summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorka <kai.ahrens@oracle.com>2011-03-28 22:51:37 +0200
committerka <kai.ahrens@oracle.com>2011-03-28 22:51:37 +0200
commit44775760807ba1d60153208899eec2d583e16fe6 (patch)
tree32b765f59e6118f804fc442cf98ffd386ec3f034
parente9fc30b6901b3af4b406bd3820125d6c607f9784 (diff)
parentd26d7768d7315d783fd143765ae68bc802c4445b (diff)
ka102: rebased to DEV300_m104
-rw-r--r--canvas/source/cairo/cairo_canvasfont.cxx5
-rw-r--r--canvas/source/cairo/cairo_textlayout.cxx311
-rwxr-xr-xcanvas/source/directx/dx_textlayout_drawhelper.cxx7
-rw-r--r--canvas/source/vcl/canvasfont.cxx5
-rw-r--r--canvas/source/vcl/canvashelper_texturefill.cxx4
-rwxr-xr-x[-rw-r--r--]canvas/source/vcl/spritehelper.cxx17
-rw-r--r--comphelper/Library_comphelp.mk1
-rw-r--r--comphelper/Package_inc.mk2
-rwxr-xr-xcomphelper/inc/comphelper/anycompare.hxx226
-rwxr-xr-xcomphelper/inc/comphelper/componentguard.hxx70
-rw-r--r--comphelper/source/container/enumerablemap.cxx205
-rwxr-xr-xcomphelper/source/misc/anycompare.cxx131
-rw-r--r--cppcanvas/inc/cppcanvas/renderer.hxx3
-rw-r--r--cppcanvas/source/mtfrenderer/implrenderer.cxx10
-rw-r--r--dtrans/source/win32/dtobj/XTDataObject.cxx2
-rw-r--r--dtrans/source/win32/dtobj/XTDataObject.hxx2
-rw-r--r--i18npool/inc/i18npool/lang.h5
-rw-r--r--i18npool/source/breakiterator/makefile.mk12
-rw-r--r--i18npool/source/calendar/calendar_gregorian.cxx6
-rw-r--r--i18npool/source/isolang/isolang.cxx9
-rw-r--r--i18npool/source/isolang/mslangid.cxx2
-rw-r--r--i18npool/source/localedata/LocaleNode.cxx77
-rw-r--r--i18npool/source/localedata/data/dsb_DE.xml350
-rw-r--r--i18npool/source/localedata/data/fi_FI.xml2
-rw-r--r--i18npool/source/localedata/data/haw_US.xml358
-rw-r--r--i18npool/source/localedata/data/hsb_DE.xml2
-rw-r--r--i18npool/source/localedata/data/ht_HT.xml358
-rw-r--r--i18npool/source/localedata/data/jbo.xml358
-rw-r--r--i18npool/source/localedata/data/lif_NP.xml357
-rw-r--r--i18npool/source/localedata/data/localedata_euro.map17
-rw-r--r--i18npool/source/localedata/data/localedata_others.map104
-rw-r--r--i18npool/source/localedata/data/makefile.mk7
-rw-r--r--i18npool/source/localedata/data/no_NO.xml2
-rw-r--r--i18npool/source/localedata/data/sv_SE.xml2
-rw-r--r--i18npool/source/localedata/data/ur_PK.xml358
-rw-r--r--i18npool/source/localedata/data/yi_US.xml163
-rw-r--r--i18npool/source/localedata/localedata.cxx7
-rw-r--r--i18npool/source/paper/paper.cxx2
-rwxr-xr-xl10ntools/scripts/localize.pl2
-rw-r--r--l10ntools/scripts/tool/l10ntool.py5
-rwxr-xr-x[-rw-r--r--]l10ntools/source/help/HelpCompiler.hxx8
-rw-r--r--l10ntools/source/help/HelpIndexerTool.java9
-rwxr-xr-x[-rw-r--r--]l10ntools/source/help/HelpLinker.cxx41
-rw-r--r--padmin/AllLangResTarget_spa.mk48
-rw-r--r--padmin/Executable_spadmin.bin.mk70
-rw-r--r--padmin/Library_spa.mk76
-rw-r--r--padmin/Makefile38
-rw-r--r--padmin/Module_padmin.mk41
-rw-r--r--padmin/Package_inc.mk30
-rw-r--r--padmin/prj/build.lst2
-rw-r--r--padmin/prj/d.lst7
-rw-r--r--padmin/prj/makefile.mk40
-rw-r--r--padmin/source/helper.hxx7
-rw-r--r--padmin/source/makefile.mk115
-rw-r--r--padmin/source/padialog.hxx2
-rw-r--r--padmin/source/padialog.src18
-rw-r--r--padmin/source/prtsetup.cxx6
-rw-r--r--rsc/source/rscpp/cpp4.c2
-rw-r--r--rsc/source/tools/rscchar.cxx16
-rw-r--r--sot/source/sdstor/stgio.cxx3
-rw-r--r--svl/inc/svl/nfkeytab.hxx14
-rw-r--r--svl/prj/build.lst2
-rw-r--r--svl/qa/complex/passwordcontainer/makefile.mk134
-rw-r--r--svl/source/numbers/zforlist.cxx14
-rw-r--r--svl/source/numbers/zformat.cxx20
-rw-r--r--svl/source/numbers/zforscan.cxx22
-rw-r--r--svl/source/numbers/zforscan.hxx2
-rw-r--r--svl/source/undo/undo.cxx2
-rw-r--r--svtools/Library_svt.mk3
-rw-r--r--svtools/Package_inc.mk4
-rwxr-xr-xsvtools/inc/svtools/accessiblefactory.hxx15
-rw-r--r--svtools/inc/svtools/accessibletable.hxx10
-rw-r--r--svtools/inc/svtools/svtools.hrc9
-rw-r--r--svtools/inc/svtools/table/abstracttablecontrol.hxx134
-rw-r--r--svtools/inc/svtools/table/defaultinputhandler.hxx41
-rw-r--r--svtools/inc/svtools/table/gridtablerenderer.hxx50
-rw-r--r--svtools/inc/svtools/table/tablecontrol.hxx165
-rw-r--r--svtools/inc/svtools/table/tablecontrolinterface.hxx254
-rw-r--r--svtools/inc/svtools/table/tableinputhandler.hxx22
-rwxr-xr-x[-rw-r--r--]svtools/inc/svtools/table/tablemodel.hxx331
-rw-r--r--svtools/inc/svtools/table/tablerenderer.hxx79
-rwxr-xr-xsvtools/inc/svtools/table/tablesort.hxx91
-rw-r--r--svtools/inc/svtools/table/tabletypes.hxx7
-rw-r--r--svtools/prj/build.lst2
-rw-r--r--svtools/qa/unoapi/makefile.mk48
-rw-r--r--svtools/source/brwbox/datwin.cxx9
-rw-r--r--svtools/source/contnr/svcontnr.src27
-rw-r--r--svtools/source/contnr/svlbox.cxx1
-rwxr-xr-x[-rw-r--r--]svtools/source/control/filectrl.src40
-rwxr-xr-xsvtools/source/control/ruler.cxx1
-rwxr-xr-xsvtools/source/control/tabbar.cxx13
-rw-r--r--svtools/source/control/toolbarmenuacc.cxx2
-rw-r--r--svtools/source/control/valueacc.cxx2
-rw-r--r--svtools/source/dialogs/colrdlg.hrc2
-rw-r--r--svtools/source/dialogs/colrdlg.src38
-rw-r--r--svtools/source/filter/FilterConfigItem.cxx4
-rw-r--r--svtools/source/inc/filectrl.hrc7
-rw-r--r--svtools/source/misc/langtab.src8
-rwxr-xr-xsvtools/source/table/cellvalueconversion.cxx77
-rwxr-xr-x[-rw-r--r--]svtools/source/table/cellvalueconversion.hxx (renamed from svtools/source/inc/accessibletableimp.hxx)48
-rw-r--r--svtools/source/table/defaultinputhandler.cxx197
-rw-r--r--svtools/source/table/gridtablerenderer.cxx663
-rwxr-xr-xsvtools/source/table/mousefunction.cxx320
-rwxr-xr-xsvtools/source/table/mousefunction.hxx161
-rw-r--r--svtools/source/table/tablecontrol.cxx788
-rwxr-xr-x[-rw-r--r--]svtools/source/table/tablecontrol_impl.cxx2601
-rwxr-xr-x[-rw-r--r--]svtools/source/table/tablecontrol_impl.hxx315
-rw-r--r--svtools/source/table/tabledatawindow.cxx199
-rw-r--r--svtools/source/table/tabledatawindow.hxx (renamed from svtools/inc/svtools/table/tabledatawindow.hxx)11
-rw-r--r--svtools/source/table/tablegeometry.cxx132
-rw-r--r--svtools/source/table/tablegeometry.hxx44
-rw-r--r--[-rwxr-xr-x]svtools/source/uno/svtxgridcontrol.cxx1045
-rwxr-xr-xsvtools/source/uno/svtxgridcontrol.hxx88
-rw-r--r--svtools/source/uno/treecontrolpeer.cxx4
-rw-r--r--svtools/source/uno/unocontroltablemodel.cxx980
-rw-r--r--svtools/source/uno/unocontroltablemodel.hxx240
-rwxr-xr-xsvtools/source/uno/unogridcolumnfacade.cxx427
-rwxr-xr-xsvtools/source/uno/unogridcolumnfacade.hxx114
-rw-r--r--svtools/source/uno/unoiface.cxx1
-rw-r--r--toolkit/Library_tk.mk2
-rw-r--r--toolkit/inc/toolkit/awt/vclxcontainer.hxx2
-rw-r--r--toolkit/inc/toolkit/awt/vclxtopwindow.hxx2
-rw-r--r--toolkit/inc/toolkit/awt/vclxwindows.hxx2
-rwxr-xr-xtoolkit/inc/toolkit/controls/animatedimages.hxx4
-rw-r--r--toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx7
-rw-r--r--toolkit/inc/toolkit/controls/dialogcontrol.hxx32
-rw-r--r--toolkit/inc/toolkit/controls/formattedcontrol.hxx9
-rw-r--r--toolkit/inc/toolkit/controls/geometrycontrolmodel.hxx3
-rw-r--r--toolkit/inc/toolkit/controls/geometrycontrolmodel_impl.hxx16
-rw-r--r--toolkit/inc/toolkit/controls/roadmapcontrol.hxx38
-rwxr-xr-xtoolkit/inc/toolkit/controls/spinningprogress.hxx2
-rw-r--r--toolkit/inc/toolkit/controls/tabpagecontainer.hxx4
-rw-r--r--toolkit/inc/toolkit/controls/tabpagemodel.hxx5
-rw-r--r--toolkit/inc/toolkit/controls/tkscrollbar.hxx4
-rw-r--r--toolkit/inc/toolkit/controls/tksimpleanimation.hxx4
-rw-r--r--toolkit/inc/toolkit/controls/tkspinbutton.hxx4
-rw-r--r--toolkit/inc/toolkit/controls/tkthrobber.hxx4
-rw-r--r--toolkit/inc/toolkit/controls/unocontrol.hxx7
-rw-r--r--toolkit/inc/toolkit/controls/unocontrolbase.hxx8
-rw-r--r--toolkit/inc/toolkit/controls/unocontrolcontainer.hxx5
-rw-r--r--toolkit/inc/toolkit/controls/unocontrolcontainermodel.hxx2
-rw-r--r--toolkit/inc/toolkit/controls/unocontrolmodel.hxx49
-rw-r--r--toolkit/inc/toolkit/controls/unocontrols.hxx95
-rw-r--r--toolkit/inc/toolkit/helper/formpdfexport.hxx14
-rw-r--r--toolkit/inc/toolkit/helper/mutexandbroadcasthelper.hxx6
-rw-r--r--toolkit/inc/toolkit/helper/property.hxx13
-rw-r--r--toolkit/inc/toolkit/helper/servicenames.hxx1
-rw-r--r--toolkit/prj/build.lst5
-rwxr-xr-xtoolkit/qa/complex/toolkit/AccessibleStatusBar.java (renamed from toolkit/qa/complex/toolkit/CheckAccessibleStatusBar.java)107
-rwxr-xr-xtoolkit/qa/complex/toolkit/AccessibleStatusBarItem.java (renamed from toolkit/qa/complex/toolkit/CheckAccessibleStatusBarItem.java)122
-rwxr-xr-xtoolkit/qa/complex/toolkit/Assert.java234
-rw-r--r--toolkit/qa/complex/toolkit/CallbackClass.java67
-rw-r--r--toolkit/qa/complex/toolkit/CheckAsyncCallback.java156
-rwxr-xr-xtoolkit/qa/complex/toolkit/GridControl.java687
-rw-r--r--toolkit/qa/complex/toolkit/UnitConversion.java247
-rw-r--r--toolkit/qa/complex/toolkit/_XRequestCallback.java88
-rwxr-xr-xtoolkit/qa/complex/toolkit/accessibility/_XAccessibleComponent.java (renamed from toolkit/qa/complex/toolkit/_XAccessibleComponent.java)3
-rwxr-xr-xtoolkit/qa/complex/toolkit/accessibility/_XAccessibleContext.java (renamed from toolkit/qa/complex/toolkit/_XAccessibleContext.java)2
-rwxr-xr-xtoolkit/qa/complex/toolkit/accessibility/_XAccessibleEventBroadcaster.java (renamed from toolkit/qa/complex/toolkit/_XAccessibleEventBroadcaster.java)14
-rwxr-xr-xtoolkit/qa/complex/toolkit/accessibility/_XAccessibleExtendedComponent.java (renamed from toolkit/qa/complex/toolkit/_XAccessibleExtendedComponent.java)2
-rwxr-xr-xtoolkit/qa/complex/toolkit/accessibility/_XAccessibleText.java (renamed from toolkit/qa/complex/toolkit/_XAccessibleText.java)2
-rwxr-xr-xtoolkit/qa/complex/toolkit/awtgrid/DummyColumn.java180
-rwxr-xr-xtoolkit/qa/complex/toolkit/awtgrid/GridDataListener.java98
-rwxr-xr-xtoolkit/qa/complex/toolkit/awtgrid/TMutableGridDataModel.java314
-rwxr-xr-xtoolkit/qa/complex/toolkit/makefile.mk97
-rw-r--r--toolkit/qa/complex/xunitconversion/XUnitConversionTest.java250
-rw-r--r--toolkit/qa/unoapi/makefile.mk48
-rw-r--r--toolkit/source/awt/vclxaccessiblecomponent.cxx4
-rwxr-xr-xtoolkit/source/controls/animatedimages.cxx10
-rw-r--r--toolkit/source/controls/controlmodelcontainerbase.cxx129
-rw-r--r--toolkit/source/controls/dialogcontrol.cxx48
-rw-r--r--toolkit/source/controls/formattedcontrol.cxx8
-rw-r--r--toolkit/source/controls/grid/defaultgridcolumnmodel.cxx460
-rw-r--r--toolkit/source/controls/grid/defaultgridcolumnmodel.hxx81
-rw-r--r--toolkit/source/controls/grid/defaultgriddatamodel.cxx567
-rw-r--r--toolkit/source/controls/grid/defaultgriddatamodel.hxx99
-rw-r--r--toolkit/source/controls/grid/gridcolumn.cxx480
-rw-r--r--toolkit/source/controls/grid/gridcolumn.hxx114
-rw-r--r--toolkit/source/controls/grid/gridcontrol.cxx313
-rw-r--r--toolkit/source/controls/grid/gridcontrol.hxx55
-rwxr-xr-xtoolkit/source/controls/grid/grideventforwarder.cxx149
-rwxr-xr-xtoolkit/source/controls/grid/grideventforwarder.hxx85
-rwxr-xr-xtoolkit/source/controls/grid/initguard.hxx64
-rwxr-xr-xtoolkit/source/controls/grid/sortablegriddatamodel.cxx877
-rwxr-xr-xtoolkit/source/controls/grid/sortablegriddatamodel.hxx198
-rw-r--r--toolkit/source/controls/roadmapcontrol.cxx8
-rwxr-xr-xtoolkit/source/controls/spinningprogress.cxx4
-rw-r--r--toolkit/source/controls/tabpagecontainer.cxx18
-rw-r--r--toolkit/source/controls/tabpagemodel.cxx20
-rw-r--r--toolkit/source/controls/tkscrollbar.cxx8
-rw-r--r--toolkit/source/controls/tksimpleanimation.cxx6
-rw-r--r--toolkit/source/controls/tkspinbutton.cxx8
-rw-r--r--toolkit/source/controls/tkthrobber.cxx6
-rw-r--r--toolkit/source/controls/tree/treecontrol.cxx20
-rw-r--r--toolkit/source/controls/tree/treecontrol.hxx7
-rw-r--r--toolkit/source/controls/unocontrol.cxx40
-rw-r--r--toolkit/source/controls/unocontrolbase.cxx9
-rw-r--r--toolkit/source/controls/unocontrolcontainer.cxx9
-rw-r--r--toolkit/source/controls/unocontrolcontainermodel.cxx3
-rw-r--r--toolkit/source/controls/unocontrolmodel.cxx64
-rw-r--r--toolkit/source/controls/unocontrols.cxx157
-rw-r--r--toolkit/source/helper/formpdfexport.cxx58
-rw-r--r--toolkit/source/helper/property.cxx22
-rw-r--r--toolkit/source/helper/registerservices.cxx299
-rw-r--r--toolkit/source/helper/servicenames.cxx1
-rw-r--r--toolkit/source/helper/unowrapper.cxx1
-rw-r--r--toolkit/source/helper/vclunohelper.cxx5
-rw-r--r--toolkit/util/tk.component5
-rw-r--r--tools/inc/tools/debug.hxx8
-rw-r--r--tools/inc/tools/mempool.hxx17
-rw-r--r--tools/inc/tools/stream.hxx17
-rw-r--r--tools/inc/tools/wintypes.hxx3
-rw-r--r--tools/source/debug/debug.cxx50
-rwxr-xr-xtools/source/memtools/mempool.cxx14
-rwxr-xr-xtools/source/stream/stream.cxx46
-rw-r--r--tools/workben/makefile.mk68
-rw-r--r--tools/workben/mempooltest.cxx18
-rw-r--r--unotools/inc/unotools/textsearch.hxx9
-rw-r--r--unotools/source/i18n/textsearch.cxx37
-rwxr-xr-xvcl/aqua/inc/salframeview.h1
-rw-r--r--vcl/aqua/inc/salgdi.h8
-rw-r--r--vcl/aqua/source/dtrans/DragSource.cxx13
-rw-r--r--vcl/aqua/source/dtrans/DropTarget.cxx43
-rw-r--r--vcl/aqua/source/dtrans/DropTarget.hxx2
-rw-r--r--vcl/aqua/source/dtrans/service_entry.cxx14
-rw-r--r--vcl/aqua/source/gdi/aquaprintaccessoryview.mm8
-rw-r--r--vcl/aqua/source/gdi/salgdi.cxx59
-rw-r--r--vcl/aqua/source/gdi/salprn.cxx32
-rwxr-xr-xvcl/aqua/source/window/salframeview.mm5
-rw-r--r--vcl/inc/vcl/cursor.hxx6
-rw-r--r--vcl/inc/vcl/cvtsvm.hxx2
-rw-r--r--vcl/inc/vcl/displayconnectiondispatch.hxx52
-rw-r--r--vcl/inc/vcl/dllapi.h6
-rw-r--r--vcl/inc/vcl/fontcache.hxx2
-rw-r--r--vcl/inc/vcl/fontmanager.hxx2
-rw-r--r--vcl/inc/vcl/glyphcache.hxx12
-rw-r--r--vcl/inc/vcl/graphite_adaptors.hxx2
-rw-r--r--vcl/inc/vcl/graphite_layout.hxx6
-rw-r--r--vcl/inc/vcl/graphite_serverfont.hxx8
-rw-r--r--vcl/inc/vcl/help.hxx38
-rw-r--r--vcl/inc/vcl/helpwin.hxx3
-rw-r--r--vcl/inc/vcl/impfont.hxx8
-rw-r--r--vcl/inc/vcl/lineinfo.hxx2
-rw-r--r--vcl/inc/vcl/octree.hxx6
-rwxr-xr-x[-rw-r--r--]vcl/inc/vcl/outdev.hxx6
-rw-r--r--vcl/inc/vcl/outfont.hxx6
-rw-r--r--vcl/inc/vcl/pdfextoutdevdata.hxx34
-rw-r--r--vcl/inc/vcl/pdfwriter.hxx32
-rw-r--r--vcl/inc/vcl/print.h2
-rw-r--r--vcl/inc/vcl/print.hxx17
-rw-r--r--vcl/inc/vcl/prndlg.hxx6
-rwxr-xr-x[-rw-r--r--]vcl/inc/vcl/region.hxx13
-rw-r--r--vcl/inc/vcl/salbmp.hxx2
-rw-r--r--vcl/inc/vcl/saldatabasic.hxx2
-rw-r--r--vcl/inc/vcl/salframe.hxx2
-rwxr-xr-x[-rw-r--r--]vcl/inc/vcl/salgdi.hxx15
-rw-r--r--vcl/inc/vcl/salimestatus.hxx2
-rw-r--r--vcl/inc/vcl/salinst.hxx38
-rwxr-xr-xvcl/inc/vcl/sallayout.hxx12
-rw-r--r--vcl/inc/vcl/salmenu.hxx4
-rwxr-xr-xvcl/inc/vcl/salnativewidgets.hxx2
-rw-r--r--vcl/inc/vcl/salobj.hxx2
-rw-r--r--vcl/inc/vcl/salprn.hxx6
-rw-r--r--vcl/inc/vcl/salsession.hxx2
-rw-r--r--vcl/inc/vcl/salsys.hxx2
-rw-r--r--vcl/inc/vcl/saltimer.hxx2
-rw-r--r--vcl/inc/vcl/salvd.hxx2
-rw-r--r--vcl/inc/vcl/svdata.hxx18
-rw-r--r--vcl/inc/vcl/svids.hrc4
-rw-r--r--vcl/inc/vcl/sysdata.hxx5
-rw-r--r--vcl/inc/vcl/syswin.hxx2
-rw-r--r--vcl/inc/vcl/window.h18
-rw-r--r--[-rwxr-xr-x]vcl/inc/vcl/window.hxx14
-rw-r--r--vcl/inc/vcl/xconnection.hxx15
-rw-r--r--vcl/os2/inc/salgdi.h8
-rw-r--r--vcl/os2/source/gdi/salgdi.cxx50
-rw-r--r--vcl/prj/build.lst2
-rw-r--r--vcl/source/app/dbggui.cxx20
-rw-r--r--vcl/source/app/help.cxx47
-rw-r--r--vcl/source/app/session.cxx36
-rw-r--r--vcl/source/app/svapp.cxx5
-rw-r--r--vcl/source/app/svdata.cxx15
-rw-r--r--vcl/source/app/svmain.cxx20
-rwxr-xr-xvcl/source/control/edit.cxx24
-rw-r--r--vcl/source/control/ilstbox.cxx2
-rw-r--r--vcl/source/control/tabctrl.cxx19
-rw-r--r--vcl/source/gdi/bitmap.cxx10
-rw-r--r--vcl/source/gdi/jobset.cxx7
-rw-r--r--vcl/source/gdi/lineinfo.cxx22
-rwxr-xr-x[-rw-r--r--]vcl/source/gdi/outdev.cxx847
-rw-r--r--vcl/source/gdi/outdev3.cxx8
-rw-r--r--vcl/source/gdi/pdfextoutdevdata.cxx53
-rw-r--r--vcl/source/gdi/pdfwriter.cxx4
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx314
-rw-r--r--vcl/source/gdi/pdfwriter_impl.hxx15
-rw-r--r--vcl/source/gdi/pdfwriter_impl2.cxx512
-rw-r--r--vcl/source/gdi/print.cxx44
-rw-r--r--vcl/source/gdi/print2.cxx35
-rwxr-xr-xvcl/source/gdi/print3.cxx43
-rwxr-xr-x[-rw-r--r--]vcl/source/gdi/region.cxx193
-rwxr-xr-xvcl/source/gdi/salgdilayout.cxx60
-rw-r--r--vcl/source/helper/xconnection.cxx77
-rw-r--r--vcl/source/src/print.src60
-rw-r--r--vcl/source/window/cursor.cxx20
-rw-r--r--vcl/source/window/dlgctrl.cxx73
-rw-r--r--vcl/source/window/msgbox.cxx2
-rwxr-xr-x[-rw-r--r--]vcl/source/window/printdlg.cxx44
-rw-r--r--vcl/source/window/window.cxx158
-rw-r--r--vcl/source/window/winproc.cxx8
-rw-r--r--vcl/unx/gtk/app/gtkdata.cxx6
-rw-r--r--vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx25
-rw-r--r--vcl/unx/headless/svpgdi.cxx50
-rw-r--r--vcl/unx/headless/svpgdi.hxx5
-rw-r--r--vcl/unx/headless/svppspgraphics.cxx36
-rw-r--r--vcl/unx/headless/svppspgraphics.hxx5
-rw-r--r--vcl/unx/inc/dtint.hxx2
-rw-r--r--vcl/unx/inc/plugins/gtk/gtkgdi.hxx5
-rw-r--r--vcl/unx/inc/pspgraphics.h5
-rw-r--r--vcl/unx/inc/saldisp.hxx2
-rw-r--r--vcl/unx/inc/salgdi.h8
-rw-r--r--vcl/unx/kde4/KDEData.cxx2
-rw-r--r--vcl/unx/kde4/KDEData.hxx2
-rw-r--r--vcl/unx/kde4/KDESalDisplay.cxx2
-rw-r--r--vcl/unx/kde4/KDESalFrame.cxx16
-rw-r--r--vcl/unx/kde4/KDESalFrame.hxx6
-rw-r--r--vcl/unx/kde4/KDESalGraphics.cxx22
-rw-r--r--vcl/unx/kde4/KDESalGraphics.hxx14
-rw-r--r--vcl/unx/kde4/KDESalInstance.cxx4
-rw-r--r--vcl/unx/kde4/KDESalInstance.hxx4
-rw-r--r--vcl/unx/kde4/KDEXLib.cxx2
-rw-r--r--vcl/unx/kde4/VCLKDEApplication.cxx2
-rw-r--r--vcl/unx/kde4/VCLKDEApplication.hxx2
-rw-r--r--vcl/unx/source/app/saldisp.cxx32
-rw-r--r--vcl/unx/source/dtrans/X11_clipboard.hxx26
-rw-r--r--vcl/unx/source/dtrans/X11_dndcontext.hxx6
-rw-r--r--vcl/unx/source/dtrans/X11_selection.cxx68
-rw-r--r--vcl/unx/source/dtrans/X11_selection.hxx39
-rw-r--r--vcl/unx/source/dtrans/X11_service.cxx24
-rw-r--r--vcl/unx/source/dtrans/X11_transferable.hxx4
-rw-r--r--vcl/unx/source/fontmanager/fontmanager.cxx10
-rw-r--r--vcl/unx/source/gdi/pspgraphics.cxx36
-rw-r--r--vcl/unx/source/gdi/salgdi.cxx108
-rw-r--r--vcl/unx/source/gdi/salgdi2.cxx12
-rw-r--r--vcl/unx/source/gdi/salgdi3.cxx24
-rw-r--r--vcl/unx/source/gdi/salprnpsp.cxx2
-rwxr-xr-xvcl/win/inc/salgdi.h10
-rwxr-xr-x[-rw-r--r--]vcl/win/source/gdi/salgdi.cxx217
-rwxr-xr-x[-rw-r--r--]vcl/win/source/gdi/salgdi2.cxx3
-rwxr-xr-x[-rw-r--r--]vcl/win/source/gdi/salprn.cxx9
-rwxr-xr-xvcl/win/source/window/salframe.cxx7
350 files changed, 18022 insertions, 8428 deletions
diff --git a/canvas/source/cairo/cairo_canvasfont.cxx b/canvas/source/cairo/cairo_canvasfont.cxx
index e90276f2ba33..5da2e10e7969 100644
--- a/canvas/source/cairo/cairo_canvasfont.cxx
+++ b/canvas/source/cairo/cairo_canvasfont.cxx
@@ -30,6 +30,8 @@
#include <canvas/debug.hxx>
+#include <com/sun/star/rendering/PanoseProportion.hpp>
+
#include <rtl/math.hxx>
#include <basegfx/numeric/ftools.hxx>
@@ -83,6 +85,9 @@ namespace cairocanvas
// TODO(F2): improve panose->vclenum conversion
maFont->SetWeight( static_cast<FontWeight>(rFontRequest.FontDescription.FontDescription.Weight) );
maFont->SetItalic( (rFontRequest.FontDescription.FontDescription.Letterform<=8) ? ITALIC_NONE : ITALIC_NORMAL );
+ maFont->SetPitch(
+ rFontRequest.FontDescription.FontDescription.Proportion == rendering::PanoseProportion::MONO_SPACED
+ ? PITCH_FIXED : PITCH_VARIABLE);
maFont->SetLanguage(MsLangId::convertLocaleToLanguage(rFontRequest.Locale));
diff --git a/canvas/source/cairo/cairo_textlayout.cxx b/canvas/source/cairo/cairo_textlayout.cxx
index 1da9197693ff..725a6ae0f2a6 100644
--- a/canvas/source/cairo/cairo_textlayout.cxx
+++ b/canvas/source/cairo/cairo_textlayout.cxx
@@ -105,6 +105,11 @@ namespace cairocanvas
// as required at the API spec
rOutDev.SetLayoutMode( nLayoutMode | TEXT_LAYOUT_TEXTORIGIN_LEFT );
}
+
+ bool compareFallbacks(const SystemGlyphData&rA, const SystemGlyphData &rB)
+ {
+ return rA.fallbacklevel < rB.fallbacklevel;
+ }
}
TextLayout::TextLayout( const rendering::StringContext& aText,
@@ -363,7 +368,6 @@ namespace cairocanvas
return true;
}
-
/**
* TextLayout::draw
*
@@ -404,18 +408,41 @@ namespace cairocanvas
::canvas::tools::numeric_cast<USHORT>(maText.Length),
maLogicalAdvancements.getLength() ? aOffsets.get() : NULL);
+ // Sort them so that all glyphs on the same glyph fallback level are consecutive
+ std::sort(aSysLayoutData.rGlyphData.begin(), aSysLayoutData.rGlyphData.end(), compareFallbacks);
+ bool bCairoRenderable = true;
+
+ //Pull all the fonts we need to render the text
+ typedef std::pair<SystemFontData,int> FontLevel;
+ typedef std::vector<FontLevel> FontLevelVector;
+ FontLevelVector aFontData;
+ SystemGlyphDataVector::const_iterator aIter=aSysLayoutData.rGlyphData.begin();
+ const SystemGlyphDataVector::const_iterator aEnd=aSysLayoutData.rGlyphData.end();
+ for( ; aIter != aEnd; ++aIter )
+ {
+ if( aFontData.empty() || aIter->fallbacklevel != aFontData.back().second )
+ {
+ aFontData.push_back(FontLevel(rOutDev.GetSysFontData(aIter->fallbacklevel),
+ aIter->fallbacklevel));
+ if( !isCairoRenderable(aFontData.back().first) )
+ {
+ bCairoRenderable = false;
+ OSL_TRACE(":cairocanvas::TextLayout::draw(S,O,p,v,r): VCL FALLBACK %s%s%s%s - %s",
+ maLogicalAdvancements.getLength() ? "ADV " : "",
+ aFontData.back().first.bAntialias ? "AA " : "",
+ aFontData.back().first.bFakeBold ? "FB " : "",
+ aFontData.back().first.bFakeItalic ? "FI " : "",
+ ::rtl::OUStringToOString( maText.Text.copy( maText.StartPosition, maText.Length ),
+ RTL_TEXTENCODING_UTF8 ).getStr());
+ break;
+ }
+ }
+ }
+
// The ::GetSysTextLayoutData(), i.e. layouting of text to glyphs can change the font being used.
// The fallback checks need to be done after final font is known.
- if (!isCairoRenderable(aSysLayoutData.aSysFontData)) // VCL FALLBACKS
+ if (!bCairoRenderable) // VCL FALLBACKS
{
- OSL_TRACE(":cairocanvas::TextLayout::draw(S,O,p,v,r): VCL FALLBACK %s%s%s%s - %s",
- maLogicalAdvancements.getLength() ? "ADV " : "",
- aSysLayoutData.aSysFontData.bAntialias ? "AA " : "",
- aSysLayoutData.aSysFontData.bFakeBold ? "FB " : "",
- aSysLayoutData.aSysFontData.bFakeItalic ? "FI " : "",
- ::rtl::OUStringToOString( maText.Text.copy( maText.StartPosition, maText.Length ),
- RTL_TEXTENCODING_UTF8 ).getStr());
-
if (maLogicalAdvancements.getLength()) // VCL FALLBACK - with glyph advances
{
rOutDev.DrawTextArray( rOutpos, maText.Text, aOffsets.get(),
@@ -438,144 +465,158 @@ namespace cairocanvas
* Setup platform independent glyph vector into cairo-based glyphs vector.
**/
- // setup glyphs
- std::vector<cairo_glyph_t> cairo_glyphs;
- cairo_glyphs.reserve( 256 );
-
- for( int nStart = 0; nStart < (int) aSysLayoutData.rGlyphData.size(); nStart++ )
+ // Loop through the fonts used and render the matching glyphs for each
+ FontLevelVector::const_iterator aFontDataIter = aFontData.begin();
+ const FontLevelVector::const_iterator aFontDataEnd = aFontData.end();
+ for( ; aFontDataIter != aFontDataEnd; ++aFontDataIter )
{
- cairo_glyph_t aGlyph;
- SystemGlyphData systemGlyph = aSysLayoutData.rGlyphData.at(nStart);
- aGlyph.index = systemGlyph.index;
-#ifdef CAIRO_HAS_WIN32_SURFACE
- // Cairo requires standard glyph indexes (ETO_GLYPH_INDEX), while vcl/win/* uses ucs4 chars.
- // Convert to standard indexes
- aGlyph.index = cairo::ucs4toindex((unsigned int) aGlyph.index, aSysLayoutData.aSysFontData.hFont);
-#endif
- aGlyph.x = systemGlyph.x;
- aGlyph.y = systemGlyph.y;
- cairo_glyphs.push_back(aGlyph);
- }
-
- if (cairo_glyphs.empty()) return true; //true or false??
-
- /**
- * Setup font
- **/
- cairo_font_face_t* font_face = NULL;
-
-#ifdef CAIRO_HAS_QUARTZ_SURFACE
- // TODO: use cairo_quartz_font_face_create_for_cgfont(cgFont)
- // when CGFont (Mac OS X 10.5 API) is provided by the AQUA VCL backend.
- font_face = cairo_quartz_font_face_create_for_atsu_font_id((ATSUFontID) aSysLayoutData.aSysFontData.aATSUFontID);
+ const SystemFontData &rSysFontData = aFontDataIter->first;
-#elif defined CAIRO_HAS_WIN32_SURFACE
- #if (OSL_DEBUG_LEVEL > 1)
- GetObjectW( aSysLayoutData.aSysFontData.hFont, sizeof(logfont), &logfont );
- #endif
- // Note: cairo library uses logfont fallbacks when lfEscapement, lfOrientation and lfWidth are not zero.
- // VCL always has non-zero value for lfWidth
- font_face = cairo_win32_font_face_create_for_hfont(aSysLayoutData.aSysFontData.hFont);
-
-#elif defined CAIRO_HAS_XLIB_SURFACE
- font_face = cairo_ft_font_face_create_for_ft_face((FT_Face)aSysLayoutData.aSysFontData.nFontId,
- aSysLayoutData.aSysFontData.nFontFlags);
-#else
-# error Native API needed.
-#endif
-
- CairoSharedPtr pSCairo = pSurface->getCairo();
-
- cairo_set_font_face( pSCairo.get(), font_face);
-
- // create default font options. cairo_get_font_options() does not retrieve the surface defaults,
- // only what has been set before with cairo_set_font_options()
- cairo_font_options_t* options = cairo_font_options_create();
- if (aSysLayoutData.aSysFontData.bAntialias) {
- // CAIRO_ANTIALIAS_GRAY provides more similar result to VCL Canvas,
- // so we're not using CAIRO_ANTIALIAS_SUBPIXEL
- cairo_font_options_set_antialias(options, CAIRO_ANTIALIAS_GRAY);
- }
- cairo_set_font_options( pSCairo.get(), options);
-
- // Font color
- Color mTextColor = rOutDev.GetTextColor();
- cairo_set_source_rgb(pSCairo.get(),
- mTextColor.GetRed()/255.0,
- mTextColor.GetGreen()/255.0,
- mTextColor.GetBlue()/255.0);
-
- // Font rotation and scaling
- cairo_matrix_t m;
- Font aFont = rOutDev.GetFont();
- FontMetric aMetric( rOutDev.GetFontMetric(aFont) );
- long nWidth = 0;
-
- // width calculation is deep magic and platform/font dependant.
- // width == 0 means no scaling, and usually width == height means the same.
- // Other values mean horizontal scaling (narrow or stretching)
- // see issue #101566
-
- //proper scale calculation across platforms
- if (aFont.GetWidth() == 0) {
- nWidth = aFont.GetHeight();
- } else {
- // any scaling needs to be relative to the platform-dependent definition
- // of height of the font
- nWidth = aFont.GetWidth() * aFont.GetHeight() / aMetric.GetHeight();
- }
-
- cairo_matrix_init_identity(&m);
+ // setup glyphs
+ std::vector<cairo_glyph_t> cairo_glyphs;
+ cairo_glyphs.reserve( 256 );
- if (aSysLayoutData.orientation) cairo_matrix_rotate(&m, (3600 - aSysLayoutData.orientation) * M_PI / 1800.0);
+ SystemGlyphDataVector::const_iterator aIter=aSysLayoutData.rGlyphData.begin();
+ const SystemGlyphDataVector::const_iterator aEnd=aSysLayoutData.rGlyphData.end();
+ for( ; aIter != aEnd; ++aIter )
+ {
+ SystemGlyphData systemGlyph = *aIter;
+ if( systemGlyph.fallbacklevel != aFontDataIter->second )
+ continue;
+
+ cairo_glyph_t aGlyph;
+ aGlyph.index = systemGlyph.index;
+ #ifdef CAIRO_HAS_WIN32_SURFACE
+ // Cairo requires standard glyph indexes (ETO_GLYPH_INDEX), while vcl/win/* uses ucs4 chars.
+ // Convert to standard indexes
+ aGlyph.index = cairo::ucs4toindex((unsigned int) aGlyph.index, rSysFontData.hFont);
+ #endif
+ aGlyph.x = systemGlyph.x;
+ aGlyph.y = systemGlyph.y;
+ cairo_glyphs.push_back(aGlyph);
+ }
- cairo_matrix_scale(&m, nWidth, aFont.GetHeight());
+ if (cairo_glyphs.empty())
+ continue;
+
+ /**
+ * Setup font
+ **/
+ cairo_font_face_t* font_face = NULL;
+
+ #ifdef CAIRO_HAS_QUARTZ_SURFACE
+ // TODO: use cairo_quartz_font_face_create_for_cgfont(cgFont)
+ // when CGFont (Mac OS X 10.5 API) is provided by the AQUA VCL backend.
+ font_face = cairo_quartz_font_face_create_for_atsu_font_id((ATSUFontID) rSysFontData.aATSUFontID);
+
+ #elif defined CAIRO_HAS_WIN32_SURFACE
+ #if (OSL_DEBUG_LEVEL > 1)
+ GetObjectW( rSysFontData.hFont, sizeof(logfont), &logfont );
+ #endif
+ // Note: cairo library uses logfont fallbacks when lfEscapement, lfOrientation and lfWidth are not zero.
+ // VCL always has non-zero value for lfWidth
+ font_face = cairo_win32_font_face_create_for_hfont(rSysFontData.hFont);
+
+ #elif defined CAIRO_HAS_XLIB_SURFACE
+ font_face = cairo_ft_font_face_create_for_ft_face((FT_Face)rSysFontData.nFontId,
+ rSysFontData.nFontFlags);
+ #else
+ # error Native API needed.
+ #endif
+
+ CairoSharedPtr pSCairo = pSurface->getCairo();
+
+ cairo_set_font_face( pSCairo.get(), font_face);
+
+ // create default font options. cairo_get_font_options() does not retrieve the surface defaults,
+ // only what has been set before with cairo_set_font_options()
+ cairo_font_options_t* options = cairo_font_options_create();
+ if (rSysFontData.bAntialias) {
+ // CAIRO_ANTIALIAS_GRAY provides more similar result to VCL Canvas,
+ // so we're not using CAIRO_ANTIALIAS_SUBPIXEL
+ cairo_font_options_set_antialias(options, CAIRO_ANTIALIAS_GRAY);
+ }
+ cairo_set_font_options( pSCairo.get(), options);
+
+ // Font color
+ Color mTextColor = rOutDev.GetTextColor();
+ cairo_set_source_rgb(pSCairo.get(),
+ mTextColor.GetRed()/255.0,
+ mTextColor.GetGreen()/255.0,
+ mTextColor.GetBlue()/255.0);
+
+ // Font rotation and scaling
+ cairo_matrix_t m;
+ Font aFont = rOutDev.GetFont();
+ FontMetric aMetric( rOutDev.GetFontMetric(aFont) );
+ long nWidth = 0;
+
+ // width calculation is deep magic and platform/font dependant.
+ // width == 0 means no scaling, and usually width == height means the same.
+ // Other values mean horizontal scaling (narrow or stretching)
+ // see issue #101566
+
+ //proper scale calculation across platforms
+ if (aFont.GetWidth() == 0) {
+ nWidth = aFont.GetHeight();
+ } else {
+ // any scaling needs to be relative to the platform-dependent definition
+ // of height of the font
+ nWidth = aFont.GetWidth() * aFont.GetHeight() / aMetric.GetHeight();
+ }
- //faux italics
- if (aSysLayoutData.aSysFontData.bFakeItalic) m.xy = -m.xx * 0x6000L / 0x10000L;
+ cairo_matrix_init_identity(&m);
- cairo_set_font_matrix(pSCairo.get(), &m);
+ if (aSysLayoutData.orientation) cairo_matrix_rotate(&m, (3600 - aSysLayoutData.orientation) * M_PI / 1800.0);
- OSL_TRACE("\r\n:cairocanvas::TextLayout::draw(S,O,p,v,r): Size:(%d,%d), W:%d->%d, Pos (%d,%d), G(%d,%d,%d) %s%s%s%s || Name:%s - %s",
- aFont.GetWidth(),
- aFont.GetHeight(),
- aMetric.GetWidth(),
- nWidth,
- (int) rOutpos.X(),
- (int) rOutpos.Y(),
- cairo_glyphs[0].index, cairo_glyphs[1].index, cairo_glyphs[2].index,
- maLogicalAdvancements.getLength() ? "ADV " : "",
- aSysLayoutData.aSysFontData.bAntialias ? "AA " : "",
- aSysLayoutData.aSysFontData.bFakeBold ? "FB " : "",
- aSysLayoutData.aSysFontData.bFakeItalic ? "FI " : "",
-#if (defined CAIRO_HAS_WIN32_SURFACE) && (OSL_DEBUG_LEVEL > 1)
- ::rtl::OUStringToOString( reinterpret_cast<const sal_Unicode*> (logfont.lfFaceName), RTL_TEXTENCODING_UTF8 ).getStr(),
-#else
- ::rtl::OUStringToOString( aFont.GetName(), RTL_TEXTENCODING_UTF8 ).getStr(),
-#endif
- ::rtl::OUStringToOString( maText.Text.copy( maText.StartPosition, maText.Length ),
- RTL_TEXTENCODING_UTF8 ).getStr()
- );
+ cairo_matrix_scale(&m, nWidth, aFont.GetHeight());
- cairo_show_glyphs(pSCairo.get(), &cairo_glyphs[0], cairo_glyphs.size());
+ //faux italics
+ if (rSysFontData.bFakeItalic) m.xy = -m.xx * 0x6000L / 0x10000L;
- //faux bold
- if (aSysLayoutData.aSysFontData.bFakeBold) {
- double bold_dx = 0.5 * sqrt( 0.7 * aFont.GetHeight() );
- int total_steps = 2 * ((int) (bold_dx + 0.5));
+ cairo_set_font_matrix(pSCairo.get(), &m);
- // loop to draw the text for every half pixel of displacement
- for (int nSteps = 0; nSteps < total_steps; nSteps++) {
- for(int nGlyphIdx = 0; nGlyphIdx < (int) cairo_glyphs.size(); nGlyphIdx++) {
- cairo_glyphs[nGlyphIdx].x += bold_dx * nSteps / total_steps;
+ OSL_TRACE("\r\n:cairocanvas::TextLayout::draw(S,O,p,v,r): Size:(%d,%d), W:%d->%d, Pos (%d,%d), G(%d,%d,%d) %s%s%s%s || Name:%s - %s",
+ aFont.GetWidth(),
+ aFont.GetHeight(),
+ aMetric.GetWidth(),
+ nWidth,
+ (int) rOutpos.X(),
+ (int) rOutpos.Y(),
+ cairo_glyphs[0].index, cairo_glyphs[1].index, cairo_glyphs[2].index,
+ maLogicalAdvancements.getLength() ? "ADV " : "",
+ rSysFontData.bAntialias ? "AA " : "",
+ rSysFontData.bFakeBold ? "FB " : "",
+ rSysFontData.bFakeItalic ? "FI " : "",
+ #if (defined CAIRO_HAS_WIN32_SURFACE) && (OSL_DEBUG_LEVEL > 1)
+ ::rtl::OUStringToOString( reinterpret_cast<const sal_Unicode*> (logfont.lfFaceName), RTL_TEXTENCODING_UTF8 ).getStr(),
+ #else
+ ::rtl::OUStringToOString( aFont.GetName(), RTL_TEXTENCODING_UTF8 ).getStr(),
+ #endif
+ ::rtl::OUStringToOString( maText.Text.copy( maText.StartPosition, maText.Length ),
+ RTL_TEXTENCODING_UTF8 ).getStr()
+ );
+
+ cairo_show_glyphs(pSCairo.get(), &cairo_glyphs[0], cairo_glyphs.size());
+
+ //faux bold
+ if (rSysFontData.bFakeBold) {
+ double bold_dx = 0.5 * sqrt( 0.7 * aFont.GetHeight() );
+ int total_steps = 2 * ((int) (bold_dx + 0.5));
+
+ // loop to draw the text for every half pixel of displacement
+ for (int nSteps = 0; nSteps < total_steps; nSteps++) {
+ for(int nGlyphIdx = 0; nGlyphIdx < (int) cairo_glyphs.size(); nGlyphIdx++) {
+ cairo_glyphs[nGlyphIdx].x += bold_dx * nSteps / total_steps;
+ }
+ cairo_show_glyphs(pSCairo.get(), &cairo_glyphs[0], cairo_glyphs.size());
}
- cairo_show_glyphs(pSCairo.get(), &cairo_glyphs[0], cairo_glyphs.size());
+ OSL_TRACE(":cairocanvas::TextLayout::draw(S,O,p,v,r): FAKEBOLD - dx:%d", (int) bold_dx);
}
- OSL_TRACE(":cairocanvas::TextLayout::draw(S,O,p,v,r): FAKEBOLD - dx:%d", (int) bold_dx);
- }
- cairo_restore( pSCairo.get() );
- cairo_font_face_destroy(font_face);
+ cairo_restore( pSCairo.get() );
+ cairo_font_face_destroy(font_face);
+ }
return true;
}
diff --git a/canvas/source/directx/dx_textlayout_drawhelper.cxx b/canvas/source/directx/dx_textlayout_drawhelper.cxx
index b246cf5bedeb..7fd29805e2f7 100755
--- a/canvas/source/directx/dx_textlayout_drawhelper.cxx
+++ b/canvas/source/directx/dx_textlayout_drawhelper.cxx
@@ -39,6 +39,7 @@
#include <boost/scoped_array.hpp>
#include <boost/bind.hpp>
#include <com/sun/star/rendering/FontRequest.hpp>
+#include <com/sun/star/rendering/PanoseProportion.hpp>
#include <com/sun/star/rendering/XCanvasFont.hpp>
#include <comphelper/sequence.hxx>
#include <comphelper/scopeguard.hxx>
@@ -132,6 +133,9 @@ namespace dxcanvas
aFont.SetVertical( (rFontRequest.FontDescription.IsVertical==com::sun::star::util::TriState_YES) ? sal_True : sal_False );
aFont.SetWeight( static_cast<FontWeight>(rFontRequest.FontDescription.FontDescription.Weight) );
aFont.SetItalic( (rFontRequest.FontDescription.FontDescription.Letterform<=8) ? ITALIC_NONE : ITALIC_NORMAL );
+ aFont.SetPitch(
+ rFontRequest.FontDescription.FontDescription.Proportion == rendering::PanoseProportion::MONO_SPACED
+ ? PITCH_FIXED : PITCH_VARIABLE);
aFont.SetLanguage(MsLangId::convertLocaleToLanguage(rFontRequest.Locale));
@@ -264,6 +268,9 @@ namespace dxcanvas
aFont.SetVertical( (rFontRequest.FontDescription.IsVertical==com::sun::star::util::TriState_YES) ? sal_True : sal_False );
aFont.SetWeight( static_cast<FontWeight>(rFontRequest.FontDescription.FontDescription.Weight) );
aFont.SetItalic( (rFontRequest.FontDescription.FontDescription.Letterform<=8) ? ITALIC_NONE : ITALIC_NORMAL );
+ aFont.SetPitch(
+ rFontRequest.FontDescription.FontDescription.Proportion == rendering::PanoseProportion::MONO_SPACED
+ ? PITCH_FIXED : PITCH_VARIABLE);
// adjust to stretched font
if(!::rtl::math::approxEqual(rFontMatrix.m00, rFontMatrix.m11))
diff --git a/canvas/source/vcl/canvasfont.cxx b/canvas/source/vcl/canvasfont.cxx
index 4ca0084983db..9f10c788bd24 100644
--- a/canvas/source/vcl/canvasfont.cxx
+++ b/canvas/source/vcl/canvasfont.cxx
@@ -35,6 +35,8 @@
#include <i18npool/mslangid.hxx>
#include <vcl/metric.hxx>
+#include <com/sun/star/rendering/PanoseProportion.hpp>
+
#include "canvasfont.hxx"
#include "textlayout.hxx"
@@ -63,6 +65,9 @@ namespace vclcanvas
// TODO(F2): improve panose->vclenum conversion
maFont->SetWeight( static_cast<FontWeight>(rFontRequest.FontDescription.FontDescription.Weight) );
maFont->SetItalic( (rFontRequest.FontDescription.FontDescription.Letterform<=8) ? ITALIC_NONE : ITALIC_NORMAL );
+ maFont->SetPitch(
+ rFontRequest.FontDescription.FontDescription.Proportion == rendering::PanoseProportion::MONO_SPACED
+ ? PITCH_FIXED : PITCH_VARIABLE);
maFont->SetLanguage(MsLangId::convertLocaleToLanguage(rFontRequest.Locale));
diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx
index 077b30d5b904..00eb7c1ba071 100644
--- a/canvas/source/vcl/canvashelper_texturefill.cxx
+++ b/canvas/source/vcl/canvashelper_texturefill.cxx
@@ -211,6 +211,8 @@ namespace vclcanvas
if( (rColors.size() % 2) != (nStepCount % 2) )
++nStepCount;
+ rOutDev.SetLineColor();
+
basegfx::tools::KeyStopLerp aLerper(rValues.maStops);
// only iterate nStepCount-1 steps, as the last strip is
@@ -366,6 +368,8 @@ namespace vclcanvas
// color).
++nStepCount;
+ rOutDev.SetLineColor();
+
basegfx::tools::KeyStopLerp aLerper(rValues.maStops);
if( !bFillNonOverlapping )
diff --git a/canvas/source/vcl/spritehelper.cxx b/canvas/source/vcl/spritehelper.cxx
index 774a43ae3855..af1a2f9ccd4d 100644..100755
--- a/canvas/source/vcl/spritehelper.cxx
+++ b/canvas/source/vcl/spritehelper.cxx
@@ -341,21 +341,8 @@ namespace vclcanvas
else
#endif
{
- // redraw is direcly on the front buffer,
- // or using alpha blending - cannot use
- // XOR, thus, employing the still somewhat
- // speedier triangle clip method
- ::basegfx::B2DPolygon aTriangulatedClip(::basegfx::triangulator::triangulate(aClipPoly));
-
- // restrict the clipping area to the visible portion of the output device.
- Size aSize(rTargetSurface.GetOutputSizePixel());
- ::basegfx::B2DRange aOutputRect(::basegfx::B2DPoint(0,0),::basegfx::B2DPoint(aSize.Width(),aSize.Height()));
- ::basegfx::B2DPolygon aClippedClip(::basegfx::tools::clipTriangleListOnRange(aTriangulatedClip,aOutputRect));
-
- // #i76339#
- const Polygon aPoly(aClippedClip);
- const PolyPolygon aPolyPoly(aPoly);
- rTargetSurface.SetTriangleClipRegion(aPolyPoly);
+ Region aClipRegion( aClipPoly );
+ rTargetSurface.SetClipRegion( aClipRegion );
}
}
}
diff --git a/comphelper/Library_comphelp.mk b/comphelper/Library_comphelp.mk
index f077c1db4973..0228d80b2f89 100644
--- a/comphelper/Library_comphelp.mk
+++ b/comphelper/Library_comphelp.mk
@@ -113,6 +113,7 @@ $(eval $(call gb_Library_add_exception_objects,comphelper,\
comphelper/source/misc/serviceinfohelper \
comphelper/source/misc/sharedmutex \
comphelper/source/misc/stillreadwriteinteraction \
+ comphelper/source/misc/anycompare \
comphelper/source/misc/storagehelper \
comphelper/source/misc/string \
comphelper/source/misc/synchronousdispatch \
diff --git a/comphelper/Package_inc.mk b/comphelper/Package_inc.mk
index dcfb4954efb1..5794c56ab74d 100644
--- a/comphelper/Package_inc.mk
+++ b/comphelper/Package_inc.mk
@@ -35,6 +35,7 @@ $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/basicio.hxx,comp
$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/classids.hxx,comphelper/classids.hxx))
$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/MasterPropertySet.hxx,comphelper/MasterPropertySet.hxx))
$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/stillreadwriteinteraction.hxx,comphelper/stillreadwriteinteraction.hxx))
+$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/anycompare.hxx,comphelper/anycompare.hxx))
$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/propagg.hxx,comphelper/propagg.hxx))
$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/scopeguard.hxx,comphelper/scopeguard.hxx))
$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/asyncnotification.hxx,comphelper/asyncnotification.hxx))
@@ -110,6 +111,7 @@ $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/numbers.hxx,comp
$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/evtlistenerhlp.hxx,comphelper/evtlistenerhlp.hxx))
$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/optional.hxx,comphelper/optional.hxx))
$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/componentbase.hxx,comphelper/componentbase.hxx))
+$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/componentguard.hxx,comphelper/componentguard.hxx))
$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/InlineContainer.hxx,comphelper/InlineContainer.hxx))
$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/propertybag.hxx,comphelper/propertybag.hxx))
$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/embeddedobjectcontainer.hxx,comphelper/embeddedobjectcontainer.hxx))
diff --git a/comphelper/inc/comphelper/anycompare.hxx b/comphelper/inc/comphelper/anycompare.hxx
new file mode 100755
index 000000000000..03f41e108ba9
--- /dev/null
+++ b/comphelper/inc/comphelper/anycompare.hxx
@@ -0,0 +1,226 @@
+/*************************************************************************
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef COMPHELPER_ANYCOMPARE_HXX
+#define COMPHELPER_ANYCOMPARE_HXX
+
+#include "comphelper/comphelperdllapi.h"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/i18n/XCollator.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/extract.hxx>
+
+#include <functional>
+#include <memory>
+
+//......................................................................................................................
+namespace comphelper
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= IKeyPredicateLess
+ //==================================================================================================================
+ class SAL_NO_VTABLE IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const = 0;
+ virtual ~IKeyPredicateLess() {}
+ };
+
+ //==================================================================================================================
+ //= LessPredicateAdapter
+ //==================================================================================================================
+ struct LessPredicateAdapter : public ::std::binary_function< ::com::sun::star::uno::Any, ::com::sun::star::uno::Any, bool >
+ {
+ LessPredicateAdapter( const IKeyPredicateLess& _predicate )
+ :m_predicate( _predicate )
+ {
+ }
+
+ bool operator()( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const
+ {
+ return m_predicate.isLess( _lhs, _rhs );
+ }
+
+ private:
+ IKeyPredicateLess const & m_predicate;
+
+ private:
+ LessPredicateAdapter(); // never implemented
+ };
+
+ //==================================================================================================================
+ //= ScalarPredicateLess
+ //==================================================================================================================
+ template< typename SCALAR >
+ class ScalarPredicateLess : public IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const
+ {
+ SCALAR lhs(0), rhs(0);
+ if ( !( _lhs >>= lhs )
+ || !( _rhs >>= rhs )
+ )
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ return lhs < rhs;
+ }
+ };
+
+ //==================================================================================================================
+ //= StringPredicateLess
+ //==================================================================================================================
+ class StringPredicateLess : public IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const
+ {
+ ::rtl::OUString lhs, rhs;
+ if ( !( _lhs >>= lhs )
+ || !( _rhs >>= rhs )
+ )
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ return lhs < rhs;
+ }
+ };
+
+ //==================================================================================================================
+ //= StringCollationPredicateLess
+ //==================================================================================================================
+ class StringCollationPredicateLess : public IKeyPredicateLess
+ {
+ public:
+ StringCollationPredicateLess( ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > const & i_collator )
+ :m_collator( i_collator )
+ {
+ }
+
+ virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const
+ {
+ ::rtl::OUString lhs, rhs;
+ if ( !( _lhs >>= lhs )
+ || !( _rhs >>= rhs )
+ )
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ return m_collator->compareString( lhs, rhs ) < 0;
+ }
+
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > const m_collator;
+ };
+
+ //==================================================================================================================
+ //= TypePredicateLess
+ //==================================================================================================================
+ class TypePredicateLess : public IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const
+ {
+ ::com::sun::star::uno::Type lhs, rhs;
+ if ( !( _lhs >>= lhs )
+ || !( _rhs >>= rhs )
+ )
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ return lhs.getTypeName() < rhs.getTypeName();
+ }
+ };
+
+ //==================================================================================================================
+ //= EnumPredicateLess
+ //==================================================================================================================
+ class EnumPredicateLess : public IKeyPredicateLess
+ {
+ public:
+ EnumPredicateLess( ::com::sun::star::uno::Type const & _enumType )
+ :m_enumType( _enumType )
+ {
+ }
+
+ virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const
+ {
+ sal_Int32 lhs(0), rhs(0);
+ if ( !::cppu::enum2int( lhs, _lhs )
+ || !::cppu::enum2int( rhs, _rhs )
+ || !_lhs.getValueType().equals( m_enumType )
+ || !_rhs.getValueType().equals( m_enumType )
+ )
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ return lhs < rhs;
+ }
+
+ private:
+ ::com::sun::star::uno::Type const m_enumType;
+ };
+
+ //==================================================================================================================
+ //= InterfacePredicateLess
+ //==================================================================================================================
+ class InterfacePredicateLess : public IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const
+ {
+ if ( ( _lhs.getValueTypeClass() != ::com::sun::star::uno::TypeClass_INTERFACE )
+ || ( _rhs.getValueTypeClass() != ::com::sun::star::uno::TypeClass_INTERFACE )
+ )
+ throw ::com::sun::star::lang::IllegalArgumentException();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > lhs( _lhs, ::com::sun::star::uno::UNO_QUERY );
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > rhs( _rhs, ::com::sun::star::uno::UNO_QUERY );
+ return lhs.get() < rhs.get();
+ }
+ };
+
+ //==================================================================================================================
+ //= getStandardLessPredicate
+ //==================================================================================================================
+ /** creates a default IKeyPredicateLess instance for the given UNO type
+ @param i_type
+ the type for which a predicate instance should be created
+ @param i_collator
+ specifies a collator instance to use, or <NULL/>. If <NULL/>, strings will be compared using the <code>&lt</code>
+ operator, otherwise the collator will be used. The parameter is ignored if <arg>i_type</arg> does not specify
+ the string type.
+ @return
+ a default implementation of IKeyPredicateLess, which is able to compare values of the given type. If no
+ such default implementation is known for the given type, then <NULL/> is returned.
+ */
+ ::std::auto_ptr< IKeyPredicateLess > COMPHELPER_DLLPUBLIC
+ getStandardLessPredicate(
+ ::com::sun::star::uno::Type const & i_type,
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > const & i_collator
+ );
+
+//......................................................................................................................
+} // namespace comphelper
+//......................................................................................................................
+
+#endif // COMPHELPER_ANYCOMPARE_HXX
diff --git a/comphelper/inc/comphelper/componentguard.hxx b/comphelper/inc/comphelper/componentguard.hxx
new file mode 100755
index 000000000000..820b901a5c55
--- /dev/null
+++ b/comphelper/inc/comphelper/componentguard.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef COMPHELPER_COMPONENTGUARD_HXX
+#define COMPHELPER_COMPONENTGUARD_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/DisposedException.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+
+//......................................................................................................................
+namespace comphelper
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= ComponentGuard
+ //==================================================================================================================
+ class ComponentGuard
+ {
+ public:
+ ComponentGuard( ::cppu::OWeakObject& i_component, ::cppu::OBroadcastHelper & i_broadcastHelper )
+ :m_aGuard( i_broadcastHelper.rMutex )
+ {
+ if ( i_broadcastHelper.bDisposed )
+ throw ::com::sun::star::lang::DisposedException( ::rtl::OUString(), &i_component );
+ }
+
+ ~ComponentGuard()
+ {
+ }
+
+ void clear() { m_aGuard.clear(); }
+ void reset() { m_aGuard.reset(); }
+
+ private:
+ ::osl::ResettableMutexGuard m_aGuard;
+ };
+
+//......................................................................................................................
+} // namespace comphelper
+//......................................................................................................................
+
+#endif // COMPHELPER_COMPONENTGUARD_HXX
diff --git a/comphelper/source/container/enumerablemap.cxx b/comphelper/source/container/enumerablemap.cxx
index 15241cd72dd6..a73983517751 100644
--- a/comphelper/source/container/enumerablemap.cxx
+++ b/comphelper/source/container/enumerablemap.cxx
@@ -24,11 +24,11 @@
*
************************************************************************/
-// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_comphelper.hxx"
#include "comphelper_module.hxx"
#include "comphelper/anytostring.hxx"
+#include "comphelper/anycompare.hxx"
#include "comphelper/componentbase.hxx"
#include "comphelper/componentcontext.hxx"
#include "comphelper/extract.hxx"
@@ -47,9 +47,7 @@
#include <rtl/ustrbuf.hxx>
#include <typelib/typedescription.hxx>
-#include <functional>
#include <map>
-#include <memory>
#include <boost/shared_ptr.hpp>
//........................................................................
@@ -79,26 +77,14 @@ namespace comphelper
using ::com::sun::star::beans::Pair;
using ::com::sun::star::uno::TypeClass;
using ::com::sun::star::uno::TypeClass_VOID;
- using ::com::sun::star::uno::TypeClass_CHAR;
- using ::com::sun::star::uno::TypeClass_BOOLEAN;
- using ::com::sun::star::uno::TypeClass_BYTE;
- using ::com::sun::star::uno::TypeClass_SHORT;
- using ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT;
- using ::com::sun::star::uno::TypeClass_LONG;
- using ::com::sun::star::uno::TypeClass_UNSIGNED_LONG;
- using ::com::sun::star::uno::TypeClass_HYPER;
- using ::com::sun::star::uno::TypeClass_UNSIGNED_HYPER;
- using ::com::sun::star::uno::TypeClass_FLOAT;
- using ::com::sun::star::uno::TypeClass_DOUBLE;
- using ::com::sun::star::uno::TypeClass_STRING;
- using ::com::sun::star::uno::TypeClass_TYPE;
- using ::com::sun::star::uno::TypeClass_ENUM;
- using ::com::sun::star::uno::TypeClass_INTERFACE;
using ::com::sun::star::uno::TypeClass_UNKNOWN;
using ::com::sun::star::uno::TypeClass_ANY;
using ::com::sun::star::uno::TypeClass_EXCEPTION;
using ::com::sun::star::uno::TypeClass_STRUCT;
using ::com::sun::star::uno::TypeClass_UNION;
+ using ::com::sun::star::uno::TypeClass_FLOAT;
+ using ::com::sun::star::uno::TypeClass_DOUBLE;
+ using ::com::sun::star::uno::TypeClass_INTERFACE;
using ::com::sun::star::lang::XServiceInfo;
using ::com::sun::star::uno::XComponentContext;
using ::com::sun::star::container::XEnumeration;
@@ -108,136 +94,6 @@ namespace comphelper
/** === end UNO using === **/
//====================================================================
- //= IKeyPredicateLess
- //====================================================================
- class SAL_NO_VTABLE IKeyPredicateLess
- {
- public:
- virtual bool isLess( const Any& _lhs, const Any& _rhs ) const = 0;
- virtual ~IKeyPredicateLess() {}
- };
-
- //====================================================================
- //= LessPredicateAdapter
- //====================================================================
- struct LessPredicateAdapter : public ::std::binary_function< Any, Any, bool >
- {
- LessPredicateAdapter( const IKeyPredicateLess& _predicate )
- :m_predicate( _predicate )
- {
- }
-
- bool operator()( const Any& _lhs, const Any& _rhs ) const
- {
- return m_predicate.isLess( _lhs, _rhs );
- }
-
- private:
- const IKeyPredicateLess& m_predicate;
-
- private:
- LessPredicateAdapter(); // never implemented
- };
-
- //====================================================================
- //= ScalarPredicateLess
- //====================================================================
- template< typename SCALAR >
- class ScalarPredicateLess : public IKeyPredicateLess
- {
- public:
- virtual bool isLess( const Any& _lhs, const Any& _rhs ) const
- {
- SCALAR lhs(0), rhs(0);
- if ( !( _lhs >>= lhs )
- || !( _rhs >>= rhs )
- )
- throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported key type." ) ), NULL, 1 );
- return lhs < rhs;
- }
- };
-
- //====================================================================
- //= StringPredicateLess
- //====================================================================
- class StringPredicateLess : public IKeyPredicateLess
- {
- public:
- virtual bool isLess( const Any& _lhs, const Any& _rhs ) const
- {
- ::rtl::OUString lhs, rhs;
- if ( !( _lhs >>= lhs )
- || !( _rhs >>= rhs )
- )
- throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported key type." ) ), NULL, 1 );
- return lhs < rhs;
- }
- };
-
- //====================================================================
- //= TypePredicateLess
- //====================================================================
- class TypePredicateLess : public IKeyPredicateLess
- {
- public:
- virtual bool isLess( const Any& _lhs, const Any& _rhs ) const
- {
- Type lhs, rhs;
- if ( !( _lhs >>= lhs )
- || !( _rhs >>= rhs )
- )
- throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported key type." ) ), NULL, 1 );
- return lhs.getTypeName() < rhs.getTypeName();
- }
- };
-
- //====================================================================
- //= EnumPredicateLess
- //====================================================================
- class EnumPredicateLess : public IKeyPredicateLess
- {
- public:
- EnumPredicateLess( const Type& _enumType )
- :m_enumType( _enumType )
- {
- }
-
- virtual bool isLess( const Any& _lhs, const Any& _rhs ) const
- {
- sal_Int32 lhs(0), rhs(0);
- if ( !::cppu::enum2int( lhs, _lhs )
- || !::cppu::enum2int( rhs, _rhs )
- || !_lhs.getValueType().equals( m_enumType )
- || !_rhs.getValueType().equals( m_enumType )
- )
- throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported key type." ) ), NULL, 1 );
- return lhs < rhs;
- }
-
- private:
- const Type m_enumType;
- };
-
- //====================================================================
- //= InterfacePredicateLess
- //====================================================================
- class InterfacePredicateLess : public IKeyPredicateLess
- {
- public:
- virtual bool isLess( const Any& _lhs, const Any& _rhs ) const
- {
- if ( ( _lhs.getValueTypeClass() != TypeClass_INTERFACE )
- || ( _rhs.getValueTypeClass() != TypeClass_INTERFACE )
- )
- throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported key type." ) ), NULL, 1 );
-
- Reference< XInterface > lhs( _lhs, UNO_QUERY );
- Reference< XInterface > rhs( _rhs, UNO_QUERY );
- return lhs.get() < rhs.get();
- }
- };
-
- //====================================================================
//= MapData
//====================================================================
class IMapModificationListener;
@@ -549,58 +405,9 @@ namespace comphelper
throw IllegalTypeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported value type." ) ), *this );
// create the comparator for the KeyType, and throw if the type is not supported
- TypeClass eKeyTypeClass = aKeyType.getTypeClass();
- ::std::auto_ptr< IKeyPredicateLess > pComparator;
- switch ( eKeyTypeClass )
- {
- case TypeClass_CHAR:
- pComparator.reset( new ScalarPredicateLess< sal_Unicode >() );
- break;
- case TypeClass_BOOLEAN:
- pComparator.reset( new ScalarPredicateLess< sal_Bool >() );
- break;
- case TypeClass_BYTE:
- pComparator.reset( new ScalarPredicateLess< sal_Int8 >() );
- break;
- case TypeClass_SHORT:
- pComparator.reset( new ScalarPredicateLess< sal_Int16 >() );
- break;
- case TypeClass_UNSIGNED_SHORT:
- pComparator.reset( new ScalarPredicateLess< sal_uInt16 >() );
- break;
- case TypeClass_LONG:
- pComparator.reset( new ScalarPredicateLess< sal_Int32 >() );
- break;
- case TypeClass_UNSIGNED_LONG:
- pComparator.reset( new ScalarPredicateLess< sal_uInt32 >() );
- break;
- case TypeClass_HYPER:
- pComparator.reset( new ScalarPredicateLess< sal_Int64 >() );
- break;
- case TypeClass_UNSIGNED_HYPER:
- pComparator.reset( new ScalarPredicateLess< sal_uInt64 >() );
- break;
- case TypeClass_FLOAT:
- pComparator.reset( new ScalarPredicateLess< float >() );
- break;
- case TypeClass_DOUBLE:
- pComparator.reset( new ScalarPredicateLess< double >() );
- break;
- case TypeClass_STRING:
- pComparator.reset( new StringPredicateLess() );
- break;
- case TypeClass_TYPE:
- pComparator.reset( new TypePredicateLess() );
- break;
- case TypeClass_ENUM:
- pComparator.reset( new EnumPredicateLess( aKeyType ) );
- break;
- case TypeClass_INTERFACE:
- pComparator.reset( new InterfacePredicateLess() );
- break;
- default:
+ ::std::auto_ptr< IKeyPredicateLess > pComparator( getStandardLessPredicate( aKeyType, NULL ) );
+ if ( !pComparator.get() )
throw IllegalTypeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported key type." ) ), *this );
- }
// init members
m_aData.m_aKeyType = aKeyType;
diff --git a/comphelper/source/misc/anycompare.cxx b/comphelper/source/misc/anycompare.cxx
new file mode 100755
index 000000000000..a86174daf08e
--- /dev/null
+++ b/comphelper/source/misc/anycompare.cxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ * 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.
+ *
+ ************************************************************************/
+
+#include "precompiled_comphelper.hxx"
+
+#include "comphelper/anycompare.hxx"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+//......................................................................................................................
+namespace comphelper
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::uno::TypeClass_CHAR;
+ using ::com::sun::star::uno::TypeClass_BOOLEAN;
+ using ::com::sun::star::uno::TypeClass_BYTE;
+ using ::com::sun::star::uno::TypeClass_SHORT;
+ using ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT;
+ using ::com::sun::star::uno::TypeClass_LONG;
+ using ::com::sun::star::uno::TypeClass_UNSIGNED_LONG;
+ using ::com::sun::star::uno::TypeClass_HYPER;
+ using ::com::sun::star::uno::TypeClass_UNSIGNED_HYPER;
+ using ::com::sun::star::uno::TypeClass_FLOAT;
+ using ::com::sun::star::uno::TypeClass_DOUBLE;
+ using ::com::sun::star::uno::TypeClass_STRING;
+ using ::com::sun::star::uno::TypeClass_TYPE;
+ using ::com::sun::star::uno::TypeClass_ENUM;
+ using ::com::sun::star::uno::TypeClass_INTERFACE;
+ using ::com::sun::star::i18n::XCollator;
+ /** === end UNO using === **/
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::std::auto_ptr< IKeyPredicateLess > getStandardLessPredicate( Type const & i_type, Reference< XCollator > const & i_collator )
+ {
+ ::std::auto_ptr< IKeyPredicateLess > pComparator;
+ switch ( i_type.getTypeClass() )
+ {
+ case TypeClass_CHAR:
+ pComparator.reset( new ScalarPredicateLess< sal_Unicode >() );
+ break;
+ case TypeClass_BOOLEAN:
+ pComparator.reset( new ScalarPredicateLess< sal_Bool >() );
+ break;
+ case TypeClass_BYTE:
+ pComparator.reset( new ScalarPredicateLess< sal_Int8 >() );
+ break;
+ case TypeClass_SHORT:
+ pComparator.reset( new ScalarPredicateLess< sal_Int16 >() );
+ break;
+ case TypeClass_UNSIGNED_SHORT:
+ pComparator.reset( new ScalarPredicateLess< sal_uInt16 >() );
+ break;
+ case TypeClass_LONG:
+ pComparator.reset( new ScalarPredicateLess< sal_Int32 >() );
+ break;
+ case TypeClass_UNSIGNED_LONG:
+ pComparator.reset( new ScalarPredicateLess< sal_uInt32 >() );
+ break;
+ case TypeClass_HYPER:
+ pComparator.reset( new ScalarPredicateLess< sal_Int64 >() );
+ break;
+ case TypeClass_UNSIGNED_HYPER:
+ pComparator.reset( new ScalarPredicateLess< sal_uInt64 >() );
+ break;
+ case TypeClass_FLOAT:
+ pComparator.reset( new ScalarPredicateLess< float >() );
+ break;
+ case TypeClass_DOUBLE:
+ pComparator.reset( new ScalarPredicateLess< double >() );
+ break;
+ case TypeClass_STRING:
+ if ( i_collator.is() )
+ pComparator.reset( new StringCollationPredicateLess( i_collator ) );
+ else
+ pComparator.reset( new StringPredicateLess() );
+ break;
+ case TypeClass_TYPE:
+ pComparator.reset( new TypePredicateLess() );
+ break;
+ case TypeClass_ENUM:
+ pComparator.reset( new EnumPredicateLess( i_type ) );
+ break;
+ case TypeClass_INTERFACE:
+ pComparator.reset( new InterfacePredicateLess() );
+ break;
+ default:
+ break;
+ }
+ return pComparator;
+ }
+
+//......................................................................................................................
+} // namespace comphelper
+//......................................................................................................................
diff --git a/cppcanvas/inc/cppcanvas/renderer.hxx b/cppcanvas/inc/cppcanvas/renderer.hxx
index 0b8bb43d7e3e..09852ff9e530 100644
--- a/cppcanvas/inc/cppcanvas/renderer.hxx
+++ b/cppcanvas/inc/cppcanvas/renderer.hxx
@@ -136,6 +136,9 @@ namespace cppcanvas
/// Optionally forces the given font letter form (italics etc.) for all text actions
::boost::optional< sal_Int8 > maFontLetterForm;
+ /// Optionally forces the given font proportion (condensed, monospaced etc.) for all text actions
+ ::boost::optional< sal_Int8 > maFontProportion;
+
/// Optionally forces underlining for all text actions
::boost::optional< bool > maFontUnderline;
};
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index 3061f4ec2770..d0382997a9db 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -43,6 +43,7 @@
#include <com/sun/star/rendering/TexturingMode.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/geometry/RealPoint2D.hpp>
+#include <com/sun/star/rendering/PanoseProportion.hpp>
#include <com/sun/star/rendering/ViewState.hpp>
#include <com/sun/star/rendering/RenderState.hpp>
#include <com/sun/star/rendering/XCanvasFont.hpp>
@@ -864,6 +865,12 @@ namespace cppcanvas
rParms.mrParms.maFontLetterForm.is_initialized() ?
*rParms.mrParms.maFontLetterForm :
(rFont.GetItalic() == ITALIC_NONE) ? 0 : 9;
+ aFontRequest.FontDescription.FontDescription.Proportion =
+ rParms.mrParms.maFontProportion.is_initialized() ?
+ *rParms.mrParms.maFontProportion :
+ (rFont.GetPitch() == PITCH_FIXED)
+ ? rendering::PanoseProportion::MONO_SPACED
+ : rendering::PanoseProportion::ANYTHING;
LanguageType aLang = rFont.GetLanguage();
aFontRequest.Locale = MsLangId::convertLanguageToLocale(aLang, false);
@@ -3007,7 +3014,8 @@ namespace cppcanvas
if( rParams.maFontName.is_initialized() ||
rParams.maFontWeight.is_initialized() ||
rParams.maFontLetterForm.is_initialized() ||
- rParams.maFontUnderline.is_initialized() )
+ rParams.maFontUnderline.is_initialized() ||
+ rParams.maFontProportion.is_initialized() )
{
::cppcanvas::internal::OutDevState& rState = getState( aStateStack );
diff --git a/dtrans/source/win32/dtobj/XTDataObject.cxx b/dtrans/source/win32/dtobj/XTDataObject.cxx
index e17a931d7380..8b86048cd330 100644
--- a/dtrans/source/win32/dtobj/XTDataObject.cxx
+++ b/dtrans/source/win32/dtobj/XTDataObject.cxx
@@ -36,7 +36,7 @@
#ifndef _TXDATAOBJECT_HXX_
#include "XTDataObject.hxx"
#endif
-#include <com/sun/star/datatransfer/dataflavor.hpp>
+#include <com/sun/star/datatransfer/DataFlavor.hpp>
#include "..\misc\ImplHelper.hxx"
#include "DTransHelper.hxx"
#include "TxtCnvtHlp.hxx"
diff --git a/dtrans/source/win32/dtobj/XTDataObject.hxx b/dtrans/source/win32/dtobj/XTDataObject.hxx
index b7b20af56ac7..b9794cad029e 100644
--- a/dtrans/source/win32/dtobj/XTDataObject.hxx
+++ b/dtrans/source/win32/dtobj/XTDataObject.hxx
@@ -42,7 +42,7 @@
#endif
#ifndef _FETCLIST_HXX_
-#include "FEtcList.hxx"
+#include "FetcList.hxx"
#endif
#if defined _MSC_VER
diff --git a/i18npool/inc/i18npool/lang.h b/i18npool/inc/i18npool/lang.h
index 52e4e51d7a41..5d9c3cee878c 100644
--- a/i18npool/inc/i18npool/lang.h
+++ b/i18npool/inc/i18npool/lang.h
@@ -515,6 +515,11 @@ typedef unsigned short LanguageType;
#define LANGUAGE_USER_GIKUYU 0x0655
#define LANGUAGE_USER_RUSYN_UKRAINE 0x0656
#define LANGUAGE_USER_RUSYN_SLOVAKIA 0x8256 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_RUSYN_UKRAINE)) */
+#define LANGUAGE_USER_YIDDISH_US 0x083D /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_YIDDISH)) */
+#define LANGUAGE_USER_LIMBU 0x0657
+#define LANGUAGE_USER_LOJBAN 0x0658 /* no locale */
+#define LANGUAGE_USER_KABYLE 0x0659
+#define LANGUAGE_USER_HAITIAN 0x065A
#endif /* INCLUDED_I18NPOOL_LANG_H */
diff --git a/i18npool/source/breakiterator/makefile.mk b/i18npool/source/breakiterator/makefile.mk
index f3088125ecf1..fc6561c3e0aa 100644
--- a/i18npool/source/breakiterator/makefile.mk
+++ b/i18npool/source/breakiterator/makefile.mk
@@ -79,7 +79,17 @@ GENBRK:=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)$/genbrk
GENCCODE:=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)$/genccode
.ENDIF
-$(MISC)$/%.brk : data/%.txt
+.INCLUDE .IGNORE : icuversion.mk
+
+$(MISC)$/%.txt : data/%.txt
+# fdo#31271 ")" reclassified in more recent ICU/Unicode Standards
+.IF "$(ICU_MAJOR)" >= "5" || ("$(ICU_MAJOR)" == "4" && "$(ICU_MINOR)" >= "4")
+ $(SED) "s#\[:LineBreak = Close_Punctuation:\]#\[\[:LineBreak = Close_Punctuation:\] \[:LineBreak = Close_Parenthesis:\]\]#" $< > $@
+.ELSE
+ $(COPY) $< $@
+.ENDIF
+
+$(MISC)$/%.brk : $(MISC)/%.txt
$(WRAPCMD) $(GENBRK) -r $< -o $(MISC)$/$*.brk
$(MISC)$/%_brk.c : $(MISC)$/%.brk
diff --git a/i18npool/source/calendar/calendar_gregorian.cxx b/i18npool/source/calendar/calendar_gregorian.cxx
index 727a6f601ba3..0ba91c0587d8 100644
--- a/i18npool/source/calendar/calendar_gregorian.cxx
+++ b/i18npool/source/calendar/calendar_gregorian.cxx
@@ -1003,9 +1003,11 @@ Calendar_gregorian::getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16
sprintf(aStr, "%02d", value); // #100211# - checked
break;
case CalendarDisplayCode::SHORT_YEAR:
- // Take last 2 digits, or only one if vallue<10, for example,
+ // Take last 2 digits, or only one if value<10, for example,
// in case of the Gengou calendar.
- if (value < 100)
+ // #i116701# For values in non-Gregorian era years use all
+ // digits.
+ if (value < 100 || eraArray)
sprintf(aStr, "%d", value); // #100211# - checked
else
sprintf(aStr, "%02d", value % 100); // #100211# - checked
diff --git a/i18npool/source/isolang/isolang.cxx b/i18npool/source/isolang/isolang.cxx
index 357be80a69ea..78a66c1cc79e 100644
--- a/i18npool/source/isolang/isolang.cxx
+++ b/i18npool/source/isolang/isolang.cxx
@@ -292,7 +292,6 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] =
// { LANGUAGE_USER_CATALAN_VALENCIAN, "ca", "ES" }, // In case MS format files escaped into the wild, map them back.
{ LANGUAGE_FRENCH_CAMEROON, "fr", "CM" },
{ LANGUAGE_FRENCH_COTE_D_IVOIRE, "fr", "CI" },
- { LANGUAGE_FRENCH_HAITI, "fr", "HT" },
{ LANGUAGE_FRENCH_MALI, "fr", "ML" },
{ LANGUAGE_FRENCH_SENEGAL, "fr", "SN" },
{ LANGUAGE_FRENCH_ZAIRE, "fr", "CD" }, // Democratic Republic Of Congo
@@ -353,6 +352,7 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] =
{ LANGUAGE_PAPIAMENTU, "pap", "AN" },
{ LANGUAGE_USER_PAPIAMENTU_ARUBA, "pap", "AW" },
{ LANGUAGE_ENGLISH_SINGAPORE, "en", "SG" },
+ { LANGUAGE_USER_YIDDISH_US, "yi", "US" },
{ LANGUAGE_YIDDISH, "yi", "IL" }, // new: old was "ji"
{ LANGUAGE_YIDDISH, "ji", "IL" }, // old: new is "yi"
{ LANGUAGE_SYRIAC, "syr", "TR" }, // "TR" according to http://www.ethnologue.com/show_language.asp?code=SYC
@@ -461,6 +461,11 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] =
{ LANGUAGE_USER_GIKUYU, "ki", "KE" },
{ LANGUAGE_USER_RUSYN_UKRAINE, "rue", "UA" },
{ LANGUAGE_USER_RUSYN_SLOVAKIA, "rue", "SK" },
+ { LANGUAGE_USER_LIMBU, "lif", "NP" },
+ { LANGUAGE_USER_LOJBAN, "jbo", "" },
+ { LANGUAGE_USER_KABYLE, "kab", "DZ" },
+ { LANGUAGE_USER_HAITIAN, "ht", "HT" },
+ { LANGUAGE_FRENCH_HAITI, "fr", "HT" },
{ LANGUAGE_NONE, "zxx", "" }, // added to ISO 639-2 on 2006-01-11: Used to declare the absence of linguistic information
{ LANGUAGE_DONTKNOW, "", "" } // marks end of table
};
@@ -685,6 +690,7 @@ static const MsLangId::IsoLangEntry & lcl_lookupFallbackEntry( LanguageType nLan
case LANGUAGE_BASQUE:
case LANGUAGE_USER_ESPERANTO:
case LANGUAGE_USER_INTERLINGUA:
+ case LANGUAGE_USER_LOJBAN:
return *pEntry;
default:
; // nothing
@@ -765,6 +771,7 @@ static const MsLangId::IsoLangEntry & lcl_lookupFallbackEntry(
case LANGUAGE_BASQUE:
case LANGUAGE_USER_ESPERANTO:
case LANGUAGE_USER_INTERLINGUA:
+ case LANGUAGE_USER_LOJBAN:
return *pEntry;
default:
; // nothing
diff --git a/i18npool/source/isolang/mslangid.cxx b/i18npool/source/isolang/mslangid.cxx
index a03d24e6fcdb..599299951164 100644
--- a/i18npool/source/isolang/mslangid.cxx
+++ b/i18npool/source/isolang/mslangid.cxx
@@ -339,6 +339,7 @@ sal_Int16 MsLangId::getScriptType( LanguageType nLang )
case LANGUAGE_FARSI:
case LANGUAGE_HEBREW:
case LANGUAGE_YIDDISH:
+ case LANGUAGE_USER_YIDDISH_US:
case LANGUAGE_MARATHI:
case LANGUAGE_PUNJABI:
case LANGUAGE_GUJARATI:
@@ -374,6 +375,7 @@ sal_Int16 MsLangId::getScriptType( LanguageType nLang )
case LANGUAGE_USER_DOGRI_INDIA:
case LANGUAGE_USER_MAITHILI_INDIA:
case LANGUAGE_UIGHUR_CHINA:
+ case LANGUAGE_USER_LIMBU:
nScript = ::com::sun::star::i18n::ScriptType::COMPLEX;
break;
diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx
index 7a520047637d..275fdf006d9f 100644
--- a/i18npool/source/localedata/LocaleNode.cxx
+++ b/i18npool/source/localedata/LocaleNode.cxx
@@ -160,9 +160,11 @@ LocaleNode* LocaleNode::createNode (const OUString& name, const Reference< XAttr
// printf(" name: '%s'\n", p->getName().pData->buffer );
// printf("value: '%s'\n", p->getValue().pData->buffer );
+#define OSTR(s) (OUStringToOString( (s), RTL_TEXTENCODING_UTF8).getStr())
+
void print_OUString( const OUString& s )
{
- printf( "%s", OUStringToOString( s, RTL_TEXTENCODING_UTF8).getStr());
+ printf( "%s", OSTR(s));
}
bool is_empty( const OUString& s )
@@ -266,16 +268,16 @@ void LocaleNode :: generateCode (const OFileWriter &of) const
fprintf( stderr, "Error: less than %ld character%s (%ld) in %s '%s'.\n",
sal::static_int_cast< long >(nMinLen), (nMinLen > 1 ? "s" : ""),
sal::static_int_cast< long >(nLen),
- (pNode ? OUStringToOString( pNode->getName(), RTL_TEXTENCODING_UTF8).getStr() : ""),
- OUStringToOString( aVal, RTL_TEXTENCODING_UTF8).getStr());
+ (pNode ? OSTR( pNode->getName()) : ""),
+ OSTR( aVal));
}
else if (nLen > nMaxLen && nMaxLen >= 0)
fprintf( stderr,
"Warning: more than %ld character%s (%ld) in %s %s not supported by application.\n",
sal::static_int_cast< long >(nMaxLen), (nMaxLen > 1 ? "s" : ""),
sal::static_int_cast< long >(nLen),
- (pNode ? OUStringToOString( pNode->getName(), RTL_TEXTENCODING_UTF8).getStr() : ""),
- OUStringToOString( aVal, RTL_TEXTENCODING_UTF8).getStr());
+ (pNode ? OSTR( pNode->getName()) : ""),
+ OSTR( aVal));
return aVal;
}
@@ -306,7 +308,7 @@ void LocaleNode::incError( const char* pStr ) const
void LocaleNode::incError( const ::rtl::OUString& rStr ) const
{
- incError( OUStringToOString( rStr, RTL_TEXTENCODING_UTF8).getStr());
+ incError( OSTR( rStr));
}
char* LocaleNode::prepareErrorFormat( const char* pFormat, const char* pDefaultConversion ) const
@@ -332,8 +334,7 @@ void LocaleNode::incErrorInt( const char* pStr, int nVal ) const
void LocaleNode::incErrorStr( const char* pStr, const ::rtl::OUString& rVal ) const
{
++nError;
- fprintf( stderr, prepareErrorFormat( pStr, ": %s"), OUStringToOString(
- rVal, RTL_TEXTENCODING_UTF8).getStr());
+ fprintf( stderr, prepareErrorFormat( pStr, ": %s"), OSTR( rVal));
}
void LCInfoNode::generateCode (const OFileWriter &of) const
@@ -501,6 +502,64 @@ void LCCTYPENode::generateCode (const OFileWriter &of) const
if (aQuoteEnd == aDoubleQuoteEnd)
fprintf( stderr, "Warning: %s\n",
"QuotationEnd equals DoubleQuotationEnd. Not necessarily an error, but unusual.");
+ // Known good values, exclude ASCII single (U+0027, ') and double (U+0022, ") quotes.
+ int ic;
+ switch (ic = aQuoteStart.toChar())
+ {
+ case 0x2018: // LEFT SINGLE QUOTATION MARK
+ case 0x201a: // SINGLE LOW-9 QUOTATION MARK
+ case 0x201b: // SINGLE HIGH-REVERSED-9 QUOTATION MARK
+ case 0x2039: // SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+ case 0x203a: // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+ case 0x300c: // LEFT CORNER BRACKET (Chinese)
+ ;
+ break;
+ default:
+ fprintf( stderr, "Warning: %s U+%04X %s\n",
+ "QuotationStart may be wrong:", ic, OSTR( aQuoteStart));
+ }
+ switch (ic = aQuoteEnd.toChar())
+ {
+ case 0x2019: // RIGHT SINGLE QUOTATION MARK
+ case 0x201a: // SINGLE LOW-9 QUOTATION MARK
+ case 0x201b: // SINGLE HIGH-REVERSED-9 QUOTATION MARK
+ case 0x2039: // SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+ case 0x203a: // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+ case 0x300d: // RIGHT CORNER BRACKET (Chinese)
+ ;
+ break;
+ default:
+ fprintf( stderr, "Warning: %s U+%04X %s\n",
+ "QuotationEnd may be wrong:", ic, OSTR( aQuoteEnd));
+ }
+ switch (ic = aDoubleQuoteStart.toChar())
+ {
+ case 0x00ab: // LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ case 0x00bb: // RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ case 0x201c: // LEFT DOUBLE QUOTATION MARK
+ case 0x201e: // DOUBLE LOW-9 QUOTATION MARK
+ case 0x201f: // DOUBLE HIGH-REVERSED-9 QUOTATION MARK
+ case 0x300e: // LEFT WHITE CORNER BRACKET (Chinese)
+ ;
+ break;
+ default:
+ fprintf( stderr, "Warning: %s U+%04X %s\n",
+ "DoubleQuotationStart may be wrong:", ic, OSTR( aDoubleQuoteStart));
+ }
+ switch (ic = aDoubleQuoteEnd.toChar())
+ {
+ case 0x00ab: // LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ case 0x00bb: // RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ case 0x201d: // RIGHT DOUBLE QUOTATION MARK
+ case 0x201e: // DOUBLE LOW-9 QUOTATION MARK
+ case 0x201f: // DOUBLE HIGH-REVERSED-9 QUOTATION MARK
+ case 0x300f: // RIGHT WHITE CORNER BRACKET (Chinese)
+ ;
+ break;
+ default:
+ fprintf( stderr, "Warning: %s U+%04X %s\n",
+ "DoubleQuotationEnd may be wrong:", ic, OSTR( aDoubleQuoteEnd));
+ }
writeParameterCheckLen( of, "TimeAM", "timeAM", 1, -1);
writeParameterCheckLen( of, "TimePM", "timePM", 1, -1);
@@ -640,7 +699,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
fprintf( stderr,
"Warning: Can't check separators used in FormatCode due to LC_CTYPE ref=\"%s\".\n"
"If these two locales use identical format codes, you should consider to use the ref= mechanism also for the LC_FORMAT element, together with replaceFrom= and replaceTo= for the currency.\n",
- OUStringToOString( aRef, RTL_TEXTENCODING_UTF8).getStr());
+ OSTR( aRef));
bCtypeIsRef = true;
pCtype = 0;
}
diff --git a/i18npool/source/localedata/data/dsb_DE.xml b/i18npool/source/localedata/data/dsb_DE.xml
new file mode 100644
index 000000000000..fe953ec807c1
--- /dev/null
+++ b/i18npool/source/localedata/data/dsb_DE.xml
@@ -0,0 +1,350 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE Locale SYSTEM 'locale.dtd'>
+<Locale versionDTD="2.0.3" allowUpdateFromCLDR="no" version="1.0">
+ <LC_INFO>
+ <Language>
+ <LangID>dsb</LangID>
+ <DefaultName>Sorbian, Lower</DefaultName>
+ </Language>
+ <Country>
+ <CountryID>DE</CountryID>
+ <DefaultName>Germany</DefaultName>
+ </Country>
+ </LC_INFO>
+ <LC_CTYPE unoid="generic">
+ <Separators>
+ <DateSeparator>.</DateSeparator>
+ <ThousandSeparator>&#160;</ThousandSeparator><!-- a non-breaking space (U+00A0) as a thousand separator; alternatively, there could be no separator at all -->
+ <DecimalSeparator>,</DecimalSeparator>
+ <TimeSeparator>:</TimeSeparator>
+ <Time100SecSeparator>,</Time100SecSeparator>
+ <ListSeparator>;</ListSeparator>
+ <LongDateDayOfWeekSeparator>, </LongDateDayOfWeekSeparator>
+ <LongDateDaySeparator>. </LongDateDaySeparator>
+ <LongDateMonthSeparator> </LongDateMonthSeparator>
+ <LongDateYearSeparator> </LongDateYearSeparator>
+ </Separators>
+ <Markers>
+ <QuotationStart>‚</QuotationStart>
+ <QuotationEnd>‘</QuotationEnd>
+ <DoubleQuotationStart>„</DoubleQuotationStart>
+ <DoubleQuotationEnd>“</DoubleQuotationEnd>
+ </Markers>
+ <TimeAM>dopołdnja</TimeAM>
+ <TimePM>wótpołdnja</TimePM>
+ <MeasurementSystem>metric</MeasurementSystem>
+ </LC_CTYPE>
+ <LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$€-82E]">
+ <FormatElement msgid="FixedFormatskey1" default="true" type="medium" usage="FIXED_NUMBER" formatindex="0">
+ <FormatCode>Standard</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey2" default="true" type="short" usage="FIXED_NUMBER" formatindex="1">
+ <FormatCode>0</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey3" default="false" type="medium" usage="FIXED_NUMBER" formatindex="2">
+ <FormatCode>0,00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey4" default="false" type="short" usage="FIXED_NUMBER" formatindex="3">
+ <FormatCode># ##0</FormatCode><!-- a non-breaking space (U+00A0) as a thousand separator -->
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey5" default="false" type="medium" usage="FIXED_NUMBER" formatindex="4">
+ <FormatCode># ##0,00</FormatCode><!-- a non-breaking space (U+00A0) as a thousand separator -->
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey6" default="false" type="medium" usage="FIXED_NUMBER" formatindex="5">
+ <FormatCode># ###,00</FormatCode><!-- a non-breaking space (U+00A0) as a thousand separator -->
+ </FormatElement>
+ <FormatElement msgid="ScientificFormatskey1" default="true" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="6">
+ <FormatCode>0,00E+000</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="ScientificFormatskey2" default="false" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="7">
+ <FormatCode>0,00E+00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="PercentFormatskey1" default="true" type="short" usage="PERCENT_NUMBER" formatindex="8">
+ <FormatCode>0%</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="PercentFormatskey2" default="true" type="long" usage="PERCENT_NUMBER" formatindex="9">
+ <FormatCode>0,00%</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey1" default="true" type="short" usage="CURRENCY" formatindex="12">
+ <FormatCode># ##0 [CURRENCY];-# ##0 [CURRENCY]</FormatCode><!-- a non-breaking space (U+00A0) as a thousand separator -->
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey2" default="false" type="medium" usage="CURRENCY" formatindex="13">
+ <FormatCode># ##0,00 [CURRENCY];-# ##0,00 [CURRENCY]</FormatCode><!-- a non-breaking space (U+00A0) as a thousand separator -->
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey3" default="false" type="medium" usage="CURRENCY" formatindex="14">
+ <FormatCode># ##0 [CURRENCY];[RED]-# ##0 [CURRENCY]</FormatCode><!-- a non-breaking space (U+00A0) as a thousand separator -->
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey4" default="true" type="medium" usage="CURRENCY" formatindex="15">
+ <FormatCode># ##0,00 [CURRENCY];[RED]-# ##0,00 [CURRENCY]</FormatCode><!-- a non-breaking space (U+00A0) as a thousand separator -->
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey5" default="false" type="medium" usage="CURRENCY" formatindex="16">
+ <FormatCode>CCC# ##0,00</FormatCode><!-- a non-breaking space (U+00A0) as a thousand separator -->
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey6" default="false" type="medium" usage="CURRENCY" formatindex="17">
+ <FormatCode># ##0,-- [CURRENCY];[RED]-# ##0,-- [CURRENCY]</FormatCode><!-- a non-breaking space (U+00A0) as a thousand separator -->
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey11" default="true" type="short" usage="DATE" formatindex="18">
+ <FormatCode>D.MM.YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey14" default="true" type="long" usage="DATE" formatindex="19">
+ <FormatCode>NNNND. MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey6" default="true" type="medium" usage="DATE" formatindex="20">
+ <FormatCode>DD.MM.YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey5" default="false" type="medium" usage="DATE" formatindex="21">
+ <FormatCode>DD.MM.YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey15" default="false" type="long" usage="DATE" formatindex="22">
+ <FormatCode>D. MMM YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey16" default="false" type="long" usage="DATE" formatindex="23">
+ <FormatCode>D. MMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey21" default="false" type="long" usage="DATE" formatindex="24">
+ <FormatCode>D. MMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey17" default="false" type="long" usage="DATE" formatindex="25">
+ <FormatCode>D. MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey22" default="false" type="long" usage="DATE" formatindex="26">
+ <FormatCode>D. MMMM YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey10" default="false" type="medium" usage="DATE" formatindex="27">
+ <FormatCode>NN, DD. MMM YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey18" default="false" type="long" usage="DATE" formatindex="28">
+ <FormatCode>NN, D. MMM YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey19" default="false" type="long" usage="DATE" formatindex="29">
+ <FormatCode>NN, D. MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey20" default="false" type="long" usage="DATE" formatindex="30">
+ <FormatCode>NNNND. MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey12" default="false" type="short" usage="DATE" formatindex="31">
+ <FormatCode>MM.DD</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey7" default="false" type="medium" usage="DATE" formatindex="32">
+ <FormatCode>YY-MM-DD</FormatCode>
+ <DefaultName>ISO 8601</DefaultName>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey8" default="false" type="medium" usage="DATE" formatindex="33">
+ <FormatCode>YYYY-MM-DD</FormatCode>
+ <DefaultName>ISO 8601</DefaultName>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey1" default="false" type="medium" usage="DATE" formatindex="34">
+ <FormatCode>MM.YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey2" default="false" type="medium" usage="DATE" formatindex="35">
+ <FormatCode>D. MMM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey3" default="false" type="medium" usage="DATE" formatindex="36">
+ <FormatCode>MMMM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey4" default="false" type="medium" usage="DATE" formatindex="37">
+ <FormatCode>QQ YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey9" default="false" type="medium" usage="DATE" formatindex="38">
+ <FormatCode>WW</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey1" default="false" type="short" usage="TIME" formatindex="39">
+ <FormatCode>H:MM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey2" default="false" type="medium" usage="TIME" formatindex="40">
+ <FormatCode>H:MM:SS</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey3" default="true" type="short" usage="TIME" formatindex="41">
+ <FormatCode>H:MM AM/PM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey4" default="true" type="medium" usage="TIME" formatindex="42">
+ <FormatCode>H:MM:SS AM/PM</FormatCode><!-- with commonly used 24-hour time, the AM/PM indicator is not needed -->
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey5" default="false" type="medium" usage="TIME" formatindex="43">
+ <FormatCode>[H]:MM:SS</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey6" default="false" type="short" usage="TIME" formatindex="44">
+ <FormatCode>MM:SS,00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey7" default="false" type="medium" usage="TIME" formatindex="45">
+ <FormatCode>[H]:MM:SS,00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateTimeFormatskey1" default="true" type="medium" usage="DATE_TIME" formatindex="46">
+ <FormatCode>DD.MM.YY H:MM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateTimeFormatskey2" default="false" type="medium" usage="DATE_TIME" formatindex="47">
+ <FormatCode>DD.MM.YYYY H:MM:SS AM/PM</FormatCode><!-- with commonly used 24-hour time, the AM/PM indicator is useless (and also never used) -->
+ </FormatElement>
+ </LC_FORMAT>
+ <LC_COLLATION>
+ <Collator default="true" unoid="alphanumeric"/>
+ <CollationOptions>
+ <TransliterationModules>IGNORE_CASE</TransliterationModules>
+ </CollationOptions>
+ </LC_COLLATION>
+ <LC_SEARCH>
+ <SearchOptions>
+ <TransliterationModules>IGNORE_CASE</TransliterationModules>
+ </SearchOptions>
+ </LC_SEARCH>
+ <LC_INDEX>
+ <IndexKey unoid="alphanumeric" default="true" phonetic="false">A-C Č Ć D E Ě F-H {Ch} I-K Ł L-N Ń O Ó P-R Ŕ S Š Ś T-Z Ž Ź</IndexKey>
+ <UnicodeScript>0</UnicodeScript>
+ <UnicodeScript>1</UnicodeScript>
+ <UnicodeScript>2</UnicodeScript>
+ <FollowPageWord>bok</FollowPageWord><!-- there's no conventional abbreviation -->
+ <FollowPageWord>boki</FollowPageWord><!-- there's no conventional abbreviation -->
+ </LC_INDEX>
+ <LC_CALENDAR>
+ <Calendar unoid="gregorian" default="true">
+ <DaysOfWeek>
+ <Day>
+ <DayID>sun</DayID>
+ <DefaultAbbrvName>nje.</DefaultAbbrvName>
+ <DefaultFullName>njeźela</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>mon</DayID>
+ <DefaultAbbrvName>pón.</DefaultAbbrvName>
+ <DefaultFullName>pónjeźela</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>tue</DayID>
+ <DefaultAbbrvName>wał.</DefaultAbbrvName>
+ <DefaultFullName>wałtora</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>wed</DayID>
+ <DefaultAbbrvName>srj.</DefaultAbbrvName>
+ <DefaultFullName>srjoda</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>thu</DayID>
+ <DefaultAbbrvName>stw.</DefaultAbbrvName>
+ <DefaultFullName>stwórtk</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>fri</DayID>
+ <DefaultAbbrvName>pět.</DefaultAbbrvName>
+ <DefaultFullName>pětk</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>sat</DayID>
+ <DefaultAbbrvName>sob.</DefaultAbbrvName>
+ <DefaultFullName>sobota</DefaultFullName>
+ </Day>
+ </DaysOfWeek>
+ <MonthsOfYear>
+ <Month>
+ <MonthID>jan</MonthID>
+ <DefaultAbbrvName>jan.</DefaultAbbrvName>
+ <DefaultFullName>januar</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>feb</MonthID>
+ <DefaultAbbrvName>feb.</DefaultAbbrvName>
+ <DefaultFullName>februar</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>mar</MonthID>
+ <DefaultAbbrvName>měr.</DefaultAbbrvName>
+ <DefaultFullName>měrc</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>apr</MonthID>
+ <DefaultAbbrvName>apr.</DefaultAbbrvName>
+ <DefaultFullName>apryl</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>may</MonthID>
+ <DefaultAbbrvName>maj</DefaultAbbrvName>
+ <DefaultFullName>maj</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>jun</MonthID>
+ <DefaultAbbrvName>jun.</DefaultAbbrvName>
+ <DefaultFullName>junij</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>jul</MonthID>
+ <DefaultAbbrvName>jul.</DefaultAbbrvName>
+ <DefaultFullName>julij</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>aug</MonthID>
+ <DefaultAbbrvName>awg.</DefaultAbbrvName>
+ <DefaultFullName>awgust</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>sep</MonthID>
+ <DefaultAbbrvName>sep.</DefaultAbbrvName>
+ <DefaultFullName>september</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>oct</MonthID>
+ <DefaultAbbrvName>okt.</DefaultAbbrvName>
+ <DefaultFullName>oktober</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>nov</MonthID>
+ <DefaultAbbrvName>now.</DefaultAbbrvName>
+ <DefaultFullName>nowember</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>dec</MonthID>
+ <DefaultAbbrvName>dec.</DefaultAbbrvName>
+ <DefaultFullName>december</DefaultFullName>
+ </Month>
+ </MonthsOfYear>
+ <Eras>
+ <Era>
+ <EraID>bc</EraID>
+ <DefaultAbbrvName>pś. Kr.</DefaultAbbrvName>
+ <DefaultFullName>pśed Kristusom</DefaultFullName>
+ </Era>
+ <Era>
+ <EraID>ad</EraID>
+ <DefaultAbbrvName>pó Kr.</DefaultAbbrvName>
+ <DefaultFullName>pó Kristusu</DefaultFullName>
+ </Era>
+ </Eras>
+ <StartDayOfWeek>
+ <DayID>mon</DayID>
+ </StartDayOfWeek>
+ <MinimalDaysInFirstWeek>4</MinimalDaysInFirstWeek>
+ </Calendar>
+ </LC_CALENDAR>
+ <LC_CURRENCY>
+ <Currency default="true" usedInCompatibleFormatCodes="true">
+ <CurrencyID>EUR</CurrencyID>
+ <CurrencySymbol>€</CurrencySymbol>
+ <BankSymbol>EUR</BankSymbol>
+ <CurrencyName>euro</CurrencyName>
+ <DecimalPlaces>2</DecimalPlaces>
+ </Currency>
+ </LC_CURRENCY>
+ <LC_TRANSLITERATION>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
+ <Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="IGNORE_CASE"/>
+ </LC_TRANSLITERATION>
+ <LC_MISC>
+ <ReservedWords>
+ <trueWord>wěrno</trueWord>
+ <falseWord>njewěrno</falseWord>
+ <quarter1Word>prědny kwartal</quarter1Word>
+ <quarter2Word>drugi kwartal</quarter2Word>
+ <quarter3Word>tśeśi kwartal</quarter3Word>
+ <quarter4Word>stwórty kwartal</quarter4Word>
+ <aboveWord>nad</aboveWord>
+ <belowWord>pód</belowWord>
+ <quarter1Abbreviation>K1</quarter1Abbreviation>
+ <quarter2Abbreviation>K2</quarter2Abbreviation>
+ <quarter3Abbreviation>K3</quarter3Abbreviation>
+ <quarter4Abbreviation>K4</quarter4Abbreviation>
+ </ReservedWords>
+ </LC_MISC>
+ <LC_NumberingLevel ref="en_US"/>
+ <LC_OutLineNumberingLevel ref="en_US"/>
+</Locale>
+<!--Version 1.0 -->
diff --git a/i18npool/source/localedata/data/fi_FI.xml b/i18npool/source/localedata/data/fi_FI.xml
index 432d5f155423..1f7747d8b97a 100644
--- a/i18npool/source/localedata/data/fi_FI.xml
+++ b/i18npool/source/localedata/data/fi_FI.xml
@@ -179,7 +179,7 @@
<LC_COLLATION ref="en_US" />
<LC_SEARCH ref="en_US"/>
<LC_INDEX>
- <IndexKey phonetic="false" default="true" unoid="alphanumeric">A-V X-Z Ä Ö</IndexKey>
+ <IndexKey phonetic="false" default="true" unoid="alphanumeric">A-Z Ä Ö</IndexKey>
<UnicodeScript>0</UnicodeScript>
<UnicodeScript>1</UnicodeScript>
<FollowPageWord>p.</FollowPageWord>
diff --git a/i18npool/source/localedata/data/haw_US.xml b/i18npool/source/localedata/data/haw_US.xml
new file mode 100644
index 000000000000..b9fd553e24ef
--- /dev/null
+++ b/i18npool/source/localedata/data/haw_US.xml
@@ -0,0 +1,358 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE Locale SYSTEM 'locale.dtd'>
+<Locale versionDTD="2.0.3" allowUpdateFromCLDR="no" version="1.0">
+ <LC_INFO>
+ <Language>
+ <LangID>haw</LangID>
+ <DefaultName>Hawaiian</DefaultName>
+ </Language>
+ <Country>
+ <CountryID>US</CountryID>
+ <DefaultName>United States</DefaultName>
+ </Country>
+ </LC_INFO>
+ <LC_CTYPE unoid="generic">
+ <Separators>
+ <DateSeparator>/</DateSeparator>
+ <ThousandSeparator>,</ThousandSeparator>
+ <DecimalSeparator>.</DecimalSeparator>
+ <TimeSeparator>:</TimeSeparator>
+ <Time100SecSeparator>.</Time100SecSeparator>
+ <ListSeparator>;</ListSeparator>
+ <LongDateDayOfWeekSeparator>, </LongDateDayOfWeekSeparator>
+ <LongDateDaySeparator> </LongDateDaySeparator>
+ <LongDateMonthSeparator> </LongDateMonthSeparator>
+ <LongDateYearSeparator> </LongDateYearSeparator>
+ </Separators>
+ <Markers>
+ <QuotationStart>‘</QuotationStart>
+ <QuotationEnd>’</QuotationEnd>
+ <DoubleQuotationStart>“</DoubleQuotationStart>
+ <DoubleQuotationEnd>”</DoubleQuotationEnd>
+ </Markers>
+ <TimeAM>AM</TimeAM>
+ <TimePM>PM</TimePM>
+ <MeasurementSystem>metric</MeasurementSystem>
+ </LC_CTYPE>
+ <LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$$-475]">
+ <FormatElement msgid="FixedFormatskey1" default="true" type="medium" usage="FIXED_NUMBER" formatindex="0">
+ <FormatCode>General</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey2" default="true" type="short" usage="FIXED_NUMBER" formatindex="1">
+ <FormatCode>0</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey3" default="false" type="medium" usage="FIXED_NUMBER" formatindex="2">
+ <FormatCode>0.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey4" default="false" type="short" usage="FIXED_NUMBER" formatindex="3">
+ <FormatCode>#,##0</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey5" default="false" type="medium" usage="FIXED_NUMBER" formatindex="4">
+ <FormatCode>#,##0.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey6" default="false" type="medium" usage="FIXED_NUMBER" formatindex="5">
+ <FormatCode>#,###.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="ScientificFormatskey1" default="true" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="6">
+ <FormatCode>0.00E+00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="ScientificFormatskey2" default="false" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="7">
+ <FormatCode>0.00E+000</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="PercentFormatskey1" default="true" type="short" usage="PERCENT_NUMBER" formatindex="8">
+ <FormatCode>0%</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="PercentFormatskey2" default="true" type="long" usage="PERCENT_NUMBER" formatindex="9">
+ <FormatCode>0.00%</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey1" default="true" type="short" usage="CURRENCY" formatindex="12">
+ <FormatCode>[CURRENCY]#,##0;([CURRENCY]#,##0)</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey2" default="false" type="medium" usage="CURRENCY" formatindex="13">
+ <FormatCode>[CURRENCY]#,##0.00;([CURRENCY]#,##0.00)</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey3" default="false" type="medium" usage="CURRENCY" formatindex="14">
+ <FormatCode>[CURRENCY]#,##0;[RED]([CURRENCY]#,##0)</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey4" default="true" type="medium" usage="CURRENCY" formatindex="15">
+ <FormatCode>[CURRENCY]#,##0.00;[RED]([CURRENCY]#,##0.00)</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey5" default="false" type="medium" usage="CURRENCY" formatindex="16">
+ <FormatCode>CCC#,##0.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey6" default="false" type="medium" usage="CURRENCY" formatindex="17">
+ <FormatCode>[CURRENCY]#,##0.--;[RED]([CURRENCY]#,##0.--)</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey11" default="true" type="short" usage="DATE" formatindex="18">
+ <FormatCode>YY/MM/DD</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey14" default="true" type="long" usage="DATE" formatindex="19">
+ <FormatCode>NNNNDD MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey6" default="true" type="medium" usage="DATE" formatindex="20">
+ <FormatCode>YY/MM/DD</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey5" default="false" type="medium" usage="DATE" formatindex="21">
+ <FormatCode>YYYY/MM/DD</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey15" default="false" type="long" usage="DATE" formatindex="22">
+ <FormatCode>D MMM YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey16" default="false" type="long" usage="DATE" formatindex="23">
+ <FormatCode>D MMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey21" default="false" type="long" usage="DATE" formatindex="24">
+ <FormatCode>D MMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey17" default="false" type="long" usage="DATE" formatindex="25">
+ <FormatCode>D MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey22" default="false" type="long" usage="DATE" formatindex="26">
+ <FormatCode>D MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey10" default="false" type="medium" usage="DATE" formatindex="27">
+ <FormatCode>NN, DD/MMM/YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey18" default="false" type="long" usage="DATE" formatindex="28">
+ <FormatCode>NN, D MMM YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey19" default="false" type="long" usage="DATE" formatindex="29">
+ <FormatCode>NN, D MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey20" default="false" type="long" usage="DATE" formatindex="30">
+ <FormatCode>NNNND MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey12" default="false" type="short" usage="DATE" formatindex="31">
+ <FormatCode>MM/DD</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey7" default="false" type="medium" usage="DATE" formatindex="32">
+ <FormatCode>YY-MM-DD</FormatCode>
+ <DefaultName>ISO 8601</DefaultName>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey8" default="false" type="medium" usage="DATE" formatindex="33">
+ <FormatCode>YYYY-MM-DD</FormatCode>
+ <DefaultName>ISO 8601</DefaultName>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey1" default="false" type="medium" usage="DATE" formatindex="34">
+ <FormatCode>YY/MM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey2" default="false" type="medium" usage="DATE" formatindex="35">
+ <FormatCode>MMM/DD</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey3" default="false" type="medium" usage="DATE" formatindex="36">
+ <FormatCode>MMMM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey4" default="false" type="medium" usage="DATE" formatindex="37">
+ <FormatCode>QQ YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey9" default="false" type="medium" usage="DATE" formatindex="38">
+ <FormatCode>WW</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey1" default="false" type="short" usage="TIME" formatindex="39">
+ <FormatCode>HH:MM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey2" default="false" type="medium" usage="TIME" formatindex="40">
+ <FormatCode>HH:MM:SS</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey3" default="true" type="short" usage="TIME" formatindex="41">
+ <FormatCode>HH:MM AM/PM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey4" default="true" type="medium" usage="TIME" formatindex="42">
+ <FormatCode>HH:MM:SS AM/PM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey5" default="false" type="medium" usage="TIME" formatindex="43">
+ <FormatCode>[HH]:MM:SS</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey6" default="false" type="short" usage="TIME" formatindex="44">
+ <FormatCode>MM:SS.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey7" default="false" type="medium" usage="TIME" formatindex="45">
+ <FormatCode>[HH]:MM:SS.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateTimeFormatskey1" default="true" type="medium" usage="DATE_TIME" formatindex="46">
+ <FormatCode>YY/MM/DD HH:MM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateTimeFormatskey2" default="false" type="medium" usage="DATE_TIME" formatindex="47">
+ <FormatCode>YYYY/MM/DD HH:MM:SS AM/PM</FormatCode>
+ </FormatElement>
+ </LC_FORMAT>
+ <LC_COLLATION>
+ <Collator default="true" unoid="alphanumeric"/>
+ <CollationOptions>
+ <TransliterationModules>IGNORE_CASE</TransliterationModules>
+ </CollationOptions>
+ </LC_COLLATION>
+ <LC_SEARCH>
+ <SearchOptions>
+ <TransliterationModules>IGNORE_CASE</TransliterationModules>
+ </SearchOptions>
+ </LC_SEARCH>
+ <LC_INDEX>
+ <IndexKey phonetic="false" default="true" unoid="alphanumeric">A E I O U H K L M N P W</IndexKey>
+ <UnicodeScript>0</UnicodeScript>
+ <UnicodeScript>1</UnicodeScript>
+ <FollowPageWord>p.</FollowPageWord>
+ <FollowPageWord>pp.</FollowPageWord>
+ </LC_INDEX>
+ <LC_CALENDAR>
+ <Calendar unoid="gregorian" default="true">
+ <DaysOfWeek>
+ <Day>
+ <DayID>sun</DayID>
+ <DefaultAbbrvName>LP</DefaultAbbrvName>
+ <DefaultFullName>Lāpule</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>mon</DayID>
+ <DefaultAbbrvName>P1</DefaultAbbrvName>
+ <DefaultFullName>Poʻakahi</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>tue</DayID>
+ <DefaultAbbrvName>P2</DefaultAbbrvName>
+ <DefaultFullName>Poʻalua</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>wed</DayID>
+ <DefaultAbbrvName>P3</DefaultAbbrvName>
+ <DefaultFullName>Poʻakolu</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>thu</DayID>
+ <DefaultAbbrvName>P4</DefaultAbbrvName>
+ <DefaultFullName>Poʻahā</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>fri</DayID>
+ <DefaultAbbrvName>P5</DefaultAbbrvName>
+ <DefaultFullName>Poʻalima</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>sat</DayID>
+ <DefaultAbbrvName>P6</DefaultAbbrvName>
+ <DefaultFullName>Poʻaono</DefaultFullName>
+ </Day>
+ </DaysOfWeek>
+ <MonthsOfYear>
+ <Month>
+ <MonthID>jan</MonthID>
+ <DefaultAbbrvName>Ian.</DefaultAbbrvName>
+ <DefaultFullName>Ianuali</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>feb</MonthID>
+ <DefaultAbbrvName>Pep.</DefaultAbbrvName>
+ <DefaultFullName>Pepeluali</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>mar</MonthID>
+ <DefaultAbbrvName>Mal.</DefaultAbbrvName>
+ <DefaultFullName>Malaki</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>apr</MonthID>
+ <DefaultAbbrvName>ʻAp.</DefaultAbbrvName>
+ <DefaultFullName>ʻApelila</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>may</MonthID>
+ <DefaultAbbrvName>Mei</DefaultAbbrvName>
+ <DefaultFullName>Mei</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>jun</MonthID>
+ <DefaultAbbrvName>Iun.</DefaultAbbrvName>
+ <DefaultFullName>Iune</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>jul</MonthID>
+ <DefaultAbbrvName>Iul.</DefaultAbbrvName>
+ <DefaultFullName>Iulai</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>aug</MonthID>
+ <DefaultAbbrvName>ʻAuk.</DefaultAbbrvName>
+ <DefaultFullName>ʻAukake</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>sep</MonthID>
+ <DefaultAbbrvName>Kep.</DefaultAbbrvName>
+ <DefaultFullName>Kepakemapa</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>oct</MonthID>
+ <DefaultAbbrvName>ʻOk.</DefaultAbbrvName>
+ <DefaultFullName>ʻOkakopa</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>nov</MonthID>
+ <DefaultAbbrvName>Now.</DefaultAbbrvName>
+ <DefaultFullName>Nowemapa</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>dec</MonthID>
+ <DefaultAbbrvName>Kek.</DefaultAbbrvName>
+ <DefaultFullName>Kekemapa</DefaultFullName>
+ </Month>
+ </MonthsOfYear>
+ <Eras>
+ <Era>
+ <EraID>bc</EraID>
+ <DefaultAbbrvName>BC</DefaultAbbrvName>
+ <DefaultFullName>BC</DefaultFullName>
+ </Era>
+ <Era>
+ <EraID>ad</EraID>
+ <DefaultAbbrvName>CE</DefaultAbbrvName>
+ <DefaultFullName>CE</DefaultFullName>
+ </Era>
+ </Eras>
+ <StartDayOfWeek>
+ <DayID>mon</DayID>
+ </StartDayOfWeek>
+ <MinimalDaysInFirstWeek>1</MinimalDaysInFirstWeek>
+ </Calendar>
+ </LC_CALENDAR>
+ <LC_CURRENCY>
+ <Currency default="true" usedInCompatibleFormatCodes="true">
+ <CurrencyID>USD</CurrencyID>
+ <CurrencySymbol>$</CurrencySymbol>
+ <BankSymbol>USD</BankSymbol>
+ <CurrencyName>Kālā ʻAmelika</CurrencyName>
+ <DecimalPlaces>2</DecimalPlaces>
+ </Currency>
+ </LC_CURRENCY>
+ <LC_TRANSLITERATION>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
+ <Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="IGNORE_CASE"/>
+ </LC_TRANSLITERATION>
+ <LC_MISC>
+ <ReservedWords>
+ <trueWord>ʻOiaʻiʻo</trueWord>
+ <falseWord>Hewa</falseWord>
+ <quarter1Word>Kau Hapahā 1</quarter1Word>
+ <quarter2Word>Kau Hapaha 2</quarter2Word>
+ <quarter3Word>Kau Hapahā 3</quarter3Word>
+ <quarter4Word>Kau Hapahā 4</quarter4Word>
+ <aboveWord>Luna</aboveWord>
+ <belowWord>Lalo</belowWord>
+ <quarter1Abbreviation>KH1</quarter1Abbreviation>
+ <quarter2Abbreviation>KH2</quarter2Abbreviation>
+ <quarter3Abbreviation>KH3</quarter3Abbreviation>
+ <quarter4Abbreviation>KH4</quarter4Abbreviation>
+ </ReservedWords>
+ </LC_MISC>
+ <LC_NumberingLevel>
+ <NumberingLevel NumType="4" Prefix=" " Suffix=")"/>
+ <NumberingLevel NumType="4" Prefix=" " Suffix="."/>
+ <NumberingLevel NumType="4" Prefix="(" Suffix=")"/>
+ <NumberingLevel NumType="2" Prefix=" " Suffix="."/>
+ <NumberingLevel NumType="0" Prefix=" " Suffix=")"/>
+ <NumberingLevel NumType="1" Prefix=" " Suffix=")"/>
+ <NumberingLevel NumType="1" Prefix="(" Suffix=")"/>
+ <NumberingLevel NumType="3" Prefix=" " Suffix="."/>
+ </LC_NumberingLevel>
+ <LC_OutLineNumberingLevel ref="en_US"/>
+</Locale>
+<!--Version 1.0 -->
diff --git a/i18npool/source/localedata/data/hsb_DE.xml b/i18npool/source/localedata/data/hsb_DE.xml
index 6513dad5f57e..1e4c70a26fd3 100644
--- a/i18npool/source/localedata/data/hsb_DE.xml
+++ b/i18npool/source/localedata/data/hsb_DE.xml
@@ -34,7 +34,7 @@
<TimePM>popołdnju</TimePM>
<MeasurementSystem>metric</MeasurementSystem>
</LC_CTYPE>
- <LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$€-042E]">
+ <LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$€-42E]">
<FormatElement msgid="FixedFormatskey1" default="true" type="medium" usage="FIXED_NUMBER" formatindex="0">
<FormatCode>Standard</FormatCode>
</FormatElement>
diff --git a/i18npool/source/localedata/data/ht_HT.xml b/i18npool/source/localedata/data/ht_HT.xml
new file mode 100644
index 000000000000..99109c72a909
--- /dev/null
+++ b/i18npool/source/localedata/data/ht_HT.xml
@@ -0,0 +1,358 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE Locale SYSTEM 'locale.dtd'>
+<Locale versionDTD="2.0.3" allowUpdateFromCLDR="no" version="1.0">
+ <LC_INFO>
+ <Language>
+ <LangID>ht</LangID>
+ <DefaultName>Haitian Creole</DefaultName>
+ </Language>
+ <Country>
+ <CountryID>HT</CountryID>
+ <DefaultName>Haiti</DefaultName>
+ </Country>
+ </LC_INFO>
+ <LC_CTYPE unoid="generic">
+ <Separators>
+ <DateSeparator>/</DateSeparator>
+ <ThousandSeparator>,</ThousandSeparator>
+ <DecimalSeparator>.</DecimalSeparator>
+ <TimeSeparator>:</TimeSeparator>
+ <Time100SecSeparator>.</Time100SecSeparator>
+ <ListSeparator>;</ListSeparator>
+ <LongDateDayOfWeekSeparator>, </LongDateDayOfWeekSeparator>
+ <LongDateDaySeparator>, </LongDateDaySeparator>
+ <LongDateMonthSeparator> </LongDateMonthSeparator>
+ <LongDateYearSeparator> </LongDateYearSeparator>
+ </Separators>
+ <Markers>
+ <QuotationStart>‘</QuotationStart>
+ <QuotationEnd>’</QuotationEnd>
+ <DoubleQuotationStart>“</DoubleQuotationStart>
+ <DoubleQuotationEnd>”</DoubleQuotationEnd>
+ </Markers>
+ <TimeAM>AM</TimeAM>
+ <TimePM>PM</TimePM>
+ <MeasurementSystem>metric</MeasurementSystem>
+ </LC_CTYPE>
+ <LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$G-65A]">
+ <FormatElement msgid="FixedFormatskey1" default="true" type="medium" usage="FIXED_NUMBER" formatindex="0">
+ <FormatCode>General</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey2" default="true" type="short" usage="FIXED_NUMBER" formatindex="1">
+ <FormatCode>0</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey3" default="false" type="medium" usage="FIXED_NUMBER" formatindex="2">
+ <FormatCode>0.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey4" default="false" type="short" usage="FIXED_NUMBER" formatindex="3">
+ <FormatCode>#,##0</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey5" default="false" type="medium" usage="FIXED_NUMBER" formatindex="4">
+ <FormatCode>#,##0.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey6" default="false" type="medium" usage="FIXED_NUMBER" formatindex="5">
+ <FormatCode>#,###.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="ScientificFormatskey1" default="true" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="6">
+ <FormatCode>0.00E+00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="ScientificFormatskey2" default="false" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="7">
+ <FormatCode>0.00E+000</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="PercentFormatskey1" default="true" type="short" usage="PERCENT_NUMBER" formatindex="8">
+ <FormatCode>0%</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="PercentFormatskey2" default="true" type="long" usage="PERCENT_NUMBER" formatindex="9">
+ <FormatCode>0.00%</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey1" default="true" type="short" usage="CURRENCY" formatindex="12">
+ <FormatCode>[CURRENCY]#,##0;-[CURRENCY]#,##0</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey2" default="false" type="medium" usage="CURRENCY" formatindex="13">
+ <FormatCode>[CURRENCY]#,##0.00;-[CURRENCY]#,##0.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey3" default="false" type="medium" usage="CURRENCY" formatindex="14">
+ <FormatCode>[CURRENCY]#,##0;[RED]-[CURRENCY]#,##0</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey4" default="true" type="medium" usage="CURRENCY" formatindex="15">
+ <FormatCode>[CURRENCY]#,##0.00;[RED]-[CURRENCY]#,##0.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey5" default="false" type="medium" usage="CURRENCY" formatindex="16">
+ <FormatCode>CCC#,##0.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey6" default="false" type="medium" usage="CURRENCY" formatindex="17">
+ <FormatCode>[CURRENCY]#,##0.--;[RED]-[CURRENCY]#,##0.--</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey11" default="true" type="short" usage="DATE" formatindex="18">
+ <FormatCode>D/MM/YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey14" default="true" type="long" usage="DATE" formatindex="19">
+ <FormatCode>NNNNDD, MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey6" default="true" type="medium" usage="DATE" formatindex="20">
+ <FormatCode>DD/MM/YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey5" default="false" type="medium" usage="DATE" formatindex="21">
+ <FormatCode>DD/MM/YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey15" default="false" type="long" usage="DATE" formatindex="22">
+ <FormatCode>D, MMM YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey16" default="false" type="long" usage="DATE" formatindex="23">
+ <FormatCode>D, MMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey21" default="false" type="long" usage="DATE" formatindex="24">
+ <FormatCode>D, MMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey17" default="false" type="long" usage="DATE" formatindex="25">
+ <FormatCode>D, MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey22" default="false" type="long" usage="DATE" formatindex="26">
+ <FormatCode>D, MMMM YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey10" default="false" type="medium" usage="DATE" formatindex="27">
+ <FormatCode>NN, DD/MMM/YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey18" default="false" type="long" usage="DATE" formatindex="28">
+ <FormatCode>NN, D, MMM YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey19" default="false" type="long" usage="DATE" formatindex="29">
+ <FormatCode>NN, D, MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey20" default="false" type="long" usage="DATE" formatindex="30">
+ <FormatCode>NNNND, MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey12" default="false" type="short" usage="DATE" formatindex="31">
+ <FormatCode>MM/DD</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey7" default="false" type="medium" usage="DATE" formatindex="32">
+ <FormatCode>YY-MM-DD</FormatCode>
+ <DefaultName>ISO 8601</DefaultName>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey8" default="false" type="medium" usage="DATE" formatindex="33">
+ <FormatCode>YYYY-MM-DD</FormatCode>
+ <DefaultName>ISO 8601</DefaultName>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey1" default="false" type="medium" usage="DATE" formatindex="34">
+ <FormatCode>MM/YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey2" default="false" type="medium" usage="DATE" formatindex="35">
+ <FormatCode>MMM/DD</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey3" default="false" type="medium" usage="DATE" formatindex="36">
+ <FormatCode>MMMM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey4" default="false" type="medium" usage="DATE" formatindex="37">
+ <FormatCode>QQ YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey9" default="false" type="medium" usage="DATE" formatindex="38">
+ <FormatCode>WW</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey1" default="false" type="short" usage="TIME" formatindex="39">
+ <FormatCode>HH:MM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey2" default="false" type="medium" usage="TIME" formatindex="40">
+ <FormatCode>HH:MM:SS</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey3" default="true" type="short" usage="TIME" formatindex="41">
+ <FormatCode>HH:MM AM/PM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey4" default="true" type="medium" usage="TIME" formatindex="42">
+ <FormatCode>HH:MM:SS AM/PM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey5" default="false" type="medium" usage="TIME" formatindex="43">
+ <FormatCode>[HH]:MM:SS</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey6" default="false" type="short" usage="TIME" formatindex="44">
+ <FormatCode>MM:SS.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey7" default="false" type="medium" usage="TIME" formatindex="45">
+ <FormatCode>[HH]:MM:SS.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateTimeFormatskey1" default="true" type="medium" usage="DATE_TIME" formatindex="46">
+ <FormatCode>DD/MM/YY HH:MM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateTimeFormatskey2" default="false" type="medium" usage="DATE_TIME" formatindex="47">
+ <FormatCode>DD/MM/YYYY HH:MM:SS AM/PM</FormatCode>
+ </FormatElement>
+ </LC_FORMAT>
+ <LC_COLLATION>
+ <Collator default="true" unoid="alphanumeric"/>
+ <CollationOptions>
+ <TransliterationModules>IGNORE_CASE</TransliterationModules>
+ </CollationOptions>
+ </LC_COLLATION>
+ <LC_SEARCH>
+ <SearchOptions>
+ <TransliterationModules>IGNORE_CASE</TransliterationModules>
+ </SearchOptions>
+ </LC_SEARCH>
+ <LC_INDEX>
+ <IndexKey phonetic="false" default="true" unoid="alphanumeric">A-Z</IndexKey>
+ <UnicodeScript>0</UnicodeScript>
+ <UnicodeScript>1</UnicodeScript>
+ <FollowPageWord>s</FollowPageWord>
+ <FollowPageWord>pl</FollowPageWord>
+ </LC_INDEX>
+ <LC_CALENDAR>
+ <Calendar unoid="gregorian" default="true">
+ <DaysOfWeek>
+ <Day>
+ <DayID>sun</DayID>
+ <DefaultAbbrvName>Dim</DefaultAbbrvName>
+ <DefaultFullName>Dimanch</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>mon</DayID>
+ <DefaultAbbrvName>Len</DefaultAbbrvName>
+ <DefaultFullName>Lendi</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>tue</DayID>
+ <DefaultAbbrvName>Mad</DefaultAbbrvName>
+ <DefaultFullName>Madi</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>wed</DayID>
+ <DefaultAbbrvName>Mèk</DefaultAbbrvName>
+ <DefaultFullName>Mèkredi</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>thu</DayID>
+ <DefaultAbbrvName>Jed</DefaultAbbrvName>
+ <DefaultFullName>Jedi</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>fri</DayID>
+ <DefaultAbbrvName>Van</DefaultAbbrvName>
+ <DefaultFullName>Vandredi</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>sat</DayID>
+ <DefaultAbbrvName>Sam</DefaultAbbrvName>
+ <DefaultFullName>Samdi</DefaultFullName>
+ </Day>
+ </DaysOfWeek>
+ <MonthsOfYear>
+ <Month>
+ <MonthID>jan</MonthID>
+ <DefaultAbbrvName>Jan</DefaultAbbrvName>
+ <DefaultFullName>Janvye</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>feb</MonthID>
+ <DefaultAbbrvName>Fev</DefaultAbbrvName>
+ <DefaultFullName>Fevriye</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>mar</MonthID>
+ <DefaultAbbrvName>Mas</DefaultAbbrvName>
+ <DefaultFullName>Mas</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>apr</MonthID>
+ <DefaultAbbrvName>Avr</DefaultAbbrvName>
+ <DefaultFullName>Avril</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>may</MonthID>
+ <DefaultAbbrvName>Me</DefaultAbbrvName>
+ <DefaultFullName>Me</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>jun</MonthID>
+ <DefaultAbbrvName>Jen</DefaultAbbrvName>
+ <DefaultFullName>Jen</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>jul</MonthID>
+ <DefaultAbbrvName>Jiy</DefaultAbbrvName>
+ <DefaultFullName>Jiyè</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>aug</MonthID>
+ <DefaultAbbrvName>Dao</DefaultAbbrvName>
+ <DefaultFullName>Daout</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>sep</MonthID>
+ <DefaultAbbrvName>Sep</DefaultAbbrvName>
+ <DefaultFullName>Septanm</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>oct</MonthID>
+ <DefaultAbbrvName>Okt</DefaultAbbrvName>
+ <DefaultFullName>Oktòb</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>nov</MonthID>
+ <DefaultAbbrvName>Nov</DefaultAbbrvName>
+ <DefaultFullName>Novanm</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>dec</MonthID>
+ <DefaultAbbrvName>Des</DefaultAbbrvName>
+ <DefaultFullName>Desanm</DefaultFullName>
+ </Month>
+ </MonthsOfYear>
+ <Eras>
+ <Era>
+ <EraID>bc</EraID>
+ <DefaultAbbrvName>AJ</DefaultAbbrvName>
+ <DefaultFullName>Avan Jezikri</DefaultFullName>
+ </Era>
+ <Era>
+ <EraID>ad</EraID>
+ <DefaultAbbrvName>AP</DefaultAbbrvName>
+ <DefaultFullName>Apre Jezikri</DefaultFullName>
+ </Era>
+ </Eras>
+ <StartDayOfWeek>
+ <DayID>sun</DayID>
+ </StartDayOfWeek>
+ <MinimalDaysInFirstWeek>1</MinimalDaysInFirstWeek>
+ </Calendar>
+ </LC_CALENDAR>
+ <LC_CURRENCY>
+ <Currency default="true" usedInCompatibleFormatCodes="true">
+ <CurrencyID>HTG</CurrencyID>
+ <CurrencySymbol>G</CurrencySymbol>
+ <BankSymbol>HTG</BankSymbol>
+ <CurrencyName>Goud</CurrencyName>
+ <DecimalPlaces>2</DecimalPlaces>
+ </Currency>
+ </LC_CURRENCY>
+ <LC_TRANSLITERATION>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
+ <Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="IGNORE_CASE"/>
+ </LC_TRANSLITERATION>
+ <LC_MISC>
+ <ReservedWords>
+ <trueWord>Vre</trueWord>
+ <falseWord>Fo</falseWord>
+ <quarter1Word>Trimès 1</quarter1Word>
+ <quarter2Word>Trimès 2</quarter2Word>
+ <quarter3Word>Trimès 3</quarter3Word>
+ <quarter4Word>Trimès 4</quarter4Word>
+ <aboveWord>Anwo</aboveWord>
+ <belowWord>Anba</belowWord>
+ <quarter1Abbreviation>Trimès 1</quarter1Abbreviation>
+ <quarter2Abbreviation>Trimès 2</quarter2Abbreviation>
+ <quarter3Abbreviation>Trimès 3</quarter3Abbreviation>
+ <quarter4Abbreviation>Trimès 4</quarter4Abbreviation>
+ </ReservedWords>
+ </LC_MISC>
+ <LC_NumberingLevel>
+ <NumberingLevel NumType="4" Prefix=" " Suffix=")"/>
+ <NumberingLevel NumType="4" Prefix=" " Suffix="."/>
+ <NumberingLevel NumType="4" Prefix="(" Suffix=")"/>
+ <NumberingLevel NumType="2" Prefix=" " Suffix="."/>
+ <NumberingLevel NumType="0" Prefix=" " Suffix=")"/>
+ <NumberingLevel NumType="1" Prefix=" " Suffix=")"/>
+ <NumberingLevel NumType="1" Prefix="(" Suffix=")"/>
+ <NumberingLevel NumType="3" Prefix=" " Suffix="."/>
+ </LC_NumberingLevel>
+ <LC_OutLineNumberingLevel ref="en_US"/>
+</Locale>
+<!--Version 1.0 -->
diff --git a/i18npool/source/localedata/data/jbo.xml b/i18npool/source/localedata/data/jbo.xml
new file mode 100644
index 000000000000..403442638bd0
--- /dev/null
+++ b/i18npool/source/localedata/data/jbo.xml
@@ -0,0 +1,358 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE Locale SYSTEM 'locale.dtd'>
+<Locale versionDTD="2.0.3" allowUpdateFromCLDR="no" version="1.0">
+ <LC_INFO>
+ <Language>
+ <LangID>jbo</LangID>
+ <DefaultName>Lojban</DefaultName>
+ </Language>
+ <Country>
+ <CountryID></CountryID>
+ <DefaultName></DefaultName>
+ </Country>
+ </LC_INFO>
+ <LC_CTYPE unoid="generic">
+ <Separators>
+ <DateSeparator>/</DateSeparator>
+ <ThousandSeparator>,</ThousandSeparator>
+ <DecimalSeparator>.</DecimalSeparator>
+ <TimeSeparator>:</TimeSeparator>
+ <Time100SecSeparator>.</Time100SecSeparator>
+ <ListSeparator>;</ListSeparator>
+ <LongDateDayOfWeekSeparator>, </LongDateDayOfWeekSeparator>
+ <LongDateDaySeparator>, </LongDateDaySeparator>
+ <LongDateMonthSeparator> </LongDateMonthSeparator>
+ <LongDateYearSeparator> </LongDateYearSeparator>
+ </Separators>
+ <Markers>
+ <QuotationStart>‘</QuotationStart>
+ <QuotationEnd>’</QuotationEnd>
+ <DoubleQuotationStart>“</DoubleQuotationStart>
+ <DoubleQuotationEnd>”</DoubleQuotationEnd>
+ </Markers>
+ <TimeAM>PDM</TimeAM>
+ <TimePM>BDM</TimePM>
+ <MeasurementSystem>metric</MeasurementSystem>
+ </LC_CTYPE>
+ <LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$€-658]">
+ <FormatElement msgid="FixedFormatskey1" default="true" type="medium" usage="FIXED_NUMBER" formatindex="0">
+ <FormatCode>General</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey2" default="true" type="short" usage="FIXED_NUMBER" formatindex="1">
+ <FormatCode>0</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey3" default="false" type="medium" usage="FIXED_NUMBER" formatindex="2">
+ <FormatCode>0.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey4" default="false" type="short" usage="FIXED_NUMBER" formatindex="3">
+ <FormatCode>#,##0</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey5" default="false" type="medium" usage="FIXED_NUMBER" formatindex="4">
+ <FormatCode>#,##0.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey6" default="false" type="medium" usage="FIXED_NUMBER" formatindex="5">
+ <FormatCode>#,###.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="ScientificFormatskey1" default="true" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="6">
+ <FormatCode>0.00E+00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="ScientificFormatskey2" default="false" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="7">
+ <FormatCode>0.00E+000</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="PercentFormatskey1" default="true" type="short" usage="PERCENT_NUMBER" formatindex="8">
+ <FormatCode>0%</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="PercentFormatskey2" default="true" type="long" usage="PERCENT_NUMBER" formatindex="9">
+ <FormatCode>0.00%</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey1" default="true" type="short" usage="CURRENCY" formatindex="12">
+ <FormatCode>[CURRENCY]#,##0;-[CURRENCY]#,##0</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey2" default="false" type="medium" usage="CURRENCY" formatindex="13">
+ <FormatCode>[CURRENCY]#,##0.00;-[CURRENCY]#,##0.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey3" default="false" type="medium" usage="CURRENCY" formatindex="14">
+ <FormatCode>[CURRENCY]#,##0;[RED]-[CURRENCY]#,##0</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey4" default="true" type="medium" usage="CURRENCY" formatindex="15">
+ <FormatCode>[CURRENCY]#,##0.00;[RED]-[CURRENCY]#,##0.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey5" default="false" type="medium" usage="CURRENCY" formatindex="16">
+ <FormatCode>CCC#,##0.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey6" default="false" type="medium" usage="CURRENCY" formatindex="17">
+ <FormatCode>[CURRENCY]#,##0.--;[RED]-[CURRENCY]#,##0.--</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey11" default="true" type="short" usage="DATE" formatindex="18">
+ <FormatCode>D/MM/YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey14" default="true" type="long" usage="DATE" formatindex="19">
+ <FormatCode>NNNNDD, MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey6" default="true" type="medium" usage="DATE" formatindex="20">
+ <FormatCode>DD/MM/YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey5" default="false" type="medium" usage="DATE" formatindex="21">
+ <FormatCode>DD/MM/YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey15" default="false" type="long" usage="DATE" formatindex="22">
+ <FormatCode>D, MMM YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey16" default="false" type="long" usage="DATE" formatindex="23">
+ <FormatCode>D, MMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey21" default="false" type="long" usage="DATE" formatindex="24">
+ <FormatCode>D, MMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey17" default="false" type="long" usage="DATE" formatindex="25">
+ <FormatCode>D, MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey22" default="false" type="long" usage="DATE" formatindex="26">
+ <FormatCode>D, MMMM YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey10" default="false" type="medium" usage="DATE" formatindex="27">
+ <FormatCode>NN, DD/MMM/YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey18" default="false" type="long" usage="DATE" formatindex="28">
+ <FormatCode>NN, D, MMM YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey19" default="false" type="long" usage="DATE" formatindex="29">
+ <FormatCode>NN, D, MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey20" default="false" type="long" usage="DATE" formatindex="30">
+ <FormatCode>NNNND, MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey12" default="false" type="short" usage="DATE" formatindex="31">
+ <FormatCode>DD/MM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey7" default="false" type="medium" usage="DATE" formatindex="32">
+ <FormatCode>YY-MM-DD</FormatCode>
+ <DefaultName>ISO 8601</DefaultName>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey8" default="false" type="medium" usage="DATE" formatindex="33">
+ <FormatCode>YYYY-MM-DD</FormatCode>
+ <DefaultName>ISO 8601</DefaultName>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey1" default="false" type="medium" usage="DATE" formatindex="34">
+ <FormatCode>MM/YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey2" default="false" type="medium" usage="DATE" formatindex="35">
+ <FormatCode>MMM/DD</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey3" default="false" type="medium" usage="DATE" formatindex="36">
+ <FormatCode>MMMM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey4" default="false" type="medium" usage="DATE" formatindex="37">
+ <FormatCode>QQ YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey9" default="false" type="medium" usage="DATE" formatindex="38">
+ <FormatCode>WW</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey1" default="false" type="short" usage="TIME" formatindex="39">
+ <FormatCode>HH:MM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey2" default="false" type="medium" usage="TIME" formatindex="40">
+ <FormatCode>HH:MM:SS</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey3" default="true" type="short" usage="TIME" formatindex="41">
+ <FormatCode>HH:MM AM/PM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey4" default="true" type="medium" usage="TIME" formatindex="42">
+ <FormatCode>HH:MM:SS AM/PM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey5" default="false" type="medium" usage="TIME" formatindex="43">
+ <FormatCode>[HH]:MM:SS</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey6" default="false" type="short" usage="TIME" formatindex="44">
+ <FormatCode>MM:SS.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey7" default="false" type="medium" usage="TIME" formatindex="45">
+ <FormatCode>[HH]:MM:SS.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateTimeFormatskey1" default="true" type="medium" usage="DATE_TIME" formatindex="46">
+ <FormatCode>DD/MM/YY HH:MM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateTimeFormatskey2" default="false" type="medium" usage="DATE_TIME" formatindex="47">
+ <FormatCode>DD/MM/YYYY HH:MM:SS AM/PM</FormatCode>
+ </FormatElement>
+ </LC_FORMAT>
+ <LC_COLLATION>
+ <Collator default="true" unoid="alphanumeric"/>
+ <CollationOptions>
+ <TransliterationModules>IGNORE_CASE</TransliterationModules>
+ </CollationOptions>
+ </LC_COLLATION>
+ <LC_SEARCH>
+ <SearchOptions>
+ <TransliterationModules>IGNORE_CASE</TransliterationModules>
+ </SearchOptions>
+ </LC_SEARCH>
+ <LC_INDEX>
+ <IndexKey phonetic="false" default="true" unoid="alphanumeric">A-Z</IndexKey>
+ <UnicodeScript>0</UnicodeScript>
+ <UnicodeScript>1</UnicodeScript>
+ <FollowPageWord>BP</FollowPageWord>
+ <FollowPageWord>BP</FollowPageWord>
+ </LC_INDEX>
+ <LC_CALENDAR>
+ <Calendar unoid="gregorian" default="true">
+ <DaysOfWeek>
+ <Day>
+ <DayID>sun</DayID>
+ <DefaultAbbrvName>nondei</DefaultAbbrvName>
+ <DefaultFullName>nondei</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>mon</DayID>
+ <DefaultAbbrvName>pavdei</DefaultAbbrvName>
+ <DefaultFullName>pavdei</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>tue</DayID>
+ <DefaultAbbrvName>reldei</DefaultAbbrvName>
+ <DefaultFullName>reldei</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>wed</DayID>
+ <DefaultAbbrvName>cibdei</DefaultAbbrvName>
+ <DefaultFullName>cibdei</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>thu</DayID>
+ <DefaultAbbrvName>vondei</DefaultAbbrvName>
+ <DefaultFullName>vondei</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>fri</DayID>
+ <DefaultAbbrvName>mumdei</DefaultAbbrvName>
+ <DefaultFullName>mumdei</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>sat</DayID>
+ <DefaultAbbrvName>xavdei</DefaultAbbrvName>
+ <DefaultFullName>xavdei</DefaultFullName>
+ </Day>
+ </DaysOfWeek>
+ <MonthsOfYear>
+ <Month>
+ <MonthID>jan</MonthID>
+ <DefaultAbbrvName>pavma'i</DefaultAbbrvName>
+ <DefaultFullName>pavmasti</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>feb</MonthID>
+ <DefaultAbbrvName>relma'i</DefaultAbbrvName>
+ <DefaultFullName>relmasti</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>mar</MonthID>
+ <DefaultAbbrvName>cibma'i</DefaultAbbrvName>
+ <DefaultFullName>cibmasti</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>apr</MonthID>
+ <DefaultAbbrvName>vonma'i</DefaultAbbrvName>
+ <DefaultFullName>vonmasti</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>may</MonthID>
+ <DefaultAbbrvName>mumyma'i</DefaultAbbrvName>
+ <DefaultFullName>mumymasti</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>jun</MonthID>
+ <DefaultAbbrvName>xavma'i</DefaultAbbrvName>
+ <DefaultFullName>xavmasti</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>jul</MonthID>
+ <DefaultAbbrvName>zelma'i</DefaultAbbrvName>
+ <DefaultFullName>zelmasti</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>aug</MonthID>
+ <DefaultAbbrvName>bivma'i</DefaultAbbrvName>
+ <DefaultFullName>bivmasti</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>sep</MonthID>
+ <DefaultAbbrvName>sozma'i</DefaultAbbrvName>
+ <DefaultFullName>sozmasti</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>oct</MonthID>
+ <DefaultAbbrvName>daurma'i</DefaultAbbrvName>
+ <DefaultFullName>daurmasti</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>nov</MonthID>
+ <DefaultAbbrvName>feirma'i</DefaultAbbrvName>
+ <DefaultFullName>feirmasti</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>dec</MonthID>
+ <DefaultAbbrvName>gairma'i</DefaultAbbrvName>
+ <DefaultFullName>gairmasti</DefaultFullName>
+ </Month>
+ </MonthsOfYear>
+ <Eras>
+ <Era>
+ <EraID>bc</EraID>
+ <DefaultAbbrvName>PLK</DefaultAbbrvName>
+ <DefaultFullName>purci la .kraist.</DefaultFullName>
+ </Era>
+ <Era>
+ <EraID>ad</EraID>
+ <DefaultAbbrvName>NLK</DefaultAbbrvName>
+ <DefaultFullName>nanca la .kraist.</DefaultFullName>
+ </Era>
+ </Eras>
+ <StartDayOfWeek>
+ <DayID>mon</DayID>
+ </StartDayOfWeek>
+ <MinimalDaysInFirstWeek>1</MinimalDaysInFirstWeek>
+ </Calendar>
+ </LC_CALENDAR>
+ <LC_CURRENCY>
+ <Currency default="true" usedInCompatibleFormatCodes="true">
+ <CurrencyID>EUR</CurrencyID>
+ <CurrencySymbol>€</CurrencySymbol>
+ <BankSymbol>EUR</BankSymbol>
+ <CurrencyName>jdini</CurrencyName>
+ <DecimalPlaces>2</DecimalPlaces>
+ </Currency>
+ </LC_CURRENCY>
+ <LC_TRANSLITERATION>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
+ <Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="IGNORE_CASE"/>
+ </LC_TRANSLITERATION>
+ <LC_MISC>
+ <ReservedWords>
+ <trueWord>jetnu</trueWord>
+ <falseWord>jitfa</falseWord>
+ <quarter1Word>pa moi vo si'e</quarter1Word>
+ <quarter2Word>re moi vo si'e</quarter2Word>
+ <quarter3Word>ci moi vo si'e</quarter3Word>
+ <quarter4Word>vo moi vo si'e</quarter4Word>
+ <aboveWord>gapru</aboveWord>
+ <belowWord>cnita</belowWord>
+ <quarter1Abbreviation>1MVS</quarter1Abbreviation>
+ <quarter2Abbreviation>2MVS</quarter2Abbreviation>
+ <quarter3Abbreviation>3MVS</quarter3Abbreviation>
+ <quarter4Abbreviation>4MVS</quarter4Abbreviation>
+ </ReservedWords>
+ </LC_MISC>
+ <LC_NumberingLevel>
+ <NumberingLevel NumType="4" Prefix=" " Suffix=")"/>
+ <NumberingLevel NumType="4" Prefix=" " Suffix="."/>
+ <NumberingLevel NumType="4" Prefix="(" Suffix=")"/>
+ <NumberingLevel NumType="2" Prefix=" " Suffix="."/>
+ <NumberingLevel NumType="0" Prefix=" " Suffix=")"/>
+ <NumberingLevel NumType="1" Prefix=" " Suffix=")"/>
+ <NumberingLevel NumType="1" Prefix="(" Suffix=")"/>
+ <NumberingLevel NumType="3" Prefix=" " Suffix="."/>
+ </LC_NumberingLevel>
+ <LC_OutLineNumberingLevel ref="en_US"/>
+</Locale>
+<!--Version 1.0 -->
diff --git a/i18npool/source/localedata/data/lif_NP.xml b/i18npool/source/localedata/data/lif_NP.xml
new file mode 100644
index 000000000000..fadbfad11ff3
--- /dev/null
+++ b/i18npool/source/localedata/data/lif_NP.xml
@@ -0,0 +1,357 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE Locale SYSTEM 'locale.dtd'>
+<Locale versionDTD="2.0.3" allowUpdateFromCLDR="no" version="1.0">
+ <LC_INFO>
+ <Language>
+ <LangID>lif</LangID>
+ <DefaultName>Limbu</DefaultName>
+ </Language>
+ <Country>
+ <CountryID>NP</CountryID>
+ <DefaultName>Nepal</DefaultName>
+ </Country>
+ </LC_INFO>
+ <LC_CTYPE unoid="generic">
+ <Separators>
+ <DateSeparator>/</DateSeparator>
+ <ThousandSeparator>,</ThousandSeparator>
+ <DecimalSeparator>.</DecimalSeparator>
+ <TimeSeparator>:</TimeSeparator>
+ <Time100SecSeparator>.</Time100SecSeparator>
+ <ListSeparator>;</ListSeparator>
+ <LongDateDayOfWeekSeparator>, </LongDateDayOfWeekSeparator>
+ <LongDateDaySeparator>, </LongDateDaySeparator>
+ <LongDateMonthSeparator> </LongDateMonthSeparator>
+ <LongDateYearSeparator> </LongDateYearSeparator>
+ </Separators>
+ <Markers>
+ <QuotationStart>‘</QuotationStart>
+ <QuotationEnd>’</QuotationEnd>
+ <DoubleQuotationStart>“</DoubleQuotationStart>
+ <DoubleQuotationEnd>”</DoubleQuotationEnd>
+ </Markers>
+ <TimeAM>पूर्वान्ह</TimeAM>
+ <TimePM>अपरान्ह</TimePM>
+ <MeasurementSystem>metric</MeasurementSystem>
+ </LC_CTYPE>
+ <LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$रू-657]">
+ <FormatElement msgid="FixedFormatskey1" default="true" type="medium" usage="FIXED_NUMBER" formatindex="0">
+ <FormatCode>General</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey2" default="true" type="short" usage="FIXED_NUMBER" formatindex="1">
+ <FormatCode>0</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey3" default="false" type="medium" usage="FIXED_NUMBER" formatindex="2">
+ <FormatCode>0.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey4" default="false" type="short" usage="FIXED_NUMBER" formatindex="3">
+ <FormatCode>#,##0</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey5" default="false" type="medium" usage="FIXED_NUMBER" formatindex="4">
+ <FormatCode>#,##0.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey6" default="false" type="medium" usage="FIXED_NUMBER" formatindex="5">
+ <FormatCode>#,###.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="ScientificFormatskey1" default="true" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="6">
+ <FormatCode>0.00E+00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="ScientificFormatskey2" default="false" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="7">
+ <FormatCode>0.00E+000</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="PercentFormatskey1" default="true" type="short" usage="PERCENT_NUMBER" formatindex="8">
+ <FormatCode>0%</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="PercentFormatskey2" default="true" type="long" usage="PERCENT_NUMBER" formatindex="9">
+ <FormatCode>0.00%</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey1" default="true" type="short" usage="CURRENCY" formatindex="12">
+ <FormatCode>[CURRENCY] #,##0;-[CURRENCY] #,##0</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey2" default="false" type="medium" usage="CURRENCY" formatindex="13">
+ <FormatCode>[CURRENCY] #,##0.00;-[CURRENCY] #,##0.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey3" default="false" type="medium" usage="CURRENCY" formatindex="14">
+ <FormatCode>[CURRENCY] #,##0;[RED]-[CURRENCY] #,##0</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey4" default="true" type="medium" usage="CURRENCY" formatindex="15">
+ <FormatCode>[CURRENCY] #,##0.00;[RED]-[CURRENCY] #,##0.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey5" default="false" type="medium" usage="CURRENCY" formatindex="16">
+ <FormatCode>CCC#,##0.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey6" default="false" type="medium" usage="CURRENCY" formatindex="17">
+ <FormatCode>[CURRENCY] #,##0.--;[RED]-[CURRENCY] #,##0.--</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey11" default="true" type="short" usage="DATE" formatindex="18">
+ <FormatCode>YY/MM/DD</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey14" default="true" type="long" usage="DATE" formatindex="19">
+ <FormatCode>NNNNDD, MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey6" default="true" type="medium" usage="DATE" formatindex="20">
+ <FormatCode>YY/MM/DD</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey5" default="false" type="medium" usage="DATE" formatindex="21">
+ <FormatCode>YYYY/MM/DD</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey15" default="false" type="long" usage="DATE" formatindex="22">
+ <FormatCode>D, MMM YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey16" default="false" type="long" usage="DATE" formatindex="23">
+ <FormatCode>D, MMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey21" default="false" type="long" usage="DATE" formatindex="24">
+ <FormatCode>D, MMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey17" default="false" type="long" usage="DATE" formatindex="25">
+ <FormatCode>D, MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey22" default="false" type="long" usage="DATE" formatindex="26">
+ <FormatCode>D, MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey10" default="false" type="medium" usage="DATE" formatindex="27">
+ <FormatCode>NN, DD/MMM/YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey18" default="false" type="long" usage="DATE" formatindex="28">
+ <FormatCode>NN, D, MMM YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey19" default="false" type="long" usage="DATE" formatindex="29">
+ <FormatCode>NN, D, MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey20" default="false" type="long" usage="DATE" formatindex="30">
+ <FormatCode>NNNND, MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey12" default="false" type="short" usage="DATE" formatindex="31">
+ <FormatCode>MM/DD</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey7" default="false" type="medium" usage="DATE" formatindex="32">
+ <FormatCode>YY-MM-DD</FormatCode>
+ <DefaultName>ISO 8601</DefaultName>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey8" default="false" type="medium" usage="DATE" formatindex="33">
+ <FormatCode>YYYY-MM-DD</FormatCode>
+ <DefaultName>ISO 8601</DefaultName>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey1" default="false" type="medium" usage="DATE" formatindex="34">
+ <FormatCode>YY/MM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey2" default="false" type="medium" usage="DATE" formatindex="35">
+ <FormatCode>MMM/DD</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey3" default="false" type="medium" usage="DATE" formatindex="36">
+ <FormatCode>MMMM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey4" default="false" type="medium" usage="DATE" formatindex="37">
+ <FormatCode>QQ YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey9" default="false" type="medium" usage="DATE" formatindex="38">
+ <FormatCode>WW</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey1" default="false" type="short" usage="TIME" formatindex="39">
+ <FormatCode>HH:MM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey2" default="false" type="medium" usage="TIME" formatindex="40">
+ <FormatCode>HH:MM:SS</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey3" default="true" type="short" usage="TIME" formatindex="41">
+ <FormatCode>HH:MM AM/PM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey4" default="true" type="medium" usage="TIME" formatindex="42">
+ <FormatCode>HH:MM:SS AM/PM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey5" default="false" type="medium" usage="TIME" formatindex="43">
+ <FormatCode>[HH]:MM:SS</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey6" default="false" type="short" usage="TIME" formatindex="44">
+ <FormatCode>MM:SS.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey7" default="false" type="medium" usage="TIME" formatindex="45">
+ <FormatCode>[HH]:MM:SS.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateTimeFormatskey1" default="true" type="medium" usage="DATE_TIME" formatindex="46">
+ <FormatCode>YY/MM/DD HH:MM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateTimeFormatskey2" default="false" type="medium" usage="DATE_TIME" formatindex="47">
+ <FormatCode>YYYY/MM/DD HH:MM:SS AM/PM</FormatCode>
+ </FormatElement>
+ </LC_FORMAT>
+ <LC_COLLATION>
+ <Collator default="true" unoid="alphanumeric"/>
+ <CollationOptions>
+ <TransliterationModules>IGNORE_CASE</TransliterationModules>
+ </CollationOptions>
+ </LC_COLLATION>
+ <LC_SEARCH>
+ <SearchOptions>
+ <TransliterationModules>IGNORE_CASE</TransliterationModules>
+ </SearchOptions>
+ </LC_SEARCH>
+ <LC_INDEX>
+ <IndexKey phonetic="false" default="true" unoid="alphanumeric">ᤁ-ᤜ</IndexKey>
+ <UnicodeScript>85</UnicodeScript>
+ <FollowPageWord>p.</FollowPageWord>
+ <FollowPageWord>pp.</FollowPageWord>
+ </LC_INDEX>
+ <LC_CALENDAR>
+ <Calendar unoid="gregorian" default="true">
+ <DaysOfWeek>
+ <Day>
+ <DayID>sun</DayID>
+ <DefaultAbbrvName>ᤋᤧᤏᤧᤒᤠ</DefaultAbbrvName>
+ <DefaultFullName>ᤋᤧᤏᤧᤒᤠ</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>mon</DayID>
+ <DefaultAbbrvName>ᤑᤥᤖᤠᤒᤠ</DefaultAbbrvName>
+ <DefaultFullName>ᤑᤥᤖᤠᤒᤠ</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>tue</DayID>
+ <DefaultAbbrvName>ᤔᤡᤰᤜᤠᤱᤒᤠ</DefaultAbbrvName>
+ <DefaultFullName>ᤔᤡᤰᤜᤠᤱᤒᤠ</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>wed</DayID>
+ <DefaultAbbrvName>ᤂᤧᤰᤛᤢᤒᤠ</DefaultAbbrvName>
+ <DefaultFullName>ᤂᤧᤰᤛᤢᤒᤠ</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>thu</DayID>
+ <DefaultAbbrvName>ᤁᤢᤖᤢ᤺ᤵᤐᤠ</DefaultAbbrvName>
+ <DefaultFullName>ᤁᤢᤖᤢ᤺ᤵᤐᤠ</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>fri</DayID>
+ <DefaultAbbrvName>ᤑᤛᤢ᤺ᤵᤐᤠ</DefaultAbbrvName>
+ <DefaultFullName>ᤑᤛᤢ᤺ᤵᤐᤠ</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>sat</DayID>
+ <DefaultAbbrvName>ᤛᤧᤴᤇᤪᤧᤱᤒᤠ</DefaultAbbrvName>
+ <DefaultFullName>ᤛᤧᤴᤇᤪᤧᤱᤒᤠ</DefaultFullName>
+ </Day>
+ </DaysOfWeek>
+ <MonthsOfYear>
+ <Month>
+ <MonthID>jan</MonthID>
+ <DefaultAbbrvName>जन</DefaultAbbrvName>
+ <DefaultFullName>जनवरी</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>feb</MonthID>
+ <DefaultAbbrvName>फेब</DefaultAbbrvName>
+ <DefaultFullName>फेब्रुअरी</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>mar</MonthID>
+ <DefaultAbbrvName>मार्च</DefaultAbbrvName>
+ <DefaultFullName>मार्च</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>apr</MonthID>
+ <DefaultAbbrvName>अप्रि</DefaultAbbrvName>
+ <DefaultFullName>अप्रिल</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>may</MonthID>
+ <DefaultAbbrvName>मे</DefaultAbbrvName>
+ <DefaultFullName>मे</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>jun</MonthID>
+ <DefaultAbbrvName>जुन</DefaultAbbrvName>
+ <DefaultFullName>जुन</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>jul</MonthID>
+ <DefaultAbbrvName>जुला</DefaultAbbrvName>
+ <DefaultFullName>जुलाई</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>aug</MonthID>
+ <DefaultAbbrvName>अग</DefaultAbbrvName>
+ <DefaultFullName>अगस्त</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>sep</MonthID>
+ <DefaultAbbrvName>सेप्ट</DefaultAbbrvName>
+ <DefaultFullName>सेप्टेम्बर</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>oct</MonthID>
+ <DefaultAbbrvName>अक्टो</DefaultAbbrvName>
+ <DefaultFullName>अक्टोबर</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>nov</MonthID>
+ <DefaultAbbrvName>नोभे</DefaultAbbrvName>
+ <DefaultFullName>नोभेम्बर</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>dec</MonthID>
+ <DefaultAbbrvName>डिसे</DefaultAbbrvName>
+ <DefaultFullName>डिसेम्बर</DefaultFullName>
+ </Month>
+ </MonthsOfYear>
+ <Eras>
+ <Era>
+ <EraID>bc</EraID>
+ <DefaultAbbrvName>ईसापूर्व</DefaultAbbrvName>
+ <DefaultFullName>ईसापूर्व</DefaultFullName>
+ </Era>
+ <Era>
+ <EraID>ad</EraID>
+ <DefaultAbbrvName>सन्</DefaultAbbrvName>
+ <DefaultFullName>सन्</DefaultFullName>
+ </Era>
+ </Eras>
+ <StartDayOfWeek>
+ <DayID>sun</DayID>
+ </StartDayOfWeek>
+ <MinimalDaysInFirstWeek>1</MinimalDaysInFirstWeek>
+ </Calendar>
+ </LC_CALENDAR>
+ <LC_CURRENCY>
+ <Currency default="true" usedInCompatibleFormatCodes="true">
+ <CurrencyID>NPR</CurrencyID>
+ <CurrencySymbol>रू</CurrencySymbol>
+ <BankSymbol>NPR</BankSymbol>
+ <CurrencyName>Nepalese Rupee</CurrencyName>
+ <DecimalPlaces>2</DecimalPlaces>
+ </Currency>
+ </LC_CURRENCY>
+ <LC_TRANSLITERATION>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
+ <Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="IGNORE_CASE"/>
+ </LC_TRANSLITERATION>
+ <LC_MISC>
+ <ReservedWords>
+ <trueWord>ठीक</trueWord>
+ <falseWord>बेठीक</falseWord>
+ <quarter1Word>पहिलो सत्र</quarter1Word>
+ <quarter2Word>दोस्रो सत्र</quarter2Word>
+ <quarter3Word>तेस्रो सत्र</quarter3Word>
+ <quarter4Word>चौथो सत्र</quarter4Word>
+ <aboveWord>माथि</aboveWord>
+ <belowWord>तल</belowWord>
+ <quarter1Abbreviation>Q1</quarter1Abbreviation>
+ <quarter2Abbreviation>Q2</quarter2Abbreviation>
+ <quarter3Abbreviation>Q3</quarter3Abbreviation>
+ <quarter4Abbreviation>Q4</quarter4Abbreviation>
+ </ReservedWords>
+ </LC_MISC>
+ <LC_NumberingLevel>
+ <NumberingLevel NumType="12" Prefix=" " Suffix=")"/>
+ <NumberingLevel NumType="12" Prefix=" " Suffix="."/>
+ <NumberingLevel NumType="12" Prefix="(" Suffix=")"/>
+ <NumberingLevel NumType="2" Prefix=" " Suffix="."/>
+ <NumberingLevel NumType="2" Prefix=" " Suffix=")"/>
+ <NumberingLevel NumType="3" Prefix=" " Suffix=")"/>
+ <NumberingLevel NumType="3" Prefix="(" Suffix=")"/>
+ <NumberingLevel NumType="12" Prefix=" " Suffix="."/>
+ </LC_NumberingLevel>
+ <LC_OutLineNumberingLevel ref="en_US"/>
+</Locale>
+<!--Version 1.0 -->
diff --git a/i18npool/source/localedata/data/localedata_euro.map b/i18npool/source/localedata/data/localedata_euro.map
index e0564b85ea25..b9dd20c724d7 100644
--- a/i18npool/source/localedata/data/localedata_euro.map
+++ b/i18npool/source/localedata/data/localedata_euro.map
@@ -16,6 +16,7 @@ getAllCalendars_de_CH;
getAllCalendars_de_DE;
getAllCalendars_de_LI;
getAllCalendars_de_LU;
+getAllCalendars_dsb_DE;
getAllCalendars_el_GR;
getAllCalendars_et_EE;
getAllCalendars_eu;
@@ -86,6 +87,7 @@ getAllCurrencies_de_CH;
getAllCurrencies_de_DE;
getAllCurrencies_de_LI;
getAllCurrencies_de_LU;
+getAllCurrencies_dsb_DE;
getAllCurrencies_el_GR;
getAllCurrencies_et_EE;
getAllCurrencies_eu;
@@ -156,6 +158,7 @@ getAllFormats0_de_CH;
getAllFormats0_de_DE;
getAllFormats0_de_LI;
getAllFormats0_de_LU;
+getAllFormats0_dsb_DE;
getAllFormats0_el_GR;
getAllFormats0_et_EE;
getAllFormats0_eu;
@@ -226,6 +229,7 @@ getBreakIteratorRules_de_CH;
getBreakIteratorRules_de_DE;
getBreakIteratorRules_de_LI;
getBreakIteratorRules_de_LU;
+getBreakIteratorRules_dsb_DE;
getBreakIteratorRules_el_GR;
getBreakIteratorRules_et_EE;
getBreakIteratorRules_eu;
@@ -296,6 +300,7 @@ getCollationOptions_de_CH;
getCollationOptions_de_DE;
getCollationOptions_de_LI;
getCollationOptions_de_LU;
+getCollationOptions_dsb_DE;
getCollationOptions_el_GR;
getCollationOptions_et_EE;
getCollationOptions_eu;
@@ -366,6 +371,7 @@ getCollatorImplementation_de_CH;
getCollatorImplementation_de_DE;
getCollatorImplementation_de_LI;
getCollatorImplementation_de_LU;
+getCollatorImplementation_dsb_DE;
getCollatorImplementation_el_GR;
getCollatorImplementation_et_EE;
getCollatorImplementation_eu;
@@ -436,6 +442,7 @@ getContinuousNumberingLevels_de_CH;
getContinuousNumberingLevels_de_DE;
getContinuousNumberingLevels_de_LI;
getContinuousNumberingLevels_de_LU;
+getContinuousNumberingLevels_dsb_DE;
getContinuousNumberingLevels_el_GR;
getContinuousNumberingLevels_et_EE;
getContinuousNumberingLevels_eu;
@@ -506,6 +513,7 @@ getFollowPageWords_de_CH;
getFollowPageWords_de_DE;
getFollowPageWords_de_LI;
getFollowPageWords_de_LU;
+getFollowPageWords_dsb_DE;
getFollowPageWords_el_GR;
getFollowPageWords_et_EE;
getFollowPageWords_eu;
@@ -576,6 +584,7 @@ getForbiddenCharacters_de_CH;
getForbiddenCharacters_de_DE;
getForbiddenCharacters_de_LI;
getForbiddenCharacters_de_LU;
+getForbiddenCharacters_dsb_DE;
getForbiddenCharacters_el_GR;
getForbiddenCharacters_et_EE;
getForbiddenCharacters_eu;
@@ -646,6 +655,7 @@ getIndexAlgorithm_de_CH;
getIndexAlgorithm_de_DE;
getIndexAlgorithm_de_LI;
getIndexAlgorithm_de_LU;
+getIndexAlgorithm_dsb_DE;
getIndexAlgorithm_el_GR;
getIndexAlgorithm_et_EE;
getIndexAlgorithm_eu;
@@ -716,6 +726,7 @@ getLCInfo_de_CH;
getLCInfo_de_DE;
getLCInfo_de_LI;
getLCInfo_de_LU;
+getLCInfo_dsb_DE;
getLCInfo_el_GR;
getLCInfo_et_EE;
getLCInfo_eu;
@@ -786,6 +797,7 @@ getLocaleItem_de_CH;
getLocaleItem_de_DE;
getLocaleItem_de_LI;
getLocaleItem_de_LU;
+getLocaleItem_dsb_DE;
getLocaleItem_el_GR;
getLocaleItem_et_EE;
getLocaleItem_eu;
@@ -856,6 +868,7 @@ getOutlineNumberingLevels_de_CH;
getOutlineNumberingLevels_de_DE;
getOutlineNumberingLevels_de_LI;
getOutlineNumberingLevels_de_LU;
+getOutlineNumberingLevels_dsb_DE;
getOutlineNumberingLevels_el_GR;
getOutlineNumberingLevels_et_EE;
getOutlineNumberingLevels_eu;
@@ -926,6 +939,7 @@ getReservedWords_de_CH;
getReservedWords_de_DE;
getReservedWords_de_LI;
getReservedWords_de_LU;
+getReservedWords_dsb_DE;
getReservedWords_el_GR;
getReservedWords_et_EE;
getReservedWords_eu;
@@ -996,6 +1010,7 @@ getSearchOptions_de_CH;
getSearchOptions_de_DE;
getSearchOptions_de_LI;
getSearchOptions_de_LU;
+getSearchOptions_dsb_DE;
getSearchOptions_el_GR;
getSearchOptions_et_EE;
getSearchOptions_eu;
@@ -1066,6 +1081,7 @@ getTransliterations_de_CH;
getTransliterations_de_DE;
getTransliterations_de_LI;
getTransliterations_de_LU;
+getTransliterations_dsb_DE;
getTransliterations_el_GR;
getTransliterations_et_EE;
getTransliterations_eu;
@@ -1136,6 +1152,7 @@ getUnicodeScripts_de_CH;
getUnicodeScripts_de_DE;
getUnicodeScripts_de_LI;
getUnicodeScripts_de_LU;
+getUnicodeScripts_dsb_DE;
getUnicodeScripts_el_GR;
getUnicodeScripts_et_EE;
getUnicodeScripts_eu;
diff --git a/i18npool/source/localedata/data/localedata_others.map b/i18npool/source/localedata/data/localedata_others.map
index e5de10cb68e5..46f4c4f74aea 100644
--- a/i18npool/source/localedata/data/localedata_others.map
+++ b/i18npool/source/localedata/data/localedata_others.map
@@ -1,5 +1,6 @@
UDK_3_0_0 {
global:
+GetVersionInfo;
getAllCalendars_af_NA;
getAllCalendars_af_ZA;
getAllCalendars_ak_GH;
@@ -21,14 +22,17 @@ getAllCalendars_fa_IR;
getAllCalendars_gug_PY;
getAllCalendars_gu_IN;
getAllCalendars_ha_GH;
+getAllCalendars_haw_US;
getAllCalendars_he_IL;
getAllCalendars_hi_IN;
getAllCalendars_hil_PH;
+getAllCalendars_ht_HT;
getAllCalendars_hu_HU;
getAllCalendars_hy_AM;
getAllCalendars_ia;
getAllCalendars_id_ID;
getAllCalendars_ja_JP;
+getAllCalendars_jbo;
getAllCalendars_kk_KZ;
getAllCalendars_km_KH;
getAllCalendars_kn_IN;
@@ -36,6 +40,7 @@ getAllCalendars_ko_KR;
getAllCalendars_ku_TR;
getAllCalendars_ky_KG;
getAllCalendars_lg_UG;
+getAllCalendars_lif_NP;
getAllCalendars_ln_CD;
getAllCalendars_lo_LA;
getAllCalendars_mai_IN;
@@ -68,10 +73,12 @@ getAllCalendars_tn_ZA;
getAllCalendars_tpi_PG;
getAllCalendars_ts_ZA;
getAllCalendars_ug_CN;
+getAllCalendars_ur_PK;
getAllCalendars_uz_UZ;
getAllCalendars_ve_ZA;
getAllCalendars_vi_VN;
getAllCalendars_xh_ZA;
+getAllCalendars_yi_US;
getAllCalendars_zh_CN;
getAllCalendars_zh_HK;
getAllCalendars_zh_MO;
@@ -99,14 +106,17 @@ getAllCurrencies_fa_IR;
getAllCurrencies_gug_PY;
getAllCurrencies_gu_IN;
getAllCurrencies_ha_GH;
+getAllCurrencies_haw_US;
getAllCurrencies_he_IL;
getAllCurrencies_hi_IN;
getAllCurrencies_hil_PH;
+getAllCurrencies_ht_HT;
getAllCurrencies_hu_HU;
getAllCurrencies_hy_AM;
getAllCurrencies_ia;
getAllCurrencies_id_ID;
getAllCurrencies_ja_JP;
+getAllCurrencies_jbo;
getAllCurrencies_kk_KZ;
getAllCurrencies_km_KH;
getAllCurrencies_kn_IN;
@@ -114,6 +124,7 @@ getAllCurrencies_ko_KR;
getAllCurrencies_ku_TR;
getAllCurrencies_ky_KG;
getAllCurrencies_lg_UG;
+getAllCurrencies_lif_NP;
getAllCurrencies_ln_CD;
getAllCurrencies_lo_LA;
getAllCurrencies_mai_IN;
@@ -146,10 +157,12 @@ getAllCurrencies_tn_ZA;
getAllCurrencies_tpi_PG;
getAllCurrencies_ts_ZA;
getAllCurrencies_ug_CN;
+getAllCurrencies_ur_PK;
getAllCurrencies_uz_UZ;
getAllCurrencies_ve_ZA;
getAllCurrencies_vi_VN;
getAllCurrencies_xh_ZA;
+getAllCurrencies_yi_US;
getAllCurrencies_zh_CN;
getAllCurrencies_zh_HK;
getAllCurrencies_zh_MO;
@@ -177,14 +190,17 @@ getAllFormats0_fa_IR;
getAllFormats0_gug_PY;
getAllFormats0_gu_IN;
getAllFormats0_ha_GH;
+getAllFormats0_haw_US;
getAllFormats0_he_IL;
getAllFormats0_hi_IN;
getAllFormats0_hil_PH;
+getAllFormats0_ht_HT;
getAllFormats0_hu_HU;
getAllFormats0_hy_AM;
getAllFormats0_ia;
getAllFormats0_id_ID;
getAllFormats0_ja_JP;
+getAllFormats0_jbo;
getAllFormats0_kk_KZ;
getAllFormats0_km_KH;
getAllFormats0_kn_IN;
@@ -192,6 +208,7 @@ getAllFormats0_ko_KR;
getAllFormats0_ku_TR;
getAllFormats0_ky_KG;
getAllFormats0_lg_UG;
+getAllFormats0_lif_NP;
getAllFormats0_ln_CD;
getAllFormats0_lo_LA;
getAllFormats0_mai_IN;
@@ -224,10 +241,12 @@ getAllFormats0_tn_ZA;
getAllFormats0_tpi_PG;
getAllFormats0_ts_ZA;
getAllFormats0_ug_CN;
+getAllFormats0_ur_PK;
getAllFormats0_uz_UZ;
getAllFormats0_ve_ZA;
getAllFormats0_vi_VN;
getAllFormats0_xh_ZA;
+getAllFormats0_yi_US;
getAllFormats0_zh_CN;
getAllFormats0_zh_HK;
getAllFormats0_zh_MO;
@@ -255,14 +274,17 @@ getBreakIteratorRules_fa_IR;
getBreakIteratorRules_gug_PY;
getBreakIteratorRules_gu_IN;
getBreakIteratorRules_ha_GH;
+getBreakIteratorRules_haw_US;
getBreakIteratorRules_he_IL;
getBreakIteratorRules_hi_IN;
getBreakIteratorRules_hil_PH;
+getBreakIteratorRules_ht_HT;
getBreakIteratorRules_hu_HU;
getBreakIteratorRules_hy_AM;
getBreakIteratorRules_ia;
getBreakIteratorRules_id_ID;
getBreakIteratorRules_ja_JP;
+getBreakIteratorRules_jbo;
getBreakIteratorRules_kk_KZ;
getBreakIteratorRules_km_KH;
getBreakIteratorRules_kn_IN;
@@ -270,6 +292,7 @@ getBreakIteratorRules_ko_KR;
getBreakIteratorRules_ku_TR;
getBreakIteratorRules_ky_KG;
getBreakIteratorRules_lg_UG;
+getBreakIteratorRules_lif_NP;
getBreakIteratorRules_ln_CD;
getBreakIteratorRules_lo_LA;
getBreakIteratorRules_mai_IN;
@@ -302,10 +325,12 @@ getBreakIteratorRules_tn_ZA;
getBreakIteratorRules_tpi_PG;
getBreakIteratorRules_ts_ZA;
getBreakIteratorRules_ug_CN;
+getBreakIteratorRules_ur_PK;
getBreakIteratorRules_uz_UZ;
getBreakIteratorRules_ve_ZA;
getBreakIteratorRules_vi_VN;
getBreakIteratorRules_xh_ZA;
+getBreakIteratorRules_yi_US;
getBreakIteratorRules_zh_CN;
getBreakIteratorRules_zh_HK;
getBreakIteratorRules_zh_MO;
@@ -333,14 +358,17 @@ getCollationOptions_fa_IR;
getCollationOptions_gug_PY;
getCollationOptions_gu_IN;
getCollationOptions_ha_GH;
+getCollationOptions_haw_US;
getCollationOptions_he_IL;
getCollationOptions_hi_IN;
getCollationOptions_hil_PH;
+getCollationOptions_ht_HT;
getCollationOptions_hu_HU;
getCollationOptions_hy_AM;
getCollationOptions_ia;
getCollationOptions_id_ID;
getCollationOptions_ja_JP;
+getCollationOptions_jbo;
getCollationOptions_kk_KZ;
getCollationOptions_km_KH;
getCollationOptions_kn_IN;
@@ -348,6 +376,7 @@ getCollationOptions_ko_KR;
getCollationOptions_ku_TR;
getCollationOptions_ky_KG;
getCollationOptions_lg_UG;
+getCollationOptions_lif_NP;
getCollationOptions_ln_CD;
getCollationOptions_lo_LA;
getCollationOptions_mai_IN;
@@ -380,10 +409,12 @@ getCollationOptions_tn_ZA;
getCollationOptions_tpi_PG;
getCollationOptions_ts_ZA;
getCollationOptions_ug_CN;
+getCollationOptions_ur_PK;
getCollationOptions_uz_UZ;
getCollationOptions_ve_ZA;
getCollationOptions_vi_VN;
getCollationOptions_xh_ZA;
+getCollationOptions_yi_US;
getCollationOptions_zh_CN;
getCollationOptions_zh_HK;
getCollationOptions_zh_MO;
@@ -411,14 +442,17 @@ getCollatorImplementation_fa_IR;
getCollatorImplementation_gug_PY;
getCollatorImplementation_gu_IN;
getCollatorImplementation_ha_GH;
+getCollatorImplementation_haw_US;
getCollatorImplementation_he_IL;
getCollatorImplementation_hi_IN;
getCollatorImplementation_hil_PH;
+getCollatorImplementation_ht_HT;
getCollatorImplementation_hu_HU;
getCollatorImplementation_hy_AM;
getCollatorImplementation_ia;
getCollatorImplementation_id_ID;
getCollatorImplementation_ja_JP;
+getCollatorImplementation_jbo;
getCollatorImplementation_kk_KZ;
getCollatorImplementation_km_KH;
getCollatorImplementation_kn_IN;
@@ -426,6 +460,7 @@ getCollatorImplementation_ko_KR;
getCollatorImplementation_ku_TR;
getCollatorImplementation_ky_KG;
getCollatorImplementation_lg_UG;
+getCollatorImplementation_lif_NP;
getCollatorImplementation_ln_CD;
getCollatorImplementation_lo_LA;
getCollatorImplementation_mai_IN;
@@ -458,10 +493,12 @@ getCollatorImplementation_tn_ZA;
getCollatorImplementation_tpi_PG;
getCollatorImplementation_ts_ZA;
getCollatorImplementation_ug_CN;
+getCollatorImplementation_ur_PK;
getCollatorImplementation_uz_UZ;
getCollatorImplementation_ve_ZA;
getCollatorImplementation_vi_VN;
getCollatorImplementation_xh_ZA;
+getCollatorImplementation_yi_US;
getCollatorImplementation_zh_CN;
getCollatorImplementation_zh_HK;
getCollatorImplementation_zh_MO;
@@ -489,14 +526,17 @@ getContinuousNumberingLevels_fa_IR;
getContinuousNumberingLevels_gug_PY;
getContinuousNumberingLevels_gu_IN;
getContinuousNumberingLevels_ha_GH;
+getContinuousNumberingLevels_haw_US;
getContinuousNumberingLevels_he_IL;
getContinuousNumberingLevels_hi_IN;
getContinuousNumberingLevels_hil_PH;
+getContinuousNumberingLevels_ht_HT;
getContinuousNumberingLevels_hu_HU;
getContinuousNumberingLevels_hy_AM;
getContinuousNumberingLevels_ia;
getContinuousNumberingLevels_id_ID;
getContinuousNumberingLevels_ja_JP;
+getContinuousNumberingLevels_jbo;
getContinuousNumberingLevels_kk_KZ;
getContinuousNumberingLevels_km_KH;
getContinuousNumberingLevels_kn_IN;
@@ -504,6 +544,7 @@ getContinuousNumberingLevels_ko_KR;
getContinuousNumberingLevels_ku_TR;
getContinuousNumberingLevels_ky_KG;
getContinuousNumberingLevels_lg_UG;
+getContinuousNumberingLevels_lif_NP;
getContinuousNumberingLevels_ln_CD;
getContinuousNumberingLevels_lo_LA;
getContinuousNumberingLevels_mai_IN;
@@ -536,10 +577,12 @@ getContinuousNumberingLevels_tn_ZA;
getContinuousNumberingLevels_tpi_PG;
getContinuousNumberingLevels_ts_ZA;
getContinuousNumberingLevels_ug_CN;
+getContinuousNumberingLevels_ur_PK;
getContinuousNumberingLevels_uz_UZ;
getContinuousNumberingLevels_ve_ZA;
getContinuousNumberingLevels_vi_VN;
getContinuousNumberingLevels_xh_ZA;
+getContinuousNumberingLevels_yi_US;
getContinuousNumberingLevels_zh_CN;
getContinuousNumberingLevels_zh_HK;
getContinuousNumberingLevels_zh_MO;
@@ -567,14 +610,17 @@ getFollowPageWords_fa_IR;
getFollowPageWords_gug_PY;
getFollowPageWords_gu_IN;
getFollowPageWords_ha_GH;
+getFollowPageWords_haw_US;
getFollowPageWords_he_IL;
getFollowPageWords_hi_IN;
getFollowPageWords_hil_PH;
+getFollowPageWords_ht_HT;
getFollowPageWords_hu_HU;
getFollowPageWords_hy_AM;
getFollowPageWords_ia;
getFollowPageWords_id_ID;
getFollowPageWords_ja_JP;
+getFollowPageWords_jbo;
getFollowPageWords_kk_KZ;
getFollowPageWords_km_KH;
getFollowPageWords_kn_IN;
@@ -582,6 +628,7 @@ getFollowPageWords_ko_KR;
getFollowPageWords_ku_TR;
getFollowPageWords_ky_KG;
getFollowPageWords_lg_UG;
+getFollowPageWords_lif_NP;
getFollowPageWords_ln_CD;
getFollowPageWords_lo_LA;
getFollowPageWords_mai_IN;
@@ -614,10 +661,12 @@ getFollowPageWords_tn_ZA;
getFollowPageWords_tpi_PG;
getFollowPageWords_ts_ZA;
getFollowPageWords_ug_CN;
+getFollowPageWords_ur_PK;
getFollowPageWords_uz_UZ;
getFollowPageWords_ve_ZA;
getFollowPageWords_vi_VN;
getFollowPageWords_xh_ZA;
+getFollowPageWords_yi_US;
getFollowPageWords_zh_CN;
getFollowPageWords_zh_HK;
getFollowPageWords_zh_MO;
@@ -645,14 +694,17 @@ getForbiddenCharacters_fa_IR;
getForbiddenCharacters_gug_PY;
getForbiddenCharacters_gu_IN;
getForbiddenCharacters_ha_GH;
+getForbiddenCharacters_haw_US;
getForbiddenCharacters_he_IL;
getForbiddenCharacters_hi_IN;
getForbiddenCharacters_hil_PH;
+getForbiddenCharacters_ht_HT;
getForbiddenCharacters_hu_HU;
getForbiddenCharacters_hy_AM;
getForbiddenCharacters_ia;
getForbiddenCharacters_id_ID;
getForbiddenCharacters_ja_JP;
+getForbiddenCharacters_jbo;
getForbiddenCharacters_kk_KZ;
getForbiddenCharacters_km_KH;
getForbiddenCharacters_kn_IN;
@@ -660,6 +712,7 @@ getForbiddenCharacters_ko_KR;
getForbiddenCharacters_ku_TR;
getForbiddenCharacters_ky_KG;
getForbiddenCharacters_lg_UG;
+getForbiddenCharacters_lif_NP;
getForbiddenCharacters_ln_CD;
getForbiddenCharacters_lo_LA;
getForbiddenCharacters_mai_IN;
@@ -692,10 +745,12 @@ getForbiddenCharacters_tn_ZA;
getForbiddenCharacters_tpi_PG;
getForbiddenCharacters_ts_ZA;
getForbiddenCharacters_ug_CN;
+getForbiddenCharacters_ur_PK;
getForbiddenCharacters_uz_UZ;
getForbiddenCharacters_ve_ZA;
getForbiddenCharacters_vi_VN;
getForbiddenCharacters_xh_ZA;
+getForbiddenCharacters_yi_US;
getForbiddenCharacters_zh_CN;
getForbiddenCharacters_zh_HK;
getForbiddenCharacters_zh_MO;
@@ -723,14 +778,17 @@ getIndexAlgorithm_fa_IR;
getIndexAlgorithm_gug_PY;
getIndexAlgorithm_gu_IN;
getIndexAlgorithm_ha_GH;
+getIndexAlgorithm_haw_US;
getIndexAlgorithm_he_IL;
getIndexAlgorithm_hi_IN;
getIndexAlgorithm_hil_PH;
+getIndexAlgorithm_ht_HT;
getIndexAlgorithm_hu_HU;
getIndexAlgorithm_hy_AM;
getIndexAlgorithm_ia;
getIndexAlgorithm_id_ID;
getIndexAlgorithm_ja_JP;
+getIndexAlgorithm_jbo;
getIndexAlgorithm_kk_KZ;
getIndexAlgorithm_km_KH;
getIndexAlgorithm_kn_IN;
@@ -738,6 +796,7 @@ getIndexAlgorithm_ko_KR;
getIndexAlgorithm_ku_TR;
getIndexAlgorithm_ky_KG;
getIndexAlgorithm_lg_UG;
+getIndexAlgorithm_lif_NP;
getIndexAlgorithm_ln_CD;
getIndexAlgorithm_lo_LA;
getIndexAlgorithm_mai_IN;
@@ -770,10 +829,12 @@ getIndexAlgorithm_tn_ZA;
getIndexAlgorithm_tpi_PG;
getIndexAlgorithm_ts_ZA;
getIndexAlgorithm_ug_CN;
+getIndexAlgorithm_ur_PK;
getIndexAlgorithm_uz_UZ;
getIndexAlgorithm_ve_ZA;
getIndexAlgorithm_vi_VN;
getIndexAlgorithm_xh_ZA;
+getIndexAlgorithm_yi_US;
getIndexAlgorithm_zh_CN;
getIndexAlgorithm_zh_HK;
getIndexAlgorithm_zh_MO;
@@ -801,14 +862,17 @@ getLCInfo_fa_IR;
getLCInfo_gug_PY;
getLCInfo_gu_IN;
getLCInfo_ha_GH;
+getLCInfo_haw_US;
getLCInfo_he_IL;
getLCInfo_hi_IN;
getLCInfo_hil_PH;
+getLCInfo_ht_HT;
getLCInfo_hu_HU;
getLCInfo_hy_AM;
getLCInfo_ia;
getLCInfo_id_ID;
getLCInfo_ja_JP;
+getLCInfo_jbo;
getLCInfo_kk_KZ;
getLCInfo_km_KH;
getLCInfo_kn_IN;
@@ -816,6 +880,7 @@ getLCInfo_ko_KR;
getLCInfo_ku_TR;
getLCInfo_ky_KG;
getLCInfo_lg_UG;
+getLCInfo_lif_NP;
getLCInfo_ln_CD;
getLCInfo_lo_LA;
getLCInfo_mai_IN;
@@ -848,10 +913,12 @@ getLCInfo_tn_ZA;
getLCInfo_tpi_PG;
getLCInfo_ts_ZA;
getLCInfo_ug_CN;
+getLCInfo_ur_PK;
getLCInfo_uz_UZ;
getLCInfo_ve_ZA;
getLCInfo_vi_VN;
getLCInfo_xh_ZA;
+getLCInfo_yi_US;
getLCInfo_zh_CN;
getLCInfo_zh_HK;
getLCInfo_zh_MO;
@@ -879,14 +946,17 @@ getLocaleItem_fa_IR;
getLocaleItem_gug_PY;
getLocaleItem_gu_IN;
getLocaleItem_ha_GH;
+getLocaleItem_haw_US;
getLocaleItem_he_IL;
getLocaleItem_hi_IN;
getLocaleItem_hil_PH;
+getLocaleItem_ht_HT;
getLocaleItem_hu_HU;
getLocaleItem_hy_AM;
getLocaleItem_ia;
getLocaleItem_id_ID;
getLocaleItem_ja_JP;
+getLocaleItem_jbo;
getLocaleItem_kk_KZ;
getLocaleItem_km_KH;
getLocaleItem_kn_IN;
@@ -894,6 +964,7 @@ getLocaleItem_ko_KR;
getLocaleItem_ku_TR;
getLocaleItem_ky_KG;
getLocaleItem_lg_UG;
+getLocaleItem_lif_NP;
getLocaleItem_ln_CD;
getLocaleItem_lo_LA;
getLocaleItem_mai_IN;
@@ -926,10 +997,12 @@ getLocaleItem_tn_ZA;
getLocaleItem_tpi_PG;
getLocaleItem_ts_ZA;
getLocaleItem_ug_CN;
+getLocaleItem_ur_PK;
getLocaleItem_uz_UZ;
getLocaleItem_ve_ZA;
getLocaleItem_vi_VN;
getLocaleItem_xh_ZA;
+getLocaleItem_yi_US;
getLocaleItem_zh_CN;
getLocaleItem_zh_HK;
getLocaleItem_zh_MO;
@@ -957,14 +1030,17 @@ getOutlineNumberingLevels_fa_IR;
getOutlineNumberingLevels_gug_PY;
getOutlineNumberingLevels_gu_IN;
getOutlineNumberingLevels_ha_GH;
+getOutlineNumberingLevels_haw_US;
getOutlineNumberingLevels_he_IL;
getOutlineNumberingLevels_hi_IN;
getOutlineNumberingLevels_hil_PH;
+getOutlineNumberingLevels_ht_HT;
getOutlineNumberingLevels_hu_HU;
getOutlineNumberingLevels_hy_AM;
getOutlineNumberingLevels_ia;
getOutlineNumberingLevels_id_ID;
getOutlineNumberingLevels_ja_JP;
+getOutlineNumberingLevels_jbo;
getOutlineNumberingLevels_kk_KZ;
getOutlineNumberingLevels_km_KH;
getOutlineNumberingLevels_kn_IN;
@@ -972,6 +1048,7 @@ getOutlineNumberingLevels_ko_KR;
getOutlineNumberingLevels_ku_TR;
getOutlineNumberingLevels_ky_KG;
getOutlineNumberingLevels_lg_UG;
+getOutlineNumberingLevels_lif_NP;
getOutlineNumberingLevels_ln_CD;
getOutlineNumberingLevels_lo_LA;
getOutlineNumberingLevels_mai_IN;
@@ -1004,10 +1081,12 @@ getOutlineNumberingLevels_tn_ZA;
getOutlineNumberingLevels_tpi_PG;
getOutlineNumberingLevels_ts_ZA;
getOutlineNumberingLevels_ug_CN;
+getOutlineNumberingLevels_ur_PK;
getOutlineNumberingLevels_uz_UZ;
getOutlineNumberingLevels_ve_ZA;
getOutlineNumberingLevels_vi_VN;
getOutlineNumberingLevels_xh_ZA;
+getOutlineNumberingLevels_yi_US;
getOutlineNumberingLevels_zh_CN;
getOutlineNumberingLevels_zh_HK;
getOutlineNumberingLevels_zh_MO;
@@ -1035,14 +1114,17 @@ getReservedWords_fa_IR;
getReservedWords_gug_PY;
getReservedWords_gu_IN;
getReservedWords_ha_GH;
+getReservedWords_haw_US;
getReservedWords_he_IL;
getReservedWords_hi_IN;
getReservedWords_hil_PH;
+getReservedWords_ht_HT;
getReservedWords_hu_HU;
getReservedWords_hy_AM;
getReservedWords_ia;
getReservedWords_id_ID;
getReservedWords_ja_JP;
+getReservedWords_jbo;
getReservedWords_kk_KZ;
getReservedWords_km_KH;
getReservedWords_kn_IN;
@@ -1050,6 +1132,7 @@ getReservedWords_ko_KR;
getReservedWords_ku_TR;
getReservedWords_ky_KG;
getReservedWords_lg_UG;
+getReservedWords_lif_NP;
getReservedWords_ln_CD;
getReservedWords_lo_LA;
getReservedWords_mai_IN;
@@ -1082,10 +1165,12 @@ getReservedWords_tn_ZA;
getReservedWords_tpi_PG;
getReservedWords_ts_ZA;
getReservedWords_ug_CN;
+getReservedWords_ur_PK;
getReservedWords_uz_UZ;
getReservedWords_ve_ZA;
getReservedWords_vi_VN;
getReservedWords_xh_ZA;
+getReservedWords_yi_US;
getReservedWords_zh_CN;
getReservedWords_zh_HK;
getReservedWords_zh_MO;
@@ -1113,14 +1198,17 @@ getSearchOptions_fa_IR;
getSearchOptions_gug_PY;
getSearchOptions_gu_IN;
getSearchOptions_ha_GH;
+getSearchOptions_haw_US;
getSearchOptions_he_IL;
getSearchOptions_hi_IN;
getSearchOptions_hil_PH;
+getSearchOptions_ht_HT;
getSearchOptions_hu_HU;
getSearchOptions_hy_AM;
getSearchOptions_ia;
getSearchOptions_id_ID;
getSearchOptions_ja_JP;
+getSearchOptions_jbo;
getSearchOptions_kk_KZ;
getSearchOptions_km_KH;
getSearchOptions_kn_IN;
@@ -1128,6 +1216,7 @@ getSearchOptions_ko_KR;
getSearchOptions_ku_TR;
getSearchOptions_ky_KG;
getSearchOptions_lg_UG;
+getSearchOptions_lif_NP;
getSearchOptions_ln_CD;
getSearchOptions_lo_LA;
getSearchOptions_mai_IN;
@@ -1160,10 +1249,12 @@ getSearchOptions_tn_ZA;
getSearchOptions_tpi_PG;
getSearchOptions_ts_ZA;
getSearchOptions_ug_CN;
+getSearchOptions_ur_PK;
getSearchOptions_uz_UZ;
getSearchOptions_ve_ZA;
getSearchOptions_vi_VN;
getSearchOptions_xh_ZA;
+getSearchOptions_yi_US;
getSearchOptions_zh_CN;
getSearchOptions_zh_HK;
getSearchOptions_zh_MO;
@@ -1191,14 +1282,17 @@ getTransliterations_fa_IR;
getTransliterations_gug_PY;
getTransliterations_gu_IN;
getTransliterations_ha_GH;
+getTransliterations_haw_US;
getTransliterations_he_IL;
getTransliterations_hi_IN;
getTransliterations_hil_PH;
+getTransliterations_ht_HT;
getTransliterations_hu_HU;
getTransliterations_hy_AM;
getTransliterations_ia;
getTransliterations_id_ID;
getTransliterations_ja_JP;
+getTransliterations_jbo;
getTransliterations_kk_KZ;
getTransliterations_km_KH;
getTransliterations_kn_IN;
@@ -1206,6 +1300,7 @@ getTransliterations_ko_KR;
getTransliterations_ku_TR;
getTransliterations_ky_KG;
getTransliterations_lg_UG;
+getTransliterations_lif_NP;
getTransliterations_ln_CD;
getTransliterations_lo_LA;
getTransliterations_mai_IN;
@@ -1238,10 +1333,12 @@ getTransliterations_tn_ZA;
getTransliterations_tpi_PG;
getTransliterations_ts_ZA;
getTransliterations_ug_CN;
+getTransliterations_ur_PK;
getTransliterations_uz_UZ;
getTransliterations_ve_ZA;
getTransliterations_vi_VN;
getTransliterations_xh_ZA;
+getTransliterations_yi_US;
getTransliterations_zh_CN;
getTransliterations_zh_HK;
getTransliterations_zh_MO;
@@ -1269,14 +1366,17 @@ getUnicodeScripts_fa_IR;
getUnicodeScripts_gug_PY;
getUnicodeScripts_gu_IN;
getUnicodeScripts_ha_GH;
+getUnicodeScripts_haw_US;
getUnicodeScripts_he_IL;
getUnicodeScripts_hi_IN;
getUnicodeScripts_hil_PH;
+getUnicodeScripts_ht_HT;
getUnicodeScripts_hu_HU;
getUnicodeScripts_hy_AM;
getUnicodeScripts_ia;
getUnicodeScripts_id_ID;
getUnicodeScripts_ja_JP;
+getUnicodeScripts_jbo;
getUnicodeScripts_kk_KZ;
getUnicodeScripts_km_KH;
getUnicodeScripts_kn_IN;
@@ -1284,6 +1384,7 @@ getUnicodeScripts_ko_KR;
getUnicodeScripts_ku_TR;
getUnicodeScripts_ky_KG;
getUnicodeScripts_lg_UG;
+getUnicodeScripts_lif_NP;
getUnicodeScripts_ln_CD;
getUnicodeScripts_lo_LA;
getUnicodeScripts_mai_IN;
@@ -1316,17 +1417,18 @@ getUnicodeScripts_tn_ZA;
getUnicodeScripts_tpi_PG;
getUnicodeScripts_ts_ZA;
getUnicodeScripts_ug_CN;
+getUnicodeScripts_ur_PK;
getUnicodeScripts_uz_UZ;
getUnicodeScripts_ve_ZA;
getUnicodeScripts_vi_VN;
getUnicodeScripts_xh_ZA;
+getUnicodeScripts_yi_US;
getUnicodeScripts_zh_CN;
getUnicodeScripts_zh_HK;
getUnicodeScripts_zh_MO;
getUnicodeScripts_zh_SG;
getUnicodeScripts_zh_TW;
getUnicodeScripts_zu_ZA;
-GetVersionInfo;
local:
*;
diff --git a/i18npool/source/localedata/data/makefile.mk b/i18npool/source/localedata/data/makefile.mk
index 1034de7f11bf..54b412d75205 100644
--- a/i18npool/source/localedata/data/makefile.mk
+++ b/i18npool/source/localedata/data/makefile.mk
@@ -167,6 +167,7 @@ SHL3OBJS= \
$(SLO)$/localedata_de_DE.obj \
$(SLO)$/localedata_de_LI.obj \
$(SLO)$/localedata_de_LU.obj \
+ $(SLO)$/localedata_dsb_DE.obj \
$(SLO)$/localedata_el_GR.obj \
$(SLO)$/localedata_et_EE.obj \
$(SLO)$/localedata_eu.obj \
@@ -260,15 +261,18 @@ SHL4OBJS= \
$(SLO)$/localedata_fa_IR.obj \
$(SLO)$/localedata_gu_IN.obj \
$(SLO)$/localedata_gug_PY.obj \
+ $(SLO)$/localedata_haw_US.obj \
$(SLO)$/localedata_ha_GH.obj \
$(SLO)$/localedata_he_IL.obj \
$(SLO)$/localedata_hi_IN.obj \
$(SLO)$/localedata_hil_PH.obj \
+ $(SLO)$/localedata_ht_HT.obj \
$(SLO)$/localedata_hu_HU.obj \
$(SLO)$/localedata_hy_AM.obj \
$(SLO)$/localedata_ia.obj \
$(SLO)$/localedata_id_ID.obj \
$(SLO)$/localedata_ja_JP.obj \
+ $(SLO)$/localedata_jbo.obj \
$(SLO)$/localedata_kk_KZ.obj \
$(SLO)$/localedata_km_KH.obj \
$(SLO)$/localedata_kn_IN.obj \
@@ -276,6 +280,7 @@ SHL4OBJS= \
$(SLO)$/localedata_ku_TR.obj \
$(SLO)$/localedata_ky_KG.obj \
$(SLO)$/localedata_lg_UG.obj \
+ $(SLO)$/localedata_lif_NP.obj \
$(SLO)$/localedata_ln_CD.obj \
$(SLO)$/localedata_lo_LA.obj \
$(SLO)$/localedata_mai_IN.obj \
@@ -308,10 +313,12 @@ SHL4OBJS= \
$(SLO)$/localedata_tpi_PG.obj \
$(SLO)$/localedata_ts_ZA.obj \
$(SLO)$/localedata_ug_CN.obj \
+ $(SLO)$/localedata_ur_PK.obj \
$(SLO)$/localedata_uz_UZ.obj \
$(SLO)$/localedata_ve_ZA.obj \
$(SLO)$/localedata_vi_VN.obj \
$(SLO)$/localedata_xh_ZA.obj \
+ $(SLO)$/localedata_yi_US.obj \
$(SLO)$/localedata_zh_CN.obj \
$(SLO)$/localedata_zh_HK.obj \
$(SLO)$/localedata_zh_MO.obj \
diff --git a/i18npool/source/localedata/data/no_NO.xml b/i18npool/source/localedata/data/no_NO.xml
index 21ac49181020..6df7b5e2d018 100644
--- a/i18npool/source/localedata/data/no_NO.xml
+++ b/i18npool/source/localedata/data/no_NO.xml
@@ -232,7 +232,7 @@
</SearchOptions>
</LC_SEARCH>
<LC_INDEX>
-<IndexKey unoid="alphanumeric" default="true" phonetic="false">A-V X-Z Æ Ø Å</IndexKey>
+<IndexKey unoid="alphanumeric" default="true" phonetic="false">A-Z Æ Ø Å</IndexKey>
<UnicodeScript>0</UnicodeScript>
<UnicodeScript>1</UnicodeScript>
<FollowPageWord>p.</FollowPageWord>
diff --git a/i18npool/source/localedata/data/sv_SE.xml b/i18npool/source/localedata/data/sv_SE.xml
index 211f95c3e894..4afefebfa661 100644
--- a/i18npool/source/localedata/data/sv_SE.xml
+++ b/i18npool/source/localedata/data/sv_SE.xml
@@ -179,7 +179,7 @@
<LC_COLLATION ref="en_US" />
<LC_SEARCH ref="en_US"/>
<LC_INDEX>
- <IndexKey phonetic="false" default="true" unoid="alphanumeric">A-V X-Z Å Ä Ö</IndexKey>
+ <IndexKey phonetic="false" default="true" unoid="alphanumeric">A-Z Å Ä Ö</IndexKey>
<UnicodeScript>0</UnicodeScript>
<UnicodeScript>1</UnicodeScript>
<FollowPageWord>f.</FollowPageWord>
diff --git a/i18npool/source/localedata/data/ur_PK.xml b/i18npool/source/localedata/data/ur_PK.xml
new file mode 100644
index 000000000000..53002e931068
--- /dev/null
+++ b/i18npool/source/localedata/data/ur_PK.xml
@@ -0,0 +1,358 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE Locale SYSTEM 'locale.dtd'>
+<Locale versionDTD="2.0.3" allowUpdateFromCLDR="no" version="1.0">
+ <LC_INFO>
+ <Language>
+ <LangID>ur</LangID>
+ <DefaultName>Urdu</DefaultName>
+ </Language>
+ <Country>
+ <CountryID>PK</CountryID>
+ <DefaultName>Pakistan</DefaultName>
+ </Country>
+ </LC_INFO>
+ <LC_CTYPE unoid="generic">
+ <Separators>
+ <DateSeparator>/</DateSeparator>
+ <ThousandSeparator>,</ThousandSeparator>
+ <DecimalSeparator>.</DecimalSeparator>
+ <TimeSeparator>:</TimeSeparator>
+ <Time100SecSeparator>.</Time100SecSeparator>
+ <ListSeparator>;</ListSeparator>
+ <LongDateDayOfWeekSeparator>, </LongDateDayOfWeekSeparator>
+ <LongDateDaySeparator>, </LongDateDaySeparator>
+ <LongDateMonthSeparator> </LongDateMonthSeparator>
+ <LongDateYearSeparator> </LongDateYearSeparator>
+ </Separators>
+ <Markers>
+ <QuotationStart>‘</QuotationStart>
+ <QuotationEnd>’</QuotationEnd>
+ <DoubleQuotationStart>“</DoubleQuotationStart>
+ <DoubleQuotationEnd>”</DoubleQuotationEnd>
+ </Markers>
+ <TimeAM>قبل دوپہر</TimeAM>
+ <TimePM>بعد دوپہر</TimePM>
+ <MeasurementSystem>metric</MeasurementSystem>
+ </LC_CTYPE>
+ <LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$₨-420]">
+ <FormatElement msgid="FixedFormatskey1" default="true" type="medium" usage="FIXED_NUMBER" formatindex="0">
+ <FormatCode>General</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey2" default="true" type="short" usage="FIXED_NUMBER" formatindex="1">
+ <FormatCode>0</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey3" default="false" type="medium" usage="FIXED_NUMBER" formatindex="2">
+ <FormatCode>0.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey4" default="false" type="short" usage="FIXED_NUMBER" formatindex="3">
+ <FormatCode>#,##0</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey5" default="false" type="medium" usage="FIXED_NUMBER" formatindex="4">
+ <FormatCode>#,##0.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="FixedFormatskey6" default="false" type="medium" usage="FIXED_NUMBER" formatindex="5">
+ <FormatCode>#,###.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="ScientificFormatskey1" default="true" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="6">
+ <FormatCode>0.00E+00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="ScientificFormatskey2" default="false" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="7">
+ <FormatCode>0.00E+000</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="PercentFormatskey1" default="true" type="short" usage="PERCENT_NUMBER" formatindex="8">
+ <FormatCode>0%</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="PercentFormatskey2" default="true" type="long" usage="PERCENT_NUMBER" formatindex="9">
+ <FormatCode>0.00%</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey1" default="true" type="short" usage="CURRENCY" formatindex="12">
+ <FormatCode>[CURRENCY]#,##0;-[CURRENCY]#,##0</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey2" default="false" type="medium" usage="CURRENCY" formatindex="13">
+ <FormatCode>[CURRENCY]#,##0.00;-[CURRENCY]#,##0.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey3" default="false" type="medium" usage="CURRENCY" formatindex="14">
+ <FormatCode>[CURRENCY]#,##0;[RED]-[CURRENCY]#,##0</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey4" default="true" type="medium" usage="CURRENCY" formatindex="15">
+ <FormatCode>[CURRENCY]#,##0.00;[RED]-[CURRENCY]#,##0.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey5" default="false" type="medium" usage="CURRENCY" formatindex="16">
+ <FormatCode>CCC#,##0.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey6" default="false" type="medium" usage="CURRENCY" formatindex="17">
+ <FormatCode>[CURRENCY]#,##0.--;[RED]-[CURRENCY]#,##0.--</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey11" default="true" type="short" usage="DATE" formatindex="18">
+ <FormatCode>D/MM/YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey14" default="true" type="long" usage="DATE" formatindex="19">
+ <FormatCode>NNNNDD, MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey6" default="true" type="medium" usage="DATE" formatindex="20">
+ <FormatCode>DD/MM/YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey5" default="false" type="medium" usage="DATE" formatindex="21">
+ <FormatCode>DD/MM/YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey15" default="false" type="long" usage="DATE" formatindex="22">
+ <FormatCode>D, MMM YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey16" default="false" type="long" usage="DATE" formatindex="23">
+ <FormatCode>D, MMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey21" default="false" type="long" usage="DATE" formatindex="24">
+ <FormatCode>D, MMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey17" default="false" type="long" usage="DATE" formatindex="25">
+ <FormatCode>D, MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey22" default="false" type="long" usage="DATE" formatindex="26">
+ <FormatCode>D, MMMM YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey10" default="false" type="medium" usage="DATE" formatindex="27">
+ <FormatCode>NN, DD/MMM/YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey18" default="false" type="long" usage="DATE" formatindex="28">
+ <FormatCode>NN, D, MMM YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey19" default="false" type="long" usage="DATE" formatindex="29">
+ <FormatCode>NN, D, MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey20" default="false" type="long" usage="DATE" formatindex="30">
+ <FormatCode>NNNND, MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey12" default="false" type="short" usage="DATE" formatindex="31">
+ <FormatCode>MM/DD</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey7" default="false" type="medium" usage="DATE" formatindex="32">
+ <FormatCode>YY-MM-DD</FormatCode>
+ <DefaultName>ISO 8601</DefaultName>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey8" default="false" type="medium" usage="DATE" formatindex="33">
+ <FormatCode>YYYY-MM-DD</FormatCode>
+ <DefaultName>ISO 8601</DefaultName>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey1" default="false" type="medium" usage="DATE" formatindex="34">
+ <FormatCode>MM/YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey2" default="false" type="medium" usage="DATE" formatindex="35">
+ <FormatCode>MMM/DD</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey3" default="false" type="medium" usage="DATE" formatindex="36">
+ <FormatCode>MMMM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey4" default="false" type="medium" usage="DATE" formatindex="37">
+ <FormatCode>QQ YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey9" default="false" type="medium" usage="DATE" formatindex="38">
+ <FormatCode>WW</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey1" default="false" type="short" usage="TIME" formatindex="39">
+ <FormatCode>HH:MM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey2" default="false" type="medium" usage="TIME" formatindex="40">
+ <FormatCode>HH:MM:SS</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey3" default="true" type="short" usage="TIME" formatindex="41">
+ <FormatCode>HH:MM AM/PM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey4" default="true" type="medium" usage="TIME" formatindex="42">
+ <FormatCode>HH:MM:SS AM/PM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey5" default="false" type="medium" usage="TIME" formatindex="43">
+ <FormatCode>[HH]:MM:SS</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey6" default="false" type="short" usage="TIME" formatindex="44">
+ <FormatCode>MM:SS.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey7" default="false" type="medium" usage="TIME" formatindex="45">
+ <FormatCode>[HH]:MM:SS.00</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateTimeFormatskey1" default="true" type="medium" usage="DATE_TIME" formatindex="46">
+ <FormatCode>DD/MM/YY HH:MM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateTimeFormatskey2" default="false" type="medium" usage="DATE_TIME" formatindex="47">
+ <FormatCode>DD/MM/YYYY HH:MM:SS AM/PM</FormatCode>
+ </FormatElement>
+ </LC_FORMAT>
+ <LC_COLLATION>
+ <Collator default="true" unoid="alphanumeric"/>
+ <CollationOptions>
+ <TransliterationModules>IGNORE_CASE</TransliterationModules>
+ </CollationOptions>
+ </LC_COLLATION>
+ <LC_SEARCH>
+ <SearchOptions>
+ <TransliterationModules>IGNORE_CASE</TransliterationModules>
+ </SearchOptions>
+ </LC_SEARCH>
+ <LC_INDEX>
+ <IndexKey phonetic="false" default="true" unoid="alphanumeric">أ ؤ ا آ ب پ ت ٹ ث ج چ ح خ د ڈ ذ ر ڑ ز ژ س ش ص ض ط ظ ع غ ف ق ک گ ل م ن ں و ہ ی ء ئ ے ٻ ة ٺ ټ ٽ ه ھ ي</IndexKey>
+ <UnicodeScript>0</UnicodeScript>
+ <UnicodeScript>1</UnicodeScript>
+ <FollowPageWord>صفحہ</FollowPageWord>
+ <FollowPageWord>صفحے</FollowPageWord>
+ </LC_INDEX>
+ <LC_CALENDAR>
+ <Calendar unoid="gregorian" default="true">
+ <DaysOfWeek>
+ <Day>
+ <DayID>sun</DayID>
+ <DefaultAbbrvName>ا</DefaultAbbrvName>
+ <DefaultFullName>اتوار</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>mon</DayID>
+ <DefaultAbbrvName>پ</DefaultAbbrvName>
+ <DefaultFullName>پير</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>tue</DayID>
+ <DefaultAbbrvName>م</DefaultAbbrvName>
+ <DefaultFullName>منگل</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>wed</DayID>
+ <DefaultAbbrvName>ب</DefaultAbbrvName>
+ <DefaultFullName>بده</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>thu</DayID>
+ <DefaultAbbrvName>ج</DefaultAbbrvName>
+ <DefaultFullName>جمعرات</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>fri</DayID>
+ <DefaultAbbrvName>ج</DefaultAbbrvName>
+ <DefaultFullName>جمعہ</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>sat</DayID>
+ <DefaultAbbrvName>ہ</DefaultAbbrvName>
+ <DefaultFullName>ہفتہ</DefaultFullName>
+ </Day>
+ </DaysOfWeek>
+ <MonthsOfYear>
+ <Month>
+ <MonthID>jan</MonthID>
+ <DefaultAbbrvName>ج</DefaultAbbrvName>
+ <DefaultFullName>جنوری</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>feb</MonthID>
+ <DefaultAbbrvName>ف</DefaultAbbrvName>
+ <DefaultFullName>فروری</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>mar</MonthID>
+ <DefaultAbbrvName>م</DefaultAbbrvName>
+ <DefaultFullName>مار چ</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>apr</MonthID>
+ <DefaultAbbrvName>ا</DefaultAbbrvName>
+ <DefaultFullName>اپريل</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>may</MonthID>
+ <DefaultAbbrvName>م</DefaultAbbrvName>
+ <DefaultFullName>مئ</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>jun</MonthID>
+ <DefaultAbbrvName>ج</DefaultAbbrvName>
+ <DefaultFullName>جون</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>jul</MonthID>
+ <DefaultAbbrvName>ج</DefaultAbbrvName>
+ <DefaultFullName>جولائ</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>aug</MonthID>
+ <DefaultAbbrvName>ا</DefaultAbbrvName>
+ <DefaultFullName>اگست</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>sep</MonthID>
+ <DefaultAbbrvName>س</DefaultAbbrvName>
+ <DefaultFullName>ستمبر</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>oct</MonthID>
+ <DefaultAbbrvName>ا</DefaultAbbrvName>
+ <DefaultFullName>اکتوبر</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>nov</MonthID>
+ <DefaultAbbrvName>ن</DefaultAbbrvName>
+ <DefaultFullName>نومبر</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>dec</MonthID>
+ <DefaultAbbrvName>د</DefaultAbbrvName>
+ <DefaultFullName>دسمبر</DefaultFullName>
+ </Month>
+ </MonthsOfYear>
+ <Eras>
+ <Era>
+ <EraID>bc</EraID>
+ <DefaultAbbrvName>ق م</DefaultAbbrvName>
+ <DefaultFullName>قبل مسيح</DefaultFullName>
+ </Era>
+ <Era>
+ <EraID>ad</EraID>
+ <DefaultAbbrvName>ء</DefaultAbbrvName>
+ <DefaultFullName>عيسوی سن</DefaultFullName>
+ </Era>
+ </Eras>
+ <StartDayOfWeek>
+ <DayID>sun</DayID>
+ </StartDayOfWeek>
+ <MinimalDaysInFirstWeek>1</MinimalDaysInFirstWeek>
+ </Calendar>
+ </LC_CALENDAR>
+ <LC_CURRENCY>
+ <Currency default="true" usedInCompatibleFormatCodes="true">
+ <CurrencyID>PKR</CurrencyID>
+ <CurrencySymbol>₨</CurrencySymbol>
+ <BankSymbol>PKR</BankSymbol>
+ <CurrencyName>پاکستانی روپیہ</CurrencyName>
+ <DecimalPlaces>2</DecimalPlaces>
+ </Currency>
+ </LC_CURRENCY>
+ <LC_TRANSLITERATION>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
+ <Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="IGNORE_CASE"/>
+ </LC_TRANSLITERATION>
+ <LC_MISC>
+ <ReservedWords>
+ <trueWord>راست</trueWord>
+ <falseWord>غلط</falseWord>
+ <quarter1Word>ایک چوتھائی</quarter1Word>
+ <quarter2Word>دو چوتھائی</quarter2Word>
+ <quarter3Word>تین چوتھائی</quarter3Word>
+ <quarter4Word>چار چوتھائی</quarter4Word>
+ <aboveWord>اوپر</aboveWord>
+ <belowWord>نیچے</belowWord>
+ <quarter1Abbreviation>چوتھائی 1</quarter1Abbreviation>
+ <quarter2Abbreviation>چوتھائی 2 </quarter2Abbreviation>
+ <quarter3Abbreviation>چوتھائی 3</quarter3Abbreviation>
+ <quarter4Abbreviation>چوتھائی 4</quarter4Abbreviation>
+ </ReservedWords>
+ </LC_MISC>
+ <LC_NumberingLevel>
+ <NumberingLevel NumType="4" Prefix=" " Suffix=")"/>
+ <NumberingLevel NumType="4" Prefix=" " Suffix="."/>
+ <NumberingLevel NumType="4" Prefix="(" Suffix=")"/>
+ <NumberingLevel NumType="2" Prefix=" " Suffix="."/>
+ <NumberingLevel NumType="0" Prefix=" " Suffix=")"/>
+ <NumberingLevel NumType="1" Prefix=" " Suffix=")"/>
+ <NumberingLevel NumType="1" Prefix="(" Suffix=")"/>
+ <NumberingLevel NumType="3" Prefix=" " Suffix="."/>
+ </LC_NumberingLevel>
+ <LC_OutLineNumberingLevel ref="en_US"/>
+</Locale>
+<!--Version 1.0 -->
diff --git a/i18npool/source/localedata/data/yi_US.xml b/i18npool/source/localedata/data/yi_US.xml
new file mode 100644
index 000000000000..cf52c1ae1fdf
--- /dev/null
+++ b/i18npool/source/localedata/data/yi_US.xml
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE Locale SYSTEM 'locale.dtd'>
+<Locale versionDTD="2.0.3" allowUpdateFromCLDR="no" version="1.0">
+ <LC_INFO>
+ <Language>
+ <LangID>yi</LangID>
+ <DefaultName>Yiddish</DefaultName>
+ </Language>
+ <Country>
+ <CountryID>US</CountryID>
+ <DefaultName>United States</DefaultName>
+ </Country>
+ </LC_INFO>
+ <LC_CTYPE ref="en_US"/>
+ <LC_FORMAT ref="en_US" replaceTo="[$$-83D]"/>
+ <LC_COLLATION ref="en_US"/>
+ <LC_SEARCH ref="en_US"/>
+ <LC_INDEX>
+ <IndexKey phonetic="false" default="true" unoid="alphanumeric">א-י כ ל מ נ ס ע פ צ-ת</IndexKey>
+ <UnicodeScript>10</UnicodeScript>
+ <FollowPageWord>ז“</FollowPageWord>
+ <FollowPageWord>ז“</FollowPageWord>
+ </LC_INDEX>
+ <LC_CALENDAR>
+ <Calendar unoid="gregorian" default="true">
+ <DaysOfWeek>
+ <Day>
+ <DayID>sun</DayID>
+ <DefaultAbbrvName>זונ'</DefaultAbbrvName>
+ <DefaultFullName>זונטיק</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>mon</DayID>
+ <DefaultAbbrvName>מאָנ'</DefaultAbbrvName>
+ <DefaultFullName>מאָנטיק</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>tue</DayID>
+ <DefaultAbbrvName>דינ'</DefaultAbbrvName>
+ <DefaultFullName>דינסטיק</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>wed</DayID>
+ <DefaultAbbrvName>מיט'</DefaultAbbrvName>
+ <DefaultFullName>מיטװאָך</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>thu</DayID>
+ <DefaultAbbrvName>דאָנ'</DefaultAbbrvName>
+ <DefaultFullName>דאָנערשטיק</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>fri</DayID>
+ <DefaultAbbrvName>פֿרײַ'</DefaultAbbrvName>
+ <DefaultFullName>פֿרײַטיק</DefaultFullName>
+ </Day>
+ <Day>
+ <DayID>sat</DayID>
+ <DefaultAbbrvName>שבת</DefaultAbbrvName>
+ <DefaultFullName>שבת</DefaultFullName>
+ </Day>
+ </DaysOfWeek>
+ <MonthsOfYear>
+ <Month>
+ <MonthID>jan</MonthID>
+ <DefaultAbbrvName>יאַנ</DefaultAbbrvName>
+ <DefaultFullName>יאַנואַר</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>feb</MonthID>
+ <DefaultAbbrvName>פֿעב</DefaultAbbrvName>
+ <DefaultFullName>פֿעברואַר</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>mar</MonthID>
+ <DefaultAbbrvName>מאַר</DefaultAbbrvName>
+ <DefaultFullName>מאַרץ</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>apr</MonthID>
+ <DefaultAbbrvName>אַפּר</DefaultAbbrvName>
+ <DefaultFullName>אַפּריל</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>may</MonthID>
+ <DefaultAbbrvName>מײַ</DefaultAbbrvName>
+ <DefaultFullName>מײַ</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>jun</MonthID>
+ <DefaultAbbrvName>יונ</DefaultAbbrvName>
+ <DefaultFullName>יוני</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>jul</MonthID>
+ <DefaultAbbrvName>יול</DefaultAbbrvName>
+ <DefaultFullName>יולי</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>aug</MonthID>
+ <DefaultAbbrvName>אױג</DefaultAbbrvName>
+ <DefaultFullName>אױגוסט</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>sep</MonthID>
+ <DefaultAbbrvName>סעפּ</DefaultAbbrvName>
+ <DefaultFullName>סעפּטעמבער</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>oct</MonthID>
+ <DefaultAbbrvName>אָקט</DefaultAbbrvName>
+ <DefaultFullName>אָקטאָבער</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>nov</MonthID>
+ <DefaultAbbrvName>נאָװ</DefaultAbbrvName>
+ <DefaultFullName>נאָװעמבער</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>dec</MonthID>
+ <DefaultAbbrvName>דעצ</DefaultAbbrvName>
+ <DefaultFullName>דעצעמבער</DefaultFullName>
+ </Month>
+ </MonthsOfYear>
+ <Eras>
+ <Era>
+ <EraID>bc</EraID>
+ <DefaultAbbrvName>פֿ"ק</DefaultAbbrvName>
+ <DefaultFullName>פֿ"ק</DefaultFullName>
+ </Era>
+ <Era>
+ <EraID>ad</EraID>
+ <DefaultAbbrvName>אצ“ר</DefaultAbbrvName>
+ <DefaultFullName>אצ“ר</DefaultFullName>
+ </Era>
+ </Eras>
+ <StartDayOfWeek>
+ <DayID>sun</DayID>
+ </StartDayOfWeek>
+ <MinimalDaysInFirstWeek>1</MinimalDaysInFirstWeek>
+ </Calendar>
+ </LC_CALENDAR>
+ <LC_CURRENCY ref="en_US"/>
+ <LC_TRANSLITERATION ref="en_US"/>
+ <LC_MISC>
+ <ReservedWords>
+ <trueWord>אמת</trueWord>
+ <falseWord>פֿאַלש</falseWord>
+ <quarter1Word>ערשט יאָרפֿערטל</quarter1Word>
+ <quarter2Word>צװײט יאָרפֿערטל</quarter2Word>
+ <quarter3Word>דריט יאָרפֿערטל</quarter3Word>
+ <quarter4Word>פֿערט יאָרפֿערטל</quarter4Word>
+ <aboveWord>אױבן</aboveWord>
+ <belowWord>אונטן</belowWord>
+ <quarter1Abbreviation>י“פֿ1</quarter1Abbreviation>
+ <quarter2Abbreviation>י“פֿ2</quarter2Abbreviation>
+ <quarter3Abbreviation>י“פֿ3</quarter3Abbreviation>
+ <quarter4Abbreviation>י“פֿ4</quarter4Abbreviation>
+ </ReservedWords>
+ </LC_MISC>
+ <LC_NumberingLevel ref="en_US"/>
+ <LC_OutLineNumberingLevel ref="en_US"/>
+</Locale>
diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx
index 34f4f6bbb520..8906a3433bea 100644
--- a/i18npool/source/localedata/localedata.cxx
+++ b/i18npool/source/localedata/localedata.cxx
@@ -169,6 +169,7 @@ static const struct {
{ "ast_ES", lcl_DATA_EURO },
{ "ltg_LV", lcl_DATA_EURO },
{ "hsb_DE", lcl_DATA_EURO },
+ { "dsb_DE", lcl_DATA_EURO },
{ "rue_SK", lcl_DATA_EURO },
{ "ja_JP", lcl_DATA_OTHERS },
@@ -251,6 +252,12 @@ static const struct {
{ "om_ET", lcl_DATA_OTHERS },
{ "plt_MG", lcl_DATA_OTHERS },
{ "mai_IN", lcl_DATA_OTHERS },
+ { "yi_US", lcl_DATA_OTHERS },
+ { "haw_US", lcl_DATA_OTHERS },
+ { "lif_NP", lcl_DATA_OTHERS },
+ { "ur_PK", lcl_DATA_OTHERS },
+ { "ht_HT", lcl_DATA_OTHERS },
+ { "jbo", lcl_DATA_OTHERS }
};
static const sal_Unicode under = sal_Unicode('_');
diff --git a/i18npool/source/paper/paper.cxx b/i18npool/source/paper/paper.cxx
index 0d9235747fd6..aaac0e83a4eb 100644
--- a/i18npool/source/paper/paper.cxx
+++ b/i18npool/source/paper/paper.cxx
@@ -159,7 +159,7 @@ static PageDesc aDinTab[] =
static const size_t nTabSize = sizeof(aDinTab) / sizeof(aDinTab[0]);
-#define MAXSLOPPY 11
+#define MAXSLOPPY 21
bool PaperInfo::doSloppyFit()
{
diff --git a/l10ntools/scripts/localize.pl b/l10ntools/scripts/localize.pl
index 323f7fe549b6..e432869d3a7b 100755
--- a/l10ntools/scripts/localize.pl
+++ b/l10ntools/scripts/localize.pl
@@ -175,7 +175,7 @@ sub splitfile{
exit( -1 );
}
my $src_root = $ENV{SOURCE_ROOT_DIR};
- my $ooo_src_root = $ENV{SRC_ROOT};
+ my $ooo_src_root = $src_root."/l10n/l10n";
my $so_l10n_path = $src_root."/sun/l10n_so/source";
my $ooo_l10n_path = $ooo_src_root."/l10n/source";
diff --git a/l10ntools/scripts/tool/l10ntool.py b/l10ntools/scripts/tool/l10ntool.py
index b65c262b6020..126b991c377b 100644
--- a/l10ntools/scripts/tool/l10ntool.py
+++ b/l10ntools/scripts/tool/l10ntool.py
@@ -122,6 +122,11 @@ class AbstractL10nTool:
pass
try:
+ os.remove(outputfilename)
+ except:
+ pass
+
+ try:
shutil.copy(inputfilename, outputfilename)
except IOError:
print "ERROR: Can not copy file '" + inputfilename + "' to " + "'" + outputfilename + "'"
diff --git a/l10ntools/source/help/HelpCompiler.hxx b/l10ntools/source/help/HelpCompiler.hxx
index e300fe26f16d..8ce6098d21a9 100644..100755
--- a/l10ntools/source/help/HelpCompiler.hxx
+++ b/l10ntools/source/help/HelpCompiler.hxx
@@ -102,6 +102,14 @@ namespace fs
HCDBG(std::cerr << "native_file_string is " << tmp.getStr() << std::endl);
return std::string(tmp.getStr());
}
+#ifdef WNT
+ wchar_t const * native_file_string_w() const
+ {
+ ::rtl::OUString ustrSystemPath;
+ osl::File::getSystemPathFromFileURL(data, ustrSystemPath);
+ return ustrSystemPath.getStr();
+ }
+#endif
std::string native_directory_string() const { return native_file_string(); }
std::string toUTF8() const
{
diff --git a/l10ntools/source/help/HelpIndexerTool.java b/l10ntools/source/help/HelpIndexerTool.java
index a39b5399e38d..c20d9f108ced 100644
--- a/l10ntools/source/help/HelpIndexerTool.java
+++ b/l10ntools/source/help/HelpIndexerTool.java
@@ -45,6 +45,15 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Date;
+
+/**
+ When this tool is used with long path names on Windows, that is paths which start
+ with \\?\, then the caller must make sure that the path is unique. This is achieved
+ by removing '.' and '..' from the path. Paths which are created by
+ osl_getSystemPathFromFileURL fulfill this requirement. This is necessary because
+ lucene is patched to not use File.getCanonicalPath. See long_path.patch in the lucene
+ module.
+ */
public class HelpIndexerTool
{
public HelpIndexerTool()
diff --git a/l10ntools/source/help/HelpLinker.cxx b/l10ntools/source/help/HelpLinker.cxx
index 4e3a4cedbe6f..036208520ede 100644..100755
--- a/l10ntools/source/help/HelpLinker.cxx
+++ b/l10ntools/source/help/HelpLinker.cxx
@@ -118,7 +118,13 @@ void IndexerPreProcessor::processDocument
{
fs::path fsCaptionPureTextFile_docURL = m_fsCaptionFilesDirName / aStdStr_EncodedDocPathURL;
std::string aCaptionPureTextFileStr_docURL = fsCaptionPureTextFile_docURL.native_file_string();
- FILE* pFile_docURL = fopen( aCaptionPureTextFileStr_docURL.c_str(), "w" );
+#ifdef WNT //We need _wfopen to support long file paths on Windows XP
+ FILE* pFile_docURL = _wfopen(
+ fsCaptionPureTextFile_docURL.native_file_string_w(), L"w" );
+#else
+ FILE* pFile_docURL = fopen(
+ fsCaptionPureTextFile_docURL.native_file_string().c_str(), "w" );
+#endif
if( pFile_docURL )
{
fprintf( pFile_docURL, "%s\n", pResNodeCaption->content );
@@ -135,8 +141,13 @@ void IndexerPreProcessor::processDocument
if( pResNodeContent )
{
fs::path fsContentPureTextFile_docURL = m_fsContentFilesDirName / aStdStr_EncodedDocPathURL;
- std::string aContentPureTextFileStr_docURL = fsContentPureTextFile_docURL.native_file_string();
- FILE* pFile_docURL = fopen( aContentPureTextFileStr_docURL.c_str(), "w" );
+#ifdef WNT //We need _wfopen to support long file paths on Windows XP
+ FILE* pFile_docURL = _wfopen(
+ fsContentPureTextFile_docURL.native_file_string_w(), L"w" );
+#else
+ FILE* pFile_docURL = fopen(
+ fsContentPureTextFile_docURL.native_file_string().c_str(), "w" );
+#endif
if( pFile_docURL )
{
fprintf( pFile_docURL, "%s\n", pResNodeContent->content );
@@ -226,9 +237,13 @@ public:
}
}
- void dump_DBHelp( const std::string& rFileName )
+ void dump_DBHelp( const fs::path& rFileName )
{
- FILE* pFile = fopen( rFileName.c_str(), "wb" );
+#ifdef WNT //We need _wfopen to support long file paths on Windows XP
+ FILE* pFile = _wfopen( rFileName.native_file_string_w(), L"wb" );
+#else
+ FILE* pFile = fopen( rFileName.native_file_string().c_str(), "wb" );
+#endif
if( pFile == NULL )
return;
@@ -430,9 +445,15 @@ void HelpLinker::link() throw( HelpProcessingException )
#endif
fs::path helpTextFileName_DBHelp(indexDirParentName / (mod + (bUse_ ? ".ht_" : ".ht")));
+#ifdef WNT
+ //We need _wfopen to support long file paths on Windows XP
+ FILE* pFileHelpText_DBHelp = _wfopen
+ ( helpTextFileName_DBHelp.native_file_string_w(), L"wb" );
+#else
+
FILE* pFileHelpText_DBHelp = fopen
( helpTextFileName_DBHelp.native_file_string().c_str(), "wb" );
-
+#endif
DB* dbBase(0);
#ifndef DBHELP_ONLY
fs::path dbBaseFileName(indexDirParentName / (mod + ".db"));
@@ -442,8 +463,14 @@ void HelpLinker::link() throw( HelpProcessingException )
#endif
fs::path dbBaseFileName_DBHelp(indexDirParentName / (mod + (bUse_ ? ".db_" : ".db")));
+#ifdef WNT
+ //We need _wfopen to support long file paths on Windows XP
+ FILE* pFileDbBase_DBHelp = _wfopen
+ ( dbBaseFileName_DBHelp.native_file_string_w(), L"wb" );
+#else
FILE* pFileDbBase_DBHelp = fopen
( dbBaseFileName_DBHelp.native_file_string().c_str(), "wb" );
+#endif
#ifndef DBHELP_ONLY
DB* keyWord(0);
@@ -692,7 +719,7 @@ void HelpLinker::link() throw( HelpProcessingException )
if( pFileDbBase_DBHelp != NULL )
fclose( pFileDbBase_DBHelp );
- helpKeyword.dump_DBHelp( keyWordFileName_DBHelp.native_file_string() );
+ helpKeyword.dump_DBHelp( keyWordFileName_DBHelp);
if( !bExtensionMode )
{
diff --git a/padmin/AllLangResTarget_spa.mk b/padmin/AllLangResTarget_spa.mk
new file mode 100644
index 000000000000..1fd6e42dad56
--- /dev/null
+++ b/padmin/AllLangResTarget_spa.mk
@@ -0,0 +1,48 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2009 by Sun Microsystems, Inc.
+#
+# 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.
+#
+#*************************************************************************
+
+$(eval $(call gb_AllLangResTarget_AllLangResTarget,spa))
+
+$(eval $(call gb_AllLangResTarget_set_reslocation,spa,padmin))
+
+$(eval $(call gb_AllLangResTarget_add_srs,spa,\
+ padmin/source \
+))
+
+$(eval $(call gb_SrsTarget_SrsTarget,padmin/source))
+
+$(eval $(call gb_SrsTarget_set_include,padmin/source,\
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_SrsTarget_add_files,padmin/source,\
+ padmin/source/padialog.src \
+ padmin/source/rtsetup.src \
+))
+
+
+# vim: set noet sw=4 ts=4:
diff --git a/padmin/Executable_spadmin.bin.mk b/padmin/Executable_spadmin.bin.mk
new file mode 100644
index 000000000000..ae677c1c86b4
--- /dev/null
+++ b/padmin/Executable_spadmin.bin.mk
@@ -0,0 +1,70 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+$(eval $(call gb_Executable_Executable,spadmin.bin))
+
+$(eval $(call gb_Executable_set_include,spadmin.bin,\
+ $$(INCLUDE) \
+ -I$(OUTDIR)/inc \
+ -I$(OUTDIR)/inc/offuh \
+))
+
+$(eval $(call gb_Executable_set_cxxflags,spadmin.bin,\
+ $$(CXXFLAGS) \
+))
+
+$(eval $(call gb_Executable_add_linked_static_libs,spadmin.bin,\
+ vclmain \
+))
+
+$(eval $(call gb_Executable_add_linked_libs,spadmin.bin,\
+ spa \
+ svt \
+ vcl \
+ utl \
+ ucbhelper \
+ comphelper \
+ tl \
+ cppuhelper \
+ cppu \
+ sal \
+ stl \
+))
+
+$(eval $(call gb_Executable_add_exception_objects,spadmin.bin,\
+ padmin/source/desktopcontext \
+ padmin/source/pamain \
+))
+
+ifeq ($(OS),LINUX)
+$(eval $(call gb_Executable_add_linked_libs,spadmin.bin,\
+ dl \
+ pthread \
+))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/padmin/Library_spa.mk b/padmin/Library_spa.mk
new file mode 100644
index 000000000000..47618720d283
--- /dev/null
+++ b/padmin/Library_spa.mk
@@ -0,0 +1,76 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+$(eval $(call gb_Library_Library,spa))
+
+$(eval $(call gb_Library_set_include,spa,\
+ $$(INCLUDE) \
+ -I$(OUTDIR)/inc/offuh \
+ -I$(OUTDIR)/inc/stl \
+))
+
+$(eval $(call gb_Library_set_defs,spa,\
+ $$(DEFS) \
+ -DSPA_DLLIMPLEMENTATION \
+))
+
+$(eval $(call gb_Library_add_linked_libs,spa,\
+ svt \
+ vcl \
+ utl \
+ tl \
+ basegfx \
+ comphelper \
+ i18nisolang1 \
+ stl \
+ cppu \
+ sal \
+ vos3 \
+))
+
+
+$(eval $(call gb_Library_add_exception_objects,spa,\
+ padmin/source/adddlg \
+ padmin/source/cmddlg \
+ padmin/source/fontentry \
+ padmin/source/helper \
+ padmin/source/newppdlg \
+ padmin/source/padialog \
+ padmin/source/progress \
+ padmin/source/prtsetup \
+ padmin/source/titlectrl \
+))
+
+ifeq ($(OS),LINUX)
+$(eval $(call gb_Library_add_linked_libs,spa,\
+ dl \
+ m \
+ pthread \
+))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/padmin/Makefile b/padmin/Makefile
new file mode 100644
index 000000000000..a79aff831024
--- /dev/null
+++ b/padmin/Makefile
@@ -0,0 +1,38 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+ifeq ($(strip $(SOLARENV)),)
+$(error No environment set!)
+endif
+
+gb_PARTIALBUILD := T
+GBUILDDIR := $(SOLARENV)/gbuild
+include $(GBUILDDIR)/gbuild.mk
+
+$(eval $(call gb_Module_make_global_targets,$(shell ls $(dir $(realpath $(firstword $(MAKEFILE_LIST))))/Module*.mk)))
+
+# vim: set noet sw=4 ts=4:
diff --git a/padmin/Module_padmin.mk b/padmin/Module_padmin.mk
new file mode 100644
index 000000000000..01fd4c99af19
--- /dev/null
+++ b/padmin/Module_padmin.mk
@@ -0,0 +1,41 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+
+$(eval $(call gb_Module_Module,padmin))
+
+ifeq ($(GUIBASE),unx)
+
+$(eval $(call gb_Module_add_targets,padmin,\
+ Executable_spadmin.bin \
+ Library_spa \
+ AllLangResTarget_spa \
+ Package_inc \
+))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/padmin/Package_inc.mk b/padmin/Package_inc.mk
new file mode 100644
index 000000000000..3a2a3a3177e1
--- /dev/null
+++ b/padmin/Package_inc.mk
@@ -0,0 +1,30 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+$(eval $(call gb_Package_Package,padmin_src,$(SRCDIR)/padmin/source))
+$(eval $(call gb_Package_add_file,padmin_src,bin/spadmin,spadmin.sh))
+
diff --git a/padmin/prj/build.lst b/padmin/prj/build.lst
index 9aaab83cf7de..0e505f92f2a2 100644
--- a/padmin/prj/build.lst
+++ b/padmin/prj/build.lst
@@ -1,3 +1,3 @@
pd padmin : vcl svtools NULL
pd padmin usr1 - all pd_mkout NULL
-pd padmin\source nmake - all pd_source NULL
+pd padmin\prj nmake - all pd_prj NULL
diff --git a/padmin/prj/d.lst b/padmin/prj/d.lst
index 3b86822c24e8..8b137891791f 100644
--- a/padmin/prj/d.lst
+++ b/padmin/prj/d.lst
@@ -1,8 +1 @@
-mkdir: %COMMON_DEST%\bin%_EXT%\hid
-..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid
-..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res
-..\%__SRC%\bin\*.bin %_DEST%\bin%_EXT%\*.bin
-..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%\lib*.so
-..\%__SRC%\lib\lib*.dylib %_DEST%\lib%_EXT%\lib*.dylib
-..\%__SRC%\misc\spadmin.sh %_DEST%\bin%_EXT%\spadmin
diff --git a/padmin/prj/makefile.mk b/padmin/prj/makefile.mk
new file mode 100644
index 000000000000..c73a3d944bbf
--- /dev/null
+++ b/padmin/prj/makefile.mk
@@ -0,0 +1,40 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..
+TARGET=prj
+
+.INCLUDE : settings.mk
+
+.IF "$(VERBOSE)"!=""
+VERBOSEFLAG :=
+.ELSE
+VERBOSEFLAG := -s
+.ENDIF
+
+all:
+ cd $(PRJ) && $(GNUMAKE) $(VERBOSEFLAG) -r -j$(MAXPROCESS) $(gb_MAKETARGET)
diff --git a/padmin/source/helper.hxx b/padmin/source/helper.hxx
index b78bee96672d..5b7b710679a8 100644
--- a/padmin/source/helper.hxx
+++ b/padmin/source/helper.hxx
@@ -46,6 +46,13 @@
#endif
#include <vcl/combobox.hxx>
+#if defined SPA_DLLIMPLEMENTATION
+#define SPA_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define SPA_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+
class Config;
#define PSPRINT_PPDDIR "driver"
diff --git a/padmin/source/makefile.mk b/padmin/source/makefile.mk
deleted file mode 100644
index 8bcbd51ef832..000000000000
--- a/padmin/source/makefile.mk
+++ /dev/null
@@ -1,115 +0,0 @@
-#*************************************************************************
-#
-# 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.
-#
-#*************************************************************************
-
-.IF "$(GUIBASE)"=="aqua"
-
-dummy:
- @echo "Nothing to build for GUIBASE aqua."
-
-.ELSE
-
-PRJ=..
-PRJNAME=padmin
-TARGET=padmin
-TARGETTYPE=GUI
-ENABLE_EXCEPTIONS=TRUE
-LIBTARGET=NO
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE: settings.mk
-
-# --- Files --------------------------------------------------------
-
-SRS1NAME=$(TARGET)
-SRC1FILES=padialog.src rtsetup.src
-
-RESLIB1NAME=spa
-RESLIB1IMAGES=$(PRJ)$/source
-RESLIB1SRSFILES= $(SRS)$/padmin.srs
-RESLIB1DEPN=\
- padialog.src \
- padialog.hrc \
- rtsetup.src \
- rtsetup.hrc
-
-.IF "$(GUI)" == "UNX"
-
-SLOFILES=\
- $(SLO)$/padialog.obj \
- $(SLO)$/cmddlg.obj \
- $(SLO)$/progress.obj \
- $(SLO)$/newppdlg.obj \
- $(SLO)$/prtsetup.obj \
- $(SLO)$/fontentry.obj \
- $(SLO)$/helper.obj \
- $(SLO)$/adddlg.obj \
- $(SLO)$/titlectrl.obj
-
-
-OBJFILES=\
- $(OBJ)/pamain.obj
-
-SHL1TARGET= spa$(DLLPOSTFIX)
-SHL1OBJS=$(SLOFILES)
-SHL1STDLIBS=\
- $(SVTOOLLIB) \
- $(VCLLIB) \
- $(UNOTOOLSLIB) \
- $(TOOLSLIB) \
- $(COMPHELPERLIB) \
- $(CPPULIB) \
- $(SALLIB)
-
-APP1TARGET=spadmin.bin
-APP1DEPN+=$(SHL1TARGETN)
-
-APP1OBJS=\
- $(OBJ)$/desktopcontext.obj \
- $(OBJ)/pamain.obj
-
-APP1STDLIBS= \
- -l$(SHL1TARGET) \
- $(VCLLIB) \
- $(UNOTOOLSLIB) \
- $(TOOLSLIB) \
- $(UCBHELPERLIB) \
- $(COMPHELPERLIB) \
- $(CPPUHELPERLIB) \
- $(CPPULIB) \
- $(SALLIB)
-
-UNIXTEXT = $(MISC)$/spadmin.sh
-
-.ENDIF
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
-
-.ENDIF # GUIBASE==aqua
-
diff --git a/padmin/source/padialog.hxx b/padmin/source/padialog.hxx
index 88086e9497de..a0cee7b2af7d 100644
--- a/padmin/source/padialog.hxx
+++ b/padmin/source/padialog.hxx
@@ -50,7 +50,7 @@ class Printer;
namespace padmin {
- class PADialog : public ModalDialog
+ class SPA_DLLPUBLIC PADialog : public ModalDialog
{
private:
DelListBox m_aDevicesLB;
diff --git a/padmin/source/padialog.src b/padmin/source/padialog.src
index 09ce29a2c682..85191f3dddf9 100644
--- a/padmin/source/padialog.src
+++ b/padmin/source/padialog.src
@@ -483,47 +483,47 @@ String RID_YOU_SURE
Bitmap RID_BUTTERFLY
{
- File = "butter.png" ;
+ File = "source/butter.png" ;
};
Bitmap RID_BMP_SMALL_PRINTER
{
- File = "print.png";
+ File = "source/print.png";
};
Bitmap RID_BMP_SMALL_FAX
{
- File = "fax.png";
+ File = "source/fax.png";
};
Bitmap RID_BMP_SMALL_PDF
{
- File = "pdf.png";
+ File = "source/pdf.png";
};
Bitmap RID_BMP_PRINTER
{
- File = "printer_large.png";
+ File = "source/printer_large.png";
};
Bitmap RID_BMP_SMALL_PRINTER_HC
{
- File = "printer_16_h.png";
+ File = "source/printer_16_h.png";
};
Bitmap RID_BMP_SMALL_FAX_HC
{
- File = "fax_16_h.png";
+ File = "source/fax_16_h.png";
};
Bitmap RID_BMP_SMALL_PDF_HC
{
- File = "printpdf_16_h.png";
+ File = "source/printpdf_16_h.png";
};
Bitmap RID_BMP_PRINTER_HC
{
- File = "printer_40x48_h.png";
+ File = "source/printer_40x48_h.png";
};
diff --git a/padmin/source/prtsetup.cxx b/padmin/source/prtsetup.cxx
index 2ec2707a2bcc..ad73d48ae48b 100644
--- a/padmin/source/prtsetup.cxx
+++ b/padmin/source/prtsetup.cxx
@@ -802,7 +802,7 @@ OString RTSPWDialog::getPassword() const
extern "C" {
- int Sal_SetupPrinterDriver( ::psp::PrinterInfo& rJobData )
+ int SPA_DLLPUBLIC Sal_SetupPrinterDriver( ::psp::PrinterInfo& rJobData )
{
int nRet = 0;
RTSDialog aDialog( rJobData, rJobData.m_aPrinterName, false );
@@ -816,14 +816,14 @@ extern "C" {
return nRet;
}
- int Sal_queryFaxNumber( String& rNumber )
+ int SPA_DLLPUBLIC Sal_queryFaxNumber( String& rNumber )
{
String aTmpString( PaResId( RID_TXT_QUERYFAXNUMBER ) );
QueryString aQuery( NULL, aTmpString, rNumber );
return aQuery.Execute();
}
- bool Sal_authenticateQuery( const OString& rServer, OString& rUserName, OString& rPassword )
+ bool SPA_DLLPUBLIC Sal_authenticateQuery( const OString& rServer, OString& rUserName, OString& rPassword )
{
bool bRet = false;
diff --git a/rsc/source/rscpp/cpp4.c b/rsc/source/rscpp/cpp4.c
index b8f90ab4f7ed..04d715f35351 100644
--- a/rsc/source/rscpp/cpp4.c
+++ b/rsc/source/rscpp/cpp4.c
@@ -629,7 +629,7 @@ void dumpparm(char* why)
nargs, parmp - parm, why);
for (i = 0; i < nargs; i++) {
fprintf( pCppOut, "parm[%d] (%d) = \"%s\"\n",
- i + 1, strlen(parlist[i]), parlist[i]);
+ i + 1, (int)strlen(parlist[i]), parlist[i]);
}
}
#endif
diff --git a/rsc/source/tools/rscchar.cxx b/rsc/source/tools/rscchar.cxx
index f666058617f8..f554040c4ec9 100644
--- a/rsc/source/tools/rscchar.cxx
+++ b/rsc/source/tools/rscchar.cxx
@@ -55,13 +55,13 @@
*************************************************************************/
char * RscChar::MakeUTF8( char * pStr, sal_uInt16 nTextEncoding )
{
- sal_Size nMaxUniCodeBuf = strlen( pStr ) + 1;
- char * pOrgStr = new char[ nMaxUniCodeBuf ];
- sal_uInt32 nOrgLen = 0;
-
+ sal_Size nMaxUniCodeBuf = strlen( pStr ) + 1;
if( nMaxUniCodeBuf * 6 > 0x0FFFFF )
RscExit( 10 );
+ char * pOrgStr = new char[ nMaxUniCodeBuf ];
+ sal_uInt32 nOrgLen = 0;
+
char cOld = '1';
while( cOld != 0 )
{
@@ -119,9 +119,8 @@ char * RscChar::MakeUTF8( char * pStr, sal_uInt16 nTextEncoding )
}
if( nChar > 255 )
{
- rtl_freeMemory( pOrgStr );
-
// Wert zu gross, oder kein 3 Ziffern
+ delete [] pOrgStr;
return( NULL );
}
c = (char)nChar;
@@ -174,6 +173,7 @@ char * RscChar::MakeUTF8( char * pStr, sal_uInt16 nTextEncoding )
&nSrcCvtBytes );
rtl_destroyTextToUnicodeConverter( hConv );
+ delete[] pOrgStr, pOrgStr = 0;
hConv = rtl_createUnicodeToTextConverter( RTL_TEXTENCODING_UTF8 );
// factor fo 6 is the maximum size of an UNICODE character as utf8
@@ -188,9 +188,7 @@ char * RscChar::MakeUTF8( char * pStr, sal_uInt16 nTextEncoding )
&nSrcCvtBytes );
rtl_destroyTextToUnicodeConverter( hConv );
-
- delete[] pUniCode;
- delete[] pOrgStr;
+ delete[] pUniCode, pUniCode = 0;
return pUtf8;
};
diff --git a/sot/source/sdstor/stgio.cxx b/sot/source/sdstor/stgio.cxx
index 0a10192528c1..36b841b29ca0 100644
--- a/sot/source/sdstor/stgio.cxx
+++ b/sot/source/sdstor/stgio.cxx
@@ -159,6 +159,7 @@ class EasyFat
public:
EasyFat( StgIo & rIo, StgStrm *pFatStream, sal_Int32 nPSize );
~EasyFat() { delete[] pFat; delete[] pFree; }
+
sal_Int32 GetPageSize() { return nPageSize; }
sal_Int32 Count() { return nPages; }
sal_Int32 operator[]( sal_Int32 nOffset ) { return pFat[ nOffset ]; }
@@ -385,5 +386,3 @@ sal_uLong StgIo::ValidateFATs()
// DBG_ERROR("Validiere nicht (kein FileStorage)");
return FAT_OK;
}
-
-
diff --git a/svl/inc/svl/nfkeytab.hxx b/svl/inc/svl/nfkeytab.hxx
index 7c3fef4b88cc..34d483ab4d86 100644
--- a/svl/inc/svl/nfkeytab.hxx
+++ b/svl/inc/svl/nfkeytab.hxx
@@ -28,6 +28,7 @@
#ifndef INCLUDED_SVTOOLS_NFKEYTAB_HXX
#define INCLUDED_SVTOOLS_NFKEYTAB_HXX
+#include <vector>
#include <tools/string.hxx>
//! For ImpSvNumberformatScan: first the short symbols, then the long symbols!
@@ -111,7 +112,18 @@ enum NfKeywordIndex
NF_KEYWORD_ENTRIES_COUNT
};
-typedef String NfKeywordTable [NF_KEYWORD_ENTRIES_COUNT];
+class NfKeywordTable
+{
+ typedef ::std::vector<String> Keywords_t;
+ Keywords_t m_keywords;
+
+public:
+ NfKeywordTable() : m_keywords(NF_KEYWORD_ENTRIES_COUNT) {};
+ virtual ~NfKeywordTable() {}
+
+ String & operator[] (Keywords_t::size_type n) { return m_keywords[n]; }
+ const String & operator[] (Keywords_t::size_type n) const { return m_keywords[n]; }
+};
#endif // INCLUDED_SVTOOLS_NFKEYTAB_HXX
diff --git a/svl/prj/build.lst b/svl/prj/build.lst
index f41b1142ae3f..999cdf8947de 100644
--- a/svl/prj/build.lst
+++ b/svl/prj/build.lst
@@ -1,2 +1,2 @@
-sl svl : l10n rsc offuh ucbhelper unotools cppu cppuhelper comphelper sal sot LIBXSLT:libxslt NULL
+sl svl : L10N:l10n rsc offuh ucbhelper unotools cppu cppuhelper comphelper sal sot LIBXSLT:libxslt NULL
sl svl\prj nmake - all svl_prj NULL
diff --git a/svl/qa/complex/passwordcontainer/makefile.mk b/svl/qa/complex/passwordcontainer/makefile.mk
new file mode 100644
index 000000000000..625404682761
--- /dev/null
+++ b/svl/qa/complex/passwordcontainer/makefile.mk
@@ -0,0 +1,134 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
+nothing .PHONY:
+.ELSE
+
+PRJ = ../../..
+PRJNAME = svl
+TARGET = qa_complex_passwordcontainer
+
+.IF "$(OOO_JUNIT_JAR)" != ""
+PACKAGE = complex/passwordcontainer
+
+# here store only Files which contain a @Test
+JAVATESTFILES = \
+ PasswordContainerUnitTest.java
+
+
+# put here all other files
+JAVAFILES = $(JAVATESTFILES) \
+ PasswordContainerTest.java\
+ Test01.java\
+ Test02.java\
+ Test03.java\
+ TestHelper.java\
+ MasterPasswdHandler.java
+
+
+JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar
+EXTRAJARFILES = $(OOO_JUNIT_JAR)
+
+# Sample how to debug
+# JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y
+
+.END
+
+.INCLUDE: settings.mk
+.INCLUDE: target.mk
+.INCLUDE: installationtest.mk
+
+ALLTAR : javatest
+
+.END
+
+
+#
+#
+#
+#
+# PRJ = ..$/..$/..
+# TARGET = PasswordContainerUnitTest
+# PRJNAME=svl
+# PACKAGE = complex$/passwordcontainer
+#
+# # --- Settings -----------------------------------------------------
+# .INCLUDE: settings.mk
+#
+#
+# #----- compile .java files -----------------------------------------
+#
+# JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
+#
+# JAVAFILES =\
+# PasswordContainerUnitTest.java\
+# PasswordContainerTest.java\
+# TestHelper.java\
+# Test01.java\
+# Test02.java\
+# Test03.java\
+# MasterPasswdHandler.java
+#
+# JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+#
+# #----- make a jar from compiled files ------------------------------
+#
+# MAXLINELENGTH = 100000
+#
+# JARCLASSDIRS = $(PACKAGE)
+# JARTARGET = $(TARGET).jar
+# JARCOMPRESS = TRUE
+#
+# # --- Parameters for the test --------------------------------------
+#
+# # start an office if the parameter is set for the makefile
+# .IF "$(OFFICE)" == ""
+# CT_APPEXECCOMMAND =
+# .ELSE
+# CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;"
+# .ENDIF
+#
+# # test base is java complex
+# CT_TESTBASE = -TestBase java_complex
+#
+# # test looks something like the.full.package.TestName
+# CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b)
+#
+# # start the runner application
+# CT_APP = org.openoffice.Runner
+#
+# # --- Targets ------------------------------------------------------
+#
+# .INCLUDE: target.mk
+#
+# RUN: run
+#
+# run:
+# +java -cp $(CLASSPATH) $(CT_APP) $(CT_TESTBASE) $(CT_APPEXECCOMMAND) $(CT_TEST)
+#
+#
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index ebc1fa673fe2..d4d0f8550907 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -939,10 +939,10 @@ void SvNumberFormatter::FillKeywordTable( NfKeywordTable& rKeywords,
LanguageType eLang )
{
ChangeIntl( eLang );
- const String* pTable = pFormatScanner->GetKeywords();
+ const NfKeywordTable & rTable = pFormatScanner->GetKeywords();
for ( sal_uInt16 i = 0; i < NF_KEYWORD_ENTRIES_COUNT; ++i )
{
- rKeywords[i] = pTable[i];
+ rKeywords[i] = rTable[i];
}
}
@@ -950,9 +950,9 @@ void SvNumberFormatter::FillKeywordTable( NfKeywordTable& rKeywords,
String SvNumberFormatter::GetKeyword( LanguageType eLnge, sal_uInt16 nIndex )
{
ChangeIntl(eLnge);
- const String* pTable = pFormatScanner->GetKeywords();
- if ( pTable && nIndex < NF_KEYWORD_ENTRIES_COUNT )
- return pTable[nIndex];
+ const NfKeywordTable & rTable = pFormatScanner->GetKeywords();
+ if ( nIndex < NF_KEYWORD_ENTRIES_COUNT )
+ return rTable[nIndex];
DBG_ERROR("GetKeyword: invalid index");
return String();
@@ -2589,8 +2589,8 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, sal_Bool bLoadi
CLOffset + SetIndexTable( NF_FRACTION_2, ZF_STANDARD_FRACTION+1 ));
// Week of year must be appended here because of nNewExtended
- const String* pKeyword = pFormatScanner->GetKeywords();
- aSingleFormatCode.Code = pKeyword[NF_KEY_WW];
+ const NfKeywordTable & rKeyword = pFormatScanner->GetKeywords();
+ aSingleFormatCode.Code = rKeyword[NF_KEY_WW];
ImpInsertNewStandardFormat( aSingleFormatCode,
CLOffset + SetIndexTable( NF_DATE_WW, nNewExtended++ ),
SV_NUMBERFORMATTER_VERSION_NF_DATE_WW );
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 92398792077d..9b01c2ee91be 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -1149,7 +1149,7 @@ short SvNumberformat::ImpNextSymbol(String& rString,
xub_StrLen nLen = rString.Len();
ScanState eState = SsStart;
sSymbol.Erase();
- const String* pKeywords = rScan.GetKeywords();
+ const NfKeywordTable & rKeywords = rScan.GetKeywords();
while (nPos < nLen && eState != SsStop)
{
cToken = rString.GetChar(nPos);
@@ -1267,9 +1267,9 @@ short SvNumberformat::ImpNextSymbol(String& rString,
BRACKET_SYMBOLTYPE_DBNUM1 - (cDBNum - '1'));
eState = SsGetPrefix;
}
- else if (cUpper == pKeywords[NF_KEY_H].GetChar(0) || // H
- cUpper == pKeywords[NF_KEY_MI].GetChar(0) || // M
- cUpper == pKeywords[NF_KEY_S].GetChar(0) ) // S
+ else if (cUpper == rKeywords[NF_KEY_H].GetChar(0) || // H
+ cUpper == rKeywords[NF_KEY_MI].GetChar(0) || // M
+ cUpper == rKeywords[NF_KEY_S].GetChar(0) ) // S
{
sSymbol += cToken;
eState = SsGetTime;
@@ -1306,9 +1306,9 @@ short SvNumberformat::ImpNextSymbol(String& rString,
else
{
sal_Unicode cUpper = rChrCls().toUpper( rString, nPos-1, 1 ).GetChar(0);
- if (cUpper == pKeywords[NF_KEY_H].GetChar(0) || // H
- cUpper == pKeywords[NF_KEY_MI].GetChar(0) || // M
- cUpper == pKeywords[NF_KEY_S].GetChar(0) ) // S
+ if (cUpper == rKeywords[NF_KEY_H].GetChar(0) || // H
+ cUpper == rKeywords[NF_KEY_MI].GetChar(0) || // M
+ cUpper == rKeywords[NF_KEY_S].GetChar(0) ) // S
{
if (cLetter == cToken)
{
@@ -4230,10 +4230,10 @@ String SvNumberformat::GetMappedFormatstring(
const String& rColorName = NumFor[n].GetColorName();
if ( rColorName.Len() )
{
- const String* pKey = rScan.GetKeywords() + NF_KEY_FIRSTCOLOR;
- for ( int j=NF_KEY_FIRSTCOLOR; j<=NF_KEY_LASTCOLOR; j++, pKey++ )
+ const NfKeywordTable & rKey = rScan.GetKeywords();
+ for ( int j=NF_KEY_FIRSTCOLOR; j<=NF_KEY_LASTCOLOR; j++ )
{
- if ( *pKey == rColorName )
+ if ( rKey[j] == rColorName )
{
aPrefix += '[';
aPrefix += rKeywords[j];
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index 000649a6de80..83dbd512a4e2 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -473,10 +473,10 @@ void ImpSvNumberformatScan::ChangeStandardPrec(sal_uInt16 nPrec)
Color* ImpSvNumberformatScan::GetColor(String& sStr)
{
String sString = pFormatter->GetCharClass()->upper(sStr);
- const String* pKeyword = GetKeywords();
+ const NfKeywordTable & rKeyword = GetKeywords();
size_t i = 0;
while (i < NF_MAX_DEFAULT_COLORS &&
- sString != pKeyword[NF_KEY_FIRSTCOLOR+i] )
+ sString != rKeyword[NF_KEY_FIRSTCOLOR+i] )
i++;
if ( i >= NF_MAX_DEFAULT_COLORS )
{
@@ -492,7 +492,7 @@ Color* ImpSvNumberformatScan::GetColor(String& sStr)
Color* pResult = NULL;
if (i >= NF_MAX_DEFAULT_COLORS)
{
- const String& rColorWord = pKeyword[NF_KEY_COLOR];
+ const String& rColorWord = rKeyword[NF_KEY_COLOR];
xub_StrLen nPos = sString.Match(rColorWord);
if (nPos > 0)
{
@@ -529,7 +529,7 @@ Color* ImpSvNumberformatScan::GetColor(String& sStr)
pFormatter->ChangeIntl(eTmpLnge);
}
else
- sStr = pKeyword[NF_KEY_FIRSTCOLOR+i];
+ sStr = rKeyword[NF_KEY_FIRSTCOLOR+i];
pResult = &(StandardColor[i]);
}
@@ -540,16 +540,16 @@ Color* ImpSvNumberformatScan::GetColor(String& sStr)
short ImpSvNumberformatScan::GetKeyWord( const String& sSymbol, xub_StrLen nPos )
{
String sString = pFormatter->GetCharClass()->toUpper( sSymbol, nPos, sSymbol.Len() - nPos );
- const String* pKeyword = GetKeywords();
+ const NfKeywordTable & rKeyword = GetKeywords();
// #77026# for the Xcl perverts: the GENERAL keyword is recognized anywhere
- if ( sString.Search( pKeyword[NF_KEY_GENERAL] ) == 0 )
+ if ( sString.Search( rKeyword[NF_KEY_GENERAL] ) == 0 )
return NF_KEY_GENERAL;
//! MUST be a reverse search to find longer strings first
short i = NF_KEYWORD_ENTRIES_COUNT-1;
sal_Bool bFound = sal_False;
for ( ; i > NF_KEY_LASTKEYWORD_SO5; --i )
{
- bFound = sString.Search(pKeyword[i]) == 0;
+ bFound = sString.Search(rKeyword[i]) == 0;
if ( bFound )
{
break;
@@ -559,15 +559,15 @@ short ImpSvNumberformatScan::GetKeyWord( const String& sSymbol, xub_StrLen nPos
if ( !bFound )
{ // skip the gap of colors et al between new and old keywords and search on
i = NF_KEY_LASTKEYWORD;
- while ( i > 0 && sString.Search(pKeyword[i]) != 0 )
+ while ( i > 0 && sString.Search(rKeyword[i]) != 0 )
i--;
- if ( i > NF_KEY_LASTOLDKEYWORD && sString != pKeyword[i] )
+ if ( i > NF_KEY_LASTOLDKEYWORD && sString != rKeyword[i] )
{ // found something, but maybe it's something else?
// e.g. new NNN is found in NNNN, for NNNN we must search on
short j = i - 1;
- while ( j > 0 && sString.Search(pKeyword[j]) != 0 )
+ while ( j > 0 && sString.Search(rKeyword[j]) != 0 )
j--;
- if ( j && pKeyword[j].Len() > pKeyword[i].Len() )
+ if ( j && rKeyword[j].Len() > rKeyword[i].Len() )
return j;
}
}
diff --git a/svl/source/numbers/zforscan.hxx b/svl/source/numbers/zforscan.hxx
index 9b04921cb7f4..a1372866a46e 100644
--- a/svl/source/numbers/zforscan.hxx
+++ b/svl/source/numbers/zforscan.hxx
@@ -66,7 +66,7 @@ public:
const LocaleDataWrapper& GetLoc() const { return *pFormatter->GetLocaleData(); }
CalendarWrapper& GetCal() const { return *pFormatter->GetCalendar(); }
- const String* GetKeywords() const
+ const NfKeywordTable & GetKeywords() const
{
if ( bKeywordsNeedInit )
InitKeywords();
diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index af22c04c79ff..fae0250e9002 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -711,7 +711,7 @@ sal_uInt16 SfxUndoManager::GetUndoActionId() const
DBG_ASSERT( m_pData->pActUndoArray->nCurUndoAction > 0, "svl::SfxUndoManager::GetUndoActionId(), illegal id!" );
if ( m_pData->pActUndoArray->nCurUndoAction == 0 )
- return NULL;
+ return 0;
return m_pData->pActUndoArray->aUndoActions[m_pData->pActUndoArray->nCurUndoAction-1].pAction->GetId();
}
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk
index dd668caf5302..39b135f16b1e 100644
--- a/svtools/Library_svt.mk
+++ b/svtools/Library_svt.mk
@@ -250,6 +250,8 @@ $(eval $(call gb_Library_add_exception_objects,svt,\
svtools/source/table/tablecontrol \
svtools/source/table/tablecontrol_impl \
svtools/source/table/tabledatawindow \
+ svtools/source/table/mousefunction \
+ svtools/source/table/cellvalueconversion \
svtools/source/table/tablegeometry \
svtools/source/toolpanel/drawerlayouter \
svtools/source/toolpanel/dummypanel \
@@ -278,6 +280,7 @@ $(eval $(call gb_Library_add_exception_objects,svt,\
svtools/source/uno/toolboxcontroller \
svtools/source/uno/treecontrolpeer \
svtools/source/uno/unocontroltablemodel \
+ svtools/source/uno/unogridcolumnfacade \
svtools/source/uno/unoevent \
svtools/source/uno/unoiface \
svtools/source/uno/unoimap \
diff --git a/svtools/Package_inc.mk b/svtools/Package_inc.mk
index 6cc92a14c823..4162e8f53fea 100644
--- a/svtools/Package_inc.mk
+++ b/svtools/Package_inc.mk
@@ -145,15 +145,15 @@ $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/svxbox.hxx,svtools/svx
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/sychconv.hxx,svtools/sychconv.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/syntaxhighlight.hxx,svtools/syntaxhighlight.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/tabbar.hxx,svtools/tabbar.hxx))
-$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/table/abstracttablecontrol.hxx,svtools/table/abstracttablecontrol.hxx))
+$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/table/tablecontrolinterface.hxx,svtools/table/tablecontrolinterface.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/table/defaultinputhandler.hxx,svtools/table/defaultinputhandler.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/table/gridtablerenderer.hxx,svtools/table/gridtablerenderer.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/table/tablecontrol.hxx,svtools/table/tablecontrol.hxx))
-$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/table/tabledatawindow.hxx,svtools/table/tabledatawindow.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/table/tableinputhandler.hxx,svtools/table/tableinputhandler.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/table/tablemodel.hxx,svtools/table/tablemodel.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/table/tablerenderer.hxx,svtools/table/tablerenderer.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/table/tabletypes.hxx,svtools/table/tabletypes.hxx))
+$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/table/tablesort.hxx,svtools/table/tablesort.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/taskbar.hxx,svtools/taskbar.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/templatefoldercache.hxx,svtools/templatefoldercache.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/templdlg.hxx,svtools/templdlg.hxx))
diff --git a/svtools/inc/svtools/accessiblefactory.hxx b/svtools/inc/svtools/accessiblefactory.hxx
index 9606e93a2fa0..372af4fdca25 100755
--- a/svtools/inc/svtools/accessiblefactory.hxx
+++ b/svtools/inc/svtools/accessiblefactory.hxx
@@ -28,16 +28,12 @@
#ifndef SVTOOLS_ACCESSIBLE_FACTORY_HXX
#define SVTOOLS_ACCESSIBLE_FACTORY_HXX
-#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX
+#include "AccessibleBrowseBoxObjType.hxx"
+#include "accessibletableprovider.hxx"
+
#include <com/sun/star/uno/Reference.hxx>
-#endif
-#ifndef _RTL_REF_HXX
#include <rtl/ref.hxx>
-#endif
-#include "AccessibleBrowseBoxObjType.hxx"
-#include "accessibletableprovider.hxx"
-#include "accessibletable.hxx"
namespace com { namespace sun { namespace star {
namespace accessibility {
@@ -64,6 +60,11 @@ namespace svt
class ToolPanelDeck;
class IToolPanelDeck;
class PanelTabBar;
+ namespace table
+ {
+ class IAccessibleTable;
+ class IAccessibleTableControl;
+ }
/** a function which is able to create a factory for the standard Accessible/Context
components needed for standard toolkit controls
diff --git a/svtools/inc/svtools/accessibletable.hxx b/svtools/inc/svtools/accessibletable.hxx
index 807760ef9b97..d7bd98481404 100644
--- a/svtools/inc/svtools/accessibletable.hxx
+++ b/svtools/inc/svtools/accessibletable.hxx
@@ -109,8 +109,6 @@ public:
virtual long GetRowCount() const= 0;
virtual long GetColumnCount() const= 0;
virtual sal_Bool HasRowHeader() const= 0;
- virtual sal_Int32 GetSelectedRowCount() const= 0;
- virtual bool IsRowSelected( long _nRow ) const= 0;
virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint )= 0;
virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, sal_Bool _bOnScreen = sal_True ) = 0;
virtual Rectangle calcTableRect( sal_Bool _bOnScreen = sal_True ) = 0;
@@ -122,9 +120,13 @@ public:
virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const = 0;
virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const = 0;
virtual ::com::sun::star::uno::Any GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0;
- virtual std::vector<sal_Int32>& GetSelectedRows() = 0;
- virtual void RemoveSelectedRow(sal_Int32 _nRowPos) = 0;
virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0;
+
+ virtual sal_Int32 GetSelectedRowCount() const = 0;
+ virtual sal_Int32 GetSelectedRowIndex( sal_Int32 const i_selectionIndex ) const = 0;
+ virtual bool IsRowSelected( sal_Int32 const i_rowIndex ) const = 0;
+ virtual void SelectRow( sal_Int32 const i_rowIndex, bool const i_select ) = 0;
+ virtual void SelectAllRows( bool const i_select ) = 0;
};
// ----------------------------------------------------------------------------
diff --git a/svtools/inc/svtools/svtools.hrc b/svtools/inc/svtools/svtools.hrc
index b4bf84532b26..554fc63f5c7c 100644
--- a/svtools/inc/svtools/svtools.hrc
+++ b/svtools/inc/svtools/svtools.hrc
@@ -252,6 +252,10 @@
#define STR_SVT_ACC_DESC_FOLDER (STR_SVT_ACC_BEGIN+4)
#define STR_SVT_ACC_DESC_FILE (STR_SVT_ACC_BEGIN+5)
#define STR_SVT_ACC_EMPTY_FIELD (STR_SVT_ACC_BEGIN+6)
+//IAccessible2 implementation
+#define STR_SVT_ACC_LISTENTRY_SELCTED_STATE (STR_SVT_ACC_BEGIN+7)
+#define STR_SVT_ACC_RULER_VERT_NAME (STR_SVT_ACC_BEGIN+8)
+#define STR_SVT_ACC_RULER_HORZ_NAME (STR_SVT_ACC_BEGIN+9)
#define STR_SVT_ACC_END (STR_SVT_ACC_EMPTY_FIELD)
#define STR_SVT_INDEXENTRY_START (STR_SVT_ACC_END + 1)
@@ -390,6 +394,11 @@
#define RID_IMG_PRNDLG_COLLATE_HC (STR_SVT_PRNDLG_START + 31)
#define RID_IMG_PRNDLG_NOCOLLATE_HC (STR_SVT_PRNDLG_START + 32)
+// IAccessible2 implementation in 2009
+#define STR_PARAGRAPH_START (STR_SVT_PRNDLG_START + 50)
+#define STR_PARAGRAPH (STR_PARAGRAPH_START + 0)
+#define STR_PARAGRAPH_END (STR_PARAGRAPH)
+
#endif // #ifndef _SVTOOLS_HRC
// ******************************************************************* EOF
diff --git a/svtools/inc/svtools/table/abstracttablecontrol.hxx b/svtools/inc/svtools/table/abstracttablecontrol.hxx
deleted file mode 100644
index 9206f20ecbcb..000000000000
--- a/svtools/inc/svtools/table/abstracttablecontrol.hxx
+++ /dev/null
@@ -1,134 +0,0 @@
-/*************************************************************************
- * 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.
- *
-************************************************************************/
-
-#ifndef SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_HXX
-#define SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_HXX
-
-#include <sal/types.h>
-#include <vcl/event.hxx>
-#include <vcl/seleng.hxx>
-#include "tabletypes.hxx"
-//........................................................................
-namespace svt { namespace table
-{
-//........................................................................
-
- enum TableControlAction
- {
- /// moves the cursor in the table control one row up, if possible, by keeping the current column
- cursorUp,
- /// moves the cursor in the table control one row down, if possible, by keeping the current column
- cursorDown,
- /// moves the cursor in the table control one column to the left, if possible, by keeping the current row
- cursorLeft,
- /// moves the cursor in the table control one column to the right, if possible, by keeping the current row
- cursorRight,
- /// moves the cursor to the beginning of the current line
- cursorToLineStart,
- /// moves the cursor to the end of the current line
- cursorToLineEnd,
- /// moves the cursor to the first row, keeping the current column
- cursorToFirstLine,
- /// moves the cursor to the last row, keeping the current column
- cursorToLastLine,
- /// moves the cursor one page up, keeping the current column
- cursorPageUp,
- /// moves the cursor one page down, keeping the current column
- cursorPageDown,
- /// moves the cursor to the top-most, left-most cell
- cursorTopLeft,
- /// moves the cursor to the bottom-most, right-most cell
- cursorBottomRight,
- /// selects the row, where the actual cursor is
- cursorSelectRow,
- /// selects the rows, above the actual cursor is
- cursorSelectRowUp,
- /// selects the row, beneath the actual cursor is
- cursorSelectRowDown,
- /// selects the row, from the actual cursor till top
- cursorSelectRowAreaTop,
- /// selects the row, from the actual cursor till bottom
- cursorSelectRowAreaBottom,
-
-
- /// invalid and final enumeration value, not to be actually used
- invalidTableControlAction
- };
-
- //====================================================================
- //= IAbstractTableControl
- //====================================================================
- /** defines a callback interface to be implemented by a concrete table control
- */
- class SAL_NO_VTABLE IAbstractTableControl
- {
- public:
- /** hides the cell cursor
-
- The method cares for successive calls, that is, for every call to
- ->hideCursor(), you need one call to ->showCursor. Only if the number
- of both calls matches, the cursor is really shown.
-
- @see showCursor
- */
- virtual void hideCursor() = 0;
-
- /** shows the cell cursor
-
- @see hideCursor
- */
- virtual void showCursor() = 0;
-
- /** dispatches an action to the table control
-
- @return
- <TRUE/> if the action could be dispatched successfully, <FALSE/> otherwise. Usual
- failure conditions include some other instance vetoing the action, or impossibility
- to execute the action at all (for instance moving up one row when already positioned
- on the very first row).
-
- @see TableControlAction
- */
- virtual bool dispatchAction( TableControlAction _eAction ) = 0;
- /** returns selection engine*/
- virtual SelectionEngine* getSelEngine() = 0;
- virtual void setCursorAtCurrentCell(const Point& rPoint) = 0;
- virtual bool isTooltipActive() = 0;
- virtual rtl::OUString& setTooltip(const Point& rPoint ) = 0;
- virtual RowPos getCurrentRow(const Point& rPoint ) = 0;
- virtual void resizeColumn(const Point& rPoint ) = 0;
- virtual bool startResizeColumn(const Point& rPoint) = 0;
- virtual bool endResizeColumn(const Point& rPoint) = 0;
- virtual bool isRowSelected(RowPos _nRow) = 0;
-
- virtual ~IAbstractTableControl() {};
- };
-
-//........................................................................
-} } // namespace svt::table
-//........................................................................
-
-#endif // SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_HXX
diff --git a/svtools/inc/svtools/table/defaultinputhandler.hxx b/svtools/inc/svtools/table/defaultinputhandler.hxx
index ca760896d539..6990f903cdb2 100644
--- a/svtools/inc/svtools/table/defaultinputhandler.hxx
+++ b/svtools/inc/svtools/table/defaultinputhandler.hxx
@@ -27,43 +27,44 @@
#ifndef SVTOOLS_INC_TABLE_DEFAULTINPUTHANDLER_HXX
#define SVTOOLS_INC_TABLE_DEFAULTINPUTHANDLER_HXX
-#include <svtools/table/tableinputhandler.hxx>
+#include "svtools/table/tableinputhandler.hxx"
+#include "svtools/table/tabletypes.hxx"
-//........................................................................
+#include <boost/scoped_ptr.hpp>
+
+//......................................................................................................................
namespace svt { namespace table
{
-//........................................................................
+//......................................................................................................................
struct DefaultInputHandler_Impl;
- //====================================================================
+ //==================================================================================================================
//= DefaultInputHandler
- //====================================================================
+ //==================================================================================================================
class DefaultInputHandler : public ITableInputHandler
{
- friend class TableDataWindow;
private:
- DefaultInputHandler_Impl* m_pImpl;
- bool m_bResize;
+ ::boost::scoped_ptr< DefaultInputHandler_Impl > m_pImpl;
public:
DefaultInputHandler();
~DefaultInputHandler();
- virtual bool MouseMove ( IAbstractTableControl& _rControl, const MouseEvent& rMEvt );
- virtual bool MouseButtonDown ( IAbstractTableControl& _rControl, const MouseEvent& rMEvt );
- virtual bool MouseButtonUp ( IAbstractTableControl& _rControl, const MouseEvent& rMEvt );
- virtual bool KeyInput ( IAbstractTableControl& _rControl, const KeyEvent& rKEvt );
- virtual bool GetFocus ( IAbstractTableControl& _rControl );
- virtual bool LoseFocus ( IAbstractTableControl& _rControl );
- virtual bool RequestHelp ( IAbstractTableControl& _rControl, const HelpEvent& rHEvt );
- virtual bool Command ( IAbstractTableControl& _rControl, const CommandEvent& rCEvt );
- virtual bool PreNotify ( IAbstractTableControl& _rControl, NotifyEvent& rNEvt );
- virtual bool Notify ( IAbstractTableControl& _rControl, NotifyEvent& rNEvt );
+ virtual bool MouseMove ( ITableControl& _rControl, const MouseEvent& rMEvt );
+ virtual bool MouseButtonDown ( ITableControl& _rControl, const MouseEvent& rMEvt );
+ virtual bool MouseButtonUp ( ITableControl& _rControl, const MouseEvent& rMEvt );
+ virtual bool KeyInput ( ITableControl& _rControl, const KeyEvent& rKEvt );
+ virtual bool GetFocus ( ITableControl& _rControl );
+ virtual bool LoseFocus ( ITableControl& _rControl );
+ virtual bool RequestHelp ( ITableControl& _rControl, const HelpEvent& rHEvt );
+ virtual bool Command ( ITableControl& _rControl, const CommandEvent& rCEvt );
+ virtual bool PreNotify ( ITableControl& _rControl, NotifyEvent& rNEvt );
+ virtual bool Notify ( ITableControl& _rControl, NotifyEvent& rNEvt );
};
-//........................................................................
+//......................................................................................................................
} } // namespace svt::table
-//........................................................................
+//......................................................................................................................
#endif // SVTOOLS_INC_TABLE_DEFAULTINPUTHANDLER_HXX
diff --git a/svtools/inc/svtools/table/gridtablerenderer.hxx b/svtools/inc/svtools/table/gridtablerenderer.hxx
index e474306c0423..c472fa408574 100644
--- a/svtools/inc/svtools/table/gridtablerenderer.hxx
+++ b/svtools/inc/svtools/table/gridtablerenderer.hxx
@@ -29,6 +29,8 @@
#include <svtools/table/tablemodel.hxx>
+#include <boost/scoped_ptr.hpp>
+
//........................................................................
namespace svt { namespace table
{
@@ -43,14 +45,11 @@ namespace svt { namespace table
This class is able to paint a table grid, table headers, and cell
backgrounds according to the selected/active state of cells.
-
- TODO update the documentation when it's decided whether this renderer
- also does value handling
*/
class GridTableRenderer : public ITableRenderer
{
private:
- GridTableRenderer_Impl* m_pImpl;
+ ::boost::scoped_ptr< GridTableRenderer_Impl > m_pImpl;
public:
/** creates a table renderer associated with the given model
@@ -72,9 +71,17 @@ namespace svt { namespace table
This method returns the index of the last row which has been prepared
*/
- RowPos getCurrentRow();
+ RowPos getCurrentRow() const;
+
+ /** determines whether or not to paint grid lines
+ */
+ bool useGridLines() const;
- protected:
+ /** controls whether or not to paint grid lines
+ */
+ void useGridLines( bool const i_use );
+
+ public:
// ITableRenderer overridables
virtual void PaintHeaderArea(
OutputDevice& _rDevice, const Rectangle& _rArea,
@@ -89,17 +96,34 @@ namespace svt { namespace table
virtual void PaintRowHeader(
bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea,
- const StyleSettings& _rStyle, rtl::OUString& _rText );
- virtual void PaintCellImage( ColPos _nColumn,
- bool _bActive, bool _bSelected,
- OutputDevice& _rDevice, const Rectangle& _rArea,
- const StyleSettings& _rStyle, Image* _pCellData );
- virtual void PaintCellString( ColPos _nColumn,
+ const StyleSettings& _rStyle );
+ virtual void PaintCell( ColPos const i_col,
bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea,
- const StyleSettings& _rStyle, rtl::OUString& _rText );
+ const StyleSettings& _rStyle );
virtual void ShowCellCursor( Window& _rView, const Rectangle& _rCursorRect);
virtual void HideCellCursor( Window& _rView, const Rectangle& _rCursorRect);
+ virtual bool FitsIntoCell(
+ ::com::sun::star::uno::Any const & i_cellContent,
+ ColPos const i_colPos, RowPos const i_rowPos,
+ bool const i_active, bool const i_selected,
+ OutputDevice& i_targetDevice, Rectangle const & i_targetArea
+ );
+
+ private:
+ struct CellRenderContext;
+
+ void impl_paintCellContent(
+ CellRenderContext const & i_context
+ );
+ void impl_paintCellImage(
+ CellRenderContext const & i_context,
+ Image const & i_image
+ );
+ void impl_paintCellText(
+ CellRenderContext const & i_context,
+ ::rtl::OUString const & i_text
+ );
};
//........................................................................
} } // namespace svt::table
diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx
index 28ac3583bd5a..8afc2209227c 100644
--- a/svtools/inc/svtools/table/tablecontrol.hxx
+++ b/svtools/inc/svtools/table/tablecontrol.hxx
@@ -28,13 +28,16 @@
#define SVTOOLS_INC_TABLE_TABLECONTROL_HXX
#include "svtools/svtdllapi.h"
-#include <svtools/table/tablemodel.hxx>
+#include "svtools/table/tablemodel.hxx"
+#include "svtools/accessibletable.hxx"
+#include "svtools/accessiblefactory.hxx"
+
#include <vcl/ctrl.hxx>
#include <vcl/seleng.hxx>
-#include <svtools/table/tabledatawindow.hxx>
-#include <svtools/accessibletable.hxx>
-#include <com/sun/star/util/Color.hpp>
-#include <svtools/accessiblefactory.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
+
//........................................................................
namespace svt { namespace table
@@ -42,8 +45,6 @@ namespace svt { namespace table
//........................................................................
class TableControl_Impl;
- class TableDataWindow;
- class AccessibleTableControl_Impl;
//====================================================================
//= TableControl
@@ -63,31 +64,19 @@ namespace svt { namespace table
The control supports the concept of a <em>current</em> (or <em>active</em>
cell).
The control supports accessibility, this is encapsulated in IAccessibleTable
-
- // TODO: scrolling?
*/
class SVT_DLLPUBLIC TableControl : public Control, public IAccessibleTable
{
private:
- DECL_DLLPRIVATE_LINK( ImplMouseButtonDownHdl, MouseEvent* );
- DECL_DLLPRIVATE_LINK( ImplMouseButtonUpHdl, MouseEvent* );
+ ::boost::shared_ptr< TableControl_Impl > m_pImpl;
- DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* );
- TableControl_Impl* m_pImpl;
- ::com::sun::star::uno::Sequence< sal_Int32 > m_nCols;
- ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aText;
- Link m_aSelectHdl;
- bool m_bSelectionChanged;
- bool m_bTooltip;
public:
- ::std::auto_ptr< AccessibleTableControl_Impl > m_pAccessTable;
-
TableControl( Window* _pParent, WinBits _nStyle );
~TableControl();
/// sets a new table model
- SVT_DLLPRIVATE void SetModel( PTableModel _pModel );
+ void SetModel( PTableModel _pModel );
/// retrieves the current table model
PTableModel GetModel() const;
@@ -107,9 +96,8 @@ namespace svt { namespace table
*/
sal_Int32 GetCurrentRow() const;
- /** returns the row, which contains the input point*/
-
- ColPos GetCurrentRow (const Point& rPoint);
+ ITableControl&
+ getTableControlInterface();
/** retrieves the current column
@@ -125,7 +113,7 @@ namespace svt { namespace table
/** activates the cell at the given position
@return
- <TRUE/> if the move was successful, <FALSE/> otherwise. Usual
+ <sal_True/> if the move was successful, <FALSE/> otherwise. Usual
failure conditions include some other instance vetoing the move,
or impossibility to execute the move at all (for instance because
of invalid coordinates).
@@ -135,7 +123,7 @@ namespace svt { namespace table
/** moves the active cell to the given column, by keeping the active row
@return
- <TRUE/> if the move was successful, <FALSE/> otherwise. Usual
+ <sal_True/> if the move was successful, <FALSE/> otherwise. Usual
failure conditions include some other instance vetoing the move,
or impossibility to execute the move at all (for instance because
of invalid coordinates).
@@ -148,7 +136,7 @@ namespace svt { namespace table
/** moves the active cell to the given row, by keeping the active column
@return
- <TRUE/> if the move was successful, <FALSE/> otherwise. Usual
+ <sal_True/> if the move was successful, <FALSE/> otherwise. Usual
failure conditions include some other instance vetoing the move,
or impossibility to execute the move at all (for instance because
of invalid coordinates).
@@ -157,22 +145,17 @@ namespace svt { namespace table
{
return GoTo( GetCurrentColumn(), _nRow );
}
- SVT_DLLPRIVATE virtual void Resize();
- virtual void Select();
- SVT_DLLPRIVATE void SetSelectHdl( const Link& rLink ) { m_aSelectHdl = rLink; }
- const Link& GetSelectHdl() const { return m_aSelectHdl; }
- /**invalidates the table if table has been changed e.g. new row added
- */
- void InvalidateDataWindow(RowPos _nRowStart, RowPos _nRowEnd, bool _bRemoved);
- /**gets the vector, which contains the selected rows
- */
- std::vector<sal_Int32>& GetSelectedRows();
- /**after removing a row, updates the vector which contains the selected rows
- if the row, which should be removed, is selected, it will be erased from the vector
- */
- SelectionEngine* getSelEngine();
- TableDataWindow* getDataWindow();
+ SVT_DLLPRIVATE virtual void Resize();
+ virtual void Select();
+ void SetSelectHdl( const Link& rLink );
+ const Link& GetSelectHdl() const;
+
+ /**after removing a row, updates the vector which contains the selected rows
+ if the row, which should be removed, is selected, it will be erased from the vector
+ */
+ SelectionEngine* getSelEngine();
+ Window& getDataWindow();
// Window overridables
virtual void GetFocus();
@@ -180,55 +163,55 @@ namespace svt { namespace table
virtual void KeyInput( const KeyEvent& rKEvt );
virtual void StateChanged( StateChangedType i_nStateChange );
- /** Creates and returns the accessible object of the whole GridControl. */
- SVT_DLLPRIVATE virtual XACC CreateAccessible();
- SVT_DLLPRIVATE virtual XACC CreateAccessibleControl( sal_Int32 _nIndex );
- SVT_DLLPRIVATE virtual ::rtl::OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const;
- SVT_DLLPRIVATE virtual sal_Bool GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow );
- SVT_DLLPRIVATE virtual ::rtl::OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const;
- virtual void FillAccessibleStateSet(
- ::utl::AccessibleStateSetHelper& rStateSet,
- AccessibleTableControlObjType eObjType ) const;
- //// Window
- virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const;
- virtual void GrabFocus();
- virtual XACC GetAccessible( sal_Bool bCreate = sal_True );
- virtual Window* GetAccessibleParentWindow() const;
- virtual Window* GetWindowInstance();
- virtual sal_Int32 GetAccessibleControlCount() const;
- virtual sal_Bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint );
- virtual long GetRowCount() const;
- virtual long GetColumnCount() const;
- virtual sal_Bool HasRowHeader() const;
- virtual sal_Int32 GetSelectedRowCount() const;
- virtual bool IsRowSelected( long _nRow ) const;
- virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint );
- virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, sal_Bool _bOnScreen = sal_True );
- virtual Rectangle calcTableRect( sal_Bool _bOnScreen = sal_True );
- virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex);
- virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint);
- virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const;
- virtual ::rtl::OUString GetRowDescription( sal_Int32 _nRow ) const;
- virtual ::rtl::OUString GetRowName(sal_Int32 _nIndex) const;
- virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const;
- virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const;
- virtual ::com::sun::star::uno::Any GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const;
- virtual sal_Bool HasRowHeader();
- virtual sal_Bool HasColHeader();
- virtual sal_Bool isAccessibleAlive( ) const;
- virtual void commitGridControlEvent( sal_Int16 _nEventId, const com::sun::star::uno::Any& _rNewValue, const com::sun::star::uno::Any& _rOldValue );
- virtual void RemoveSelectedRow(RowPos _nRowPos);
- virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const;
- ::com::sun::star::uno::Sequence< sal_Int32 >& getColumnsForTooltip();
- ::com::sun::star::uno::Sequence< ::rtl::OUString >& getTextForTooltip();
- void setTooltip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aText, const ::com::sun::star::uno::Sequence< sal_Int32 >& nCols);
- void clearSelection();
- void selectionChanged(bool _bChanged);
- bool isTooltip();
-
- protected:
- /// retrieves the XAccessible implementation associated with the GridControl instance
- ::svt::IAccessibleFactory& getAccessibleFactory();
+ /** Creates and returns the accessible object of the whole GridControl. */
+ SVT_DLLPRIVATE virtual XACC CreateAccessible();
+ SVT_DLLPRIVATE virtual XACC CreateAccessibleControl( sal_Int32 _nIndex );
+ SVT_DLLPRIVATE virtual ::rtl::OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const;
+ SVT_DLLPRIVATE virtual sal_Bool GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow );
+ SVT_DLLPRIVATE virtual ::rtl::OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const;
+ virtual void FillAccessibleStateSet(
+ ::utl::AccessibleStateSetHelper& rStateSet,
+ AccessibleTableControlObjType eObjType ) const;
+
+ // .............................................................................................................
+ // IAccessibleTable
+ virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const;
+ virtual void GrabFocus();
+ virtual XACC GetAccessible( sal_Bool bCreate = sal_True );
+ virtual Window* GetAccessibleParentWindow() const;
+ virtual Window* GetWindowInstance();
+ virtual sal_Int32 GetAccessibleControlCount() const;
+ virtual sal_Bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint );
+ virtual long GetRowCount() const;
+ virtual long GetColumnCount() const;
+ virtual sal_Bool HasRowHeader() const;
+ virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint );
+ virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, sal_Bool _bOnScreen = sal_True );
+ virtual Rectangle calcTableRect( sal_Bool _bOnScreen = sal_True );
+ virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex);
+ virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint);
+ virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const;
+ virtual ::rtl::OUString GetRowDescription( sal_Int32 _nRow ) const;
+ virtual ::rtl::OUString GetRowName(sal_Int32 _nIndex) const;
+ virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const;
+ virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const;
+ virtual ::com::sun::star::uno::Any GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const;
+ virtual sal_Bool HasRowHeader();
+ virtual sal_Bool HasColHeader();
+ virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const;
+
+ virtual sal_Int32 GetSelectedRowCount() const;
+ virtual sal_Int32 GetSelectedRowIndex( sal_Int32 const i_selectionIndex ) const;
+ virtual bool IsRowSelected( sal_Int32 const i_rowIndex ) const;
+ virtual void SelectRow( sal_Int32 const i_rowIndex, bool const i_select );
+ virtual void SelectAllRows( bool const i_select );
+ // .............................................................................................................
+
+ private:
+ DECL_DLLPRIVATE_LINK( ImplMouseButtonDownHdl, MouseEvent* );
+ DECL_DLLPRIVATE_LINK( ImplMouseButtonUpHdl, MouseEvent* );
+
+ DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* );
private:
TableControl(); // never implemented
diff --git a/svtools/inc/svtools/table/tablecontrolinterface.hxx b/svtools/inc/svtools/table/tablecontrolinterface.hxx
new file mode 100644
index 000000000000..74e9688d01db
--- /dev/null
+++ b/svtools/inc/svtools/table/tablecontrolinterface.hxx
@@ -0,0 +1,254 @@
+/*************************************************************************
+ * 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.
+ *
+************************************************************************/
+
+#ifndef SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_HXX
+#define SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_HXX
+
+#include <sal/types.h>
+#include <vcl/event.hxx>
+#include <vcl/seleng.hxx>
+
+#include "svtools/table/tabletypes.hxx"
+#include "svtools/table/tablemodel.hxx"
+
+class Pointer;
+
+//......................................................................................................................
+namespace svt { namespace table
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= TableControlAction
+ //==================================================================================================================
+ enum TableControlAction
+ {
+ /// moves the cursor in the table control one row up, if possible, by keeping the current column
+ cursorUp,
+ /// moves the cursor in the table control one row down, if possible, by keeping the current column
+ cursorDown,
+ /// moves the cursor in the table control one column to the left, if possible, by keeping the current row
+ cursorLeft,
+ /// moves the cursor in the table control one column to the right, if possible, by keeping the current row
+ cursorRight,
+ /// moves the cursor to the beginning of the current line
+ cursorToLineStart,
+ /// moves the cursor to the end of the current line
+ cursorToLineEnd,
+ /// moves the cursor to the first row, keeping the current column
+ cursorToFirstLine,
+ /// moves the cursor to the last row, keeping the current column
+ cursorToLastLine,
+ /// moves the cursor one page up, keeping the current column
+ cursorPageUp,
+ /// moves the cursor one page down, keeping the current column
+ cursorPageDown,
+ /// moves the cursor to the top-most, left-most cell
+ cursorTopLeft,
+ /// moves the cursor to the bottom-most, right-most cell
+ cursorBottomRight,
+ /// selects the row, where the actual cursor is
+ cursorSelectRow,
+ /// selects the rows, above the actual cursor is
+ cursorSelectRowUp,
+ /// selects the row, beneath the actual cursor is
+ cursorSelectRowDown,
+ /// selects the row, from the actual cursor till top
+ cursorSelectRowAreaTop,
+ /// selects the row, from the actual cursor till bottom
+ cursorSelectRowAreaBottom,
+
+ /// invalid and final enumeration value, not to be actually used
+ invalidTableControlAction
+ };
+
+ //==================================================================================================================
+ //= TableCellArea
+ //==================================================================================================================
+ enum TableCellArea
+ {
+ CellContent,
+ ColumnDivider
+ };
+
+ //==================================================================================================================
+ //= TableCell
+ //==================================================================================================================
+ struct TableCell
+ {
+ ColPos nColumn;
+ RowPos nRow;
+ TableCellArea eArea;
+
+ TableCell()
+ :nColumn( COL_INVALID )
+ ,nRow( ROW_INVALID )
+ ,eArea( CellContent )
+ {
+ }
+
+ TableCell( ColPos const i_column, RowPos const i_row )
+ :nColumn( i_column )
+ ,nRow( i_row )
+ ,eArea( CellContent )
+ {
+ }
+ };
+
+ //==================================================================================================================
+ //= ColumnMetrics
+ //==================================================================================================================
+ struct ColumnMetrics
+ {
+ /** the start of the column, in pixels. Might be negative, in case the column is scrolled out of the visible
+ area.
+ */
+ long nStartPixel;
+
+ /** the end of the column, in pixels, plus 1. Effectively, this is the accumulated width of a all columns
+ up to the current one.
+ */
+ long nEndPixel;
+
+ ColumnMetrics()
+ :nStartPixel(0)
+ ,nEndPixel(0)
+ {
+ }
+
+ ColumnMetrics( long const i_start, long const i_end )
+ :nStartPixel( i_start )
+ ,nEndPixel( i_end )
+ {
+ }
+ };
+
+ //==================================================================================================================
+ //= TableArea
+ //==================================================================================================================
+ enum TableArea
+ {
+ TableAreaColumnHeaders,
+ TableAreaRowHeaders,
+ TableAreaDataArea,
+ TableAreaAll
+ };
+
+ //==================================================================================================================
+ //= ITableControl
+ //==================================================================================================================
+ /** defines a callback interface to be implemented by a concrete table control
+ */
+ class SAL_NO_VTABLE ITableControl
+ {
+ public:
+ /** hides the cell cursor
+
+ The method cares for successive calls, that is, for every call to
+ ->hideCursor(), you need one call to ->showCursor. Only if the number
+ of both calls matches, the cursor is really shown.
+
+ @see showCursor
+ */
+ virtual void hideCursor() = 0;
+
+ /** shows the cell cursor
+
+ @see hideCursor
+ */
+ virtual void showCursor() = 0;
+
+ /** dispatches an action to the table control
+
+ @return
+ <TRUE/> if the action could be dispatched successfully, <FALSE/> otherwise. Usual
+ failure conditions include some other instance vetoing the action, or impossibility
+ to execute the action at all (for instance moving up one row when already positioned
+ on the very first row).
+
+ @see TableControlAction
+ */
+ virtual bool dispatchAction( TableControlAction _eAction ) = 0;
+
+ /** returns selection engine*/
+ virtual SelectionEngine* getSelEngine() = 0;
+
+ /** returns the table model
+
+ The returned model is guaranteed to not be <NULL/>.
+ */
+ virtual PTableModel getModel() const = 0;
+
+ /// returns the index of the currently active column
+ virtual ColPos getCurrentColumn() const = 0;
+
+ /// returns the index of the currently active row
+ virtual RowPos getCurrentRow() const = 0;
+
+ /// activates the given cell
+ virtual bool activateCell( ColPos const i_col, RowPos const i_row ) = 0;
+
+ /// retrieves the size of the table window, in pixels
+ virtual ::Size getTableSizePixel() const = 0;
+
+ /// sets a new mouse pointer for the table window
+ virtual void setPointer( Pointer const & i_pointer ) = 0;
+
+ /// captures the mouse to the table window
+ virtual void captureMouse() = 0;
+
+ /// releases the mouse, after it had previously been captured
+ virtual void releaseMouse() = 0;
+
+ /// invalidates the table window
+ virtual void invalidate( TableArea const i_what ) = 0;
+
+ /// calculates a width, given in pixels, into a AppFont-based width
+ virtual long pixelWidthToAppFont( long const i_pixels ) const = 0;
+
+ /// shows a trackign rectangle
+ virtual void showTracking( Rectangle const & i_location, sal_uInt16 const i_flags ) = 0;
+
+ /// hides a prviously shown tracking rectangle
+ virtual void hideTracking() = 0;
+
+ /// does a hit test for the given pixel coordinates
+ virtual TableCell hitTest( const Point& rPoint ) const = 0;
+
+ /// retrieves the metrics for a given column
+ virtual ColumnMetrics getColumnMetrics( ColPos const i_column ) const = 0;
+
+ /// determines whether a given row is selected
+ virtual bool isRowSelected( RowPos _nRow ) const = 0;
+
+ virtual ~ITableControl() {};
+ };
+
+//......................................................................................................................
+} } // namespace svt::table
+//......................................................................................................................
+
+#endif // SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_HXX
diff --git a/svtools/inc/svtools/table/tableinputhandler.hxx b/svtools/inc/svtools/table/tableinputhandler.hxx
index 6d6af9f641bb..87803f03e240 100644
--- a/svtools/inc/svtools/table/tableinputhandler.hxx
+++ b/svtools/inc/svtools/table/tableinputhandler.hxx
@@ -40,7 +40,7 @@ namespace svt { namespace table
{
//........................................................................
- class IAbstractTableControl;
+ class ITableControl;
//====================================================================
//= ITableInputHandler
@@ -56,16 +56,16 @@ namespace svt { namespace table
// or whether it has been sufficiently handled by the ->ITableInputHandler instance
// (<FALSE/>).
- virtual bool MouseMove ( IAbstractTableControl& _rControl, const MouseEvent& rMEvt ) = 0;
- virtual bool MouseButtonDown ( IAbstractTableControl& _rControl, const MouseEvent& rMEvt ) = 0;
- virtual bool MouseButtonUp ( IAbstractTableControl& _rControl, const MouseEvent& rMEvt ) = 0;
- virtual bool KeyInput ( IAbstractTableControl& _rControl, const KeyEvent& rKEvt ) = 0;
- virtual bool GetFocus ( IAbstractTableControl& _rControl ) = 0;
- virtual bool LoseFocus ( IAbstractTableControl& _rControl ) = 0;
- virtual bool RequestHelp ( IAbstractTableControl& _rControl, const HelpEvent& rHEvt ) = 0;
- virtual bool Command ( IAbstractTableControl& _rControl, const CommandEvent& rCEvt ) = 0;
- virtual bool PreNotify ( IAbstractTableControl& _rControl, NotifyEvent& rNEvt ) = 0;
- virtual bool Notify ( IAbstractTableControl& _rControl, NotifyEvent& rNEvt ) = 0;
+ virtual bool MouseMove ( ITableControl& _rControl, const MouseEvent& rMEvt ) = 0;
+ virtual bool MouseButtonDown ( ITableControl& _rControl, const MouseEvent& rMEvt ) = 0;
+ virtual bool MouseButtonUp ( ITableControl& _rControl, const MouseEvent& rMEvt ) = 0;
+ virtual bool KeyInput ( ITableControl& _rControl, const KeyEvent& rKEvt ) = 0;
+ virtual bool GetFocus ( ITableControl& _rControl ) = 0;
+ virtual bool LoseFocus ( ITableControl& _rControl ) = 0;
+ virtual bool RequestHelp ( ITableControl& _rControl, const HelpEvent& rHEvt ) = 0;
+ virtual bool Command ( ITableControl& _rControl, const CommandEvent& rCEvt ) = 0;
+ virtual bool PreNotify ( ITableControl& _rControl, NotifyEvent& rNEvt ) = 0;
+ virtual bool Notify ( ITableControl& _rControl, NotifyEvent& rNEvt ) = 0;
virtual ~ITableInputHandler() { }
};
diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx
index 3da396d9d86c..94f03b684e64 100644..100755
--- a/svtools/inc/svtools/table/tablemodel.hxx
+++ b/svtools/inc/svtools/table/tablemodel.hxx
@@ -28,16 +28,22 @@
#define SVTOOLS_INC_TABLE_TABLEMODEL_HXX
#include "svtools/svtdllapi.h"
-#include <svtools/table/tabletypes.hxx>
-#include <svtools/table/tablerenderer.hxx>
-#include <svtools/table/tableinputhandler.hxx>
-#include <rtl/ref.hxx>
-#include <sal/types.h>
+#include "svtools/table/tabletypes.hxx"
+#include "svtools/table/tablerenderer.hxx"
+#include "svtools/table/tableinputhandler.hxx"
+#include "svtools/table/tablesort.hxx"
+
#include <com/sun/star/util/Color.hpp>
-#include <boost/shared_ptr.hpp>
#include <com/sun/star/style/VerticalAlignment.hpp>
#include <com/sun/star/style/HorizontalAlignment.hpp>
+#include <rtl/ref.hxx>
+#include <sal/types.h>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/optional.hpp>
+#include <boost/enable_shared_from_this.hpp>
+
//........................................................................
namespace svt { namespace table
{
@@ -45,19 +51,6 @@ namespace svt { namespace table
//====================================================================
- //= cell data
- //====================================================================
- struct TableContentType
- {
- ::rtl::OUString sContent;
- Image* pImage;
- TableContentType() :
- sContent(),
- pImage( )
- {
- }
- };
- //====================================================================
//= ScrollbarVisibility
//====================================================================
enum ScrollbarVisibility
@@ -78,13 +71,24 @@ namespace svt { namespace table
//====================================================================
//= ITableModelListener
//====================================================================
+ typedef sal_Int32 ColumnAttributeGroup;
+ #define COL_ATTRS_NONE (0x00000000)
+ /// denotes column attributes related to the width of the column
+ #define COL_ATTRS_WIDTH (0x00000001)
+ /// denotes column attributes related to the appearance of the column, i.e. those relevant for rendering
+ #define COL_ATTRS_APPEARANCE (0x00000002)
+ /// denotes the entirety of column attributes
+ #define COL_ATTRS_ALL (0x7FFFFFFF)
+
+ //====================================================================
+ //= ITableModelListener
+ //====================================================================
/** declares an interface to be implemented by components interested in
changes in an ->ITableModel
*/
- class SAL_NO_VTABLE ITableModelListener
+ class SAL_NO_VTABLE ITableModelListener : public ::boost::enable_shared_from_this< ITableModelListener >
{
public:
- //virtual void onTableModelChanged(PTableModel pTableModel) = 0;
/** notifies the listener that one or more rows have been inserted into
the table
@@ -100,7 +104,8 @@ namespace svt { namespace table
the table
@param first
- the old index of the first removed row
+ the old index of the first removed row. If this is <code>-1</code>, then all
+ rows have been removed from the model.
@param last
the old index of the last removed row. Must not be smaller
than ->first
@@ -116,27 +121,19 @@ namespace svt { namespace table
the index of the last newly inserted row. Must not be smaller
than ->first
*/
- virtual void columnsInserted( ColPos first, ColPos last ) = 0;
+ virtual void columnInserted( ColPos const i_colIndex ) = 0;
/** notifies the listener that one or more columns have been removed from
the table
- @param first
- the old index of the first removed row
- @param last
- the old index of the last removed row. Must not be smaller
- than ->first
+ @param i_colIndex
+ the old index of the removed column
*/
- virtual void columnsRemoved( ColPos first, ColPos last ) = 0;
-
- /** notifies the listener that a column in the table has moved
+ virtual void columnRemoved( ColPos const i_colIndex ) = 0;
- @param oldIndex
- the old index of the column within the model
- @param newIndex
- the new index of the column within the model
+ /** notifies the listener that all columns have been removed form the model
*/
- virtual void columnMoved( ColPos oldIndex, ColPos newIndex ) = 0;
+ virtual void allColumnsRemoved() = 0;
/** notifies the listener that a rectangular cell range in the table
has been updated
@@ -145,7 +142,24 @@ namespace svt { namespace table
they have about the cells in question, in particular any possibly
cached cell values.
*/
- virtual void cellsUpdated( ColPos firstCol, ColPos lastCol, RowPos firstRow, RowPos lastRow ) = 0;
+ virtual void cellsUpdated( ColPos const i_firstCol, ColPos i_lastCol, RowPos const i_firstRow, RowPos const i_lastRow ) = 0;
+
+ /** notifies the listener that attributes of a given column changed
+
+ @param i_column
+ the position of the column whose attributes changed
+ @param i_attributeGroup
+ a combination of one or more <code>COL_ATTRS_*</code> flags, denoting the attribute group(s)
+ in which changes occurred.
+ */
+ virtual void columnChanged( ColPos const i_column, ColumnAttributeGroup const i_attributeGroup ) = 0;
+
+ /** notifies the listener that the metrics of the table changed.
+
+ Metrics here include the column header height, the row header width, the row height, and the presence
+ of both the row and column header.
+ */
+ virtual void tableMetricsChanged() = 0;
/// deletes the listener instance
virtual ~ITableModelListener(){};
@@ -172,7 +186,8 @@ namespace svt { namespace table
@see setID
*/
- virtual ColumnID getID() const = 0;
+ virtual ::com::sun::star::uno::Any
+ getID() const = 0;
/** sets a new column ID
@@ -183,7 +198,7 @@ namespace svt { namespace table
@see getID
*/
- virtual bool setID( const ColumnID _nID ) = 0;
+ virtual void setID( const ::com::sun::star::uno::Any& _nID ) = 0;
/** returns the name of the column
@@ -200,7 +215,15 @@ namespace svt { namespace table
*/
virtual void setName( const String& _rName ) = 0;
- /** determines whether the column can be resized
+ /** retrieves the help text to be displayed for the column.
+ */
+ virtual String getHelpText() const = 0;
+
+ /** sets a new the help text to be displayed for the column.
+ */
+ virtual void setHelpText( const String& i_helpText ) = 0;
+
+ /** determines whether the column can be interactively resized
@see getMinWidth
@see getMaxWidth
@@ -216,40 +239,41 @@ namespace svt { namespace table
*/
virtual void setResizable( bool _bResizable ) = 0;
- /** returns the width of the column, in 1/100 millimeters
+ /** denotes the relative flexibility of the column
- The returned value must be a positive ->TableMetrics value.
+ This flexibility is taken into account when a table control auto-resizes its columns, because the available
+ space changed. In this case, the columns grow or shrink according to their flexibility.
- It can also be COLWIDTH_FIT_TO_VIEW, to indicate that the width of the column
- should automatically be adjusted to completely fit the view. For instance, a
- model's last column could return this value, to indicate that it is to occupy
- all horizontal space remaining in the view, after all other columns have been
- layouted.
+ A value of 0 means the column is not auto-resized at all.
+ */
+ virtual sal_Int32 getFlexibility() const = 0;
- If there is more than one column with width COLWIDTH_FIT_TO_VIEW in a model,
- they're all layouted equal-width.
+ /** sets a new flexibility value for the column
- If the columns with a read width (i.e. other than COLWIDTH_FIT_TO_VIEW) are,
- in sum, wider than the view, then the view is free to choose a real width for any
- columns which return COLWIDTH_FIT_TO_VIEW here.
+ @see getFlexibility
+ */
+ virtual void setFlexibility( sal_Int32 const i_flexibility ) = 0;
+
+ /** returns the width of the column, in app-font unitss
+
+ The returned value must be a positive ->TableMetrics value.
@see setWidth
@see getMinWidth
@see getMaxWidth
- @see COLWIDTH_FIT_TO_VIEW
*/
virtual TableMetrics getWidth() const = 0;
/** sets a new width for the column
@param _nWidth
- the new width, in 1/100 millimeters
+ the new width, app-font units
@see getWidth
*/
virtual void setWidth( TableMetrics _nWidth ) = 0;
- /** returns the minimum width of the column, in 1/100 millimeters, or 0 if the column
+ /** returns the minimum width of the column, in app-font units, or 0 if the column
does not have a minimal width
@see setMinWidth
@@ -258,7 +282,7 @@ namespace svt { namespace table
*/
virtual TableMetrics getMinWidth() const = 0;
- /** sets the minimum width of the column, in 1/100 millimeters
+ /** sets the minimum width of the column, in app-font units
@see getMinWidth
@see setMaxWidth
@@ -266,7 +290,7 @@ namespace svt { namespace table
*/
virtual void setMinWidth( TableMetrics _nMinWidth ) = 0;
- /** returns the maximum width of the column, in 1/100 millimeters, or 0 if the column
+ /** returns the maximum width of the column, in app-font units, or 0 if the column
does not have a minimal width
@see setMaxWidth
@@ -275,7 +299,7 @@ namespace svt { namespace table
*/
virtual TableMetrics getMaxWidth() const = 0;
- /** sets the maximum width of the column, in 1/100 millimeters
+ /** sets the maximum width of the column, in app-font units
@see getMaxWidth
@see setMinWidth
@@ -283,24 +307,14 @@ namespace svt { namespace table
*/
virtual void setMaxWidth( TableMetrics _nMaxWidth ) = 0;
- /** returns the preferred width of the column, or 0 if the column
- does not have a preferred width.
-
- @see setMaxWidth
- @see getMinWidth
- @see getWidth
+ /** retrieves the horizontal alignment to be used for content in this cell
*/
- virtual TableMetrics getPreferredWidth() const = 0;
- /** sets the preferred width of the column, to be used when user resizes column
+ virtual ::com::sun::star::style::HorizontalAlignment getHorizontalAlign() = 0;
- @see getMaxWidth
- @see setMinWidth
- @see setWidth
+ /** sets a new the horizontal alignment to be used for content in this cell
*/
- virtual void setPreferredWidth( TableMetrics _nPrefWidth ) = 0;
-
- virtual ::com::sun::star::style::HorizontalAlignment getHorizontalAlign() = 0;
virtual void setHorizontalAlign(::com::sun::star::style::HorizontalAlignment _xAlign) = 0;
+
/// deletes the column model instance
virtual ~IColumnModel() { }
};
@@ -322,9 +336,6 @@ namespace svt { namespace table
*/
virtual TableSize getRowCount() const = 0;
- SVT_DLLPRIVATE virtual void setColumnCount(TableSize _nColCount) = 0;
- SVT_DLLPRIVATE virtual void setRowCount(TableSize _nRowCount) = 0;
-
/** determines whether the table has column headers
If this method returns <TRUE/>, the renderer returned by
@@ -333,15 +344,6 @@ namespace svt { namespace table
@see IColumnRenderer
*/
virtual bool hasColumnHeaders() const = 0;
- /** sets whether the table should have row headers
- @see IColumnRenderer
- */
- SVT_DLLPRIVATE virtual void setRowHeaders( bool rowHeaders) = 0;
-
- /** sets whether the table should have column headers
- @see IColumnRenderer
- */
- SVT_DLLPRIVATE virtual void setColumnHeaders( bool columnHeaders) = 0;
/** determines whether the table has row headers
@@ -359,14 +361,6 @@ namespace svt { namespace table
*/
virtual bool isCellEditable( ColPos col, RowPos row ) const = 0;
- /** adds the given listener to the list of ->ITableModelListener's
- */
- SVT_DLLPRIVATE virtual void addTableModelListener( const PTableModelListener& listener ) = 0;
-
- /** revokes the given listener from the list of ->ITableModelListener's
- */
- SVT_DLLPRIVATE virtual void removeTableModelListener( const PTableModelListener& listener ) = 0;
-
/** returns a model for a certain column
@param column
@@ -375,27 +369,15 @@ namespace svt { namespace table
@return
the model of the column in question. Must not be <NULL/>
-
- @see getColumnModelByID
*/
virtual PColumnModel getColumnModel( ColPos column ) = 0;
- /** finds a column model by ID
-
- @param id
- the id of the column which is to be looked up
- @return
- the column model with the given ID, or <NULL/> if there is
- no such column
- */
- virtual PColumnModel getColumnModelByID( ColumnID id ) = 0;
-
/** returns a renderer which is able to paint the table represented
by this table model
@return the renderer to use. Must not be <NULL/>
*/
- SVT_DLLPRIVATE virtual PTableRenderer getRenderer() const = 0;
+ virtual PTableRenderer getRenderer() const = 0;
/** returns the component handling input in a view associated with the model
*/
@@ -404,12 +386,10 @@ namespace svt { namespace table
/** determines the height of rows in the table.
@return
- the logical height of rows in the table, in 1/100 millimeters. The height must be
+ the logical height of rows in the table, in app-font units. The height must be
greater 0.
*/
- SVT_DLLPRIVATE virtual TableMetrics getRowHeight() const = 0;
-
- SVT_DLLPRIVATE virtual void setRowHeight(TableMetrics _nRowHeight) = 0;
+ virtual TableMetrics getRowHeight() const = 0;
/** determines the height of the column header row
@@ -417,10 +397,10 @@ namespace svt { namespace table
returned <FALSE/>.
@return
- the logical height of the column header row, in 1/100 millimeters.
+ the logical height of the column header row, in app-font units.
Must be greater than 0.
*/
- SVT_DLLPRIVATE virtual TableMetrics getColumnHeaderHeight() const = 0;
+ virtual TableMetrics getColumnHeaderHeight() const = 0;
/** determines the width of the row header column
@@ -428,48 +408,105 @@ namespace svt { namespace table
returned <FALSE/>.
@return
- the logical width of the row header column, in 1/100 millimeters.
+ the logical width of the row header column, in app-font units.
Must be greater than 0.
*/
- SVT_DLLPRIVATE virtual TableMetrics getRowHeaderWidth() const = 0;
+ virtual TableMetrics getRowHeaderWidth() const = 0;
- /** determines the visibility of the vertical scrollbar of the table control
- @param overAllHeight the height of the table with all rows
- @param actHeight the given height of the table
+ /** returns the visibilit mode of the vertical scrollbar
*/
- virtual ScrollbarVisibility getVerticalScrollbarVisibility(int overAllHeight,int actHeight) const = 0;
+ virtual ScrollbarVisibility getVerticalScrollbarVisibility() const = 0;
- /** determines the visibility of the horizontal scrollbar of the table control
- @param overAllWidth the width of the table with all columns
- @param actWidth the given width of the table
+ /** returns the visibilit mode of the horizontal scrollbar
*/
- virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const = 0;
- virtual bool hasVerticalScrollbar() =0;
- virtual bool hasHorizontalScrollbar() = 0;
- /** fills cells with content
- */
- virtual void setCellContent(const std::vector< std::vector< ::com::sun::star::uno::Any > >& cellContent)=0;
- /** gets the content of the cells
- */
- virtual std::vector< std::vector< ::com::sun::star::uno::Any > >& getCellContent() = 0;
- /**sets title of header rows
- */
- SVT_DLLPRIVATE virtual void setRowHeaderName(const std::vector<rtl::OUString>& cellColumnContent)=0;
- /** gets title of header rows
- */
- virtual std::vector<rtl::OUString>& getRowHeaderName() = 0;
- SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getLineColor() = 0;
- SVT_DLLPRIVATE virtual void setLineColor(::com::sun::star::util::Color _rColor) = 0;
- SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getHeaderBackgroundColor() = 0;
- SVT_DLLPRIVATE virtual void setHeaderBackgroundColor(::com::sun::star::util::Color _rColor) = 0;
- SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getTextColor() = 0;
- SVT_DLLPRIVATE virtual void setTextColor(::com::sun::star::util::Color _rColor) = 0;
- SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getOddRowBackgroundColor() = 0;
- SVT_DLLPRIVATE virtual void setOddRowBackgroundColor(::com::sun::star::util::Color _rColor) = 0;
- SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getEvenRowBackgroundColor() = 0;
- SVT_DLLPRIVATE virtual void setEvenRowBackgroundColor(::com::sun::star::util::Color _rColor) = 0;
- SVT_DLLPRIVATE virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign() = 0;
- SVT_DLLPRIVATE virtual void setVerticalAlign(::com::sun::star::style::VerticalAlignment _xAlign) = 0;
+ virtual ScrollbarVisibility getHorizontalScrollbarVisibility() const = 0;
+
+ /** adds a listener to be notified of changes in the table model
+ */
+ virtual void addTableModelListener( const PTableModelListener& i_listener ) = 0;
+
+ /** remove a listener to be notified of changes in the table model
+ */
+ virtual void removeTableModelListener( const PTableModelListener& i_listener ) = 0;
+
+ /** retrieves the content of the given cell
+ */
+ virtual void getCellContent( ColPos const i_col, RowPos const i_row, ::com::sun::star::uno::Any& o_cellContent ) = 0;
+
+ /** returns an object which should be displayed as tooltip for the given cell
+
+ At the moment, only string-convertible values are supported here. In the future, one might imagine displaying
+ scaled-down versions of a graphic in a cell, and a larger version of that very graphic as tooltip.
+
+ If no tooltip object is provided, then the cell content is used, and displayed as tooltip for the cell
+ if and only if it doesn't fit into the cell's space itself.
+
+ @param i_col
+ The column index of the cell in question. COL_ROW_HEADERS is a valid argument here.
+ @param i_row
+ The row index of the cell in question.
+ @param o_cellToolTip
+ takes the tooltip object upon return.
+ */
+ virtual void getCellToolTip( ColPos const i_col, RowPos const i_row, ::com::sun::star::uno::Any & o_cellToolTip ) = 0;
+
+ /** retrieves title of a given row
+ */
+ virtual ::com::sun::star::uno::Any getRowHeading( RowPos const i_rowPos ) const = 0;
+
+ /** returns the color to be used for rendering the grid lines.
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::boost::optional< ::Color > getLineColor() const = 0;
+
+ /** returns the color to be used for rendering the header background.
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::boost::optional< ::Color > getHeaderBackgroundColor() const = 0;
+
+ /** returns the color to be used for rendering the header text.
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::boost::optional< ::Color > getHeaderTextColor() const = 0;
+
+ /** returns the color to be used for rendering cell texts.
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::boost::optional< ::Color > getTextColor() const = 0;
+
+ /** returns the color to be used for text lines (underline, strikethrough) when rendering cell text.
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::boost::optional< ::Color > getTextLineColor() const = 0;
+
+ /** returns the colors to be used for the row backgrounds.
+
+ If this value is not set, every second row will have a background color derived from the style settings's
+ selection color, the other rows will not have a special background at all.
+
+ If this value is an empty sequence, the rows will not have a special background at all, instead the
+ normal background of the complete control will be used.
+
+ If value is a non-empty sequence, then rows will have the background colors as specified in the sequence,
+ in alternating order.
+ */
+ virtual ::boost::optional< ::std::vector< ::Color > >
+ getRowBackgroundColors() const = 0;
+
+ /** determines the vertical alignment of content within a cell
+ */
+ virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign() const = 0;
+
+ /** returns an adapter to the sorting functionality of the model
+
+ It is legitimate to return <NULL/> here, in this case, the table model does not support sorting.
+ */
+ virtual ITableDataSort* getSortAdapter() = 0;
/// destroys the table model instance
virtual ~ITableModel() { }
diff --git a/svtools/inc/svtools/table/tablerenderer.hxx b/svtools/inc/svtools/table/tablerenderer.hxx
index f81771dd22e6..3d50c9d70ee7 100644
--- a/svtools/inc/svtools/table/tablerenderer.hxx
+++ b/svtools/inc/svtools/table/tablerenderer.hxx
@@ -46,6 +46,7 @@ namespace svt { namespace table
class SAL_NO_VTABLE ITableRenderer
{
public:
+
/** paints a (part of) header area
There are two header areas in a table control:
@@ -175,12 +176,10 @@ namespace svt { namespace table
the are into which the row header should be painted
@param _rStyle
the style to be used for drawing
- @param _rText
- the title of the header row
*/
virtual void PaintRowHeader( bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea,
- const StyleSettings& _rStyle, rtl::OUString& _rText ) = 0;
+ const StyleSettings& _rStyle ) = 0;
/** paints a certain cell
@@ -207,46 +206,11 @@ namespace svt { namespace table
the are into which the cell should be painted
@param _rStyle
the style to be used for drawing
- @param _pCellData
- the content of the cell
*/
- virtual void PaintCellImage( ColPos _nColumn,
+ virtual void PaintCell( ColPos const i_col,
bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea,
- const StyleSettings& _rStyle, Image* _pCellData ) = 0;
-
- /** paints a certain cell
-
- The row to be painted is denoted by the most recent call to
- ->PrepareRow.
-
- @param _bSelected
- <TRUE/> if and only if the cell to be painted is
- selected currently. This is the case if either
- the row or the column of the cell is currently selected.
- <br/>
- Note that this flag is equal to the respective flag in the
- previous ->PrepareRow call, it's passed here for convinience
- only.
- @param _bActive
- <TRUE/> if the cell is currently active.
- <br/>
- Note that this flag is equal to the respective flag in the
- previous ->PrepareRow call, it's passed here for convinience
- only.
- @param _rDevice
- denotes the device to paint onto
- @param _rArea
- the are into which the cell should be painted
- @param _rStyle
- the style to be used for drawing
- @param _rText
- the content of the cell
- */
- virtual void PaintCellString( ColPos _nColumn,
- bool _bActive, bool _bSelected,
- OutputDevice& _rDevice, const Rectangle& _rArea,
- const StyleSettings& _rStyle, rtl::OUString& _rText ) = 0;
+ const StyleSettings& _rStyle ) = 0;
/** draws a cell cursor in the given rectangle
@@ -262,6 +226,41 @@ namespace svt { namespace table
*/
virtual void HideCellCursor( Window& _rView, const Rectangle& _rCursorRect) = 0;
+ /** checks whether a given cell content fits into a given target area on a given device.
+
+ @param i_colPos
+ denotes the column which the cell content would be painted into. Your renderer implementation
+ would only need this parameter if rendering is done differently for different columns.
+
+ @param i_rowPos
+ denotes the row which the cell content would be painted into. Your renderer implementation
+ would only need this parameter if rendering is done differently for different rows.
+
+ @param i_active
+ is <TRUE/> if and only if the renderer should assume the cell content would be painted for the active
+ cell.
+
+ @param i_selected
+ is <TRUE/> if and only if the renderer should assume the cell content would be painted for a selected
+ cell.
+
+ @param i_targetDevice
+ denotes the target device for the assumed rendering operation
+
+ @param i_targetArea
+ denotes the area within the target device for the assumed rendering operation.
+
+ @return
+ <TRUE/> if and only if the given cell content could be rendered into the given device and the
+ given area.
+ */
+ virtual bool FitsIntoCell(
+ ::com::sun::star::uno::Any const & i_cellContent,
+ ColPos const i_colPos, RowPos const i_rowPos,
+ bool const i_active, bool const i_selected,
+ OutputDevice& i_targetDevice, Rectangle const & i_targetArea
+ ) = 0;
+
/// deletes the renderer instance
virtual ~ITableRenderer() { }
};
diff --git a/svtools/inc/svtools/table/tablesort.hxx b/svtools/inc/svtools/table/tablesort.hxx
new file mode 100755
index 000000000000..1690b4d51344
--- /dev/null
+++ b/svtools/inc/svtools/table/tablesort.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef SVTOOLS_TABLESORT_HXX
+#define SVTOOLS_TABLESORT_HXX
+
+#include "svtools/table/tabletypes.hxx"
+
+//......................................................................................................................
+namespace svt { namespace table
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= ColumnSortDirection
+ //==================================================================================================================
+ enum ColumnSortDirection
+ {
+ ColumnSortAscending,
+ ColumnSortDescending
+ };
+
+ //==================================================================================================================
+ //= ColumnSort
+ //==================================================================================================================
+ struct ColumnSort
+ {
+ ColPos nColumnPos;
+ ColumnSortDirection eSortDirection;
+
+ ColumnSort()
+ :nColumnPos( COL_INVALID )
+ ,eSortDirection( ColumnSortAscending )
+ {
+ }
+
+ ColumnSort( ColPos const i_columnPos, ColumnSortDirection const i_sortDirection )
+ :nColumnPos( i_columnPos )
+ ,eSortDirection( i_sortDirection )
+ {
+ }
+ };
+
+ //==================================================================================================================
+ //= ITableDataSort
+ //==================================================================================================================
+ /** provides sorting functionality for the datta underlying an ITableModel
+ */
+ class SAL_NO_VTABLE ITableDataSort
+ {
+ public:
+ /** sorts the rows in the model by the given column's data, in the given direction.
+ */
+ virtual void sortByColumn( ColPos const i_column, ColumnSortDirection const i_sortDirection ) = 0;
+
+ /** retrieves the current sort order of the data
+
+ If the <code>nColumnIndex</code> member of the returned srtructure is <code>COL_INVALID</code>, then
+ the data is currently not sorted.
+ */
+ virtual ColumnSort getCurrentSortOrder() const = 0;
+ };
+
+//......................................................................................................................
+} } // namespace svt::table
+//......................................................................................................................
+
+#endif // SVTOOLS_TABLESORT_HXX
diff --git a/svtools/inc/svtools/table/tabletypes.hxx b/svtools/inc/svtools/table/tabletypes.hxx
index 645120e30d4b..ae20851992e3 100644
--- a/svtools/inc/svtools/table/tabletypes.hxx
+++ b/svtools/inc/svtools/table/tabletypes.hxx
@@ -49,14 +49,7 @@ namespace svt { namespace table
*/
typedef sal_Int32 AnyPos;
- /// the ID of a column in a table
- typedef sal_Int32 ColumnID;
-
typedef sal_Int32 TableMetrics;
-/** special column width value which indicates that the column should be
- automatically resized to fit the view
-*/
-#define COLWIDTH_FIT_TO_VIEW ((::svt::table::TableMetrics)-1)
/// denotes the column containing the row headers
#define COL_ROW_HEADERS ((::svt::table::ColPos)-1)
diff --git a/svtools/prj/build.lst b/svtools/prj/build.lst
index fd0f1a560c18..ff9aa6a9875c 100644
--- a/svtools/prj/build.lst
+++ b/svtools/prj/build.lst
@@ -1,2 +1,2 @@
-st svtools : l10n svl offuh toolkit ucbhelper unotools JPEG:jpeg cppu cppuhelper comphelper sal sot jvmfwk LIBXSLT:libxslt NULL
+st svtools : L10N:l10n svl offuh toolkit ucbhelper unotools JPEG:jpeg cppu cppuhelper comphelper sal sot jvmfwk LIBXSLT:libxslt NULL
st svtools\prj nmake - all st_prj NULL
diff --git a/svtools/qa/unoapi/makefile.mk b/svtools/qa/unoapi/makefile.mk
new file mode 100644
index 000000000000..e3afb77e637a
--- /dev/null
+++ b/svtools/qa/unoapi/makefile.mk
@@ -0,0 +1,48 @@
+#*************************************************************************
+# 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.
+#***********************************************************************/
+
+.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
+nothing .PHONY:
+.ELSE
+
+PRJ = ../..
+PRJNAME = svtools
+TARGET = qa_unoapi
+
+.IF "$(OOO_JUNIT_JAR)" != ""
+PACKAGE = org/openoffice/svtools/qa/unoapi
+JAVATESTFILES = Test.java
+JAVAFILES = $(JAVATESTFILES)
+JARFILES = OOoRunner.jar ridl.jar test.jar
+EXTRAJARFILES = $(OOO_JUNIT_JAR)
+.END
+
+.INCLUDE: settings.mk
+.INCLUDE: target.mk
+.INCLUDE: installationtest.mk
+
+ALLTAR : javatest
+
+.END
diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx
index c13eabd2314e..377180653780 100644
--- a/svtools/source/brwbox/datwin.cxx
+++ b/svtools/source/brwbox/datwin.cxx
@@ -752,17 +752,18 @@ void BrowserScrollBar::Tracking( const TrackingEvent& rTEvt )
sal_uLong nPos = GetThumbPos();
if ( nPos != _nLastPos )
{
- if ( _nTip )
- Help::HideTip( _nTip );
-
String aTip( String::CreateFromInt32(nPos) );
aTip += '/';
if ( _pDataWin->GetRealRowCount().Len() )
aTip += _pDataWin->GetRealRowCount();
else
aTip += String::CreateFromInt32(GetRangeMax());
+
Rectangle aRect( GetPointerPosPixel(), Size( GetTextHeight(), GetTextWidth( aTip ) ) );
- _nTip = Help::ShowTip( this, aRect, aTip );
+ if ( _nTip )
+ Help::UpdateTip( _nTip, this, aRect, aTip );
+ else
+ _nTip = Help::ShowTip( this, aRect, aTip );
_nLastPos = nPos;
}
diff --git a/svtools/source/contnr/svcontnr.src b/svtools/source/contnr/svcontnr.src
index bcd1e060664f..e0449fc3f644 100644
--- a/svtools/source/contnr/svcontnr.src
+++ b/svtools/source/contnr/svcontnr.src
@@ -74,30 +74,3 @@ String STR_SVT_ACC_EMPTY_FIELD
Text [ en-US ] = "Empty Field";
};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/svtools/source/contnr/svlbox.cxx b/svtools/source/contnr/svlbox.cxx
index e34ed061cd69..e4e4abdc96a2 100644
--- a/svtools/source/contnr/svlbox.cxx
+++ b/svtools/source/contnr/svlbox.cxx
@@ -683,6 +683,7 @@ SvViewDataEntry::~SvViewDataEntry()
SvLBox_Impl::SvLBox_Impl( SvLBox& _rBox )
:m_bIsEmptyTextAllowed( true )
,m_bEntryMnemonicsEnabled( false )
+ ,m_bDoingQuickSelection( false )
,m_pLink( NULL )
,m_aMnemonicEngine( _rBox )
,m_aQuickSelectionEngine( _rBox )
diff --git a/svtools/source/control/filectrl.src b/svtools/source/control/filectrl.src
index dc8bbb5905d6..f9d63b65b838 100644..100755
--- a/svtools/source/control/filectrl.src
+++ b/svtools/source/control/filectrl.src
@@ -31,28 +31,20 @@ String STR_FILECTRL_BUTTONTEXT
Text [ en-US ] = "Browse..." ;
};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+String STR_TABBAR_PUSHBUTTON_MOVET0HOME
+{
+ Text [ en-US ] = "Move To Home" ;
+};
+String STR_TABBAR_PUSHBUTTON_MOVELEFT
+{
+ Text [ en-US ] = "Move Left" ;
+};
+String STR_TABBAR_PUSHBUTTON_MOVERIGHT
+{
+ Text [ en-US ] = "Move Right" ;
+};
+String STR_TABBAR_PUSHBUTTON_MOVETOEND
+{
+ Text [ en-US ] = "Move To End" ;
+};
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index 164118d12ef9..1c5b95460232 100755
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -303,6 +303,7 @@ void Ruler::ImplInit( WinBits nWinBits )
else
aDefSize.Width() = nDefHeight;
SetOutputSizePixel( aDefSize );
+ SetType(WINDOW_RULER);
}
// -----------------------------------------------------------------------
diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index 033ae63e8a0a..b7511d24b5c8 100755
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -38,7 +38,8 @@
#include <vcl/button.hxx>
#include <vcl/edit.hxx>
#include "svtaccessiblefactory.hxx"
-
+#include <filectrl.hrc>
+#include <svtools/svtdata.hxx>
#include <limits>
// =======================================================================
@@ -397,6 +398,16 @@ void TabBar::ImplInit( WinBits nWinStyle )
mnOffY++;
ImplInitControls();
+
+ if(mpFirstBtn)
+ mpFirstBtn->SetAccessibleName(String(SvtResId(STR_TABBAR_PUSHBUTTON_MOVET0HOME)));
+ if(mpPrevBtn)
+ mpPrevBtn->SetAccessibleName( String(SvtResId(STR_TABBAR_PUSHBUTTON_MOVELEFT)));
+ if(mpNextBtn)
+ mpNextBtn->SetAccessibleName(String(SvtResId(STR_TABBAR_PUSHBUTTON_MOVERIGHT)));
+ if(mpLastBtn)
+ mpLastBtn->SetAccessibleName( String(SvtResId(STR_TABBAR_PUSHBUTTON_MOVETOEND)));
+
SetSizePixel( Size( 100, CalcWindowSizePixel().Height() ) );
ImplInitSettings( sal_True, sal_True );
}
diff --git a/svtools/source/control/toolbarmenuacc.cxx b/svtools/source/control/toolbarmenuacc.cxx
index 9ffc4fc55f04..620002017e6c 100644
--- a/svtools/source/control/toolbarmenuacc.cxx
+++ b/svtools/source/control/toolbarmenuacc.cxx
@@ -252,7 +252,7 @@ OUString SAL_CALL ToolbarMenuAcc::getAccessibleName() throw (RuntimeException)
if( !aRet.getLength() )
{
- Window* pLabel = mpParent->mrMenu.GetLabeledBy();
+ Window* pLabel = mpParent->mrMenu.GetAccessibleRelationLabeledBy();
if( pLabel && pLabel != &mpParent->mrMenu )
aRet = OutputDevice::GetNonMnemonicString( pLabel->GetText() );
}
diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx
index 848ef4c3e10e..1b98e3197bd3 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -317,7 +317,7 @@ sal_Int16 SAL_CALL ValueSetAcc::getAccessibleRole()
if ( !aRet.Len() )
{
- Window* pLabel = mpParent->GetLabeledBy();
+ Window* pLabel = mpParent->GetAccessibleRelationLabeledBy();
if ( pLabel && pLabel != mpParent )
aRet = OutputDevice::GetNonMnemonicString( pLabel->GetText() );
}
diff --git a/svtools/source/dialogs/colrdlg.hrc b/svtools/source/dialogs/colrdlg.hrc
index 41329df6e366..b1e785bd2f17 100644
--- a/svtools/source/dialogs/colrdlg.hrc
+++ b/svtools/source/dialogs/colrdlg.hrc
@@ -65,3 +65,5 @@
#define BTN_CANCEL 1
#define BTN_HELP 1
+//IAccessibility2 Implementation 2009-----
+#define STR_COLORDES 3001
diff --git a/svtools/source/dialogs/colrdlg.src b/svtools/source/dialogs/colrdlg.src
index a93642b0bd05..fee6314b28cc 100644
--- a/svtools/source/dialogs/colrdlg.src
+++ b/svtools/source/dialogs/colrdlg.src
@@ -277,45 +277,19 @@ ModalDialog DLG_COLOR
Border = TRUE ;
Pos = MAP_APPFONT ( 200 , 109 ) ;
Size = MAP_APPFONT ( 26 , 51 + DIFF ) ;
- TabStop = TRUE ;
+ TabStop = FALSE ;
};
Control CTL_PREVIEW
{
Border = TRUE ;
Pos = MAP_APPFONT ( 229 , 109 ) ;
Size = MAP_APPFONT ( 26 , 51 + DIFF ) ;
- TabStop = TRUE ;
+ TabStop = FALSE ;
};
};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+String STR_COLORDES
+{
+ Text [ en-US ] = "RGB(%1, %2, %3) Hue:%4 Saturation:%5 Brightness:%6";
+};
diff --git a/svtools/source/filter/FilterConfigItem.cxx b/svtools/source/filter/FilterConfigItem.cxx
index 1e836cde8785..8d7752ddd7df 100644
--- a/svtools/source/filter/FilterConfigItem.cxx
+++ b/svtools/source/filter/FilterConfigItem.cxx
@@ -428,7 +428,7 @@ void FilterConfigItem::WriteBool( const OUString& rKey, sal_Bool bNewValue )
Any aAny;
if ( ImplGetPropertyValue( aAny, xPropSet, rKey, sal_True ) )
{
- sal_Bool bOldValue = bNewValue;
+ sal_Bool bOldValue(sal_True);
if ( aAny >>= bOldValue )
{
if ( bOldValue != bNewValue )
@@ -462,7 +462,7 @@ void FilterConfigItem::WriteInt32( const OUString& rKey, sal_Int32 nNewValue )
if ( ImplGetPropertyValue( aAny, xPropSet, rKey, sal_True ) )
{
- sal_Int32 nOldValue = nNewValue;
+ sal_Int32 nOldValue = 0;
if ( aAny >>= nOldValue )
{
if ( nOldValue != nNewValue )
diff --git a/svtools/source/inc/filectrl.hrc b/svtools/source/inc/filectrl.hrc
index 1707e306e1b0..150bbba4ac68 100644
--- a/svtools/source/inc/filectrl.hrc
+++ b/svtools/source/inc/filectrl.hrc
@@ -30,5 +30,12 @@
#define STR_FILECTRL_BUTTONTEXT 333 // ID-Range?!
+//IAccessibility2 Implementation 2009-----
+#define STR_TABBAR_PUSHBUTTON_MOVET0HOME ( STR_FILECTRL_BUTTONTEXT+ 1)
+#define STR_TABBAR_PUSHBUTTON_MOVELEFT ( STR_FILECTRL_BUTTONTEXT+ 2)
+#define STR_TABBAR_PUSHBUTTON_MOVERIGHT ( STR_FILECTRL_BUTTONTEXT+ 3)
+#define STR_TABBAR_PUSHBUTTON_MOVETOEND ( STR_FILECTRL_BUTTONTEXT+ 4)
+//-----IAccessibility2 Implementation 2009
+
#endif
diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src
index 067eb601a5af..bb5fa2dfd363 100644
--- a/svtools/source/misc/langtab.src
+++ b/svtools/source/misc/langtab.src
@@ -301,7 +301,7 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE
< "Shuswap" ; LANGUAGE_USER_SHUSWAP ; > ;
< "Oromo" ; LANGUAGE_OROMO ; > ;
< "Greek, Ancient" ; LANGUAGE_USER_ANCIENT_GREEK ; > ;
- < "Yiddish" ; LANGUAGE_YIDDISH ; > ;
+ < "Yiddish (Israel)" ; LANGUAGE_YIDDISH ; > ;
< "Quechua (Ecuador)" ; LANGUAGE_QUECHUA_ECUADOR ; > ;
< "Uyghur" ; LANGUAGE_UIGHUR_CHINA ; > ;
< "Asturian" ; LANGUAGE_USER_ASTURIAN ; > ;
@@ -323,6 +323,12 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE
< "Yoruba" ; LANGUAGE_YORUBA ; > ;
< "Rusyn (Ukraine)" ; LANGUAGE_USER_RUSYN_UKRAINE ; > ;
< "Rusyn (Slovakia)" ; LANGUAGE_USER_RUSYN_SLOVAKIA ; > ;
+ < "Yiddish (USA)" ; LANGUAGE_USER_YIDDISH_US ; > ;
+ < "Hawaiian" ; LANGUAGE_HAWAIIAN_UNITED_STATES ; > ;
+ < "Limbu" ; LANGUAGE_USER_LIMBU ; > ;
+ < "Lojban" ; LANGUAGE_USER_LOJBAN ; > ;
+ < "Kabyle" ; LANGUAGE_USER_KABYLE ; > ;
+ < "Haitian" ; LANGUAGE_USER_HAITIAN ; > ;
};
};
diff --git a/svtools/source/table/cellvalueconversion.cxx b/svtools/source/table/cellvalueconversion.cxx
new file mode 100755
index 000000000000..286ca505bb30
--- /dev/null
+++ b/svtools/source/table/cellvalueconversion.cxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ * 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.
+ *
+ ************************************************************************/
+
+#include "precompiled_svtools.hxx"
+
+#include "cellvalueconversion.hxx"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+//......................................................................................................................
+namespace svt
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Any;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= CellValueConversion
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString CellValueConversion::convertToString( const Any& i_value )
+ {
+ ::rtl::OUString sConvertString;
+ if ( !i_value.hasValue() )
+ return sConvertString;
+
+
+ // TODO: use css.script.XTypeConverter?
+
+ sal_Int32 nInt = 0;
+ sal_Bool bBool = false;
+ double fDouble = 0;
+
+ ::rtl::OUString sStringValue;
+ if ( i_value >>= sConvertString )
+ sStringValue = sConvertString;
+ else if ( i_value >>= nInt )
+ sStringValue = sConvertString.valueOf( nInt );
+ else if ( i_value >>= bBool )
+ sStringValue = sConvertString.valueOf( bBool );
+ else if ( i_value >>= fDouble )
+ sStringValue = sConvertString.valueOf( fDouble );
+ else
+ OSL_ENSURE( !i_value.hasValue(), "CellValueConversion::convertToString: cannot handle the given cell content type!" );
+
+ return sStringValue;
+ }
+
+//......................................................................................................................
+} // namespace svt
+//......................................................................................................................
diff --git a/svtools/source/inc/accessibletableimp.hxx b/svtools/source/table/cellvalueconversion.hxx
index 3a01c01567d3..4d6b8c8d6aac 100644..100755
--- a/svtools/source/inc/accessibletableimp.hxx
+++ b/svtools/source/table/cellvalueconversion.hxx
@@ -22,41 +22,31 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
-************************************************************************/
+ ************************************************************************/
-#ifndef SVTOOLS_SOURCE_INC_ACCESSIBLETABLEIMP_HXX
-#define SVTOOLS_SOURCE_INC_ACCESSIBLETABLEIMP_HXX
+#ifndef SVTOOLS_CELLVALUECONVERSION_HXX
+#define SVTOOLS_CELLVALUECONVERSION_HXX
-#include "svtaccessiblefactory.hxx"
+/** === begin UNO includes === **/
+#include <com/sun/star/uno/Any.hxx>
+/** === end UNO includes === **/
-namespace svt { namespace table
+//......................................................................................................................
+namespace svt
{
-//........................................................................
+//......................................................................................................................
-
- class AccessibleTableControl_Impl
+ //==================================================================================================================
+ //= CellValueConversion
+ //==================================================================================================================
+ class CellValueConversion
{
- public:
- AccessibleFactoryAccess m_aFactoryAccess;
- IAccessibleTableControl* m_pAccessible;
-
- public:
- AccessibleTableControl_Impl() : m_pAccessible(NULL)
- {
- }
-
-
- /// @see AccessibleTableControl::getTableRowHeader
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
- getAccessibleTableHeader( AccessibleTableControlObjType _eObjType );
- /// @see AccessibleTableControl::getTable
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
- getAccessibleTable( );
-
+ public:
+ static ::rtl::OUString convertToString( const ::com::sun::star::uno::Any& i_cellValue );
};
-//........................................................................
-} } // namespace svt::table
-//........................................................................
+//......................................................................................................................
+} // namespace svt
+//......................................................................................................................
-#endif // SVTOOLS_SOURCE_INC_ACCESSIBLETABLEIMP_HXX
+#endif // SVTOOLS_CELLVALUECONVERSION_HXX
diff --git a/svtools/source/table/defaultinputhandler.cxx b/svtools/source/table/defaultinputhandler.cxx
index 133575fdf8cf..733366d16904 100644
--- a/svtools/source/table/defaultinputhandler.cxx
+++ b/svtools/source/table/defaultinputhandler.cxx
@@ -28,111 +28,123 @@
#include "precompiled_svtools.hxx"
#include "svtools/table/defaultinputhandler.hxx"
-#include "svtools/table/abstracttablecontrol.hxx"
+#include "svtools/table/tablecontrolinterface.hxx"
+
+#include "tabledatawindow.hxx"
+#include "mousefunction.hxx"
#include <tools/debug.hxx>
#include <vcl/event.hxx>
#include <vcl/cursor.hxx>
-#include "svtools/table/tabledatawindow.hxx"
-//........................................................................
+//......................................................................................................................
namespace svt { namespace table
{
-//.......................................................................
+//......................................................................................................................
+ typedef ::rtl::Reference< IMouseFunction > PMouseFunction;
+ typedef ::std::vector< PMouseFunction > MouseFunctions;
struct DefaultInputHandler_Impl
{
+ PMouseFunction pActiveFunction;
+ MouseFunctions aMouseFunctions;
};
- //====================================================================
+ //==================================================================================================================
//= DefaultInputHandler
- //====================================================================
- //--------------------------------------------------------------------
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
DefaultInputHandler::DefaultInputHandler()
:m_pImpl( new DefaultInputHandler_Impl )
- ,m_bResize(false)
{
+ m_pImpl->aMouseFunctions.push_back( new ColumnResize );
+ m_pImpl->aMouseFunctions.push_back( new RowSelection );
+ m_pImpl->aMouseFunctions.push_back( new ColumnSortHandler );
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
DefaultInputHandler::~DefaultInputHandler()
{
- DELETEZ( m_pImpl );
}
- //--------------------------------------------------------------------
- bool DefaultInputHandler::MouseMove( IAbstractTableControl& _rControl, const MouseEvent& _rMEvt )
+ //------------------------------------------------------------------------------------------------------------------
+ namespace
{
- Point aPoint = _rMEvt.GetPosPixel();
- if(m_bResize)
+ bool lcl_delegateMouseEvent( DefaultInputHandler_Impl& i_impl, ITableControl& i_control, const MouseEvent& i_event,
+ FunctionResult ( IMouseFunction::*i_handlerMethod )( ITableControl&, const MouseEvent& ) )
{
- _rControl.resizeColumn(aPoint);
- return true;
- }
- return false;
- }
-
- //--------------------------------------------------------------------
- bool DefaultInputHandler::MouseButtonDown( IAbstractTableControl& _rControl, const MouseEvent& _rMEvt )
- {
- bool bHandled = false;
- Point aPoint = _rMEvt.GetPosPixel();
- RowPos nRow = _rControl.getCurrentRow(aPoint);
- if(nRow == -1)
- {
- m_bResize = _rControl.startResizeColumn(aPoint);
- bHandled = true;
- }
- else if(nRow >= 0)
- {
- if(_rControl.getSelEngine()->GetSelectionMode() == NO_SELECTION)
+ if ( i_impl.pActiveFunction.is() )
{
- _rControl.setCursorAtCurrentCell(aPoint);
- bHandled = true;
+ bool furtherHandler = false;
+ switch ( (i_impl.pActiveFunction.get()->*i_handlerMethod)( i_control, i_event ) )
+ {
+ case ActivateFunction:
+ OSL_ENSURE( false, "lcl_delegateMouseEvent: unexpected - function already *is* active!" );
+ break;
+ case ContinueFunction:
+ break;
+ case DeactivateFunction:
+ i_impl.pActiveFunction.clear();
+ break;
+ case SkipFunction:
+ furtherHandler = true;
+ break;
+ }
+ if ( !furtherHandler )
+ // handled the event
+ return true;
}
- else
+
+ // ask all other handlers
+ bool handled = false;
+ for ( MouseFunctions::iterator handler = i_impl.aMouseFunctions.begin();
+ ( handler != i_impl.aMouseFunctions.end() ) && !handled;
+ ++handler
+ )
{
- if(!_rControl.isRowSelected(nRow))
- bHandled = _rControl.getSelEngine()->SelMouseButtonDown(_rMEvt);
- else
- bHandled = true;
+ if ( *handler == i_impl.pActiveFunction )
+ // we already invoked this function
+ continue;
+
+ switch ( (handler->get()->*i_handlerMethod)( i_control, i_event ) )
+ {
+ case ActivateFunction:
+ i_impl.pActiveFunction = *handler;
+ handled = true;
+ break;
+ case ContinueFunction:
+ case DeactivateFunction:
+ OSL_ENSURE( false, "lcl_delegateMouseEvent: unexpected: inactivate handler cannot be continued or deactivated!" );
+ break;
+ case SkipFunction:
+ handled = false;
+ break;
+ }
}
+ return handled;
}
- return bHandled;
}
- //--------------------------------------------------------------------
- bool DefaultInputHandler::MouseButtonUp( IAbstractTableControl& _rControl, const MouseEvent& _rMEvt )
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool DefaultInputHandler::MouseMove( ITableControl& i_tableControl, const MouseEvent& i_event )
{
- bool bHandled = false;
- Point aPoint = _rMEvt.GetPosPixel();
- if(_rControl.getCurrentRow(aPoint) >= 0)
- {
- if(m_bResize)
- {
- m_bResize = _rControl.endResizeColumn(aPoint);
- bHandled = true;
- }
- else if(_rControl.getSelEngine()->GetSelectionMode() == NO_SELECTION)
- {
- bHandled = true;
- }
- else
- {
- bHandled = _rControl.getSelEngine()->SelMouseButtonUp(_rMEvt);
- }
- }
- else
- {
- if(m_bResize)
- {
- m_bResize = _rControl.endResizeColumn(aPoint);
- bHandled = true;
- }
- }
- return bHandled;
+ return lcl_delegateMouseEvent( *m_pImpl, i_tableControl, i_event, &IMouseFunction::handleMouseMove );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool DefaultInputHandler::MouseButtonDown( ITableControl& i_tableControl, const MouseEvent& i_event )
+ {
+ return lcl_delegateMouseEvent( *m_pImpl, i_tableControl, i_event, &IMouseFunction::handleMouseDown );
}
- //--------------------------------------------------------------------
- bool DefaultInputHandler::KeyInput( IAbstractTableControl& _rControl, const KeyEvent& rKEvt )
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool DefaultInputHandler::MouseButtonUp( ITableControl& i_tableControl, const MouseEvent& i_event )
+ {
+ return lcl_delegateMouseEvent( *m_pImpl, i_tableControl, i_event, &IMouseFunction::handleMouseUp );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool DefaultInputHandler::KeyInput( ITableControl& _rControl, const KeyEvent& rKEvt )
{
bool bHandled = false;
@@ -158,11 +170,11 @@ namespace svt { namespace table
{ KEY_PAGEDOWN, KEY_MOD1, cursorToLastLine },
{ KEY_HOME, KEY_MOD1, cursorTopLeft },
{ KEY_END, KEY_MOD1, cursorBottomRight },
- { KEY_SPACE, KEY_MOD1, cursorSelectRow },
- { KEY_UP, KEY_SHIFT, cursorSelectRowUp },
- { KEY_DOWN, KEY_SHIFT, cursorSelectRowDown },
- { KEY_END, KEY_SHIFT, cursorSelectRowAreaBottom },
- { KEY_HOME, KEY_SHIFT, cursorSelectRowAreaTop },
+ { KEY_SPACE, KEY_MOD1, cursorSelectRow },
+ { KEY_UP, KEY_SHIFT, cursorSelectRowUp },
+ { KEY_DOWN, KEY_SHIFT, cursorSelectRowDown },
+ { KEY_END, KEY_SHIFT, cursorSelectRowAreaBottom },
+ { KEY_HOME, KEY_SHIFT, cursorSelectRowAreaTop },
{ 0, 0, invalidTableControlAction }
};
@@ -173,7 +185,6 @@ namespace svt { namespace table
if ( ( pActions->nKeyCode == nKeyCode ) && ( pActions->nKeyModifier == rKeyCode.GetAllModifier() ) )
{
bHandled = _rControl.dispatchAction( pActions->eAction );
- bHandled = true; // always handled issue #i114340
break;
}
}
@@ -181,22 +192,22 @@ namespace svt { namespace table
return bHandled;
}
- //--------------------------------------------------------------------
- bool DefaultInputHandler::GetFocus( IAbstractTableControl& _rControl )
+ //------------------------------------------------------------------------------------------------------------------
+ bool DefaultInputHandler::GetFocus( ITableControl& _rControl )
{
_rControl.showCursor();
return false; // continue processing
}
- //--------------------------------------------------------------------
- bool DefaultInputHandler::LoseFocus( IAbstractTableControl& _rControl )
+ //------------------------------------------------------------------------------------------------------------------
+ bool DefaultInputHandler::LoseFocus( ITableControl& _rControl )
{
_rControl.hideCursor();
return false; // continue processing
}
- //--------------------------------------------------------------------
- bool DefaultInputHandler::RequestHelp( IAbstractTableControl& _rControl, const HelpEvent& _rHEvt )
+ //------------------------------------------------------------------------------------------------------------------
+ bool DefaultInputHandler::RequestHelp( ITableControl& _rControl, const HelpEvent& _rHEvt )
{
(void)_rControl;
(void)_rHEvt;
@@ -204,8 +215,8 @@ namespace svt { namespace table
return false;
}
- //--------------------------------------------------------------------
- bool DefaultInputHandler::Command( IAbstractTableControl& _rControl, const CommandEvent& _rCEvt )
+ //------------------------------------------------------------------------------------------------------------------
+ bool DefaultInputHandler::Command( ITableControl& _rControl, const CommandEvent& _rCEvt )
{
(void)_rControl;
(void)_rCEvt;
@@ -213,8 +224,8 @@ namespace svt { namespace table
return false;
}
- //--------------------------------------------------------------------
- bool DefaultInputHandler::PreNotify( IAbstractTableControl& _rControl, NotifyEvent& _rNEvt )
+ //------------------------------------------------------------------------------------------------------------------
+ bool DefaultInputHandler::PreNotify( ITableControl& _rControl, NotifyEvent& _rNEvt )
{
(void)_rControl;
(void)_rNEvt;
@@ -222,14 +233,14 @@ namespace svt { namespace table
return false;
}
- //--------------------------------------------------------------------
- bool DefaultInputHandler::Notify( IAbstractTableControl& _rControl, NotifyEvent& _rNEvt )
+ //------------------------------------------------------------------------------------------------------------------
+ bool DefaultInputHandler::Notify( ITableControl& _rControl, NotifyEvent& _rNEvt )
{
(void)_rControl;
(void)_rNEvt;
// TODO
return false;
}
-//........................................................................
+//......................................................................................................................
} } // namespace svt::table
-//........................................................................
+//......................................................................................................................
diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx
index 5fb61a9f385e..1e230d372c24 100644
--- a/svtools/source/table/gridtablerenderer.cxx
+++ b/svtools/source/table/gridtablerenderer.cxx
@@ -27,51 +27,209 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
+#include "cellvalueconversion.hxx"
#include "svtools/table/gridtablerenderer.hxx"
+#include "svtools/colorcfg.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/graphic/XGraphic.hpp>
+/** === end UNO includes === **/
#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
#include <vcl/window.hxx>
#include <vcl/image.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/decoview.hxx>
-//........................................................................
+//......................................................................................................................
namespace svt { namespace table
{
-//........................................................................
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::TypeClass_INTERFACE;
+ using ::com::sun::star::graphic::XGraphic;
+ using ::com::sun::star::style::HorizontalAlignment;
+ using ::com::sun::star::style::HorizontalAlignment_LEFT;
+ using ::com::sun::star::style::HorizontalAlignment_CENTER;
+ using ::com::sun::star::style::HorizontalAlignment_RIGHT;
+ using ::com::sun::star::style::VerticalAlignment;
+ using ::com::sun::star::style::VerticalAlignment_TOP;
+ using ::com::sun::star::style::VerticalAlignment_MIDDLE;
+ using ::com::sun::star::style::VerticalAlignment_BOTTOM;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= CachedSortIndicator
+ //==================================================================================================================
+ class CachedSortIndicator
+ {
+ public:
+ CachedSortIndicator()
+ :m_lastHeaderHeight( 0 )
+ ,m_lastArrowColor( COL_TRANSPARENT )
+ {
+ }
+
+ BitmapEx const & getBitmapFor( OutputDevice const & i_device, long const i_headerHeight, StyleSettings const & i_style, bool const i_sortAscending );
+
+ private:
+ long m_lastHeaderHeight;
+ Color m_lastArrowColor;
+ BitmapEx m_sortAscending;
+ BitmapEx m_sortDescending;
+ };
+
+ //------------------------------------------------------------------------------------------------------------------
+ BitmapEx const & CachedSortIndicator::getBitmapFor( OutputDevice const & i_device, long const i_headerHeight,
+ StyleSettings const & i_style, bool const i_sortAscending )
+ {
+ BitmapEx & rBitmap( i_sortAscending ? m_sortAscending : m_sortDescending );
+ if ( !rBitmap || ( i_headerHeight != m_lastHeaderHeight ) || ( i_style.GetActiveColor() != m_lastArrowColor ) )
+ {
+ long const nSortIndicatorWidth = 2 * i_headerHeight / 3;
+ long const nSortIndicatorHeight = 2 * nSortIndicatorWidth / 3;
+
+ Point const aBitmapPos( 0, 0 );
+ Size const aBitmapSize( nSortIndicatorWidth, nSortIndicatorHeight );
+ VirtualDevice aDevice( i_device, 0, 0 );
+ aDevice.SetOutputSizePixel( aBitmapSize );
+
+ DecorationView aDecoView( &aDevice );
+ aDecoView.DrawSymbol(
+ Rectangle( aBitmapPos, aBitmapSize ),
+ i_sortAscending ? SYMBOL_SPIN_UP : SYMBOL_SPIN_DOWN,
+ i_style.GetActiveColor()
+ );
+
+ rBitmap = aDevice.GetBitmapEx( aBitmapPos, aBitmapSize );
+ m_lastHeaderHeight = i_headerHeight;
+ m_lastArrowColor = i_style.GetActiveColor();
+ }
+ return rBitmap;
+ }
+ //==================================================================================================================
+ //= GridTableRenderer_Impl
+ //==================================================================================================================
struct GridTableRenderer_Impl
{
- ITableModel& rModel;
- RowPos nCurrentRow;
+ ITableModel& rModel;
+ RowPos nCurrentRow;
+ bool bUseGridLines;
+ CachedSortIndicator aSortIndicator;
GridTableRenderer_Impl( ITableModel& _rModel )
:rModel( _rModel )
,nCurrentRow( ROW_INVALID )
+ ,bUseGridLines( true )
{
}
};
- //====================================================================
+ //==================================================================================================================
+ //= helper
+ //==================================================================================================================
+ namespace
+ {
+ static Rectangle lcl_getContentArea( GridTableRenderer_Impl const & i_impl, Rectangle const & i_cellArea )
+ {
+ Rectangle aContentArea( i_cellArea );
+ if ( i_impl.bUseGridLines )
+ {
+ --aContentArea.Right();
+ --aContentArea.Bottom();
+ }
+ return aContentArea;
+ }
+ static Rectangle lcl_getTextRenderingArea( Rectangle const & i_contentArea )
+ {
+ Rectangle aTextArea( i_contentArea );
+ aTextArea.Left() += 2; aTextArea.Right() -= 2;
+ ++aTextArea.Top(); --aTextArea.Bottom();
+ return aTextArea;
+ }
+
+ static sal_uLong lcl_getAlignmentTextDrawFlags( GridTableRenderer_Impl const & i_impl, ColPos const i_columnPos )
+ {
+ sal_uLong nVertFlag = TEXT_DRAW_TOP;
+ VerticalAlignment const eVertAlign = i_impl.rModel.getVerticalAlign();
+ switch ( eVertAlign )
+ {
+ case VerticalAlignment_MIDDLE: nVertFlag = TEXT_DRAW_VCENTER; break;
+ case VerticalAlignment_BOTTOM: nVertFlag = TEXT_DRAW_BOTTOM; break;
+ default:
+ break;
+ }
+
+ sal_uLong nHorzFlag = TEXT_DRAW_LEFT;
+ HorizontalAlignment const eHorzAlign = i_impl.rModel.getColumnModel( i_columnPos )->getHorizontalAlign();
+ switch ( eHorzAlign )
+ {
+ case HorizontalAlignment_CENTER: nHorzFlag = TEXT_DRAW_CENTER; break;
+ case HorizontalAlignment_RIGHT: nHorzFlag = TEXT_DRAW_RIGHT; break;
+ default:
+ break;
+ }
+
+ return nVertFlag | nHorzFlag;
+ }
+
+ }
+
+ //==================================================================================================================
//= GridTableRenderer
- //====================================================================
- //--------------------------------------------------------------------
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
GridTableRenderer::GridTableRenderer( ITableModel& _rModel )
:m_pImpl( new GridTableRenderer_Impl( _rModel ) )
{
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
GridTableRenderer::~GridTableRenderer()
{
- DELETEZ( m_pImpl );
}
- //--------------------------------------------------------------------
- RowPos GridTableRenderer::getCurrentRow()
+ //------------------------------------------------------------------------------------------------------------------
+ RowPos GridTableRenderer::getCurrentRow() const
{
return m_pImpl->nCurrentRow;
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ bool GridTableRenderer::useGridLines() const
+ {
+ return m_pImpl->bUseGridLines;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void GridTableRenderer::useGridLines( bool const i_use )
+ {
+ m_pImpl->bUseGridLines = i_use;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ namespace
+ {
+ Color lcl_getEffectiveColor(
+ ::boost::optional< ::Color > const & i_modelColor,
+ StyleSettings const & i_styleSettings,
+ ::Color const & ( StyleSettings::*i_getDefaultColor ) () const
+ )
+ {
+ if ( !!i_modelColor )
+ return *i_modelColor;
+ return ( i_styleSettings.*i_getDefaultColor )();
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
void GridTableRenderer::PaintHeaderArea(
OutputDevice& _rDevice, const Rectangle& _rArea, bool _bIsColHeaderArea, bool _bIsRowHeaderArea,
const StyleSettings& _rStyle )
@@ -79,15 +237,18 @@ namespace svt { namespace table
OSL_PRECOND( _bIsColHeaderArea || _bIsRowHeaderArea,
"GridTableRenderer::PaintHeaderArea: invalid area flags!" );
- _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR);
- Color background = m_pImpl->rModel.getHeaderBackgroundColor();
- if( background != 0xFFFFFF)
- _rDevice.SetFillColor(background);
- else
- _rDevice.SetFillColor(_rStyle.GetDialogColor());
- _rDevice.SetLineColor(_rStyle.GetSeparatorColor());
+ _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR );
+
+ Color const background = lcl_getEffectiveColor( m_pImpl->rModel.getHeaderBackgroundColor(), _rStyle, &StyleSettings::GetDialogColor );
+ _rDevice.SetFillColor( background );
+
+ _rDevice.SetLineColor();
_rDevice.DrawRect( _rArea );
+
// delimiter lines at bottom/right
+ ::boost::optional< ::Color > aLineColor( m_pImpl->rModel.getLineColor() );
+ ::Color const lineColor = !aLineColor ? _rStyle.GetSeparatorColor() : *aLineColor;
+ _rDevice.SetLineColor( lineColor );
_rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
_rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
@@ -96,48 +257,73 @@ namespace svt { namespace table
(void)_bIsRowHeaderArea;
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void GridTableRenderer::PaintColumnHeader( ColPos _nCol, bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle )
{
_rDevice.Push( PUSH_LINECOLOR);
- _rDevice.SetLineColor(_rStyle.GetSeparatorColor());
- _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight());
String sHeaderText;
- PColumnModel pColumn = m_pImpl->rModel.getColumnModel( _nCol );
+ PColumnModel const pColumn = m_pImpl->rModel.getColumnModel( _nCol );
DBG_ASSERT( !!pColumn, "GridTableRenderer::PaintColumnHeader: invalid column model object!" );
if ( !!pColumn )
sHeaderText = pColumn->getName();
- if(m_pImpl->rModel.getTextColor() != 0x000000)
- _rDevice.SetTextColor(m_pImpl->rModel.getTextColor());
- else
- _rDevice.SetTextColor(_rStyle.GetFieldTextColor());
- sal_uLong nHorFlag = TEXT_DRAW_LEFT;
- sal_uLong nVerFlag = TEXT_DRAW_TOP;
- if(m_pImpl->rModel.getVerticalAlign() == 1)
- nVerFlag = TEXT_DRAW_VCENTER;
- else if(m_pImpl->rModel.getVerticalAlign() == 2)
- nVerFlag = TEXT_DRAW_BOTTOM;
- if(m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 1)
- nHorFlag = TEXT_DRAW_CENTER;
- else if(m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 2)
- nHorFlag = TEXT_DRAW_RIGHT;
- Rectangle aRect(_rArea);
- aRect.Left()+=4; aRect.Right()-=4;
- aRect.Bottom()-=2;
- _rDevice.DrawText( aRect, sHeaderText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP);
+
+ ::Color const textColor = lcl_getEffectiveColor( m_pImpl->rModel.getTextColor(), _rStyle, &StyleSettings::GetFieldTextColor );
+ _rDevice.SetTextColor( textColor );
+
+ Rectangle const aTextRect( lcl_getTextRenderingArea( lcl_getContentArea( *m_pImpl, _rArea ) ) );
+ sal_uLong const nDrawTextFlags = lcl_getAlignmentTextDrawFlags( *m_pImpl, _nCol ) | TEXT_DRAW_CLIP;
+ _rDevice.DrawText( aTextRect, sHeaderText, nDrawTextFlags );
+
+ ::boost::optional< ::Color > const aLineColor( m_pImpl->rModel.getLineColor() );
+ ::Color const lineColor = !aLineColor ? _rStyle.GetSeparatorColor() : *aLineColor;
+ _rDevice.SetLineColor( lineColor );
+ _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight());
_rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
+
+ // draw sort indicator if the model data is sorted by the given column
+ ITableDataSort const * pSortAdapter = m_pImpl->rModel.getSortAdapter();
+ ColumnSort aCurrentSortOrder;
+ if ( pSortAdapter != NULL )
+ aCurrentSortOrder = pSortAdapter->getCurrentSortOrder();
+ if ( aCurrentSortOrder.nColumnPos == _nCol )
+ {
+ long const nHeaderHeight( _rArea.GetHeight() );
+ BitmapEx const aIndicatorBitmap = m_pImpl->aSortIndicator.getBitmapFor( _rDevice, nHeaderHeight, _rStyle,
+ aCurrentSortOrder.eSortDirection == ColumnSortAscending );
+ Size const aBitmapSize( aIndicatorBitmap.GetSizePixel() );
+ long const nSortIndicatorPaddingX = 2;
+ long const nSortIndicatorPaddingY = ( nHeaderHeight - aBitmapSize.Height() ) / 2;
+
+ if ( ( nDrawTextFlags & TEXT_DRAW_RIGHT ) != 0 )
+ {
+ // text is right aligned => draw the sort indicator at the left hand side
+ _rDevice.DrawBitmapEx(
+ Point( _rArea.Left() + nSortIndicatorPaddingX, _rArea.Top() + nSortIndicatorPaddingY ),
+ aIndicatorBitmap
+ );
+ }
+ else
+ {
+ // text is left-aligned or centered => draw the sort indicator at the right hand side
+ _rDevice.DrawBitmapEx(
+ Point( _rArea.Right() - nSortIndicatorPaddingX - aBitmapSize.Width(), nSortIndicatorPaddingY ),
+ aIndicatorBitmap
+ );
+ }
+ }
+
_rDevice.Pop();
(void)_bActive;
// no special painting for the active column at the moment
(void)_bSelected;
- //selection for column header not yet implemented
+ // selection for column header not yet implemented
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void GridTableRenderer::PrepareRow( RowPos _nRow, bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rRowArea, const StyleSettings& _rStyle )
{
@@ -146,237 +332,288 @@ namespace svt { namespace table
_rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR);
- Color aRowBackground = m_pImpl->rModel.getOddRowBackgroundColor();
- Color line = m_pImpl->rModel.getLineColor();
- Color aRowBackground2 = m_pImpl->rModel.getEvenRowBackgroundColor();
- Color fieldColor = _rStyle.GetFieldColor();
- if(aRowBackground == 0xFFFFFF)
- aRowBackground = fieldColor;
- if(aRowBackground2 == 0xFFFFFF)
- aRowBackground2 = fieldColor;
- //if row is selected background color becomes blue, and lines should be also blue
- //if they aren't user defined
- if(_bSelected)
+ ::Color backgroundColor = _rStyle.GetFieldColor();
+
+ ::boost::optional< ::Color > aLineColor( m_pImpl->rModel.getLineColor() );
+ ::Color lineColor = !aLineColor ? _rStyle.GetSeparatorColor() : *aLineColor;
+
+ if ( _bSelected )
{
- Color aSelected(_rStyle.GetHighlightColor());
- aRowBackground = aSelected;
- if(line == 0xFFFFFF)
- _rDevice.SetLineColor(aRowBackground);
- else
- _rDevice.SetLineColor(line);
+ // selected rows use the background color from the style
+ backgroundColor = _rStyle.GetHighlightColor();
+ if ( !aLineColor )
+ lineColor = backgroundColor;
}
- //if row not selected, check the cases whether user defined backgrounds are set
- //and set line color to be the same
else
{
- if(aRowBackground2 != fieldColor && _nRow%2)
+ ::boost::optional< ::std::vector< ::Color > > aRowColors = m_pImpl->rModel.getRowBackgroundColors();
+ if ( !aRowColors )
{
- aRowBackground = aRowBackground2;
- if(line == 0xFFFFFF)
- _rDevice.SetLineColor(aRowBackground);
+ // use alternating default colors
+ Color const fieldColor = _rStyle.GetFieldColor();
+ if ( _rStyle.GetHighContrastMode() || ( ( m_pImpl->nCurrentRow % 2 ) == 0 ) )
+ {
+ backgroundColor = fieldColor;
+ }
else
- _rDevice.SetLineColor(line);
+ {
+ Color hilightColor = _rStyle.GetHighlightColor();
+ hilightColor.SetRed( 9 * ( fieldColor.GetRed() - hilightColor.GetRed() ) / 10 + hilightColor.GetRed() );
+ hilightColor.SetGreen( 9 * ( fieldColor.GetGreen() - hilightColor.GetGreen() ) / 10 + hilightColor.GetGreen() );
+ hilightColor.SetBlue( 9 * ( fieldColor.GetBlue() - hilightColor.GetBlue() ) / 10 + hilightColor.GetBlue() );
+ backgroundColor = hilightColor;
+ }
}
- //fill the rows with alternating background colors if second background color is specified
- else if(aRowBackground != fieldColor && line == 0xFFFFFF)
- _rDevice.SetLineColor(aRowBackground);
else
{
- //if Line color is set, then it was user defined and should be visible
- //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible
- _rDevice.SetLineColor(line);
+ if ( aRowColors->empty() )
+ {
+ // all colors have the same background color
+ backgroundColor = _rStyle.GetFieldColor();
+ }
+ else
+ {
+ backgroundColor = aRowColors->at( m_pImpl->nCurrentRow % aRowColors->size() );
+ }
}
}
- _rDevice.SetFillColor( aRowBackground );
- _rDevice.DrawRect( _rRowArea );
- // TODO: active?
+ //m_pImpl->bUseGridLines ? _rDevice.SetLineColor( lineColor ) : _rDevice.SetLineColor();
+ _rDevice.SetLineColor();
+ _rDevice.SetFillColor( backgroundColor );
+ _rDevice.DrawRect( _rRowArea );
_rDevice.Pop();
+
(void)_bActive;
+ // row containing the active cell not rendered any special at the moment
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void GridTableRenderer::PaintRowHeader( bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea,
- const StyleSettings& _rStyle, rtl::OUString& _rText )
+ const StyleSettings& _rStyle )
{
- _rDevice.Push( PUSH_LINECOLOR);
- _rDevice.SetLineColor(_rStyle.GetSeparatorColor());
+ _rDevice.Push( PUSH_LINECOLOR | PUSH_TEXTCOLOR );
+
+ ::boost::optional< ::Color > const aLineColor( m_pImpl->rModel.getLineColor() );
+ ::Color const lineColor = !aLineColor ? _rStyle.GetSeparatorColor() : *aLineColor;
+ _rDevice.SetLineColor( lineColor );
_rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
- if(m_pImpl->rModel.getTextColor() != 0x000000)
- _rDevice.SetTextColor(m_pImpl->rModel.getTextColor());
- else
- _rDevice.SetTextColor(_rStyle.GetFieldTextColor());
- sal_uLong nHorFlag = TEXT_DRAW_LEFT;
- sal_uLong nVerFlag = TEXT_DRAW_TOP;
- if(m_pImpl->rModel.getVerticalAlign() == 1)
- nVerFlag = TEXT_DRAW_VCENTER;
- else if(m_pImpl->rModel.getVerticalAlign() == 2)
- nVerFlag = TEXT_DRAW_BOTTOM;
- if(m_pImpl->rModel.getColumnModel(0)->getHorizontalAlign() == 1)
- nHorFlag = TEXT_DRAW_CENTER;
- else if(m_pImpl->rModel.getColumnModel(0)->getHorizontalAlign() == 2)
- nHorFlag = TEXT_DRAW_RIGHT;
- Rectangle aRect(_rArea);
- aRect.Left()+=4; aRect.Right()-=4;
- aRect.Bottom()-=2;
- _rDevice.DrawText( aRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP);
+
+ Any const rowHeading( m_pImpl->rModel.getRowHeading( m_pImpl->nCurrentRow ) );
+ ::rtl::OUString const rowTitle( CellValueConversion::convertToString( rowHeading ) );
+ if ( rowTitle.getLength() )
+ {
+ ::Color const textColor = lcl_getEffectiveColor( m_pImpl->rModel.getHeaderTextColor(), _rStyle, &StyleSettings::GetFieldTextColor );
+ _rDevice.SetTextColor( textColor );
+
+ Rectangle const aTextRect( lcl_getTextRenderingArea( lcl_getContentArea( *m_pImpl, _rArea ) ) );
+ sal_uLong const nDrawTextFlags = lcl_getAlignmentTextDrawFlags( *m_pImpl, 0 ) | TEXT_DRAW_CLIP;
+ // TODO: is using the horizontal alignment of the 0'th column a good idea here? This is pretty ... arbitray ..
+ _rDevice.DrawText( aTextRect, rowTitle, nDrawTextFlags );
+ }
+
// TODO: active? selected?
(void)_bActive;
(void)_bSelected;
- //at the moment no special paint for selected row header
_rDevice.Pop();
}
- //--------------------------------------------------------------------
- void GridTableRenderer::PaintCellImage( ColPos _nColumn, bool _bSelected, bool _bActive,
- OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, Image* _pCellData )
- {
- _rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR);
- Color background1 = m_pImpl->rModel.getOddRowBackgroundColor();
- Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor();
- Color line = m_pImpl->rModel.getLineColor();
- //if row is selected and line color isn't user specified, set it blue
- if(_bSelected)
+ //------------------------------------------------------------------------------------------------------------------
+ struct GridTableRenderer::CellRenderContext
+ {
+ OutputDevice& rDevice;
+ Rectangle const aContentArea;
+ StyleSettings const & rStyle;
+ ColPos const nColumn;
+ bool const bSelected;
+
+ CellRenderContext( OutputDevice& i_device, Rectangle const & i_contentArea,
+ StyleSettings const & i_style, ColPos const i_column, bool const i_selected )
+ :rDevice( i_device )
+ ,aContentArea( i_contentArea )
+ ,rStyle( i_style )
+ ,nColumn( i_column )
+ ,bSelected( i_selected )
{
- if(line == 0xFFFFFF)
- _rDevice.SetLineColor(_rStyle.GetHighlightColor());
- else
- _rDevice.SetLineColor(line);
}
- //else set line color to the color of row background
- else
+ };
+
+ //------------------------------------------------------------------------------------------------------------------
+ void GridTableRenderer::PaintCell( ColPos const i_column, bool _bSelected, bool _bActive,
+ OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle )
+ {
+ _rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
+
+ Rectangle const aContentArea( lcl_getContentArea( *m_pImpl, _rArea ) );
+ CellRenderContext const aRenderContext( _rDevice, aContentArea, _rStyle, i_column, _bSelected );
+ impl_paintCellContent( aRenderContext );
+
+ if ( m_pImpl->bUseGridLines )
{
- if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2)
- {
- if(line == 0xFFFFFF)
- _rDevice.SetLineColor(background2);
- else
- _rDevice.SetLineColor(line);
- }
- else if(background1 != 0xFFFFFF && line == 0xFFFFFF)
- _rDevice.SetLineColor(background1);
- else
+ ::boost::optional< ::Color > aLineColor( m_pImpl->rModel.getLineColor() );
+ ::Color lineColor = !aLineColor ? _rStyle.GetSeparatorColor() : *aLineColor;
+
+ if ( _bSelected && !aLineColor )
{
- //if line color is set, then it was user defined and should be visible
- //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible
- _rDevice.SetLineColor(line);
+ // if no line color is specified by the model, use the usual selection color for lines in selected cells
+ lineColor = _rStyle.GetHighlightColor();
}
- }
- _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
- Rectangle aRect( _rArea );
- ++aRect.Left(); --aRect.Right();
- aRect.Top(); aRect.Bottom();
- Point imagePos(Point(aRect.Left(), aRect.Top()));
- Size imageSize = _pCellData->GetSizePixel();
- if(aRect.GetWidth() > imageSize.Width())
- {
- if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 1)
- imagePos.X() = aRect.Left()+((double)(aRect.GetWidth() - imageSize.Width()))/2;
- else if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 2)
- imagePos.X() = aRect.Right() - imageSize.Width();
- }
- else
- imageSize.Width() = aRect.GetWidth();
- if(aRect.GetHeight() > imageSize.Height())
- {
- if(m_pImpl->rModel.getVerticalAlign() == 1)
- imagePos.Y() = aRect.Top()+((double)(aRect.GetHeight() - imageSize.Height()))/2;
- else if(m_pImpl->rModel.getVerticalAlign() == 2)
- imagePos.Y() = aRect.Bottom() - imageSize.Height();
+ _rDevice.SetLineColor( lineColor );
+ _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
+ _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
}
- else
- imageSize.Height() = aRect.GetHeight()-1;
- Image& image (*_pCellData);
- _rDevice.DrawImage(imagePos, imageSize, image, 0);
+
_rDevice.Pop();
(void)_bActive;
// no special painting for the active cell at the moment
}
- //--------------------------------------------------------------------
- void GridTableRenderer::PaintCellString( ColPos _nColumn, bool _bSelected, bool _bActive,
- OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, rtl::OUString& _rText )
- {
- _rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
- Color background1 = m_pImpl->rModel.getOddRowBackgroundColor();
- Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor();
- Color line = m_pImpl->rModel.getLineColor();
- //if row is selected and line color isn't user specified, set it blue
- if(_bSelected)
+ //------------------------------------------------------------------------------------------------------------------
+ void GridTableRenderer::impl_paintCellImage( CellRenderContext const & i_context, Image const & i_image )
+ {
+ Point imagePos( Point( i_context.aContentArea.Left(), i_context.aContentArea.Top() ) );
+ Size imageSize = i_image.GetSizePixel();
+ if ( i_context.aContentArea.GetWidth() > imageSize.Width() )
{
- if(line == 0xFFFFFF)
- _rDevice.SetLineColor(_rStyle.GetHighlightColor());
- else
- _rDevice.SetLineColor(line);
+ const HorizontalAlignment eHorzAlign = m_pImpl->rModel.getColumnModel( i_context.nColumn )->getHorizontalAlign();
+ switch ( eHorzAlign )
+ {
+ case HorizontalAlignment_CENTER:
+ imagePos.X() += ( i_context.aContentArea.GetWidth() - imageSize.Width() ) / 2;
+ break;
+ case HorizontalAlignment_RIGHT:
+ imagePos.X() = i_context.aContentArea.Right() - imageSize.Width();
+ break;
+ default:
+ break;
+ }
+
}
- //else set line color to the color of row background
else
+ imageSize.Width() = i_context.aContentArea.GetWidth();
+
+ if ( i_context.aContentArea.GetHeight() > imageSize.Height() )
{
- if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2)
+ const VerticalAlignment eVertAlign = m_pImpl->rModel.getVerticalAlign();
+ switch ( eVertAlign )
{
- if(line == 0xFFFFFF)
- _rDevice.SetLineColor(background2);
- else
- _rDevice.SetLineColor(line);
- }
- else if(background1 != 0xFFFFFF && line == 0xFFFFFF)
- _rDevice.SetLineColor(background1);
- else
- {
- //if Line color is set, then it was user defined and should be visible
- //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible
- _rDevice.SetLineColor(line);
+ case VerticalAlignment_MIDDLE:
+ imagePos.Y() += ( i_context.aContentArea.GetHeight() - imageSize.Height() ) / 2;
+ break;
+ case VerticalAlignment_BOTTOM:
+ imagePos.Y() = i_context.aContentArea.Bottom() - imageSize.Height();
+ break;
+ default:
+ break;
}
}
- _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
+ else
+ imageSize.Height() = i_context.aContentArea.GetHeight() - 1;
+
+ i_context.rDevice.DrawImage( imagePos, imageSize, i_image, 0 );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void GridTableRenderer::impl_paintCellContent( CellRenderContext const & i_context )
+ {
+ Any aCellContent;
+ m_pImpl->rModel.getCellContent( i_context.nColumn, m_pImpl->nCurrentRow, aCellContent );
+
+ if ( aCellContent.getValueTypeClass() == TypeClass_INTERFACE )
+ {
+ Reference< XInterface > const xContentInterface( aCellContent, UNO_QUERY );
+ if ( !xContentInterface.is() )
+ // allowed. kind of.
+ return;
- Rectangle aRect( _rArea );
- ++aRect.Left(); --aRect.Right();
- aRect.Top(); aRect.Bottom();
- if(_bSelected)
- _rDevice.SetTextColor(_rStyle.GetHighlightTextColor());
- else if(m_pImpl->rModel.getTextColor() != 0x000000)
- _rDevice.SetTextColor(m_pImpl->rModel.getTextColor());
+ Reference< XGraphic > const xGraphic( aCellContent, UNO_QUERY );
+ ENSURE_OR_RETURN_VOID( xGraphic.is(), "GridTableRenderer::impl_paintCellContent: only XGraphic interfaces (or NULL) are supported for painting." );
+
+ const Image aImage( xGraphic );
+ impl_paintCellImage( i_context, aImage );
+ return;
+ }
+
+ const ::rtl::OUString sText( CellValueConversion::convertToString( aCellContent ) );
+ impl_paintCellText( i_context, sText );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void GridTableRenderer::impl_paintCellText( CellRenderContext const & i_context, ::rtl::OUString const & i_text )
+ {
+ if ( i_context.bSelected )
+ i_context.rDevice.SetTextColor( i_context.rStyle.GetHighlightTextColor() );
else
- _rDevice.SetTextColor(_rStyle.GetFieldTextColor());
- sal_uLong nHorFlag = TEXT_DRAW_LEFT;
- sal_uLong nVerFlag = TEXT_DRAW_TOP;
- if(m_pImpl->rModel.getVerticalAlign() == 1)
- nVerFlag = TEXT_DRAW_VCENTER;
- else if(m_pImpl->rModel.getVerticalAlign() == 2)
- nVerFlag = TEXT_DRAW_BOTTOM;
- if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 1)
- nHorFlag = TEXT_DRAW_CENTER;
- else if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 2)
- nHorFlag = TEXT_DRAW_RIGHT;
- Rectangle textRect(_rArea);
- textRect.Left()+=4; textRect.Right()-=4;
- textRect.Bottom()-=2;
- _rDevice.DrawText( textRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP);
+ {
+ ::Color const textColor = lcl_getEffectiveColor( m_pImpl->rModel.getTextColor(), i_context.rStyle, &StyleSettings::GetFieldTextColor );
+ i_context.rDevice.SetTextColor( textColor );
+ }
- _rDevice.Pop();
- (void)_bActive;
- // no special painting for the active cell at the moment
+ Rectangle const textRect( lcl_getTextRenderingArea( i_context.aContentArea ) );
+ sal_uLong const nDrawTextFlags = lcl_getAlignmentTextDrawFlags( *m_pImpl, i_context.nColumn ) | TEXT_DRAW_CLIP;
+ i_context.rDevice.DrawText( textRect, i_text, nDrawTextFlags );
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void GridTableRenderer::ShowCellCursor( Window& _rView, const Rectangle& _rCursorRect)
{
_rView.ShowFocus( _rCursorRect );
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void GridTableRenderer::HideCellCursor( Window& _rView, const Rectangle& _rCursorRect)
{
- (void)_rCursorRect;
+ (void)_rCursorRect;
_rView.HideFocus();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool GridTableRenderer::FitsIntoCell( Any const & i_cellContent, ColPos const i_colPos, RowPos const i_rowPos,
+ bool const i_active, bool const i_selected, OutputDevice& i_targetDevice, Rectangle const & i_targetArea )
+ {
+ if ( !i_cellContent.hasValue() )
+ return true;
+
+ if ( i_cellContent.getValueTypeClass() == TypeClass_INTERFACE )
+ {
+ Reference< XInterface > const xContentInterface( i_cellContent, UNO_QUERY );
+ if ( !xContentInterface.is() )
+ return true;
+
+ Reference< XGraphic > const xGraphic( i_cellContent, UNO_QUERY );
+ if ( xGraphic.is() )
+ // for the moment, assume it fits. We can always scale it down during painting ...
+ return true;
+
+ OSL_ENSURE( false, "GridTableRenderer::FitsIntoCell: only XGraphic interfaces (or NULL) are supported for painting." );
+ return true;
+ }
+
+ ::rtl::OUString const sText( CellValueConversion::convertToString( i_cellContent ) );
+ if ( sText.getLength() == 0 )
+ return true;
+
+ Rectangle const aTargetArea( lcl_getTextRenderingArea( lcl_getContentArea( *m_pImpl, i_targetArea ) ) );
+
+ long const nTextHeight = i_targetDevice.GetTextHeight();
+ if ( nTextHeight > aTargetArea.GetHeight() )
+ return false;
+
+ long const nTextWidth = i_targetDevice.GetTextWidth( sText );
+ if ( nTextWidth > aTargetArea.GetWidth() )
+ return false;
+ OSL_UNUSED( i_active );
+ OSL_UNUSED( i_selected );
+ OSL_UNUSED( i_rowPos );
+ OSL_UNUSED( i_colPos );
+ return true;
}
-//........................................................................
+//......................................................................................................................
} } // namespace svt::table
-//........................................................................
+//......................................................................................................................
diff --git a/svtools/source/table/mousefunction.cxx b/svtools/source/table/mousefunction.cxx
new file mode 100755
index 000000000000..20d505e911e9
--- /dev/null
+++ b/svtools/source/table/mousefunction.cxx
@@ -0,0 +1,320 @@
+/*************************************************************************
+ * 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.
+ *
+ ************************************************************************/
+
+#include "precompiled_svtools.hxx"
+
+#include "mousefunction.hxx"
+#include "svtools/table/tablecontrolinterface.hxx"
+
+#include <tools/diagnose_ex.h>
+#include <vcl/window.hxx>
+
+//......................................................................................................................
+namespace svt { namespace table
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= MouseFunction
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ oslInterlockedCount MouseFunction::acquire()
+ {
+ return osl_incrementInterlockedCount( &m_refCount );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ oslInterlockedCount MouseFunction::release()
+ {
+ oslInterlockedCount newCount = osl_decrementInterlockedCount( &m_refCount );
+ if ( newCount == 0 )
+ {
+ delete this;
+ return 0;
+ }
+ return newCount;
+ }
+
+ //==================================================================================================================
+ //= ColumnResize
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ FunctionResult ColumnResize::handleMouseMove( ITableControl& i_tableControl, MouseEvent const & i_event )
+ {
+ Point const aPoint = i_event.GetPosPixel();
+
+ if ( m_nResizingColumn == COL_INVALID )
+ {
+ // if we hit a column divider, change the mosue pointer accordingly
+ Pointer aNewPointer( POINTER_ARROW );
+ TableCell const tableCell = i_tableControl.hitTest( aPoint );
+ if ( ( tableCell.nRow == ROW_COL_HEADERS ) && ( tableCell.eArea == ColumnDivider ) )
+ {
+ aNewPointer = Pointer( POINTER_HSPLIT );
+ }
+ i_tableControl.setPointer( aNewPointer );
+
+ return SkipFunction; // TODO: is this correct?
+ }
+
+ ::Size const tableSize = i_tableControl.getTableSizePixel();
+
+ // set proper pointer
+ Pointer aNewPointer( POINTER_ARROW );
+ ColumnMetrics const & columnMetrics( i_tableControl.getColumnMetrics( m_nResizingColumn ) );
+ if ( ( aPoint.X() > tableSize.Width() )
+ || ( aPoint.X() < columnMetrics.nStartPixel )
+ )
+ {
+ aNewPointer = Pointer( POINTER_NOTALLOWED );
+ }
+ else
+ {
+ aNewPointer = Pointer( POINTER_HSPLIT );
+ }
+ i_tableControl.setPointer( aNewPointer );
+
+ // show tracking line
+ i_tableControl.hideTracking();
+ i_tableControl.showTracking(
+ Rectangle(
+ Point( aPoint.X(), 0 ),
+ Size( 1, tableSize.Height() )
+ ),
+ SHOWTRACK_SPLIT | SHOWTRACK_WINDOW
+ );
+
+ (void)i_event;
+ return ContinueFunction;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ FunctionResult ColumnResize::handleMouseDown( ITableControl& i_tableControl, MouseEvent const & i_event )
+ {
+ if ( m_nResizingColumn != COL_INVALID )
+ {
+ OSL_ENSURE( false, "ColumnResize::handleMouseDown: suspicious: MouseButtonDown while still tracking?" );
+ return ContinueFunction;
+ }
+
+ TableCell const tableCell( i_tableControl.hitTest( i_event.GetPosPixel() ) );
+ if ( tableCell.nRow == ROW_COL_HEADERS )
+ {
+ if ( ( tableCell.nColumn != COL_INVALID )
+ && ( tableCell.eArea == ColumnDivider )
+ )
+ {
+ m_nResizingColumn = tableCell.nColumn;
+ i_tableControl.captureMouse();
+ return ActivateFunction;
+ }
+ }
+
+ return SkipFunction;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ FunctionResult ColumnResize::handleMouseUp( ITableControl& i_tableControl, MouseEvent const & i_event )
+ {
+ if ( m_nResizingColumn == COL_INVALID )
+ return SkipFunction;
+
+ Point const aPoint = i_event.GetPosPixel();
+
+ i_tableControl.hideTracking();
+ PColumnModel const pColumn = i_tableControl.getModel()->getColumnModel( m_nResizingColumn );
+ long const maxWidthLogical = pColumn->getMaxWidth();
+ long const minWidthLogical = pColumn->getMinWidth();
+
+ // new position of mouse
+ long const requestedEnd = aPoint.X();
+
+ // old position of right border
+ long const oldEnd = i_tableControl.getColumnMetrics( m_nResizingColumn ).nEndPixel;
+
+ // position of left border if cursor in the to-be-resized column
+ long const columnStart = i_tableControl.getColumnMetrics( m_nResizingColumn ).nStartPixel;
+ long const requestedWidth = requestedEnd - columnStart;
+ // TODO: this is not correct, strictly: It assumes that the mouse was pressed exactly on the "end" pos,
+ // but for a while now, we have relaxed this, and allow clicking a few pixels aside, too
+
+ if ( requestedEnd >= columnStart )
+ {
+ long requestedWidthLogical = i_tableControl.pixelWidthToAppFont( requestedWidth );
+ // respect column width limits
+ if ( oldEnd > requestedEnd )
+ {
+ // column has become smaller, check against minimum width
+ if ( ( minWidthLogical != 0 ) && ( requestedWidthLogical < minWidthLogical ) )
+ requestedWidthLogical = minWidthLogical;
+ }
+ else if ( oldEnd < requestedEnd )
+ {
+ // column has become larger, check against max width
+ if ( ( maxWidthLogical != 0 ) && ( requestedWidthLogical >= maxWidthLogical ) )
+ requestedWidthLogical = maxWidthLogical;
+ }
+ pColumn->setWidth( requestedWidthLogical );
+ i_tableControl.invalidate( TableAreaAll );
+ }
+
+ i_tableControl.setPointer( Pointer() );
+ i_tableControl.releaseMouse();
+
+ m_nResizingColumn = COL_INVALID;
+ return DeactivateFunction;
+ }
+
+ //==================================================================================================================
+ //= RowSelection
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ FunctionResult RowSelection::handleMouseMove( ITableControl& i_tableControl, MouseEvent const & i_event )
+ {
+ OSL_UNUSED( i_tableControl );
+ OSL_UNUSED( i_event );
+ return SkipFunction;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ FunctionResult RowSelection::handleMouseDown( ITableControl& i_tableControl, MouseEvent const & i_event )
+ {
+ bool handled = false;
+
+ TableCell const tableCell( i_tableControl.hitTest( i_event.GetPosPixel() ) );
+ if ( tableCell.nRow >= 0 )
+ {
+ bool bSetCursor = false;
+ if ( i_tableControl.getSelEngine()->GetSelectionMode() == NO_SELECTION )
+ {
+ bSetCursor = true;
+ }
+ else
+ {
+ if ( !i_tableControl.isRowSelected( tableCell.nRow ) )
+ {
+ handled = i_tableControl.getSelEngine()->SelMouseButtonDown( i_event );
+ }
+ else
+ {
+ bSetCursor = true;
+ }
+ }
+
+ if ( bSetCursor )
+ {
+ i_tableControl.activateCell( tableCell.nColumn, tableCell.nRow );
+ handled = true;
+ }
+ }
+
+ if ( handled )
+ m_bActive = true;
+ return handled ? ActivateFunction : SkipFunction;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ FunctionResult RowSelection::handleMouseUp( ITableControl& i_tableControl, MouseEvent const & i_event )
+ {
+ TableCell const tableCell = i_tableControl.hitTest( i_event.GetPosPixel() );
+ if ( tableCell.nRow >= 0 )
+ {
+ if ( i_tableControl.getSelEngine()->GetSelectionMode() != NO_SELECTION )
+ {
+ i_tableControl.getSelEngine()->SelMouseButtonUp( i_event );
+ }
+ }
+ if ( m_bActive )
+ {
+ m_bActive = false;
+ return DeactivateFunction;
+ }
+ return SkipFunction;
+ }
+
+ //==================================================================================================================
+ //= ColumnSortHandler
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ FunctionResult ColumnSortHandler::handleMouseMove( ITableControl& i_tableControl, MouseEvent const & i_event )
+ {
+ OSL_UNUSED( i_tableControl );
+ OSL_UNUSED( i_event );
+ return SkipFunction;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ FunctionResult ColumnSortHandler::handleMouseDown( ITableControl& i_tableControl, MouseEvent const & i_event )
+ {
+ if ( m_nActiveColumn != COL_INVALID )
+ {
+ OSL_ENSURE( false, "ColumnSortHandler::handleMouseDown: called while already active - suspicious!" );
+ return ContinueFunction;
+ }
+
+ if ( i_tableControl.getModel()->getSortAdapter() == NULL )
+ // no sorting support at the model
+ return SkipFunction;
+
+ TableCell const tableCell( i_tableControl.hitTest( i_event.GetPosPixel() ) );
+ if ( ( tableCell.nRow != ROW_COL_HEADERS ) || ( tableCell.nColumn < 0 ) )
+ return SkipFunction;
+
+ // TODO: ensure the column header is rendered in some special way, indicating its current state
+
+ m_nActiveColumn = tableCell.nColumn;
+ return ActivateFunction;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ FunctionResult ColumnSortHandler::handleMouseUp( ITableControl& i_tableControl, MouseEvent const & i_event )
+ {
+ if ( m_nActiveColumn == COL_INVALID )
+ return SkipFunction;
+
+ TableCell const tableCell( i_tableControl.hitTest( i_event.GetPosPixel() ) );
+ if ( ( tableCell.nRow == ROW_COL_HEADERS ) && ( tableCell.nColumn == m_nActiveColumn ) )
+ {
+ ITableDataSort* pSort = i_tableControl.getModel()->getSortAdapter();
+ ENSURE_OR_RETURN( pSort != NULL, "ColumnSortHandler::handleMouseUp: somebody is mocking with us!", DeactivateFunction );
+ // in handleMousButtonDown, the model claimed to have sort support ...
+
+ ColumnSortDirection eSortDirection = ColumnSortAscending;
+ ColumnSort const aCurrentSort = pSort->getCurrentSortOrder();
+ if ( aCurrentSort.nColumnPos == m_nActiveColumn )
+ // invert existing sort order
+ eSortDirection = ( aCurrentSort.eSortDirection == ColumnSortAscending ) ? ColumnSortDescending : ColumnSortAscending;
+
+ pSort->sortByColumn( m_nActiveColumn, eSortDirection );
+ }
+
+ m_nActiveColumn = COL_INVALID;
+ return DeactivateFunction;
+ }
+
+//......................................................................................................................
+} } // namespace svt::table
+//......................................................................................................................
diff --git a/svtools/source/table/mousefunction.hxx b/svtools/source/table/mousefunction.hxx
new file mode 100755
index 000000000000..2149026a0923
--- /dev/null
+++ b/svtools/source/table/mousefunction.hxx
@@ -0,0 +1,161 @@
+/*************************************************************************
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef SVTOOLS_MOUSEFUNCTION_HXX
+#define SVTOOLS_MOUSEFUNCTION_HXX
+
+#include "svtools/table/tabletypes.hxx"
+
+#include <rtl/ref.hxx>
+
+#include <boost/noncopyable.hpp>
+
+class MouseEvent;
+
+//......................................................................................................................
+namespace svt { namespace table
+{
+//......................................................................................................................
+
+ class ITableControl;
+
+ //==================================================================================================================
+ //= FunctionResult
+ //==================================================================================================================
+ enum FunctionResult
+ {
+ ActivateFunction,
+ ContinueFunction,
+ DeactivateFunction,
+
+ SkipFunction
+ };
+
+ //==================================================================================================================
+ //= IMouseFunction
+ //==================================================================================================================
+ class IMouseFunction : public ::rtl::IReference, public ::boost::noncopyable
+ {
+ public:
+ virtual FunctionResult handleMouseMove( ITableControl& i_tableControl, MouseEvent const & i_event ) = 0;
+ virtual FunctionResult handleMouseDown( ITableControl& i_tableControl, MouseEvent const & i_event ) = 0;
+ virtual FunctionResult handleMouseUp( ITableControl& i_tableControl, MouseEvent const & i_event ) = 0;
+
+ protected:
+ virtual ~IMouseFunction() { }
+ };
+
+ //==================================================================================================================
+ //= MouseFunction
+ //==================================================================================================================
+ class MouseFunction : public IMouseFunction
+ {
+ public:
+ MouseFunction()
+ :m_refCount( 0 )
+ {
+ }
+ protected:
+ ~MouseFunction()
+ {
+ }
+
+ public:
+ virtual oslInterlockedCount SAL_CALL acquire();
+ virtual oslInterlockedCount SAL_CALL release();
+
+ private:
+ oslInterlockedCount m_refCount;
+ };
+
+ //==================================================================================================================
+ //= ColumnResize
+ //==================================================================================================================
+ class ColumnResize : public MouseFunction
+ {
+ public:
+ ColumnResize()
+ :m_nResizingColumn( COL_INVALID )
+ {
+ }
+
+ public:
+ // IMouseFunction
+ virtual FunctionResult handleMouseMove( ITableControl& i_tableControl, MouseEvent const & i_event );
+ virtual FunctionResult handleMouseDown( ITableControl& i_tableControl, MouseEvent const & i_event );
+ virtual FunctionResult handleMouseUp( ITableControl& i_tableControl, MouseEvent const & i_event );
+
+ private:
+ ColPos m_nResizingColumn;
+ };
+
+ //==================================================================================================================
+ //= RowSelection
+ //==================================================================================================================
+ class RowSelection : public MouseFunction
+ {
+ public:
+ RowSelection()
+ :m_bActive( false )
+ {
+ }
+
+ public:
+ // IMouseFunction
+ virtual FunctionResult handleMouseMove( ITableControl& i_tableControl, MouseEvent const & i_event );
+ virtual FunctionResult handleMouseDown( ITableControl& i_tableControl, MouseEvent const & i_event );
+ virtual FunctionResult handleMouseUp( ITableControl& i_tableControl, MouseEvent const & i_event );
+
+ private:
+ bool m_bActive;
+ };
+
+ //==================================================================================================================
+ //= ColumnSortHandler
+ //==================================================================================================================
+ class ColumnSortHandler : public MouseFunction
+ {
+ public:
+ ColumnSortHandler()
+ :m_nActiveColumn( COL_INVALID )
+ {
+ }
+
+ public:
+ // IMouseFunction
+ virtual FunctionResult handleMouseMove( ITableControl& i_tableControl, MouseEvent const & i_event );
+ virtual FunctionResult handleMouseDown( ITableControl& i_tableControl, MouseEvent const & i_event );
+ virtual FunctionResult handleMouseUp( ITableControl& i_tableControl, MouseEvent const & i_event );
+
+ private:
+ ColPos m_nActiveColumn;
+ };
+
+//......................................................................................................................
+} } // namespace svt::table
+//......................................................................................................................
+
+#endif // SVTOOLS_MOUSEFUNCTION_HXX
diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx
index d6122e7917a0..01a9b667a8f7 100644
--- a/svtools/source/table/tablecontrol.cxx
+++ b/svtools/source/table/tablecontrol.cxx
@@ -28,55 +28,39 @@
#include "precompiled_svtools.hxx"
#include "svtools/table/tablecontrol.hxx"
+
#include "tablegeometry.hxx"
#include "tablecontrol_impl.hxx"
-#include "accessibletableimp.hxx"
-#include "svtools/table/tabledatawindow.hxx"
+#include "tabledatawindow.hxx"
+
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <tools/diagnose_ex.h>
+
using namespace ::com::sun::star::uno;
using ::com::sun::star::accessibility::XAccessible;
using namespace ::com::sun::star::accessibility;
using namespace ::com::sun::star::lang;
using namespace utl;
-//using namespace rtl;
-//........................................................................
+
+//......................................................................................................................
namespace svt { namespace table
{
- //====================================================================
- //= AccessibleTableControl_Impl
- //====================================================================
- // ----------------------------------------------------------------------------
- Reference< XAccessible > AccessibleTableControl_Impl::getAccessibleTableHeader( AccessibleTableControlObjType _eObjType )
- {
- if ( m_pAccessible && m_pAccessible->isAlive() )
- return m_pAccessible->getTableHeader( _eObjType );
- return NULL;
- }
- // ----------------------------------------------------------------------------
- Reference< XAccessible > AccessibleTableControl_Impl::getAccessibleTable( )
- {
- if ( m_pAccessible && m_pAccessible->isAlive() )
- return m_pAccessible->getTable( );
- return NULL;
- }
+//......................................................................................................................
- //====================================================================
+ //==================================================================================================================
//= TableControl
- //====================================================================
- //--------------------------------------------------------------------
+ //==================================================================================================================
+ // -----------------------------------------------------------------------------------------------------------------
TableControl::TableControl( Window* _pParent, WinBits _nStyle )
:Control( _pParent, _nStyle )
,m_pImpl( new TableControl_Impl( *this ) )
- ,m_bSelectionChanged(false)
- ,m_bTooltip(false)
{
- TableDataWindow* aTableData = m_pImpl->getDataWindow();
- aTableData->SetMouseButtonDownHdl( LINK( this, TableControl, ImplMouseButtonDownHdl ) );
- aTableData->SetMouseButtonUpHdl( LINK( this, TableControl, ImplMouseButtonUpHdl ) );
- aTableData->SetSelectHdl( LINK( this, TableControl, ImplSelectHdl ) );
- m_pAccessTable.reset(new ::svt::table::AccessibleTableControl_Impl());
+ TableDataWindow& rDataWindow = m_pImpl->getDataWindow();
+ rDataWindow.SetMouseButtonDownHdl( LINK( this, TableControl, ImplMouseButtonDownHdl ) );
+ rDataWindow.SetMouseButtonUpHdl( LINK( this, TableControl, ImplMouseButtonUpHdl ) );
+ rDataWindow.SetSelectHdl( LINK( this, TableControl, ImplSelectHdl ) );
// by default, use the background as determined by the style settings
const Color aWindowColor( GetSettings().GetStyleSettings().GetFieldColor() );
@@ -84,51 +68,39 @@ namespace svt { namespace table
SetFillColor( aWindowColor );
}
- //--------------------------------------------------------------------
+ // -----------------------------------------------------------------------------------------------------------------
TableControl::~TableControl()
{
ImplCallEventListeners( VCLEVENT_OBJECT_DYING );
- DELETEZ( m_pImpl );
- if ( m_pAccessTable->m_pAccessible )
- {
- m_pAccessTable->m_pAccessible->dispose();
- }
+
+ m_pImpl->setModel( PTableModel() );
+ m_pImpl->disposeAccessible();
+ m_pImpl.reset();
}
- //--------------------------------------------------------------------
+ // -----------------------------------------------------------------------------------------------------------------
void TableControl::GetFocus()
{
if ( !m_pImpl->getInputHandler()->GetFocus( *m_pImpl ) )
- {
Control::GetFocus();
- Control::GrabFocus();
- }
}
- //--------------------------------------------------------------------
+ // -----------------------------------------------------------------------------------------------------------------
void TableControl::LoseFocus()
{
if ( !m_pImpl->getInputHandler()->LoseFocus( *m_pImpl ) )
Control::LoseFocus();
}
- //--------------------------------------------------------------------
+ // -----------------------------------------------------------------------------------------------------------------
void TableControl::KeyInput( const KeyEvent& rKEvt )
{
if ( !m_pImpl->getInputHandler()->KeyInput( *m_pImpl, rKEvt ) )
Control::KeyInput( rKEvt );
- else
- {
- if(m_bSelectionChanged)
- {
- Select();
- m_bSelectionChanged = false;
- }
- }
}
- //--------------------------------------------------------------------
+ // -----------------------------------------------------------------------------------------------------------------
void TableControl::StateChanged( StateChangedType i_nStateChange )
{
Control::StateChanged( i_nStateChange );
@@ -138,156 +110,180 @@ namespace svt { namespace table
{
case STATE_CHANGE_CONTROLBACKGROUND:
if ( IsControlBackground() )
- getDataWindow()->SetControlBackground( GetControlBackground() );
+ getDataWindow().SetControlBackground( GetControlBackground() );
else
- getDataWindow()->SetControlBackground();
+ getDataWindow().SetControlBackground();
break;
case STATE_CHANGE_CONTROLFOREGROUND:
if ( IsControlForeground() )
- getDataWindow()->SetControlForeground( GetControlForeground() );
+ getDataWindow().SetControlForeground( GetControlForeground() );
else
- getDataWindow()->SetControlForeground();
+ getDataWindow().SetControlForeground();
break;
case STATE_CHANGE_CONTROLFONT:
if ( IsControlFont() )
- getDataWindow()->SetControlFont( GetControlFont() );
+ getDataWindow().SetControlFont( GetControlFont() );
else
- getDataWindow()->SetControlFont();
+ getDataWindow().SetControlFont();
break;
}
}
- //--------------------------------------------------------------------
+ // -----------------------------------------------------------------------------------------------------------------
void TableControl::Resize()
{
Control::Resize();
m_pImpl->onResize();
}
- //--------------------------------------------------------------------
+ // -----------------------------------------------------------------------------------------------------------------
void TableControl::SetModel( PTableModel _pModel )
{
m_pImpl->setModel( _pModel );
}
- //--------------------------------------------------------------------
+ // -----------------------------------------------------------------------------------------------------------------
PTableModel TableControl::GetModel() const
{
return m_pImpl->getModel();
}
- //--------------------------------------------------------------------
+ // -----------------------------------------------------------------------------------------------------------------
RowPos TableControl::GetTopRow() const
{
return m_pImpl->getTopRow();
}
- //--------------------------------------------------------------------
+ // -----------------------------------------------------------------------------------------------------------------
void TableControl::SetTopRow( RowPos _nRow )
{
- // TODO
- (void)_nRow;
+ OSL_ENSURE( false, "TableControl::SetTopRow: not implemented!" );
+ OSL_UNUSED( _nRow );
}
- //--------------------------------------------------------------------
+ // -----------------------------------------------------------------------------------------------------------------
sal_Int32 TableControl::GetCurrentRow() const
{
- return m_pImpl->getCurRow();
+ return m_pImpl->getCurrentRow();
}
- //--------------------------------------------------------------------
+ // -----------------------------------------------------------------------------------------------------------------
sal_Int32 TableControl::GetCurrentColumn() const
{
- return m_pImpl->getCurColumn();
+ return m_pImpl->getCurrentColumn();
}
- //--------------------------------------------------------------------
+ // -----------------------------------------------------------------------------------------------------------------
bool TableControl::GoTo( ColPos _nColumn, RowPos _nRow )
{
return m_pImpl->goTo( _nColumn, _nRow );
}
- //--------------------------------------------------------------------
+
+ // -----------------------------------------------------------------------------------------------------------------
sal_Bool TableControl::GoToCell(sal_Int32 _nColPos, sal_Int32 _nRowPos)
{
return m_pImpl->goTo( _nColPos, _nRowPos );
}
- //--------------------------------------------------------------------
- void TableControl::clearSelection()
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Int32 TableControl::GetSelectedRowCount() const
+ {
+ return sal_Int32( m_pImpl->getSelectedRowCount() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Int32 TableControl::GetSelectedRowIndex( sal_Int32 const i_selectionIndex ) const
{
- m_pImpl->clearSelection();
+ return sal_Int32( m_pImpl->getSelectedRowIndex( i_selectionIndex ) );
}
- //--------------------------------------------------------------------
- void TableControl::InvalidateDataWindow(RowPos _nRowStart, RowPos _nRowEnd, bool _bRemoved)
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool TableControl::IsRowSelected( sal_Int32 const i_rowIndex ) const
{
- Rectangle _rRect;
- if(_bRemoved)
- m_pImpl->invalidateRows();
+ return m_pImpl->isRowSelected( i_rowIndex );
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ void TableControl::SelectRow( RowPos const i_rowIndex, bool const i_select )
+ {
+ ENSURE_OR_RETURN_VOID( ( i_rowIndex >= 0 ) && ( i_rowIndex < m_pImpl->getModel()->getRowCount() ),
+ "TableControl::SelectRow: no control (anymore)!" );
+
+ if ( i_select )
+ {
+ if ( !m_pImpl->markRowAsSelected( i_rowIndex ) )
+ // nothing to do
+ return;
+ }
else
{
- if(m_bSelectionChanged)
- {
- m_pImpl->invalidateSelectedRegion(_nRowStart, _nRowEnd, _rRect);
- m_bSelectionChanged = false;
- }
- else
- m_pImpl->invalidateRow(_nRowStart, _rRect);
+ m_pImpl->markRowAsDeselected( i_rowIndex );
}
+
+ m_pImpl->invalidateRowRange( i_rowIndex, i_rowIndex );
+ Select();
}
- //--------------------------------------------------------------------
- std::vector<sal_Int32>& TableControl::GetSelectedRows()
- {
- return m_pImpl->getSelectedRows();
- }
- //--------------------------------------------------------------------
- void TableControl::RemoveSelectedRow(RowPos _nRowPos)
+
+ // -----------------------------------------------------------------------------------------------------------------
+ void TableControl::SelectAllRows( bool const i_select )
{
- m_pImpl->removeSelectedRow(_nRowPos);
+ if ( i_select )
+ {
+ if ( !m_pImpl->markAllRowsAsSelected() )
+ // nothing to do
+ return;
+ }
+ else
+ {
+ if ( !m_pImpl->markAllRowsAsDeselected() )
+ // nothing to do
+ return;
+ }
+
+
+ Invalidate();
+ // TODO: can't we do better than this, and invalidate only the rows which changed?
+ Select();
}
- //--------------------------------------------------------------------
- RowPos TableControl::GetCurrentRow(const Point& rPoint)
+ // -----------------------------------------------------------------------------------------------------------------
+ ITableControl& TableControl::getTableControlInterface()
{
- return m_pImpl->getCurrentRow( rPoint );
+ return *m_pImpl;
}
+ // -----------------------------------------------------------------------------------------------------------------
SelectionEngine* TableControl::getSelEngine()
{
return m_pImpl->getSelEngine();
}
- TableDataWindow* TableControl::getDataWindow()
+ // -----------------------------------------------------------------------------------------------------------------
+ Window& TableControl::getDataWindow()
{
return m_pImpl->getDataWindow();
}
+ // -----------------------------------------------------------------------------------------------------------------
Reference< XAccessible > TableControl::CreateAccessible()
{
Window* pParent = GetAccessibleParentWindow();
- DBG_ASSERT( pParent, "TableControl::CreateAccessible - parent not found" );
+ ENSURE_OR_RETURN( pParent, "TableControl::CreateAccessible - parent not found", NULL );
- if( pParent && !m_pAccessTable->m_pAccessible)
- {
- Reference< XAccessible > xAccParent = pParent->GetAccessible();
- if( xAccParent.is() )
- {
- m_pAccessTable->m_pAccessible = getAccessibleFactory().createAccessibleTableControl(
- xAccParent, *this
- );
- }
- }
- Reference< XAccessible > xAccessible;
- if ( m_pAccessTable->m_pAccessible )
- xAccessible = m_pAccessTable->m_pAccessible->getMyself();
- return xAccessible;
+ return m_pImpl->getAccessible( *pParent );
}
+
+ // -----------------------------------------------------------------------------------------------------------------
Reference<XAccessible> TableControl::CreateAccessibleControl( sal_Int32 _nIndex )
{
(void)_nIndex;
DBG_ASSERT( sal_False, "TableControl::CreateAccessibleControl: to be overwritten!" );
return NULL;
}
+
+ // -----------------------------------------------------------------------------------------------------------------
::rtl::OUString TableControl::GetAccessibleObjectName( AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const
{
::rtl::OUString aRetText;
@@ -320,309 +316,297 @@ namespace svt { namespace table
}
return aRetText;
}
-// -----------------------------------------------------------------------------
-::rtl::OUString TableControl::GetAccessibleObjectDescription( AccessibleTableControlObjType eObjType, sal_Int32 ) const
-{
- ::rtl::OUString aRetText;
- switch( eObjType )
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString TableControl::GetAccessibleObjectDescription( AccessibleTableControlObjType eObjType, sal_Int32 ) const
{
- case TCTYPE_GRIDCONTROL:
- aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GridControl description" ) );
- break;
- case TCTYPE_TABLE:
- aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TABLE description" ) );
- break;
- case TCTYPE_ROWHEADERBAR:
- aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ROWHEADERBAR description" ) );
- break;
- case TCTYPE_COLUMNHEADERBAR:
- aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "COLUMNHEADERBAR description" ) );
- break;
- case TCTYPE_TABLECELL:
- aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TABLECELL description" ) );
- break;
- case TCTYPE_ROWHEADERCELL:
- aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ROWHEADERCELL description" ) );
- break;
- case TCTYPE_COLUMNHEADERCELL:
- aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "COLUMNHEADERCELL description" ) );
- break;
+ ::rtl::OUString aRetText;
+ switch( eObjType )
+ {
+ case TCTYPE_GRIDCONTROL:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GridControl description" ) );
+ break;
+ case TCTYPE_TABLE:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TABLE description" ) );
+ break;
+ case TCTYPE_ROWHEADERBAR:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ROWHEADERBAR description" ) );
+ break;
+ case TCTYPE_COLUMNHEADERBAR:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "COLUMNHEADERBAR description" ) );
+ break;
+ case TCTYPE_TABLECELL:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TABLECELL description" ) );
+ break;
+ case TCTYPE_ROWHEADERCELL:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ROWHEADERCELL description" ) );
+ break;
+ case TCTYPE_COLUMNHEADERCELL:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "COLUMNHEADERCELL description" ) );
+ break;
+ }
+ return aRetText;
}
- return aRetText;
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString TableControl::GetRowDescription( sal_Int32 _nRow) const
-{
- (void)_nRow;
- return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "row description" ) );
-}
-// -----------------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString TableControl::GetRowDescription( sal_Int32 _nRow) const
+ {
+ (void)_nRow;
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "row description" ) );
+ }
-::rtl::OUString TableControl::GetRowName( sal_Int32 _nIndex) const
-{
- return GetModel()->getRowHeaderName()[_nIndex];
-}
-// -----------------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString TableControl::GetRowName( sal_Int32 _nIndex) const
+ {
+ ::rtl::OUString sRowName;
+ GetModel()->getRowHeading( _nIndex ) >>= sRowName;
+ return sRowName;
+ }
-::rtl::OUString TableControl::GetColumnDescription( sal_uInt16 _nColumn) const
-{
- (void)_nColumn;
- return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "col description" ) );
-}
-// -----------------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString TableControl::GetColumnDescription( sal_uInt16 _nColumn) const
+ {
+ (void)_nColumn;
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "col description" ) );
+ }
-::rtl::OUString TableControl::GetColumnName( sal_Int32 _nIndex) const
-{
- return GetModel()->getColumnModel(_nIndex)->getName();
-}
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString TableControl::GetColumnName( sal_Int32 _nIndex) const
+ {
+ return GetModel()->getColumnModel(_nIndex)->getName();
+ }
-// -----------------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ ::com::sun::star::uno::Any TableControl::GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos ) const
+ {
+ Any aCellContent;
+ GetModel()->getCellContent( _nColPos, _nRowPos, aCellContent );
+ return aCellContent;
+ }
-::com::sun::star::uno::Any TableControl::GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const
-{
- ::com::sun::star::uno::Any cellContent(::com::sun::star::uno::Any(::rtl::OUString::createFromAscii("")));
- std::vector<std::vector< ::com::sun::star::uno::Any > >& aTableContent = GetModel()->getCellContent();
- if(&aTableContent)
- cellContent = aTableContent[_nRowPos][_nColPos];
- return cellContent;
-}
-// -----------------------------------------------------------------------------
-
-::rtl::OUString TableControl::GetAccessibleCellText( sal_Int32 _nRowPos, sal_Int32 _nColPos) const
-{
- const ::com::sun::star::uno::Any cellContent = GetCellContent(_nRowPos, _nColPos);
- return m_pImpl->convertToString(cellContent);
-}
-// -----------------------------------------------------------------------------
-
-void TableControl::FillAccessibleStateSet(
- ::utl::AccessibleStateSetHelper& rStateSet,
- AccessibleTableControlObjType eObjType ) const
-{
- switch( eObjType )
- {
- case TCTYPE_GRIDCONTROL:
- case TCTYPE_TABLE:
-
- rStateSet.AddState( AccessibleStateType::FOCUSABLE );
- rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE);
- if ( HasFocus() )
- rStateSet.AddState( AccessibleStateType::FOCUSED );
- if ( IsActive() )
- rStateSet.AddState( AccessibleStateType::ACTIVE );
- if ( IsEnabled() )
- rStateSet.AddState( AccessibleStateType::ENABLED );
- if ( IsReallyVisible() )
- rStateSet.AddState( AccessibleStateType::VISIBLE );
- rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString TableControl::GetAccessibleCellText( sal_Int32 _nRowPos, sal_Int32 _nColPos) const
+ {
+ return m_pImpl->getCellContentAsString( _nRowPos, _nColPos );
+ }
- break;
- case TCTYPE_ROWHEADERBAR:
- rStateSet.AddState( AccessibleStateType::VISIBLE );
- rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
- break;
- case TCTYPE_COLUMNHEADERBAR:
- rStateSet.AddState( AccessibleStateType::VISIBLE );
- rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
- break;
- case TCTYPE_TABLECELL:
- {
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl::FillAccessibleStateSet(
+ ::utl::AccessibleStateSetHelper& rStateSet,
+ AccessibleTableControlObjType eObjType ) const
+ {
+ switch( eObjType )
+ {
+ case TCTYPE_GRIDCONTROL:
+ case TCTYPE_TABLE:
+
+ rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+ rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE);
+ if ( HasFocus() )
+ rStateSet.AddState( AccessibleStateType::FOCUSED );
+ if ( IsActive() )
+ rStateSet.AddState( AccessibleStateType::ACTIVE );
+ if ( IsEnabled() )
+ rStateSet.AddState( AccessibleStateType::ENABLED );
+ if ( IsReallyVisible() )
+ rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
+
+ break;
+ case TCTYPE_ROWHEADERBAR:
+ rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
+ break;
+ case TCTYPE_COLUMNHEADERBAR:
+ rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
+ break;
+ case TCTYPE_TABLECELL:
+ {
+ rStateSet.AddState( AccessibleStateType::TRANSIENT );
+ rStateSet.AddState( AccessibleStateType::SELECTABLE);
+ if( GetSelectedRowCount()>0)
+ rStateSet.AddState( AccessibleStateType::SELECTED);
+ }
+ break;
+ case TCTYPE_ROWHEADERCELL:
+ rStateSet.AddState( AccessibleStateType::VISIBLE );
rStateSet.AddState( AccessibleStateType::TRANSIENT );
- rStateSet.AddState( AccessibleStateType::SELECTABLE);
- if( GetSelectedRowCount()>0)
- rStateSet.AddState( AccessibleStateType::SELECTED);
- }
- break;
- case TCTYPE_ROWHEADERCELL:
- rStateSet.AddState( AccessibleStateType::VISIBLE );
- rStateSet.AddState( AccessibleStateType::TRANSIENT );
- break;
- case TCTYPE_COLUMNHEADERCELL:
- rStateSet.AddState( AccessibleStateType::VISIBLE );
- break;
+ break;
+ case TCTYPE_COLUMNHEADERCELL:
+ rStateSet.AddState( AccessibleStateType::VISIBLE );
+ break;
+ }
}
-}
-Rectangle TableControl::GetWindowExtentsRelative( Window *pRelativeWindow ) const
-{
- return Control::GetWindowExtentsRelative( pRelativeWindow );
-}
-//-----------------------------------------------------------------------------
-void TableControl::GrabFocus()
-{
- Control::GrabFocus();
-}
-// -----------------------------------------------------------------------------
-Reference< XAccessible > TableControl::GetAccessible( sal_Bool bCreate )
-{
- return Control::GetAccessible( bCreate );
-}
-// -----------------------------------------------------------------------------
-Window* TableControl::GetAccessibleParentWindow() const
-{
- return Control::GetAccessibleParentWindow();
-}
-// -----------------------------------------------------------------------------
-Window* TableControl::GetWindowInstance()
-{
- return this;
-}
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle TableControl::GetWindowExtentsRelative( Window *pRelativeWindow ) const
+ {
+ return Control::GetWindowExtentsRelative( pRelativeWindow );
+ }
-sal_Bool TableControl::HasRowHeader()
-{
- return GetModel()->hasRowHeaders();
-}
-//--------------------------------------------------------------------------------
-sal_Bool TableControl::HasColHeader()
-{
- return GetModel()->hasColumnHeaders();
-}
-//--------------------------------------------------------------------------------
-sal_Int32 TableControl::GetAccessibleControlCount() const
-{
- sal_Int32 count = 0;
- if(GetRowCount()>0)
- count+=1;
- if(GetModel()->hasRowHeaders())
- count+=1;
- if(GetModel()->hasColumnHeaders())
- count+=1;
- return count;
-}
-sal_Bool TableControl::ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint )
-{
- sal_Int32 nRow = m_pImpl->getCurrentRow(_rPoint);
- sal_Int32 nCol = GetCurrentColumn();
- _rnIndex = nRow * GetColumnCount() + nCol;
- return nRow>=0 ? sal_True : sal_False;
-}
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl::GrabFocus()
+ {
+ Control::GrabFocus();
+ }
-long TableControl::GetRowCount() const
-{
- return m_pImpl->getRowCount();
-}
-long TableControl::GetColumnCount() const
-{
- return m_pImpl->getColumnCount();
-}
-sal_Bool TableControl::HasRowHeader() const
-{
- PTableModel pModel = GetModel();
- return pModel->hasRowHeaders();
-}
-sal_Int32 TableControl::GetSelectedRowCount() const
-{
- return m_pImpl->getSelectedRows().size();
-}
-bool TableControl::IsRowSelected( long _nRow ) const
-{
- return m_pImpl->isRowSelected(m_pImpl->getSelectedRows(), _nRow);
-}
-sal_Bool TableControl::ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint )
-{
- _rnRow = m_pImpl->getCurrentRow(_rPoint);
- _rnColPos = GetCurrentColumn();
- return _rnRow>=0 ? sal_True : sal_False;
-}
-void TableControl::FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const
-{
- if ( GetCurrentRow() == _nRow && GetCurrentColumn() == _nColumnPos )
- _rStateSet.AddState( AccessibleStateType::FOCUSED );
- else // only transient when column is not focused
- _rStateSet.AddState( AccessibleStateType::TRANSIENT );
-}
-Rectangle TableControl::GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex)
-{
- (void)_nRow;
- (void)_nColumnPos;
- return GetCharacterBounds(nIndex);
-}
-sal_Int32 TableControl::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint)
-{
- (void)_nRow;
- (void)_nColumnPos;
- return GetIndexForPoint(_rPoint);
-;
-}
- // -----------------------------------------------------------------------------
-sal_Bool TableControl::isAccessibleAlive( ) const
-{
- return ( NULL != m_pAccessTable->m_pAccessible ) && m_pAccessTable->m_pAccessible->isAlive();
-}
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessible > TableControl::GetAccessible( sal_Bool bCreate )
+ {
+ return Control::GetAccessible( bCreate );
+ }
-// -----------------------------------------------------------------------------
-::svt::IAccessibleFactory& TableControl::getAccessibleFactory()
-{
- return m_pAccessTable->m_aFactoryAccess.getFactory();
-}
-// -----------------------------------------------------------------------------
-void TableControl::commitGridControlEvent( sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue )
-{
- if ( isAccessibleAlive() )
- m_pAccessTable->m_pAccessible->commitEvent( _nEventId, _rNewValue, _rOldValue);
-}
-// -----------------------------------------------------------------------------
-Rectangle TableControl::calcHeaderRect(sal_Bool _bIsColumnBar,sal_Bool _bOnScreen)
-{
- (void)_bOnScreen;
- return m_pImpl->calcHeaderRect(_bIsColumnBar);
-}
-// -----------------------------------------------------------------------------
-Rectangle TableControl::calcTableRect(sal_Bool _bOnScreen)
-{
- (void)_bOnScreen;
- return m_pImpl->calcTableRect();
-}
-//--------------------------------------------------------------------
-::com::sun::star::uno::Sequence< sal_Int32 >& TableControl::getColumnsForTooltip()
-{
- return m_nCols;
-}
-//--------------------------------------------------------------------
-::com::sun::star::uno::Sequence< ::rtl::OUString >& TableControl::getTextForTooltip()
-{
- return m_aText;
-}
-//--------------------------------------------------------------------
-void TableControl::setTooltip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aText, const ::com::sun::star::uno::Sequence< sal_Int32 >& nCols )
-{
- m_aText = aText;
- m_nCols = nCols;
- m_bTooltip = true;
-}
-// -----------------------------------------------------------------------
-void TableControl::selectionChanged(bool _bChanged)
-{
- m_bSelectionChanged = _bChanged;
-}
-// -----------------------------------------------------------------------
-bool TableControl::isTooltip()
-{
- return m_bTooltip;
-}
-// -----------------------------------------------------------------------
-IMPL_LINK( TableControl, ImplSelectHdl, void*, EMPTYARG )
-{
- Select();
- return 1;
-}
-IMPL_LINK( TableControl, ImplMouseButtonDownHdl, MouseEvent*, pData )
-{
- CallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, pData );
- return 1;
-}
-IMPL_LINK( TableControl, ImplMouseButtonUpHdl, MouseEvent*, pData )
-{
- CallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONUP, pData );
- return 1;
-}
-// -----------------------------------------------------------------------
-void TableControl::Select()
-{
- ImplCallEventListenersAndHandler( VCLEVENT_TABLEROW_SELECT, m_aSelectHdl, this );
-}
-//........................................................................
+ //------------------------------------------------------------------------------------------------------------------
+ Window* TableControl::GetAccessibleParentWindow() const
+ {
+ return Control::GetAccessibleParentWindow();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Window* TableControl::GetWindowInstance()
+ {
+ return this;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool TableControl::HasRowHeader()
+ {
+ return GetModel()->hasRowHeaders();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool TableControl::HasColHeader()
+ {
+ return GetModel()->hasColumnHeaders();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Int32 TableControl::GetAccessibleControlCount() const
+ {
+ sal_Int32 count = 0;
+ if(GetRowCount()>0)
+ count+=1;
+ if(GetModel()->hasRowHeaders())
+ count+=1;
+ if(GetModel()->hasColumnHeaders())
+ count+=1;
+ return count;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool TableControl::ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint )
+ {
+ sal_Int32 nRow = m_pImpl->getRowAtPoint( _rPoint );
+ sal_Int32 nCol = m_pImpl->getColAtPoint( _rPoint );
+ _rnIndex = nRow * GetColumnCount() + nCol;
+ return nRow >= 0 ? sal_True : sal_False;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ long TableControl::GetRowCount() const
+ {
+ return GetModel()->getRowCount();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ long TableControl::GetColumnCount() const
+ {
+ return GetModel()->getColumnCount();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool TableControl::HasRowHeader() const
+ {
+ return GetModel()->hasRowHeaders();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool TableControl::ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint )
+ {
+ _rnRow = m_pImpl->getRowAtPoint( _rPoint );
+ _rnColPos = m_pImpl->getColAtPoint( _rPoint );
+ return _rnRow >= 0 ? sal_True : sal_False;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl::FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const
+ {
+ if ( GetCurrentRow() == _nRow && GetCurrentColumn() == _nColumnPos )
+ _rStateSet.AddState( AccessibleStateType::FOCUSED );
+ else // only transient when column is not focused
+ _rStateSet.AddState( AccessibleStateType::TRANSIENT );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle TableControl::GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex)
+ {
+ (void)_nRow;
+ (void)_nColumnPos;
+ return GetCharacterBounds(nIndex);
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Int32 TableControl::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint)
+ {
+ (void)_nRow;
+ (void)_nColumnPos;
+ return GetIndexForPoint(_rPoint);
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle TableControl::calcHeaderRect(sal_Bool _bIsColumnBar,sal_Bool _bOnScreen)
+ {
+ (void)_bOnScreen;
+ return m_pImpl->calcHeaderRect( _bIsColumnBar ? false : true );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle TableControl::calcTableRect(sal_Bool _bOnScreen)
+ {
+ (void)_bOnScreen;
+ return m_pImpl->calcTableRect();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ IMPL_LINK( TableControl, ImplSelectHdl, void*, EMPTYARG )
+ {
+ Select();
+ return 1;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ IMPL_LINK( TableControl, ImplMouseButtonDownHdl, MouseEvent*, pData )
+ {
+ CallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, pData );
+ return 1;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ IMPL_LINK( TableControl, ImplMouseButtonUpHdl, MouseEvent*, pData )
+ {
+ CallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONUP, pData );
+ return 1;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl::Select()
+ {
+ ImplCallEventListenersAndHandler( VCLEVENT_TABLEROW_SELECT, m_pImpl->getSelectHandler(), this );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl::SetSelectHdl( const Link& i_selectHandler )
+ {
+ m_pImpl->setSelectHandler( i_selectHandler );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ const Link& TableControl::GetSelectHdl() const
+ {
+ return m_pImpl->getSelectHandler();
+ }
+
+//......................................................................................................................
}} // namespace svt::table
-//........................................................................
+//......................................................................................................................
diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx
index 4c109529244d..8e481d27d993 100644..100755
--- a/svtools/source/table/tablecontrol_impl.cxx
+++ b/svtools/source/table/tablecontrol_impl.cxx
@@ -30,40 +30,60 @@
#include "svtools/table/tablecontrol.hxx"
#include "svtools/table/defaultinputhandler.hxx"
#include "svtools/table/tablemodel.hxx"
+
+#include "tabledatawindow.hxx"
#include "tablecontrol_impl.hxx"
#include "tablegeometry.hxx"
-#include "svtools/table/tabledatawindow.hxx"
-#include <com/sun/star/awt/XControl.hpp>
+#include "cellvalueconversion.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleTableModelChange.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleTableModelChangeType.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/flagguard.hxx>
#include <vcl/scrbar.hxx>
#include <vcl/seleng.hxx>
#include <rtl/ref.hxx>
-#include <toolkit/awt/vclxwindow.hxx>
#include <vcl/image.hxx>
-#include <com/sun/star/graphic/XGraphic.hpp>
+#include <tools/diagnose_ex.h>
#include <functional>
-#include <stdlib.h>
-//........................................................................
+#define MIN_COLUMN_WIDTH_PIXEL 4
+
+//......................................................................................................................
namespace svt { namespace table
{
-//........................................................................
-
- //====================================================================
- //= TempHideCursor
- //====================================================================
- class TempHideCursor
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::accessibility::AccessibleTableModelChange;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::accessibility::XAccessible;
+ using ::com::sun::star::uno::Reference;
+ /** === end UNO using === **/
+ namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId;
+ namespace AccessibleTableModelChangeType = ::com::sun::star::accessibility::AccessibleTableModelChangeType;
+
+ //==================================================================================================================
+ //= SuppressCursor
+ //==================================================================================================================
+ class SuppressCursor
{
private:
- IAbstractTableControl& m_rTable;
+ ITableControl& m_rTable;
public:
- TempHideCursor( IAbstractTableControl& _rTable )
+ SuppressCursor( ITableControl& _rTable )
:m_rTable( _rTable )
{
m_rTable.hideCursor();
}
- ~TempHideCursor()
+ ~SuppressCursor()
{
m_rTable.showCursor();
}
@@ -102,50 +122,18 @@ namespace svt { namespace table
{
return false;
}
- virtual void setRowHeaders(bool _bRowHeaders)
- {
- (void)_bRowHeaders;
- }
- virtual void setColumnHeaders(bool _bColumnHeaders)
- {
- (void)_bColumnHeaders;
- }
- void setColumnCount(TableSize _nColCount)
- {
- (void) _nColCount;
- }
- void setRowCount(TableSize _nRowCount)
- {
- (void)_nRowCount;
- }
virtual bool isCellEditable( ColPos col, RowPos row ) const
{
(void)col;
(void)row;
return false;
}
- virtual void addTableModelListener( const PTableModelListener& listener )
- {
- (void)listener;
- // ignore
- }
- virtual void removeTableModelListener( const PTableModelListener& listener )
- {
- (void)listener;
- // ignore
- }
virtual PColumnModel getColumnModel( ColPos column )
{
DBG_ERROR( "EmptyTableModel::getColumnModel: invalid call!" );
(void)column;
return PColumnModel();
}
- virtual PColumnModel getColumnModelByID( ColumnID id )
- {
- DBG_ERROR( "EmptyTableModel::getColumnModel: invalid call!" );
- (void)id;
- return PColumnModel();
- }
virtual PTableRenderer getRenderer() const
{
return PTableRenderer();
@@ -170,83 +158,68 @@ namespace svt { namespace table
{
return 0;
}
- virtual ScrollbarVisibility getVerticalScrollbarVisibility(int , int ) const
+ virtual ScrollbarVisibility getVerticalScrollbarVisibility() const
{
- return ScrollbarShowNever;
+ return ScrollbarShowNever;
}
- virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int , int ) const
+ virtual ScrollbarVisibility getHorizontalScrollbarVisibility() const
{
- return ScrollbarShowNever;
+ return ScrollbarShowNever;
+ }
+ virtual void addTableModelListener( const PTableModelListener& i_listener )
+ {
+ (void)i_listener;
+ }
+ virtual void removeTableModelListener( const PTableModelListener& i_listener )
+ {
+ (void)i_listener;
+ }
+ virtual ::boost::optional< ::Color > getLineColor() const
+ {
+ return ::boost::optional< ::Color >();
+ }
+ virtual ::boost::optional< ::Color > getHeaderBackgroundColor() const
+ {
+ return ::boost::optional< ::Color >();
+ }
+ virtual ::boost::optional< ::Color > getHeaderTextColor() const
+ {
+ return ::boost::optional< ::Color >();
+ }
+ virtual ::boost::optional< ::Color > getTextColor() const
+ {
+ return ::boost::optional< ::Color >();
+ }
+ virtual ::boost::optional< ::Color > getTextLineColor() const
+ {
+ return ::boost::optional< ::Color >();
+ }
+ virtual ::boost::optional< ::std::vector< ::Color > > getRowBackgroundColors() const
+ {
+ return ::boost::optional< ::std::vector< ::Color > >();
+ }
+ virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign() const
+ {
+ return com::sun::star::style::VerticalAlignment(0);
+ }
+ virtual ITableDataSort* getSortAdapter()
+ {
+ return NULL;
+ }
+ virtual void getCellContent( ColPos const i_col, RowPos const i_row, ::com::sun::star::uno::Any& o_cellContent )
+ {
+ (void)i_row;
+ (void)i_col;
+ o_cellContent.clear();
+ }
+ virtual void getCellToolTip( ColPos const, RowPos const, ::com::sun::star::uno::Any& )
+ {
+ }
+ virtual Any getRowHeading( RowPos const i_rowPos ) const
+ {
+ (void)i_rowPos;
+ return Any();
}
- virtual bool hasVerticalScrollbar()
- {
- return false;
- }
- virtual bool hasHorizontalScrollbar()
- {
- return false;
- }
- virtual void setCellContent(const std::vector<std::vector< ::com::sun::star::uno::Any > >& )
- {
- }
- virtual ::com::sun::star::util::Color getLineColor()
- {
- return 0;
- }
- virtual void setLineColor(::com::sun::star::util::Color )
- {
- }
- virtual ::com::sun::star::util::Color getHeaderBackgroundColor()
- {
- return -1;
- }
- virtual void setHeaderBackgroundColor(::com::sun::star::util::Color )
- {
- }
- virtual ::com::sun::star::util::Color getTextColor()
- {
- return 0;
- }
- virtual void setTextColor(::com::sun::star::util::Color )
- {
- }
- virtual ::com::sun::star::util::Color getOddRowBackgroundColor()
- {
- return -1;
- }
- virtual void setOddRowBackgroundColor(::com::sun::star::util::Color )
- {
- }
- virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign()
- {
- return com::sun::star::style::VerticalAlignment(0);
- }
- virtual void setVerticalAlign(com::sun::star::style::VerticalAlignment )
- {
- }
- virtual ::com::sun::star::util::Color getEvenRowBackgroundColor()
- {
- return -1;
- }
- virtual void setEvenRowBackgroundColor(::com::sun::star::util::Color )
- {
- }
- virtual std::vector<std::vector< ::com::sun::star::uno::Any > >& getCellContent()
- {
- return m_aCellContent;
- }
- virtual void setRowHeaderName(const std::vector<rtl::OUString>& )
- {
- }
- virtual std::vector<rtl::OUString>& getRowHeaderName()
- {
- aRowHeaderNames.clear();
- aRowHeaderNames.push_back(rtl::OUString::createFromAscii(""));
- return aRowHeaderNames;
- }
- private:
- std::vector<rtl::OUString> aRowHeaderNames;
- std::vector<std::vector< ::com::sun::star::uno::Any > > m_aCellContent;
};
@@ -312,7 +285,7 @@ namespace svt { namespace table
}
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
const sal_Char* TableControl_Impl::impl_checkInvariants() const
{
if ( !m_pModel )
@@ -327,12 +300,9 @@ namespace svt { namespace table
if ( m_pModel->getRowCount() != m_nRowCount )
return "row counts are inconsistent!";
- if ( ( m_nCurColumn != COL_INVALID ) && !m_aColumnWidthsPixel.empty() && ( m_nCurColumn < 0 ) || ( m_nCurColumn >= (ColPos)m_aColumnWidthsPixel.size() ) )
+ if ( ( m_nCurColumn != COL_INVALID ) && !m_aColumnWidths.empty() && ( m_nCurColumn < 0 ) || ( m_nCurColumn >= (ColPos)m_aColumnWidths.size() ) )
return "current column is invalid!";
- if ( m_aColumnWidthsPixel.size() != m_aAccColumnWidthsPixel.size() )
- return "columnd width caches are inconsistent!";
-
if ( !lcl_checkLimitsExclusive_OrDefault_OrFallback( m_nTopRow, (RowPos)-1, m_nRowCount, getModel(), (RowPos)0 ) )
return "invalid top row value!";
@@ -348,6 +318,20 @@ namespace svt { namespace table
if ( m_pInputHandler != m_pModel->getInputHandler() )
return "input handler is not the model-provided one!";
+ // m_aSelectedRows should have reasonable content
+ {
+ if ( m_aSelectedRows.size() > size_t( m_pModel->getRowCount() ) )
+ return "there are more rows selected than actually exist";
+ for ( ::std::vector< RowPos >::const_iterator selRow = m_aSelectedRows.begin();
+ selRow != m_aSelectedRows.end();
+ ++selRow
+ )
+ {
+ if ( ( *selRow < 0 ) || ( *selRow >= m_pModel->getRowCount() ) )
+ return "a non-existent row is selected";
+ }
+ }
+
// m_nColHeaderHeightPixel consistent with the model's value?
{
TableMetrics nHeaderHeight = m_pModel->hasColumnHeaders() ? m_pModel->getColumnHeaderHeight() : 0;
@@ -373,7 +357,28 @@ namespace svt { namespace table
return "row header widths are inconsistent!";
}
- // TODO: check m_aColumnWidthsPixel and m_aAccColumnWidthsPixel
+ // m_aColumnWidths consistency
+ if ( size_t( m_nColumnCount ) != m_aColumnWidths.size() )
+ return "wrong number of cached column widths";
+
+ for ( ColumnPositions::const_iterator col = m_aColumnWidths.begin();
+ col != m_aColumnWidths.end();
+ )
+ {
+ if ( col->getEnd() < col->getStart() )
+ return "column widths: 'end' is expected to not be smaller than start";
+
+ ColumnPositions::const_iterator nextCol = col + 1;
+ if ( nextCol != m_aColumnWidths.end() )
+ if ( col->getEnd() != nextCol->getStart() )
+ return "column widths: one column's end should be the next column's start";
+ col = nextCol;
+ }
+
+ if ( m_nLeftColumn < m_nColumnCount )
+ if ( m_aColumnWidths[ m_nLeftColumn ].getStart() != m_nRowHeaderWidthPixel )
+ return "the left-most column should start immediately after the row header";
+
if ( m_nCursorHidden < 0 )
return "invalid hidden count for the cursor!";
@@ -382,6 +387,8 @@ namespace svt { namespace table
DBG_SUSPEND_INV( INV_SCROLL_POSITION );
// prevent infinite recursion
+ if ( m_nLeftColumn < 0 )
+ return "invalid left-most column index";
if ( m_pVScroll->GetThumbPos() != m_nTopRow )
return "vertical scroll bar |position| is incorrect!";
if ( m_pVScroll->GetRange().Max() != m_nRowCount )
@@ -410,44 +417,44 @@ namespace svt { namespace table
#define DBG_CHECK_ME() \
DBG_CHKTHIS( TableControl_Impl, TableControl_Impl_checkInvariants )
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
TableControl_Impl::TableControl_Impl( TableControl& _rAntiImpl )
:m_rAntiImpl ( _rAntiImpl )
,m_pModel ( new EmptyTableModel )
,m_pInputHandler ( )
,m_nRowHeightPixel ( 15 )
- ,m_nColHeaderHeightPixel( 0 )
+ ,m_nColHeaderHeightPixel( 0 )
,m_nRowHeaderWidthPixel ( 0 )
,m_nColumnCount ( 0 )
,m_nRowCount ( 0 )
+ ,m_bColumnsFit ( true )
,m_nCurColumn ( COL_INVALID )
,m_nCurRow ( ROW_INVALID )
,m_nLeftColumn ( 0 )
- ,m_nTopRow ( 0 )
+ ,m_nTopRow ( 0 )
,m_nCursorHidden ( 1 )
,m_pDataWindow ( new TableDataWindow( *this ) )
- ,m_pVScroll ( NULL )
+ ,m_pVScroll ( NULL )
,m_pHScroll ( NULL )
,m_pScrollCorner ( NULL )
- ,m_pSelEngine ( )
- ,m_nRowSelected ( )
- ,m_pTableFunctionSet ( new TableFunctionSet(this ) )
- ,m_nAnchor (-1 )
- ,m_bResizing ( false )
- ,m_nResizingColumn ( 0 )
- ,m_bResizingGrid ( false )
+ ,m_pSelEngine ( )
+ ,m_aSelectedRows ( )
+ ,m_pTableFunctionSet ( new TableFunctionSet( this ) )
+ ,m_nAnchor ( -1 )
+ ,m_bUpdatingColWidths ( false )
+ ,m_pAccessibleTable ( NULL )
#if DBG_UTIL
,m_nRequiredInvariants ( INV_SCROLL_POSITION )
#endif
{
DBG_CTOR( TableControl_Impl, TableControl_Impl_checkInvariants );
- m_pSelEngine = new SelectionEngine(m_pDataWindow, m_pTableFunctionSet);
- m_pSelEngine->SetSelectionMode(SINGLE_SELECTION);
+ m_pSelEngine = new SelectionEngine( m_pDataWindow.get(), m_pTableFunctionSet );
+ m_pSelEngine->SetSelectionMode(SINGLE_SELECTION);
m_pDataWindow->SetPosPixel( Point( 0, 0 ) );
m_pDataWindow->Show();
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
TableControl_Impl::~TableControl_Impl()
{
DBG_DTOR( TableControl_Impl, TableControl_Impl_checkInvariants );
@@ -457,35 +464,30 @@ namespace svt { namespace table
DELETEZ( m_pScrollCorner );
DELETEZ( m_pTableFunctionSet );
DELETEZ( m_pSelEngine );
- DELETEZ( m_pDataWindow );
}
- //--------------------------------------------------------------------
- PTableModel TableControl_Impl::getModel() const
- {
- if ( dynamic_cast< const EmptyTableModel* >( m_pModel.get() ) != NULL )
- // if it's an EmptyTableModel, pretend that there is no model
- return PTableModel();
-
- return m_pModel;
- }
-
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableControl_Impl::setModel( PTableModel _pModel )
{
DBG_CHECK_ME();
- TempHideCursor aHideCursor( *this );
+ SuppressCursor aHideCursor( *this );
+
+ if ( !!m_pModel )
+ m_pModel->removeTableModelListener( shared_from_this() );
m_pModel = _pModel;
if ( !m_pModel)
m_pModel.reset( new EmptyTableModel );
+ m_pModel->addTableModelListener( shared_from_this() );
+
m_nCurRow = ROW_INVALID;
m_nCurColumn = COL_INVALID;
// recalc some model-dependent cached info
impl_ni_updateCachedModelValues();
+ impl_ni_updateScrollbars();
// completely invalidate
m_rAntiImpl.Invalidate();
@@ -495,67 +497,308 @@ namespace svt { namespace table
if ( m_nColumnCount ) m_nCurColumn = 0;
}
- //--------------------------------------------------------------------
- void TableControl_Impl::impl_getAllVisibleCellsArea( Rectangle& _rCellArea ) const
+ //------------------------------------------------------------------------------------------------------------------
+ namespace
+ {
+ bool lcl_adjustSelectedRows( ::std::vector< RowPos >& io_selectionIndexes, RowPos const i_firstAffectedRowIndex, TableSize const i_offset )
+ {
+ bool didChanges = false;
+ for ( ::std::vector< RowPos >::iterator selPos = io_selectionIndexes.begin();
+ selPos != io_selectionIndexes.end();
+ ++selPos
+ )
+ {
+ if ( *selPos < i_firstAffectedRowIndex )
+ continue;
+ *selPos += i_offset;
+ didChanges = true;
+ }
+ return didChanges;
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl_Impl::rowsInserted( RowPos i_first, RowPos i_last )
+ {
+ DBG_CHECK_ME();
+ OSL_PRECOND( i_last >= i_first, "TableControl_Impl::rowsInserted: invalid row indexes!" );
+
+ TableSize const insertedRows = i_last - i_first + 1;
+
+ // adjust selection, if necessary
+ bool const selectionChanged = lcl_adjustSelectedRows( m_aSelectedRows, i_first, insertedRows );
+
+ // adjust our cached row count
+ m_nRowCount = m_pModel->getRowCount();
+
+ // if the rows have been inserted before the current row, adjust this
+ if ( i_first <= m_nCurRow )
+ goTo( m_nCurColumn, m_nCurRow + insertedRows );
+
+ // adjust scrollbars
+ impl_ni_updateScrollbars();
+
+ // notify A1YY events
+ if ( impl_isAccessibleAlive() )
+ {
+ impl_commitAccessibleEvent( AccessibleEventId::TABLE_MODEL_CHANGED,
+ makeAny( AccessibleTableModelChange( AccessibleTableModelChangeType::INSERT, i_first, i_last, 0, m_pModel->getColumnCount() ) ),
+ Any()
+ );
+ impl_commitAccessibleEvent( AccessibleEventId::CHILD,
+ makeAny( m_pAccessibleTable->getTableHeader( TCTYPE_ROWHEADERBAR ) ),
+ Any()
+ );
+
+// for ( sal_Int32 i = 0 ; i <= m_pModel->getColumnCount(); ++i )
+// {
+// impl_commitAccessibleEvent(
+// CHILD,
+// makeAny( m_pAccessibleTable->getTable() ),
+// Any());
+// }
+ // Huh? What's that? We're notifying |columnCount| CHILD events here, claiming the *table* itself
+ // has been inserted. Doesn't make much sense, does it?
+ }
+
+ // schedule repaint
+ invalidateRowRange( i_first, ROW_INVALID );
+
+ // call selection handlers, if necessary
+ if ( selectionChanged )
+ m_rAntiImpl.Select();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl_Impl::rowsRemoved( RowPos i_first, RowPos i_last )
+ {
+ sal_Int32 firstRemovedRow = i_first;
+ sal_Int32 lastRemovedRow = i_last;
+
+ // adjust selection, if necessary
+ bool selectionChanged = false;
+ if ( i_first == -1 )
+ {
+ selectionChanged = markAllRowsAsDeselected();
+
+ firstRemovedRow = 0;
+ lastRemovedRow = m_nRowCount - 1;
+ }
+ else
+ {
+ ENSURE_OR_RETURN_VOID( i_last >= i_first, "TableControl_Impl::rowsRemoved: illegal indexes!" );
+
+ for ( sal_Int32 row = i_first; row <= i_last; ++row )
+ {
+ if ( markRowAsDeselected( row ) )
+ selectionChanged = true;
+ }
+
+ if ( lcl_adjustSelectedRows( m_aSelectedRows, i_last + 1, i_first - i_last - 1 ) )
+ selectionChanged = true;
+ }
+
+ // adjust cached row count
+ m_nRowCount = m_pModel->getRowCount();
+
+ // adjust the current row, if it is larger than the row count now
+ if ( m_nCurRow >= m_nRowCount )
+ {
+ if ( m_nRowCount > 0 )
+ goTo( m_nCurColumn, m_nRowCount - 1 );
+ else
+ m_nCurRow = ROW_INVALID;
+ }
+
+ // adjust scrollbars
+ impl_ni_updateScrollbars();
+
+ // notify A11Y events
+ if ( impl_isAccessibleAlive() )
+ {
+ impl_commitAccessibleEvent(
+ AccessibleEventId::TABLE_MODEL_CHANGED,
+ makeAny( AccessibleTableModelChange(
+ AccessibleTableModelChangeType::DELETE,
+ firstRemovedRow,
+ lastRemovedRow,
+ 0,
+ m_pModel->getColumnCount()
+ ) ),
+ Any()
+ );
+ }
+
+ // schedule a repaint
+ invalidateRowRange( firstRemovedRow, ROW_INVALID );
+
+ // call selection handlers, if necessary
+ if ( selectionChanged )
+ m_rAntiImpl.Select();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl_Impl::columnInserted( ColPos const i_colIndex )
+ {
+ m_nColumnCount = m_pModel->getColumnCount();
+ impl_ni_updateColumnWidths();
+ impl_ni_updateScrollbars();
+
+ m_rAntiImpl.Invalidate();
+
+ OSL_UNUSED( i_colIndex );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl_Impl::columnRemoved( ColPos const i_colIndex )
+ {
+ m_nColumnCount = m_pModel->getColumnCount();
+ impl_ni_updateColumnWidths();
+ impl_ni_updateScrollbars();
+
+ m_rAntiImpl.Invalidate();
+
+ OSL_UNUSED( i_colIndex );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl_Impl::allColumnsRemoved()
+ {
+ m_nColumnCount = m_pModel->getColumnCount();
+ impl_ni_updateColumnWidths();
+ impl_ni_updateScrollbars();
+
+ m_rAntiImpl.Invalidate();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl_Impl::cellsUpdated( ColPos const i_firstCol, ColPos i_lastCol, RowPos const i_firstRow, RowPos const i_lastRow )
+ {
+ invalidateRowRange( i_firstRow, i_lastRow );
+
+ OSL_UNUSED( i_firstCol );
+ OSL_UNUSED( i_lastCol );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl_Impl::tableMetricsChanged()
+ {
+ long const oldRowHeaderWidthPixel = m_nRowHeaderWidthPixel;
+ impl_ni_updateCachedTableMetrics();
+ if ( oldRowHeaderWidthPixel != m_nRowHeaderWidthPixel )
+ impl_ni_updateColumnWidths();
+ impl_ni_updateScrollbars();
+ m_rAntiImpl.Invalidate();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl_Impl::impl_invalidateColumn( ColPos const i_column )
{
DBG_CHECK_ME();
- _rCellArea.Left() = 0;
- _rCellArea.Top() = 0;
+ Rectangle const aAllCellsArea( impl_getAllVisibleCellsArea() );
+
+ const TableColumnGeometry aColumn( *this, aAllCellsArea, i_column );
+ if ( aColumn.isValid() )
+ m_rAntiImpl.Invalidate( aColumn.getRect() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl_Impl::columnChanged( ColPos const i_column, ColumnAttributeGroup const i_attributeGroup )
+ {
+ ColumnAttributeGroup nGroup( i_attributeGroup );
+ if ( nGroup & COL_ATTRS_APPEARANCE )
+ {
+ impl_invalidateColumn( i_column );
+ nGroup &= ~COL_ATTRS_APPEARANCE;
+ }
+
+ if ( nGroup & COL_ATTRS_WIDTH )
+ {
+ if ( !m_bUpdatingColWidths )
+ {
+ impl_ni_updateColumnWidths( i_column );
+ invalidate( TableAreaAll );
+ impl_ni_updateScrollbars();
+ }
+
+ nGroup &= ~COL_ATTRS_WIDTH;
+ }
+
+ OSL_ENSURE( ( nGroup == COL_ATTRS_NONE ) || ( i_attributeGroup == COL_ATTRS_ALL ),
+ "TableControl_Impl::columnChanged: don't know how to handle this change!" );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle TableControl_Impl::impl_getAllVisibleCellsArea() const
+ {
+ DBG_CHECK_ME();
+
+ Rectangle aArea( Point( 0, 0 ), Size( 0, 0 ) );
// determine the right-most border of the last column which is
// at least partially visible
- _rCellArea.Right() = m_nRowHeaderWidthPixel;
- if ( !m_aAccColumnWidthsPixel.empty() )
+ aArea.Right() = m_nRowHeaderWidthPixel;
+ if ( !m_aColumnWidths.empty() )
{
- // the number of pixels which are scroll out of the left hand
+ // the number of pixels which are scrolled out of the left hand
// side of the window
- long nScrolledOutLeft = m_nLeftColumn == 0 ? 0 : m_aAccColumnWidthsPixel[ m_nLeftColumn - 1 ];
+ const long nScrolledOutLeft = m_nLeftColumn == 0 ? 0 : m_aColumnWidths[ m_nLeftColumn - 1 ].getEnd();
- ArrayOfLong::const_reverse_iterator loop = m_aAccColumnWidthsPixel.rbegin();
+ ColumnPositions::const_reverse_iterator loop = m_aColumnWidths.rbegin();
do
{
- _rCellArea.Right() = *loop++ - nScrolledOutLeft + m_nRowHeaderWidthPixel;
+ aArea.Right() = loop->getEnd() - nScrolledOutLeft + m_nRowHeaderWidthPixel;
+ ++loop;
}
- while ( ( loop != m_aAccColumnWidthsPixel.rend() )
- && ( *loop - nScrolledOutLeft >= _rCellArea.Right() )
+ while ( ( loop != m_aColumnWidths.rend() )
+ && ( loop->getEnd() - nScrolledOutLeft >= aArea.Right() )
);
}
- // so far, _rCellArea.Right() denotes the first pixel *after* the cell area
- --_rCellArea.Right();
+ // so far, aArea.Right() denotes the first pixel *after* the cell area
+ --aArea.Right();
// determine the last row which is at least partially visible
- _rCellArea.Bottom() =
+ aArea.Bottom() =
m_nColHeaderHeightPixel
+ impl_getVisibleRows( true ) * m_nRowHeightPixel
- 1;
+
+ return aArea;
}
- //--------------------------------------------------------------------
- void TableControl_Impl::impl_getAllVisibleDataCellArea( Rectangle& _rCellArea ) const
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle TableControl_Impl::impl_getAllVisibleDataCellArea() const
{
DBG_CHECK_ME();
- impl_getAllVisibleCellsArea( _rCellArea );
- _rCellArea.Left() = m_nRowHeaderWidthPixel;
- _rCellArea.Top() = m_nColHeaderHeightPixel;
+ Rectangle aArea( impl_getAllVisibleCellsArea() );
+ aArea.Left() = m_nRowHeaderWidthPixel;
+ aArea.Top() = m_nColHeaderHeightPixel;
+ return aArea;
}
- //--------------------------------------------------------------------
- void TableControl_Impl::impl_ni_updateCachedModelValues()
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl_Impl::impl_ni_updateCachedTableMetrics()
{
- m_nRowHeightPixel = 15;
- m_nColHeaderHeightPixel = 0;
- m_nRowHeaderWidthPixel = 0;
- m_pInputHandler.reset();
- m_nColumnCount = m_nRowCount = 0;
+ m_nRowHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getRowHeight() ), MAP_APPFONT ).Height();
- m_nRowHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getRowHeight() ), MAP_APPFONT ).Height();
- if ( m_pModel->hasColumnHeaders() )
+ m_nColHeaderHeightPixel = 0;
+ if ( m_pModel->hasColumnHeaders() )
m_nColHeaderHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getColumnHeaderHeight() ), MAP_APPFONT ).Height();
+
+ m_nRowHeaderWidthPixel = 0;
if ( m_pModel->hasRowHeaders() )
m_nRowHeaderWidthPixel = m_rAntiImpl.LogicToPixel( Size( m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT).Width();
+ }
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl_Impl::impl_ni_updateCachedModelValues()
+ {
+ m_pInputHandler.reset();
+ m_nColumnCount = m_nRowCount = 0;
+
+ impl_ni_updateCachedTableMetrics();
impl_ni_updateColumnWidths();
m_pInputHandler = m_pModel->getInputHandler();
@@ -566,144 +809,279 @@ namespace svt { namespace table
m_nRowCount = m_pModel->getRowCount();
}
- //--------------------------------------------------------------------
- void TableControl_Impl::impl_ni_updateColumnWidths()
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl_Impl::impl_ni_updateColumnWidths( ColPos const i_assumeInflexibleColumnsUpToIncluding )
{
- m_aColumnWidthsPixel.resize( 0 );
- m_aAccColumnWidthsPixel.resize( 0 );
+ ENSURE_OR_RETURN_VOID( !m_bUpdatingColWidths, "TableControl_Impl::impl_ni_updateColumnWidths: recursive call detected!" );
+
+ m_aColumnWidths.resize( 0 );
if ( !m_pModel )
return;
- TableSize colCount = m_pModel->getColumnCount();
+ const TableSize colCount = m_pModel->getColumnCount();
+ if ( colCount == 0 )
+ return;
+
+ m_bUpdatingColWidths = true;
+ const ::comphelper::FlagGuard aWidthUpdateFlag( m_bUpdatingColWidths );
- m_aColumnWidthsPixel.reserve( colCount );
- m_aAccColumnWidthsPixel.reserve( colCount );
- if(colCount>0)
+ m_aColumnWidths.reserve( colCount );
+
+ // the available horizontal space
+ long gridWidthPixel = m_rAntiImpl.GetOutputSizePixel().Width();
+ if ( m_pModel->hasRowHeaders() && ( gridWidthPixel != 0 ) )
{
- std::vector<sal_Int32> aPrePixelWidths(0);
- long accumulatedPixelWidth = 0;
- int lastResizableCol = -1;
- double gridWidth = m_rAntiImpl.GetOutputSizePixel().Width();
- if(m_pModel->hasRowHeaders())
- {
- TableMetrics rowHeaderWidth = m_pModel->getRowHeaderWidth();
- gridWidth-= m_rAntiImpl.LogicToPixel( Size( rowHeaderWidth, 0 ), MAP_APPFONT ).Width();
- }
- if(m_pModel->hasVerticalScrollbar())
+ gridWidthPixel -= m_nRowHeaderWidthPixel;
+ }
+ if ( m_pModel->getVerticalScrollbarVisibility() != ScrollbarShowNever )
+ {
+ long nScrollbarMetrics = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize();
+ gridWidthPixel -= nScrollbarMetrics;
+ }
+
+ // TODO: shouldn't we take the visibility of the vertical scroll bar into account here, too?
+ long const gridWidthAppFont = m_rAntiImpl.PixelToLogic( Size( gridWidthPixel, 0 ), MAP_APPFONT ).Width();
+
+ // determine the accumulated current width of all columns
+ for ( ColPos col = 0; col < colCount; ++col )
+ {
+ const PColumnModel pColumn = m_pModel->getColumnModel( col );
+ ENSURE_OR_THROW( !!pColumn, "invalid column returned by the model!" );
+
+ }
+
+ // collect some meta data for our columns:
+ // - their current (appt-font) metrics
+ long accumulatedCurrentWidth = 0;
+ ::std::vector< long > currentColWidths;
+ currentColWidths.reserve( colCount );
+ // - their effective minimal and maximal width (app-font!)
+ typedef ::std::vector< ::std::pair< long, long > > ColumnLimits;
+ ColumnLimits effectiveColumnLimits;
+ effectiveColumnLimits.reserve( colCount );
+ long accumulatedMinWidth = 0;
+ long accumulatedMaxWidth = 0;
+ // - their relative flexibility
+ ::std::vector< ::sal_Int32 > columnFlexibilities;
+ columnFlexibilities.reserve( colCount );
+ long flexibilityDenominator = 0;
+ for ( ColPos col = 0; col < colCount; ++col )
+ {
+ PColumnModel const pColumn = m_pModel->getColumnModel( col );
+ ENSURE_OR_THROW( !!pColumn, "invalid column returned by the model!" );
+
+ // current width
+ TableMetrics const currentWidth = pColumn->getWidth();
+ currentColWidths.push_back( currentWidth );
+
+ // accumulated width
+ accumulatedCurrentWidth += currentWidth;
+
+ // flexibility
+ ::sal_Int32 flexibility = pColumn->getFlexibility();
+ OSL_ENSURE( flexibility >= 0, "TableControl_Impl::impl_ni_updateColumnWidths: a column's flexibility should be non-negative." );
+ if ( ( flexibility < 0 ) // normalization
+ || ( !pColumn->isResizable() ) // column not resizeable => no auto-resize
+ || ( col <= i_assumeInflexibleColumnsUpToIncluding ) // column shall be treated as inflexible => respec this
+ )
+ flexibility = 0;
+
+ // min/max width
+ long effectiveMin = currentWidth, effectiveMax = currentWidth;
+ // if the column is not flexible, it will not be asked for min/max, but we assume the current width as limit then
+ if ( flexibility > 0 )
{
- sal_Int32 scrollbarWidth = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize();
- gridWidth-=scrollbarWidth;
+ long const minWidth = pColumn->getMinWidth();
+ if ( minWidth > 0 )
+ effectiveMin = minWidth;
+ else
+ effectiveMin = MIN_COLUMN_WIDTH_PIXEL;
+
+ long const maxWidth = pColumn->getMaxWidth();
+ OSL_ENSURE( minWidth <= maxWidth, "TableControl_Impl::impl_ni_updateColumnWidths: pretty undecided 'bout its width limits, this column!" );
+ if ( ( maxWidth > 0 ) && ( maxWidth >= minWidth ) )
+ effectiveMax = maxWidth;
+ else
+ effectiveMax = gridWidthAppFont; // TODO: any better guess here?
+
+ if ( effectiveMin == effectiveMax )
+ // if the min and the max are identical, this implies no flexibility at all
+ flexibility = 0;
}
- double colWidthsSum = 0.0;
- double colWithoutFixedWidthsSum = 0.0;
- double minColWithoutFixedSum = 0.0;
- for ( ColPos col = 0; col < colCount; ++col )
+
+ columnFlexibilities.push_back( flexibility );
+ flexibilityDenominator += flexibility;
+
+ effectiveColumnLimits.push_back( ::std::pair< long, long >( effectiveMin, effectiveMax ) );
+ accumulatedMinWidth += effectiveMin;
+ accumulatedMaxWidth += effectiveMax;
+ }
+
+ ::std::vector< long > newWidths( currentColWidths );
+ if ( flexibilityDenominator == 0 )
+ {
+ // no column is flexible => don't adjust anything
+ }
+ else if ( gridWidthAppFont > accumulatedCurrentWidth )
+ { // we have space to give away ...
+ long distributeAppFontUnits = gridWidthAppFont - accumulatedCurrentWidth;
+ if ( gridWidthAppFont > accumulatedMaxWidth )
{
- PColumnModel pColumn = m_pModel->getColumnModel( col );
- DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" );
- if ( !pColumn )
- continue;
- TableMetrics colWidth = 0;
- TableMetrics colPrefWidth = pColumn->getPreferredWidth();
- bool bResizable = pColumn->isResizable();
- if(pColumn->getMinWidth() == 0 && bResizable)
- {
- pColumn->setMinWidth(1);
- minColWithoutFixedSum+=m_rAntiImpl.PixelToLogic( Size( 1, 0 ), MAP_APPFONT ).Width();
- }
- if(pColumn->getMaxWidth() == 0 && bResizable)
- pColumn->setMaxWidth(m_rAntiImpl.PixelToLogic( Size( (int)gridWidth, 0 ), MAP_APPFONT ).Width());
- if( colPrefWidth != 0)
- {
- if(m_bResizingGrid)
- {
- colWidth = pColumn->getWidth();
- pColumn->setPreferredWidth(0);
- }
- else
- {
- colWidth = colPrefWidth;
- pColumn->setWidth(colPrefWidth);
- }
- }
- else
- colWidth = pColumn->getWidth();
- long pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width();
- if(bResizable && colPrefWidth == 0)
+ // ... but the column's maximal widths are still less than we have
+ // => set them all to max
+ for ( size_t i = 0; i < size_t( colCount ); ++i )
{
- colWithoutFixedWidthsSum+=pixelWidth;
- lastResizableCol = col;
+ newWidths[i] = effectiveColumnLimits[i].second;
}
- colWidthsSum+=pixelWidth;
- aPrePixelWidths.push_back(pixelWidth);
- }
- double gridWidthWithoutFixed = gridWidth - colWidthsSum + colWithoutFixedWidthsSum;
- double scalingFactor = 1.0;
- if(m_bResizingGrid)
- {
- if(gridWidthWithoutFixed > (minColWithoutFixedSum+colWidthsSum - colWithoutFixedWidthsSum))
- scalingFactor = gridWidthWithoutFixed/colWithoutFixedWidthsSum;
}
else
{
- if(colWidthsSum < gridWidthWithoutFixed)
+ bool startOver = false;
+ do
{
- if(colWithoutFixedWidthsSum>0)
- scalingFactor = gridWidthWithoutFixed/colWithoutFixedWidthsSum;
+ startOver = false;
+ // distribute the remaining space amongst all columns with a positive flexibility
+ for ( size_t i=0; i<newWidths.size() && !startOver; ++i )
+ {
+ long const columnFlexibility = columnFlexibilities[i];
+ if ( columnFlexibility == 0 )
+ continue;
+
+ long newColWidth = currentColWidths[i] + columnFlexibility * distributeAppFontUnits / flexibilityDenominator;
+
+ if ( newColWidth > effectiveColumnLimits[i].second )
+ { // that was too much, we hit the col's maximum
+ // set the new width to exactly this maximum
+ newColWidth = effectiveColumnLimits[i].second;
+ // adjust the flexibility denominator ...
+ flexibilityDenominator -= columnFlexibility;
+ columnFlexibilities[i] = 0;
+ // ... and the remaining width ...
+ long const difference = newColWidth - currentColWidths[i];
+ distributeAppFontUnits -= difference;
+ // ... this way, we ensure that the width not taken up by this column is consumed by the other
+ // flexible ones (if there are some)
+
+ // and start over with the first column, since there might be earlier columns which need
+ // to be recalculated now
+ startOver = true;
+ }
+
+ newWidths[i] = newColWidth;
+ }
}
+ while ( startOver );
}
- for ( ColPos i = 0; i < colCount; ++i )
+ }
+ else if ( gridWidthAppFont < accumulatedCurrentWidth )
+ { // we need to take away some space from the columns which allow it ...
+ long takeAwayAppFontUnits = accumulatedCurrentWidth - gridWidthAppFont;
+ if ( gridWidthAppFont < accumulatedMinWidth )
{
- PColumnModel pColumn = m_pModel->getColumnModel( i );
- DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" );
- if ( !pColumn )
- continue;
- if(pColumn->isResizable() && pColumn->getPreferredWidth() == 0)
+ // ... but the column's minimal widths are still more than we have
+ // => set them all to min
+ for ( size_t i = 0; i < size_t( colCount ); ++i )
{
- aPrePixelWidths[i]*=scalingFactor;
- TableMetrics logicColWidth = m_rAntiImpl.PixelToLogic( Size( aPrePixelWidths[i], 0 ), MAP_APPFONT ).Width();
- pColumn->setWidth(logicColWidth);
+ newWidths[i] = effectiveColumnLimits[i].first;
}
- m_aColumnWidthsPixel.push_back( aPrePixelWidths[i] );
- m_aAccColumnWidthsPixel.push_back( accumulatedPixelWidth += aPrePixelWidths[i] );
}
- if(gridWidth > m_aAccColumnWidthsPixel[colCount-1])
+ else
{
- if(lastResizableCol >= 0)
+ bool startOver = false;
+ do
{
- PColumnModel pColumn = m_pModel->getColumnModel(lastResizableCol);
- m_aColumnWidthsPixel[lastResizableCol]+=gridWidth-m_aAccColumnWidthsPixel[colCount-1];
- TableMetrics logicColWidth1 = m_rAntiImpl.PixelToLogic( Size( m_aColumnWidthsPixel[lastResizableCol], 0 ), MAP_APPFONT ).Width();
- pColumn->setWidth(logicColWidth1);
- while(lastResizableCol < colCount)
+ startOver = false;
+ // take away the space we need from the columns with a positive flexibility
+ for ( size_t i=0; i<newWidths.size() && !startOver; ++i )
{
- if(lastResizableCol == 0)
- m_aAccColumnWidthsPixel[0] = m_aColumnWidthsPixel[lastResizableCol];
- else
- m_aAccColumnWidthsPixel[lastResizableCol]=m_aAccColumnWidthsPixel[lastResizableCol-1]+m_aColumnWidthsPixel[lastResizableCol];
- ++lastResizableCol;
+ long const columnFlexibility = columnFlexibilities[i];
+ if ( columnFlexibility == 0 )
+ continue;
+
+ long newColWidth = currentColWidths[i] - columnFlexibility * takeAwayAppFontUnits / flexibilityDenominator;
+
+ if ( newColWidth < effectiveColumnLimits[i].first )
+ { // that was too much, we hit the col's minimum
+ // set the new width to exactly this minimum
+ newColWidth = effectiveColumnLimits[i].first;
+ // adjust the flexibility denominator ...
+ flexibilityDenominator -= columnFlexibility;
+ columnFlexibilities[i] = 0;
+ // ... and the remaining width ...
+ long const difference = currentColWidths[i] - newColWidth;
+ takeAwayAppFontUnits -= difference;
+
+ // and start over with the first column, since there might be earlier columns which need
+ // to be recalculated now
+ startOver = true;
+ }
+
+ newWidths[i] = newColWidth;
}
}
+ while ( startOver );
+ }
+ }
+
+ // now that we have calculated the app-font widths, get the actual pixels
+ long accumulatedWidthPixel = m_nRowHeaderWidthPixel;
+ for ( ColPos col = 0; col < colCount; ++col )
+ {
+ long const colWidth = m_rAntiImpl.LogicToPixel( Size( newWidths[col], 0 ), MAP_APPFONT ).Width();
+ const long columnStart = accumulatedWidthPixel;
+ const long columnEnd = columnStart + colWidth;
+ m_aColumnWidths.push_back( MutableColumnMetrics( columnStart, columnEnd ) );
+ accumulatedWidthPixel = columnEnd;
+
+ // and don't forget to forward this to the column models
+ PColumnModel const pColumn = m_pModel->getColumnModel( col );
+ ENSURE_OR_THROW( !!pColumn, "invalid column returned by the model!" );
+ pColumn->setWidth( newWidths[col] );
+ }
+
+ // if the column resizing happened to leave some space at the right, but there are columns
+ // scrolled out to the left, scroll them in
+ while ( ( m_nLeftColumn > 0 )
+ && ( accumulatedWidthPixel - m_aColumnWidths[ m_nLeftColumn - 1 ].getStart() <= gridWidthPixel )
+ )
+ {
+ --m_nLeftColumn;
+ }
+
+ // now adjust the column metrics, since they currently ignore the horizontal scroll position
+ if ( m_nLeftColumn > 0 )
+ {
+ const long offsetPixel = m_aColumnWidths[ 0 ].getStart() - m_aColumnWidths[ m_nLeftColumn ].getStart();
+ for ( ColumnPositions::iterator colPos = m_aColumnWidths.begin();
+ colPos != m_aColumnWidths.end();
+ ++colPos
+ )
+ {
+ colPos->move( offsetPixel );
}
}
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
namespace
{
- //................................................................
+ //..............................................................................................................
/// determines whether a scrollbar is needed for the given values
- bool lcl_determineScrollbarNeed( ScrollbarVisibility _eVisibility,
- long _nVisibleUnits, long _nRange )
+ bool lcl_determineScrollbarNeed( long const i_position, ScrollbarVisibility const i_visibility,
+ long const i_availableSpace, long const i_neededSpace )
{
- if ( _eVisibility == ScrollbarShowNever )
+ if ( i_visibility == ScrollbarShowNever )
return false;
- if ( _eVisibility == ScrollbarShowAlways )
+ if ( i_visibility == ScrollbarShowAlways )
+ return true;
+ if ( i_position > 0 )
return true;
- return _nVisibleUnits > _nRange;
+ if ( i_availableSpace >= i_neededSpace )
+ return false;
+ return true;
}
- //................................................................
+ //..............................................................................................................
void lcl_setButtonRepeat( Window& _rWindow, sal_uLong _nDelay )
{
AllSettings aSettings = _rWindow.GetSettings();
@@ -715,24 +1093,23 @@ namespace svt { namespace table
_rWindow.SetSettings( aSettings, sal_True );
}
- //................................................................
+ //..............................................................................................................
void lcl_updateScrollbar( Window& _rParent, ScrollBar*& _rpBar,
- ScrollbarVisibility _eVisibility, long _nVisibleUnits,
+ bool const i_needBar, long _nVisibleUnits,
long _nPosition, long _nLineSize, long _nRange,
bool _bHorizontal, const Link& _rScrollHandler )
{
- // do we need the scrollbar?
- bool bNeedBar = lcl_determineScrollbarNeed( _eVisibility, _nVisibleUnits, _nRange );
-
// do we currently have the scrollbar?
bool bHaveBar = _rpBar != NULL;
// do we need to correct the scrollbar visibility?
- if ( bHaveBar && !bNeedBar )
+ if ( bHaveBar && !i_needBar )
{
+ if ( _rpBar->IsTracking() )
+ _rpBar->EndTracking();
DELETEZ( _rpBar );
}
- else if ( !bHaveBar && bNeedBar )
+ else if ( !bHaveBar && i_needBar )
{
_rpBar = new ScrollBar(
&_rParent,
@@ -754,7 +1131,7 @@ namespace svt { namespace table
}
}
- //................................................................
+ //..............................................................................................................
/** returns the number of rows fitting into the given range,
for the given row height. Partially fitting rows are counted, too, if the
respective parameter says so.
@@ -766,7 +1143,7 @@ namespace svt { namespace table
: _nOverallHeight / _nRowHeightPixel;
}
- //................................................................
+ //..............................................................................................................
/** returns the number of columns fitting into the given area,
with the first visible column as given. Partially fitting columns are counted, too,
if the respective parameter says so.
@@ -791,15 +1168,13 @@ namespace svt { namespace table
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableControl_Impl::impl_ni_updateScrollbars()
{
- TempHideCursor aHideCursor( *this );
+ SuppressCursor aHideCursor( *this );
// the width/height of a scrollbar, needed several times below
- long nScrollbarMetrics = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize();
- if ( m_rAntiImpl.IsZoom() )
- nScrollbarMetrics = (long)( nScrollbarMetrics * (double)m_rAntiImpl.GetZoom() );
+ long const nScrollbarMetrics = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize();
// determine the playground for the data cells (excluding headers)
// TODO: what if the control is smaller than needed for the headers/scrollbars?
@@ -809,26 +1184,28 @@ namespace svt { namespace table
m_nRowCount = m_pModel->getRowCount();
m_nColumnCount = m_pModel->getColumnCount();
- if(m_aAccColumnWidthsPixel.empty())
- {
+ if ( m_aColumnWidths.empty() )
impl_ni_updateColumnWidths();
- }
+ OSL_ENSURE( m_aColumnWidths.size() == size_t( m_nColumnCount ), "TableControl_Impl::impl_ni_updateScrollbars: inconsistency!" );
+ const long nAllColumnsWidth = m_aColumnWidths.empty()
+ ? 0
+ : m_aColumnWidths[ m_nColumnCount - 1 ].getEnd() - m_aColumnWidths[ 0 ].getStart();
+
+ const ScrollbarVisibility eVertScrollbar = m_pModel->getVerticalScrollbarVisibility();
+ const ScrollbarVisibility eHorzScrollbar = m_pModel->getHorizontalScrollbarVisibility();
// do we need a vertical scrollbar?
+ bool bNeedVerticalScrollbar = lcl_determineScrollbarNeed(
+ m_nTopRow, eVertScrollbar, aDataCellPlayground.GetHeight(), m_nRowHeightPixel * m_nRowCount );
bool bFirstRoundVScrollNeed = false;
- if ( lcl_determineScrollbarNeed(
- m_pModel->getVerticalScrollbarVisibility(aDataCellPlayground.GetHeight(), m_nRowHeightPixel*m_nRowCount),
- lcl_getRowsFittingInto( aDataCellPlayground.GetHeight(), m_nRowHeightPixel ),
- m_nRowCount ) )
+ if ( bNeedVerticalScrollbar )
{
aDataCellPlayground.Right() -= nScrollbarMetrics;
bFirstRoundVScrollNeed = true;
}
// do we need a horizontal scrollbar?
- if ( lcl_determineScrollbarNeed(
- m_pModel->getHorizontalScrollbarVisibility(aDataCellPlayground.GetWidth(), m_aAccColumnWidthsPixel[m_nColumnCount-1]),
- lcl_getColumnsVisibleWithin( aDataCellPlayground, m_nLeftColumn, *this, false ),
- m_nColumnCount ) )
+ const bool bNeedHorizontalScrollbar = lcl_determineScrollbarNeed( m_nLeftColumn, eHorzScrollbar, aDataCellPlayground.GetWidth(), nAllColumnsWidth );
+ if ( bNeedHorizontalScrollbar )
{
aDataCellPlayground.Bottom() -= nScrollbarMetrics;
@@ -836,19 +1213,21 @@ namespace svt { namespace table
// the need for a vertical one may have changed, since the horizontal
// SB might just occupy enough space so that not all rows do fit
// anymore
- if ( !bFirstRoundVScrollNeed && lcl_determineScrollbarNeed(
- m_pModel->getVerticalScrollbarVisibility(aDataCellPlayground.GetHeight(),m_nRowHeightPixel*m_nRowCount),
- lcl_getRowsFittingInto( aDataCellPlayground.GetHeight(), m_nRowHeightPixel ),
- m_nRowCount ) )
+ if ( !bFirstRoundVScrollNeed )
{
- aDataCellPlayground.Right() -= nScrollbarMetrics;
+ bNeedVerticalScrollbar = lcl_determineScrollbarNeed(
+ m_nTopRow, eVertScrollbar, aDataCellPlayground.GetHeight(), m_nRowHeightPixel * m_nRowCount );
+ if ( bNeedVerticalScrollbar )
+ {
+ aDataCellPlayground.Right() -= nScrollbarMetrics;
+ }
}
}
// create or destroy the vertical scrollbar, as needed
lcl_updateScrollbar(
m_rAntiImpl,
m_pVScroll,
- m_pModel->getVerticalScrollbarVisibility(aDataCellPlayground.GetHeight(),m_nRowHeightPixel*m_nRowCount),
+ bNeedVerticalScrollbar,
lcl_getRowsFittingInto( aDataCellPlayground.GetHeight(), m_nRowHeightPixel ),
// visible units
m_nTopRow, // current position
@@ -872,7 +1251,7 @@ namespace svt { namespace table
lcl_updateScrollbar(
m_rAntiImpl,
m_pHScroll,
- m_pModel->getHorizontalScrollbarVisibility(aDataCellPlayground.GetWidth(), m_aAccColumnWidthsPixel[m_nColumnCount-1]),
+ bNeedHorizontalScrollbar,
lcl_getColumnsVisibleWithin( aDataCellPlayground, m_nLeftColumn, *this, false ),
// visible units
m_nLeftColumn, // current position
@@ -884,14 +1263,14 @@ namespace svt { namespace table
// position it
if ( m_pHScroll )
{
- TableSize nVisibleUnits = lcl_getColumnsVisibleWithin( aDataCellPlayground, m_nLeftColumn, *this, false );
- int nRange = m_nColumnCount;
- if( m_nLeftColumn + nVisibleUnits == nRange-1)
+ TableSize const nVisibleUnits = lcl_getColumnsVisibleWithin( aDataCellPlayground, m_nLeftColumn, *this, false );
+ TableMetrics const nRange = m_nColumnCount;
+ if( m_nLeftColumn + nVisibleUnits == nRange - 1 )
{
- if(m_aAccColumnWidthsPixel[nRange-2] - m_aAccColumnWidthsPixel[m_nLeftColumn] + m_aColumnWidthsPixel[nRange-1]>aDataCellPlayground.GetWidth())
+ if ( m_aColumnWidths[ nRange - 1 ].getStart() - m_aColumnWidths[ m_nLeftColumn ].getEnd() + m_aColumnWidths[ nRange-1 ].getWidth() > aDataCellPlayground.GetWidth() )
{
m_pHScroll->SetVisibleSize( nVisibleUnits -1 );
- m_pHScroll->SetPageSize(nVisibleUnits -1);
+ m_pHScroll->SetPageSize( nVisibleUnits - 1 );
}
}
Rectangle aScrollbarArea(
@@ -929,41 +1308,17 @@ namespace svt { namespace table
) );
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableControl_Impl::onResize()
{
DBG_CHECK_ME();
- if(m_nRowCount != 0)
- {
- if(m_nColumnCount != 0)
- {
- if(m_bResizingGrid)
- impl_ni_updateColumnWidths();
- invalidateRows();
- m_bResizingGrid = true;
- }
- }
- else
- {
- //In the case that column headers are defined but data hasn't yet been set,
- //only column headers will be shown
- if(m_pModel->hasColumnHeaders())
- {
- if(m_nColHeaderHeightPixel>1)
- {
- m_pDataWindow->SetSizePixel( m_rAntiImpl.GetOutputSizePixel());
- if(m_bResizingGrid)
- //update column widths to fit in grid
- impl_ni_updateColumnWidths();
- m_bResizingGrid = true;
- }
- }
- if(m_nColumnCount != 0)
- impl_ni_updateScrollbars();
- }
+
+ impl_ni_updateColumnWidths();
+ impl_ni_updateScrollbars();
+ checkCursorPosition();
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableControl_Impl::doPaintContent( const Rectangle& _rUpdateRect )
{
DBG_CHECK_ME();
@@ -971,32 +1326,24 @@ namespace svt { namespace table
if ( !getModel() )
return;
PTableRenderer pRenderer = getModel()->getRenderer();
- DBG_ASSERT( !!pRenderer, "TableDataWindow::Paint: invalid renderer!" );
+ DBG_ASSERT( !!pRenderer, "TableDataWindow::doPaintContent: invalid renderer!" );
if ( !pRenderer )
return;
// our current style settings, to be passed to the renderer
const StyleSettings& rStyle = m_rAntiImpl.GetSettings().GetStyleSettings();
m_nRowCount = m_pModel->getRowCount();
- TableSize nVisibleRows = impl_getVisibleRows(true);
- TableSize nActualRows = m_nRowCount;
- if(m_nRowCount>nVisibleRows)
- nActualRows = nVisibleRows;
// the area occupied by all (at least partially) visible cells, including
// headers
- Rectangle aAllCellsWithHeaders;
- impl_getAllVisibleCellsArea( aAllCellsWithHeaders );
+ Rectangle const aAllCellsWithHeaders( impl_getAllVisibleCellsArea() );
// ............................
// draw the header column area
if ( m_pModel->hasColumnHeaders() )
{
- TableRowGeometry aHeaderRow( *this, Rectangle( Point( 0, 0 ),
+ TableRowGeometry const aHeaderRow( *this, Rectangle( Point( 0, 0 ),
aAllCellsWithHeaders.BottomRight() ), ROW_COL_HEADERS );
- Rectangle aColRect(aHeaderRow.getRect());
- //to avoid double lines when scrolling horizontally
- if(m_nLeftColumn != 0)
- --aColRect.Left();
+ Rectangle const aColRect(aHeaderRow.getRect());
pRenderer->PaintHeaderArea(
*m_pDataWindow, aColRect, true, false, rStyle
);
@@ -1012,7 +1359,7 @@ namespace svt { namespace table
if ( _rUpdateRect.GetIntersection( aCell.getRect() ).IsEmpty() )
continue;
- bool isActiveColumn = ( aCell.getColumn() == getCurColumn() );
+ bool isActiveColumn = ( aCell.getColumn() == getCurrentColumn() );
bool isSelectedColumn = false;
pRenderer->PaintColumnHeader( aCell.getColumn(), isActiveColumn, isSelectedColumn,
*m_pDataWindow, aCell.getRect(), rStyle );
@@ -1024,31 +1371,23 @@ namespace svt { namespace table
{
aRowHeaderArea = aAllCellsWithHeaders;
aRowHeaderArea.Right() = m_nRowHeaderWidthPixel - 1;
- if(m_nTopRow+nActualRows>m_nRowCount)
- aRowHeaderArea.Bottom() = m_nRowHeightPixel * (nActualRows -1)+ m_nColHeaderHeightPixel - 1;
- else
- aRowHeaderArea.Bottom() = m_nRowHeightPixel * nActualRows + m_nColHeaderHeightPixel - 1;
- //to avoid double lines when scrolling vertically
- if(m_nTopRow != 0)
- --aRowHeaderArea.Top();
- --aRowHeaderArea.Right();
- pRenderer->PaintHeaderArea(*m_pDataWindow, aRowHeaderArea, false, true, rStyle);
+
+ TableSize const nVisibleRows = impl_getVisibleRows( true );
+ TableSize nActualRows = nVisibleRows;
+ if ( m_nTopRow + nActualRows > m_nRowCount )
+ nActualRows = m_nRowCount - m_nTopRow;
+ aRowHeaderArea.Bottom() = m_nColHeaderHeightPixel + m_nRowHeightPixel * nActualRows - 1;
+
+ pRenderer->PaintHeaderArea( *m_pDataWindow, aRowHeaderArea, false, true, rStyle );
// Note that strictly, aRowHeaderArea also contains the intersection between column
// and row header area. However, below we go to paint this intersection, again,
// so this hopefully doesn't hurt if we already paint it here.
if ( m_pModel->hasColumnHeaders() )
{
- TableCellGeometry aIntersection( *this, Rectangle( Point( 0, 0 ),
+ TableCellGeometry const aIntersection( *this, Rectangle( Point( 0, 0 ),
aAllCellsWithHeaders.BottomRight() ), COL_ROW_HEADERS, ROW_COL_HEADERS );
- Rectangle aInters(aIntersection.getRect());
- //to avoid double line when scrolling vertically
- if( m_nTopRow != 0 )
- {
- --aInters.Top();
- --aInters.Bottom();
- }
- --aInters.Right();
+ Rectangle const aInters( aIntersection.getRect() );
pRenderer->PaintHeaderArea(
*m_pDataWindow, aInters, true, true, rStyle
);
@@ -1061,51 +1400,36 @@ namespace svt { namespace table
TableSize colCount = getModel()->getColumnCount();
// paint all rows
- Rectangle aAllDataCellsArea;
- impl_getAllVisibleDataCellArea( aAllDataCellsArea );
- ::std::vector< std::vector< ::com::sun::star::uno::Any > >& aCellContent = m_pModel->getCellContent();
+ Rectangle const aAllDataCellsArea( impl_getAllVisibleDataCellArea() );
for ( TableRowGeometry aRowIterator( *this, aAllCellsWithHeaders, getTopRow() );
aRowIterator.isValid();
aRowIterator.moveDown() )
{
if ( _rUpdateRect.GetIntersection( aRowIterator.getRect() ).IsEmpty() )
continue;
- bool isActiveRow = ( aRowIterator.getRow() == getCurRow() );
- bool isSelectedRow = false;
- if(!m_nRowSelected.empty())
- {
- for(std::vector<RowPos>::iterator itSel=m_nRowSelected.begin();
- itSel!=m_nRowSelected.end();++itSel)
- {
- if(*itSel == aRowIterator.getRow())
- isSelectedRow = true;
- }
- }
- Rectangle aRect = aRowIterator.getRect().GetIntersection( aAllDataCellsArea );
- //to avoid double lines
- if( aRowIterator.getRow() != 0 )
- --aRect.Top();
- if(m_nLeftColumn != 0)
- --aRect.Left();
- else
- {
- if(m_pModel->hasRowHeaders())
- --aRect.Left();
- }
+
+ bool const isActiveRow = ( aRowIterator.getRow() == getCurrentRow() );
+ bool const isSelectedRow = isRowSelected( aRowIterator.getRow() );
+
+ Rectangle const aRect = aRowIterator.getRect().GetIntersection( aAllDataCellsArea );
+
// give the redenderer a chance to prepare the row
- pRenderer->PrepareRow( aRowIterator.getRow(), isActiveRow, isSelectedRow,
- *m_pDataWindow, aRect, rStyle );
+ pRenderer->PrepareRow(
+ aRowIterator.getRow(), isActiveRow, isSelectedRow,
+ *m_pDataWindow, aRect, rStyle
+ );
// paint the row header
if ( m_pModel->hasRowHeaders() )
{
- Rectangle aCurrentRowHeader( aRowHeaderArea.GetIntersection( aRowIterator.getRect() ) );
- rtl::OUString rowHeaderName = m_pModel->getRowHeaderName()[aRowIterator.getRow()];
+ const Rectangle aCurrentRowHeader( aRowHeaderArea.GetIntersection( aRowIterator.getRect() ) );
pRenderer->PaintRowHeader( isActiveRow, isSelectedRow, *m_pDataWindow, aCurrentRowHeader,
- rStyle, rowHeaderName );
+ rStyle );
}
+
if ( !colCount )
continue;
+
// paint all cells in this row
for ( TableCellGeometry aCell( aRowIterator, m_nLeftColumn );
aCell.isValid();
@@ -1113,25 +1437,12 @@ namespace svt { namespace table
)
{
bool isSelectedColumn = false;
- ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic;
- ::com::sun::star::uno::Any rCellData = aCellContent[aRowIterator.getRow()][aCell.getColumn()];
- if(rCellData>>=xGraphic)
- {
- Image* pImage = new Image(xGraphic);
- if(pImage!=NULL)
- pRenderer->PaintCellImage( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow,
- *m_pDataWindow, aCell.getRect(), rStyle, pImage );
- }
- else
- {
- ::rtl::OUString sContent = convertToString(rCellData);
- pRenderer->PaintCellString( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow,
- *m_pDataWindow, aCell.getRect(), rStyle, sContent );
- }
+ pRenderer->PaintCell( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow,
+ *m_pDataWindow, aCell.getRect(), rStyle );
}
}
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableControl_Impl::hideCursor()
{
DBG_CHECK_ME();
@@ -1140,7 +1451,7 @@ namespace svt { namespace table
impl_ni_doSwitchCursor( false );
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableControl_Impl::showCursor()
{
DBG_CHECK_ME();
@@ -1150,12 +1461,14 @@ namespace svt { namespace table
impl_ni_doSwitchCursor( true );
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
bool TableControl_Impl::dispatchAction( TableControlAction _eAction )
{
DBG_CHECK_ME();
bool bSuccess = false;
+ bool selectionChanged = false;
+
Rectangle rCells;
switch ( _eAction )
{
@@ -1163,25 +1476,25 @@ namespace svt { namespace table
if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
{
//if other rows already selected, deselect them
- if(m_nRowSelected.size()>0)
+ if(m_aSelectedRows.size()>0)
{
- for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
- it!=m_nRowSelected.end();++it)
+ for(std::vector<RowPos>::iterator it=m_aSelectedRows.begin();
+ it!=m_aSelectedRows.end();++it)
{
invalidateSelectedRegion(*it, *it, rCells);
}
- m_nRowSelected.clear();
+ m_aSelectedRows.clear();
}
if(m_nCurRow < m_nRowCount-1)
{
++m_nCurRow;
- m_nRowSelected.push_back(m_nCurRow);
+ m_aSelectedRows.push_back(m_nCurRow);
}
else
- m_nRowSelected.push_back(m_nCurRow);
+ m_aSelectedRows.push_back(m_nCurRow);
invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
ensureVisible(m_nCurColumn,m_nCurRow,false);
- m_rAntiImpl.selectionChanged(true);
+ selectionChanged = true;
bSuccess = true;
}
else
@@ -1194,28 +1507,28 @@ namespace svt { namespace table
case cursorUp:
if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
{
- if(m_nRowSelected.size()>0)
+ if(m_aSelectedRows.size()>0)
{
- for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
- it!=m_nRowSelected.end();++it)
+ for(std::vector<RowPos>::iterator it=m_aSelectedRows.begin();
+ it!=m_aSelectedRows.end();++it)
{
invalidateSelectedRegion(*it, *it, rCells);
}
- m_nRowSelected.clear();
+ m_aSelectedRows.clear();
}
if(m_nCurRow>0)
{
--m_nCurRow;
- m_nRowSelected.push_back(m_nCurRow);
+ m_aSelectedRows.push_back(m_nCurRow);
invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
}
else
{
- m_nRowSelected.push_back(m_nCurRow);
+ m_aSelectedRows.push_back(m_nCurRow);
invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
}
ensureVisible(m_nCurColumn,m_nCurRow,false);
- m_rAntiImpl.selectionChanged(true);
+ selectionChanged = true;
bSuccess = true;
}
else
@@ -1277,259 +1590,269 @@ namespace svt { namespace table
case cursorBottomRight:
bSuccess = goTo( m_nColumnCount - 1, m_nRowCount - 1 );
break;
- case cursorSelectRow:
- {
- if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
- return bSuccess = false;
- //pos is the position of the current row in the vector of selected rows, if current row is selected
- int pos = getRowSelectedNumber(m_nRowSelected, m_nCurRow);
- //if current row is selected, it should be deselected, when ALT+SPACE are pressed
- if(pos>-1)
- {
- m_nRowSelected.erase(m_nRowSelected.begin()+pos);
- if(m_nRowSelected.empty() && m_nAnchor != -1)
- m_nAnchor = -1;
- }
- //else select the row->put it in the vector
- else
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
- m_rAntiImpl.selectionChanged(true);
- bSuccess = true;
- }
- break;
- case cursorSelectRowUp:
- {
- if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
- return bSuccess = false;
- else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+
+ case cursorSelectRow:
{
- //if there are other selected rows, deselect them
- return false;
+ if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
+ return bSuccess = false;
+ //pos is the position of the current row in the vector of selected rows, if current row is selected
+ int pos = getRowSelectedNumber(m_aSelectedRows, m_nCurRow);
+ //if current row is selected, it should be deselected, when ALT+SPACE are pressed
+ if(pos>-1)
+ {
+ m_aSelectedRows.erase(m_aSelectedRows.begin()+pos);
+ if(m_aSelectedRows.empty() && m_nAnchor != -1)
+ m_nAnchor = -1;
+ }
+ //else select the row->put it in the vector
+ else
+ m_aSelectedRows.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+ selectionChanged = true;
+ bSuccess = true;
}
- else
+ break;
+ case cursorSelectRowUp:
{
- //there are other selected rows
- if(m_nRowSelected.size()>0)
+ if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
+ return bSuccess = false;
+ else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+ {
+ //if there are other selected rows, deselect them
+ return false;
+ }
+ else
{
- //the anchor wasn't set -> a region is not selected, that's why clear all selection
- //and select the current row
- if(m_nAnchor==-1)
+ //there are other selected rows
+ if(m_aSelectedRows.size()>0)
{
- for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
- it!=m_nRowSelected.end();++it)
+ //the anchor wasn't set -> a region is not selected, that's why clear all selection
+ //and select the current row
+ if(m_nAnchor==-1)
{
- invalidateSelectedRegion(*it, *it, rCells);
- }
- m_nRowSelected.clear();
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
- }
- else
- {
- //a region is already selected, prevRow is last selected row and the row above - nextRow - should be selected
- int prevRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow);
- int nextRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow-1);
- if(prevRow>-1)
- {
- //if m_nCurRow isn't the upper one, can move up, otherwise not
- if(m_nCurRow>0)
- m_nCurRow--;
- else
- return bSuccess = true;
- //if nextRow already selected, deselect it, otherwise select it
- if(nextRow>-1 && m_nRowSelected[nextRow] == m_nCurRow)
- {
- m_nRowSelected.erase(m_nRowSelected.begin()+prevRow);
- invalidateSelectedRegion(m_nCurRow+1, m_nCurRow+1, rCells);
- }
- else
+ for(std::vector<RowPos>::iterator it=m_aSelectedRows.begin();
+ it!=m_aSelectedRows.end();++it)
{
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
- }
- }
+ invalidateSelectedRegion(*it, *it, rCells);
+ }
+ m_aSelectedRows.clear();
+ m_aSelectedRows.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+ }
else
{
- if(m_nCurRow>0)
+ //a region is already selected, prevRow is last selected row and the row above - nextRow - should be selected
+ int prevRow = getRowSelectedNumber(m_aSelectedRows, m_nCurRow);
+ int nextRow = getRowSelectedNumber(m_aSelectedRows, m_nCurRow-1);
+ if(prevRow>-1)
+ {
+ //if m_nCurRow isn't the upper one, can move up, otherwise not
+ if(m_nCurRow>0)
+ m_nCurRow--;
+ else
+ return bSuccess = true;
+ //if nextRow already selected, deselect it, otherwise select it
+ if(nextRow>-1 && m_aSelectedRows[nextRow] == m_nCurRow)
+ {
+ m_aSelectedRows.erase(m_aSelectedRows.begin()+prevRow);
+ invalidateSelectedRegion(m_nCurRow+1, m_nCurRow+1, rCells);
+ }
+ else
+ {
+ m_aSelectedRows.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+ }
+ }
+ else
{
- m_nRowSelected.push_back(m_nCurRow);
- m_nCurRow--;
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRegion(m_nCurRow+1, m_nCurRow, rCells);
+ if(m_nCurRow>0)
+ {
+ m_aSelectedRows.push_back(m_nCurRow);
+ m_nCurRow--;
+ m_aSelectedRows.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow+1, m_nCurRow, rCells);
+ }
}
}
}
- }
- else
- {
- //if nothing is selected and the current row isn't the upper one
- //select the current and one row above
- //otherwise select only the upper row
- if(m_nCurRow>0)
- {
- m_nRowSelected.push_back(m_nCurRow);
- m_nCurRow--;
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRegion(m_nCurRow+1, m_nCurRow, rCells);
- }
else
{
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+ //if nothing is selected and the current row isn't the upper one
+ //select the current and one row above
+ //otherwise select only the upper row
+ if(m_nCurRow>0)
+ {
+ m_aSelectedRows.push_back(m_nCurRow);
+ m_nCurRow--;
+ m_aSelectedRows.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow+1, m_nCurRow, rCells);
+ }
+ else
+ {
+ m_aSelectedRows.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+ }
}
+ m_pSelEngine->SetAnchor(sal_True);
+ m_nAnchor = m_nCurRow;
+ ensureVisible(m_nCurColumn, m_nCurRow, false);
+ selectionChanged = true;
+ bSuccess = true;
}
- m_pSelEngine->SetAnchor(sal_True);
- m_nAnchor = m_nCurRow;
- ensureVisible(m_nCurColumn, m_nCurRow, false);
- m_rAntiImpl.selectionChanged(true);
- bSuccess = true;
}
- }
- break;
- case cursorSelectRowDown:
- {
- if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
- bSuccess = false;
- else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
- {
- bSuccess = false;
- }
- else
+ break;
+ case cursorSelectRowDown:
{
- if(m_nRowSelected.size()>0)
+ if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
+ bSuccess = false;
+ else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+ {
+ bSuccess = false;
+ }
+ else
{
- //the anchor wasn't set -> a region is not selected, that's why clear all selection
- //and select the current row
- if(m_nAnchor==-1)
+ if(m_aSelectedRows.size()>0)
{
- for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
- it!=m_nRowSelected.end();++it)
+ //the anchor wasn't set -> a region is not selected, that's why clear all selection
+ //and select the current row
+ if(m_nAnchor==-1)
{
- invalidateSelectedRegion(*it, *it, rCells);
- }
- m_nRowSelected.clear();
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+ for(std::vector<RowPos>::iterator it=m_aSelectedRows.begin();
+ it!=m_aSelectedRows.end();++it)
+ {
+ invalidateSelectedRegion(*it, *it, rCells);
+ }
+ m_aSelectedRows.clear();
+ m_aSelectedRows.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+ }
+ else
+ {
+ //a region is already selected, prevRow is last selected row and the row beneath - nextRow - should be selected
+ int prevRow = getRowSelectedNumber(m_aSelectedRows, m_nCurRow);
+ int nextRow = getRowSelectedNumber(m_aSelectedRows, m_nCurRow+1);
+ if(prevRow>-1)
+ {
+ //if m_nCurRow isn't the last one, can move down, otherwise not
+ if(m_nCurRow<m_nRowCount-1)
+ m_nCurRow++;
+ else
+ return bSuccess = true;
+ //if next row already selected, deselect it, otherwise select it
+ if(nextRow>-1 && m_aSelectedRows[nextRow] == m_nCurRow)
+ {
+ m_aSelectedRows.erase(m_aSelectedRows.begin()+prevRow);
+ invalidateSelectedRegion(m_nCurRow-1, m_nCurRow-1, rCells);
+ }
+ else
+ {
+ m_aSelectedRows.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+ }
+ }
+ else
+ {
+ if(m_nCurRow<m_nRowCount-1)
+ {
+ m_aSelectedRows.push_back(m_nCurRow);
+ m_nCurRow++;
+ m_aSelectedRows.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow-1, m_nCurRow, rCells);
+ }
+ }
}
+ }
else
{
- //a region is already selected, prevRow is last selected row and the row beneath - nextRow - should be selected
- int prevRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow);
- int nextRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow+1);
- if(prevRow>-1)
- {
- //if m_nCurRow isn't the last one, can move down, otherwise not
- if(m_nCurRow<m_nRowCount-1)
- m_nCurRow++;
- else
- return bSuccess = true;
- //if next row already selected, deselect it, otherwise select it
- if(nextRow>-1 && m_nRowSelected[nextRow] == m_nCurRow)
- {
- m_nRowSelected.erase(m_nRowSelected.begin()+prevRow);
- invalidateSelectedRegion(m_nCurRow-1, m_nCurRow-1, rCells);
- }
- else
- {
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
- }
+ //there wasn't any selection, select current and row beneath, otherwise only row beneath
+ if(m_nCurRow<m_nRowCount-1)
+ {
+ m_aSelectedRows.push_back(m_nCurRow);
+ m_nCurRow++;
+ m_aSelectedRows.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow-1, m_nCurRow, rCells);
}
else
{
- if(m_nCurRow<m_nRowCount-1)
- {
- m_nRowSelected.push_back(m_nCurRow);
- m_nCurRow++;
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRegion(m_nCurRow-1, m_nCurRow, rCells);
- }
+ m_aSelectedRows.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
}
}
+ m_pSelEngine->SetAnchor(sal_True);
+ m_nAnchor = m_nCurRow;
+ ensureVisible(m_nCurColumn, m_nCurRow, false);
+ selectionChanged = true;
+ bSuccess = true;
}
+ }
+ break;
+
+ case cursorSelectRowAreaTop:
+ {
+ if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
+ bSuccess = false;
+ else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+ bSuccess = false;
else
{
- //there wasn't any selection, select current and row beneath, otherwise only row beneath
- if(m_nCurRow<m_nRowCount-1)
+ //select the region between the current and the upper row
+ RowPos iter = m_nCurRow;
+ invalidateSelectedRegion(m_nCurRow, 0, rCells);
+ //put the rows in vector
+ while(iter>=0)
{
- m_nRowSelected.push_back(m_nCurRow);
- m_nCurRow++;
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRegion(m_nCurRow-1, m_nCurRow, rCells);
- }
- else
- {
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+ if ( !isRowSelected( iter ) )
+ m_aSelectedRows.push_back(iter);
+ --iter;
}
+ m_nCurRow = 0;
+ m_nAnchor = m_nCurRow;
+ m_pSelEngine->SetAnchor(sal_True);
+ ensureVisible(m_nCurColumn, 0, false);
+ selectionChanged = true;
+ bSuccess = true;
}
- m_pSelEngine->SetAnchor(sal_True);
- m_nAnchor = m_nCurRow;
- ensureVisible(m_nCurColumn, m_nCurRow, false);
- m_rAntiImpl.selectionChanged(true);
- bSuccess = true;
}
- }
break;
- case cursorSelectRowAreaTop:
- {
- if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
- bSuccess = false;
- else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
- bSuccess = false;
- else
+
+ case cursorSelectRowAreaBottom:
{
- //select the region between the current and the upper row
+ if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
+ return bSuccess = false;
+ else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+ return bSuccess = false;
+ //select the region between the current and the last row
RowPos iter = m_nCurRow;
- invalidateSelectedRegion(m_nCurRow, 0, rCells);
- //put the rows in vector
- while(iter>=0)
+ invalidateSelectedRegion(m_nCurRow, m_nRowCount-1, rCells);
+ //put the rows in the vector
+ while(iter<=m_nRowCount)
{
- if(!isRowSelected(m_nRowSelected, iter))
- m_nRowSelected.push_back(iter);
- --iter;
+ if ( !isRowSelected( iter ) )
+ m_aSelectedRows.push_back(iter);
+ ++iter;
}
- m_nCurRow = 0;
+ m_nCurRow = m_nRowCount-1;
m_nAnchor = m_nCurRow;
m_pSelEngine->SetAnchor(sal_True);
- ensureVisible(m_nCurColumn, 0, false);
- m_rAntiImpl.selectionChanged(true);
+ ensureVisible(m_nCurColumn, m_nRowCount-1, false);
+ selectionChanged = true;
bSuccess = true;
}
- }
- break;
- case cursorSelectRowAreaBottom:
- {
- if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
- return bSuccess = false;
- else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
- return bSuccess = false;
- //select the region between the current and the last row
- RowPos iter = m_nCurRow;
- invalidateSelectedRegion(m_nCurRow, m_nRowCount-1, rCells);
- //put the rows in the vector
- while(iter<=m_nRowCount)
- {
- if(!isRowSelected(m_nRowSelected, iter))
- m_nRowSelected.push_back(iter);
- ++iter;
- }
- m_nCurRow = m_nRowCount-1;
- m_nAnchor = m_nCurRow;
- m_pSelEngine->SetAnchor(sal_True);
- ensureVisible(m_nCurColumn, m_nRowCount-1, false);
- m_rAntiImpl.selectionChanged(true);
- bSuccess = true;
- }
break;
default:
DBG_ERROR( "TableControl_Impl::dispatchAction: unsupported action!" );
+ break;
+ }
+
+ if ( bSuccess && selectionChanged )
+ {
+ m_rAntiImpl.Select();
}
+
return bSuccess;
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableControl_Impl::impl_ni_doSwitchCursor( bool _bShow )
{
PTableRenderer pRenderer = !!m_pModel ? m_pModel->getRenderer() : PTableRenderer();
@@ -1537,16 +1860,14 @@ namespace svt { namespace table
{
Rectangle aCellRect;
impl_getCellRect( m_nCurColumn, m_nCurRow, aCellRect );
- if(!m_pModel->hasRowHeaders() && m_nCurColumn == 0)
- aCellRect.Left()++;
if ( _bShow )
- pRenderer->ShowCellCursor( *m_pDataWindow, aCellRect);
+ pRenderer->ShowCellCursor( *m_pDataWindow, aCellRect );
else
- pRenderer->HideCellCursor( *m_pDataWindow, aCellRect);
+ pRenderer->HideCellCursor( *m_pDataWindow, aCellRect );
}
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableControl_Impl::impl_getCellRect( ColPos _nColumn, RowPos _nRow, Rectangle& _rCellRect ) const
{
DBG_CHECK_ME();
@@ -1560,164 +1881,236 @@ namespace svt { namespace table
return;
}
- Rectangle aAllCells;
- impl_getAllVisibleCellsArea( aAllCells );
-
- TableCellGeometry aCell( *this, aAllCells, _nColumn, _nRow );
+ TableCellGeometry aCell( *this, impl_getAllVisibleCellsArea(), _nColumn, _nRow );
_rCellRect = aCell.getRect();
- _rCellRect.Top()--;_rCellRect.Left()--;
}
- //-------------------------------------------------------------------------------
- RowPos TableControl_Impl::getCurrentRow(const Point& rPoint)
+
+ //------------------------------------------------------------------------------------------------------------------
+ RowPos TableControl_Impl::getRowAtPoint( const Point& rPoint ) const
+ {
+ DBG_CHECK_ME();
+ return impl_getRowForAbscissa( rPoint.Y() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ColPos TableControl_Impl::getColAtPoint( const Point& rPoint ) const
{
DBG_CHECK_ME();
- Rectangle rCellRect;
- RowPos newRowPos = -2;//-1 is HeaderRow
- ColPos newColPos = 0;
- for(int i=-1;i<m_nRowCount;i++)
+ return impl_getColumnForOrdinate( rPoint.X() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ TableCell TableControl_Impl::hitTest( Point const & i_point ) const
+ {
+ TableCell aCell( getColAtPoint( i_point ), getRowAtPoint( i_point ) );
+ if ( aCell.nColumn > COL_ROW_HEADERS )
{
- for(int j=-1;j<m_nColumnCount;j++)
+ PColumnModel const pColumn = m_pModel->getColumnModel( aCell.nColumn );
+ MutableColumnMetrics const & rColInfo( m_aColumnWidths[ aCell.nColumn ] );
+ if ( ( rColInfo.getEnd() - 3 <= i_point.X() )
+ && ( rColInfo.getEnd() >= i_point.X() )
+ && pColumn->isResizable()
+ )
{
- impl_getCellRect(j,i,rCellRect);
- if((rPoint.X() >= rCellRect.Left() && rPoint.X() <= rCellRect.Right()) && rPoint.Y() >= rCellRect.Top() && rPoint.Y() <= rCellRect.Bottom())
- {
- newRowPos = i;
- newColPos = j;
- if(newColPos != -1)
- m_nCurColumn = newColPos;
- return newRowPos;
- }
+ aCell.eArea = ColumnDivider;
}
}
- return newRowPos;
+ return aCell;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ColumnMetrics TableControl_Impl::getColumnMetrics( ColPos const i_column ) const
+ {
+ DBG_CHECK_ME();
+
+ ENSURE_OR_RETURN( ( i_column >= 0 ) && ( i_column < m_pModel->getColumnCount() ),
+ "TableControl_Impl::getColumnMetrics: illegal column index!", ColumnMetrics() );
+ return (ColumnMetrics const &)m_aColumnWidths[ i_column ];
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ PTableModel TableControl_Impl::getModel() const
+ {
+ return m_pModel;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ RowPos TableControl_Impl::getCurrentColumn() const
+ {
+ return m_nCurColumn;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ RowPos TableControl_Impl::getCurrentRow() const
+ {
+ return m_nCurRow;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::Size TableControl_Impl::getTableSizePixel() const
+ {
+ return m_pDataWindow->GetOutputSizePixel();
}
- //-------------------------------------------------------------------------------
- void TableControl_Impl::setCursorAtCurrentCell(const Point& rPoint)
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl_Impl::setPointer( Pointer const & i_pointer )
{
DBG_CHECK_ME();
- hideCursor();
- Rectangle rCellRect;
- RowPos newRowPos = -2;//-1 is HeaderRow
- ColPos newColPos = 0;
- for(int i=0;i<m_nRowCount;i++)
+ m_pDataWindow->SetPointer( i_pointer );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl_Impl::captureMouse()
+ {
+ m_pDataWindow->CaptureMouse();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl_Impl::releaseMouse()
+ {
+ m_pDataWindow->ReleaseMouse();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl_Impl::invalidate( TableArea const i_what )
+ {
+ switch ( i_what )
{
- for(int j=-1;j<m_nColumnCount;j++)
- {
- impl_getCellRect(j,i,rCellRect);
- if((rPoint.X() >= rCellRect.Left() && rPoint.X() <= rCellRect.Right()) && rPoint.Y() >= rCellRect.Top() && rPoint.Y() <= rCellRect.Bottom())
- {
- newRowPos = i;
- m_nCurRow = newRowPos;
- newColPos = j;
- if(newColPos == -1)
- m_nCurColumn = 0;
- else
- m_nCurColumn = newColPos;
- }
- }
+ case TableAreaColumnHeaders:
+ m_pDataWindow->Invalidate( calcHeaderRect( true ) );
+ break;
+
+ case TableAreaRowHeaders:
+ m_pDataWindow->Invalidate( calcHeaderRect( false ) );
+ break;
+
+ case TableAreaDataArea:
+ m_pDataWindow->Invalidate( impl_getAllVisibleDataCellArea() );
+ break;
+
+ case TableAreaAll:
+ m_pDataWindow->Invalidate();
+ break;
}
- showCursor();
}
- //-------------------------------------------------------------------------------
+
+ //------------------------------------------------------------------------------------------------------------------
+ long TableControl_Impl::pixelWidthToAppFont( long const i_pixels ) const
+ {
+ return m_pDataWindow->PixelToLogic( Size( i_pixels, 0 ), MAP_APPFONT ).Width();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl_Impl::hideTracking()
+ {
+ m_pDataWindow->HideTracking();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl_Impl::showTracking( Rectangle const & i_location, sal_uInt16 const i_flags )
+ {
+ m_pDataWindow->ShowTracking( i_location, i_flags );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool TableControl_Impl::activateCell( ColPos const i_col, RowPos const i_row )
+ {
+ DBG_CHECK_ME();
+ return goTo( i_col, i_row );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
void TableControl_Impl::invalidateSelectedRegion(RowPos _nPrevRow, RowPos _nCurRow, Rectangle& _rCellRect)
{
DBG_CHECK_ME();
- Rectangle aAllCells;
//get the visible area of the table control and set the Left and right border of the region to be repainted
- impl_getAllVisibleCellsArea( aAllCells );
+ Rectangle const aAllCells( impl_getAllVisibleCellsArea() );
_rCellRect.Left() = aAllCells.Left();
_rCellRect.Right() = aAllCells.Right();
- Rectangle rCells;
//if only one row is selected
if(_nPrevRow == _nCurRow)
{
- impl_getCellRect(m_nCurColumn,_nCurRow,rCells);
- _rCellRect.Top()=--rCells.Top();
- _rCellRect.Bottom()=rCells.Bottom();
+ Rectangle aCellRect;
+ impl_getCellRect( m_nCurColumn, _nCurRow, aCellRect );
+ _rCellRect.Top() = aCellRect.Top();
+ _rCellRect.Bottom() = aCellRect.Bottom();
}
//if the region is above the current row
else if(_nPrevRow < _nCurRow )
{
- impl_getCellRect(m_nCurColumn,_nPrevRow,rCells);
- _rCellRect.Top()= --rCells.Top();
- impl_getCellRect(m_nCurColumn,_nCurRow,rCells);
- _rCellRect.Bottom()=rCells.Bottom();
+ Rectangle aCellRect;
+ impl_getCellRect( m_nCurColumn, _nPrevRow, aCellRect );
+ _rCellRect.Top() = aCellRect.Top();
+ impl_getCellRect( m_nCurColumn, _nCurRow, aCellRect );
+ _rCellRect.Bottom() = aCellRect.Bottom();
}
//if the region is beneath the current row
else
{
- impl_getCellRect(m_nCurColumn,_nCurRow,rCells);
- _rCellRect.Top()= --rCells.Top();
- impl_getCellRect(m_nCurColumn,_nPrevRow,rCells);
- _rCellRect.Bottom()=rCells.Bottom();
+ Rectangle aCellRect;
+ impl_getCellRect( m_nCurColumn, _nCurRow, aCellRect );
+ _rCellRect.Top() = aCellRect.Top();
+ impl_getCellRect( m_nCurColumn, _nPrevRow, aCellRect );
+ _rCellRect.Bottom() = aCellRect.Bottom();
}
m_pDataWindow->Invalidate(_rCellRect);
}
- //-------------------------------------------------------------------------------
- //this method is to be called, when a new row is added
- void TableControl_Impl::invalidateRow(RowPos _nRowPos, Rectangle& _rCellRect)
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl_Impl::invalidateRowRange( RowPos const i_firstRow, RowPos const i_lastRow )
{
- if(m_nCurRow < 0)
- m_nCurRow = 0;
- if(m_nCursorHidden == 2)
+ if ( m_nCursorHidden == 2 )
+ // WTF? what kind of hack is this?
--m_nCursorHidden;
- impl_getAllVisibleCellsArea( _rCellRect );
- TableRowGeometry _rRow( *this, _rCellRect, _nRowPos);
- impl_ni_updateScrollbars();
- m_pDataWindow->Invalidate(_rRow.getRect());
- }
- //-------------------------------------------------------------------------------
- std::vector<RowPos>& TableControl_Impl::getSelectedRows()
- {
- return m_nRowSelected;
- }
- //--------------------------------------------------------------------
- void TableControl_Impl::clearSelection()
- {
- m_nRowSelected.clear();
- }
- //--------------------------------------------------------------------
- //-------------------------------------------------------------------------------
- void TableControl_Impl::removeSelectedRow(RowPos _nRowPos)
- {
- int i =0;
- //if the row is selected, remove it from the selection vector
- if(isRowSelected(m_nRowSelected, _nRowPos))
- {
- if(m_nRowSelected.size()>1)
- m_nRowSelected.erase(m_nRowSelected.begin()+_nRowPos);
- else
- m_nRowSelected.clear();
- }
- //after removing a row, row positions must be updated, so selected rows could stay selected
- if(m_nRowSelected.size()>1)
+
+ RowPos const firstRow = i_firstRow < m_nTopRow ? m_nTopRow : i_firstRow;
+ RowPos const lastVisibleRow = m_nTopRow + impl_getVisibleRows( true ) - 1;
+ RowPos const lastRow = ( ( i_lastRow == ROW_INVALID ) || ( i_lastRow > lastVisibleRow ) ) ? lastVisibleRow : i_lastRow;
+
+ Rectangle aInvalidateRect;
+
+ Rectangle const aVisibleCellsArea( impl_getAllVisibleCellsArea() );
+ TableRowGeometry aRow( *this, aVisibleCellsArea, firstRow, true );
+ while ( aRow.isValid() && ( aRow.getRow() <= lastRow ) )
{
- for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();it!=m_nRowSelected.end();++it)
- {
- if(*it > _nRowPos)
- m_nRowSelected[i]=*it-1;
- ++i;
- }
+ aInvalidateRect.Union( aRow.getRect() );
+ aRow.moveDown();
}
- if(_nRowPos == 0)
- m_nCurRow = 0;
- else
- m_nCurRow = _nRowPos-1;
+
+ if ( i_lastRow == ROW_INVALID )
+ aInvalidateRect.Bottom() = m_pDataWindow->GetOutputSizePixel().Height();
+
+ m_pDataWindow->Invalidate( aInvalidateRect );
}
+
//------------------------------------------------------------------------------
- void TableControl_Impl::invalidateRows()
+ void TableControl_Impl::checkCursorPosition()
{
- impl_ni_updateScrollbars();
+ DBG_CHECK_ME();
+
TableSize nVisibleRows = impl_getVisibleRows(true);
TableSize nVisibleCols = impl_getVisibleColumns(true);
- if(m_nTopRow+nVisibleRows>m_nRowCount && m_nRowCount>=nVisibleRows)
- m_nTopRow--;
+ if ( ( m_nTopRow + nVisibleRows > m_nRowCount )
+ && ( m_nRowCount >= nVisibleRows )
+ )
+ {
+ --m_nTopRow;
+ }
else
+ {
m_nTopRow = 0;
- if(m_nLeftColumn+nVisibleCols>m_nColumnCount && m_nColumnCount>=nVisibleCols)
- m_nLeftColumn--;
+ }
+
+ if ( ( m_nLeftColumn + nVisibleCols > m_nColumnCount )
+ && ( m_nColumnCount >= nVisibleCols )
+ )
+ {
+ --m_nLeftColumn;
+ }
else
+ {
m_nLeftColumn = 0;
+ }
+
m_pDataWindow->Invalidate();
}
@@ -1736,7 +2129,7 @@ namespace svt { namespace table
}
//--------------------------------------------------------------------
- TableSize TableControl_Impl::impl_getVisibleColumns( bool _bAcceptPartialRow ) const
+ TableSize TableControl_Impl::impl_getVisibleColumns( bool _bAcceptPartialCol ) const
{
DBG_CHECK_ME();
@@ -1746,7 +2139,7 @@ namespace svt { namespace table
Rectangle( Point( 0, 0 ), m_pDataWindow->GetOutputSizePixel() ),
m_nLeftColumn,
*this,
- _bAcceptPartialRow
+ _bAcceptPartialCol
);
}
@@ -1757,12 +2150,15 @@ namespace svt { namespace table
// TODO: give veto listeners a chance
- if ( ( _nColumn < -1 ) || ( _nColumn >= m_nColumnCount )
- || ( _nRow < -1 ) || ( _nRow >= m_nRowCount )
+ if ( ( _nColumn < 0 ) || ( _nColumn >= m_nColumnCount )
+ || ( _nRow < 0 ) || ( _nRow >= m_nRowCount )
)
+ {
+ OSL_ENSURE( false, "TableControl_Impl::goTo: invalid row or column index!" );
return false;
+ }
- TempHideCursor aHideCursor( *this );
+ SuppressCursor aHideCursor( *this );
m_nCurColumn = _nColumn;
m_nCurRow = _nRow;
@@ -1779,32 +2175,40 @@ namespace svt { namespace table
&& ( _nRow >= 0 ) && ( _nRow < m_nRowCount ),
"TableControl_Impl::ensureVisible: invalid coordinates!" );
- TempHideCursor aHideCursor( *this );
+ SuppressCursor aHideCursor( *this );
if ( _nColumn < m_nLeftColumn )
- impl_ni_ScrollColumns( _nColumn - m_nLeftColumn );
+ impl_scrollColumns( _nColumn - m_nLeftColumn );
else
{
TableSize nVisibleColumns = impl_getVisibleColumns( _bAcceptPartialVisibility );
if ( _nColumn > m_nLeftColumn + nVisibleColumns - 1 )
{
- impl_ni_ScrollColumns( _nColumn - ( m_nLeftColumn + nVisibleColumns - 1 ) );
+ impl_scrollColumns( _nColumn - ( m_nLeftColumn + nVisibleColumns - 1 ) );
// TODO: since not all columns have the same width, this might in theory result
// in the column still not being visible.
}
}
if ( _nRow < m_nTopRow )
- impl_ni_ScrollRows( _nRow - m_nTopRow );
+ impl_scrollRows( _nRow - m_nTopRow );
else
{
TableSize nVisibleRows = impl_getVisibleRows( _bAcceptPartialVisibility );
if ( _nRow > m_nTopRow + nVisibleRows - 1 )
- impl_ni_ScrollRows( _nRow - ( m_nTopRow + nVisibleRows - 1 ) );
+ impl_scrollRows( _nRow - ( m_nTopRow + nVisibleRows - 1 ) );
}
}
//--------------------------------------------------------------------
+ ::rtl::OUString TableControl_Impl::getCellContentAsString( RowPos const i_row, ColPos const i_col )
+ {
+ ::com::sun::star::uno::Any content;
+ m_pModel->getCellContent( i_col, i_row, content );
+ return CellValueConversion::convertToString( content );
+ }
+
+ //--------------------------------------------------------------------
TableSize TableControl_Impl::impl_ni_ScrollRows( TableSize _nRowDelta )
{
// compute new top row
@@ -1818,10 +2222,10 @@ namespace svt { namespace table
m_nTopRow = nNewTopRow;
// if updates are enabled currently, scroll the viewport
- if ( m_rAntiImpl.IsUpdateMode() && ( m_nTopRow != nOldTopRow ) )
+ if ( m_nTopRow != nOldTopRow )
{
DBG_SUSPEND_INV( INV_SCROLL_POSITION );
- TempHideCursor aHideCursor( *this );
+ SuppressCursor aHideCursor( *this );
// TODO: call a onStartScroll at our listener (or better an own onStartScroll,
// which hides the cursor and then calls the listener)
// Same for onEndScroll
@@ -1844,43 +2248,68 @@ namespace svt { namespace table
m_pVScroll->SetThumbPos( m_nTopRow );
}
+ // The scroll bar availaility might change when we scrolled. This is because we do not hide
+ // the scrollbar when it is, in theory, unnecessary, but currently at a position > 0. In this case, it will
+ // be auto-hidden when it's scrolled back to pos 0.
+ if ( m_nTopRow == 0 )
+ m_rAntiImpl.PostUserEvent( LINK( this, TableControl_Impl, OnUpdateScrollbars ) );
+
return (TableSize)( m_nTopRow - nOldTopRow );
}
//--------------------------------------------------------------------
+ TableSize TableControl_Impl::impl_scrollRows( TableSize const i_rowDelta )
+ {
+ DBG_CHECK_ME();
+ return impl_ni_ScrollRows( i_rowDelta );
+ }
+
+ //--------------------------------------------------------------------
TableSize TableControl_Impl::impl_ni_ScrollColumns( TableSize _nColumnDelta )
{
// compute new left column
- ColPos nNewLeftColumn =
+ const ColPos nNewLeftColumn =
::std::max(
::std::min( (ColPos)( m_nLeftColumn + _nColumnDelta ), (ColPos)( m_nColumnCount - 1 ) ),
(ColPos)0
);
- ColPos nOldLeftColumn = m_nLeftColumn;
+ const ColPos nOldLeftColumn = m_nLeftColumn;
m_nLeftColumn = nNewLeftColumn;
// if updates are enabled currently, scroll the viewport
- if ( m_rAntiImpl.IsUpdateMode() && ( m_nLeftColumn != nOldLeftColumn ) )
+ if ( m_nLeftColumn != nOldLeftColumn )
{
DBG_SUSPEND_INV( INV_SCROLL_POSITION );
- TempHideCursor aHideCursor( *this );
+ SuppressCursor aHideCursor( *this );
// TODO: call a onStartScroll at our listener (or better an own onStartScroll,
// which hides the cursor and then calls the listener)
// Same for onEndScroll
// scroll the view port, if possible
- Rectangle aDataArea( Point( m_nRowHeaderWidthPixel, 0 ), m_pDataWindow->GetOutputSizePixel() );
+ const Rectangle aDataArea( Point( m_nRowHeaderWidthPixel, 0 ), m_pDataWindow->GetOutputSizePixel() );
long nPixelDelta =
- ( m_nLeftColumn > 0 ? m_aAccColumnWidthsPixel[ m_nLeftColumn - 1 ] : 0 )
- - ( nOldLeftColumn > 0 ? m_aAccColumnWidthsPixel[ nOldLeftColumn - 1 ] : 0 );
+ m_aColumnWidths[ nOldLeftColumn ].getStart()
+ - m_aColumnWidths[ m_nLeftColumn ].getStart();
+
+ // update our column positions
+ // Do this *before* scrolling, as SCROLL_UPDATE will trigger a paint, which already needs the correct
+ // information in m_aColumnWidths
+ for ( ColumnPositions::iterator colPos = m_aColumnWidths.begin();
+ colPos != m_aColumnWidths.end();
+ ++colPos
+ )
+ {
+ colPos->move( nPixelDelta );
+ }
+ // scroll the window content (if supported and possible), or invalidate the complete window
if ( m_pDataWindow->GetBackground().IsScrollable()
&& abs( nPixelDelta ) < aDataArea.GetWidth()
)
{
- m_pDataWindow->Scroll( (long)-nPixelDelta, 0, aDataArea, SCROLL_CLIP | SCROLL_UPDATE );
+ m_pDataWindow->Scroll( nPixelDelta, 0, aDataArea, SCROLL_CLIP | SCROLL_UPDATE );
}
else
m_pDataWindow->Invalidate( INVALIDATE_UPDATE );
@@ -1889,39 +2318,55 @@ namespace svt { namespace table
m_pHScroll->SetThumbPos( m_nLeftColumn );
}
+ // The scroll bar availaility might change when we scrolled. This is because we do not hide
+ // the scrollbar when it is, in theory, unnecessary, but currently at a position > 0. In this case, it will
+ // be auto-hidden when it's scrolled back to pos 0.
+ if ( m_nLeftColumn == 0 )
+ m_rAntiImpl.PostUserEvent( LINK( this, TableControl_Impl, OnUpdateScrollbars ) );
+
return (TableSize)( m_nLeftColumn - nOldLeftColumn );
}
- //-------------------------------------------------------------------------------
- SelectionEngine* TableControl_Impl::getSelEngine()
+
+ //------------------------------------------------------------------------------------------------------------------
+ TableSize TableControl_Impl::impl_scrollColumns( TableSize const i_columnDelta )
{
- return m_pSelEngine;
+ DBG_CHECK_ME();
+ return impl_ni_ScrollColumns( i_columnDelta );
}
- //-------------------------------------------------------------------------------
- TableDataWindow* TableControl_Impl::getDataWindow()
+
+ //------------------------------------------------------------------------------------------------------------------
+ SelectionEngine* TableControl_Impl::getSelEngine()
{
- return m_pDataWindow;
+ return m_pSelEngine;
}
- //-------------------------------------------------------------------------------
+
+ //------------------------------------------------------------------------------------------------------------------
ScrollBar* TableControl_Impl::getHorzScrollbar()
{
return m_pHScroll;
}
- //-------------------------------------------------------------------------------
+
+ //------------------------------------------------------------------------------------------------------------------
ScrollBar* TableControl_Impl::getVertScrollbar()
{
return m_pVScroll;
}
- //-------------------------------------------------------------------------------
- sal_Bool TableControl_Impl::isRowSelected(const ::std::vector<RowPos>& selectedRows, RowPos current)
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool TableControl_Impl::isRowSelected( RowPos i_row ) const
{
- return ::std::find(selectedRows.begin(),selectedRows.end(),current) != selectedRows.end();
+ return ::std::find( m_aSelectedRows.begin(), m_aSelectedRows.end(), i_row ) != m_aSelectedRows.end();
}
- //-------------------------------------------------------------------------------
- bool TableControl_Impl::isRowSelected(RowPos current)
+
+ //------------------------------------------------------------------------------------------------------------------
+ RowPos TableControl_Impl::getSelectedRowIndex( size_t const i_selectionIndex ) const
{
- return ::std::find(m_nRowSelected.begin(),m_nRowSelected.end(),current) != m_nRowSelected.end();
+ if ( i_selectionIndex < m_aSelectedRows.size() )
+ return m_aSelectedRows[ i_selectionIndex ];
+ return ROW_INVALID;
}
- //-------------------------------------------------------------------------------
+
+ //------------------------------------------------------------------------------------------------------------------
int TableControl_Impl::getRowSelectedNumber(const ::std::vector<RowPos>& selectedRows, RowPos current)
{
std::vector<RowPos>::const_iterator it = ::std::find(selectedRows.begin(),selectedRows.end(),current);
@@ -1931,281 +2376,158 @@ namespace svt { namespace table
}
return -1;
}
- //-------------------------------------------------------------------------------
- bool TableControl_Impl::isTooltipActive()
- {
- return m_rAntiImpl.isTooltip();
- }
- //-------------------------------------------------------------------------------
- ::rtl::OUString& TableControl_Impl::setTooltip(const Point& rPoint )
+
+ //--------------------------------------------------------------------
+ ColPos TableControl_Impl::impl_getColumnForOrdinate( long const i_ordinate ) const
{
- ::rtl::OUString aTooltipText;
- RowPos current = getCurrentRow(rPoint);
- com::sun::star::uno::Sequence< sal_Int32 > cols = m_rAntiImpl.getColumnsForTooltip();
- com::sun::star::uno::Sequence< ::rtl::OUString > text = m_rAntiImpl.getTextForTooltip();
- if(text.getLength()==0 && cols.getLength()==0)
- {
- ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][m_nCurColumn];
- aTooltipText = convertToString(content);
- }
- else if(text.getLength() == 0)
- {
- for(int i=0; i<cols.getLength(); i++)
- {
- if(i==0)
- {
- ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][cols[i]];
- aTooltipText = convertToString(content);
- }
- else
- {
- aTooltipText+= ::rtl::OUString::createFromAscii("\n");
- ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][cols[i]];
- aTooltipText += convertToString(content);
- }
- }
- }
- else if(cols.getLength() == 0)
- {
- for(int i=0; i<text.getLength(); i++)
- {
- if(i==0)
- aTooltipText = text[i];
- else
- {
- aTooltipText+= ::rtl::OUString::createFromAscii("\n");
- aTooltipText+= text[i];
- }
- }
- }
- else
+ DBG_CHECK_ME();
+
+ if ( ( m_aColumnWidths.empty() ) || ( i_ordinate < 0 ) )
+ return COL_INVALID;
+
+ if ( i_ordinate < m_nRowHeaderWidthPixel )
+ return COL_ROW_HEADERS;
+
+ long const ordinate = i_ordinate - m_nRowHeaderWidthPixel;
+
+ ColumnPositions::const_iterator lowerBound = ::std::lower_bound(
+ m_aColumnWidths.begin(),
+ m_aColumnWidths.end(),
+ ordinate + 1,
+ ColumnInfoPositionLess()
+ );
+ if ( lowerBound == m_aColumnWidths.end() )
{
- int nCols = cols.getLength();
- int mText = text.getLength();
- if(nCols < mText )
- cols.realloc(mText);
- else if(mText < nCols)
- text.realloc(nCols);
- for(int i=0; i<cols.getLength(); i++)
- {
- if(i==0)
- {
- ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][cols[i]];
- aTooltipText = text[i] + convertToString(content);
- }
- else
- {
- aTooltipText+= ::rtl::OUString::createFromAscii("\n");
- aTooltipText+= text[i];
- if(nCols > i)
- {
- ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][cols[i]];
- ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic;
- aTooltipText += convertToString(content);
- }
- }
- }
+ // point is *behind* the start of the last column ...
+ if ( ordinate < m_aColumnWidths.rbegin()->getEnd() )
+ // ... but still before its end
+ return m_nColumnCount - 1;
+ return COL_INVALID;
}
- return m_aTooltipText = aTooltipText;
+ return lowerBound - m_aColumnWidths.begin();
}
+
//--------------------------------------------------------------------
- void TableControl_Impl::resizeColumn(const Point& rPoint)
- {
- Pointer aNewPointer(POINTER_ARROW);
- int headerRowWidth = 0;
- if(m_pModel->hasRowHeaders())
- headerRowWidth = m_rAntiImpl.LogicToPixel( Size(m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT ).Width();
- int resizingColumn=m_nCurColumn-m_nLeftColumn;
- PColumnModel pColumn = m_pModel->getColumnModel(m_nCurColumn);
- impl_ni_getAccVisibleColWidths();
- int newColWidth = m_aColumnWidthsPixel[m_nCurColumn];
- //make resize area for the separator wider
- int nLeft = m_aVisibleColumnWidthsPixel[resizingColumn]-4;
- //subtract 1 from m_aAccColumnWidthPixel because right border should be part of the current cell
- int nRight = m_aVisibleColumnWidthsPixel[resizingColumn]-1;
- if( rPoint.X()> nLeft && rPoint.X()<nRight && pColumn->isResizable())
- aNewPointer = Pointer( POINTER_HSPLIT );
- //MouseButton was pressed but not yet released, mouse is moving
- if(m_bResizing)
- {
- if(rPoint.X() > m_pDataWindow->GetOutputSizePixel().Width() || rPoint.X() < m_aVisibleColumnWidthsPixel[resizingColumn]-newColWidth)
- aNewPointer = Pointer( POINTER_NOTALLOWED);
- else
- aNewPointer = Pointer( POINTER_HSPLIT );
- m_pDataWindow->HideTracking();
- int lineHeight = 0;
- if(m_pModel->hasColumnHeaders())
- lineHeight+= m_nColHeaderHeightPixel;
- lineHeight+=m_nRowHeightPixel*m_nRowCount;
- int gridHeight = m_pDataWindow->GetOutputSizePixel().Height();
- if(lineHeight >= gridHeight)
- lineHeight = gridHeight;
- m_pDataWindow->ShowTracking(Rectangle(Point(rPoint.X(),0), Size(1, lineHeight )),
- SHOWTRACK_SPLIT | SHOWTRACK_WINDOW);
- }
- m_pDataWindow->SetPointer(aNewPointer);
+ RowPos TableControl_Impl::impl_getRowForAbscissa( long const i_abscissa ) const
+ {
+ DBG_CHECK_ME();
+
+ if ( i_abscissa < 0 )
+ return ROW_INVALID;
+
+ if ( i_abscissa < m_nColHeaderHeightPixel )
+ return ROW_COL_HEADERS;
+
+ long const abscissa = i_abscissa - m_nColHeaderHeightPixel;
+ long const row = m_nTopRow + abscissa / m_nRowHeightPixel;
+ return row < m_pModel->getRowCount() ? row : ROW_INVALID;
}
+
//--------------------------------------------------------------------
- bool TableControl_Impl::startResizeColumn(const Point& rPoint)
+ bool TableControl_Impl::markRowAsDeselected( RowPos const i_rowIndex )
{
- m_bResizingGrid = false;
- m_nResizingColumn = m_nCurColumn;
- PColumnModel pColumn = m_pModel->getColumnModel(m_nResizingColumn);
- //make resize area for the separator wider
- int nLeft = m_aVisibleColumnWidthsPixel[m_nResizingColumn-m_nLeftColumn]-4;
- int nRight = m_aVisibleColumnWidthsPixel[m_nResizingColumn-m_nLeftColumn]-1;
- if(rPoint.X()> nLeft && rPoint.X()<nRight && pColumn->isResizable())
- {
- m_pDataWindow->CaptureMouse();
- m_bResizing = true;
- }
- return m_bResizing;
+ DBG_CHECK_ME();
+
+ ::std::vector< RowPos >::iterator selPos = ::std::find( m_aSelectedRows.begin(), m_aSelectedRows.end(), i_rowIndex );
+ if ( selPos == m_aSelectedRows.end() )
+ return false;
+
+ m_aSelectedRows.erase( selPos );
+ return true;
}
+
//--------------------------------------------------------------------
- bool TableControl_Impl::endResizeColumn(const Point& rPoint)
- {
- if(m_bResizing)
- {
- m_pDataWindow->HideTracking();
- PColumnModel pColumn = m_pModel->getColumnModel(m_nResizingColumn);
- int maxWidth = m_rAntiImpl.LogicToPixel( Size( pColumn->getMaxWidth(), 0 ), MAP_APPFONT ).Width();
- int minWidth = m_rAntiImpl.LogicToPixel( Size( pColumn->getMinWidth(), 0 ), MAP_APPFONT ).Width();
- int resizeCol = m_nResizingColumn-m_nLeftColumn;
- //new position of mouse
- int actX = rPoint.X();
- //old position of right border
- int oldX = m_aVisibleColumnWidthsPixel[resizeCol];
- //position of left border if cursor in the first cell
- int leftX = 0;
- if(m_nResizingColumn > m_nLeftColumn)
- leftX = m_aVisibleColumnWidthsPixel[resizeCol-1];
- else if(m_nResizingColumn == m_nLeftColumn && m_pModel->hasRowHeaders())
- leftX = m_rAntiImpl.LogicToPixel( Size( m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT ).Width();
- int actWidth = actX - leftX;
- int newActWidth = 0;
- //minimize the column width
- if(oldX > actX && actX >= leftX)
+ bool TableControl_Impl::markRowAsSelected( RowPos const i_rowIndex )
+ {
+ DBG_CHECK_ME();
+
+ if ( isRowSelected( i_rowIndex ) )
+ return false;
+
+ SelectionMode const eSelMode = getSelEngine()->GetSelectionMode();
+ switch ( eSelMode )
+ {
+ case SINGLE_SELECTION:
+ if ( !m_aSelectedRows.empty() )
{
- if(minWidth < actWidth)
- {
- newActWidth = m_rAntiImpl.PixelToLogic( Size( actWidth, 0 ), MAP_APPFONT ).Width();
- pColumn->setPreferredWidth(newActWidth);
- }
- else
- pColumn->setPreferredWidth(pColumn->getMinWidth());
- if(m_nLeftColumn != 0)
- impl_updateLeftColumn();
+ OSL_ENSURE( m_aSelectedRows.size() == 1, "TableControl::markRowAsSelected: SingleSelection with more than one selected element?" );
+ m_aSelectedRows[0] = i_rowIndex;
+ break;
+ }
+ // fall through
+
+ case MULTIPLE_SELECTION:
+ m_aSelectedRows.push_back( i_rowIndex );
+ break;
+
+ default:
+ OSL_ENSURE( false, "TableControl_Impl::markRowAsSelected: unsupported selection mode!" );
+ return false;
}
- else if(oldX < actX)
+
+ return true;
+ }
+
+ //--------------------------------------------------------------------
+ bool TableControl_Impl::markAllRowsAsDeselected()
+ {
+ if ( m_aSelectedRows.empty() )
+ return false;
+
+ m_aSelectedRows.clear();
+ return true;
+ }
+
+ //--------------------------------------------------------------------
+ bool TableControl_Impl::markAllRowsAsSelected()
+ {
+ DBG_CHECK_ME();
+
+ SelectionMode const eSelMode = getSelEngine()->GetSelectionMode();
+ ENSURE_OR_RETURN_FALSE( eSelMode == MULTIPLE_SELECTION, "TableControl_Impl::markAllRowsAsSelected: unsupported selection mode!" );
+
+ if ( m_aSelectedRows.size() == size_t( m_pModel->getRowCount() ) )
{
- if(actWidth < maxWidth)
+ #if OSL_DEBUG_LEVEL > 0
+ for ( TableSize row = 0; row < m_pModel->getRowCount(); ++row )
{
- newActWidth = m_rAntiImpl.PixelToLogic( Size( actWidth, 0 ), MAP_APPFONT ).Width();
- pColumn->setPreferredWidth(newActWidth);
+ OSL_ENSURE( isRowSelected( row ), "TableControl_Impl::markAllRowsAsSelected: inconsistency in the selected rows!" );
}
- else
- pColumn->setPreferredWidth(pColumn->getMaxWidth());
+ #endif
+ // already all rows marked as selected
+ return false;
}
- m_nCurColumn = m_nResizingColumn;
- impl_ni_updateColumnWidths();
- impl_ni_updateScrollbars();
- m_pDataWindow->Invalidate(INVALIDATE_UPDATE);
- m_pDataWindow->SetPointer(Pointer());
- m_bResizing = false;
- m_bResizingGrid = true;
- }
- m_pDataWindow->ReleaseMouse();
- return m_bResizing;
- }
- //-------------------------------------------------------------------------------
- void TableControl_Impl::impl_ni_getAccVisibleColWidths()
- {
- TableSize nVisCols = impl_getVisibleColumns(true);
- int widthsPixel = 0;
- m_aVisibleColumnWidthsPixel.resize(0);
- m_aVisibleColumnWidthsPixel.reserve(nVisCols);
- int headerRowWidth = 0;
- if(m_pModel->hasRowHeaders())
- {
- headerRowWidth = m_rAntiImpl.LogicToPixel( Size(m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT ).Width();
- widthsPixel+=headerRowWidth;
- }
- int col = m_nLeftColumn;
- while(nVisCols)
- {
- m_aVisibleColumnWidthsPixel.push_back(widthsPixel+=m_aColumnWidthsPixel[col]);
- col++;
- nVisCols--;
- }
- }
- //-------------------------------------------------------------------------------
- void TableControl_Impl::impl_updateLeftColumn()
- {
- int nVisCols = m_aVisibleColumnWidthsPixel.size();
- int headerRowWidth = 0;
- //sum of currently visible columns
- int widthsPixel = 0;
- //header pixel should be added, because header doesn't vanish when scrolling
- if(m_pModel->hasRowHeaders())
- {
- headerRowWidth = m_rAntiImpl.LogicToPixel( Size(m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT ).Width();
- widthsPixel+=headerRowWidth;
- }
- int col = m_nLeftColumn;
- //add column width of the neighbour of the left column
- widthsPixel+=m_aColumnWidthsPixel[col-1];
- //compute the sum of the new column widths
- while(nVisCols)
- {
- PColumnModel pColumn = m_pModel->getColumnModel(col);
- int colWidth = pColumn->getWidth();
- int colPrefWidth = pColumn->getPreferredWidth();
- if(colPrefWidth!=0)
- colWidth = colPrefWidth;
- widthsPixel += m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width();
- col++;
- nVisCols--;
- }
- //when the sum of all visible columns and the next to the left column is smaller than
- //window width, then update m_nLeftColumn
- if(widthsPixel<m_pDataWindow->GetOutputSizePixel().Width())
- m_nLeftColumn--;
+
+ m_aSelectedRows.clear();
+ for ( RowPos i=0; i < m_pModel->getRowCount(); ++i )
+ m_aSelectedRows.push_back(i);
+
+ return true;
}
+
//--------------------------------------------------------------------
- rtl::OUString TableControl_Impl::convertToString(const ::com::sun::star::uno::Any& value)
- {
- sal_Int32 nInt = 0;
- sal_Bool bBool = false;
- double fDouble = 0;
- ::rtl::OUString sNewString;
- ::rtl::OUString sConvertString;
- if(value >>= sConvertString)
- sNewString = sConvertString;
- else if(value >>= nInt)
- sNewString = sConvertString.valueOf(nInt);
- else if(value >>= bBool)
- sNewString = sConvertString.valueOf(bBool);
- else if(value >>= fDouble)
- sNewString = sConvertString.valueOf(fDouble);
- return sNewString;
- }
Rectangle TableControl_Impl::calcHeaderRect(bool bColHeader)
{
- Rectangle aRectTable, aRectTableWithHeaders;
- impl_getAllVisibleDataCellArea(aRectTable);
- impl_getAllVisibleCellsArea(aRectTableWithHeaders);
- Size aSizeTable(aRectTable.GetSize());
- Size aSizeTableWithHeaders(aRectTableWithHeaders.GetSize());
- if(bColHeader)
- return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width()-aSizeTable.Width(), aSizeTableWithHeaders.Height()));
+ Rectangle const aRectTableWithHeaders( impl_getAllVisibleCellsArea() );
+ Size const aSizeTableWithHeaders( aRectTableWithHeaders.GetSize() );
+ if ( bColHeader )
+ return Rectangle( aRectTableWithHeaders.TopLeft(), Size( aSizeTableWithHeaders.Width(), m_nColHeaderHeightPixel ) );
else
- return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width(), aSizeTableWithHeaders.Height()-aSizeTable.Height()));
+ return Rectangle( aRectTableWithHeaders.TopLeft(), Size( m_nRowHeaderWidthPixel, aSizeTableWithHeaders.Height() ) );
}
+
+ //--------------------------------------------------------------------
Rectangle TableControl_Impl::calcTableRect()
{
- Rectangle aRect;
- impl_getAllVisibleDataCellArea(aRect);
- return aRect;
+ return impl_getAllVisibleDataCellArea();
+ }
+
+ //--------------------------------------------------------------------
+ IMPL_LINK( TableControl_Impl, OnUpdateScrollbars, void*, /**/ )
+ {
+ DBG_CHECK_ME();
+ impl_ni_updateScrollbars();
+ return 1L;
}
//--------------------------------------------------------------------
@@ -2221,157 +2543,200 @@ namespace svt { namespace table
return 0L;
}
- //---------------------------------------------------------------------------------------
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessible > TableControl_Impl::getAccessible( Window& i_parentWindow )
+ {
+ DBG_TESTSOLARMUTEX();
+ if ( m_pAccessibleTable == NULL )
+ {
+ Reference< XAccessible > const xAccParent = i_parentWindow.GetAccessible();
+ if ( xAccParent.is() )
+ {
+ m_pAccessibleTable = m_aFactoryAccess.getFactory().createAccessibleTableControl(
+ xAccParent, m_rAntiImpl
+ );
+ }
+ }
+
+ Reference< XAccessible > xAccessible;
+ if ( m_pAccessibleTable )
+ xAccessible = m_pAccessibleTable->getMyself();
+ return xAccessible;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl_Impl::disposeAccessible()
+ {
+ if ( m_pAccessibleTable )
+ m_pAccessibleTable->dispose();
+ m_pAccessibleTable = NULL;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool TableControl_Impl::impl_isAccessibleAlive() const
+ {
+ DBG_CHECK_ME();
+ return ( NULL != m_pAccessibleTable ) && m_pAccessibleTable->isAlive();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TableControl_Impl::impl_commitAccessibleEvent( sal_Int16 const i_eventID, Any const & i_newValue, Any const & i_oldValue )
+ {
+ DBG_CHECK_ME();
+ if ( impl_isAccessibleAlive() )
+ m_pAccessibleTable->commitEvent( i_eventID, i_newValue, i_oldValue );
+ }
+
+ //==================================================================================================================
+ //= TableFunctionSet
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
TableFunctionSet::TableFunctionSet(TableControl_Impl* _pTableControl)
:m_pTableControl( _pTableControl)
- ,m_nCurrentRow (-2)
+ ,m_nCurrentRow( ROW_INVALID )
{
}
- //-------------------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
TableFunctionSet::~TableFunctionSet()
{
}
- //-------------------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableFunctionSet::BeginDrag()
{
}
- //-------------------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableFunctionSet::CreateAnchor()
{
- m_pTableControl->m_nAnchor = m_pTableControl->m_nCurRow;
+ m_pTableControl->setAnchor( m_pTableControl->getCurRow() );
}
- //-------------------------------------------------------------------------------
+
+ //------------------------------------------------------------------------------------------------------------------
void TableFunctionSet::DestroyAnchor()
{
- m_pTableControl->m_nAnchor = -1;
+ m_pTableControl->setAnchor( ROW_INVALID );
}
- //-------------------------------------------------------------------------------
+
+ //------------------------------------------------------------------------------------------------------------------
sal_Bool TableFunctionSet::SetCursorAtPoint(const Point& rPoint, sal_Bool bDontSelectAtCursor)
{
sal_Bool bHandled = sal_False;
- Rectangle rCells;
- //curRow is the row where the mouse click happened, m_nCurRow is the last selected row, before the mouse click
- RowPos curRow = m_pTableControl->getCurrentRow(rPoint);
- if(curRow == -2)
+ // newRow is the row which includes the point, getCurRow() is the last selected row, before the mouse click
+ RowPos newRow = m_pTableControl->getRowAtPoint( rPoint );
+ if ( newRow == ROW_COL_HEADERS )
+ newRow = m_pTableControl->getTopRow();
+
+ ColPos newCol = m_pTableControl->getColAtPoint( rPoint );
+ if ( newCol == COL_ROW_HEADERS )
+ newCol = m_pTableControl->getLeftColumn();
+
+ if ( ( newRow == ROW_INVALID ) || ( newCol == COL_INVALID ) )
return sal_False;
- if( bDontSelectAtCursor )
+
+ if ( bDontSelectAtCursor )
{
- if(m_pTableControl->m_nRowSelected.size()>1)
- m_pTableControl->m_pSelEngine->AddAlways(sal_True);
+ if ( m_pTableControl->getSelectedRowCount() > 1 )
+ m_pTableControl->getSelEngine()->AddAlways(sal_True);
bHandled = sal_True;
}
- else if(m_pTableControl->m_nAnchor == m_pTableControl->m_nCurRow)
+ else if ( m_pTableControl->getAnchor() == m_pTableControl->getCurRow() )
{
//selecting region,
- int diff = m_pTableControl->m_nCurRow - curRow;
+ int diff = m_pTableControl->getCurRow() - newRow;
//selected region lies above the last selection
if( diff >= 0)
{
//put selected rows in vector
- while(m_pTableControl->m_nAnchor>=curRow)
+ while ( m_pTableControl->getAnchor() >= newRow )
{
- bool isAlreadySelected = m_pTableControl->isRowSelected(m_pTableControl->m_nRowSelected, m_pTableControl->m_nAnchor);
- //if row isn't selected, put it in vector, otherwise don't put it there, because it will be twice there
- if(!isAlreadySelected)
- m_pTableControl->m_nRowSelected.push_back(m_pTableControl->m_nAnchor);
- m_pTableControl->m_nAnchor--;
+ m_pTableControl->markRowAsSelected( m_pTableControl->getAnchor() );
+ m_pTableControl->setAnchor( m_pTableControl->getAnchor() - 1 );
diff--;
}
- m_pTableControl->m_nAnchor++;
+ m_pTableControl->setAnchor( m_pTableControl->getAnchor() + 1 );
}
//selected region lies beneath the last selected row
else
{
- while(m_pTableControl->m_nAnchor<=curRow)
+ while ( m_pTableControl->getAnchor() <= newRow )
{
- bool isAlreadySelected = m_pTableControl->isRowSelected(m_pTableControl->m_nRowSelected, m_pTableControl->m_nAnchor);
- if(!isAlreadySelected)
- m_pTableControl->m_nRowSelected.push_back(m_pTableControl->m_nAnchor);
- m_pTableControl->m_nAnchor++;
+ m_pTableControl->markRowAsSelected( m_pTableControl->getAnchor() );
+ m_pTableControl->setAnchor( m_pTableControl->getAnchor() + 1 );
diff++;
}
- m_pTableControl->m_nAnchor--;
+ m_pTableControl->setAnchor( m_pTableControl->getAnchor() - 1 );
}
- m_pTableControl->invalidateSelectedRegion(m_pTableControl->m_nCurRow, curRow, rCells);
+ Rectangle aCellRect;
+ m_pTableControl->invalidateSelectedRegion( m_pTableControl->getCurRow(), newRow, aCellRect );
bHandled = sal_True;
}
//no region selected
else
{
- if(m_pTableControl->m_nRowSelected.empty())
- m_pTableControl->m_nRowSelected.push_back(curRow);
+ if ( !m_pTableControl->hasRowSelection() )
+ m_pTableControl->markRowAsSelected( newRow );
else
{
- if(m_pTableControl->m_pSelEngine->GetSelectionMode()==SINGLE_SELECTION)
+ if ( m_pTableControl->getSelEngine()->GetSelectionMode() == SINGLE_SELECTION )
{
DeselectAll();
- m_pTableControl->m_nRowSelected.push_back(curRow);
+ m_pTableControl->markRowAsSelected( newRow );
}
else
{
- bool isAlreadySelected = m_pTableControl->isRowSelected(m_pTableControl->m_nRowSelected, curRow);
- if(!isAlreadySelected)
- m_pTableControl->m_nRowSelected.push_back(curRow);
+ m_pTableControl->markRowAsSelected( newRow );
}
}
- if(m_pTableControl->m_nRowSelected.size()>1 && m_pTableControl->m_pSelEngine->GetSelectionMode()!=SINGLE_SELECTION)
- m_pTableControl->m_pSelEngine->AddAlways(sal_True);
- m_pTableControl->invalidateSelectedRegion(curRow, curRow, rCells);
+ if ( m_pTableControl->getSelectedRowCount() > 1 && m_pTableControl->getSelEngine()->GetSelectionMode() != SINGLE_SELECTION )
+ m_pTableControl->getSelEngine()->AddAlways(sal_True);
+
+ Rectangle aCellRect;
+ m_pTableControl->invalidateSelectedRegion( newRow, newRow, aCellRect );
bHandled = sal_True;
}
- m_pTableControl->m_nCurRow = curRow;
- m_pTableControl->ensureVisible(m_pTableControl->m_nCurColumn,m_pTableControl->m_nCurRow,false);
+ m_pTableControl->goTo( newCol, newRow );
return bHandled;
}
- //-------------------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
sal_Bool TableFunctionSet::IsSelectionAtPoint( const Point& rPoint )
{
- m_pTableControl->m_pSelEngine->AddAlways(sal_False);
- if(m_pTableControl->m_nRowSelected.empty())
+ m_pTableControl->getSelEngine()->AddAlways(sal_False);
+ if ( !m_pTableControl->hasRowSelection() )
return sal_False;
else
{
- RowPos curRow = m_pTableControl->getCurrentRow(rPoint);
- m_pTableControl->m_nAnchor = -1;
- bool selected = m_pTableControl->isRowSelected(m_pTableControl->m_nRowSelected, curRow);
+ RowPos curRow = m_pTableControl->getRowAtPoint( rPoint );
+ m_pTableControl->setAnchor( ROW_INVALID );
+ bool selected = m_pTableControl->isRowSelected( curRow );
m_nCurrentRow = curRow;
return selected;
}
}
- //-------------------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableFunctionSet::DeselectAtPoint( const Point& rPoint )
{
(void)rPoint;
- long pos = 0;
- long i = 0;
- Rectangle rCells;
- for(std::vector<RowPos>::iterator it=m_pTableControl->m_nRowSelected.begin();
- it!=m_pTableControl->m_nRowSelected.end();++it)
- {
- if(*it == m_nCurrentRow)
- {
- pos = i;
- m_pTableControl->invalidateSelectedRegion(*it, *it, rCells);
- }
- ++i;
- }
- m_pTableControl->m_nRowSelected.erase(m_pTableControl->m_nRowSelected.begin()+pos);
+ Rectangle aCellRange;
+ m_pTableControl->invalidateSelectedRegion( m_nCurrentRow, m_nCurrentRow, aCellRange );
+ m_pTableControl->markRowAsDeselected( m_nCurrentRow );
}
- //-------------------------------------------------------------------------------
+
+ //------------------------------------------------------------------------------------------------------------------
void TableFunctionSet::DeselectAll()
{
- if(!m_pTableControl->m_nRowSelected.empty())
+ if ( m_pTableControl->hasRowSelection() )
{
- Rectangle rCells;
- for(std::vector<RowPos>::iterator it=m_pTableControl->m_nRowSelected.begin();
- it!=m_pTableControl->m_nRowSelected.end();++it)
+ Rectangle aCellRange;
+ for ( size_t i=0; i<m_pTableControl->getSelectedRowCount(); ++i )
{
- m_pTableControl->invalidateSelectedRegion(*it, *it, rCells);
+ RowPos const rowIndex = m_pTableControl->getSelectedRowIndex(i);
+ m_pTableControl->invalidateSelectedRegion( rowIndex, rowIndex, aCellRange );
}
- m_pTableControl->m_nRowSelected.clear();
+
+ m_pTableControl->markAllRowsAsDeselected();
}
}
-//........................................................................
+//......................................................................................................................
} } // namespace svt::table
-//........................................................................
+//......................................................................................................................
diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx
index c0604be15cdb..bc1ac55fbe51 100644..100755
--- a/svtools/source/table/tablecontrol_impl.hxx
+++ b/svtools/source/table/tablecontrol_impl.hxx
@@ -27,18 +27,16 @@
#ifndef SVTOOLS_TABLECONTROL_IMPL_HXX
#define SVTOOLS_TABLECONTROL_IMPL_HXX
-#ifndef SVTOOLS_INC_TABLE_TABLEMODEL_HXX
-#include <svtools/table/tablemodel.hxx>
-#endif
+#include "svtools/table/tablemodel.hxx"
+#include "svtools/table/tablecontrolinterface.hxx"
-#ifndef SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_HXX
-#include <svtools/table/abstracttablecontrol.hxx>
-#endif
+#include "svtaccessiblefactory.hxx"
-#include <svtools/table/tablemodel.hxx>
-#include <vector>
#include <vcl/seleng.hxx>
+#include <vector>
+
+#include <boost/scoped_ptr.hpp>
class ScrollBar;
class ScrollBarBox;
@@ -48,7 +46,42 @@ namespace svt { namespace table
{
//........................................................................
- typedef ::std::vector< long > ArrayOfLong;
+ struct MutableColumnMetrics : protected ColumnMetrics
+ {
+ MutableColumnMetrics()
+ :ColumnMetrics()
+ {
+ }
+
+ MutableColumnMetrics( long const i_startPixel, long const i_endPixel )
+ :ColumnMetrics( i_startPixel, i_endPixel )
+ {
+ }
+
+ long getStart() const { return nStartPixel; }
+ long getEnd() const { return nEndPixel; }
+
+ void setEnd( long const i_end ) { nEndPixel = i_end; }
+ void move( long const i_offset ) { nStartPixel += i_offset; nEndPixel += i_offset; }
+
+ long getWidth() const { return nEndPixel - nStartPixel; }
+
+ ColumnMetrics const & operator()() { return *this; }
+ };
+
+ struct ColumnInfoPositionLess
+ {
+ bool operator()( MutableColumnMetrics const& i_colInfo, long const i_position )
+ {
+ return i_colInfo.getEnd() < i_position;
+ }
+ bool operator()( long const i_position, MutableColumnMetrics const& i_colInfo )
+ {
+ return i_position < i_colInfo.getStart();
+ }
+ };
+
+ typedef ::std::vector< MutableColumnMetrics > ColumnPositions;
class TableControl;
class TableDataWindow;
@@ -57,13 +90,14 @@ namespace svt { namespace table
//====================================================================
//= TableControl_Impl
//====================================================================
- class TableControl_Impl : public IAbstractTableControl
+ class TableControl_Impl :public ITableControl
+ ,public ITableModelListener
{
friend class TableGeometry;
friend class TableRowGeometry;
friend class TableColumnGeometry;
friend class SuspendInvariants;
- friend class TableFunctionSet;
+
private:
/// the control whose impl-instance we implemnt
TableControl& m_rAntiImpl;
@@ -71,14 +105,9 @@ namespace svt { namespace table
PTableModel m_pModel;
/// the input handler to use, usually the input handler as provided by ->m_pModel
PTableInputHandler m_pInputHandler;
- /// the widths of the single columns, measured in pixel
- ArrayOfLong m_aColumnWidthsPixel;
- /** the accumulated widths of the single columns, i.e. their exclusive right borders,
- <strong<not</strong> counting the space for a possible row header column
- */
- ArrayOfLong m_aAccColumnWidthsPixel;
+ /// info about the widths of our columns
+ ColumnPositions m_aColumnWidths;
- ArrayOfLong m_aVisibleColumnWidthsPixel;
/// the height of a single row in the table, measured in pixels
long m_nRowHeightPixel;
/// the height of the column header row in the table, measured in pixels
@@ -88,9 +117,13 @@ namespace svt { namespace table
/// the number of columns in the table control. Cached model value.
TableSize m_nColumnCount;
+
/// the number of rows in the table control. Cached model value.
TableSize m_nRowCount;
+ /// denotes whether or not the columns fitted into the available width, last time we checked
+ long m_bColumnsFit;
+
ColPos m_nCurColumn;
RowPos m_nCurRow;
ColPos m_nLeftColumn;
@@ -103,24 +136,27 @@ namespace svt { namespace table
The window's upper left corner is at position (0,0), relative to the
table control, which is the direct parent of the data window.
*/
- TableDataWindow* m_pDataWindow;
+ ::boost::scoped_ptr< TableDataWindow >
+ m_pDataWindow;
/// the vertical scrollbar, if any
ScrollBar* m_pVScroll;
/// the horizontal scrollbar, if any
- ScrollBar* m_pHScroll;
+ ScrollBar* m_pHScroll;
ScrollBarBox* m_pScrollCorner;
- //selection engine - for determining selection range, e.g. single, multiple
- SelectionEngine* m_pSelEngine;
- //vector which contains the selected rows
- std::vector<RowPos> m_nRowSelected;
- //part of selection engine
- TableFunctionSet* m_pTableFunctionSet;
- //part of selection engine
- RowPos m_nAnchor;
- bool m_bResizing;
- ColPos m_nResizingColumn;
- bool m_bResizingGrid;
- rtl::OUString m_aTooltipText;
+ //selection engine - for determining selection range, e.g. single, multiple
+ SelectionEngine* m_pSelEngine;
+ //vector which contains the selected rows
+ std::vector<RowPos> m_aSelectedRows;
+ //part of selection engine
+ TableFunctionSet* m_pTableFunctionSet;
+ //part of selection engine
+ RowPos m_nAnchor;
+ bool m_bUpdatingColWidths;
+
+ Link m_aSelectHdl;
+
+ AccessibleFactoryAccess m_aFactoryAccess;
+ IAccessibleTableControl* m_pAccessibleTable;
#if DBG_UTIL
#define INV_SCROLL_POSITION 1
@@ -133,21 +169,18 @@ namespace svt { namespace table
#endif
public:
-
-
- PTableModel getModel() const;
void setModel( PTableModel _pModel );
inline const PTableInputHandler& getInputHandler() const { return m_pInputHandler; }
- inline ColPos getCurColumn() const { return m_nCurColumn; }
- inline RowPos getCurRow() const { return m_nCurRow; }
- inline void setCurRow(RowPos curRow){ m_nCurRow = curRow; }
- inline RowPos getTopRow() const { return m_nTopRow; }
- inline long getRowCount() const { return m_nRowCount; }
- inline long getColumnCount() const { return m_nColumnCount; }
+ inline RowPos getCurRow() const { return m_nCurRow; }
+ inline void setCurRow( RowPos i_curRow ){ m_nCurRow = i_curRow; }
- inline long getColHeaderHightPixel() const { return m_nColHeaderHeightPixel; }
+ RowPos getAnchor() const { return m_nAnchor; }
+ void setAnchor( RowPos const i_anchor ) { m_nAnchor = i_anchor; }
+
+ inline RowPos getTopRow() const { return m_nTopRow; }
+ inline ColPos getLeftColumn() const { return m_nLeftColumn; }
inline const TableControl& getAntiImpl() const { return m_rAntiImpl; }
inline TableControl& getAntiImpl() { return m_rAntiImpl; }
@@ -185,45 +218,115 @@ namespace svt { namespace table
<TRUE/> if it's okay that the given cooordinate is only partially visible
*/
void ensureVisible( ColPos _nColumn, RowPos _nRow, bool _bAcceptPartialVisibility );
- /** returns the row, which contains the input point*/
- virtual RowPos getCurrentRow (const Point& rPoint);
-
- void setCursorAtCurrentCell(const Point& rPoint);
- /** checks whether the vector with the selected rows contains the current row*/
- sal_Bool isRowSelected(const ::std::vector<RowPos>& selectedRows, RowPos current);
-
- bool isRowSelected(RowPos current);
- /** returns the position of the current row in the selection vector */
- int getRowSelectedNumber(const ::std::vector<RowPos>& selectedRows, RowPos current);
- /** _rCellRect contains the region, which should be invalidate after some action e.g. selecting row*/
- void invalidateSelectedRegion(RowPos _nPrevRow, RowPos _nCurRow, Rectangle& _rCellRect );
- /** to be called when a new row is added to the control*/
- void invalidateRow(RowPos _nRowPos, Rectangle& _rCellRect );
- /** returns the vector, which contains the selected rows*/
- std::vector<RowPos>& getSelectedRows();
- /** updates the vector, which contains the selected rows after removing the row nRowPos*/
- void removeSelectedRow(RowPos _nRowPos);
- void invalidateRows();
- void clearSelection();
- // IAbstractTableControl
- virtual void hideCursor();
- virtual void showCursor();
- virtual bool dispatchAction( TableControlAction _eAction );
- virtual SelectionEngine* getSelEngine();
- virtual bool isTooltipActive();
- virtual rtl::OUString& setTooltip(const Point& rPoint );
- virtual void resizeColumn(const Point& rPoint);
- virtual bool startResizeColumn(const Point& rPoint);
- virtual bool endResizeColumn(const Point& rPoint);
-
- TableDataWindow* getDataWindow();
- ScrollBar* getHorzScrollbar();
- ScrollBar* getVertScrollbar();
-
- ::rtl::OUString convertToString(const ::com::sun::star::uno::Any& _value);
- Rectangle calcHeaderRect(bool bColHeader);
- Rectangle calcTableRect();
+
+ /** retrieves the content of the given cell, converted to a string
+ */
+ ::rtl::OUString getCellContentAsString( RowPos const i_row, ColPos const i_col );
+
+ /** returns the position of the current row in the selection vector */
+ int getRowSelectedNumber(const ::std::vector<RowPos>& selectedRows, RowPos current);
+
+ /** _rCellRect contains the region, which should be invalidate after some action e.g. selecting row*/
+ void invalidateSelectedRegion(RowPos _nPrevRow, RowPos _nCurRow, Rectangle& _rCellRect );
+
+ /** invalidates the part of the data window which is covered by the given row
+ @param i_firstRow
+ the index of the first row to include in the invalidation
+ @param i_lastRow
+ the index of the last row to include in the invalidation, or ROW_INVALID if the invalidation
+ should happen down to the bottom of the data window.
+ */
+ void invalidateRowRange( RowPos const i_firstRow, RowPos const i_lastRow );
+
+ void checkCursorPosition();
+
+ bool hasRowSelection() const { return !m_aSelectedRows.empty(); }
+ size_t getSelectedRowCount() const { return m_aSelectedRows.size(); }
+ RowPos getSelectedRowIndex( size_t const i_selectionIndex ) const;
+
+ /** removes the given row index from m_aSelectedRows
+
+ @return
+ <TRUE/> if and only if the row was previously marked as selected
+ */
+ bool markRowAsDeselected( RowPos const i_rowIndex );
+
+ /** marks the given row as selectged, by putting it into m_aSelectedRows
+ @return
+ <TRUE/> if and only if the row was previously <em>not</em> marked as selected
+ */
+ bool markRowAsSelected( RowPos const i_rowIndex );
+
+ /** marks all rows as deselected
+ @return
+ <TRUE/> if and only if the selection actually changed by this operation
+ */
+ bool markAllRowsAsDeselected();
+
+ /** marks all rows as selected
+ @return
+ <FALSE/> if and only if all rows were selected already.
+ */
+ bool markAllRowsAsSelected();
+
+ void setSelectHandler( Link const & i_selectHandler ) { m_aSelectHdl = i_selectHandler; }
+ Link const& getSelectHandler() const { return m_aSelectHdl; }
+
+ // ITableControl
+ virtual void hideCursor();
+ virtual void showCursor();
+ virtual bool dispatchAction( TableControlAction _eAction );
+ virtual SelectionEngine* getSelEngine();
+ virtual PTableModel getModel() const;
+ virtual ColPos getCurrentColumn() const;
+ virtual RowPos getCurrentRow() const;
+ virtual bool activateCell( ColPos const i_col, RowPos const i_row );
+ virtual ::Size getTableSizePixel() const;
+ virtual void setPointer( Pointer const & i_pointer );
+ virtual void captureMouse();
+ virtual void releaseMouse();
+ virtual void invalidate( TableArea const i_what );
+ virtual long pixelWidthToAppFont( long const i_pixels ) const;
+ virtual void hideTracking();
+ virtual void showTracking( Rectangle const & i_location, sal_uInt16 const i_flags );
+ virtual RowPos getRowAtPoint( const Point& rPoint ) const;
+ virtual ColPos getColAtPoint( const Point& rPoint ) const;
+ virtual TableCell hitTest( const Point& rPoint ) const;
+ virtual ColumnMetrics getColumnMetrics( ColPos const i_column ) const;
+ virtual bool isRowSelected( RowPos i_row ) const;
+
+
+ TableDataWindow& getDataWindow() { return *m_pDataWindow; }
+ const TableDataWindow& getDataWindow() const { return *m_pDataWindow; }
+ ScrollBar* getHorzScrollbar();
+ ScrollBar* getVertScrollbar();
+
+ Rectangle calcHeaderRect(bool bColHeader);
+ Rectangle calcTableRect();
+
+ // A11Y
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getAccessible( Window& i_parentWindow );
+ void disposeAccessible();
+
+ // ITableModelListener
+ virtual void rowsInserted( RowPos first, RowPos last );
+ virtual void rowsRemoved( RowPos first, RowPos last );
+ virtual void columnInserted( ColPos const i_colIndex );
+ virtual void columnRemoved( ColPos const i_colIndex );
+ virtual void allColumnsRemoved();
+ virtual void cellsUpdated( ColPos const i_firstCol, ColPos i_lastCol, RowPos const i_firstRow, RowPos const i_lastRow );
+ virtual void columnChanged( ColPos const i_column, ColumnAttributeGroup const i_attributeGroup );
+ virtual void tableMetricsChanged();
+
private:
+ bool impl_isAccessibleAlive() const;
+ void impl_commitAccessibleEvent(
+ sal_Int16 const i_eventID,
+ ::com::sun::star::uno::Any const & i_newValue,
+ ::com::sun::star::uno::Any const & i_oldValue
+ );
+
/** toggles the cursor visibility
The method is not bound to the classes public invariants, as it's used in
@@ -251,7 +354,7 @@ namespace svt { namespace table
specifies whether a possible only partially visible last row is
counted, too.
*/
- TableSize impl_getVisibleColumns( bool _bAcceptPartialRow ) const;
+ TableSize impl_getVisibleColumns( bool _bAcceptPartialCol ) const;
/** determines the rectangle occupied by the given cell
*/
@@ -264,15 +367,20 @@ namespace svt { namespace table
*/
void impl_ni_updateCachedModelValues();
- /** updates ->m_aColumnWidthsPixel with the current pixel widths of all model columns
+ /** updates the cached table metrics (row height etc.)
+ */
+ void impl_ni_updateCachedTableMetrics();
- The method takes into account the current zoom factor and map mode of the table
- control, plus any possible COLWIDTH_FIT_TO_VIEW widths in the model columns.
+ /** updates ->m_aColumnWidthsPixel with the current pixel widths of all model columns
The method is not bound to the classes public invariants, as it's used in
situations where the they must not necessarily be fullfilled.
+
+ @param i_assumeInflexibleColumnsUpToIncluding
+ the index of a column up to which all columns should be considered as inflexible, or
+ <code>COL_INVALID</code>.
*/
- void impl_ni_updateColumnWidths();
+ void impl_ni_updateColumnWidths( ColPos const i_assumeInflexibleColumnsUpToIncluding = COL_INVALID );
/** updates the scrollbars of the control
@@ -296,6 +404,10 @@ namespace svt { namespace table
*/
TableSize impl_ni_ScrollRows( TableSize _nRowDelta );
+ /** equivalent to impl_ni_ScrollRows, but checks the instances invariants beforehand (in a non-product build only)
+ */
+ TableSize impl_scrollRows( TableSize const i_rowDelta );
+
/** scrolls the view by the given number of columns
The method is not bound to the classes public invariants, as it's used in
@@ -306,8 +418,13 @@ namespace svt { namespace table
from the given numbers to scroll in case the begin or the end of the
column range were reached.
*/
- TableSize impl_ni_ScrollColumns( TableSize _nRowDelta );
- /** retrieves the area occupied by the totality of (at least partially) visible cells
+ TableSize impl_ni_ScrollColumns( TableSize _nColumnDelta );
+
+ /** equivalent to impl_ni_ScrollColumns, but checks the instances invariants beforehand (in a non-product build only)
+ */
+ TableSize impl_scrollColumns( TableSize const i_columnDelta );
+
+ /** retrieves the area occupied by the totality of (at least partially) visible cells
The returned area includes row and column headers. Also, it takes into
account the the fact that there might be less columns than would normally
@@ -316,27 +433,37 @@ namespace svt { namespace table
As a result of respecting the partial visibility of rows and columns,
the returned area might be larger than the data window's output size.
*/
- void impl_getAllVisibleCellsArea( Rectangle& _rCellArea ) const;
+ Rectangle impl_getAllVisibleCellsArea() const;
/** retrieves the area occupied by all (at least partially) visible data cells.
Effectively, the returned area is the same as returned by ->impl_getAllVisibleCellsArea,
minus the row and column header areas.
*/
- void impl_getAllVisibleDataCellArea( Rectangle& _rCellArea ) const;
+ Rectangle impl_getAllVisibleDataCellArea() const;
+
+ /** retrieves the column which covers the given ordinate
+ */
+ ColPos impl_getColumnForOrdinate( long const i_ordinate ) const;
- void impl_ni_getAccVisibleColWidths();
- void impl_updateLeftColumn();
+ /** retrieves the row which covers the given abscissa
+ */
+ RowPos impl_getRowForAbscissa( long const i_abscissa ) const;
+
+ /// invalidates the window area occupied by the given column
+ void impl_invalidateColumn( ColPos const i_column );
DECL_LINK( OnScroll, ScrollBar* );
+ DECL_LINK( OnUpdateScrollbars, void* );
};
+
//see seleng.hxx, seleng.cxx, FunctionSet overridables, part of selection engine
class TableFunctionSet : public FunctionSet
{
- friend class TableDataWindow;
private:
- TableControl_Impl* m_pTableControl;
- RowPos m_nCurrentRow;
+ TableControl_Impl* m_pTableControl;
+ RowPos m_nCurrentRow;
+
public:
TableFunctionSet(TableControl_Impl* _pTableControl);
virtual ~TableFunctionSet();
diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx
index bbd7f6829369..11605e36c8b2 100644
--- a/svtools/source/table/tabledatawindow.cxx
+++ b/svtools/source/table/tabledatawindow.cxx
@@ -28,23 +28,31 @@
#include "precompiled_svtools.hxx"
#include "svtools/table/tablecontrol.hxx"
-#include "svtools/table/tabledatawindow.hxx"
+
+#include "tabledatawindow.hxx"
#include "tablecontrol_impl.hxx"
+#include "tablegeometry.hxx"
+#include "cellvalueconversion.hxx"
+
#include <vcl/help.hxx>
-//........................................................................
+//......................................................................................................................
namespace svt { namespace table
{
- class TableControl_Impl;
-//........................................................................
+//......................................................................................................................
- //====================================================================
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Any;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
//= TableDataWindow
- //====================================================================
- //--------------------------------------------------------------------
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
TableDataWindow::TableDataWindow( TableControl_Impl& _rTableControl )
:Window( &_rTableControl.getAntiImpl() )
- ,m_rTableControl ( _rTableControl )
+ ,m_rTableControl( _rTableControl )
+ ,m_nTipWindowHandle( 0 )
{
// by default, use the background as determined by the style settings
const Color aWindowColor( GetSettings().GetStyleSettings().GetFieldColor() );
@@ -52,105 +60,164 @@ namespace svt { namespace table
SetFillColor( aWindowColor );
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ TableDataWindow::~TableDataWindow()
+ {
+ impl_hideTipWindow();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
void TableDataWindow::Paint( const Rectangle& rUpdateRect )
{
m_rTableControl.doPaintContent( rUpdateRect );
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableDataWindow::SetBackground( const Wallpaper& rColor )
{
Window::SetBackground( rColor );
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableDataWindow::SetControlBackground( const Color& rColor )
{
Window::SetControlBackground( rColor );
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableDataWindow::SetBackground()
{
Window::SetBackground();
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableDataWindow::SetControlBackground()
{
Window::SetControlBackground();
}
- //--------------------------------------------------------------------
- void TableDataWindow::MouseMove( const MouseEvent& rMEvt )
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TableDataWindow::RequestHelp( const HelpEvent& rHEvt )
{
- Point aPoint = rMEvt.GetPosPixel();
- if ( !m_rTableControl.getInputHandler()->MouseMove( m_rTableControl, rMEvt ) )
+ sal_uInt16 const nHelpMode = rHEvt.GetMode();
+ if ( ( IsMouseCaptured() )
+ || ( ( nHelpMode & HELPMODE_QUICK ) == 0 )
+ )
+ {
+ Window::RequestHelp( rHEvt );
+ return;
+ }
+
+ ::rtl::OUString sHelpText;
+ sal_uInt16 nHelpStyle = 0;
+
+ Point const aMousePos( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) );
+ RowPos const hitRow = m_rTableControl.getRowAtPoint( aMousePos );
+ ColPos const hitCol = m_rTableControl.getColAtPoint( aMousePos );
+
+ PTableModel const pTableModel( m_rTableControl.getModel() );
+ if ( ( hitCol >= 0 ) && ( hitCol < pTableModel->getColumnCount() ) )
{
- if(m_rTableControl.getCurrentRow(aPoint)>=0 && m_rTableControl.isTooltipActive() )
+ if ( hitRow == ROW_COL_HEADERS )
{
- SetPointer(POINTER_ARROW);
- rtl::OUString& rHelpText = m_rTableControl.setTooltip(aPoint);
- Help::EnableBalloonHelp();
- Window::SetHelpText( rHelpText.getStr());
+ sHelpText = pTableModel->getColumnModel( hitCol )->getHelpText();
}
- else if(m_rTableControl.getCurrentRow(aPoint) == -1)
+ else if ( ( hitRow >= 0 ) && ( hitRow < pTableModel->getRowCount() ) )
{
- if(Help::IsBalloonHelpEnabled())
- Help::DisableBalloonHelp();
- m_rTableControl.resizeColumn(aPoint);
+ Any aCellToolTip;
+ pTableModel->getCellToolTip( hitCol, hitRow, aCellToolTip );
+ if ( !aCellToolTip.hasValue() )
+ {
+ // use the cell content
+ pTableModel->getCellContent( hitCol, hitRow, aCellToolTip );
+
+ // use the cell content as tool tip only if it doesn't fit into the cell.
+ bool const activeCell = ( hitRow == m_rTableControl.getCurrentRow() ) && ( hitCol == m_rTableControl.getCurrentColumn() );
+ bool const selectedCell = m_rTableControl.isRowSelected( hitRow );
+
+ Rectangle const aWindowRect( Point( 0, 0 ), GetOutputSizePixel() );
+ TableCellGeometry const aCell( m_rTableControl, aWindowRect, hitCol, hitRow );
+ Rectangle const aCellRect( aCell.getRect() );
+
+ PTableRenderer const pRenderer = pTableModel->getRenderer();
+ if ( pRenderer->FitsIntoCell( aCellToolTip, hitCol, hitRow, activeCell, selectedCell, *this, aCellRect ) )
+ aCellToolTip.clear();
+ }
+
+ sHelpText = CellValueConversion::convertToString( aCellToolTip );
+
+ if ( sHelpText.indexOf( '\n' ) >= 0 )
+ nHelpStyle = QUICKHELP_TIP_STYLE_BALLOON;
}
+ }
+
+ if ( sHelpText.getLength() )
+ {
+ Rectangle const aControlScreenRect(
+ OutputToScreenPixel( Point( 0, 0 ) ),
+ GetOutputSizePixel()
+ );
+
+ if ( m_nTipWindowHandle )
+ Help::UpdateTip( m_nTipWindowHandle, this, aControlScreenRect, sHelpText );
else
- {
- if(Help::IsBalloonHelpEnabled())
- Help::DisableBalloonHelp();
- Window::MouseMove( rMEvt );
- }
+ m_nTipWindowHandle = Help::ShowTip( this, aControlScreenRect, sHelpText, nHelpStyle );
}
+ else
+ impl_hideTipWindow();
}
- //--------------------------------------------------------------------
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TableDataWindow::impl_hideTipWindow()
+ {
+ if ( m_nTipWindowHandle != 0 )
+ {
+ Help::HideTip( m_nTipWindowHandle );
+ m_nTipWindowHandle = 0;
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TableDataWindow::MouseMove( const MouseEvent& rMEvt )
+ {
+ if ( rMEvt.IsLeaveWindow() )
+ impl_hideTipWindow();
+
+ if ( !m_rTableControl.getInputHandler()->MouseMove( m_rTableControl, rMEvt ) )
+ {
+ Window::MouseMove( rMEvt );
+ }
+ }
+ //------------------------------------------------------------------------------------------------------------------
void TableDataWindow::MouseButtonDown( const MouseEvent& rMEvt )
{
- Point aPoint = rMEvt.GetPosPixel();
- RowPos nCurRow = m_rTableControl.getCurrentRow(aPoint);
- std::vector<RowPos> selectedRows(m_rTableControl.getSelectedRows());
+ impl_hideTipWindow();
+
+ Point const aPoint = rMEvt.GetPosPixel();
+ RowPos const hitRow = m_rTableControl.getRowAtPoint( aPoint );
+ bool const wasRowSelected = m_rTableControl.isRowSelected( hitRow );
+
if ( !m_rTableControl.getInputHandler()->MouseButtonDown( m_rTableControl, rMEvt ) )
- Window::MouseButtonDown( rMEvt );
- else
{
- if(nCurRow >= 0 && m_rTableControl.getSelEngine()->GetSelectionMode() != NO_SELECTION)
- {
- bool found = std::find(selectedRows.begin(),selectedRows.end(), nCurRow) != selectedRows.end();
+ Window::MouseButtonDown( rMEvt );
+ return;
+ }
- if( !found )
- {
- m_aSelectHdl.Call( NULL );
- }
- }
+ bool const isRowSelected = m_rTableControl.isRowSelected( hitRow );
+ if ( isRowSelected != wasRowSelected )
+ {
+ m_aSelectHdl.Call( NULL );
}
m_aMouseButtonDownHdl.Call((MouseEvent*) &rMEvt);
- m_rTableControl.getAntiImpl().LoseFocus();
}
- //--------------------------------------------------------------------
+
+ //------------------------------------------------------------------------------------------------------------------
void TableDataWindow::MouseButtonUp( const MouseEvent& rMEvt )
{
if ( !m_rTableControl.getInputHandler()->MouseButtonUp( m_rTableControl, rMEvt ) )
Window::MouseButtonUp( rMEvt );
+
m_aMouseButtonUpHdl.Call((MouseEvent*) &rMEvt);
- m_rTableControl.getAntiImpl().GetFocus();
+ m_rTableControl.getAntiImpl().GrabFocus();
}
- //--------------------------------------------------------------------
- void TableDataWindow::SetPointer( const Pointer& rPointer )
- {
- Window::SetPointer(rPointer);
- }
- //--------------------------------------------------------------------
- void TableDataWindow::CaptureMouse()
- {
- Window::CaptureMouse();
- }
- //--------------------------------------------------------------------
- void TableDataWindow::ReleaseMouse( )
- {
- Window::ReleaseMouse();
- }
- // -----------------------------------------------------------------------
+
+ //------------------------------------------------------------------------------------------------------------------
long TableDataWindow::Notify(NotifyEvent& rNEvt )
{
long nDone = 0;
@@ -168,6 +235,6 @@ namespace svt { namespace table
}
return nDone ? nDone : Window::Notify( rNEvt );
}
-//........................................................................
+//......................................................................................................................
} } // namespace svt::table
-//........................................................................
+//......................................................................................................................
diff --git a/svtools/inc/svtools/table/tabledatawindow.hxx b/svtools/source/table/tabledatawindow.hxx
index 829feecd5836..6f78ac49c44d 100644
--- a/svtools/inc/svtools/table/tabledatawindow.hxx
+++ b/svtools/source/table/tabledatawindow.hxx
@@ -55,8 +55,12 @@ namespace svt { namespace table
Link m_aMouseButtonDownHdl;
Link m_aMouseButtonUpHdl;
Link m_aSelectHdl;
+ sal_uLong m_nTipWindowHandle;
+
public:
TableDataWindow( TableControl_Impl& _rTableControl );
+ ~TableDataWindow();
+
inline void SetMouseButtonDownHdl( const Link& rLink ) { m_aMouseButtonDownHdl = rLink; }
inline const Link& GetMouseButtonDownHdl() const { return m_aMouseButtonDownHdl; }
inline void SetMouseButtonUpHdl( const Link& rLink ) { m_aMouseButtonUpHdl = rLink; }
@@ -69,15 +73,16 @@ namespace svt { namespace table
virtual void MouseMove( const MouseEvent& rMEvt);
virtual void MouseButtonDown( const MouseEvent& rMEvt);
virtual void MouseButtonUp( const MouseEvent& rMEvt);
- virtual void SetPointer( const Pointer& rPointer );
- virtual void CaptureMouse();
- virtual void ReleaseMouse();
virtual long Notify(NotifyEvent& rNEvt);
virtual void SetControlBackground(const Color& rColor);
virtual void SetControlBackground();
+ virtual void RequestHelp( const HelpEvent& rHEvt );
void SetBackground(const Wallpaper& rColor);
void SetBackground();
+
+ private:
+ void impl_hideTipWindow();
};
//........................................................................
} } // namespace svt::table
diff --git a/svtools/source/table/tablegeometry.cxx b/svtools/source/table/tablegeometry.cxx
index d60de9e6438f..661079775daa 100644
--- a/svtools/source/table/tablegeometry.cxx
+++ b/svtools/source/table/tablegeometry.cxx
@@ -27,105 +27,139 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
-
#include "tablegeometry.hxx"
#include "tablecontrol_impl.hxx"
#include <tools/debug.hxx>
-//........................................................................
+//......................................................................................................................
namespace svt { namespace table
{
-//........................................................................
+//......................................................................................................................
- //====================================================================
+ //==================================================================================================================
//= TableRowGeometry
- //====================================================================
- //--------------------------------------------------------------------
- TableRowGeometry::TableRowGeometry( const TableControl_Impl& _rControl, const Rectangle& _rBoundaries,
- RowPos _nRow )
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ TableRowGeometry::TableRowGeometry( TableControl_Impl const & _rControl, Rectangle const & _rBoundaries,
+ RowPos const _nRow, bool const i_allowVirtualRows )
:TableGeometry( _rControl, _rBoundaries )
,m_nRowPos( _nRow )
+ ,m_bAllowVirtualRows( i_allowVirtualRows )
{
if ( m_nRowPos == ROW_COL_HEADERS )
{
- //DBG_ASSERT( m_rControl.m_pModel->hasColumnHeaders(),
- // "TableRowGeometry::TableRowGeometry: why asking for the geoemtry of the non-existent column header row?" );
m_aRect.Top() = 0;
m_aRect.Bottom() = m_rControl.m_nColHeaderHeightPixel - 1;
}
else
{
- if ( ( m_nRowPos >= m_rControl.m_nTopRow ) && ( m_nRowPos < m_rControl.m_pModel->getRowCount() ) )
- {
- m_aRect.Top() = m_rControl.m_nColHeaderHeightPixel + ( m_nRowPos - m_rControl.m_nTopRow ) * m_rControl.m_nRowHeightPixel;
- m_aRect.Bottom() = m_aRect.Top() + m_rControl.m_nRowHeightPixel - 1;
- }
- else
- m_aRect.SetEmpty();
+ impl_initRect();
}
}
- //--------------------------------------------------------------------
- bool TableRowGeometry::moveDown()
+ //------------------------------------------------------------------------------------------------------------------
+ void TableRowGeometry::impl_initRect()
{
- if ( ++m_nRowPos < m_rControl.m_pModel->getRowCount() )
- m_aRect.Move( 0, m_rControl.m_nRowHeightPixel );
+ if ( ( m_nRowPos >= m_rControl.m_nTopRow ) && impl_isValidRow( m_nRowPos ) )
+ {
+ m_aRect.Top() = m_rControl.m_nColHeaderHeightPixel + ( m_nRowPos - m_rControl.m_nTopRow ) * m_rControl.m_nRowHeightPixel;
+ m_aRect.Bottom() = m_aRect.Top() + m_rControl.m_nRowHeightPixel - 1;
+ }
else
m_aRect.SetEmpty();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool TableRowGeometry::impl_isValidRow( RowPos const i_row ) const
+ {
+ return m_bAllowVirtualRows || ( i_row < m_rControl.m_pModel->getRowCount() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool TableRowGeometry::moveDown()
+ {
+ if ( m_nRowPos == ROW_COL_HEADERS )
+ {
+ m_nRowPos = m_rControl.m_nTopRow;
+ impl_initRect();
+ }
+ else
+ {
+ if ( impl_isValidRow( ++m_nRowPos ) )
+ m_aRect.Move( 0, m_rControl.m_nRowHeightPixel );
+ else
+ m_aRect.SetEmpty();
+ }
return isValid();
}
- //====================================================================
+ //==================================================================================================================
//= TableColumnGeometry
- //====================================================================
- //--------------------------------------------------------------------
- TableColumnGeometry::TableColumnGeometry( const TableControl_Impl& _rControl, const Rectangle& _rBoundaries,
- ColPos _nCol )
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ TableColumnGeometry::TableColumnGeometry( TableControl_Impl const & _rControl, Rectangle const & _rBoundaries,
+ ColPos const _nCol, bool const i_allowVirtualColumns )
:TableGeometry( _rControl, _rBoundaries )
,m_nColPos( _nCol )
+ ,m_bAllowVirtualColumns( i_allowVirtualColumns )
{
if ( m_nColPos == COL_ROW_HEADERS )
{
-/* DBG_ASSERT( m_rControl.m_pModel->hasRowHeaders(),
- "TableColumnGeometry::TableColumnGeometry: why asking for the geoemtry of the non-existent row header column?" )*/;
m_aRect.Left() = 0;
m_aRect.Right() = m_rControl.m_nRowHeaderWidthPixel - 1;
}
else
{
- ColPos nLeftColumn = m_rControl.m_nLeftColumn;
- if ( ( m_nColPos >= nLeftColumn ) && ( m_nColPos < (ColPos)m_rControl.m_aColumnWidthsPixel.size() ) )
- {
- m_aRect.Left() = m_rControl.m_nRowHeaderWidthPixel;
- // TODO: take into account any possibly frozen columns
+ impl_initRect();
+ }
+ }
- for ( ColPos col = nLeftColumn; col < m_nColPos; ++col )
- m_aRect.Left() += m_rControl.m_aColumnWidthsPixel[ col ];
- m_aRect.Right() = m_aRect.Left() + m_rControl.m_aColumnWidthsPixel[ m_nColPos ] - 1;
- }
- else
- m_aRect.SetEmpty();
+ //------------------------------------------------------------------------------------------------------------------
+ void TableColumnGeometry::impl_initRect()
+ {
+ ColPos nLeftColumn = m_rControl.m_nLeftColumn;
+ if ( ( m_nColPos >= nLeftColumn ) && impl_isValidColumn( m_nColPos ) )
+ {
+ m_aRect.Left() = m_rControl.m_nRowHeaderWidthPixel;
+ // TODO: take into account any possibly frozen columns
+
+ for ( ColPos col = nLeftColumn; col < m_nColPos; ++col )
+ m_aRect.Left() += m_rControl.m_aColumnWidths[ col ].getWidth();
+ m_aRect.Right() = m_aRect.Left() + m_rControl.m_aColumnWidths[ m_nColPos ].getWidth() - 1;
}
+ else
+ m_aRect.SetEmpty();
}
- //--------------------------------------------------------------------
- bool TableColumnGeometry::moveRight()
+ //------------------------------------------------------------------------------------------------------------------
+ bool TableColumnGeometry::impl_isValidColumn( ColPos const i_column ) const
{
- DBG_ASSERT( m_nColPos != COL_ROW_HEADERS, "TableColumnGeometry::moveRight: cannot move the row header column!" );
- // what would be COL_ROW_HEADERS + 1?
+ return m_bAllowVirtualColumns || ( i_column < ColPos( m_rControl.m_aColumnWidths.size() ) );
+ }
- if ( ++m_nColPos < (ColPos)m_rControl.m_aColumnWidthsPixel.size() )
+ //------------------------------------------------------------------------------------------------------------------
+ bool TableColumnGeometry::moveRight()
+ {
+ if ( m_nColPos == COL_ROW_HEADERS )
{
- m_aRect.Left() = m_aRect.Right() + 1;
- m_aRect.Right() += m_rControl.m_aColumnWidthsPixel[ m_nColPos ];
+ m_nColPos = m_rControl.m_nLeftColumn;
+ impl_initRect();
}
else
- m_aRect.SetEmpty();
+ {
+ if ( impl_isValidColumn( ++m_nColPos ) )
+ {
+ m_aRect.Left() = m_aRect.Right() + 1;
+ m_aRect.Right() += m_rControl.m_aColumnWidths[ m_nColPos ].getWidth();
+ }
+ else
+ m_aRect.SetEmpty();
+ }
return isValid();
}
-//........................................................................
+//......................................................................................................................
} } // namespace svt::table
-//........................................................................
+//......................................................................................................................
diff --git a/svtools/source/table/tablegeometry.hxx b/svtools/source/table/tablegeometry.hxx
index 3ddde0c98c64..fedc7cb2f24f 100644
--- a/svtools/source/table/tablegeometry.hxx
+++ b/svtools/source/table/tablegeometry.hxx
@@ -27,13 +27,9 @@
#ifndef SVTOOLS_TABLEGEOMETRY_HXX
#define SVTOOLS_TABLEGEOMETRY_HXX
-#ifndef SVTOOLS_INC_TABLE_TABLETYPES_HXX
-#include <svtools/table/tabletypes.hxx>
-#endif
+#include "svtools/table/tabletypes.hxx"
-#ifndef _SV_GEN_HXX
#include <tools/gen.hxx>
-#endif
//........................................................................
namespace svt { namespace table
@@ -79,18 +75,25 @@ namespace svt { namespace table
{
protected:
RowPos m_nRowPos;
+ bool m_bAllowVirtualRows;
public:
TableRowGeometry(
- const TableControl_Impl& _rControl,
- const Rectangle& _rBoundaries,
- RowPos _nRow
+ TableControl_Impl const & _rControl,
+ Rectangle const & _rBoundaries,
+ RowPos const _nRow,
+ bool const i_allowVirtualRows = false
+ // allow rows >= getRowCount()?
);
// status
RowPos getRow() const { return m_nRowPos; }
// operations
bool moveDown();
+
+ private:
+ void impl_initRect();
+ bool impl_isValidRow( RowPos const i_row ) const;
};
//====================================================================
@@ -100,18 +103,24 @@ namespace svt { namespace table
{
protected:
ColPos m_nColPos;
+ bool m_bAllowVirtualColumns;
public:
TableColumnGeometry(
- const TableControl_Impl& _rControl,
- const Rectangle& _rBoundaries,
- ColPos _nCol
+ TableControl_Impl const & _rControl,
+ Rectangle const & _rBoundaries,
+ ColPos const _nCol,
+ bool const i_allowVirtualColumns = false
);
// status
ColPos getCol() const { return m_nColPos; }
// operations
bool moveRight();
+
+ private:
+ void impl_initRect();
+ bool impl_isValidColumn( ColPos const i_column ) const;
};
//====================================================================
@@ -127,13 +136,14 @@ namespace svt { namespace table
public:
TableCellGeometry(
- const TableControl_Impl& _rControl,
- const Rectangle& _rBoundaries,
- ColPos _nCol,
- RowPos _nRow
+ TableControl_Impl const & _rControl,
+ Rectangle const & _rBoundaries,
+ ColPos const _nCol,
+ RowPos const _nRow,
+ bool const i_alllowVirtualCells = false
)
- :m_aRow( _rControl, _rBoundaries, _nRow )
- ,m_aCol( _rControl, _rBoundaries, _nCol )
+ :m_aRow( _rControl, _rBoundaries, _nRow, i_alllowVirtualCells )
+ ,m_aCol( _rControl, _rBoundaries, _nCol, i_alllowVirtualCells )
{
}
diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx
index f5bc837f60b0..0e826ef6bff3 100755..100644
--- a/svtools/source/uno/svtxgridcontrol.cxx
+++ b/svtools/source/uno/svtxgridcontrol.cxx
@@ -28,115 +28,193 @@
#include "precompiled_svtools.hxx"
#include "svtxgridcontrol.hxx"
-#include "accessibletableimp.hxx"
#include <com/sun/star/view/SelectionType.hpp>
+#include "svtools/table/tablecontrolinterface.hxx"
#include "svtools/table/gridtablerenderer.hxx"
-#include "svtools/table/defaultinputhandler.hxx"
#include "svtools/table/tablecontrol.hxx"
#include "unocontroltablemodel.hxx"
#include <comphelper/sequence.hxx>
#include <rtl/ref.hxx>
-#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
#include <toolkit/helper/property.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/awt/grid/XGridColumn.hpp>
-#include <com/sun/star/accessibility/AccessibleTableModelChange.hpp>
-#include <com/sun/star/accessibility/AccessibleTableModelChangeType.hpp>
-#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/awt/XControl.hpp>
#include <com/sun/star/awt/grid/GridInvalidDataException.hpp>
#include <com/sun/star/awt/grid/GridInvalidModelException.hpp>
#include <com/sun/star/util/Color.hpp>
#include <com/sun/star/awt/FontDescriptor.hpp>
-using ::rtl::OUString;
using namespace ::svt::table;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt::grid;
using namespace ::com::sun::star::view;
-using namespace ::toolkit;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::container;
using namespace ::com::sun::star::accessibility;
-using namespace ::com::sun::star::accessibility::AccessibleEventId;
-using namespace ::com::sun::star::accessibility::AccessibleTableModelChangeType;
-using ::com::sun::star::accessibility::AccessibleTableModelChange;
SVTXGridControl::SVTXGridControl()
- :m_pTableModel (new UnoControlTableModel()),
- m_xDataModel(0),
- m_xColumnModel(0),
- m_bHasColumnHeaders(false),
- m_bHasRowHeaders(false),
- m_bVScroll(false),
- m_bHScroll(false),
- m_bUpdate(false),
- m_nSelectedRowCount(0),
- m_aSelectionListeners( *this )
+ :m_pTableModel( new UnoControlTableModel() )
+ ,m_bHasColumnHeaders( false )
+ ,m_bHasRowHeaders( false )
+ ,m_bTableModelInitCompleted( false )
+ ,m_nSelectedRowCount( 0 )
+ ,m_aSelectionListeners( *this )
{
}
-//--------------------------------------------------------------------
+// ---------------------------------------------------------------------------------------------------------------------
SVTXGridControl::~SVTXGridControl()
{
}
-::com::sun::star::uno::Any SVTXGridControl::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+// ---------------------------------------------------------------------------------------------------------------------
+void SVTXGridControl::SetWindow( Window* pWindow )
{
- ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridControl*, this ),
- SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridDataListener*, this ),
- SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridColumnListener*, this ),
- SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
- return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
+ SVTXGridControl_Base::SetWindow( pWindow );
+ impl_checkTableModelInit();
}
-// ::com::sun::star::lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( SVTXGridControl )
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridControl>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener>* ) NULL ),
- VCLXWindow::getTypes()
-IMPL_XTYPEPROVIDER_END
+// ---------------------------------------------------------------------------------------------------------------------
+sal_Int32 SAL_CALL SVTXGridControl::getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getRowAtPoint: no control (anymore)!", -1 );
+
+ TableCell const tableCell = pTable->getTableControlInterface().hitTest( Point( x, y ) );
+ return ( tableCell.nRow >= 0 ) ? tableCell.nRow : -1;
+}
-sal_Int32 SAL_CALL SVTXGridControl::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
+// ---------------------------------------------------------------------------------------------------------------------
+sal_Int32 SAL_CALL SVTXGridControl::getColumnAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
{
- TableControl* pTable = (TableControl*)GetWindow();
- return pTable->GetCurrentRow( Point(x,y) );
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getColumnAtPoint: no control (anymore)!", -1 );
+
+ TableCell const tableCell = pTable->getTableControlInterface().hitTest( Point( x, y ) );
+ return ( tableCell.nColumn >= 0 ) ? tableCell.nColumn : -1;
}
-void SAL_CALL SVTXGridControl::setToolTip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& text, const com::sun::star::uno::Sequence< sal_Int32 >& columns) throw (::com::sun::star::uno::RuntimeException)
+// ---------------------------------------------------------------------------------------------------------------------
+sal_Int32 SAL_CALL SVTXGridControl::getCurrentColumn( ) throw (RuntimeException)
{
- TableControl* pTable = (TableControl*)GetWindow();
- pTable->setTooltip(text, columns);
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getCurrentColumn: no control (anymore)!", -1 );
+
+ sal_Int32 const nColumn = pTable->GetCurrentColumn();
+ return ( nColumn >= 0 ) ? nColumn : -1;
}
+// ---------------------------------------------------------------------------------------------------------------------
+sal_Int32 SAL_CALL SVTXGridControl::getCurrentRow( ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getCurrentRow: no control (anymore)!", -1 );
+
+ sal_Int32 const nRow = pTable->GetCurrentRow();
+ return ( nRow >= 0 ) ? nRow : -1;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
void SAL_CALL SVTXGridControl::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
{
m_aSelectionListeners.addInterface(listener);
}
+// ---------------------------------------------------------------------------------------------------------------------
void SAL_CALL SVTXGridControl::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
{
m_aSelectionListeners.removeInterface(listener);
}
+// ---------------------------------------------------------------------------------------------------------------------
void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const Any& aValue) throw(RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
- TableControl* pTable = (TableControl*)GetWindow();
+ TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ ENSURE_OR_RETURN_VOID( pTable != NULL, "SVTXGridControl::setProperty: no control (anymore)!" );
+
switch( GetPropertyId( PropertyName ) )
{
+ case BASEPROPERTY_ROW_HEADER_WIDTH:
+ {
+ sal_Int32 rowHeaderWidth( -1 );
+ aValue >>= rowHeaderWidth;
+ ENSURE_OR_BREAK( rowHeaderWidth > 0, "SVTXGridControl::setProperty: illegal row header width!" );
+ m_pTableModel->setRowHeaderWidth( rowHeaderWidth );
+ // TODO: the model should broadcast this change itself, and the table should invalidate itself as needed
+ pTable->Invalidate();
+ }
+ break;
+
+ case BASEPROPERTY_COLUMN_HEADER_HEIGHT:
+ {
+ sal_Int32 columnHeaderHeight = 0;
+ if ( !aValue.hasValue() )
+ {
+ columnHeaderHeight = pTable->PixelToLogic( Size( 0, pTable->GetTextHeight() + 3 ), MAP_APPFONT ).Height();
+ }
+ else
+ {
+ aValue >>= columnHeaderHeight;
+ }
+ ENSURE_OR_BREAK( columnHeaderHeight > 0, "SVTXGridControl::setProperty: illegal column header height!" );
+ m_pTableModel->setColumnHeaderHeight( columnHeaderHeight );
+ // TODO: the model should broadcast this change itself, and the table should invalidate itself as needed
+ pTable->Invalidate();
+ }
+ break;
+
+ case BASEPROPERTY_USE_GRID_LINES:
+ {
+ GridTableRenderer* pGridRenderer = dynamic_cast< GridTableRenderer* >(
+ m_pTableModel->getRenderer().get() );
+ ENSURE_OR_BREAK( pGridRenderer != NULL, "SVTXGridControl::setProperty(UseGridLines): invalid renderer!" );
+ sal_Bool bUseGridLines = sal_False;
+ OSL_VERIFY( aValue >>= bUseGridLines );
+ pGridRenderer->useGridLines( bUseGridLines );
+ pTable->Invalidate();
+ }
+ break;
+
+ case BASEPROPERTY_ROW_HEIGHT:
+ {
+ sal_Int32 rowHeight = 0;
+ if ( !aValue.hasValue() )
+ {
+ rowHeight = pTable->PixelToLogic( Size( 0, pTable->GetTextHeight() + 3 ), MAP_APPFONT ).Height();
+ }
+ else
+ {
+ aValue >>= rowHeight;
+ }
+ m_pTableModel->setRowHeight( rowHeight );
+ ENSURE_OR_BREAK( rowHeight > 0, "SVTXGridControl::setProperty: illegal row height!" );
+ // TODO: the model should broadcast this change itself, and the table should invalidate itself as needed
+ pTable->Invalidate();
+ }
+ break;
+
case BASEPROPERTY_BACKGROUNDCOLOR:
{
// let the base class handle this for the TableControl
VCLXWindow::setProperty( PropertyName, aValue );
// and forward to the grid control's data window
if ( pTable->IsBackground() )
- pTable->getDataWindow()->SetBackground( pTable->GetBackground() );
+ pTable->getDataWindow().SetBackground( pTable->GetBackground() );
else
- pTable->getDataWindow()->SetBackground();
+ pTable->getDataWindow().SetBackground();
}
break;
@@ -151,7 +229,6 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
case SelectionType_SINGLE: eSelMode = SINGLE_SELECTION; break;
case SelectionType_RANGE: eSelMode = RANGE_SELECTION; break;
case SelectionType_MULTI: eSelMode = MULTIPLE_SELECTION; break;
- // case SelectionType_NONE:
default: eSelMode = NO_SELECTION; break;
}
if( pTable->getSelEngine()->GetSelectionMode() != eSelMode )
@@ -163,19 +240,16 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
{
sal_Bool bHScroll = true;
if( aValue >>= bHScroll )
- {
- m_bHScroll = bHScroll;
- m_pTableModel->setHorizontalScrollbarVisibility(bHScroll);
- }
+ m_pTableModel->setHorizontalScrollbarVisibility( bHScroll ? ScrollbarShowAlways : ScrollbarShowSmart );
break;
}
+
case BASEPROPERTY_VSCROLL:
{
sal_Bool bVScroll = true;
if( aValue >>= bVScroll )
{
- m_bVScroll = bVScroll;
- m_pTableModel->setVerticalScrollbarVisibility(bVScroll);
+ m_pTableModel->setVerticalScrollbarVisibility( bVScroll ? ScrollbarShowAlways : ScrollbarShowSmart );
}
break;
}
@@ -189,64 +263,42 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
}
break;
}
- case BASEPROPERTY_GRID_HEADER_BACKGROUND:
- {
- sal_Int32 colorHeader = 0xFFFFFF;
- if( aValue >>= colorHeader )
- {
- m_pTableModel->setHeaderBackgroundColor(colorHeader);
- }
+
+ case BASEPROPERTY_GRID_ROW_BACKGROUND_COLORS:
+ m_pTableModel->setRowBackgroundColors( aValue );
+ pTable->Invalidate();
break;
- }
+
case BASEPROPERTY_GRID_LINE_COLOR:
- {
- sal_Int32 colorLine = 0xFFFFFF;
- if( aValue >>= colorLine )
- {
- m_pTableModel->setLineColor(colorLine);
- }
+ m_pTableModel->setLineColor( aValue );
+ pTable->Invalidate();
break;
- }
- case BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND:
- {
- sal_Int32 colorEvenRow = 0xFFFFFF;
- if( aValue >>= colorEvenRow )
- {
- m_pTableModel->setEvenRowBackgroundColor(colorEvenRow);
- }
+
+ case BASEPROPERTY_GRID_HEADER_BACKGROUND:
+ m_pTableModel->setHeaderBackgroundColor( aValue );
+ pTable->Invalidate();
break;
- }
- case BASEPROPERTY_GRID_ROW_BACKGROUND:
- {
- sal_Int32 colorBackground = 0xFFFFFF;
- if( aValue >>= colorBackground )
- {
- m_pTableModel->setOddRowBackgroundColor(colorBackground);
- }
+
+ case BASEPROPERTY_GRID_HEADER_TEXT_COLOR:
+ m_pTableModel->setHeaderTextColor( aValue );
+ pTable->Invalidate();
break;
- }
+
case BASEPROPERTY_TEXTCOLOR:
- {
- sal_Int32 colorText = 0x000000;
- if( aValue >>= colorText )
- {
- m_pTableModel->setTextColor(colorText);
- }
+ m_pTableModel->setTextColor( aValue );
+ pTable->Invalidate();
break;
- }
+
+ case BASEPROPERTY_TEXTLINECOLOR:
+ m_pTableModel->setTextLineColor( aValue );
+ pTable->Invalidate();
+ break;
+
case BASEPROPERTY_VERTICALALIGN:
{
- com::sun::star::style::VerticalAlignment vAlign(com::sun::star::style::VerticalAlignment(0));
- if( aValue >>= vAlign )
- {
- switch( vAlign )
- {
- case com::sun::star::style::VerticalAlignment_TOP: m_pTableModel->setVerticalAlign(com::sun::star::style::VerticalAlignment(0)); break;
- case com::sun::star::style::VerticalAlignment_MIDDLE: m_pTableModel->setVerticalAlign(com::sun::star::style::VerticalAlignment(1)); break;
- case com::sun::star::style::VerticalAlignment_BOTTOM: m_pTableModel->setVerticalAlign(com::sun::star::style::VerticalAlignment(2)); break;
- default: m_pTableModel->setVerticalAlign(com::sun::star::style::VerticalAlignment(0)); break;
- }
- }
+ VerticalAlignment eAlign( VerticalAlignment_TOP );
+ if ( aValue >>= eAlign )
+ m_pTableModel->setVerticalAlign( eAlign );
break;
}
@@ -261,97 +313,31 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
}
case BASEPROPERTY_GRID_DATAMODEL:
{
- {
- m_xDataModel = Reference< XGridDataModel >( aValue, UNO_QUERY );
- if(m_xDataModel != NULL)
- {
- Sequence<Sequence< Any > > cellData = m_xDataModel->getData();
- if(cellData.getLength()!= 0)
- {
- for (int i = 0; i < cellData.getLength(); i++)
- {
- std::vector< Any > newRow;
- Sequence< Any > rawRowData = cellData[i];
- //check whether the data row vector length matches with the column count
- if(m_xColumnModel->getColumnCount() == 0)
- {
- for ( ::svt::table::ColPos col = 0; col < rawRowData.getLength(); ++col )
- {
- UnoControlTableColumn* tableColumn = new UnoControlTableColumn();
- m_pTableModel->getColumnModel().push_back((PColumnModel)tableColumn);
- }
- m_xColumnModel->setDefaultColumns(rawRowData.getLength());
- }
- else
- if((unsigned int)rawRowData.getLength()!=(unsigned)m_pTableModel->getColumnCount())
- throw GridInvalidDataException(rtl::OUString::createFromAscii("The column count doesn't match with the length of row data"), m_xDataModel);
-
- for ( int k = 0; k < rawRowData.getLength(); k++)
- {
- newRow.push_back(rawRowData[k]);
- }
- m_pTableModel->getCellContent().push_back(newRow);
- }
-
- Sequence< ::rtl::OUString > rowHeaders = m_xDataModel->getRowHeaders();
- std::vector< rtl::OUString > newRow(
- comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rowHeaders));
- m_pTableModel->setRowCount(m_xDataModel->getRowCount());
- m_pTableModel->setRowHeaderName(newRow);
- }
- }
- else
- throw GridInvalidDataException(rtl::OUString::createFromAscii("The data model isn't set!"), m_xDataModel);
- sal_Int32 fontHeight = pTable->PixelToLogic( Size( 0, pTable->GetTextHeight()+3 ), MAP_APPFONT ).Height();
- if(m_xDataModel->getRowHeight() == 0)
- {
- m_pTableModel->setRowHeight(fontHeight);
- m_xDataModel->setRowHeight(fontHeight);
- }
- else
- m_pTableModel->setRowHeight(m_xDataModel->getRowHeight());
- m_pTableModel->setRowHeaderWidth(m_xDataModel->getRowHeaderWidth());
- }
- break;
+ Reference< XGridDataModel > const xDataModel( aValue, UNO_QUERY );
+ if ( !xDataModel.is() )
+ throw GridInvalidDataException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid data model." ) ), *this );
+
+ m_pTableModel->setDataModel( xDataModel );
+ impl_checkTableModelInit();
}
+ break;
+
case BASEPROPERTY_GRID_COLUMNMODEL:
{
- m_xColumnModel = Reference< XGridColumnModel >( aValue, UNO_QUERY );
- if(m_xColumnModel != NULL)
- {
- if(m_xColumnModel->getColumnCount() != 0)
- {
- Sequence<Reference< XGridColumn > > columns = m_xColumnModel->getColumns();
- std::vector<Reference< XGridColumn > > aNewColumns(
- comphelper::sequenceToContainer<std::vector<Reference< XGridColumn > > >(columns));
- sal_Int32 fontHeight = pTable->PixelToLogic( Size( 0, pTable->GetTextHeight()+3 ), MAP_APPFONT ).Height();
- if(m_xColumnModel->getColumnHeaderHeight() == 0)
- {
- m_pTableModel->setColumnHeaderHeight(fontHeight);
- m_xColumnModel->setColumnHeaderHeight(fontHeight);
- }
- else
- m_pTableModel->setColumnHeaderHeight(m_xColumnModel->getColumnHeaderHeight());
- for ( ::svt::table::ColPos col = 0; col < m_xColumnModel->getColumnCount(); ++col )
- {
- UnoControlTableColumn* tableColumn = new UnoControlTableColumn(aNewColumns[col]);
- Reference< XGridColumn > xGridColumn = m_xColumnModel->getColumn(col);
- m_pTableModel->getColumnModel().push_back((PColumnModel)tableColumn);
- tableColumn->setHorizontalAlign(xGridColumn->getHorizontalAlign());
- tableColumn->setWidth(xGridColumn->getColumnWidth());
- if(xGridColumn->getPreferredWidth() != 0)
- tableColumn->setPreferredWidth(xGridColumn->getPreferredWidth());
- if(xGridColumn->getMaxWidth() != 0)
- tableColumn->setMaxWidth(xGridColumn->getMaxWidth());
- if(xGridColumn->getMinWidth() != 0)
- tableColumn->setMinWidth(xGridColumn->getMinWidth());
- tableColumn->setResizable(xGridColumn->getResizeable());
- }
- }
- }
- else
- throw GridInvalidModelException(rtl::OUString::createFromAscii("The column model isn't set!"), m_xColumnModel);
+ // obtain new col model
+ Reference< XGridColumnModel > const xColumnModel( aValue, UNO_QUERY );
+ if ( !xColumnModel.is() )
+ throw GridInvalidModelException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid column model." ) ), *this );
+
+ // remove all old columns
+ m_pTableModel->removeAllColumns();
+
+ // announce to the TableModel
+ m_pTableModel->setColumnModel( xColumnModel );
+ impl_checkTableModelInit();
+ // add new columns
+ impl_updateColumnsFromModel_nothrow();
break;
}
default:
@@ -360,489 +346,354 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
}
}
+
+void SVTXGridControl::impl_checkTableModelInit()
+{
+ if ( !m_bTableModelInitCompleted && m_pTableModel->hasColumnModel() && m_pTableModel->hasDataModel() )
+ {
+ TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ if ( pTable )
+ {
+ pTable->SetModel( PTableModel( m_pTableModel ) );
+
+ m_bTableModelInitCompleted = true;
+
+ // ensure default columns exist, if they have not previously been added
+ Reference< XGridDataModel > const xDataModel( m_pTableModel->getDataModel(), UNO_QUERY_THROW );
+ Reference< XGridColumnModel > const xColumnModel( m_pTableModel->getColumnModel(), UNO_QUERY_THROW );
+
+ sal_Int32 const nDataColumnCount = xDataModel->getColumnCount();
+ if ( ( nDataColumnCount > 0 ) && ( xColumnModel->getColumnCount() == 0 ) )
+ xColumnModel->setDefaultColumns( nDataColumnCount );
+ // this will trigger notifications, which in turn will let us update our m_pTableModel
+ }
+ }
+}
+
+namespace
+{
+ void lcl_convertColor( ::boost::optional< ::Color > const & i_color, Any & o_colorValue )
+ {
+ if ( !i_color )
+ o_colorValue.clear();
+ else
+ o_colorValue <<= i_color->GetColor();
+ }
+}
+
Any SVTXGridControl::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
+ TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getProperty: no control (anymore)!", Any() );
+
+ Any aPropertyValue;
+
const sal_uInt16 nPropId = GetPropertyId( PropertyName );
- TableControl* pTable = (TableControl*)GetWindow();
- if(pTable)
+ switch(nPropId)
+ {
+ case BASEPROPERTY_GRID_SELECTIONMODE:
{
- switch(nPropId)
+ SelectionType eSelectionType;
+
+ SelectionMode eSelMode = pTable->getSelEngine()->GetSelectionMode();
+ switch( eSelMode )
{
- case BASEPROPERTY_GRID_SELECTIONMODE:
+ case SINGLE_SELECTION: eSelectionType = SelectionType_SINGLE; break;
+ case RANGE_SELECTION: eSelectionType = SelectionType_RANGE; break;
+ case MULTIPLE_SELECTION:eSelectionType = SelectionType_MULTI; break;
+ default: eSelectionType = SelectionType_NONE; break;
+ }
+ aPropertyValue <<= eSelectionType;
+ break;
+ }
+
+ case BASEPROPERTY_GRID_SHOWROWHEADER:
+ aPropertyValue <<= sal_Bool( m_pTableModel->hasRowHeaders() );
+ break;
+
+ case BASEPROPERTY_GRID_SHOWCOLUMNHEADER:
+ aPropertyValue <<= sal_Bool( m_pTableModel->hasColumnHeaders() );
+ break;
+
+ case BASEPROPERTY_GRID_DATAMODEL:
+ aPropertyValue <<= m_pTableModel->getDataModel();
+ break;
+
+ case BASEPROPERTY_GRID_COLUMNMODEL:
+ aPropertyValue <<= m_pTableModel->getColumnModel();
+ break;
+
+ case BASEPROPERTY_HSCROLL:
{
- SelectionType eSelectionType;
+ sal_Bool const bHasScrollbar = ( m_pTableModel->getHorizontalScrollbarVisibility() != ScrollbarShowNever );
+ aPropertyValue <<= bHasScrollbar;
+ break;
+ }
- SelectionMode eSelMode = pTable->getSelEngine()->GetSelectionMode();
- switch( eSelMode )
- {
- case SINGLE_SELECTION: eSelectionType = SelectionType_SINGLE; break;
- case RANGE_SELECTION: eSelectionType = SelectionType_RANGE; break;
- case MULTIPLE_SELECTION:eSelectionType = SelectionType_MULTI; break;
-// case NO_SELECTION:
- default: eSelectionType = SelectionType_NONE; break;
- }
- return Any( eSelectionType );
+ case BASEPROPERTY_VSCROLL:
+ {
+ sal_Bool const bHasScrollbar = ( m_pTableModel->getVerticalScrollbarVisibility() != ScrollbarShowNever );
+ aPropertyValue <<= bHasScrollbar;
+ break;
}
- case BASEPROPERTY_GRID_SHOWROWHEADER:
+
+ case BASEPROPERTY_USE_GRID_LINES:
+ {
+ GridTableRenderer* pGridRenderer = dynamic_cast< GridTableRenderer* >(
+ m_pTableModel->getRenderer().get() );
+ ENSURE_OR_BREAK( pGridRenderer != NULL, "SVTXGridControl::getProperty(UseGridLines): invalid renderer!" );
+ aPropertyValue <<= pGridRenderer->useGridLines();
+ }
+ break;
+
+ case BASEPROPERTY_GRID_ROW_BACKGROUND_COLORS:
+ {
+ ::boost::optional< ::std::vector< ::Color > > aColors( m_pTableModel->getRowBackgroundColors() );
+ if ( !aColors )
+ aPropertyValue.clear();
+ else
+ {
+ Sequence< ::com::sun::star::util::Color > aAPIColors( aColors->size() );
+ for ( size_t i=0; i<aColors->size(); ++i )
{
- return Any ((sal_Bool) m_pTableModel->hasRowHeaders());
+ aAPIColors[i] = aColors->at(i).GetColor();
}
- case BASEPROPERTY_GRID_SHOWCOLUMNHEADER:
- return Any ((sal_Bool) m_pTableModel->hasColumnHeaders());
- case BASEPROPERTY_GRID_DATAMODEL:
- return Any ( m_xDataModel );
- case BASEPROPERTY_GRID_COLUMNMODEL:
- return Any ( m_xColumnModel);
- case BASEPROPERTY_HSCROLL:
- return Any ( m_bHScroll);
- case BASEPROPERTY_VSCROLL:
- return Any ( m_bVScroll);
+ aPropertyValue <<= aAPIColors;
}
}
- return VCLXWindow::getProperty( PropertyName );
+ break;
+
+ case BASEPROPERTY_GRID_LINE_COLOR:
+ lcl_convertColor( m_pTableModel->getLineColor(), aPropertyValue );
+ break;
+
+ case BASEPROPERTY_GRID_HEADER_BACKGROUND:
+ lcl_convertColor( m_pTableModel->getHeaderBackgroundColor(), aPropertyValue );
+ break;
+
+ case BASEPROPERTY_GRID_HEADER_TEXT_COLOR:
+ lcl_convertColor( m_pTableModel->getHeaderTextColor(), aPropertyValue );
+ break;
+
+ case BASEPROPERTY_TEXTCOLOR:
+ lcl_convertColor( m_pTableModel->getTextColor(), aPropertyValue );
+ break;
+
+ case BASEPROPERTY_TEXTLINECOLOR:
+ lcl_convertColor( m_pTableModel->getTextLineColor(), aPropertyValue );
+ break;
+
+ default:
+ aPropertyValue = VCLXWindow::getProperty( PropertyName );
+ break;
+ }
+
+ return aPropertyValue;
}
void SVTXGridControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
{
PushPropertyIds( rIds,
- BASEPROPERTY_GRID_SHOWROWHEADER,
- BASEPROPERTY_GRID_SHOWCOLUMNHEADER,
- BASEPROPERTY_GRID_DATAMODEL,
- BASEPROPERTY_GRID_COLUMNMODEL,
- BASEPROPERTY_GRID_SELECTIONMODE,
- BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND,
- BASEPROPERTY_GRID_HEADER_BACKGROUND,
- BASEPROPERTY_GRID_LINE_COLOR,
- BASEPROPERTY_GRID_ROW_BACKGROUND,
- 0);
+ BASEPROPERTY_GRID_SHOWROWHEADER,
+ BASEPROPERTY_GRID_SHOWCOLUMNHEADER,
+ BASEPROPERTY_GRID_DATAMODEL,
+ BASEPROPERTY_GRID_COLUMNMODEL,
+ BASEPROPERTY_GRID_SELECTIONMODE,
+ BASEPROPERTY_GRID_HEADER_BACKGROUND,
+ BASEPROPERTY_GRID_HEADER_TEXT_COLOR,
+ BASEPROPERTY_GRID_LINE_COLOR,
+ BASEPROPERTY_GRID_ROW_BACKGROUND_COLORS,
+ 0
+ );
VCLXWindow::ImplGetPropertyIds( rIds, true );
}
-void SAL_CALL SVTXGridControl::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException)
+
+//----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL SVTXGridControl::rowsInserted( const GridDataEvent& i_event ) throw (RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
- TableControl* pTable = (TableControl*)GetWindow();
- if ( pTable )
- {
- pTable->SetModel(PTableModel(m_pTableModel));
- pTable->Show( bVisible );
- }
+ m_pTableModel->notifyRowsInserted( i_event );
}
-void SAL_CALL SVTXGridControl::setFocus() throw(::com::sun::star::uno::RuntimeException)
+
+//----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL//----------------------------------------------------------------------------------------------------------------------
+ SVTXGridControl::rowsRemoved( const GridDataEvent& i_event ) throw (RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
- if ( GetWindow())
- GetWindow()->GrabFocus();
+ m_pTableModel->notifyRowsRemoved( i_event );
}
-void SAL_CALL SVTXGridControl::rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
+
+//----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL SVTXGridControl::dataChanged( const GridDataEvent& i_event ) throw (RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
- std::vector< Any > newRow;
- Sequence< Any > rawRowData = Event.rowData;
- int colCount = m_xColumnModel->getColumnCount();
- if(colCount == 0)
- {
- Reference<XGridColumnListener> listener(*this,UNO_QUERY_THROW);
- m_xColumnModel->setDefaultColumns(rawRowData.getLength());
- for ( ::svt::table::ColPos col = 0; col < rawRowData.getLength(); ++col )
- {
- UnoControlTableColumn* tableColumn = new UnoControlTableColumn();
- m_pTableModel->getColumnModel().push_back((PColumnModel)tableColumn);
- m_xColumnModel->getColumn(col)->addColumnListener(listener);
- }
+ m_pTableModel->notifyDataChanged( i_event );
- }
- else if((unsigned int)rawRowData.getLength()!=(unsigned)colCount)
- throw GridInvalidDataException(rtl::OUString::createFromAscii("The column count doesn't match with the length of row data"), m_xDataModel);
-
- for ( int k = 0; k < rawRowData.getLength(); k++)
- newRow.push_back(rawRowData[k]);
- m_pTableModel->getCellContent().push_back(newRow);
- if(m_pTableModel->hasRowHeaders())
- m_pTableModel->getRowHeaderName().push_back(Event.headerName);
- m_pTableModel->setRowCount(m_pTableModel->getCellContent().size());
- TableControl* pTable = (TableControl*)GetWindow();
- pTable->InvalidateDataWindow(m_pTableModel->getCellContent().size()-1, 0, false);
- if(pTable->isAccessibleAlive())
- {
- pTable->commitGridControlEvent(TABLE_MODEL_CHANGED,
- makeAny( AccessibleTableModelChange(INSERT, m_pTableModel->getRowCount()-1, m_pTableModel->getRowCount(), 0, m_pTableModel->getColumnCount())),
- Any());
- pTable->commitGridControlEvent(CHILD,
- makeAny( pTable->m_pAccessTable->m_pAccessible->getTableHeader(TCTYPE_ROWHEADERBAR)),
- Any());
- for (sal_Int32 i = 0 ; i <= m_pTableModel->getColumnCount() ; ++i)
- {
- pTable->commitGridControlEvent(
- CHILD,
- makeAny( pTable->m_pAccessTable->m_pAccessible->getTable() ),
- Any());
- }
- }
+ // if the data model is sortable, a dataChanged event is also fired in case the sort order changed.
+ // So, just in case, invalidate the column header area, too.
+ TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::dataChanged: no control (anymore)!" );
+ pTable->getTableControlInterface().invalidate( TableAreaColumnHeaders );
}
-void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
+//----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL SVTXGridControl::rowHeadingChanged( const GridDataEvent& i_event ) throw (RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
+ OSL_UNUSED( i_event );
- TableControl* pTable = (TableControl*)GetWindow();
- if(Event.index == -1)
- {
- if(!isSelectionEmpty())
- deselectAllRows();
- if(m_pTableModel->hasRowHeaders())
- m_pTableModel->getRowHeaderName().clear();
- pTable->clearSelection();
- m_pTableModel->getCellContent().clear();
- if(pTable->isAccessibleAlive())
- {
- pTable->commitGridControlEvent(TABLE_MODEL_CHANGED,
- makeAny( AccessibleTableModelChange(DELETE, 0, m_pTableModel->getColumnCount(), 0, m_pTableModel->getColumnCount())),
- Any());
- }
- }
- else if(Event.index >= 0 && Event.index < m_pTableModel->getRowCount())
- {
- if(isSelectedIndex(Event.index))
- {
- Sequence<sal_Int32> selected(1);
- selected[0]=Event.index;
- deselectRows(selected);
- }
- if(m_pTableModel->hasRowHeaders())
- m_pTableModel->getRowHeaderName().erase(m_pTableModel->getRowHeaderName().begin()+Event.index);
- std::vector<std::vector<Any> >::iterator rowPos =m_pTableModel->getCellContent().begin() + Event.index;
- m_pTableModel->getCellContent().erase( rowPos );
- }
- m_pTableModel->setRowCount(m_pTableModel->getCellContent().size());
- pTable->InvalidateDataWindow(Event.index, Event.index, true);
- if(pTable->isAccessibleAlive())
- {
- pTable->commitGridControlEvent(TABLE_MODEL_CHANGED,
- makeAny( AccessibleTableModelChange(DELETE, Event.index, Event.index+1, 0, m_pTableModel->getColumnCount())),
- Any());
- }
+ TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::rowHeadingChanged: no control (anymore)!" );
+
+ // TODO: we could do better than this - invalidate the header area only
+ pTable->getTableControlInterface().invalidate( TableAreaRowHeaders );
}
-void SAL_CALL SVTXGridControl::columnChanged(const ::com::sun::star::awt::grid::GridColumnEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
+//----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL SVTXGridControl::elementInserted( const ContainerEvent& i_event ) throw (RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
- TableControl* pTable = (TableControl*)GetWindow();
- if(Event.valueName == rtl::OUString::createFromAscii("ColumnResize"))
- {
- bool resizable = m_pTableModel->getColumnModel()[Event.index]->isResizable();
- Event.newValue>>=resizable;
- m_pTableModel->getColumnModel()[Event.index]->setResizable(resizable);
- }
- else if(Event.valueName == rtl::OUString::createFromAscii("ColWidth"))
- {
- sal_Int32 colWidth = m_pTableModel->getColumnModel()[Event.index]->getWidth();
- Event.newValue>>=colWidth;
- m_pTableModel->getColumnModel()[Event.index]->setWidth(colWidth);
- }
- else if(Event.valueName == rtl::OUString::createFromAscii("MaxWidth"))
- {
- sal_Int32 maxWidth = m_pTableModel->getColumnModel()[Event.index]->getMaxWidth();
- Event.newValue>>=maxWidth;
- m_pTableModel->getColumnModel()[Event.index]->setMaxWidth(maxWidth);
- }
- else if(Event.valueName == rtl::OUString::createFromAscii("MinWidth"))
- {
- sal_Int32 minWidth = m_pTableModel->getColumnModel()[Event.index]->getMinWidth();
- Event.newValue>>=minWidth;
- m_pTableModel->getColumnModel()[Event.index]->setMinWidth(minWidth);
- }
- else if(Event.valueName == rtl::OUString::createFromAscii("PrefWidth"))
- {
- sal_Int32 prefWidth = m_pTableModel->getColumnModel()[Event.index]->getPreferredWidth();
- Event.newValue>>=prefWidth;
- m_pTableModel->getColumnModel()[Event.index]->setPreferredWidth(prefWidth);
- }
- else if(Event.valueName == rtl::OUString::createFromAscii("HAlign"))
- {
- ::com::sun::star::style::HorizontalAlignment hAlign = m_pTableModel->getColumnModel()[Event.index]->getHorizontalAlign();
- Event.newValue>>=hAlign;
- m_pTableModel->getColumnModel()[Event.index]->setHorizontalAlign(hAlign);
- }
- else if(Event.valueName == rtl::OUString::createFromAscii("UpdateWidth"))
- {
- if(m_pTableModel->getColumnModel()[Event.index]->getPreferredWidth() != 0)
- m_xColumnModel->getColumn(Event.index)->updateColumn(rtl::OUString::createFromAscii("PrefWidth"), m_pTableModel->getColumnModel()[Event.index]->getPreferredWidth());
- m_xColumnModel->getColumn(Event.index)->updateColumn(rtl::OUString::createFromAscii("ColWidth"), m_pTableModel->getColumnModel()[Event.index]->getWidth());
- }
- pTable->Invalidate();
+ Reference< XGridColumn > const xGridColumn( i_event.Element, UNO_QUERY_THROW );
+
+ sal_Int32 nIndex( m_pTableModel->getColumnCount() );
+ OSL_VERIFY( i_event.Accessor >>= nIndex );
+ m_pTableModel->insertColumn( nIndex, xGridColumn );
}
-void SAL_CALL SVTXGridControl::dataChanged(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
+
+//----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL SVTXGridControl::elementRemoved( const ContainerEvent& i_event ) throw (RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
- TableControl* pTable = (TableControl*)GetWindow();
- if(Event.valueName == rtl::OUString::createFromAscii("RowHeight"))
- {
- sal_Int32 rowHeight = m_pTableModel->getRowHeight();
- Event.newValue>>=rowHeight;
- m_pTableModel->setRowHeight(rowHeight);
- pTable->Invalidate();
- }
- else if(Event.valueName == rtl::OUString::createFromAscii("RowHeaderWidth"))
- {
- sal_Int32 rowHeaderWidth = m_pTableModel->getRowHeaderWidth();
- Event.newValue>>=rowHeaderWidth;
- m_pTableModel->setRowHeaderWidth(rowHeaderWidth);
- pTable->Invalidate();
- }
- else if(Event.valueName == rtl::OUString::createFromAscii("RowHeaders"))
- {
- Sequence< rtl::OUString > headers(0);
- Event.newValue>>=headers;
- std::vector< rtl::OUString > headerNames( comphelper::sequenceToContainer <std::vector< rtl::OUString > >(headers) );
- m_pTableModel->setRowHeaderName(headerNames);
- pTable->Invalidate();
- }
- else if(Event.valueName == rtl::OUString::createFromAscii("CellUpdated"))
- {
- std::vector< std::vector< Any > >& rowContent = m_pTableModel->getCellContent();
- sal_Int32 col = -1;
- Event.oldValue>>=col;
- rowContent[Event.index][col] = Event.newValue;
- pTable->InvalidateDataWindow(Event.index, Event.index, false);
- }
- else if(Event.valueName == rtl::OUString::createFromAscii("RowUpdated"))
- {
- std::vector<std::vector< Any > >& rowContent = m_pTableModel->getCellContent();
- Sequence< sal_Int32 > cols(0);
- Sequence< Any > values(0);
- Event.oldValue>>=cols;
- Event.newValue>>=values;
- for(int i = 0; i< cols.getLength(); i++)
- {
- if(cols[i]>=0 && cols[i]<m_pTableModel->getColumnCount())
- rowContent[Event.index][cols[i]]=values[i];
- else
- break;
- }
- pTable->InvalidateDataWindow(Event.index, Event.index, false);
- }
+ sal_Int32 nIndex( -1 );
+ OSL_VERIFY( i_event.Accessor >>= nIndex );
+ m_pTableModel->removeColumn( nIndex );
}
-void SAL_CALL SVTXGridControl::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException)
+//----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL SVTXGridControl::elementReplaced( const ContainerEvent& i_event ) throw (RuntimeException)
{
- VCLXWindow::disposing( Source );
+ OSL_ENSURE( false, "SVTXGridControl::elementReplaced: not implemented!" );
+ // at the moment, the XGridColumnModel API does not allow replacing columns
+ OSL_UNUSED( i_event );
+ // TODO: replace the respective column in our table model
}
-::sal_Int32 SAL_CALL SVTXGridControl::getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException)
-{
- TableControl* pTable = (TableControl*)GetWindow();
- std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
- if(selectedRows.empty())
- return -1;
- else
- {
- std::vector<RowPos>::iterator itStart = selectedRows.begin();
- std::vector<RowPos>::iterator itEnd = selectedRows.end();
- return *(std::min_element(itStart, itEnd));
- }
-}
-::sal_Int32 SAL_CALL SVTXGridControl::getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException)
+//----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL SVTXGridControl::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException)
{
- TableControl* pTable = (TableControl*)GetWindow();
- std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
- if(selectedRows.empty())
- return -1;
- else
- {
- std::vector<RowPos>::iterator itStart = selectedRows.begin();
- std::vector<RowPos>::iterator itEnd = selectedRows.end();
- return *(std::max_element(itStart, itEnd));
- }
+ VCLXWindow::disposing( Source );
}
-void SAL_CALL SVTXGridControl::selectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException)
+//----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL SVTXGridControl::selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException)
{
- TableControl* pTable = (TableControl*)GetWindow();
- SelectionMode eSelMode = pTable->getSelEngine()->GetSelectionMode();
- if(eSelMode != NO_SELECTION)
- {
- sal_Int32 start = rangeOfRows[0];
- int seqSize = rangeOfRows.getLength();
- sal_Int32 end = rangeOfRows[seqSize-1];
- if((start >= 0 && start < m_pTableModel->getRowCount()) && (end >= 0 && end < m_pTableModel->getRowCount()))
- {
- std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
- if(eSelMode == SINGLE_SELECTION)
- {
- if(!selectedRows.empty())
- selectedRows.clear();
- if(rangeOfRows.getLength() == 1)
- selectedRows.push_back(start);
- else
- return;
- }
- else
- {
- for(int i=0;i<seqSize;i++)
- {
- if(!isSelectedIndex(rangeOfRows[i]))
- selectedRows.push_back(rangeOfRows[i]);
- }
- }
- pTable->selectionChanged(true);
- pTable->InvalidateDataWindow(start, end, false);
- SetSynthesizingVCLEvent( sal_True );
- pTable->Select();
- SetSynthesizingVCLEvent( sal_False );
- }
- }
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::selectRow: no control (anymore)!" );
+
+ pTable->SelectRow( i_rowIndex, true );
}
+//----------------------------------------------------------------------------------------------------------------------
void SAL_CALL SVTXGridControl::selectAllRows() throw (::com::sun::star::uno::RuntimeException)
{
- TableControl* pTable = (TableControl*)GetWindow();
- SelectionMode eSelMode = pTable->getSelEngine()->GetSelectionMode();
- if(eSelMode != NO_SELECTION)
- {
- std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
- if(!selectedRows.empty())
- selectedRows.clear();
- for(int i=0;i<m_pTableModel->getRowCount();i++)
- selectedRows.push_back(i);
- pTable->Invalidate();
- SetSynthesizingVCLEvent( sal_True );
- pTable->Select();
- SetSynthesizingVCLEvent( sal_False );
- }
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::selectAllRows: no control (anymore)!" );
+
+ pTable->SelectAllRows( true );
}
-void SAL_CALL SVTXGridControl::deselectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException)
+//----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL SVTXGridControl::deselectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException)
{
- TableControl* pTable = (TableControl*)GetWindow();
- std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
- std::vector<RowPos>::iterator itStart = selectedRows.begin();
- std::vector<RowPos>::iterator itEnd = selectedRows.end();
- for(int i = 0; i < rangeOfRows.getLength(); i++ )
- {
- std::vector<RowPos>::iterator iter = std::find(itStart, itEnd, rangeOfRows[i]);
- selectedRows.erase(iter);
- }
- pTable->selectionChanged(true);
- pTable->Invalidate();
- SetSynthesizingVCLEvent( sal_True );
- pTable->Select();
- SetSynthesizingVCLEvent( sal_False );
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::deselectRow: no control (anymore)!" );
+
+ pTable->SelectRow( i_rowIndex, false );
}
+//----------------------------------------------------------------------------------------------------------------------
void SAL_CALL SVTXGridControl::deselectAllRows() throw (::com::sun::star::uno::RuntimeException)
{
- TableControl* pTable = (TableControl*)GetWindow();
- std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
- if(!selectedRows.empty())
- selectedRows.clear();
- pTable->Invalidate();
- SetSynthesizingVCLEvent( sal_True );
- pTable->Select();
- SetSynthesizingVCLEvent( sal_False );
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::deselectAllRows: no control (anymore)!" );
+
+ pTable->SelectAllRows( false );
}
+//----------------------------------------------------------------------------------------------------------------------
::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL SVTXGridControl::getSelection() throw (::com::sun::star::uno::RuntimeException)
{
- TableControl* pTable = (TableControl*)GetWindow();
- std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
- Sequence<sal_Int32> selectedRowsToSequence(comphelper::containerToSequence(selectedRows));
- return selectedRowsToSequence;
-}
+ ::vos::OGuard aGuard( GetMutex() );
-::sal_Bool SAL_CALL SVTXGridControl::isCellEditable() throw (::com::sun::star::uno::RuntimeException)
-{
- return sal_False;
+ TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ ENSURE_OR_RETURN( pTable, "SVTXGridControl::getSelection: no control (anymore)!", Sequence< sal_Int32 >() );
+
+ sal_Int32 selectionCount = pTable->GetSelectedRowCount();
+ Sequence< sal_Int32 > selectedRows( selectionCount );
+ for ( sal_Int32 i=0; i<selectionCount; ++i )
+ selectedRows[i] = pTable->GetSelectedRowIndex(i);
+ return selectedRows;
}
+//----------------------------------------------------------------------------------------------------------------------
::sal_Bool SAL_CALL SVTXGridControl::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException)
{
- TableControl* pTable = (TableControl*)GetWindow();
- std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
- if(selectedRows.empty())
- return sal_True;
- else
- return sal_False;
-}
+ ::vos::OGuard aGuard( GetMutex() );
-::sal_Bool SAL_CALL SVTXGridControl::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
-{
- TableControl* pTable = (TableControl*)GetWindow();
- std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
- return std::find(selectedRows.begin(),selectedRows.end(), index) != selectedRows.end();
-}
+ TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ ENSURE_OR_RETURN( pTable, "SVTXGridControl::getSelection: no control (anymore)!", sal_True );
-void SAL_CALL SVTXGridControl::selectRow(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
-{
- if(index<0 || index>=m_pTableModel->getRowCount())
- return;
- TableControl* pTable = (TableControl*)GetWindow();
- SelectionMode eSelMode = pTable->getSelEngine()->GetSelectionMode();
- if(eSelMode != NO_SELECTION)
- {
- std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
- if(eSelMode == MULTIPLE_SELECTION)
- {
- if(!isSelectedIndex(index))
- selectedRows.push_back(index);
- else
- return;
- }
- else if(eSelMode == SINGLE_SELECTION)
- {
- if(!selectedRows.empty())
- {
- if(!isSelectedIndex(index))
- deselectRows(getSelection());
- else
- return;
- }
- selectedRows.push_back(index);
- }
- pTable->selectionChanged(true);
- pTable->InvalidateDataWindow(index, index, false);
- SetSynthesizingVCLEvent( sal_True );
- pTable->Select();
- SetSynthesizingVCLEvent( sal_False );
- }
+ return pTable->GetSelectedRowCount() > 0;
}
-void SAL_CALL SVTXGridControl::selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException)
+//----------------------------------------------------------------------------------------------------------------------
+::sal_Bool SAL_CALL SVTXGridControl::isSelectedIndex( ::sal_Int32 index ) throw (::com::sun::star::uno::RuntimeException)
{
- (void)x;
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ ENSURE_OR_RETURN( pTable, "SVTXGridControl::isSelectedIndex: no control (anymore)!", sal_False );
+
+ return pTable->IsRowSelected( index );
}
+
+//----------------------------------------------------------------------------------------------------------------------
void SVTXGridControl::dispose() throw(::com::sun::star::uno::RuntimeException)
{
- ::vos::OGuard aGuard( GetMutex() );
-
::com::sun::star::lang::EventObject aObj;
aObj.Source = (::cppu::OWeakObject*)this;
m_aSelectionListeners.disposeAndClear( aObj );
VCLXWindow::dispose();
}
+//----------------------------------------------------------------------------------------------------------------------
void SVTXGridControl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
{
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
+ ::vos::OGuard aGuard( GetMutex() );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
switch ( rVclWindowEvent.GetId() )
{
case VCLEVENT_TABLEROW_SELECT:
{
- TableControl* pTable = (TableControl*)GetWindow();
-
- if( pTable )
- {
- if ( m_aSelectionListeners.getLength() )
- {
- ImplCallItemListeners();
- }
- }
+ TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ ENSURE_OR_BREAK( pTable, "SVTXGridControl::ProcessWindowEvent: no control (anymore)!" );
+ if ( m_aSelectionListeners.getLength() )
+ ImplCallItemListeners();
}
break;
@@ -852,28 +703,30 @@ void SVTXGridControl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent
}
}
+//----------------------------------------------------------------------------------------------------------------------
void SVTXGridControl::ImplCallItemListeners()
{
- TableControl* pTable = (TableControl*) GetWindow();
- if ( pTable && m_aSelectionListeners.getLength() )
+ TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::ImplCallItemListeners: no control (anymore)!" );
+
+ if ( m_aSelectionListeners.getLength() )
{
- ::std::vector<sal_Int32> selRows = pTable->GetSelectedRows();
+ sal_Int32 const actSelRowCount = pTable->GetSelectedRowCount();
::com::sun::star::awt::grid::GridSelectionEvent aEvent;
aEvent.Source = (::cppu::OWeakObject*)this;
aEvent.Column = 0;
- sal_Int32 actSelRowCount = selRows.size();
sal_Int32 diff = actSelRowCount - m_nSelectedRowCount;
//row added to selection
if(diff >= 1)
{
aEvent.Action = com::sun::star::awt::grid::SelectionEventType(0);
- aEvent.Row = selRows[actSelRowCount-1];
+ aEvent.Row = pTable->GetSelectedRowIndex( actSelRowCount - 1 );
aEvent.Range = diff;
}
//selected row changed
else if(diff == 0 && actSelRowCount != 0)
{
- aEvent.Row = selRows[actSelRowCount-1];
+ aEvent.Row = pTable->GetSelectedRowIndex( actSelRowCount - 1 );
aEvent.Action = com::sun::star::awt::grid::SelectionEventType(2);
aEvent.Range = 0;
}
@@ -882,7 +735,7 @@ void SVTXGridControl::ImplCallItemListeners()
//selection changed: multiple row deselected, only 1 row is selected
if(actSelRowCount == 1)
{
- aEvent.Row = selRows[actSelRowCount-1];
+ aEvent.Row = pTable->GetSelectedRowIndex( actSelRowCount - 1 );
aEvent.Action = com::sun::star::awt::grid::SelectionEventType(2);
}
//row is deselected
@@ -897,3 +750,31 @@ void SVTXGridControl::ImplCallItemListeners()
m_aSelectionListeners.selectionChanged( aEvent );
}
}
+
+//----------------------------------------------------------------------------------------------------------------------
+void SVTXGridControl::impl_updateColumnsFromModel_nothrow()
+{
+ Reference< XGridColumnModel > const xColumnModel( m_pTableModel->getColumnModel() );
+ ENSURE_OR_RETURN_VOID( xColumnModel.is(), "no model!" );
+ TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ ENSURE_OR_RETURN_VOID( pTable != NULL, "no table!" );
+
+ try
+ {
+ const Sequence< Reference< XGridColumn > > columns = xColumnModel->getColumns();
+ for ( const Reference< XGridColumn >* colRef = columns.getConstArray();
+ colRef != columns.getConstArray() + columns.getLength();
+ ++colRef
+ )
+ {
+ ENSURE_OR_CONTINUE( colRef->is(), "illegal column!" );
+
+ m_pTableModel->appendColumn( *colRef );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
diff --git a/svtools/source/uno/svtxgridcontrol.hxx b/svtools/source/uno/svtxgridcontrol.hxx
index b15507e4614f..525327b3c760 100755
--- a/svtools/source/uno/svtxgridcontrol.hxx
+++ b/svtools/source/uno/svtxgridcontrol.hxx
@@ -32,86 +32,88 @@
#include <svtools/table/tablecontrol.hxx>
#include <com/sun/star/awt/grid/XGridControl.hpp>
#include <com/sun/star/awt/grid/XGridDataListener.hpp>
-#include <com/sun/star/awt/grid/XGridColumnListener.hpp>
#include <com/sun/star/awt/grid/GridDataEvent.hpp>
#include <com/sun/star/awt/grid/GridColumnEvent.hpp>
#include <com/sun/star/awt/grid/XGridColumnModel.hpp>
#include <com/sun/star/awt/grid/XGridDataModel.hpp>
#include <com/sun/star/awt/grid/XGridSelectionListener.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
#include <toolkit/awt/vclxwindow.hxx>
#include <toolkit/awt/vclxwindows.hxx>
#include <cppuhelper/typeprovider.hxx>
-#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/implbase4.hxx>
#include <toolkit/helper/listenermultiplexer.hxx>
using namespace ::svt::table;
-class SVTXGridControl : public ::cppu::ImplInheritanceHelper3< VCLXWindow, ::com::sun::star::awt::grid::XGridControl,
- ::com::sun::star::awt::grid::XGridDataListener, ::com::sun::star::awt::grid::XGridColumnListener>
+typedef ::cppu::ImplInheritanceHelper3 < VCLXWindow
+ , ::com::sun::star::awt::grid::XGridControl
+ , ::com::sun::star::awt::grid::XGridDataListener
+ , ::com::sun::star::container::XContainerListener
+ > SVTXGridControl_Base;
+class SVTXGridControl : public SVTXGridControl_Base
{
private:
- ::boost::shared_ptr< UnoControlTableModel > m_pTableModel;
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >m_xDataModel;
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >m_xColumnModel;
- bool m_bHasColumnHeaders;
- bool m_bHasRowHeaders;
- bool m_bVScroll;
- bool m_bHScroll;
- bool m_bUpdate;
- sal_Int32 m_nSelectedRowCount;
- SelectionListenerMultiplexer m_aSelectionListeners;
+ ::boost::shared_ptr< UnoControlTableModel > m_pTableModel;
+ bool m_bHasColumnHeaders;
+ bool m_bHasRowHeaders;
+ bool m_bTableModelInitCompleted;
+ sal_Int32 m_nSelectedRowCount;
+ SelectionListenerMultiplexer m_aSelectionListeners;
protected:
virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
void ImplCallItemListeners();
public:
- SVTXGridControl();
+ SVTXGridControl();
~SVTXGridControl();
- //XGridDataListener overridables
- virtual void SAL_CALL rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL dataChanged(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException);
- //XGridColumnListener overridables
- virtual void SAL_CALL columnChanged(const ::com::sun::star::awt::grid::GridColumnEvent & Event) throw (::com::sun::star::uno::RuntimeException);
+ // XGridDataListener
+ virtual void SAL_CALL rowsInserted( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL rowsRemoved( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL dataChanged( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL rowHeadingChanged( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
-
- ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL acquire() throw() { VCLXWindow::acquire(); }
- void SAL_CALL release() throw() { VCLXWindow::release(); }
+ // XContainerListener
+ virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
- // ::com::sun::star::lang::XTypeProvider
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
- //::com::sun::star::awt::grid::XGridControl
- virtual ::sal_Int32 SAL_CALL getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL selectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException);
+ // XGridSelection
+ virtual void SAL_CALL selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL selectAllRows() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deselectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL deselectAllRows() throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelection() throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL isCellEditable() throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setToolTip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& text, const ::com::sun::star::uno::Sequence< sal_Int32 >& columns) throw (::com::sun::star::uno::RuntimeException);
+
+ // XGridControl
+ virtual ::sal_Int32 SAL_CALL getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getColumnAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getCurrentColumn( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getCurrentRow( ) throw (::com::sun::star::uno::RuntimeException);
void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
- void SAL_CALL setVisible(sal_Bool bVisible) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setFocus() throw(::com::sun::star::uno::RuntimeException);
// ::com::sun::star::lang::XComponent
void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
- };
- #endif // _SVT_GRIDCONTROL_HXX_
+
+protected:
+ // VCLXWindow
+ virtual void SetWindow( Window* pWindow );
+
+private:
+ void impl_updateColumnsFromModel_nothrow();
+ void impl_checkTableModelInit();
+};
+#endif // _SVT_GRIDCONTROL_HXX_
diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx
index d6809635e5e5..c36368023a22 100644
--- a/svtools/source/uno/treecontrolpeer.cxx
+++ b/svtools/source/uno/treecontrolpeer.cxx
@@ -1360,7 +1360,7 @@ void TreeControlPeer::setProperty( const ::rtl::OUString& PropertyName, const An
case BASEPROPERTY_TREE_DATAMODEL:
onChangeDataModel( rTree, Reference< XTreeDataModel >( aValue, UNO_QUERY ) );
break;
- case BASEPROPERTY_TREE_ROWHEIGHT:
+ case BASEPROPERTY_ROW_HEIGHT:
{
sal_Int32 nHeight = 0;
if( aValue >>= nHeight )
@@ -1445,7 +1445,7 @@ Any TreeControlPeer::getProperty( const ::rtl::OUString& PropertyName ) throw(Ru
}
return Any( eSelectionType );
}
- case BASEPROPERTY_TREE_ROWHEIGHT:
+ case BASEPROPERTY_ROW_HEIGHT:
return Any( (sal_Int32)rTree.GetEntryHeight() );
case BASEPROPERTY_TREE_DATAMODEL:
return Any( mxDataModel );
diff --git a/svtools/source/uno/unocontroltablemodel.cxx b/svtools/source/uno/unocontroltablemodel.cxx
index d239ee3c740d..933363115810 100644
--- a/svtools/source/uno/unocontroltablemodel.cxx
+++ b/svtools/source/uno/unocontroltablemodel.cxx
@@ -28,486 +28,866 @@
#include "precompiled_svtools.hxx"
#include "unocontroltablemodel.hxx"
-#include <com/sun/star/view/SelectionType.hpp>
-#include "svtools/table/gridtablerenderer.hxx"
+#include "unogridcolumnfacade.hxx"
+
#include "svtools/table/defaultinputhandler.hxx"
+#include "svtools/table/gridtablerenderer.hxx"
#include "svtools/table/tablecontrol.hxx"
-#include <comphelper/sequence.hxx>
-#include <rtl/ref.hxx>
-#include <tools/debug.hxx>
-#include <toolkit/helper/property.hxx>
-#include <comphelper/processfactory.hxx>
+
+/** === begin UNO includes === **/
#include <com/sun/star/awt/grid/XGridColumn.hpp>
+#include <com/sun/star/view/SelectionType.hpp>
+#include <com/sun/star/awt/grid/XGridColumnListener.hpp>
+#include <com/sun/star/awt/grid/XSortableGridData.hpp>
+/** === end UNO includes === **/
-using ::rtl::OUString;
-using namespace ::svt::table;
-using namespace ::com::sun::star::uno;
+#include <comphelper/stlunosequence.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+
+// .....................................................................................................................
+namespace svt { namespace table
+{
+// .....................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::awt::grid::XGridColumn;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::awt::grid::XGridColumnListener;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::awt::grid::GridColumnEvent;
+ using ::com::sun::star::awt::grid::XGridDataModel;
+ using ::com::sun::star::awt::grid::XGridColumnModel;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::style::HorizontalAlignment_LEFT;
+ using ::com::sun::star::style::HorizontalAlignment;
+ using ::com::sun::star::style::VerticalAlignment_TOP;
+ using ::com::sun::star::style::VerticalAlignment;
+ using ::com::sun::star::uno::WeakReference;
+ using ::com::sun::star::awt::grid::GridDataEvent;
+ using ::com::sun::star::awt::grid::XSortableGridData;
+ using ::com::sun::star::beans::Pair;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= UnoControlTableModel_Impl
+ //==================================================================================================================
+ typedef ::std::vector< PTableModelListener > ModellListeners;
+ typedef ::std::vector< PColumnModel > ColumnModels;
+ struct UnoControlTableModel_Impl
+ {
+ ColumnModels aColumns;
+ bool bHasColumnHeaders;
+ bool bHasRowHeaders;
+ ScrollbarVisibility eVScrollMode;
+ ScrollbarVisibility eHScrollMode;
+ PTableRenderer pRenderer;
+ PTableInputHandler pInputHandler;
+ TableMetrics nRowHeight;
+ TableMetrics nColumnHeaderHeight;
+ TableMetrics nRowHeaderWidth;
+ ::boost::optional< ::Color > m_aGridLineColor;
+ ::boost::optional< ::Color > m_aHeaderBackgroundColor;
+ ::boost::optional< ::Color > m_aHeaderTextColor;
+ ::boost::optional< ::Color > m_aTextColor;
+ ::boost::optional< ::Color > m_aTextLineColor;
+ ::boost::optional< ::std::vector< ::Color > > m_aRowColors;
+ VerticalAlignment m_eVerticalAlign;
+ ModellListeners m_aListeners;
+ WeakReference< XGridDataModel > m_aDataModel;
+ WeakReference< XGridColumnModel > m_aColumnModel;
+ UnoControlTableModel_Impl()
+ :aColumns ( )
+ ,bHasColumnHeaders ( true )
+ ,bHasRowHeaders ( false )
+ ,eVScrollMode ( ScrollbarShowNever )
+ ,eHScrollMode ( ScrollbarShowNever )
+ ,pRenderer ( )
+ ,pInputHandler ( )
+ ,nRowHeight ( 10 )
+ ,nColumnHeaderHeight ( 10 )
+ ,nRowHeaderWidth ( 10 )
+ ,m_aGridLineColor ( )
+ ,m_aHeaderBackgroundColor ( )
+ ,m_aHeaderTextColor ( )
+ ,m_aTextColor ( )
+ ,m_aTextLineColor ( )
+ ,m_aRowColors ( )
+ ,m_eVerticalAlign ( VerticalAlignment_TOP )
+ {
+ }
+ };
- //--------------------------------------------------------------------
- UnoControlTableColumn::UnoControlTableColumn(Reference<XGridColumn> m_xGridColumn)
- :m_nID( 0 )
- ,m_sName()
- ,m_bIsResizable( true )
- ,m_nWidth( 4 )
- ,m_nMinWidth( 0 )
- ,m_nMaxWidth( 0 )
- ,m_nPrefWidth ( 0 )
- ,m_xHorizontalAlign(com::sun::star::style::HorizontalAlignment(0))
- {
- m_sName = m_xGridColumn->getTitle();
- }
- //--------------------------------------------------------------------
- UnoControlTableColumn::UnoControlTableColumn()
- :m_nID( 0 )
- ,m_sName()
- ,m_bIsResizable( true )
- ,m_nWidth( 4 )
- ,m_nMinWidth( 0 )
- ,m_nMaxWidth( 0 )
- ,m_nPrefWidth ( 0 )
- ,m_xHorizontalAlign(com::sun::star::style::HorizontalAlignment(0))
+ //==================================================================================================================
+ //= UnoControlTableModel
+ //==================================================================================================================
+#ifdef DBG_UTIL
+ const char* UnoControlTableModel_checkInvariants( const void* _pInstance )
{
+ return static_cast< const UnoControlTableModel* >( _pInstance )->checkInvariants();
}
- //--------------------------------------------------------------------
- ColumnID UnoControlTableColumn::getID() const
+ //------------------------------------------------------------------------------------------------------------------
+ const char* UnoControlTableModel::checkInvariants() const
{
- return m_nID;
- }
+ Reference< XGridDataModel > const xDataModel( m_pImpl->m_aDataModel );
+ if ( !xDataModel.is() )
+ return "data model anymore";
- //--------------------------------------------------------------------
- bool UnoControlTableColumn::setID( const ColumnID _nID )
- {
- m_nID = _nID;
- return true;
- }
+ // TODO: more?
- //--------------------------------------------------------------------
- String UnoControlTableColumn::getName() const
- {
- return m_sName;
+ return NULL;
}
+#endif
- //--------------------------------------------------------------------
- void UnoControlTableColumn::setName( const String& _rName )
+#define DBG_CHECK_ME() \
+ DBG_TESTSOLARMUTEX(); \
+ DBG_CHKTHIS( UnoControlTableModel, UnoControlTableModel_checkInvariants )
+
+ //------------------------------------------------------------------------------------------------------------------
+ DBG_NAME( UnoControlTableModel )
+ UnoControlTableModel::UnoControlTableModel()
+ :m_pImpl( new UnoControlTableModel_Impl )
{
- m_sName = _rName;
+ DBG_CTOR( UnoControlTableModel, UnoControlTableModel_checkInvariants );
+ m_pImpl->bHasColumnHeaders = true;
+ m_pImpl->bHasRowHeaders = false;
+ m_pImpl->pRenderer.reset( new GridTableRenderer( *this ) );
+ m_pImpl->pInputHandler.reset( new DefaultInputHandler );
}
- //--------------------------------------------------------------------
- bool UnoControlTableColumn::isResizable() const
+
+ //------------------------------------------------------------------------------------------------------------------
+ UnoControlTableModel::~UnoControlTableModel()
{
- return m_bIsResizable;
+ DBG_DTOR( UnoControlTableModel, UnoControlTableModel_checkInvariants );
+ DELETEZ( m_pImpl );
}
- //--------------------------------------------------------------------
- void UnoControlTableColumn::setResizable( bool _bResizable )
+ //------------------------------------------------------------------------------------------------------------------
+ TableSize UnoControlTableModel::getColumnCount() const
{
- m_bIsResizable = _bResizable;
+ DBG_CHECK_ME();
+ return (TableSize)m_pImpl->aColumns.size();
}
- //--------------------------------------------------------------------
- TableMetrics UnoControlTableColumn::getWidth() const
+ //------------------------------------------------------------------------------------------------------------------
+ TableSize UnoControlTableModel::getRowCount() const
{
- return m_nWidth;
+ DBG_CHECK_ME();
+
+ TableSize nRowCount = 0;
+ try
+ {
+ Reference< XGridDataModel > const xDataModel( m_pImpl->m_aDataModel );
+ ENSURE_OR_THROW( xDataModel.is(), "no data model anymore!" );
+ nRowCount = xDataModel->getRowCount();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return nRowCount;
}
- //--------------------------------------------------------------------
- void UnoControlTableColumn::setWidth( TableMetrics _nWidth )
+ //------------------------------------------------------------------------------------------------------------------
+ bool UnoControlTableModel::hasColumnHeaders() const
{
- m_nWidth = _nWidth;
+ DBG_CHECK_ME();
+ return m_pImpl->bHasColumnHeaders;
}
- //--------------------------------------------------------------------
- TableMetrics UnoControlTableColumn::getMinWidth() const
+ //------------------------------------------------------------------------------------------------------------------
+ bool UnoControlTableModel::hasRowHeaders() const
{
- return m_nMinWidth;
+ DBG_CHECK_ME();
+ return m_pImpl->bHasRowHeaders;
}
- //--------------------------------------------------------------------
- void UnoControlTableColumn::setMinWidth( TableMetrics _nMinWidth )
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::setRowHeaders(bool _bRowHeaders)
{
- m_nMinWidth = _nMinWidth;
+ DBG_CHECK_ME();
+ if ( m_pImpl->bHasRowHeaders == _bRowHeaders )
+ return;
+
+ m_pImpl->bHasRowHeaders = _bRowHeaders;
+ impl_notifyTableMetricsChanged();
}
- //--------------------------------------------------------------------
- TableMetrics UnoControlTableColumn::getMaxWidth() const
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::setColumnHeaders(bool _bColumnHeaders)
{
- return m_nMaxWidth;
+ DBG_CHECK_ME();
+ if ( m_pImpl->bHasColumnHeaders == _bColumnHeaders )
+ return;
+
+ m_pImpl->bHasColumnHeaders = _bColumnHeaders;
+ impl_notifyTableMetricsChanged();
}
- //--------------------------------------------------------------------
- void UnoControlTableColumn::setMaxWidth( TableMetrics _nMaxWidth )
+ //------------------------------------------------------------------------------------------------------------------
+ bool UnoControlTableModel::isCellEditable( ColPos col, RowPos row ) const
{
- m_nMaxWidth = _nMaxWidth;
+ DBG_CHECK_ME();
+ (void)col;
+ (void)row;
+ return false;
}
- //--------------------------------------------------------------------
- TableMetrics UnoControlTableColumn::getPreferredWidth() const
+
+ //------------------------------------------------------------------------------------------------------------------
+ PColumnModel UnoControlTableModel::getColumnModel( ColPos column )
{
- return m_nPrefWidth;
+ DBG_CHECK_ME();
+ ENSURE_OR_RETURN( ( column >= 0 ) && ( column < getColumnCount() ),
+ "DefaultTableModel::getColumnModel: invalid index!", PColumnModel() );
+ return m_pImpl->aColumns[ column ];
}
- //--------------------------------------------------------------------
- void UnoControlTableColumn::setPreferredWidth( TableMetrics _nPrefWidth )
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::appendColumn( Reference< XGridColumn > const & i_column )
{
- m_nPrefWidth = _nPrefWidth;
+ DBG_CHECK_ME();
+ insertColumn( m_pImpl->aColumns.size(), i_column );
}
- //--------------------------------------------------------------------
- ::com::sun::star::style::HorizontalAlignment UnoControlTableColumn::getHorizontalAlign()
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::insertColumn( ColPos const i_position, Reference< XGridColumn > const & i_column )
{
- return m_xHorizontalAlign;
+ DBG_CHECK_ME();
+ ENSURE_OR_RETURN_VOID( ( i_position >= 0 ) && ( size_t( i_position ) <= m_pImpl->aColumns.size() ),
+ "UnoControlTableModel::insertColumn: illegal position!" );
+
+ const PColumnModel pColumn( new UnoGridColumnFacade( *this, i_column ) );
+ m_pImpl->aColumns.insert( m_pImpl->aColumns.begin() + i_position, pColumn );
+
+ // notify listeners
+ ModellListeners aListeners( m_pImpl->m_aListeners );
+ for ( ModellListeners::const_iterator loop = aListeners.begin();
+ loop != aListeners.end();
+ ++loop
+ )
+ {
+ (*loop)->columnInserted( i_position );
+ }
}
- //--------------------------------------------------------------------
- void UnoControlTableColumn::setHorizontalAlign( com::sun::star::style::HorizontalAlignment _align )
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::removeColumn( ColPos const i_position )
{
- m_xHorizontalAlign = _align;
+ DBG_CHECK_ME();
+ ENSURE_OR_RETURN_VOID( ( i_position >= 0 ) && ( size_t( i_position ) <= m_pImpl->aColumns.size() ),
+ "UnoControlTableModel::removeColumn: illegal position!" );
+
+ // remove the column
+ ColumnModels::iterator pos = m_pImpl->aColumns.begin() + i_position;
+ const PColumnModel pColumn = *pos;
+ m_pImpl->aColumns.erase( pos );
+
+ // notify listeners
+ ModellListeners aListeners( m_pImpl->m_aListeners );
+ for ( ModellListeners::const_iterator loop = aListeners.begin();
+ loop != aListeners.end();
+ ++loop
+ )
+ {
+ (*loop)->columnRemoved( i_position );
+ }
+
+ // dispose the column
+ UnoGridColumnFacade* pColumnImpl = dynamic_cast< UnoGridColumnFacade* >( pColumn.get() );
+ OSL_ENSURE( pColumnImpl != NULL, "UnoControlTableModel::removeColumn: illegal column implementation!" );
+ if ( pColumnImpl )
+ pColumnImpl->dispose();
}
- //====================================================================
- //= DefaultTableModel_Impl
- //====================================================================
- struct UnoControlTableModel_Impl
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::removeAllColumns()
{
- ::std::vector< PColumnModel > aColumns;
- TableSize nRowCount;
- bool bHasColumnHeaders;
- bool bHasRowHeaders;
- bool bVScroll;
- bool bHScroll;
- PTableRenderer pRenderer;
- PTableInputHandler pInputHandler;
- TableMetrics nRowHeight;
- TableMetrics nColumnHeaderHeight;
- TableMetrics nRowHeaderWidth;
- std::vector<rtl::OUString> aRowHeadersTitle;
- std::vector<std::vector< Any > > aCellContent;
- ::com::sun::star::util::Color m_xLineColor;
- ::com::sun::star::util::Color m_xHeaderColor;
- ::com::sun::star::util::Color m_xTextColor;
- ::com::sun::star::util::Color m_xRowColor1;
- ::com::sun::star::util::Color m_xRowColor2;
- ::com::sun::star::style::VerticalAlignment m_xVerticalAlign;
+ DBG_CHECK_ME();
+ if ( m_pImpl->aColumns.empty() )
+ return;
- UnoControlTableModel_Impl()
- :aColumns ( )
- ,nRowCount ( 0 )
- ,bHasColumnHeaders ( false )
- ,bHasRowHeaders ( false )
- ,bVScroll ( false )
- ,bHScroll ( false )
- ,pRenderer ( )
- ,pInputHandler ( )
- ,nRowHeight ( 0 )
- ,nColumnHeaderHeight( 0 )
- ,nRowHeaderWidth ( 10 )
- ,aRowHeadersTitle ( )
- ,aCellContent ( )
- ,m_xLineColor ( 0xFFFFFF )
- ,m_xHeaderColor ( 0xFFFFFF )
- ,m_xTextColor ( 0 )//black as default
- ,m_xRowColor1 ( 0xFFFFFF )
- ,m_xRowColor2 ( 0xFFFFFF )
- ,m_xVerticalAlign (com::sun::star::style::VerticalAlignment(0))
+ // dispose the column instances
+ for ( ColumnModels::const_iterator col = m_pImpl->aColumns.begin();
+ col != m_pImpl->aColumns.end();
+ ++col
+ )
{
+ UnoGridColumnFacade* pColumn = dynamic_cast< UnoGridColumnFacade* >( col->get() );
+ ENSURE_OR_CONTINUE( pColumn != NULL, "UnoControlTableModel::removeAllColumns: illegal column implementation!" );
+ pColumn->dispose();
}
- };
+ m_pImpl->aColumns.clear();
+
+ // notify listeners
+ ModellListeners aListeners( m_pImpl->m_aListeners );
+ for ( ModellListeners::const_iterator loop = aListeners.begin();
+ loop != aListeners.end();
+ ++loop
+ )
+ {
+ (*loop)->allColumnsRemoved();
+ }
+ }
- //====================================================================
- //= UnoControlTableModel
- //====================================================================
- //--------------------------------------------------------------------
- UnoControlTableModel::UnoControlTableModel()
- :m_pImpl( new UnoControlTableModel_Impl )
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::impl_notifyTableMetricsChanged() const
{
- m_pImpl->bHasColumnHeaders = false;
- m_pImpl->bHasRowHeaders = false;
- m_pImpl->pRenderer.reset( new GridTableRenderer( *this ) );
- m_pImpl->pInputHandler.reset( new DefaultInputHandler );
+ ModellListeners aListeners( m_pImpl->m_aListeners );
+ for ( ModellListeners::const_iterator loop = aListeners.begin();
+ loop != aListeners.end();
+ ++loop
+ )
+ {
+ (*loop)->tableMetricsChanged();
+ }
}
- //--------------------------------------------------------------------
- UnoControlTableModel::~UnoControlTableModel()
+ //------------------------------------------------------------------------------------------------------------------
+ PTableRenderer UnoControlTableModel::getRenderer() const
{
- DELETEZ( m_pImpl );
+ DBG_CHECK_ME();
+ return m_pImpl->pRenderer;
}
- //--------------------------------------------------------------------
- TableSize UnoControlTableModel::getColumnCount() const
+ //------------------------------------------------------------------------------------------------------------------
+ PTableInputHandler UnoControlTableModel::getInputHandler() const
{
- return (TableSize)m_pImpl->aColumns.size();
+ DBG_CHECK_ME();
+ return m_pImpl->pInputHandler;
}
- //--------------------------------------------------------------------
- TableSize UnoControlTableModel::getRowCount() const
+ //------------------------------------------------------------------------------------------------------------------
+ TableMetrics UnoControlTableModel::getRowHeight() const
{
- return m_pImpl->nRowCount;
+ DBG_CHECK_ME();
+ return m_pImpl->nRowHeight;
}
- //--------------------------------------------------------------------
- bool UnoControlTableModel::hasColumnHeaders() const
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::setRowHeight(TableMetrics _nRowHeight)
{
- return m_pImpl->bHasColumnHeaders;
+ DBG_CHECK_ME();
+ if ( m_pImpl->nRowHeight == _nRowHeight )
+ return;
+
+ m_pImpl->nRowHeight = _nRowHeight;
+ impl_notifyTableMetricsChanged();
}
- //--------------------------------------------------------------------
- bool UnoControlTableModel::hasRowHeaders() const
+ //------------------------------------------------------------------------------------------------------------------
+ TableMetrics UnoControlTableModel::getColumnHeaderHeight() const
{
- return m_pImpl->bHasRowHeaders;
+ DBG_CHECK_ME();
+ DBG_ASSERT( hasColumnHeaders(), "DefaultTableModel::getColumnHeaderHeight: invalid call!" );
+ return m_pImpl->nColumnHeaderHeight;
}
- //--------------------------------------------------------------------
- void UnoControlTableModel::setRowHeaders(bool _bRowHeaders)
+ //------------------------------------------------------------------------------------------------------------------
+ TableMetrics UnoControlTableModel::getRowHeaderWidth() const
{
- m_pImpl->bHasRowHeaders = _bRowHeaders;
+ DBG_CHECK_ME();
+ DBG_ASSERT( hasRowHeaders(), "DefaultTableModel::getRowHeaderWidth: invalid call!" );
+ return m_pImpl->nRowHeaderWidth;
}
- //--------------------------------------------------------------------
- void UnoControlTableModel::setColumnHeaders(bool _bColumnHeaders)
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::setColumnHeaderHeight(TableMetrics _nHeight)
{
- m_pImpl->bHasColumnHeaders = _bColumnHeaders;
+ DBG_CHECK_ME();
+ if ( m_pImpl->nColumnHeaderHeight == _nHeight )
+ return;
+
+ m_pImpl->nColumnHeaderHeight = _nHeight;
+ impl_notifyTableMetricsChanged();
}
- void UnoControlTableModel::setColumnCount(TableSize _nColCount)
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::setRowHeaderWidth(TableMetrics _nWidth)
{
- m_pImpl->aColumns.resize( _nColCount);
+ DBG_CHECK_ME();
+ if ( m_pImpl->nRowHeaderWidth == _nWidth )
+ return;
+
+ m_pImpl->nRowHeaderWidth = _nWidth;
+ impl_notifyTableMetricsChanged();
}
- //--------------------------------------------------------------------
- void UnoControlTableModel::setRowCount(TableSize _nRowCount)
+
+ //------------------------------------------------------------------------------------------------------------------
+ ScrollbarVisibility UnoControlTableModel::getVerticalScrollbarVisibility() const
{
- m_pImpl->nRowCount = _nRowCount;
+ DBG_CHECK_ME();
+ return m_pImpl->eVScrollMode;
}
- //--------------------------------------------------------------------
- bool UnoControlTableModel::isCellEditable( ColPos col, RowPos row ) const
+
+ //------------------------------------------------------------------------------------------------------------------
+ ScrollbarVisibility UnoControlTableModel::getHorizontalScrollbarVisibility() const
{
- (void)col;
- (void)row;
- return false;
+ DBG_CHECK_ME();
+ return m_pImpl->eHScrollMode;
}
- //--------------------------------------------------------------------
- void UnoControlTableModel::addTableModelListener( const PTableModelListener& listener )
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::addTableModelListener( const PTableModelListener& i_listener )
{
- (void) listener;
- // TODO
- DBG_ERROR( "DefaultTableModel::addTableModelListener: not yet implemented!" );
+ DBG_CHECK_ME();
+ ENSURE_OR_RETURN_VOID( !!i_listener, "illegal NULL listener" );
+ m_pImpl->m_aListeners.push_back( i_listener );
}
- //--------------------------------------------------------------------
- void UnoControlTableModel::removeTableModelListener( const PTableModelListener& listener )
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::removeTableModelListener( const PTableModelListener& i_listener )
{
- (void)listener;
- // TODO
- DBG_ERROR( "DefaultTableModel::removeTableModelListener: not yet implemented!" );
+ DBG_CHECK_ME();
+ for ( ModellListeners::iterator lookup = m_pImpl->m_aListeners.begin();
+ lookup != m_pImpl->m_aListeners.end();
+ ++lookup
+ )
+ {
+ if ( *lookup == i_listener )
+ {
+ m_pImpl->m_aListeners.erase( lookup );
+ return;
+ }
+ }
+ OSL_ENSURE( false, "UnoControlTableModel::removeTableModelListener: listener is not registered - sure you're doing the right thing here?" );
}
- //--------------------------------------------------------------------
- PColumnModel UnoControlTableModel::getColumnModel( ColPos column )
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::setVerticalScrollbarVisibility( ScrollbarVisibility const i_visibility ) const
{
- DBG_ASSERT( ( column >= 0 ) && ( column < getColumnCount() ),
- "DefaultTableModel::getColumnModel: invalid index!" );
- return m_pImpl->aColumns[ column ];
+ DBG_CHECK_ME();
+ m_pImpl->eVScrollMode = i_visibility;
}
- //--------------------------------------------------------------------
- std::vector<PColumnModel>& UnoControlTableModel::getColumnModel()
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::setHorizontalScrollbarVisibility( ScrollbarVisibility const i_visibility ) const
{
- return m_pImpl->aColumns;
+ DBG_CHECK_ME();
+ m_pImpl->eHScrollMode = i_visibility;
}
- //--------------------------------------------------------------------
- PColumnModel UnoControlTableModel::getColumnModelByID( ColumnID id )
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::setDataModel( Reference< XGridDataModel > const & i_gridDataModel )
{
- (void)id;
- // TODO
- DBG_ERROR( "DefaultTableModel::getColumnModelByID: not yet implemented!" );
- return PColumnModel();
+ DBG_CHECK_ME();
+ m_pImpl->m_aDataModel = i_gridDataModel;
+ // TODO: register as listener, so we're notified of row/data changes, and can multiplex them to our
+ // own listeners
}
- //--------------------------------------------------------------------
- PTableRenderer UnoControlTableModel::getRenderer() const
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XGridDataModel > UnoControlTableModel::getDataModel() const
{
- return m_pImpl->pRenderer;
+ Reference< XGridDataModel > const xDataModel( m_pImpl->m_aDataModel );
+ return xDataModel;
}
- //--------------------------------------------------------------------
- PTableInputHandler UnoControlTableModel::getInputHandler() const
+ //------------------------------------------------------------------------------------------------------------------
+ bool UnoControlTableModel::hasDataModel() const
{
- return m_pImpl->pInputHandler;
+ return getDataModel().is();
}
- //--------------------------------------------------------------------
- TableMetrics UnoControlTableModel::getRowHeight() const
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::setColumnModel( Reference< XGridColumnModel > const & i_gridColumnModel )
{
- return m_pImpl->nRowHeight;
+ DBG_CHECK_ME();
+ m_pImpl->m_aColumnModel = i_gridColumnModel;
}
- //--------------------------------------------------------------------
- void UnoControlTableModel::setRowHeight(TableMetrics _nRowHeight)
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XGridColumnModel > UnoControlTableModel::getColumnModel() const
{
- m_pImpl->nRowHeight = _nRowHeight;
+ Reference< XGridColumnModel > const xColumnModel( m_pImpl->m_aColumnModel );
+ return xColumnModel;
}
- //--------------------------------------------------------------------
- TableMetrics UnoControlTableModel::getColumnHeaderHeight() const
+ //------------------------------------------------------------------------------------------------------------------
+ bool UnoControlTableModel::hasColumnModel() const
{
- DBG_ASSERT( hasColumnHeaders(), "DefaultTableModel::getColumnHeaderHeight: invalid call!" );
- return m_pImpl->nColumnHeaderHeight;
+ return getColumnModel().is();
}
- //--------------------------------------------------------------------
- TableMetrics UnoControlTableModel::getRowHeaderWidth() const
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::getCellContent( ColPos const i_col, RowPos const i_row, Any& o_cellContent )
{
- DBG_ASSERT( hasRowHeaders(), "DefaultTableModel::getRowHeaderWidth: invalid call!" );
- return m_pImpl->nRowHeaderWidth;
+ DBG_CHECK_ME();
+
+ o_cellContent.clear();
+ try
+ {
+ Reference< XGridDataModel > const xDataModel( m_pImpl->m_aDataModel );
+ ENSURE_OR_RETURN_VOID( xDataModel.is(), "UnoControlTableModel::getCellContent: no data model anymore!" );
+
+ PColumnModel const pColumn = getColumnModel( i_col );
+ UnoGridColumnFacade* pColumnImpl = dynamic_cast< UnoGridColumnFacade* >( pColumn.get() );
+ ENSURE_OR_RETURN_VOID( pColumnImpl != NULL, "UnoControlTableModel::getCellContent: no (valid) column at this position!" );
+ sal_Int32 const nDataColumnIndex = pColumnImpl->getDataColumnIndex() >= 0 ? pColumnImpl->getDataColumnIndex() : i_col;
+
+ if ( nDataColumnIndex >= xDataModel->getColumnCount() )
+ {
+ // this is allowed, in case the column model has been dynamically extended, but the data model does
+ // not (yet?) know about it.
+ // So, handle it gracefully.
+ #if OSL_DEBUG_LEVEL > 0
+ {
+ Reference< XGridColumnModel > const xColumnModel( m_pImpl->m_aColumnModel );
+ OSL_ENSURE( xColumnModel.is() && i_col < xColumnModel->getColumnCount(),
+ "UnoControlTableModel::getCellContent: request a column's value which the ColumnModel doesn't know about!" );
+ }
+ #endif
+ }
+ else
+ {
+ o_cellContent = xDataModel->getCellData( nDataColumnIndex, i_row );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
- //--------------------------------------------------------------------
- void UnoControlTableModel::setColumnHeaderHeight(TableMetrics _nHeight)
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::getCellToolTip( ColPos const i_col, RowPos const i_row, Any& o_cellToolTip )
{
- m_pImpl->nColumnHeaderHeight = _nHeight;
+ DBG_CHECK_ME();
+ try
+ {
+ Reference< XGridDataModel > const xDataModel( m_pImpl->m_aDataModel );
+ ENSURE_OR_THROW( xDataModel.is(), "no data model anymore!" );
+
+ o_cellToolTip = xDataModel->getCellToolTip( i_col, i_row );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
- //--------------------------------------------------------------------
- void UnoControlTableModel::setRowHeaderWidth(TableMetrics _nWidth)
+ //------------------------------------------------------------------------------------------------------------------
+ Any UnoControlTableModel::getRowHeading( RowPos const i_rowPos ) const
{
- m_pImpl->nRowHeaderWidth = _nWidth;
+ DBG_CHECK_ME();
+
+ Any aRowHeading;
+
+ Reference< XGridDataModel > const xDataModel( m_pImpl->m_aDataModel );
+ ENSURE_OR_RETURN( xDataModel.is(), "UnoControlTableModel::getRowHeading: no data model anymore!", aRowHeading );
+
+ try
+ {
+ aRowHeading = xDataModel->getRowHeading( i_rowPos );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return aRowHeading;
}
- //--------------------------------------------------------------------
- void UnoControlTableModel::SetTitleHeight( TableMetrics _nHeight )
+ //------------------------------------------------------------------------------------------------------------------
+ namespace
{
- DBG_ASSERT( _nHeight > 0, "DefaultTableModel::SetTitleHeight: invalid height value!" );
- m_pImpl->nColumnHeaderHeight = _nHeight;
- // TODO: notification
+ void lcl_setColor( Any const & i_color, ::boost::optional< ::Color > & o_convertedColor )
+ {
+ if ( !i_color.hasValue() )
+ o_convertedColor.reset();
+ else
+ {
+ sal_Int32 nColor = COL_TRANSPARENT;
+ if ( i_color >>= nColor )
+ {
+ o_convertedColor.reset( ::Color( nColor ) );
+ }
+ else
+ {
+ OSL_ENSURE( false, "lcl_setColor: could not extract color value!" );
+ }
+ }
+ }
}
- //--------------------------------------------------------------------
- void UnoControlTableModel::SetHandleWidth( TableMetrics _nWidth )
+ //------------------------------------------------------------------------------------------------------------------
+ ::boost::optional< ::Color > UnoControlTableModel::getLineColor() const
{
- DBG_ASSERT( _nWidth > 0, "DefaultTableModel::SetHandleWidth: invalid width value!" );
- m_pImpl->nRowHeaderWidth = _nWidth;
- // TODO: notification
+ DBG_CHECK_ME();
+ return m_pImpl->m_aGridLineColor;
}
- //--------------------------------------------------------------------
- ScrollbarVisibility UnoControlTableModel::getVerticalScrollbarVisibility(int overAllHeight, int actHeight) const
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::setLineColor( Any const & i_color )
{
- if(overAllHeight>=actHeight && !m_pImpl->bVScroll)
- return ScrollbarShowNever;
- else
- return ScrollbarShowAlways;
+ DBG_CHECK_ME();
+ lcl_setColor( i_color, m_pImpl->m_aGridLineColor );
}
- //--------------------------------------------------------------------
- ScrollbarVisibility UnoControlTableModel::getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const
+ //------------------------------------------------------------------------------------------------------------------
+ ::boost::optional< ::Color > UnoControlTableModel::getHeaderBackgroundColor() const
{
- if(overAllWidth>=actWidth && !m_pImpl->bHScroll)
- return ScrollbarShowNever;
- else
- return ScrollbarShowAlways;
+ DBG_CHECK_ME();
+ return m_pImpl->m_aHeaderBackgroundColor;
}
- //--------------------------------------------------------------------
- void UnoControlTableModel::setVerticalScrollbarVisibility(bool _bVScroll) const
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::setHeaderBackgroundColor( Any const & i_color )
{
- m_pImpl->bVScroll = _bVScroll;
+ DBG_CHECK_ME();
+ lcl_setColor( i_color, m_pImpl->m_aHeaderBackgroundColor );
}
- //--------------------------------------------------------------------
- void UnoControlTableModel::setHorizontalScrollbarVisibility(bool _bHScroll) const
+ //------------------------------------------------------------------------------------------------------------------
+ ::boost::optional< ::Color > UnoControlTableModel::getHeaderTextColor() const
{
- m_pImpl->bHScroll = _bHScroll;
+ DBG_CHECK_ME();
+ return m_pImpl->m_aHeaderTextColor;
}
- //--------------------------------------------------------------------
- bool UnoControlTableModel::hasVerticalScrollbar()
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::setHeaderTextColor( Any const & i_color )
{
- return m_pImpl->bVScroll;
+ DBG_CHECK_ME();
+ lcl_setColor( i_color, m_pImpl->m_aHeaderTextColor );
}
- //--------------------------------------------------------------------
- bool UnoControlTableModel::hasHorizontalScrollbar()
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::boost::optional< ::Color > UnoControlTableModel::getTextColor() const
{
- return m_pImpl->bHScroll;
+ DBG_CHECK_ME();
+ return m_pImpl->m_aTextColor;
}
- //--------------------------------------------------------------------
- void UnoControlTableModel::setCellContent(const std::vector<std::vector< Any > >& cellContent)
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::setTextColor( Any const & i_color )
{
- m_pImpl->aCellContent = cellContent;
+ DBG_CHECK_ME();
+ lcl_setColor( i_color, m_pImpl->m_aTextColor );
}
- std::vector<std::vector< Any > >& UnoControlTableModel::getCellContent()
+ //------------------------------------------------------------------------------------------------------------------
+ ::boost::optional< ::Color > UnoControlTableModel::getTextLineColor() const
{
- return m_pImpl->aCellContent;
+ DBG_CHECK_ME();
+ return m_pImpl->m_aTextColor;
}
- //--------------------------------------------------------------------
- void UnoControlTableModel::setRowHeaderName(const std::vector<rtl::OUString>& cellColumnContent)
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::setTextLineColor( Any const & i_color )
{
- m_pImpl->aRowHeadersTitle = cellColumnContent;
+ DBG_CHECK_ME();
+ lcl_setColor( i_color, m_pImpl->m_aTextLineColor );
}
- std::vector<rtl::OUString>& UnoControlTableModel::getRowHeaderName()
+ //------------------------------------------------------------------------------------------------------------------
+ ::boost::optional< ::std::vector< ::Color > > UnoControlTableModel::getRowBackgroundColors() const
{
- return m_pImpl->aRowHeadersTitle;
+ DBG_CHECK_ME();
+ return m_pImpl->m_aRowColors;
}
- //--------------------------------------------------------------------
- ::com::sun::star::util::Color UnoControlTableModel::getLineColor()
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::setRowBackgroundColors( ::com::sun::star::uno::Any const & i_APIValue )
{
- return m_pImpl->m_xLineColor;
+ DBG_CHECK_ME();
+ Sequence< ::com::sun::star::util::Color > aAPIColors;
+ if ( !( i_APIValue >>= aAPIColors ) )
+ m_pImpl->m_aRowColors.reset();
+ else
+ {
+ ::std::vector< ::Color > aColors( aAPIColors.getLength() );
+ for ( sal_Int32 i=0; i<aAPIColors.getLength(); ++i )
+ {
+ aColors[i] = ::Color( aAPIColors[i] );
+ }
+ m_pImpl->m_aRowColors.reset( aColors );
+ }
}
- //--------------------------------------------------------------------
- void UnoControlTableModel::setLineColor( ::com::sun::star::util::Color _rColor )
+ //------------------------------------------------------------------------------------------------------------------
+ VerticalAlignment UnoControlTableModel::getVerticalAlign() const
{
- m_pImpl->m_xLineColor = _rColor;
+ DBG_CHECK_ME();
+ return m_pImpl->m_eVerticalAlign;
}
- //--------------------------------------------------------------------
- ::com::sun::star::util::Color UnoControlTableModel::getHeaderBackgroundColor()
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::setVerticalAlign( VerticalAlignment _xAlign )
{
- return m_pImpl->m_xHeaderColor;
+ DBG_CHECK_ME();
+ m_pImpl->m_eVerticalAlign = _xAlign;
}
- //--------------------------------------------------------------------
- void UnoControlTableModel::setHeaderBackgroundColor( ::com::sun::star::util::Color _rColor )
+ //------------------------------------------------------------------------------------------------------------------
+ ColPos UnoControlTableModel::getColumnPos( UnoGridColumnFacade const & i_column ) const
{
- m_pImpl->m_xHeaderColor = _rColor;
+ DBG_CHECK_ME();
+ for ( ColumnModels::const_iterator col = m_pImpl->aColumns.begin();
+ col != m_pImpl->aColumns.end();
+ ++col
+ )
+ {
+ if ( &i_column == col->get() )
+ return col - m_pImpl->aColumns.begin();
+ }
+ OSL_ENSURE( false, "UnoControlTableModel::getColumnPos: column not found!" );
+ return COL_INVALID;
}
- //--------------------------------------------------------------------
- ::com::sun::star::util::Color UnoControlTableModel::getTextColor()
+
+ //------------------------------------------------------------------------------------------------------------------
+ ITableDataSort* UnoControlTableModel::getSortAdapter()
{
- return m_pImpl->m_xTextColor;
+ DBG_CHECK_ME();
+
+ Reference< XSortableGridData > const xSortAccess( getDataModel(), UNO_QUERY );
+ if ( xSortAccess.is() )
+ return this;
+ return NULL;
}
- //--------------------------------------------------------------------
- void UnoControlTableModel::setTextColor( ::com::sun::star::util::Color _rColor )
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::sortByColumn( ColPos const i_column, ColumnSortDirection const i_sortDirection )
{
- m_pImpl->m_xTextColor = _rColor;
+ DBG_CHECK_ME();
+
+ try
+ {
+ Reference< XSortableGridData > const xSortAccess( getDataModel(), UNO_QUERY_THROW );
+ xSortAccess->sortByColumn( i_column, i_sortDirection == ColumnSortAscending );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
- //--------------------------------------------------------------------
- ::com::sun::star::util::Color UnoControlTableModel::getOddRowBackgroundColor()
+
+ //------------------------------------------------------------------------------------------------------------------
+ ColumnSort UnoControlTableModel::getCurrentSortOrder() const
{
- return m_pImpl->m_xRowColor1;
+ DBG_CHECK_ME();
+
+ ColumnSort currentSort;
+ try
+ {
+ Reference< XSortableGridData > const xSortAccess( getDataModel(), UNO_QUERY_THROW );
+ Pair< ::sal_Int32, ::sal_Bool > const aCurrentSortOrder( xSortAccess->getCurrentSortOrder() );
+ currentSort.nColumnPos = aCurrentSortOrder.First;
+ currentSort.eSortDirection = aCurrentSortOrder.Second ? ColumnSortAscending : ColumnSortDescending;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return currentSort;
}
//--------------------------------------------------------------------
- void UnoControlTableModel::setOddRowBackgroundColor( ::com::sun::star::util::Color _rColor )
+ void UnoControlTableModel::notifyColumnChange( ColPos const i_columnPos, ColumnAttributeGroup const i_attributeGroup ) const
{
- m_pImpl->m_xRowColor1 = _rColor;
+ DBG_CHECK_ME();
+ ENSURE_OR_RETURN_VOID( ( i_columnPos >= 0 ) && ( i_columnPos < getColumnCount() ),
+ "UnoControlTableModel::notifyColumnChange: invalid column index!" );
+
+ ModellListeners aListeners( m_pImpl->m_aListeners );
+ for ( ModellListeners::const_iterator loop = aListeners.begin();
+ loop != aListeners.end();
+ ++loop
+ )
+ {
+ (*loop)->columnChanged( i_columnPos, i_attributeGroup );
+ }
}
- //--------------------------------------------------------------------
- ::com::sun::star::util::Color UnoControlTableModel::getEvenRowBackgroundColor()
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::notifyRowsInserted( GridDataEvent const & i_event ) const
{
- return m_pImpl->m_xRowColor2;
+ // check sanity of the event
+ ENSURE_OR_RETURN_VOID( i_event.FirstRow >= 0, "UnoControlTableModel::notifyRowsInserted: invalid first row!" );
+ ENSURE_OR_RETURN_VOID( i_event.LastRow >= i_event.FirstRow, "UnoControlTableModel::notifyRowsInserted: invalid row indexes!" );
+
+ // check own sanity
+ Reference< XGridColumnModel > const xColumnModel( m_pImpl->m_aColumnModel );
+ ENSURE_OR_RETURN_VOID( xColumnModel.is(), "UnoControlTableModel::notifyRowsInserted: no column model anymore!" );
+
+ Reference< XGridDataModel > const xDataModel( m_pImpl->m_aDataModel );
+ ENSURE_OR_RETURN_VOID( xDataModel.is(), "UnoControlTableModel::notifyRowsInserted: no data model anymore!" );
+
+ // implicitly add columns to the column model
+ // TODO: is this really a good idea?
+ sal_Int32 const dataColumnCount = xDataModel->getColumnCount();
+ OSL_ENSURE( dataColumnCount > 0, "UnoControlTableModel::notifyRowsInserted: no columns at all?" );
+
+ sal_Int32 const modelColumnCount = xColumnModel->getColumnCount();
+ if ( ( modelColumnCount == 0 ) && ( dataColumnCount > 0 ) )
+ {
+ // TODO: shouldn't we clear the mutexes guard for this call?
+ xColumnModel->setDefaultColumns( dataColumnCount );
+ }
+
+ // multiplex the event to our own listeners
+ ModellListeners aListeners( m_pImpl->m_aListeners );
+ for ( ModellListeners::const_iterator loop = aListeners.begin();
+ loop != aListeners.end();
+ ++loop
+ )
+ {
+ (*loop)->rowsInserted( i_event.FirstRow, i_event.LastRow );
+ }
}
- //--------------------------------------------------------------------
- void UnoControlTableModel::setEvenRowBackgroundColor( ::com::sun::star::util::Color _rColor )
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::notifyRowsRemoved( GridDataEvent const & i_event ) const
{
- m_pImpl->m_xRowColor2 = _rColor;
+ ModellListeners aListeners( m_pImpl->m_aListeners );
+ for ( ModellListeners::const_iterator loop = aListeners.begin();
+ loop != aListeners.end();
+ ++loop
+ )
+ {
+ (*loop)->rowsRemoved( i_event.FirstRow, i_event.LastRow );
+ }
}
- //--------------------------------------------------------------------
- ::com::sun::star::style::VerticalAlignment UnoControlTableModel::getVerticalAlign()
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::notifyDataChanged( ::com::sun::star::awt::grid::GridDataEvent const & i_event ) const
{
- return m_pImpl->m_xVerticalAlign;
+ ColPos const firstCol = i_event.FirstColumn == -1 ? 0 : i_event.FirstColumn;
+ ColPos const lastCol = i_event.FirstColumn == -1 ? getColumnCount() - 1 : i_event.LastColumn;
+ RowPos const firstRow = i_event.FirstRow == -1 ? 0 : i_event.FirstRow;
+ RowPos const lastRow = i_event.FirstRow == -1 ? getRowCount() - 1 : i_event.LastRow;
+
+ ModellListeners aListeners( m_pImpl->m_aListeners );
+ for ( ModellListeners::const_iterator loop = aListeners.begin();
+ loop != aListeners.end();
+ ++loop
+ )
+ {
+ (*loop)->cellsUpdated( firstCol, lastCol, firstRow, lastRow );
+ }
}
- //--------------------------------------------------------------------
- void UnoControlTableModel::setVerticalAlign( com::sun::star::style::VerticalAlignment _xAlign )
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::notifyAllDataChanged() const
{
- m_pImpl->m_xVerticalAlign = _xAlign;
+ ModellListeners aListeners( m_pImpl->m_aListeners );
+ for ( ModellListeners::const_iterator loop = aListeners.begin();
+ loop != aListeners.end();
+ ++loop
+ )
+ {
+ (*loop)->cellsUpdated( 0, getColumnCount() - 1, 0, getRowCount() - 1 );
+ }
}
+// .....................................................................................................................
+} } // svt::table
+// .....................................................................................................................
diff --git a/svtools/source/uno/unocontroltablemodel.hxx b/svtools/source/uno/unocontroltablemodel.hxx
index c00642448f79..537c3d9a5249 100644
--- a/svtools/source/uno/unocontroltablemodel.hxx
+++ b/svtools/source/uno/unocontroltablemodel.hxx
@@ -28,67 +28,37 @@
#ifndef _UNOCONTROL_TABLEMODEL_HXX_
#define _UNOCONTROL_TABLEMODEL_HXX_
-#include <svtools/table/tablemodel.hxx>
-#include <svtools/table/tablecontrol.hxx>
+#include "svtools/table/tablemodel.hxx"
+#include "svtools/table/tablecontrol.hxx"
+
+/** === begin UNO includes === **/
#include <com/sun/star/awt/grid/XGridControl.hpp>
-#include <com/sun/star/awt/grid/XGridDataListener.hpp>
#include <com/sun/star/awt/grid/GridDataEvent.hpp>
#include <com/sun/star/awt/grid/XGridColumnModel.hpp>
#include <com/sun/star/awt/grid/XGridDataModel.hpp>
#include <com/sun/star/awt/grid/XGridSelectionListener.hpp>
-#include <toolkit/awt/vclxwindow.hxx>
-#include <toolkit/awt/vclxwindows.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <cppuhelper/implbase2.hxx>
#include <com/sun/star/awt/grid/XGridColumn.hpp>
#include <com/sun/star/util/Color.hpp>
#include <com/sun/star/style/VerticalAlignment.hpp>
-#include <com/sun/star/style/HorizontalAlignment.hpp>
+/** === end UNO includes === **/
+#include <cppuhelper/implbase2.hxx>
+#include <rtl/ref.hxx>
-using namespace ::svt::table;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::awt::grid;
+#include <boost/noncopyable.hpp>
-class UnoControlTableColumn : public IColumnModel
-{
- private:
- ColumnID m_nID;
- String m_sName;
- bool m_bIsResizable;
- TableMetrics m_nWidth;
- TableMetrics m_nMinWidth;
- TableMetrics m_nMaxWidth;
- TableMetrics m_nPrefWidth;
- ::com::sun::star::style::HorizontalAlignment m_xHorizontalAlign;
-
- public:
- UnoControlTableColumn(Reference<XGridColumn>);
- UnoControlTableColumn();
-
- // IColumnModel overridables
- virtual ColumnID getID() const;
- virtual bool setID( const ColumnID _nID );
- virtual String getName() const;
- virtual void setName( const String& _rName );
- virtual bool isResizable() const;
- virtual void setResizable( bool _bResizable );
- virtual TableMetrics getWidth() const;
- virtual void setWidth( TableMetrics _nWidth );
- virtual TableMetrics getMinWidth() const;
- virtual void setMinWidth( TableMetrics _nMinWidth );
- virtual TableMetrics getMaxWidth() const;
- virtual void setMaxWidth( TableMetrics _nMaxWidth );
- virtual TableMetrics getPreferredWidth() const;
- virtual void setPreferredWidth( TableMetrics _nPrefWidth );
- virtual ::com::sun::star::style::HorizontalAlignment getHorizontalAlign();
- virtual void setHorizontalAlign(::com::sun::star::style::HorizontalAlignment _xAlign);
-};
-
-struct UnoControlTableModel_Impl;
-
-class UnoControlTableModel : public ITableModel
+// .....................................................................................................................
+namespace svt { namespace table
{
+// .....................................................................................................................
+
+ //==================================================================================================================
+ //= UnoControlTableModel
+ //==================================================================================================================
+ class UnoGridColumnFacade;
+ struct UnoControlTableModel_Impl;
+ class UnoControlTableModel : public ITableModel, public ITableDataSort
+ {
private:
UnoControlTableModel_Impl* m_pImpl;
@@ -96,82 +66,102 @@ class UnoControlTableModel : public ITableModel
UnoControlTableModel();
~UnoControlTableModel();
- /// returns the current row height, in 1/100 millimeters
- inline TableMetrics GetRowHeight() const { return getRowHeight(); }
- /// sets a new row height.
- void setRowHeight( TableMetrics _nHeight );
- /// sets a new row header width.
- void setRowHeaderWidth( TableMetrics _nWidth );
- /// sets a new column header height.
- void setColumnHeaderHeight( TableMetrics _nHeight );
-
- /// returns the height of the title row (containing the column headers)
- inline TableMetrics GetTitleHeight() const { return getColumnHeaderHeight(); }
- /// sets a new height for the title row (containing the column headers)
- void SetTitleHeight( TableMetrics _nHeight );
-
- /// returns the width of the handle column (containing the row headers)
- inline TableMetrics GetHandleWidth() const { return getRowHeaderWidth(); }
- /// sets a new width for the handle column (containing the row headers)
- void SetHandleWidth( TableMetrics _nWidth );
-
- /// sets the width of a column
- inline void SetColumnWidth( ColPos _nColumn, TableMetrics _nWidth100thMM );
- /// retrieves the width of a column, in 1/100th millimeters
- inline TableMetrics GetColumnWidth( ColPos _nColumn );
-
public:
// ITableModel overridables
- virtual TableSize getColumnCount() const;
- virtual TableSize getRowCount() const;
- virtual void setColumnCount(TableSize _nColCount);
- virtual void setRowCount(TableSize _nRowCount);
- virtual bool hasColumnHeaders() const;
- virtual bool hasRowHeaders() const;
- virtual void setRowHeaders(bool _bRowHeaders);
- virtual void setColumnHeaders(bool _bColumnHeaders);
- virtual bool isCellEditable( ColPos col, RowPos row ) const;
- virtual void addTableModelListener( const PTableModelListener& listener );
- virtual void removeTableModelListener( const PTableModelListener& listener );
- virtual PColumnModel getColumnModel( ColPos column );
- virtual std::vector<PColumnModel>& getColumnModel();
- virtual PColumnModel getColumnModelByID( ColumnID id );
- virtual PTableRenderer getRenderer() const;
- virtual PTableInputHandler getInputHandler() const;
- virtual TableMetrics getRowHeight() const;
- virtual TableMetrics getColumnHeaderHeight() const;
- virtual TableMetrics getRowHeaderWidth() const;
- virtual ScrollbarVisibility getVerticalScrollbarVisibility(int overAllHeight, int actHeight) const;
- virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const;
- virtual void setVerticalScrollbarVisibility(bool _bVScroll) const;
- virtual void setHorizontalScrollbarVisibility(bool _bHScroll) const;
- virtual void setCellContent(const std::vector<std::vector< Any > >& cellContent);
- virtual std::vector<std::vector< Any > >& getCellContent();
- virtual void setRowHeaderName(const std::vector<rtl::OUString>& cellColumnContent);
- virtual std::vector<rtl::OUString>& getRowHeaderName();
- virtual ::com::sun::star::util::Color getLineColor();
- virtual void setLineColor(::com::sun::star::util::Color _rColor);
- virtual ::com::sun::star::util::Color getHeaderBackgroundColor();
- virtual void setHeaderBackgroundColor(::com::sun::star::util::Color _rColor);
- virtual ::com::sun::star::util::Color getTextColor();
- virtual void setTextColor(::com::sun::star::util::Color _rColor);
- virtual ::com::sun::star::util::Color getOddRowBackgroundColor();
- virtual void setOddRowBackgroundColor(::com::sun::star::util::Color _rColor);
- virtual ::com::sun::star::util::Color getEvenRowBackgroundColor();
- virtual void setEvenRowBackgroundColor(::com::sun::star::util::Color _rColor);
- virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign();
- virtual void setVerticalAlign(::com::sun::star::style::VerticalAlignment _rAlign);
- virtual bool hasVerticalScrollbar();
- virtual bool hasHorizontalScrollbar();
-};
-
-inline void UnoControlTableModel::SetColumnWidth( ColPos _nColumn, TableMetrics _nWidth100thMM )
-{
- getColumnModel( _nColumn )->setWidth( _nWidth100thMM );
-}
+ virtual TableSize getColumnCount() const;
+ virtual TableSize getRowCount() const;
+ virtual bool hasColumnHeaders() const;
+ virtual bool hasRowHeaders() const;
+ virtual bool isCellEditable( ColPos col, RowPos row ) const;
+ virtual PColumnModel getColumnModel( ColPos column );
+ virtual PTableRenderer getRenderer() const;
+ virtual PTableInputHandler getInputHandler() const;
+ virtual TableMetrics getRowHeight() const;
+ virtual TableMetrics getColumnHeaderHeight() const;
+ virtual TableMetrics getRowHeaderWidth() const;
+ virtual ScrollbarVisibility getVerticalScrollbarVisibility() const;
+ virtual ScrollbarVisibility getHorizontalScrollbarVisibility() const;
+ virtual void addTableModelListener( const PTableModelListener& i_listener );
+ virtual void removeTableModelListener( const PTableModelListener& i_listener );
+ virtual void getCellContent( ColPos const i_col, RowPos const i_row, ::com::sun::star::uno::Any& o_cellContent );
+ virtual void getCellToolTip( ColPos const i_col, RowPos const i_row, ::com::sun::star::uno::Any & o_cellToolTip );
+ virtual ::com::sun::star::uno::Any getRowHeading( RowPos const i_rowPos ) const;
+ virtual ::boost::optional< ::Color > getLineColor() const;
+ virtual ::boost::optional< ::Color > getHeaderBackgroundColor() const;
+ virtual ::boost::optional< ::Color > getHeaderTextColor() const;
+ virtual ::boost::optional< ::Color > getTextColor() const;
+ virtual ::boost::optional< ::Color > getTextLineColor() const;
+ virtual ::boost::optional< ::std::vector< ::Color > >
+ getRowBackgroundColors() const;
+ virtual ::com::sun::star::style::VerticalAlignment
+ getVerticalAlign() const;
+ virtual ITableDataSort* getSortAdapter();
+
+ // ITableDataSort overridables
+ virtual void sortByColumn( ColPos const i_column, ColumnSortDirection const i_sortDirection );
+ virtual ColumnSort getCurrentSortOrder() const;
+
+ // column write access
+ void appendColumn( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > const & i_column );
+ void insertColumn( ColPos const i_position, ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > const & i_column );
+ void removeColumn( ColPos const i_position );
+ void removeAllColumns();
+
+ // other operations
+ void setVerticalScrollbarVisibility( ScrollbarVisibility const i_visibility ) const;
+ void setHorizontalScrollbarVisibility( ScrollbarVisibility const i_visibility ) const;
+
+ void setDataModel( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > const & i_gridDataModel );
+ bool hasDataModel() const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >
+ getDataModel() const;
+ void setColumnModel( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > const & i_gridColumnModel );
+ bool hasColumnModel() const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >
+ getColumnModel() const;
+
+ void setRowHeaders(bool _bRowHeaders);
+ void setColumnHeaders(bool _bColumnHeaders);
+
+ void setRowHeight( TableMetrics _nHeight );
+ void setRowHeaderWidth( TableMetrics _nWidth );
+ void setColumnHeaderHeight( TableMetrics _nHeight );
+
+ void setLineColor( ::com::sun::star::uno::Any const & i_color );
+ void setHeaderBackgroundColor( ::com::sun::star::uno::Any const & i_color );
+ void setHeaderTextColor( ::com::sun::star::uno::Any const & i_color );
+ void setTextColor( ::com::sun::star::uno::Any const & i_color );
+ void setTextLineColor( ::com::sun::star::uno::Any const & i_color );
+ void setRowBackgroundColors( ::com::sun::star::uno::Any const & i_APIValue );
+
+ void setVerticalAlign(::com::sun::star::style::VerticalAlignment _rAlign);
+
+ // multiplexing of XGridDataListener events
+ void notifyRowsInserted( ::com::sun::star::awt::grid::GridDataEvent const & i_event ) const;
+ void notifyRowsRemoved( ::com::sun::star::awt::grid::GridDataEvent const & i_event ) const;
+ void notifyDataChanged( ::com::sun::star::awt::grid::GridDataEvent const & i_event ) const;
+
+ /// retrieves the index of a column within the model
+ ColPos getColumnPos( UnoGridColumnFacade const & i_column ) const;
+
+ /// notifies a change in a column belonging to the model
+ void notifyColumnChange( ColPos const i_columnPos, ColumnAttributeGroup const i_attributeGroup ) const;
+
+ /** notifies a change in all data represented by the model. To be used if you cannot specified the changed data
+ in more detail.
+ */
+ void notifyAllDataChanged() const;
+
+#ifdef DBG_UTIL
+ const char* checkInvariants() const;
+#endif
-inline TableMetrics UnoControlTableModel::GetColumnWidth( ColPos _nColumn )
-{
- return getColumnModel( _nColumn )->getWidth();
-}
- #endif // _UNOCONTROL_TABLEMODEL_HXX_
+ private:
+ void impl_notifyTableMetricsChanged() const;
+ };
+
+// .....................................................................................................................
+} } // svt::table
+// .....................................................................................................................
+
+#endif // _UNOCONTROL_TABLEMODEL_HXX_
diff --git a/svtools/source/uno/unogridcolumnfacade.cxx b/svtools/source/uno/unogridcolumnfacade.cxx
new file mode 100755
index 000000000000..d2f5e7b565fd
--- /dev/null
+++ b/svtools/source/uno/unogridcolumnfacade.cxx
@@ -0,0 +1,427 @@
+/*************************************************************************
+ *
+ * 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_svtools.hxx"
+
+#include "unogridcolumnfacade.hxx"
+#include "unocontroltablemodel.hxx"
+
+#include "svtools/table/defaultinputhandler.hxx"
+#include "svtools/table/gridtablerenderer.hxx"
+#include "svtools/table/tablecontrol.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/grid/XGridColumn.hpp>
+#include <com/sun/star/view/SelectionType.hpp>
+#include <com/sun/star/awt/grid/XGridColumnListener.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/stlunosequence.hxx>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+
+// .....................................................................................................................
+namespace svt { namespace table
+{
+// .....................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::awt::grid::XGridColumn;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::awt::grid::XGridColumnListener;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::awt::grid::GridColumnEvent;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::style::HorizontalAlignment_LEFT;
+ using ::com::sun::star::style::HorizontalAlignment;
+ /** === end UNO using === **/
+
+ //------------------------------------------------------------------------------------------------------------------
+ namespace
+ {
+ template< class ATTRIBUTE_TYPE >
+ void lcl_set( Reference< XGridColumn > const & i_column, void ( SAL_CALL XGridColumn::*i_setter )( ATTRIBUTE_TYPE ),
+ ATTRIBUTE_TYPE i_value )
+ {
+ try
+ {
+ (i_column.get()->*i_setter) ( i_value );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ template< class ATTRIBUTE_TYPE >
+ ATTRIBUTE_TYPE lcl_get( Reference< XGridColumn > const & i_column, ATTRIBUTE_TYPE ( SAL_CALL XGridColumn::*i_getter )() )
+ {
+ ATTRIBUTE_TYPE value = ATTRIBUTE_TYPE();
+ try
+ {
+ value = (i_column.get()->*i_getter)();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return value;
+ }
+ }
+
+ //==================================================================================================================
+ //= ColumnChangeMultiplexer
+ //==================================================================================================================
+ typedef ::cppu::WeakImplHelper1 < XGridColumnListener
+ > ColumnChangeMultiplexer_Base;
+ class ColumnChangeMultiplexer :public ColumnChangeMultiplexer_Base
+ ,public ::boost::noncopyable
+ {
+ public:
+ ColumnChangeMultiplexer( UnoGridColumnFacade& i_colImpl );
+
+ void dispose();
+
+ protected:
+ ~ColumnChangeMultiplexer();
+
+ // XGridColumnListener
+ virtual void SAL_CALL columnChanged( const GridColumnEvent& i_event ) throw (RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const EventObject& i_event ) throw (RuntimeException);
+
+ private:
+ UnoGridColumnFacade* m_pColumnImplementation;
+ };
+
+ //------------------------------------------------------------------------------------------------------------------
+ ColumnChangeMultiplexer::ColumnChangeMultiplexer( UnoGridColumnFacade& i_colImpl )
+ :m_pColumnImplementation( &i_colImpl )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ColumnChangeMultiplexer::~ColumnChangeMultiplexer()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ColumnChangeMultiplexer::dispose()
+ {
+ DBG_TESTSOLARMUTEX();
+ m_pColumnImplementation = NULL;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL ColumnChangeMultiplexer::columnChanged( const GridColumnEvent& i_event ) throw (RuntimeException)
+ {
+ if ( i_event.AttributeName.equalsAscii( "DataColumnIndex" ) )
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ if ( m_pColumnImplementation != NULL )
+ m_pColumnImplementation->dataColumnIndexChanged();
+ return;
+ }
+
+ ColumnAttributeGroup nChangedAttributes( COL_ATTRS_NONE );
+
+ if ( i_event.AttributeName.equalsAscii( "HorizontalAlign" ) )
+ nChangedAttributes |= COL_ATTRS_APPEARANCE;
+
+ if ( i_event.AttributeName.equalsAscii( "ColumnWidth" )
+ || i_event.AttributeName.equalsAscii( "MaxWidth" )
+ || i_event.AttributeName.equalsAscii( "MinWidth" )
+ || i_event.AttributeName.equalsAscii( "PreferredWidth" )
+ || i_event.AttributeName.equalsAscii( "Resizeable" )
+ || i_event.AttributeName.equalsAscii( "Flexibility" )
+ )
+ nChangedAttributes |= COL_ATTRS_WIDTH;
+
+ OSL_ENSURE( nChangedAttributes != COL_ATTRS_NONE,
+ "ColumnChangeMultiplexer::columnChanged: unknown column attributed changed!" );
+
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ if ( m_pColumnImplementation != NULL )
+ m_pColumnImplementation->columnChanged( nChangedAttributes );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL ColumnChangeMultiplexer::disposing( const EventObject& i_event ) throw (RuntimeException)
+ {
+ OSL_UNUSED( i_event );
+ }
+
+ //==================================================================================================================
+ //= UnoGridColumnFacade
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ UnoGridColumnFacade::UnoGridColumnFacade( UnoControlTableModel const & i_owner, Reference< XGridColumn > const & i_gridColumn )
+ :m_pOwner( &i_owner )
+ ,m_nDataColumnIndex( -1 )
+ ,m_xGridColumn( i_gridColumn, UNO_QUERY_THROW )
+ ,m_pChangeMultiplexer( new ColumnChangeMultiplexer( *this ) )
+ {
+ m_xGridColumn->addGridColumnListener( m_pChangeMultiplexer.get() );
+ impl_updateDataColumnIndex_nothrow();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ UnoGridColumnFacade::~UnoGridColumnFacade()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoGridColumnFacade::dispose()
+ {
+ DBG_TESTSOLARMUTEX();
+ ENSURE_OR_RETURN_VOID( m_pOwner != NULL, "UnoGridColumnFacade::dispose: already disposed!" );
+
+ m_xGridColumn->removeGridColumnListener( m_pChangeMultiplexer.get() );
+ m_pChangeMultiplexer->dispose();
+ m_pChangeMultiplexer.clear();
+ m_xGridColumn.clear();
+ m_pOwner = NULL;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoGridColumnFacade::impl_updateDataColumnIndex_nothrow()
+ {
+ m_nDataColumnIndex = -1;
+ ENSURE_OR_RETURN_VOID( m_xGridColumn.is(), "UnoGridColumnFacade: already disposed!" );
+ try
+ {
+ m_nDataColumnIndex = m_xGridColumn->getDataColumnIndex();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoGridColumnFacade::dataColumnIndexChanged()
+ {
+ DBG_TESTSOLARMUTEX();
+ impl_updateDataColumnIndex_nothrow();
+ if ( m_pOwner != NULL )
+ m_pOwner->notifyAllDataChanged();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoGridColumnFacade::columnChanged( ColumnAttributeGroup const i_attributeGroup )
+ {
+ DBG_TESTSOLARMUTEX();
+ if ( m_pOwner != NULL )
+ m_pOwner->notifyColumnChange( m_pOwner->getColumnPos( *this ), i_attributeGroup );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Any UnoGridColumnFacade::getID() const
+ {
+ Any aID;
+ ENSURE_OR_RETURN( m_xGridColumn.is(), "UnoGridColumnFacade: already disposed!", aID );
+ try
+ {
+ aID = m_xGridColumn->getIdentifier();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return aID;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoGridColumnFacade::setID( const Any& i_ID )
+ {
+ ENSURE_OR_RETURN_VOID( m_xGridColumn.is(), "UnoGridColumnFacade: already disposed!" );
+ try
+ {
+ m_xGridColumn->setIdentifier( i_ID );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ String UnoGridColumnFacade::getName() const
+ {
+ ::rtl::OUString sName;
+ ENSURE_OR_RETURN( m_xGridColumn.is(), "UnoGridColumnFacade: already disposed!", sName );
+ try
+ {
+ sName = m_xGridColumn->getTitle();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return sName;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoGridColumnFacade::setName( const String& _rName )
+ {
+ ENSURE_OR_RETURN_VOID( m_xGridColumn.is(), "UnoGridColumnFacade: already disposed!" );
+ try
+ {
+ m_xGridColumn->setTitle( _rName );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ String UnoGridColumnFacade::getHelpText() const
+ {
+ ::rtl::OUString sHelpText;
+ ENSURE_OR_RETURN( m_xGridColumn.is(), "UnoGridColumnFacade: already disposed!", sHelpText );
+ try
+ {
+ sHelpText = m_xGridColumn->getHelpText();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return sHelpText;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoGridColumnFacade::setHelpText( const String& i_helpText )
+ {
+ ENSURE_OR_RETURN_VOID( m_xGridColumn.is(), "UnoGridColumnFacade: already disposed!" );
+ try
+ {
+ m_xGridColumn->setHelpText( i_helpText );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool UnoGridColumnFacade::isResizable() const
+ {
+ ENSURE_OR_RETURN( m_xGridColumn.is(), "UnoGridColumnFacade: already disposed!", false );
+ return lcl_get( m_xGridColumn, &XGridColumn::getResizeable );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoGridColumnFacade::setResizable( bool i_resizable )
+ {
+ ENSURE_OR_RETURN_VOID( m_xGridColumn.is(), "UnoGridColumnFacade: already disposed!" );
+ lcl_set( m_xGridColumn, &XGridColumn::setResizeable, sal_Bool( i_resizable ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Int32 UnoGridColumnFacade::getFlexibility() const
+ {
+ ENSURE_OR_RETURN( m_xGridColumn.is(), "UnoGridColumnFacade: already disposed!", 1 );
+ return lcl_get( m_xGridColumn, &XGridColumn::getFlexibility );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoGridColumnFacade::setFlexibility( sal_Int32 const i_flexibility )
+ {
+ ENSURE_OR_RETURN_VOID( m_xGridColumn.is(), "UnoGridColumnFacade: already disposed!" );
+ lcl_set( m_xGridColumn, &XGridColumn::setFlexibility, i_flexibility );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ TableMetrics UnoGridColumnFacade::getWidth() const
+ {
+ ENSURE_OR_RETURN( m_xGridColumn.is(), "UnoGridColumnFacade: already disposed!", 0 );
+ return lcl_get( m_xGridColumn, &XGridColumn::getColumnWidth );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoGridColumnFacade::setWidth( TableMetrics _nWidth )
+ {
+ ENSURE_OR_RETURN_VOID( m_xGridColumn.is(), "UnoGridColumnFacade: already disposed!" );
+ lcl_set( m_xGridColumn, &XGridColumn::setColumnWidth, _nWidth );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ TableMetrics UnoGridColumnFacade::getMinWidth() const
+ {
+ ENSURE_OR_RETURN( m_xGridColumn.is(), "UnoGridColumnFacade: already disposed!", 0 );
+ return lcl_get( m_xGridColumn, &XGridColumn::getMinWidth );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoGridColumnFacade::setMinWidth( TableMetrics _nMinWidth )
+ {
+ ENSURE_OR_RETURN_VOID( m_xGridColumn.is(), "UnoGridColumnFacade: already disposed!" );
+ lcl_set( m_xGridColumn, &XGridColumn::setMinWidth, _nMinWidth );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ TableMetrics UnoGridColumnFacade::getMaxWidth() const
+ {
+ ENSURE_OR_RETURN( m_xGridColumn.is(), "UnoGridColumnFacade: already disposed!", 0 );
+ return lcl_get( m_xGridColumn, &XGridColumn::getMaxWidth );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoGridColumnFacade::setMaxWidth( TableMetrics _nMaxWidth )
+ {
+ ENSURE_OR_RETURN_VOID( m_xGridColumn.is(), "UnoGridColumnFacade: already disposed!" );
+ lcl_set( m_xGridColumn, &XGridColumn::setMinWidth, _nMaxWidth );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::com::sun::star::style::HorizontalAlignment UnoGridColumnFacade::getHorizontalAlign()
+ {
+ ENSURE_OR_RETURN( m_xGridColumn.is(), "UnoGridColumnFacade: already disposed!", HorizontalAlignment_LEFT );
+ return lcl_get( m_xGridColumn, &XGridColumn::getHorizontalAlign );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoGridColumnFacade::setHorizontalAlign( com::sun::star::style::HorizontalAlignment _align )
+ {
+ ENSURE_OR_RETURN_VOID( m_xGridColumn.is(), "UnoGridColumnFacade: already disposed!" );
+ lcl_set( m_xGridColumn, &XGridColumn::setHorizontalAlign, _align );
+ }
+
+// .....................................................................................................................
+} } // svt::table
+// .....................................................................................................................
diff --git a/svtools/source/uno/unogridcolumnfacade.hxx b/svtools/source/uno/unogridcolumnfacade.hxx
new file mode 100755
index 000000000000..7499621ba8af
--- /dev/null
+++ b/svtools/source/uno/unogridcolumnfacade.hxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef SVTOOLS_GRIDCOLUMNFACADE_HXX
+#define SVTOOLS_GRIDCOLUMNFACADE_HXX
+
+#include "svtools/table/tablemodel.hxx"
+#include "svtools/table/tablecontrol.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/grid/XGridColumn.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/style/HorizontalAlignment.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/implbase2.hxx>
+#include <rtl/ref.hxx>
+
+#include <boost/noncopyable.hpp>
+
+// .....................................................................................................................
+namespace svt { namespace table
+{
+// .....................................................................................................................
+
+ //==================================================================================================================
+ //= UnoGridColumnFacade
+ //==================================================================================================================
+ class ColumnChangeMultiplexer;
+ class UnoControlTableModel;
+ class UnoGridColumnFacade :public IColumnModel
+ ,public ::boost::noncopyable
+ {
+ public:
+ UnoGridColumnFacade(
+ UnoControlTableModel const & i_owner,
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > const & i_gridColumn
+ );
+ ~UnoGridColumnFacade();
+
+ // IColumnModel overridables
+ virtual ::com::sun::star::uno::Any
+ getID() const;
+ virtual void setID( const ::com::sun::star::uno::Any& i_ID );
+ virtual String getName() const;
+ virtual void setName( const String& _rName );
+ virtual String getHelpText() const;
+ virtual void setHelpText( const String& i_helpText );
+ virtual bool isResizable() const;
+ virtual void setResizable( bool _bResizable );
+ virtual sal_Int32 getFlexibility() const;
+ virtual void setFlexibility( sal_Int32 const i_flexibility );
+ virtual TableMetrics getWidth() const;
+ virtual void setWidth( TableMetrics _nWidth );
+ virtual TableMetrics getMinWidth() const;
+ virtual void setMinWidth( TableMetrics _nMinWidth );
+ virtual TableMetrics getMaxWidth() const;
+ virtual void setMaxWidth( TableMetrics _nMaxWidth );
+ virtual ::com::sun::star::style::HorizontalAlignment getHorizontalAlign();
+ virtual void setHorizontalAlign(::com::sun::star::style::HorizontalAlignment _xAlign);
+
+ /** disposes the column wrapper
+
+ Note that the XGridColumn which is wrapped by the instance is <strong>not</strong> disposed, as we
+ do not own it.
+ */
+ void dispose();
+
+ sal_Int32
+ getDataColumnIndex() const { return m_nDataColumnIndex; }
+
+ // callbacks for the XGridColumnListener
+ void columnChanged( ColumnAttributeGroup const i_attributeGroup );
+ void dataColumnIndexChanged();
+
+ private:
+ void impl_updateDataColumnIndex_nothrow();
+
+ private:
+ UnoControlTableModel const * m_pOwner;
+ sal_Int32 m_nDataColumnIndex;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > m_xGridColumn;
+ ::rtl::Reference< ColumnChangeMultiplexer > m_pChangeMultiplexer;
+ };
+
+// .....................................................................................................................
+} } // svt::table
+// .....................................................................................................................
+
+#endif // SVTOOLS_GRIDCOLUMNFACADE_HXX
diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx
index a60a210e8fa7..18af2c696a8c 100644
--- a/svtools/source/uno/unoiface.cxx
+++ b/svtools/source/uno/unoiface.cxx
@@ -80,6 +80,7 @@ SAL_DLLPUBLIC_EXPORT Window* CreateWindow( VCLXWindow** ppNewComp, const ::com::
if ( pParent )
{
pWindow = new MultiLineEdit( pParent, nWinBits|WB_IGNORETAB);
+ static_cast< MultiLineEdit* >( pWindow )->DisableSelectionOnFocus();
*ppNewComp = new VCLXMultiLineEdit;
}
else
diff --git a/toolkit/Library_tk.mk b/toolkit/Library_tk.mk
index fa6d3f4d591f..caf1c045be03 100644
--- a/toolkit/Library_tk.mk
+++ b/toolkit/Library_tk.mk
@@ -99,6 +99,8 @@ $(eval $(call gb_Library_add_exception_objects,tk,\
toolkit/source/controls/grid/defaultgridcolumnmodel \
toolkit/source/controls/grid/defaultgriddatamodel \
toolkit/source/controls/grid/gridcolumn \
+ toolkit/source/controls/grid/grideventforwarder \
+ toolkit/source/controls/grid/sortablegriddatamodel \
toolkit/source/controls/grid/gridcontrol \
toolkit/source/controls/roadmapcontrol \
toolkit/source/controls/roadmapentry \
diff --git a/toolkit/inc/toolkit/awt/vclxcontainer.hxx b/toolkit/inc/toolkit/awt/vclxcontainer.hxx
index b854844ae7f1..dbf8c62f4580 100644
--- a/toolkit/inc/toolkit/awt/vclxcontainer.hxx
+++ b/toolkit/inc/toolkit/awt/vclxcontainer.hxx
@@ -42,7 +42,7 @@
// class VCLXContainer
// ----------------------------------------------------
-class VCLXContainer : public ::com::sun::star::awt::XVclContainer,
+class TOOLKIT_DLLPUBLIC VCLXContainer : public ::com::sun::star::awt::XVclContainer,
public ::com::sun::star::awt::XVclContainerPeer,
public VCLXWindow
{
diff --git a/toolkit/inc/toolkit/awt/vclxtopwindow.hxx b/toolkit/inc/toolkit/awt/vclxtopwindow.hxx
index d8e467b01499..d3b130cc8202 100644
--- a/toolkit/inc/toolkit/awt/vclxtopwindow.hxx
+++ b/toolkit/inc/toolkit/awt/vclxtopwindow.hxx
@@ -91,7 +91,7 @@ public:
// class VCLXTopWindow
// ----------------------------------------------------
-class VCLXTopWindow: public VCLXTopWindow_Base,
+class TOOLKIT_DLLPUBLIC VCLXTopWindow: public VCLXTopWindow_Base,
public VCLXContainer
{
protected:
diff --git a/toolkit/inc/toolkit/awt/vclxwindows.hxx b/toolkit/inc/toolkit/awt/vclxwindows.hxx
index 547ee86c66e4..8dcf05c9f8db 100644
--- a/toolkit/inc/toolkit/awt/vclxwindows.hxx
+++ b/toolkit/inc/toolkit/awt/vclxwindows.hxx
@@ -377,7 +377,7 @@ public:
// ----------------------------------------------------
// class VCLXDialog
// ----------------------------------------------------
-class VCLXDialog : public ::com::sun::star::awt::XDialog2,
+class TOOLKIT_DLLPUBLIC VCLXDialog : public ::com::sun::star::awt::XDialog2,
public VCLXTopWindow
{
public:
diff --git a/toolkit/inc/toolkit/controls/animatedimages.hxx b/toolkit/inc/toolkit/controls/animatedimages.hxx
index 96791c252b0b..c19ed5e5451c 100755
--- a/toolkit/inc/toolkit/controls/animatedimages.hxx
+++ b/toolkit/inc/toolkit/controls/animatedimages.hxx
@@ -57,7 +57,7 @@ namespace toolkit
class AnimatedImagesControl : public AnimatedImagesControl_Base
{
public:
- AnimatedImagesControl();
+ AnimatedImagesControl( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > const & i_factory );
::rtl::OUString GetComponentServiceName();
// XAnimation
@@ -93,7 +93,7 @@ namespace toolkit
class AnimatedImagesControlModel : public AnimatedImagesControlModel_Base
{
public:
- AnimatedImagesControlModel();
+ AnimatedImagesControlModel( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > const & i_factory );
AnimatedImagesControlModel( const AnimatedImagesControlModel& i_copySource );
virtual UnoControlModel* Clone() const;
diff --git a/toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx b/toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx
index 2246ec0204b4..3090eba68749 100644
--- a/toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx
+++ b/toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx
@@ -104,7 +104,7 @@ protected:
UnoControlModelHolderList::iterator ImplFindElement( const ::rtl::OUString& rName );
public:
- ControlModelContainerBase();
+ ControlModelContainerBase( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
ControlModelContainerBase( const ControlModelContainerBase& rModel );
~ControlModelContainerBase();
@@ -232,8 +232,11 @@ protected:
void ImplUpdateResourceResolver();
void ImplStartListingForResourceEvents();
::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > Impl_getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL );
-public:
+
ControlContainerBase();
+
+public:
+ ControlContainerBase( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
~ControlContainerBase();
DECLIMPL_SERVICEINFO_DERIVED( ControlContainerBase, UnoControlBase, "toolkit.ControlContainerBase" )
diff --git a/toolkit/inc/toolkit/controls/dialogcontrol.hxx b/toolkit/inc/toolkit/controls/dialogcontrol.hxx
index 1ab0120ec470..9c0ffa3b78fb 100644
--- a/toolkit/inc/toolkit/controls/dialogcontrol.hxx
+++ b/toolkit/inc/toolkit/controls/dialogcontrol.hxx
@@ -30,12 +30,13 @@
#include <toolkit/controls/controlmodelcontainerbase.hxx>
#include <com/sun/star/awt/XTopWindow.hpp>
-#include <com/sun/star/awt/XDialog.hpp>
+#include <com/sun/star/awt/XDialog2.hpp>
#include <com/sun/star/resource/XStringResourceResolver.hpp>
#include "toolkit/helper/servicenames.hxx"
#include "toolkit/helper/macros.hxx"
#include <toolkit/controls/unocontrolcontainer.hxx>
#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/implbase3.hxx>
#include <list>
// ----------------------------------------------------
@@ -48,7 +49,7 @@ protected:
::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoControlDialogModel();
+ UnoControlDialogModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlDialogModel( const UnoControlDialogModel& rModel );
~UnoControlDialogModel();
@@ -64,10 +65,12 @@ public:
};
-class UnoDialogControl :public ControlContainerBase,
- public ::com::sun::star::awt::XTopWindow,
- public ::com::sun::star::awt::XDialog,
- public ::com::sun::star::awt::XWindowListener
+typedef ::cppu::AggImplInheritanceHelper3 < ControlContainerBase
+ , ::com::sun::star::awt::XTopWindow
+ , ::com::sun::star::awt::XDialog2
+ , ::com::sun::star::awt::XWindowListener
+ > UnoDialogControl_Base;
+class UnoDialogControl : public UnoDialogControl_Base
{
private:
::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar > mxMenuBar;
@@ -76,15 +79,10 @@ private:
public:
- UnoDialogControl();
- ~UnoDialogControl();
+ UnoDialogControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ~UnoDialogControl();
::rtl::OUString GetComponentServiceName();
- ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlContainer::queryInterface(rType); }
- ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
- void SAL_CALL release() throw() { OWeakAggObject::release(); }
-
void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
@@ -102,16 +100,16 @@ public:
virtual void SAL_CALL windowShown( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL windowHidden( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::awt::XDialog2
+ virtual void SAL_CALL endDialog( ::sal_Int32 Result ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setHelpId( const rtl::OUString& Id ) throw (::com::sun::star::uno::RuntimeException);
+
// ::com::sun::star::awt::XDialog
void SAL_CALL setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException);
::rtl::OUString SAL_CALL getTitle() throw(::com::sun::star::uno::RuntimeException);
sal_Int16 SAL_CALL execute() throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL endExecute() throw(::com::sun::star::uno::RuntimeException);
- // ::com::sun::star::lang::XTypeProvider
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
-
// ::com::sun::star::awt::XControl
sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model ) throw(::com::sun::star::uno::RuntimeException);
diff --git a/toolkit/inc/toolkit/controls/formattedcontrol.hxx b/toolkit/inc/toolkit/controls/formattedcontrol.hxx
index f589dabd47aa..93f675dae03f 100644
--- a/toolkit/inc/toolkit/controls/formattedcontrol.hxx
+++ b/toolkit/inc/toolkit/controls/formattedcontrol.hxx
@@ -67,8 +67,11 @@ namespace toolkit
) throw (::com::sun::star::uno::Exception);
public:
- UnoControlFormattedFieldModel();
- UnoControlFormattedFieldModel( const UnoControlFormattedFieldModel& rModel ) : UnoControlModel( rModel ) {;}
+ UnoControlFormattedFieldModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ UnoControlFormattedFieldModel( const UnoControlFormattedFieldModel& rModel )
+ :UnoControlModel( rModel )
+ {
+ }
UnoControlModel* Clone() const { return new UnoControlFormattedFieldModel( *this ); }
@@ -110,7 +113,7 @@ namespace toolkit
class UnoFormattedFieldControl : public UnoSpinFieldControl
{
public:
- UnoFormattedFieldControl();
+ UnoFormattedFieldControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
// ::com::sun::star::awt::XTextListener
diff --git a/toolkit/inc/toolkit/controls/geometrycontrolmodel.hxx b/toolkit/inc/toolkit/controls/geometrycontrolmodel.hxx
index 558d145f3d14..ef86ec8eb5b8 100644
--- a/toolkit/inc/toolkit/controls/geometrycontrolmodel.hxx
+++ b/toolkit/inc/toolkit/controls/geometrycontrolmodel.hxx
@@ -185,8 +185,7 @@ FORWARD_DECLARE_INTERFACE( script, XNameContainer )
,public ::comphelper::OAggregationArrayUsageHelper< OTemplateInstanceDisambiguation< CONTROLMODEL > >
{
public:
- OGeometryControlModel();
- OGeometryControlModel(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & i_xCompContext);
+ OGeometryControlModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
private:
OGeometryControlModel(::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable >& _rxAggregateInstance);
diff --git a/toolkit/inc/toolkit/controls/geometrycontrolmodel_impl.hxx b/toolkit/inc/toolkit/controls/geometrycontrolmodel_impl.hxx
index 3b784251b65e..0b2362656433 100644
--- a/toolkit/inc/toolkit/controls/geometrycontrolmodel_impl.hxx
+++ b/toolkit/inc/toolkit/controls/geometrycontrolmodel_impl.hxx
@@ -32,17 +32,17 @@
//====================================================================
//--------------------------------------------------------------------
template <class CONTROLMODEL>
-OGeometryControlModel<CONTROLMODEL>::OGeometryControlModel()
- :OGeometryControlModel_Base(new CONTROLMODEL)
-{
-}
-
-template <class CONTROLMODEL>
-OGeometryControlModel<CONTROLMODEL>::OGeometryControlModel(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & i_xCompContext)
- :OGeometryControlModel_Base(new CONTROLMODEL(i_xCompContext))
+OGeometryControlModel<CONTROLMODEL>::OGeometryControlModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
+ :OGeometryControlModel_Base(new CONTROLMODEL( i_factory ) )
{
}
+//template <class CONTROLMODEL>
+//OGeometryControlModel<CONTROLMODEL>::OGeometryControlModel(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & i_xCompContext)
+// :OGeometryControlModel_Base(new CONTROLMODEL(i_xCompContext))
+//{
+//}
+//
//--------------------------------------------------------------------
template <class CONTROLMODEL>
OGeometryControlModel<CONTROLMODEL>::OGeometryControlModel(::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable >& _rxAggregateInstance)
diff --git a/toolkit/inc/toolkit/controls/roadmapcontrol.hxx b/toolkit/inc/toolkit/controls/roadmapcontrol.hxx
index 1b86d277fde2..0848fb21b8b5 100644
--- a/toolkit/inc/toolkit/controls/roadmapcontrol.hxx
+++ b/toolkit/inc/toolkit/controls/roadmapcontrol.hxx
@@ -45,37 +45,37 @@
#include <cppuhelper/implbase4.hxx>
-
#include <comphelper/uno3.hxx>
-typedef GraphicControlModel UnoControlRoadmapModel_Base;
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+ typedef GraphicControlModel UnoControlRoadmapModel_Base;
-typedef ::cppu::ImplHelper3 < ::com::sun::star::lang::XSingleServiceFactory
- , ::com::sun::star::container::XContainer
- , ::com::sun::star::container::XIndexContainer
- > UnoControlRoadmapModel_IBase;
+ typedef ::cppu::ImplHelper3 < ::com::sun::star::lang::XSingleServiceFactory
+ , ::com::sun::star::container::XContainer
+ , ::com::sun::star::container::XIndexContainer
+ > UnoControlRoadmapModel_IBase;
-typedef UnoControlBase UnoControlRoadmap_Base;
-typedef ::cppu::ImplHelper4 < ::com::sun::star::awt::XItemEventBroadcaster
- , ::com::sun::star::container::XContainerListener
- , ::com::sun::star::awt::XItemListener
- , ::com::sun::star::beans::XPropertyChangeListener
- > UnoControlRoadmap_IBase;
+ typedef UnoControlBase UnoControlRoadmap_Base;
+ typedef ::cppu::ImplHelper4 < ::com::sun::star::awt::XItemEventBroadcaster
+ , ::com::sun::star::container::XContainerListener
+ , ::com::sun::star::awt::XItemListener
+ , ::com::sun::star::beans::XPropertyChangeListener
+ > UnoControlRoadmap_IBase;
-typedef ::cppu::ImplHelper2< ::com::sun::star::container::XContainerListener,
- ::com::sun::star::awt::XItemEventBroadcaster> SVTXRoadmap_Base;
+ typedef ::cppu::ImplHelper2< ::com::sun::star::container::XContainerListener,
+ ::com::sun::star::awt::XItemEventBroadcaster> SVTXRoadmap_Base;
-//........................................................................
-namespace toolkit{
-//........................................................................
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::lang;
@@ -110,7 +110,7 @@ namespace toolkit{
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoControlRoadmapModel();
+ UnoControlRoadmapModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlRoadmapModel( const UnoControlRoadmapModel& rModel ) :
UnoControlRoadmapModel_Base( rModel ),
UnoControlRoadmapModel_IBase( rModel ),
@@ -167,7 +167,7 @@ namespace toolkit{
private:
ItemListenerMultiplexer maItemListeners;
public:
- UnoRoadmapControl();
+ UnoRoadmapControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); }
diff --git a/toolkit/inc/toolkit/controls/spinningprogress.hxx b/toolkit/inc/toolkit/controls/spinningprogress.hxx
index b2e8204ca999..e0a676b2aa86 100755
--- a/toolkit/inc/toolkit/controls/spinningprogress.hxx
+++ b/toolkit/inc/toolkit/controls/spinningprogress.hxx
@@ -44,7 +44,7 @@ namespace toolkit
class SpinningProgressControlModel : public SpinningProgressControlModel_Base
{
public:
- SpinningProgressControlModel();
+ SpinningProgressControlModel( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > const & i_factory );
SpinningProgressControlModel( const SpinningProgressControlModel& i_copySource );
virtual UnoControlModel* Clone() const;
diff --git a/toolkit/inc/toolkit/controls/tabpagecontainer.hxx b/toolkit/inc/toolkit/controls/tabpagecontainer.hxx
index 6861f4bc01bb..c7a2e3b8ef90 100644
--- a/toolkit/inc/toolkit/controls/tabpagecontainer.hxx
+++ b/toolkit/inc/toolkit/controls/tabpagecontainer.hxx
@@ -66,7 +66,7 @@ protected:
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
public:
- UnoControlTabPageContainerModel();
+ UnoControlTabPageContainerModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlTabPageContainerModel( const UnoControlTabPageContainerModel& rModel ) : UnoControlTabPageContainerModel_Base( rModel ),maContainerListeners( *this ) {;}
UnoControlModel* Clone() const { return new UnoControlTabPageContainerModel( *this ); }
@@ -113,7 +113,7 @@ typedef ::cppu::AggImplInheritanceHelper1 < ControlContainerBase
class UnoControlTabPageContainer : public UnoControlTabPageContainer_Base
{
public:
- UnoControlTabPageContainer();
+ UnoControlTabPageContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
// ::com::sun::star::lang::XComponent
diff --git a/toolkit/inc/toolkit/controls/tabpagemodel.hxx b/toolkit/inc/toolkit/controls/tabpagemodel.hxx
index 76edc2e68026..08938669fa58 100644
--- a/toolkit/inc/toolkit/controls/tabpagemodel.hxx
+++ b/toolkit/inc/toolkit/controls/tabpagemodel.hxx
@@ -93,12 +93,11 @@
class UnoControlTabPageModel : public ControlModelContainerBase
//public TabPageModel
{
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xCompContext;
protected:
::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoControlTabPageModel( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & i_xCompContext);
+ UnoControlTabPageModel( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > const & i_factory);
// ::com::sun::star::io::XPersistObject
::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
@@ -127,7 +126,7 @@ private:
bool m_bWindowListener;
public:
- UnoControlTabPage();
+ UnoControlTabPage( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
~UnoControlTabPage();
::rtl::OUString GetComponentServiceName();
diff --git a/toolkit/inc/toolkit/controls/tkscrollbar.hxx b/toolkit/inc/toolkit/controls/tkscrollbar.hxx
index 78795aa240c2..da3d97ab1bc2 100644
--- a/toolkit/inc/toolkit/controls/tkscrollbar.hxx
+++ b/toolkit/inc/toolkit/controls/tkscrollbar.hxx
@@ -50,7 +50,7 @@ namespace toolkit
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoControlScrollBarModel();
+ UnoControlScrollBarModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlScrollBarModel( const UnoControlScrollBarModel& rModel ) : UnoControlModel( rModel ) {;}
UnoControlModel* Clone() const { return new UnoControlScrollBarModel( *this ); }
@@ -76,7 +76,7 @@ namespace toolkit
AdjustmentListenerMultiplexer maAdjustmentListeners;
public:
- UnoScrollBarControl();
+ UnoScrollBarControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); }
diff --git a/toolkit/inc/toolkit/controls/tksimpleanimation.hxx b/toolkit/inc/toolkit/controls/tksimpleanimation.hxx
index 1d059c749902..a0ddfc0dbf8d 100644
--- a/toolkit/inc/toolkit/controls/tksimpleanimation.hxx
+++ b/toolkit/inc/toolkit/controls/tksimpleanimation.hxx
@@ -51,7 +51,7 @@ namespace toolkit
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoSimpleAnimationControlModel();
+ UnoSimpleAnimationControlModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoSimpleAnimationControlModel( const UnoSimpleAnimationControlModel& rModel ) : UnoControlModel( rModel ) {;}
UnoControlModel* Clone() const { return new UnoSimpleAnimationControlModel( *this ); }
@@ -80,7 +80,7 @@ namespace toolkit
private:
public:
- UnoSimpleAnimationControl();
+ UnoSimpleAnimationControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
// XSimpleAnimation
diff --git a/toolkit/inc/toolkit/controls/tkspinbutton.hxx b/toolkit/inc/toolkit/controls/tkspinbutton.hxx
index 48c602f76cfc..7600c3e6f9e7 100644
--- a/toolkit/inc/toolkit/controls/tkspinbutton.hxx
+++ b/toolkit/inc/toolkit/controls/tkspinbutton.hxx
@@ -51,7 +51,7 @@ namespace toolkit
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoSpinButtonModel();
+ UnoSpinButtonModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoSpinButtonModel( const UnoSpinButtonModel& rModel ) : UnoControlModel( rModel ) {;}
UnoControlModel* Clone() const { return new UnoSpinButtonModel( *this ); }
@@ -82,7 +82,7 @@ namespace toolkit
AdjustmentListenerMultiplexer maAdjustmentListeners;
public:
- UnoSpinButtonControl();
+ UnoSpinButtonControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
DECLARE_UNO3_AGG_DEFAULTS( UnoSpinButtonControl, UnoControlBase );
diff --git a/toolkit/inc/toolkit/controls/tkthrobber.hxx b/toolkit/inc/toolkit/controls/tkthrobber.hxx
index d6c3a3d8a511..1c149639fc47 100644
--- a/toolkit/inc/toolkit/controls/tkthrobber.hxx
+++ b/toolkit/inc/toolkit/controls/tkthrobber.hxx
@@ -51,7 +51,7 @@ namespace toolkit
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoThrobberControlModel();
+ UnoThrobberControlModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoThrobberControlModel( const UnoThrobberControlModel& rModel ) : UnoControlModel( rModel ) {;}
UnoControlModel* Clone() const { return new UnoThrobberControlModel( *this ); }
@@ -80,7 +80,7 @@ namespace toolkit
private:
public:
- UnoThrobberControl();
+ UnoThrobberControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
DECLARE_UNO3_AGG_DEFAULTS( UnoThrobberControl, UnoControlBase );
diff --git a/toolkit/inc/toolkit/controls/unocontrol.hxx b/toolkit/inc/toolkit/controls/unocontrol.hxx
index 6bcfa519ed3d..44836ec28dd6 100644
--- a/toolkit/inc/toolkit/controls/unocontrol.hxx
+++ b/toolkit/inc/toolkit/controls/unocontrol.hxx
@@ -49,6 +49,7 @@
#include <cppuhelper/interfacecontainer.hxx>
#include <cppuhelper/weakref.hxx>
#include <cppuhelper/implbase9.hxx>
+#include <comphelper/componentcontext.hxx>
#include <com/sun/star/util/XModeChangeBroadcaster.hpp>
#include <com/sun/star/awt/XVclWindowPeer.hpp>
@@ -95,6 +96,7 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer > mxVclWindowPeer; // just to avoid the query_interface thing
protected:
+ const ::comphelper::ComponentContext maContext;
EventListenerMultiplexer maDisposeListeners;
WindowListenerMultiplexer maWindowListeners;
FocusListenerMultiplexer maFocusListeners;
@@ -144,8 +146,11 @@ protected:
virtual sal_Bool requiresNewPeer( const ::rtl::OUString& _rPropertyName ) const;
-public:
+protected:
UnoControl();
+
+public:
+ UnoControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
~UnoControl();
UnoControlComponentInfos& GetComponentInfos() { return maComponentInfos; }
diff --git a/toolkit/inc/toolkit/controls/unocontrolbase.hxx b/toolkit/inc/toolkit/controls/unocontrolbase.hxx
index f12dd23a5c67..1ce56c11cec1 100644
--- a/toolkit/inc/toolkit/controls/unocontrolbase.hxx
+++ b/toolkit/inc/toolkit/controls/unocontrolbase.hxx
@@ -39,6 +39,14 @@
class TOOLKIT_DLLPUBLIC UnoControlBase : public UnoControl
{
protected:
+ UnoControlBase();
+
+protected:
+ UnoControlBase( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
+ :UnoControl( i_factory )
+ {
+ }
+
sal_Bool ImplHasProperty( sal_uInt16 nProp );
sal_Bool ImplHasProperty( const ::rtl::OUString& aPropertyName );
void ImplSetPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue, sal_Bool bUpdateThis );
diff --git a/toolkit/inc/toolkit/controls/unocontrolcontainer.hxx b/toolkit/inc/toolkit/controls/unocontrolcontainer.hxx
index 1175d0e85abb..dcba4fdcbf9a 100644
--- a/toolkit/inc/toolkit/controls/unocontrolcontainer.hxx
+++ b/toolkit/inc/toolkit/controls/unocontrolcontainer.hxx
@@ -64,8 +64,9 @@ protected:
void ImplActivateTabControllers();
public:
- UnoControlContainer();
- UnoControlContainer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xPeer );
+ UnoControlContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ UnoControlContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xPeer );
~UnoControlContainer();
diff --git a/toolkit/inc/toolkit/controls/unocontrolcontainermodel.hxx b/toolkit/inc/toolkit/controls/unocontrolcontainermodel.hxx
index ef0d9a4068ee..cdc908718988 100644
--- a/toolkit/inc/toolkit/controls/unocontrolcontainermodel.hxx
+++ b/toolkit/inc/toolkit/controls/unocontrolcontainermodel.hxx
@@ -45,7 +45,7 @@ protected:
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoControlContainerModel();
+ UnoControlContainerModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlContainerModel( const UnoControlContainerModel& rModel ) : UnoControlModel( rModel ) {;}
UnoControlModel* Clone() const { return new UnoControlContainerModel( *this ); }
diff --git a/toolkit/inc/toolkit/controls/unocontrolmodel.hxx b/toolkit/inc/toolkit/controls/unocontrolmodel.hxx
index 5ac3c33aa1c9..bdb6e5d4bc68 100644
--- a/toolkit/inc/toolkit/controls/unocontrolmodel.hxx
+++ b/toolkit/inc/toolkit/controls/unocontrolmodel.hxx
@@ -44,6 +44,9 @@
#include <cppuhelper/propshlp.hxx>
#include <cppuhelper/interfacecontainer.hxx>
+#include <cppuhelper/implbase7.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/uno3.hxx>
#include <list>
@@ -53,21 +56,25 @@ class ImplPropertyTable;
// class UnoControlModel
// ----------------------------------------------------
-class TOOLKIT_DLLPUBLIC UnoControlModel : public ::com::sun::star::awt::XControlModel,
- public ::com::sun::star::beans::XPropertyState,
- public ::com::sun::star::io::XPersistObject,
- public ::com::sun::star::lang::XComponent,
- public ::com::sun::star::lang::XServiceInfo,
- public ::com::sun::star::lang::XTypeProvider,
- public ::com::sun::star::lang::XUnoTunnel,
- public ::com::sun::star::util::XCloneable,
- public MutexAndBroadcastHelper,
- public ::cppu::OPropertySetHelper,
- public ::cppu::OWeakAggObject
+typedef ::cppu::WeakAggImplHelper7 < ::com::sun::star::awt::XControlModel
+ , ::com::sun::star::beans::XPropertyState
+ , ::com::sun::star::io::XPersistObject
+ , ::com::sun::star::lang::XComponent
+ , ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::lang::XUnoTunnel
+ , ::com::sun::star::util::XCloneable
+ > UnoControlModel_Base;
+
+class TOOLKIT_DLLPUBLIC UnoControlModel :public UnoControlModel_Base
+ ,public MutexAndBroadcastHelper
+ ,public ::cppu::OPropertySetHelper
{
private:
- ImplPropertyTable* mpData;
- EventListenerMultiplexer maDisposeListeners;
+ ImplPropertyTable* mpData;
+ EventListenerMultiplexer maDisposeListeners;
+
+protected:
+ const ::comphelper::ComponentContext maContext;
protected:
void ImplRegisterProperty( sal_uInt16 nPropType );
@@ -99,18 +106,21 @@ protected:
sal_Int32 _nSecondHandle /// second handle, which should supersede _nFirstHandle in the sequence
) const;
-public:
+protected:
UnoControlModel();
+public:
+ UnoControlModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlModel( const UnoControlModel& rModel );
~UnoControlModel();
virtual UnoControlModel* Clone() const = 0;
- // ::com::sun::star::uno::XAggregation
+ // ::com::sun::star::uno::XInterface
::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return OWeakAggObject::queryInterface(rType); }
- void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
- void SAL_CALL release() throw() { OWeakAggObject::release(); }
+ void SAL_CALL acquire() throw();
+ void SAL_CALL release() throw();
+ // ::com::sun::star::uno::XAggregation
::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
// ::com::sun::star::lang::XUnoTunnel
@@ -122,10 +132,7 @@ public:
::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() throw(::com::sun::star::uno::RuntimeException);
// ::com::sun::star::lang::XTypeProvider
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::awt::XControlModel
+ DECLARE_XTYPEPROVIDER()
// ::com::sun::star::lang::XComponent
void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
diff --git a/toolkit/inc/toolkit/controls/unocontrols.hxx b/toolkit/inc/toolkit/controls/unocontrols.hxx
index 21af6d2b45e6..09622d2c8ef8 100644
--- a/toolkit/inc/toolkit/controls/unocontrols.hxx
+++ b/toolkit/inc/toolkit/controls/unocontrols.hxx
@@ -82,7 +82,7 @@ protected:
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoControlEditModel();
+ UnoControlEditModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlEditModel( const UnoControlEditModel& rModel ) : UnoControlModel( rModel ) {;}
UnoControlModel* Clone() const { return new UnoControlEditModel( *this ); }
@@ -124,7 +124,7 @@ private:
public:
- UnoEditControl();
+ UnoEditControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
TextListenerMultiplexer& GetTextListeners() { return maTextListeners; }
@@ -185,7 +185,7 @@ protected:
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoControlFileControlModel();
+ UnoControlFileControlModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlFileControlModel( const UnoControlFileControlModel& rModel ) : UnoControlModel( rModel ) {;}
UnoControlModel* Clone() const { return new UnoControlFileControlModel( *this ); }
@@ -206,7 +206,7 @@ public:
class UnoFileControl : public UnoEditControl
{
public:
- UnoFileControl();
+ UnoFileControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
// ::com::sun::star::lang::XServiceInfo
@@ -226,7 +226,12 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL );
protected:
- GraphicControlModel() : mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
+ GraphicControlModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
+ ,mbAdjustingImagePosition( false )
+ ,mbAdjustingGraphic( false )
+ {
+ }
GraphicControlModel( const GraphicControlModel& _rSource ) : UnoControlModel( _rSource ), mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
// ::cppu::OPropertySetHelper
@@ -242,14 +247,14 @@ private:
// ----------------------------------------------------
// class UnoControlButtonModel
// ----------------------------------------------------
-class UnoControlButtonModel : public GraphicControlModel
+class UnoControlButtonModel : public GraphicControlModel
{
protected:
::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoControlButtonModel();
+ UnoControlButtonModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlButtonModel( const UnoControlButtonModel& rModel ) : GraphicControlModel( rModel ) {;}
UnoControlModel* Clone() const { return new UnoControlButtonModel( *this ); }
@@ -282,7 +287,7 @@ private:
public:
- UnoButtonControl();
+ UnoButtonControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
@@ -327,7 +332,7 @@ protected:
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoControlImageControlModel();
+ UnoControlImageControlModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlImageControlModel( const UnoControlImageControlModel& rModel ) : GraphicControlModel( rModel ), mbAdjustingImageScaleMode( false ) { }
UnoControlModel* Clone() const { return new UnoControlImageControlModel( *this ); }
@@ -359,7 +364,7 @@ private:
public:
- UnoImageControlControl();
+ UnoImageControlControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
@@ -387,7 +392,7 @@ protected:
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoControlRadioButtonModel();
+ UnoControlRadioButtonModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlRadioButtonModel( const UnoControlRadioButtonModel& rModel ) : GraphicControlModel( rModel ) {;}
UnoControlModel* Clone() const { return new UnoControlRadioButtonModel( *this ); }
@@ -421,7 +426,7 @@ private:
public:
- UnoRadioButtonControl();
+ UnoRadioButtonControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
@@ -466,7 +471,7 @@ protected:
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoControlCheckBoxModel();
+ UnoControlCheckBoxModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlCheckBoxModel( const UnoControlCheckBoxModel& rModel ) : GraphicControlModel( rModel ) {;}
UnoControlModel* Clone() const { return new UnoControlCheckBoxModel( *this ); }
@@ -499,7 +504,7 @@ private:
public:
- UnoCheckBoxControl();
+ UnoCheckBoxControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
~UnoCheckBoxControl(){;}
::rtl::OUString GetComponentServiceName();
@@ -547,7 +552,7 @@ protected:
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoControlFixedHyperlinkModel();
+ UnoControlFixedHyperlinkModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlFixedHyperlinkModel( const UnoControlFixedHyperlinkModel& rModel ) : UnoControlModel( rModel ) {;}
UnoControlModel* Clone() const { return new UnoControlFixedHyperlinkModel( *this ); }
@@ -573,7 +578,7 @@ private:
ActionListenerMultiplexer maActionListeners;
public:
- UnoFixedHyperlinkControl();
+ UnoFixedHyperlinkControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
@@ -621,7 +626,7 @@ protected:
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoControlFixedTextModel();
+ UnoControlFixedTextModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlFixedTextModel( const UnoControlFixedTextModel& rModel ) : UnoControlModel( rModel ) {;}
UnoControlModel* Clone() const { return new UnoControlFixedTextModel( *this ); }
@@ -645,7 +650,7 @@ class UnoFixedTextControl : public UnoControlBase,
public ::com::sun::star::awt::XLayoutConstrains
{
public:
- UnoFixedTextControl();
+ UnoFixedTextControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); }
@@ -686,7 +691,7 @@ protected:
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoControlGroupBoxModel();
+ UnoControlGroupBoxModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlGroupBoxModel( const UnoControlGroupBoxModel& rModel ) : UnoControlModel( rModel ) {;}
UnoControlModel* Clone() const { return new UnoControlGroupBoxModel( *this ); }
@@ -708,7 +713,7 @@ public:
class UnoGroupBoxControl : public UnoControlBase
{
public:
- UnoGroupBoxControl();
+ UnoGroupBoxControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException);
@@ -725,12 +730,20 @@ struct UnoControlListBoxModel_Data;
typedef ::cppu::AggImplInheritanceHelper1 < UnoControlModel
, ::com::sun::star::awt::XItemList
> UnoControlListBoxModel_Base;
-class TOOLKIT_DLLPUBLIC UnoControlListBoxModel :public UnoControlListBoxModel_Base
+class TOOLKIT_DLLPUBLIC UnoControlListBoxModel : public UnoControlListBoxModel_Base
{
protected:
- UnoControlListBoxModel(bool asComboBox);
+ enum ConstructorMode
+ {
+ ConstructDefault,
+ ConstructWithoutProperties
+ };
+
public:
- UnoControlListBoxModel();
+ UnoControlListBoxModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory,
+ ConstructorMode const i_mode = ConstructDefault
+ );
UnoControlListBoxModel( const UnoControlListBoxModel& i_rSource );
~UnoControlListBoxModel();
@@ -828,7 +841,7 @@ typedef ::cppu::AggImplInheritanceHelper5 < UnoControlBase
class TOOLKIT_DLLPUBLIC UnoListBoxControl : public UnoListBoxControl_Base
{
public:
- UnoListBoxControl();
+ UnoListBoxControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
@@ -908,7 +921,7 @@ protected:
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoControlComboBoxModel();
+ UnoControlComboBoxModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlComboBoxModel( const UnoControlComboBoxModel& rModel ) : UnoControlListBoxModel( rModel ) {;}
UnoControlModel* Clone() const { return new UnoControlComboBoxModel( *this ); }
@@ -942,7 +955,7 @@ private:
public:
- UnoComboBoxControl();
+ UnoComboBoxControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
@@ -1009,7 +1022,7 @@ private:
sal_Bool mbRepeat;
public:
- UnoSpinFieldControl();
+ UnoSpinFieldControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoEditControl::queryInterface(rType); }
::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
@@ -1047,7 +1060,7 @@ protected:
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoControlDateFieldModel();
+ UnoControlDateFieldModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlDateFieldModel( const UnoControlDateFieldModel& rModel ) : UnoControlModel( rModel ) {;}
UnoControlModel* Clone() const { return new UnoControlDateFieldModel( *this ); }
@@ -1074,7 +1087,7 @@ private:
sal_Int32 mnLast;
sal_Bool mbLongFormat;
public:
- UnoDateFieldControl();
+ UnoDateFieldControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoSpinFieldControl::queryInterface(rType); }
@@ -1123,7 +1136,7 @@ protected:
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoControlTimeFieldModel();
+ UnoControlTimeFieldModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlTimeFieldModel( const UnoControlTimeFieldModel& rModel ) : UnoControlModel( rModel ) {;}
UnoControlModel* Clone() const { return new UnoControlTimeFieldModel( *this ); }
@@ -1150,7 +1163,7 @@ private:
sal_Int32 mnLast;
public:
- UnoTimeFieldControl();
+ UnoTimeFieldControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoSpinFieldControl::queryInterface(rType); }
@@ -1198,7 +1211,7 @@ protected:
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoControlNumericFieldModel();
+ UnoControlNumericFieldModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlNumericFieldModel( const UnoControlNumericFieldModel& rModel ) : UnoControlModel( rModel ) {;}
UnoControlModel* Clone() const { return new UnoControlNumericFieldModel( *this ); }
@@ -1225,7 +1238,7 @@ private:
double mnLast;
public:
- UnoNumericFieldControl();
+ UnoNumericFieldControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoSpinFieldControl::queryInterface(rType); }
@@ -1275,7 +1288,7 @@ protected:
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoControlCurrencyFieldModel();
+ UnoControlCurrencyFieldModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlCurrencyFieldModel( const UnoControlCurrencyFieldModel& rModel ) : UnoControlModel( rModel ) {;}
UnoControlModel* Clone() const { return new UnoControlCurrencyFieldModel( *this ); }
@@ -1302,7 +1315,7 @@ private:
double mnLast;
public:
- UnoCurrencyFieldControl();
+ UnoCurrencyFieldControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoSpinFieldControl::queryInterface(rType); }
@@ -1351,7 +1364,7 @@ protected:
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoControlPatternFieldModel();
+ UnoControlPatternFieldModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlPatternFieldModel( const UnoControlPatternFieldModel& rModel ) : UnoControlModel( rModel ) {;}
UnoControlModel* Clone() const { return new UnoControlPatternFieldModel( *this ); }
@@ -1377,7 +1390,7 @@ protected:
void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal );
public:
- UnoPatternFieldControl();
+ UnoPatternFieldControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoSpinFieldControl::queryInterface(rType); }
@@ -1412,7 +1425,7 @@ protected:
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoControlProgressBarModel();
+ UnoControlProgressBarModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlProgressBarModel( const UnoControlProgressBarModel& rModel ) : UnoControlModel( rModel ) {;}
UnoControlModel* Clone() const { return new UnoControlProgressBarModel( *this ); }
@@ -1434,7 +1447,7 @@ class UnoProgressBarControl : public UnoControlBase,
public ::com::sun::star::awt::XProgressBar
{
public:
- UnoProgressBarControl();
+ UnoProgressBarControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); }
@@ -1468,7 +1481,7 @@ protected:
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoControlFixedLineModel();
+ UnoControlFixedLineModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlFixedLineModel( const UnoControlFixedLineModel& rModel ) : UnoControlModel( rModel ) {;}
UnoControlModel* Clone() const { return new UnoControlFixedLineModel( *this ); }
@@ -1490,7 +1503,7 @@ public:
class UnoFixedLineControl : public UnoControlBase
{
public:
- UnoFixedLineControl();
+ UnoFixedLineControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException);
diff --git a/toolkit/inc/toolkit/helper/formpdfexport.hxx b/toolkit/inc/toolkit/helper/formpdfexport.hxx
index 502f25520145..cafcb5d00d38 100644
--- a/toolkit/inc/toolkit/helper/formpdfexport.hxx
+++ b/toolkit/inc/toolkit/helper/formpdfexport.hxx
@@ -28,22 +28,21 @@
#ifndef _TOOLKIT_HELPER_FORM_FORMPDFEXPORT_HXX
#define _TOOLKIT_HELPER_FORM_FORMPDFEXPORT_HXX
-#ifndef TOOLKIT_DLLAPI_H
#include <toolkit/dllapi.h>
-#endif
/** === begin UNO includes === **/
-#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_
#include <com/sun/star/awt/XControl.hpp>
-#endif
/** === end UNO includes === **/
-#ifndef _VCL_PDFWRITER_HXX
#include <vcl/pdfwriter.hxx>
-#endif
#include <memory>
+namespace vcl
+{
+ class PDFExtOutDevData;
+}
+
//........................................................................
namespace toolkitform
{
@@ -53,7 +52,8 @@ namespace toolkitform
*/
void TOOLKIT_DLLPUBLIC describePDFControl(
const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl,
- ::std::auto_ptr< ::vcl::PDFWriter::AnyWidget >& _rpDescriptor
+ ::std::auto_ptr< ::vcl::PDFWriter::AnyWidget >& _rpDescriptor,
+ ::vcl::PDFExtOutDevData& i_pdfExportData
) SAL_THROW(());
//........................................................................
diff --git a/toolkit/inc/toolkit/helper/mutexandbroadcasthelper.hxx b/toolkit/inc/toolkit/helper/mutexandbroadcasthelper.hxx
index 45e0bdf93dc4..4ae1dd17c62f 100644
--- a/toolkit/inc/toolkit/helper/mutexandbroadcasthelper.hxx
+++ b/toolkit/inc/toolkit/helper/mutexandbroadcasthelper.hxx
@@ -39,7 +39,6 @@ class MutexAndBroadcastHelper
public:
MutexAndBroadcastHelper() : BrdcstHelper( Mutex ) {}
-
::osl::Mutex Mutex;
::cppu::OBroadcastHelper BrdcstHelper;
@@ -47,11 +46,6 @@ public:
::cppu::OBroadcastHelper& GetBroadcastHelper() { return BrdcstHelper; }
};
-
-
-
-
-
#endif // _TOOLKIT_HELPER_MUTEXANDBROADCASTHELPER_HXX
diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx
index 082ac75bafae..c2d6380dcb65 100644
--- a/toolkit/inc/toolkit/helper/property.hxx
+++ b/toolkit/inc/toolkit/helper/property.hxx
@@ -177,7 +177,7 @@ namespace rtl {
#define BASEPROPERTY_TREE_ROOTDISPLAYED 127
#define BASEPROPERTY_TREE_SHOWSHANDLES 128
#define BASEPROPERTY_TREE_SHOWSROOTHANDLES 129
-#define BASEPROPERTY_TREE_ROWHEIGHT 130
+#define BASEPROPERTY_ROW_HEIGHT 130
#define BASEPROPERTY_TREE_INVOKESSTOPNODEEDITING 131
#define BASEPROPERTY_TREE_END 131
#define BASEPROPERTY_DIALOGSOURCEURL 132
@@ -196,13 +196,16 @@ namespace rtl {
#define BASEPROPERTY_ENABLEVISIBLE 145 // sal_Bool
#define BASEPROPERTY_REFERENCE_DEVICE 146
#define BASEPROPERTY_HIGHCONTRASTMODE 147
-#define BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND 148
-#define BASEPROPERTY_GRID_HEADER_BACKGROUND 149
-#define BASEPROPERTY_GRID_LINE_COLOR 150
-#define BASEPROPERTY_GRID_ROW_BACKGROUND 151
+#define BASEPROPERTY_GRID_HEADER_BACKGROUND 148
+#define BASEPROPERTY_GRID_HEADER_TEXT_COLOR 149
+#define BASEPROPERTY_GRID_ROW_BACKGROUND_COLORS 150
+#define BASEPROPERTY_GRID_LINE_COLOR 151
#define BASEPROPERTY_MULTISELECTION_SIMPLEMODE 152
#define BASEPROPERTY_ITEM_SEPARATOR_POS 153
#define BASEPROPERTY_AUTO_REPEAT 154
+#define BASEPROPERTY_ROW_HEADER_WIDTH 155
+#define BASEPROPERTY_COLUMN_HEADER_HEIGHT 156
+#define BASEPROPERTY_USE_GRID_LINES 157
// Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen.
diff --git a/toolkit/inc/toolkit/helper/servicenames.hxx b/toolkit/inc/toolkit/helper/servicenames.hxx
index 1e5d394fb660..27949e9de791 100644
--- a/toolkit/inc/toolkit/helper/servicenames.hxx
+++ b/toolkit/inc/toolkit/helper/servicenames.hxx
@@ -97,6 +97,7 @@ extern const sal_Char __FAR_DATA szServiceName_GridControlModel[];
extern const sal_Char __FAR_DATA szServiceName_DefaultGridDataModel[];
extern const sal_Char __FAR_DATA szServiceName_DefaultGridColumnModel[];
extern const sal_Char __FAR_DATA szServiceName_GridColumn[];
+extern const sal_Char __FAR_DATA szServiceName_SortableGridDataModel[];
extern const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControl[], szServiceName2_UnoSimpleAnimationControl[];
extern const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControlModel[], szServiceName2_UnoSimpleAnimationControlModel[];
diff --git a/toolkit/prj/build.lst b/toolkit/prj/build.lst
index 7b6fd72c3ab0..e11d32c435bf 100644
--- a/toolkit/prj/build.lst
+++ b/toolkit/prj/build.lst
@@ -1,2 +1,3 @@
-ti toolkit : LIBXSLT:libxslt vcl NULL
-ti toolkit\prj nmake - all ti_prj NULL
+ti toolkit : LIBXSLT:libxslt vcl qadevOOo test NULL
+ti toolkit\prj nmake - all ti_prj NULL
+ti toolkit\qa\complex\toolkit nmake - all ti_complex_toolkit NULL
diff --git a/toolkit/qa/complex/toolkit/CheckAccessibleStatusBar.java b/toolkit/qa/complex/toolkit/AccessibleStatusBar.java
index cfb40614beab..d4f2329d8f31 100755
--- a/toolkit/qa/complex/toolkit/CheckAccessibleStatusBar.java
+++ b/toolkit/qa/complex/toolkit/AccessibleStatusBar.java
@@ -27,12 +27,15 @@
package complex.toolkit;
-// import complexlib.ComplexTestCase;
-import lib.TestParameters;
+import complex.toolkit.accessibility._XAccessibleEventBroadcaster;
+import complex.toolkit.accessibility._XAccessibleExtendedComponent;
+import complex.toolkit.accessibility._XAccessibleComponent;
+import complex.toolkit.accessibility._XAccessibleContext;
+import java.util.logging.Logger;
+import java.util.logging.Level;
import util.SOfficeFactory;
import util.AccessibilityTools;
import com.sun.star.awt.XWindow;
-// import com.sun.star.chart.XChartDocument;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XServiceInfo;
@@ -45,11 +48,8 @@ import com.sun.star.accessibility.AccessibleRole;
import com.sun.star.accessibility.XAccessible;
import com.sun.star.accessibility.XAccessibleContext;
import com.sun.star.awt.XExtendedToolkit;
-// import java.io.PrintWriter;
-// import org.junit.After;
import org.junit.AfterClass;
-// import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openoffice.test.OfficeConnection;
@@ -58,26 +58,12 @@ import static org.junit.Assert.*;
/**
*
*/
-public class CheckAccessibleStatusBar {
+public class AccessibleStatusBar {
XInterface testObject = null;
XMultiServiceFactory xMSF = null;
XWindow xWindow = null;
- /**
- * The test parameters
- */
- private static TestParameters param = null;
-
-// public String[] getTestMethodNames() {
-// return new String[]{"checkDocs"};//WriterDoc", "checkDrawDoc",
-//// "checkMathDoc", "checkImpressDoc", "checkCalcDoc"};
-// }
-
-/* public String getTestObjectName() {
- return "com.sun.star.awt.AccessibleStatusBar";
- }
-*/
private XMultiServiceFactory getMSF()
{
final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
@@ -100,41 +86,13 @@ public class CheckAccessibleStatusBar {
/**
* Check document types
*/
- @Test public void checkDocs() {
- Object doc = param.get("DocType");
- String testDocType;
- if (doc == null)
- {
- testDocType = "all";
- }
- else
- {
- testDocType = (String)doc;
- }
-
- System.out.println("Param was " + doc);
- System.out.println("DocType " + testDocType);
- if (testDocType.equalsIgnoreCase("writer") || testDocType.equalsIgnoreCase("all"))
- {
- checkWriterDoc();
- }
- if (testDocType.equalsIgnoreCase("math") || testDocType.equalsIgnoreCase("all"))
- {
- checkMathDoc();
- }
- if (testDocType.equalsIgnoreCase("draw") || testDocType.equalsIgnoreCase("all"))
- {
- checkDrawDoc();
- }
- if (testDocType.equalsIgnoreCase("impress") || testDocType.equalsIgnoreCase("all"))
- {
- checkImpressDoc();
- }
- if (testDocType.equalsIgnoreCase("calc") || testDocType.equalsIgnoreCase("all"))
- {
- checkCalcDoc();
- }
-
+ @Test
+ public void checkDocs() {
+ checkWriterDoc();
+ checkMathDoc();
+ checkDrawDoc();
+ checkImpressDoc();
+ checkCalcDoc();
}
/**
@@ -150,7 +108,7 @@ public class CheckAccessibleStatusBar {
getTestObject();
}
catch(com.sun.star.uno.Exception e) {
- e.printStackTrace();
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
}
runAllInterfaceTests();
@@ -160,7 +118,7 @@ public class CheckAccessibleStatusBar {
xClose.close(false);
}
catch(com.sun.star.util.CloseVetoException e) {
- e.printStackTrace();
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
}
}
}
@@ -178,7 +136,7 @@ public class CheckAccessibleStatusBar {
getTestObject();
}
catch(com.sun.star.uno.Exception e) {
- e.printStackTrace();
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
}
runAllInterfaceTests();
@@ -188,7 +146,7 @@ public class CheckAccessibleStatusBar {
xClose.close(false);
}
catch(com.sun.star.util.CloseVetoException e) {
- e.printStackTrace();
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
}
}
}
@@ -206,7 +164,7 @@ public class CheckAccessibleStatusBar {
getTestObject();
}
catch(com.sun.star.uno.Exception e) {
- e.printStackTrace();
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
}
runAllInterfaceTests();
@@ -216,7 +174,7 @@ public class CheckAccessibleStatusBar {
xClose.close(false);
}
catch(com.sun.star.util.CloseVetoException e) {
- e.printStackTrace();
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
}
}
}
@@ -234,7 +192,7 @@ public class CheckAccessibleStatusBar {
getTestObject();
}
catch(com.sun.star.uno.Exception e) {
- e.printStackTrace();
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
}
runAllInterfaceTests();
@@ -244,7 +202,7 @@ public class CheckAccessibleStatusBar {
xClose.close(false);
}
catch(com.sun.star.util.CloseVetoException e) {
- e.printStackTrace();
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
}
}
}
@@ -262,7 +220,7 @@ public class CheckAccessibleStatusBar {
getTestObject();
}
catch(com.sun.star.uno.Exception e) {
- e.printStackTrace();
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
}
runAllInterfaceTests();
@@ -272,7 +230,7 @@ public class CheckAccessibleStatusBar {
xClose.close(false);
}
catch(com.sun.star.util.CloseVetoException e) {
- e.printStackTrace();
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
}
}
}
@@ -287,12 +245,11 @@ public class CheckAccessibleStatusBar {
xWindow = UnoRuntime.queryInterface(XWindow.class, tk.getActiveTopWindow());
shortWait();
- AccessibilityTools at = new AccessibilityTools();
- XAccessible xRoot = at.getAccessibleObject(xWindow);
+ XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);
XAccessibleContext parentContext = null;
System.out.println("Get the accessible status bar.");
- parentContext = at.getAccessibleObjectForRole(
+ parentContext = AccessibilityTools.getAccessibleObjectForRole(
xRoot, AccessibleRole.STATUS_BAR, "");
shortWait();
System.out.println("...OK.");
@@ -309,11 +266,11 @@ public class CheckAccessibleStatusBar {
testObject=parentContext;
}
catch(com.sun.star.uno.Exception e) {
- e.printStackTrace();
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
}
catch(Throwable t) {
System.out.println("Got throwable:");
- t.printStackTrace();
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", t );
}
}
@@ -354,7 +311,7 @@ public class CheckAccessibleStatusBar {
System.out.println("*** Now testing XAccessibleEventBroadcaster ***");
_XAccessibleEventBroadcaster _xAccEvBcast =
- new _XAccessibleEventBroadcaster(testObject, "Pfff", xWindow);
+ new _XAccessibleEventBroadcaster(testObject, xWindow);
assertTrue("failed: XAccessibleEventBroadcaster::addEventListener", _xAccEvBcast._addEventListener());
assertTrue("failed: XAccessibleEventBroadcaster::removeEventListener", _xAccEvBcast._removeEventListener());
}
@@ -362,12 +319,14 @@ public class CheckAccessibleStatusBar {
- @BeforeClass public static void setUpConnection() throws Exception {
+ @BeforeClass
+ public static void setUpConnection() throws Exception {
System.out.println("setUpConnection()");
connection.setUp();
}
- @AfterClass public static void tearDownConnection()
+ @AfterClass
+ public static void tearDownConnection()
throws InterruptedException, com.sun.star.uno.Exception
{
System.out.println("tearDownConnection()");
diff --git a/toolkit/qa/complex/toolkit/CheckAccessibleStatusBarItem.java b/toolkit/qa/complex/toolkit/AccessibleStatusBarItem.java
index 537654c6aacc..edd84651d45e 100755
--- a/toolkit/qa/complex/toolkit/CheckAccessibleStatusBarItem.java
+++ b/toolkit/qa/complex/toolkit/AccessibleStatusBarItem.java
@@ -27,14 +27,16 @@
package complex.toolkit;
-// import complexlib.ComplexTestCase;
-import lib.TestParameters;
-// import util.SOfficeFactory;
-// import complexlib.ComplexTestCase;
+import java.util.logging.Logger;
+import java.util.logging.Level;
+import complex.toolkit.accessibility._XAccessibleEventBroadcaster;
+import complex.toolkit.accessibility._XAccessibleExtendedComponent;
+import complex.toolkit.accessibility._XAccessibleText;
+import complex.toolkit.accessibility._XAccessibleComponent;
+import complex.toolkit.accessibility._XAccessibleContext;
import util.SOfficeFactory;
import util.AccessibilityTools;
import com.sun.star.awt.XWindow;
-// import com.sun.star.chart.XChartDocument;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XServiceInfo;
@@ -47,12 +49,9 @@ import com.sun.star.accessibility.AccessibleRole;
import com.sun.star.accessibility.XAccessible;
import com.sun.star.accessibility.XAccessibleContext;
import com.sun.star.awt.XExtendedToolkit;
-// import java.io.PrintWriter;
-// import org.junit.After;
import org.junit.AfterClass;
-// import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openoffice.test.OfficeConnection;
@@ -61,35 +60,17 @@ import static org.junit.Assert.*;
/**
*
*/
-public class CheckAccessibleStatusBarItem {
+public class AccessibleStatusBarItem {
XMultiServiceFactory xMSF = null;
XAccessibleContext testObject = null;
XWindow xWindow = null;
- /**
- * The test parameters
- */
- private static TestParameters param = null;
-
-// public String[] getTestMethodNames() {
-// return new String[]{"checkDocs"};//{"checkWriterDoc", "checkDrawDoc",
-//// "checkMathDoc", "checkImpressDoc", "checkCalcDoc"};
-// }
-
- /**
- * Sleeps for 0.5 sec. to allow StarOffice to react on <code>
- * reset</code> call.
- */
- private void shortWait() {
- shortWait(500) ;
- }
-
/**
* Sleeps for a certain time.
* @param Thread is sleeping for this time in milliseconds.
*/
- private void shortWait(int time) {
+ private void shortWait() {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
@@ -100,43 +81,14 @@ public class CheckAccessibleStatusBarItem {
/**
* Check document types
*/
- @Test public void checkDocs()
+ @Test
+ public void checkDocs()
{
- param = new TestParameters();
- Object doc = param.get("DocType");
- String testDocType;
- if (doc == null)
- {
- testDocType = "all";
- }
- else
- {
- testDocType = (String)doc;
- }
-
- System.out.println("Param was " + doc);
- System.out.println("DocType " + testDocType);
- if (testDocType.equalsIgnoreCase("writer") || testDocType.equalsIgnoreCase("all"))
- {
- checkWriterDoc();
- }
- if (testDocType.equalsIgnoreCase("math") || testDocType.equalsIgnoreCase("all"))
- {
- checkMathDoc();
- }
- if (testDocType.equalsIgnoreCase("draw") || testDocType.equalsIgnoreCase("all"))
- {
- checkDrawDoc();
- }
- if (testDocType.equalsIgnoreCase("impress") || testDocType.equalsIgnoreCase("all"))
- {
- checkImpressDoc();
- }
- if (testDocType.equalsIgnoreCase("calc") || testDocType.equalsIgnoreCase("all"))
- {
- checkCalcDoc();
- }
-
+ checkWriterDoc();
+ checkMathDoc();
+ checkDrawDoc();
+ checkImpressDoc();
+ checkCalcDoc();
}
private XMultiServiceFactory getMSF()
@@ -158,7 +110,7 @@ public class CheckAccessibleStatusBarItem {
getTestObject();
}
catch(com.sun.star.uno.Exception e) {
- e.printStackTrace();
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
}
runAllInterfaceTests();
@@ -168,7 +120,7 @@ public class CheckAccessibleStatusBarItem {
xClose.close(false);
}
catch(com.sun.star.util.CloseVetoException e) {
- e.printStackTrace();
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
}
}
}
@@ -186,7 +138,7 @@ public class CheckAccessibleStatusBarItem {
getTestObject();
}
catch(com.sun.star.uno.Exception e) {
- e.printStackTrace();
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
}
runAllInterfaceTests();
@@ -196,7 +148,7 @@ public class CheckAccessibleStatusBarItem {
xClose.close(false);
}
catch(com.sun.star.util.CloseVetoException e) {
- e.printStackTrace();
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
}
}
}
@@ -214,7 +166,7 @@ public class CheckAccessibleStatusBarItem {
getTestObject();
}
catch(com.sun.star.uno.Exception e) {
- e.printStackTrace();
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
}
runAllInterfaceTests();
@@ -224,7 +176,7 @@ public class CheckAccessibleStatusBarItem {
xClose.close(false);
}
catch(com.sun.star.util.CloseVetoException e) {
- e.printStackTrace();
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
}
}
}
@@ -242,7 +194,7 @@ public class CheckAccessibleStatusBarItem {
getTestObject();
}
catch(com.sun.star.uno.Exception e) {
- e.printStackTrace();
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
}
runAllInterfaceTests();
@@ -252,7 +204,7 @@ public class CheckAccessibleStatusBarItem {
xClose.close(false);
}
catch(com.sun.star.util.CloseVetoException e) {
- e.printStackTrace();
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
}
}
}
@@ -270,7 +222,7 @@ public class CheckAccessibleStatusBarItem {
getTestObject();
}
catch(com.sun.star.uno.Exception e) {
- e.printStackTrace();
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
}
runAllInterfaceTests();
@@ -280,7 +232,7 @@ public class CheckAccessibleStatusBarItem {
xClose.close(false);
}
catch(com.sun.star.util.CloseVetoException e) {
- e.printStackTrace();
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
}
}
}
@@ -297,35 +249,25 @@ public class CheckAccessibleStatusBarItem {
XWindow.class,tk.getActiveTopWindow());
shortWait();
- AccessibilityTools at = new AccessibilityTools();
- XAccessible xRoot = at.getAccessibleObject(xWindow);
+ XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);
XAccessibleContext parentContext = null;
System.out.println("Get the accessible status bar.");
- parentContext = at.getAccessibleObjectForRole(
+ parentContext = AccessibilityTools.getAccessibleObjectForRole(
xRoot, AccessibleRole.STATUS_BAR, "");
shortWait();
if ( parentContext == null ) {
- System.out.println("Could not get the test object: set the correct focus in the next 30 seconds.");
- shortWait(30000);
- parentContext = at.getAccessibleObjectForRole(
- xRoot, AccessibleRole.STATUS_BAR, "");
-
- if ( parentContext == null )
- {
- fail("Could not create a test object.");
- }
+ fail("Could not create a test object.");
}
System.out.println("...OK.");
testObject=parentContext;
}
catch(com.sun.star.uno.Exception e) {
- e.printStackTrace();
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
}
catch(Throwable t) {
- System.out.println("Got throwable:");
- t.printStackTrace();
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", t );
}
}
@@ -391,7 +333,7 @@ public class CheckAccessibleStatusBarItem {
System.out.println("*** Now testing XAccessibleEventBroadcaster ***");
_XAccessibleEventBroadcaster _xAccEvBcast =
- new _XAccessibleEventBroadcaster(object, "Pfff", xWindow);
+ new _XAccessibleEventBroadcaster(object, xWindow);
assertTrue("failed: "+accName+" - XAccessibleEventBroadcaster::addEventListener", _xAccEvBcast._addEventListener());
assertTrue("failed: "+accName+" - XAccessibleEventBroadcaster::removeEventListener", _xAccEvBcast._removeEventListener());
diff --git a/toolkit/qa/complex/toolkit/Assert.java b/toolkit/qa/complex/toolkit/Assert.java
new file mode 100755
index 000000000000..93b1a2c490e1
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/Assert.java
@@ -0,0 +1,234 @@
+/*************************************************************************
+ * 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.
+ *
+ *************************************************************************/
+
+package complex.toolkit;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import com.sun.star.uno.UnoRuntime;
+import static org.junit.Assert.*;
+
+/**
+ * provides assertion capabilities not found in {@link org.junit.Assert}
+ * @author frank.schoenheit@oracle.com
+ */
+public class Assert
+{
+ // --------------------------------------------------------------------------------------------------------
+ /** invokes a given method on a given object, and assures a certain exception is caught
+ * @param i_message
+ * is the message to print when the check fails
+ * @param i_object
+ * is the object to invoke the method on
+ * @param i_methodName
+ * is the name of the method to invoke
+ * @param i_methodArgs
+ * are the arguments to pass to the method.
+ * @param i_argClasses
+ * are the classes to assume for the arguments of the methods
+ * @param i_expectedExceptionClass
+ * is the class of the exception to be caught. If this is null,
+ * it means that <em>no</em> exception must be throw by invoking the method.
+ */
+ public static void assertException( final String i_message, final Object i_object, final String i_methodName,
+ final Class[] i_argClasses, final Object[] i_methodArgs, final Class i_expectedExceptionClass )
+ {
+ Class objectClass = i_object.getClass();
+
+ boolean noExceptionAllowed = ( i_expectedExceptionClass == null );
+
+ boolean caughtExpected = noExceptionAllowed ? true : false;
+ try
+ {
+ Method method = impl_getMethod( objectClass, i_methodName, i_argClasses );
+ method.invoke(i_object, i_methodArgs );
+ }
+ catch ( NoSuchMethodException e )
+ {
+ StringBuilder message = new StringBuilder();
+ message.append( "no such method: " ).append( objectClass.getName() ).append( "." ).append( i_methodName ).append( "( " );
+ for ( int i=0; i<i_argClasses.length; ++i )
+ {
+ message.append( i_argClasses[i].getName() );
+ if ( i<i_argClasses.length - 1 )
+ message.append( ", " );
+ }
+ message.append( " )" );
+ fail( message.toString() );
+ }
+ catch ( InvocationTargetException e )
+ {
+ caughtExpected = noExceptionAllowed
+ ? false
+ : ( e.getTargetException().getClass().equals( i_expectedExceptionClass ) );
+ }
+ catch( Exception e )
+ {
+ caughtExpected = false;
+ }
+
+ assertTrue( i_message, caughtExpected );
+ }
+
+ /**
+ * retrieves a method, given by name and parameter signature, from the given class
+ *
+ * The method does somewhat more than simply calling {@link Class.getMethod}. In particular, it recognizes
+ * primitiive parameter types, and attempts to find a method taking the given primitive type, instead of the
+ * type represented by the parameter class.
+ *
+ * For instance, if you have a method <code>foo( int )</code>, {@link Class.getMethod} would not return this
+ * method when you pass <code>Integer.class</code>. <code>impl_getMethod</code> will recognize this, and
+ * properly retrieve the method.
+ *
+ * Note: <code>impl_getMethod</code> is limited in that it will not try all possible combinations of primitive
+ * and non-primitive types. That is, a method like <code>foo( int, Integer, int )</code> is likely to not be
+ * found.
+ *
+ * @param i_obbjectClass
+ * @param i_methodName
+ * @param i_argClasses
+ * @return
+ */
+ private static Method impl_getMethod( final Class i_objectClass, final String i_methodName, final Class[] i_argClasses ) throws NoSuchMethodException
+ {
+ try
+ {
+ return i_objectClass.getMethod( i_methodName, i_argClasses );
+ }
+ catch ( NoSuchMethodException ex )
+ {
+ }
+
+ int substitutedTypes = 0;
+ int substitutedTypesLastRound = 0;
+ final Class[][] substitutionTable = new Class[][] {
+ new Class[] { Long.class, long.class },
+ new Class[] { Integer.class, int.class },
+ new Class[] { Short.class, short.class },
+ new Class[] { Byte.class, byte.class },
+ new Class[] { Double.class, double.class },
+ new Class[] { Float.class, float.class },
+ new Class[] { Character.class, char.class }
+ };
+ do
+ {
+ substitutedTypes = 0;
+ final Class[] argClasses = new Class[ i_argClasses.length ];
+ for ( int i=0; i < argClasses.length; ++i )
+ {
+ argClasses[i] = i_argClasses[i];
+ if ( substitutedTypes > substitutedTypesLastRound )
+ continue;
+
+ for ( int c=0; c<substitutionTable.length; ++c )
+ {
+ if ( i_argClasses[i].equals( substitutionTable[c][0] ) )
+ {
+ argClasses[i] = substitutionTable[c][1];
+ ++substitutedTypes;
+ break;
+ }
+ }
+ }
+ if ( substitutedTypes == substitutedTypesLastRound )
+ throw new NoSuchMethodException();
+ substitutedTypesLastRound = substitutedTypes;
+
+ try
+ {
+ return i_objectClass.getMethod( i_methodName, argClasses );
+ }
+ catch ( NoSuchMethodException e )
+ {
+ }
+ }
+ while ( substitutedTypes > 0 );
+ throw new NoSuchMethodException();
+ }
+
+ /** invokes a given method on a given object, and assures a certain exception is caught
+ * @param i_message is the message to print when the check fails
+ * @param i_object is the object to invoke the method on
+ * @param i_methodName is the name of the method to invoke
+ * @param i_methodArgs are the arguments to pass to the method. Those implicitly define
+ * the classes of the arguments of the method which is called.
+ * @param i_expectedExceptionClass is the class of the exception to be caught. If this is null,
+ * it means that <em>no</em> exception must be throw by invoking the method.
+ */
+ public static void assertException( final String i_message, final Object i_object, final String i_methodName,
+ final Object[] i_methodArgs, final Class i_expectedExceptionClass )
+ {
+ Class[] argClasses = new Class[ i_methodArgs.length ];
+ for ( int i=0; i<i_methodArgs.length; ++i )
+ argClasses[i] = i_methodArgs[i].getClass();
+ assertException( i_message, i_object, i_methodName, argClasses, i_methodArgs, i_expectedExceptionClass );
+ }
+
+ /** invokes a given method on a given object, and assures a certain exception is caught
+ * @param i_object is the object to invoke the method on
+ * @param i_methodName is the name of the method to invoke
+ * @param i_methodArgs are the arguments to pass to the method. Those implicitly define
+ * the classes of the arguments of the method which is called.
+ * @param i_expectedExceptionClass is the class of the exception to be caught. If this is null,
+ * it means that <em>no</em> exception must be throw by invoking the method.
+ */
+ public static void assertException( final Object i_object, final String i_methodName, final Object[] i_methodArgs,
+ final Class i_expectedExceptionClass )
+ {
+ assertException(
+ "did not catch the expected exception (" +
+ ( ( i_expectedExceptionClass == null ) ? "none" : i_expectedExceptionClass.getName() ) +
+ ") while calling " + i_object.getClass().getName() + "." + i_methodName,
+ i_object, i_methodName, i_methodArgs, i_expectedExceptionClass );
+ }
+
+ /** invokes a given method on a given object, and assures a certain exception is caught
+ * @param i_object is the object to invoke the method on
+ * @param i_methodName is the name of the method to invoke
+ * @param i_methodArgs are the arguments to pass to the method
+ * @param i_argClasses are the classes to assume for the arguments of the methods
+ * @param i_expectedExceptionClass is the class of the exception to be caught. If this is null,
+ * it means that <em>no</em> exception must be throw by invoking the method.
+ */
+ public static void assertException( final Object i_object, final String i_methodName, final Class[] i_argClasses,
+ final Object[] i_methodArgs, final Class i_expectedExceptionClass )
+ {
+ assertException(
+ "did not catch the expected exception (" +
+ ( ( i_expectedExceptionClass == null ) ? "none" : i_expectedExceptionClass.getName() ) +
+ ") while calling " + i_object.getClass().getName() + "." + i_methodName,
+ i_object, i_methodName, i_argClasses, i_methodArgs, i_expectedExceptionClass );
+ }
+
+ // --------------------------------------------------------------------------------------------------------
+ public static void assertException( Object i_object, Class _unoInterfaceClass, String i_methodName, Object[] i_methodArgs,
+ Class i_expectedExceptionClass )
+ {
+ assertException( UnoRuntime.queryInterface( _unoInterfaceClass, i_object ), i_methodName,
+ i_methodArgs, i_expectedExceptionClass );
+ }
+}
diff --git a/toolkit/qa/complex/toolkit/CallbackClass.java b/toolkit/qa/complex/toolkit/CallbackClass.java
deleted file mode 100644
index 1c9eb68a6d34..000000000000
--- a/toolkit/qa/complex/toolkit/CallbackClass.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-package complex.toolkit;
-
-import com.sun.star.awt.XCallback;
-// import lib.MultiMethodTest;
-import com.sun.star.lang.XMultiServiceFactory;
-// import com.sun.star.uno.XInterface;
-// import com.sun.star.uno.UnoRuntime;
-// import share.LogWriter;
-
-/**
- * Testing <code>com.sun.star.awt.XRequestCallback</code>
- * interface methods :
- * <ul>
- * <li><code> addCallback()</code></li>
- * </ul> <p>
- * @see com.sun.star.awt.XRequestCallback
- */
-public class CallbackClass implements XCallback{
-
- // private LogWriter log;
-
- private XMultiServiceFactory xMSF;
-
-
- public CallbackClass(XMultiServiceFactory xMSF ) {
-
- this.xMSF = xMSF;
- // this.log = log;
- }
-
-
- /**
- * Callback method which will be called by the asynchronous
- * service where we have added our request before.
- */
- public void notify( Object aData ) {
-
- System.out.println("callback called successfully" );
- }
-}
diff --git a/toolkit/qa/complex/toolkit/CheckAsyncCallback.java b/toolkit/qa/complex/toolkit/CheckAsyncCallback.java
deleted file mode 100644
index 3a1e51729f11..000000000000
--- a/toolkit/qa/complex/toolkit/CheckAsyncCallback.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-package complex.toolkit;
-
-// import complexlib.ComplexTestCase;
-import util.SOfficeFactory;
-// import complex.toolkit.CallbackClass;
-import com.sun.star.awt.XRequestCallback;
-import com.sun.star.lang.XMultiServiceFactory;
-// import com.sun.star.lang.XComponent;
-// import com.sun.star.lang.XServiceInfo;
-import com.sun.star.uno.XInterface;
-import com.sun.star.uno.UnoRuntime;
-// import com.sun.star.awt.XExtendedToolkit;
-// import java.io.PrintWriter;
-
-// import org.junit.After;
-import org.junit.AfterClass;
-// import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.openoffice.test.OfficeConnection;
-import static org.junit.Assert.*;
-
-/**
- *
- */
-public class CheckAsyncCallback /* extends ComplexTestCase*/ {
-
-
- XInterface testObject = null;
- XMultiServiceFactory xMSF = null;
-
-// public String[] getTestMethodNames() {
-// return new String[]{"checkService"};
-// }
-
-/* public String getTestObjectName() {
- return "com.sun.star.awt.AccessibleStatusBar";
- }
-*/
- private XMultiServiceFactory getMSF()
- {
- final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
- return xMSF1;
- }
-
- /**
- * Sleeps for 0.5 sec. to allow StarOffice to react on <code>
- * reset</code> call.
- */
- private void shortWait() {
- try {
- Thread.sleep(500) ;
- } catch (InterruptedException e) {
- System.out.println("While waiting :" + e) ;
- }
- }
-
- /**
- * Check services
- */
- @Test public void checkService() {
- checkAsyncCallbackService();
-
- }
-
- /**
- * Test the interfaces
- */
- public void checkAsyncCallbackService() {
- runAllInterfaceTests();
- }
-
- public void getTestObject() {
- try {
- xMSF = getMSF();
- SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
-
- XRequestCallback xAsyncCallback = null;
-
- XInterface xIfc = (XInterface)xMSF.createInstance(
- "com.sun.star.awt.AsyncCallback" );
- xAsyncCallback = UnoRuntime.queryInterface(XRequestCallback.class, xIfc);
-
- testObject=xAsyncCallback;
- }
- catch(com.sun.star.uno.Exception e) {
- e.printStackTrace();
- }
- catch(Throwable t) {
- System.out.println("Got throwable:");
- t.printStackTrace();
- }
- }
-
- public void runAllInterfaceTests() {
- getTestObject();
- System.out.println("*** Now testing XRequestCallback ***");
- _XRequestCallback _xRequestCallback =
- new _XRequestCallback(testObject, xMSF );
- assertTrue("failed: XRequestCallback::addCallback", _xRequestCallback._addCallback());
- }
-
- public void checkCallback() {
- getTestObject();
- System.out.println("*** Now testing asynchronous callback service ***");
- XRequestCallback xAsyncCallback = null;
- xAsyncCallback = UnoRuntime.queryInterface(XRequestCallback.class, testObject);
- CallbackClass aCallbackClass = new CallbackClass( xMSF );
- xAsyncCallback.addCallback( aCallbackClass, null );
- }
-
-
-
- @BeforeClass public static void setUpConnection() throws Exception {
- System.out.println("setUpConnection()");
- connection.setUp();
- }
-
- @AfterClass public static void tearDownConnection()
- throws InterruptedException, com.sun.star.uno.Exception
- {
- System.out.println("tearDownConnection()");
- connection.tearDown();
- }
-
- private static final OfficeConnection connection = new OfficeConnection();
-
-
-}
diff --git a/toolkit/qa/complex/toolkit/GridControl.java b/toolkit/qa/complex/toolkit/GridControl.java
new file mode 100755
index 000000000000..a06a52342417
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/GridControl.java
@@ -0,0 +1,687 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2011 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.
+ *
+ *************************************************************************/
+
+package complex.toolkit;
+
+import com.sun.star.awt.XControl;
+import com.sun.star.awt.XControlContainer;
+import com.sun.star.awt.XControlModel;
+import com.sun.star.awt.XToolkit;
+import com.sun.star.awt.grid.DefaultGridDataModel;
+import com.sun.star.awt.grid.XGridColumn;
+import com.sun.star.awt.grid.XGridColumnModel;
+import com.sun.star.awt.grid.XGridDataModel;
+import com.sun.star.awt.grid.XMutableGridDataModel;
+import com.sun.star.awt.grid.XSortableMutableGridDataModel;
+import com.sun.star.beans.Pair;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.ContainerEvent;
+import com.sun.star.container.XContainerListener;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.IndexOutOfBoundsException;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XEventListener;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.XCloneable;
+import complex.toolkit.awtgrid.DummyColumn;
+import complex.toolkit.awtgrid.TMutableGridDataModel;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+import org.openoffice.test.OfficeConnection;
+
+/** is a unit test for the grid control related implementations
+ * @author frank.schoenheit@sun.com
+ */
+public class GridControl
+{
+ // -----------------------------------------------------------------------------------------------------------------
+ public GridControl()
+ {
+ m_context = m_connection.getComponentContext();
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ private static void impl_dispose( final Object... i_components )
+ {
+ for ( int i=0; i<i_components.length; ++i )
+ {
+ if ( i_components[i] != null )
+ {
+ final XComponent component = UnoRuntime.queryInterface( XComponent.class, i_components[i] );
+ component.dispose();
+ }
+ }
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ private void impl_recreateGridModel() throws Exception
+ {
+ impl_dispose( m_gridControlModel, m_columnModel, m_dataModel );
+
+ // create a grid control model, and ensure it has a proper data and column model already
+ m_gridControlModel = UnoRuntime.queryInterface( XPropertySet.class,
+ createInstance( "com.sun.star.awt.grid.UnoControlGridModel" ) );
+ assertNotNull( "grid control model does not provide XPropertySet interface", m_gridControlModel );
+
+ // ensure that the model has default column/data models
+ m_columnModel = UnoRuntime.queryInterface( XGridColumnModel.class, m_gridControlModel.getPropertyValue( "ColumnModel" ) );
+ assertNotNull( "the control model is expected to have an initial column model", m_columnModel );
+ final XGridDataModel dataModel = UnoRuntime.queryInterface( XGridDataModel.class, m_gridControlModel.getPropertyValue( "GridDataModel" ) );
+ assertNotNull( "the control model is expected to have an initial data model", dataModel );
+ m_dataModel = UnoRuntime.queryInterface( XSortableMutableGridDataModel.class,
+ dataModel );
+ assertNotNull( "the out-of-the-box data model should be mutable and sortable", m_dataModel );
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ @Test
+ public void testGridControlCloning() throws Exception
+ {
+ impl_recreateGridModel();
+
+ // give the test something to compare, actually
+ XGridColumnModel columnModel = UnoRuntime.queryInterface( XGridColumnModel.class,
+ m_gridControlModel.getPropertyValue( "ColumnModel" ) );
+ columnModel.setDefaultColumns( 10 );
+
+ // clone the grid model
+ final XCloneable cloneable = UnoRuntime.queryInterface( XCloneable.class, m_gridControlModel );
+ assertNotNull( "all UnoControlModel's are expected to be cloneable", cloneable );
+
+ final XInterface clone = cloneable.createClone();
+ final XPropertySet clonedProps = UnoRuntime.queryInterface( XPropertySet.class, clone );
+
+ // TODO: check all those generic properties for equality
+
+ // the data model and the column model should have been cloned, too
+ // in particular, the clone should not share the sub models with the orignal
+ final XMutableGridDataModel originalDataModel = UnoRuntime.queryInterface( XMutableGridDataModel.class,
+ m_gridControlModel.getPropertyValue( "GridDataModel" ) );
+ final XMutableGridDataModel clonedDataModel = UnoRuntime.queryInterface( XMutableGridDataModel.class,
+ clonedProps.getPropertyValue( "GridDataModel" ) );
+ assertFalse( "data model should not be shared after cloning", UnoRuntime.areSame( originalDataModel, clonedDataModel ) );
+ impl_assertEquality( originalDataModel, clonedDataModel );
+
+ final XGridColumnModel originalColumnModel = columnModel;
+ final XGridColumnModel clonedColumnModel = UnoRuntime.queryInterface( XGridColumnModel.class,
+ clonedProps.getPropertyValue( "ColumnModel" ) );
+ assertFalse( "column model should not be shared after cloning", UnoRuntime.areSame( originalColumnModel, clonedColumnModel ) );
+ impl_assertEquality( originalColumnModel, clonedColumnModel );
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ @Test
+ public void testDisposal() throws Exception
+ {
+ impl_recreateGridModel();
+
+ final int columnCount = 3;
+ m_columnModel.setDefaultColumns( columnCount );
+
+ // add disposal listeners to all columns so far
+ final XGridColumn[] columns = m_columnModel.getColumns();
+ assertEquals( "creating default columns resulted in unexpected column count", columnCount, columns.length );
+ final DisposeListener[] columnListeners = new DisposeListener[columnCount];
+ for ( int i=0; i<columnCount; ++i )
+ columnListeners[i] = new DisposeListener( columns[i] );
+
+ // add another column, and check that upon removal, it is disposed
+ final int newColumnIndex = m_columnModel.addColumn( m_columnModel.createColumn() );
+ final DisposeListener columnListener = new DisposeListener( m_columnModel.getColumn( newColumnIndex ) );
+ m_columnModel.removeColumn( newColumnIndex );
+ assertTrue( "explicit column removal is expected to dispose the column", columnListener.isDisposed() );
+
+ // by definition, the grid control model is the owner of both the column and the data model. So, setting
+ // a new column/data model should implicitly dispose the old models
+ final DisposeListener oldDataModelListener = new DisposeListener( m_dataModel );
+ final DisposeListener oldColumnModelListener = new DisposeListener( m_columnModel );
+
+ final Object newDataModel = createInstance( "com.sun.star.awt.grid.DefaultGridDataModel" );
+ final Object newColumnModel = createInstance( "com.sun.star.awt.grid.DefaultGridColumnModel" );
+ final DisposeListener newDataModelListener = new DisposeListener( newDataModel );
+ final DisposeListener newColumnModelListener = new DisposeListener( newColumnModel );
+
+ m_gridControlModel.setPropertyValue( "GridDataModel", newDataModel );
+ assertTrue( "setting a new data model failed", impl_areSameInterface( newDataModel, m_gridControlModel.getPropertyValue( "GridDataModel" ) ) );
+ m_gridControlModel.setPropertyValue( "ColumnModel", newColumnModel );
+ assertTrue( "setting a new column model failed", impl_areSameInterface( newColumnModel, m_gridControlModel.getPropertyValue( "ColumnModel" ) ) );
+
+ assertTrue( "old data model has not been disposed", oldDataModelListener.isDisposed() );
+ assertTrue( "old column model has not been disposed", oldColumnModelListener.isDisposed() );
+ for ( int i=0; i<columnCount; ++i )
+ assertTrue( "column no. " + i + " has not been disposed", columnListeners[i].isDisposed() );
+
+ // the same holds if the grid control model itself is disposed - it should dispose the depending models, too
+ assertFalse( "new data model is already disposed - this is unexpected", newDataModelListener.isDisposed() );
+ assertFalse( "new column model is already disposed - this is unexpected", newColumnModelListener.isDisposed() );
+ impl_dispose( m_gridControlModel );
+ assertTrue( "new data model is not disposed after disposing the grid column model", newDataModelListener.isDisposed() );
+ assertTrue( "new column model is not disposed after disposing the grid column model", newColumnModelListener.isDisposed() );
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ /**
+ * tests various aspects of the <code>XMutableGridDataModel</code> interface
+ */
+ @Test
+ public void testMutableGridDataModel() throws Exception
+ {
+ impl_recreateGridModel();
+
+ TMutableGridDataModel test = new TMutableGridDataModel( m_dataModel );
+ test.testAddRow();
+ test.testAddRows();
+ test.testRemoveRow();
+ test.testRemoveAllRows();
+ test.testUpdateCellData();
+ test.testUpdateRowData();
+ test.testUpdateRowHeading();
+ test.cleanup();
+
+ // a somehwat less straight-forward test: the data model is expected to implicitly increase its column count
+ // when you add a row which has more columns than currently known
+ final XMutableGridDataModel dataModel = DefaultGridDataModel.create( m_context );
+ dataModel.addRow( 0, new Object[] { 1 } );
+ assertEquals( "unexpected column count after adding the most simple row", 1, dataModel.getColumnCount() );
+ dataModel.addRow( 1, new Object[] { 1, 2 } );
+ assertEquals( "implicit extension of the column count doesn't work", 2, dataModel.getColumnCount() );
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ @Test
+ public void testGridColumnModel() throws Exception
+ {
+ impl_recreateGridModel();
+
+ ColumnModelListener listener = new ColumnModelListener();
+ m_columnModel.addContainerListener( listener );
+
+ // insert default columns into the previously empty model, ensure we get the right notifications
+ final int defaultColumnsCount = 3;
+ m_columnModel.setDefaultColumns( defaultColumnsCount );
+ impl_assertColumnModelConsistency();
+ List< ContainerEvent > events = listener.assertExclusiveInsertionEvents();
+ listener.reset();
+ assertEquals( "wrong number of events fired by setDefaulColumns", defaultColumnsCount, events.size() );
+ for ( int i=0; i<defaultColumnsCount; ++i )
+ {
+ final ContainerEvent event = events.get(i);
+ final int index = impl_assertInteger( event.Accessor );
+ assertEquals( "unexpected Accessor value in insert notification", i, index );
+ assertTrue( "wrong column object notified in insert notification",
+ impl_areSameInterface( event.Element, m_columnModel.getColumn(i) ) );
+ }
+
+ // insert some more default columns, ensure that all previously existing columns are removed
+ final int moreDefaultColumnsCount = 5;
+ m_columnModel.setDefaultColumns( moreDefaultColumnsCount );
+ impl_assertColumnModelConsistency();
+ assertEquals( "setting default columns is expected to remove all previously existing columns",
+ moreDefaultColumnsCount, m_columnModel.getColumnCount() );
+
+ // in this situation, both removal and insertion events have been notified
+ final List< ContainerEvent > removalEvents = listener.getRemovalEvents();
+ final List< ContainerEvent > insertionEvents = listener.getInsertionEvents();
+ listener.reset();
+
+ // for the removal events, check the indexes
+ assertEquals( "wrong number of columns removed (or notified) upon setting default columns",
+ defaultColumnsCount, removalEvents.size() );
+ for ( int i=0; i<removalEvents.size(); ++i )
+ {
+ final ContainerEvent event = removalEvents.get(i);
+ final int removedIndex = impl_assertInteger( event.Accessor );
+
+ // The implementation is allowed to remove the columns from the beginning, in which case the
+ // index of the removed column must always be 0, since e.g. the second column has index 0
+ // after the first column (which previously had index 0) had been removed.
+ // Alternatively, the implementation is allowed to remove columns from the end, which means
+ // that the column index given in the event is steadily increasing.
+ assertTrue( "unexpected column removal event column index",
+ ( removedIndex == 0 ) || ( removedIndex == removalEvents.size() - 1 - i ) );
+ }
+
+ // for the insertion events, check the indexes as well
+ assertEquals( "wrong number of insertion events when setting default columns over existing columns",
+ moreDefaultColumnsCount, insertionEvents.size() );
+ for ( int i=0; i<insertionEvents.size(); ++i )
+ {
+ final ContainerEvent event = insertionEvents.get(i);
+ final int index = impl_assertInteger( event.Accessor );
+ assertEquals( i, index );
+ }
+
+ // okay, remove all those columns
+ while ( m_columnModel.getColumnCount() != 0 )
+ {
+ final int columnCount = m_columnModel.getColumnCount();
+ final int removeColumnIndex = m_randomGenerator.nextInt( columnCount );
+ m_columnModel.removeColumn( removeColumnIndex );
+ events = listener.assertExclusiveRemovalEvents();
+ listener.reset();
+ assertEquals( "removing a single column should notify a single event", 1, events.size() );
+ final ContainerEvent event = events.get(0);
+ final int removalIndex = impl_assertInteger( event.Accessor );
+ assertEquals( "removing an arbitrary column does not notify the proper accessor",
+ removeColumnIndex, removalIndex );
+ }
+
+ // calling addColumn with a column not created by the given model/implementatoion should not succeed
+ boolean caughtExpected = false;
+ try
+ {
+ m_columnModel.addColumn( new DummyColumn() );
+ }
+ catch( final com.sun.star.lang.IllegalArgumentException e )
+ {
+ assertTrue( impl_areSameInterface( e.Context, m_columnModel ) );
+ caughtExpected = true;
+ }
+ assertTrue( "adding a dummy (self-implemented) grid column to the model should not succeed", caughtExpected );
+
+ // adding a single column to the end should succeed, properly notify, and still be consistent
+ final XGridColumn newColumn = m_columnModel.createColumn();
+ m_columnModel.addColumn( newColumn );
+ impl_assertColumnModelConsistency();
+ events = listener.assertExclusiveInsertionEvents();
+ listener.reset();
+ assertEquals( "addColumn notifies the wrong number of insertion events", 1, events.size() );
+ final int insertionIndex = impl_assertInteger( events.get(0).Accessor );
+ assertEquals( insertionIndex, newColumn.getIndex() );
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ @Test
+ public void testSortableDataModel() throws Exception
+ {
+ impl_recreateGridModel();
+
+ final int colCount = 3;
+ final int rowCount = 10;
+ // initialize with some data
+ final Object[][] data = new Object[][] {
+ new Object[] { 15, 17, 0 },
+ new Object[] { 9, 8, 14 },
+ new Object[] { 17, 2, 16 },
+ new Object[] { 0, 7, 14 },
+ new Object[] { 10, 16, 16 },
+ new Object[] { 2, 8, 10 },
+ new Object[] { 4, 8, 3 },
+ new Object[] { 7, 9, 0 },
+ new Object[] { 15, 6, 19 },
+ new Object[] { 2, 14, 19 }
+ };
+ final Object[] rowHeadings = new Object[] {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
+ };
+ // ensure consistency of the test data
+ assertEquals( rowHeadings.length, rowCount );
+ assertEquals( data.length, rowCount );
+ for ( Object[] rowData : data )
+ assertEquals( rowData.length, colCount );
+
+ // add the test data
+ m_dataModel.addRows( rowHeadings, data );
+ assertEquals( rowCount, m_dataModel.getRowCount() );
+ assertEquals( colCount, m_dataModel.getColumnCount() );
+
+ // sort by each column
+ for ( int colIndex = 0; colIndex < colCount; ++colIndex )
+ {
+ for ( boolean ascending : new boolean[] { true, false } )
+ {
+ m_dataModel.sortByColumn( colIndex, ascending );
+ Pair currentSortOrder = m_dataModel.getCurrentSortOrder();
+ assertEquals( "invalid current sort column (column " + colIndex + ")", ((Integer)currentSortOrder.First).intValue(), colIndex );
+ assertEquals( "invalid current sort direction", ((Boolean)currentSortOrder.Second).booleanValue(), ascending );
+
+ /*for ( int i=0; i<rowCount; ++i )
+ {
+ for ( int j=0; j<colCount; ++j )
+ System.out.print( m_dataModel.getCellData( j, i ).toString() + ", " );
+ System.out.println();
+ }*/
+
+ // verify the data is actually sorted by this column
+ for ( int rowIndex = 0; rowIndex < rowCount - 1; ++rowIndex )
+ {
+ final Object currentValue = m_dataModel.getCellData( colIndex, rowIndex );
+ final int currentIntValue = impl_assertInteger( currentValue );
+ final Object nextValue = m_dataModel.getCellData( colIndex, rowIndex + 1 );
+ final int nextIntValue = impl_assertInteger( nextValue );
+ assertTrue( "data in row " + rowIndex + " is actually not sorted " + ( ascending ? "ascending" : "descending" ),
+ ascending ? currentIntValue <= nextIntValue
+ : currentIntValue >= nextIntValue );
+
+ // ensure the data in the other columns, and the row headings, are sorted as well
+ final Object rowHeading = m_dataModel.getRowHeading( rowIndex );
+ final int unsortedRowIndex = impl_assertInteger( rowHeading );
+ for ( int innerColIndex = 0; innerColIndex < colCount; ++innerColIndex )
+ {
+ assertEquals( "sorted row " + rowIndex + ", unsorted row " + unsortedRowIndex + ", col " + innerColIndex +
+ ": wrong data",
+ data[unsortedRowIndex][innerColIndex], m_dataModel.getCellData( innerColIndex, rowIndex ) );
+ }
+ }
+ }
+ }
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ @Test
+ public void testModelViewInteraction() throws Exception
+ {
+ final List< Object > disposables = new ArrayList< Object >();
+ try
+ {
+ // create a siple dialog model/control/peer trinity
+ final XControlModel dialogModel = createInstance( XControlModel.class, "com.sun.star.awt.UnoControlDialogModel" );
+ disposables.add( dialogModel );
+ final XPropertySet dialogProps = UnoRuntime.queryInterface( XPropertySet.class, dialogModel );
+ dialogProps.setPropertyValue( "Width", 200 );
+ dialogProps.setPropertyValue( "Height", 100 );
+ dialogProps.setPropertyValue( "Title", "Grid Control Unit Test" );
+ final XControl dialogControl = createInstance( XControl.class, "com.sun.star.awt.UnoControlDialog" );
+ disposables.add( dialogControl );
+ dialogControl.setModel( dialogModel );
+ dialogControl.createPeer( createInstance( XToolkit.class, "com.sun.star.awt.Toolkit" ), null );
+
+ // insert a grid control model
+ final XMultiServiceFactory controlModelFactory = UnoRuntime.queryInterface( XMultiServiceFactory.class,
+ dialogModel );
+ XPropertySet gridModelProps = UnoRuntime.queryInterface( XPropertySet.class,
+ controlModelFactory.createInstance( "com.sun.star.awt.grid.UnoControlGridModel" ) );
+ disposables.add( gridModelProps );
+ gridModelProps.setPropertyValue( "PositionX", 6 );
+ gridModelProps.setPropertyValue( "PositionY", 6 );
+ gridModelProps.setPropertyValue( "Width", 188 );
+ gridModelProps.setPropertyValue( "Height", 88 );
+ final XNameContainer modelContainer = UnoRuntime.queryInterface( XNameContainer.class, dialogModel );
+ modelContainer.insertByName( "grid", gridModelProps );
+
+ // check the respective control has been created
+ final XControlContainer controlContainer = UnoRuntime.queryInterface( XControlContainer.class, dialogControl );
+ final XControl gridControl = controlContainer.getControl( "grid" );
+ assertNotNull( "no grid control created in the dialog", gridControl );
+
+ // in the current implementation (not sure this is a good idea at all), the control (more precise: the peer)
+ // ensures that if there are no columns in the column model, but in the data model, then the column model
+ // will implicitly have the needed columns added.
+ // To ensure that clients which rely on this do not break in the future, check this here.
+ final XMutableGridDataModel dataModel = UnoRuntime.queryInterface( XMutableGridDataModel.class,
+ gridModelProps.getPropertyValue( "GridDataModel" ) );
+ assertNotNull( dataModel );
+ assertEquals( 0, dataModel.getColumnCount() );
+
+ final XGridColumnModel columnModel = UnoRuntime.queryInterface( XGridColumnModel.class,
+ gridModelProps.getPropertyValue( "ColumnModel" ) );
+ assertNotNull( columnModel );
+ assertEquals( 0, columnModel.getColumnCount() );
+
+ dataModel.addRow( null, new Object[] { 1, 2, 3 } );
+ assertEquals( 3, dataModel.getColumnCount() );
+ assertEquals( 3, columnModel.getColumnCount() );
+ }
+ finally
+ {
+ impl_dispose( disposables.toArray());
+ }
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ private int impl_assertInteger( final Object i_object )
+ {
+ assertTrue( i_object instanceof Integer );
+ return ((Integer)i_object).intValue();
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ private void impl_assertColumnModelConsistency() throws IndexOutOfBoundsException
+ {
+ for ( int col = 0; col < m_columnModel.getColumnCount(); ++col )
+ {
+ final XGridColumn column = m_columnModel.getColumn( col );
+ assertNotNull( column );
+ assertEquals( "column/model inconsistency: column " + col + " has a wrong index!", col, column.getIndex() );
+ }
+
+ final XGridColumn[] allColumns = m_columnModel.getColumns();
+ assertEquals( "getColumns returns the wrong number of column objects",
+ m_columnModel.getColumnCount(), allColumns.length );
+ for ( int col = 0; col < m_columnModel.getColumnCount(); ++col )
+ {
+ assertTrue( "getColumns inconsistency", impl_areSameInterface( allColumns[col], m_columnModel.getColumn(col) ) );
+ }
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ private void impl_assertEquality( final XGridDataModel i_reference, final XGridDataModel i_compare ) throws IndexOutOfBoundsException
+ {
+ assertNotNull( i_reference );
+ assertNotNull( i_compare );
+
+ assertEquals( "data model comparison: wrong column counts", i_reference.getColumnCount(), i_compare.getColumnCount() );
+ assertEquals( "data model comparison: wrong row counts", i_reference.getRowCount(), i_compare.getRowCount() );
+
+ for ( int row = 0; row < i_reference.getRowCount(); ++row )
+ {
+ assertEquals( "data model comparison: wrong row heading content in row " + row,
+ i_reference.getRowHeading( row ) );
+ for ( int col = 0; col < i_reference.getRowCount(); ++col )
+ {
+ assertEquals( "data model comparison: wrong cell content in cell (" + col + ", " + row + ")",
+ i_reference.getCellData( col, row ) );
+ assertEquals( "data model comparison: wrong tooltip content in cell (" + col + ", " + row + ")",
+ i_reference.getCellToolTip( col, row ) );
+ }
+ }
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ private void impl_assertEquality( final XGridColumnModel i_reference, final XGridColumnModel i_compare ) throws IndexOutOfBoundsException
+ {
+ assertEquals( "column model comparison: wrong column counts", i_reference.getColumnCount(), i_compare.getColumnCount() );
+ for ( int col = 0; col < i_reference.getColumnCount(); ++col )
+ {
+ final XGridColumn referenceColumn = i_reference.getColumn( col );
+ final XGridColumn compareColumn = i_compare.getColumn( col );
+ impl_assertEquality( referenceColumn, compareColumn );
+ }
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ private void impl_assertEquality( final XGridColumn i_reference, final XGridColumn i_compare )
+ {
+ final Method[] methods = XGridColumn.class.getMethods();
+ for ( int m=0; m<methods.length; ++m )
+ {
+ if ( !methods[m].getName().startsWith( "get" ) )
+ continue;
+ try
+ {
+ final Object referenceValue = methods[m].invoke( i_reference );
+ final Object compareValue = methods[m].invoke( i_compare );
+ assertEquals( "grid column comparison: column attribute '" + methods[m].getName().substring(3) + "' does not match",
+ referenceValue, compareValue );
+ }
+ catch ( java.lang.Exception ex )
+ {
+ fail( " could not retrieve object attributes: " + ex.toString() );
+ }
+ }
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ private boolean impl_areSameInterface( final Object i_lhs, final Object i_rhs )
+ {
+ final XInterface lhs = UnoRuntime.queryInterface( XInterface.class, i_lhs );
+ final XInterface rhs = UnoRuntime.queryInterface( XInterface.class, i_rhs );
+ return UnoRuntime.areSame( lhs, rhs );
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ @BeforeClass
+ public static void setUpConnection() throws java.lang.Exception
+ {
+ System.out.println( "--------------------------------------------------------------------------------" );
+ System.out.println( "starting class: " + GridControl.class.getName() );
+ System.out.print( "connecting ... " );
+ m_connection.setUp();
+ System.out.println( "done.");
+
+ final long seed = m_randomGenerator.nextLong();
+ m_randomGenerator.setSeed( seed );
+ System.out.println( "seeding random number generator with " + seed );
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ @AfterClass
+ public static void tearDownConnection()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ System.out.println();
+ System.out.println( "tearing down connection" );
+ m_connection.tearDown();
+ System.out.println( "finished class: " + GridControl.class.getName() );
+ System.out.println( "--------------------------------------------------------------------------------" );
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ public <T> T createInstance( Class<T> i_interfaceClass, final String i_serviceIndentifer ) throws Exception
+ {
+ return UnoRuntime.queryInterface( i_interfaceClass, createInstance( i_serviceIndentifer ) );
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ private Object createInstance( final String i_serviceName ) throws Exception
+ {
+ Object instance = m_context.getServiceManager().createInstanceWithContext( i_serviceName, m_context );
+ assertNotNull( "could not create an instance of '" + i_serviceName + "'", instance );
+ return instance;
+ }
+ // -----------------------------------------------------------------------------------------------------------------
+ private static final class DisposeListener implements XEventListener
+ {
+ DisposeListener( final Object i_component )
+ {
+ m_component = UnoRuntime.queryInterface( XComponent.class, i_component );
+ assertNotNull( m_component );
+ m_component.addEventListener( this );
+ }
+
+ public void disposing( EventObject i_event )
+ {
+ assertTrue( UnoRuntime.areSame( i_event.Source, m_component ) );
+ m_isDisposed = true;
+ }
+
+ final boolean isDisposed() { return m_isDisposed; }
+
+ private final XComponent m_component;
+ private boolean m_isDisposed;
+ };
+
+ // -----------------------------------------------------------------------------------------------------------------
+ private static final class ColumnModelListener implements XContainerListener
+ {
+ ColumnModelListener()
+ {
+ }
+
+ public void elementInserted( ContainerEvent i_event )
+ {
+ m_insertionEvents.add( i_event );
+ }
+
+ public void elementRemoved( ContainerEvent i_event )
+ {
+ m_removalEvents.add( i_event );
+ }
+
+ public void elementReplaced( ContainerEvent i_event )
+ {
+ m_replacementEvents.add( i_event );
+ }
+
+ public void disposing( EventObject eo )
+ {
+ m_isDisposed = true;
+ }
+
+ private List< ContainerEvent > assertExclusiveInsertionEvents()
+ {
+ assertFalse( m_insertionEvents.isEmpty() );
+ assertTrue( m_removalEvents.isEmpty() );
+ assertTrue( m_replacementEvents.isEmpty() );
+ return m_insertionEvents;
+ }
+
+ private List< ContainerEvent > assertExclusiveRemovalEvents()
+ {
+ assertTrue( m_insertionEvents.isEmpty() );
+ assertFalse( m_removalEvents.isEmpty() );
+ assertTrue( m_replacementEvents.isEmpty() );
+ return m_removalEvents;
+ }
+
+ private void reset()
+ {
+ m_insertionEvents = new ArrayList< ContainerEvent >();
+ m_removalEvents = new ArrayList< ContainerEvent >();
+ m_replacementEvents = new ArrayList< ContainerEvent >();
+ }
+
+ private List< ContainerEvent > getInsertionEvents() { return m_insertionEvents; }
+ private List< ContainerEvent > getRemovalEvents() { return m_removalEvents; }
+
+ final boolean isDisposed() { return m_isDisposed; }
+
+ private List< ContainerEvent > m_insertionEvents = new ArrayList< ContainerEvent >();
+ private List< ContainerEvent > m_removalEvents = new ArrayList< ContainerEvent >();
+ private List< ContainerEvent > m_replacementEvents = new ArrayList< ContainerEvent >();
+ private boolean m_isDisposed = false;
+ };
+
+ // -----------------------------------------------------------------------------------------------------------------
+ private static final OfficeConnection m_connection = new OfficeConnection();
+ private static Random m_randomGenerator = new Random();
+ private final XComponentContext m_context;
+
+ private XPropertySet m_gridControlModel;
+ private XGridColumnModel m_columnModel;
+ private XSortableMutableGridDataModel m_dataModel;
+}
diff --git a/toolkit/qa/complex/toolkit/UnitConversion.java b/toolkit/qa/complex/toolkit/UnitConversion.java
new file mode 100644
index 000000000000..b4cf8a8e1490
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/UnitConversion.java
@@ -0,0 +1,247 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+package complex.toolkit;
+
+import com.sun.star.awt.XUnitConversion;
+import com.sun.star.uno.UnoRuntime;
+
+import com.sun.star.awt.XWindow;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.awt.XWindowPeer;
+
+import util.DesktopTools;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openoffice.test.OfficeConnection;
+import static org.junit.Assert.*;
+
+/**
+ * This complex test is only for testing the com.sun.star.awt.XUnitConversion methods
+ * These are converter methods to get the size of a well known awt component
+ * in a com.sun.star.util.MeasureUnit you want.
+ * You don't need to know the factors to calculate by hand.
+ *
+ * @author ll93751
+ */
+public class UnitConversion
+{
+ /**
+ * returns the delta value between a and b
+ * @param a
+ * @param b
+ * @return
+ */
+ private int delta(int a, int b)
+ {
+ final int n = Math.abs(a - b);
+ return n;
+ }
+
+ private XUnitConversion m_xConversion = null;
+
+ /**
+ * Not really a check,
+ * only a simple test call to convertSizeToLogic(...) with different parameters
+ * @param _aSize
+ * @param _aMeasureUnit
+ * @param _sEinheit
+ */
+ private void checkSize(com.sun.star.awt.Size _aSize, short _aMeasureUnit, String _sEinheit)
+ {
+ try
+ {
+ com.sun.star.awt.Size aSizeIn = m_xConversion.convertSizeToLogic(_aSize, _aMeasureUnit);
+ System.out.println("Window size:");
+ System.out.println("Width:" + aSizeIn.Width + " " + _sEinheit);
+ System.out.println("Height:" + aSizeIn.Height + " " + _sEinheit);
+ System.out.println("");
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ System.out.println("Caught IllegalArgumentException in convertSizeToLogic with '" + _sEinheit + "' " + e.getMessage());
+ }
+ }
+
+ /**
+ * The real test function
+ * 1. try to get the XMultiServiceFactory of an already running office. Therefore make sure an (open|star)office is running with
+ * parameters like -accept="socket,host=localhost,port=8100;urp;"
+ * 2. try to create an empty window
+ * 3. try to convert the WindowPeer to an XWindow
+ * 4. try to resize and move the window to an other position, so we get a well knowing position and size.
+ * 5. run some more tests
+ *
+ * If no test fails, the test is well done and returns with 'PASSED, OK'
+ *
+ */
+ @Test
+ public void testXUnitConversion()
+ {
+ final XMultiServiceFactory xMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
+
+ assertNotNull("failed: There is no office.", xMSF);
+
+ // create a window
+ XWindowPeer xWindowPeer = DesktopTools.createFloatingWindow(xMSF);
+ assertNotNull("failed: there is no window peer", xWindowPeer);
+
+
+ // resize and move the window to a well known position and size
+ XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, xWindowPeer);
+ assertNotNull("failed: there is no window, cast wrong?", xWindow);
+
+ xWindow.setVisible(Boolean.TRUE);
+
+ int x = 100;
+ int y = 100;
+ int width = 640;
+ int height = 480;
+ xWindow.setPosSize(x, y, width, height, com.sun.star.awt.PosSize.POSSIZE);
+
+ com.sun.star.awt.Rectangle aRect = xWindow.getPosSize();
+ com.sun.star.awt.Point aPoint = new com.sun.star.awt.Point(aRect.X, aRect.Y);
+ com.sun.star.awt.Size aSize = new com.sun.star.awt.Size(aRect.Width, aRect.Height);
+
+ System.out.println("Window position and size in pixel:");
+ System.out.println("X:" + aPoint.X);
+ System.out.println("Y:" + aPoint.Y);
+ System.out.println("Width:" + aSize.Width);
+ System.out.println("Height:" + aSize.Height);
+ System.out.println("");
+
+ assertTrue("Window pos size wrong", aSize.Width == width && aSize.Height == height && aPoint.X == x && aPoint.Y == y);
+
+ m_xConversion = UnoRuntime.queryInterface(XUnitConversion.class, xWindowPeer);
+
+ // try to get the position of the window in 1/100mm with the XUnitConversion method
+ try
+ {
+ com.sun.star.awt.Point aPointInMM_100TH = m_xConversion.convertPointToLogic(aPoint, com.sun.star.util.MeasureUnit.MM_100TH);
+ System.out.println("Window position:");
+ System.out.println("X:" + aPointInMM_100TH.X + " 1/100mm");
+ System.out.println("Y:" + aPointInMM_100TH.Y + " 1/100mm");
+ System.out.println("");
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ fail("failed: IllegalArgumentException caught in convertPointToLogic " + e.getMessage());
+ }
+
+ // try to get the size of the window in 1/100mm with the XUnitConversion method
+ com.sun.star.awt.Size aSizeInMM_100TH = null;
+ com.sun.star.awt.Size aSizeInMM_10TH = null;
+ try
+ {
+ aSizeInMM_100TH = m_xConversion.convertSizeToLogic(aSize, com.sun.star.util.MeasureUnit.MM_100TH);
+ System.out.println("Window size:");
+ System.out.println("Width:" + aSizeInMM_100TH.Width + " 1/100mm");
+ System.out.println("Height:" + aSizeInMM_100TH.Height + " 1/100mm");
+ System.out.println("");
+
+ // try to get the size of the window in 1/10mm with the XUnitConversion method
+
+ aSizeInMM_10TH = m_xConversion.convertSizeToLogic(aSize, com.sun.star.util.MeasureUnit.MM_10TH);
+ System.out.println("Window size:");
+ System.out.println("Width:" + aSizeInMM_10TH.Width + " 1/10mm");
+ System.out.println("Height:" + aSizeInMM_10TH.Height + " 1/10mm");
+ System.out.println("");
+
+ // check the size with a delta which must be smaller a given difference
+ assertTrue("Size.Width not correct", delta(aSizeInMM_100TH.Width, aSizeInMM_10TH.Width * 10) < 10);
+ assertTrue("Size.Height not correct", delta(aSizeInMM_100TH.Height, aSizeInMM_10TH.Height * 10) < 10);
+
+ // new
+ checkSize(aSize, com.sun.star.util.MeasureUnit.PIXEL, "pixel");
+ checkSize(aSize, com.sun.star.util.MeasureUnit.APPFONT, "appfont");
+ checkSize(aSize, com.sun.star.util.MeasureUnit.SYSFONT, "sysfont");
+
+ // simply check some more parameters
+ checkSize(aSize, com.sun.star.util.MeasureUnit.MM, "mm");
+ checkSize(aSize, com.sun.star.util.MeasureUnit.CM, "cm");
+ checkSize(aSize, com.sun.star.util.MeasureUnit.INCH_1000TH, "1/1000inch");
+ checkSize(aSize, com.sun.star.util.MeasureUnit.INCH_100TH, "1/100inch");
+ checkSize(aSize, com.sun.star.util.MeasureUnit.INCH_10TH, "1/10inch");
+ checkSize(aSize, com.sun.star.util.MeasureUnit.INCH, "inch");
+ // checkSize(aSize, com.sun.star.util.MeasureUnit.M, "m");
+ checkSize(aSize, com.sun.star.util.MeasureUnit.POINT, "point");
+ checkSize(aSize, com.sun.star.util.MeasureUnit.TWIP, "twip");
+ // checkSize(aSize, com.sun.star.util.MeasureUnit.KM, "km");
+ // checkSize(aSize, com.sun.star.util.MeasureUnit.PICA, "pica");
+ // checkSize(aSize, com.sun.star.util.MeasureUnit.FOOT, "foot");
+ // checkSize(aSize, com.sun.star.util.MeasureUnit.MILE, "mile");
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ fail("failed: IllegalArgumentException caught in convertSizeToLogic " + e.getMessage());
+ }
+
+ // convert the 1/100mm window size back to pixel
+ try
+ {
+ com.sun.star.awt.Size aNewSize = m_xConversion.convertSizeToPixel(aSizeInMM_100TH, com.sun.star.util.MeasureUnit.MM_100TH);
+ System.out.println("Window size:");
+ System.out.println("Width:" + aNewSize.Width + " pixel");
+ System.out.println("Height:" + aNewSize.Height + " pixel");
+
+ // assure the pixels are the same as we already know
+ assertTrue("failed: Size from pixel to 1/100mm to pixel", aSize.Width == aNewSize.Width && aSize.Height == aNewSize.Height);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ fail("failed: IllegalArgumentException caught in convertSizeToPixel " + e.getMessage());
+ }
+
+ // close the window.
+ // IMHO a little bit stupid, but the XWindow doesn't support a XCloseable interface
+ xWindow.dispose();
+ }
+
+ @BeforeClass
+ public static void setUpConnection() throws Exception
+ {
+ System.out.println( "--------------------------------------------------------------------------------" );
+ System.out.println( "starting class: " + UnitConversion.class.getName() );
+ System.out.println( "connecting ..." );
+ connection.setUp();
+ }
+
+ @AfterClass
+ public static void tearDownConnection()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ System.out.println();
+ System.out.println( "tearing down connection" );
+ connection.tearDown();
+ System.out.println( "finished class: " + UnitConversion.class.getName() );
+ System.out.println( "--------------------------------------------------------------------------------" );
+ }
+
+ private static final OfficeConnection connection = new OfficeConnection();
+}
diff --git a/toolkit/qa/complex/toolkit/_XRequestCallback.java b/toolkit/qa/complex/toolkit/_XRequestCallback.java
deleted file mode 100644
index b9486c04c80a..000000000000
--- a/toolkit/qa/complex/toolkit/_XRequestCallback.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-package complex.toolkit;
-
-import com.sun.star.awt.XRequestCallback;
-// import lib.MultiMethodTest;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.uno.XInterface;
-import com.sun.star.uno.UnoRuntime;
-// import share.LogWriter;
-
-/**
- * Testing <code>com.sun.star.awt.XRequestCallback</code>
- * interface methods :
- * <ul>
- * <li><code> addCallback()</code></li>
- * </ul> <p>
- * @see com.sun.star.awt.XRequestCallback
- */
-public class _XRequestCallback {
-
- // private LogWriter log;
-
- private static final String className =
- "com.sun.star.awt.XRequestCallback" ;
-
- public XRequestCallback oObj = null;
- private XMultiServiceFactory xMSF;
-
- String text = null;
-
-
- public _XRequestCallback(XInterface object, XMultiServiceFactory xMSF ) {
- oObj = UnoRuntime.queryInterface(XRequestCallback.class, object);
- this.xMSF = xMSF;
- // this.log = log;
- }
-
-
- /**
- * Calls the method and checks returned value.
- * Has OK status if returned value is equal to <code>chCount - 1</code>.
- * The following method tests are to be executed before:
- * <ul>
- * <li> <code>addCallback()</code> </li>
- * </ul>
- * @return
- */
- public boolean _addCallback() {
-
- boolean res = true;
- try {
- Object a = new Object();
- oObj.addCallback( null, a );
- } catch (com.sun.star.uno.RuntimeException ie) {
- res = false;
- }
- System.out.println("addCallback called" );
-
- return res;
- }
-
-}
diff --git a/toolkit/qa/complex/toolkit/_XAccessibleComponent.java b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleComponent.java
index ae3e293e50fc..7dca37ce18b7 100755
--- a/toolkit/qa/complex/toolkit/_XAccessibleComponent.java
+++ b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleComponent.java
@@ -25,9 +25,8 @@
*
************************************************************************/
-package complex.toolkit;
+package complex.toolkit.accessibility;
-// import share.LogWriter;
import com.sun.star.awt.Point;
import com.sun.star.awt.Rectangle;
import com.sun.star.awt.Size;
diff --git a/toolkit/qa/complex/toolkit/_XAccessibleContext.java b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleContext.java
index de2928fdabe3..14debda92cd8 100755
--- a/toolkit/qa/complex/toolkit/_XAccessibleContext.java
+++ b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleContext.java
@@ -25,7 +25,7 @@
*
************************************************************************/
-package complex.toolkit;
+package complex.toolkit.accessibility;
import com.sun.star.lang.Locale;
import com.sun.star.uno.XInterface;
diff --git a/toolkit/qa/complex/toolkit/_XAccessibleEventBroadcaster.java b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleEventBroadcaster.java
index 899028daec87..535c7ce36c68 100755
--- a/toolkit/qa/complex/toolkit/_XAccessibleEventBroadcaster.java
+++ b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleEventBroadcaster.java
@@ -25,7 +25,7 @@
*
************************************************************************/
-package complex.toolkit;
+package complex.toolkit.accessibility;
import com.sun.star.lang.EventObject;
import com.sun.star.awt.Rectangle;
@@ -33,13 +33,11 @@ import com.sun.star.awt.PosSize;
import com.sun.star.awt.XWindow;
import com.sun.star.accessibility.AccessibleEventObject;
import com.sun.star.accessibility.XAccessible;
-// import com.sun.star.accessibility.XAccessibleComponent;
import com.sun.star.accessibility.XAccessibleEventBroadcaster;
import com.sun.star.accessibility.XAccessibleEventListener;
import com.sun.star.accessibility.XAccessibleContext;
import com.sun.star.uno.XInterface;
import com.sun.star.uno.UnoRuntime;
-// import share.LogWriter;
/**
* Testing <code>
@@ -62,12 +60,7 @@ import com.sun.star.uno.UnoRuntime;
*/
public class _XAccessibleEventBroadcaster {
- // private LogWriter log;
- private static final String className =
- "com.sun.star.accessibility.XAccessibleEventBroadcaster" ;
-
public XAccessibleEventBroadcaster oObj = null;
- public String EventMsg = "";
EventProducer prod = null ;
EvListener list = new EvListener();
@@ -120,11 +113,9 @@ public class _XAccessibleEventBroadcaster {
* @param eventMessage
* @param window
*/
- public _XAccessibleEventBroadcaster(XInterface object, String eventMessage, XWindow window) {
+ public _XAccessibleEventBroadcaster(XInterface object, XWindow window) {
oObj = UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, object);
- // this.log = log;
prod = new EventProducer(window);
- EventMsg = eventMessage;
}
/**
@@ -157,7 +148,6 @@ public class _XAccessibleEventBroadcaster {
oObj.removeEventListener(list);
}
-// System.out.println(EventMsg);
return works;
}
diff --git a/toolkit/qa/complex/toolkit/_XAccessibleExtendedComponent.java b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleExtendedComponent.java
index 2ba5c190cf31..551b00acada7 100755
--- a/toolkit/qa/complex/toolkit/_XAccessibleExtendedComponent.java
+++ b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleExtendedComponent.java
@@ -25,7 +25,7 @@
*
************************************************************************/
-package complex.toolkit;
+package complex.toolkit.accessibility;
// import lib.MultiMethodTest;
import com.sun.star.accessibility.XAccessibleExtendedComponent;
diff --git a/toolkit/qa/complex/toolkit/_XAccessibleText.java b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleText.java
index 151e6b3f7d0b..a12d93a2d9e2 100755
--- a/toolkit/qa/complex/toolkit/_XAccessibleText.java
+++ b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleText.java
@@ -25,7 +25,7 @@
*
************************************************************************/
-package complex.toolkit;
+package complex.toolkit.accessibility;
import com.sun.star.accessibility.XAccessibleText;
// import lib.MultiMethodTest;
diff --git a/toolkit/qa/complex/toolkit/awtgrid/DummyColumn.java b/toolkit/qa/complex/toolkit/awtgrid/DummyColumn.java
new file mode 100755
index 000000000000..11e4a4b19f80
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/awtgrid/DummyColumn.java
@@ -0,0 +1,180 @@
+/*************************************************************************
+ * 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.
+ *
+ *************************************************************************/
+
+package complex.toolkit.awtgrid;
+
+import com.sun.star.awt.grid.XGridColumn;
+import com.sun.star.awt.grid.XGridColumnListener;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.XEventListener;
+import com.sun.star.style.HorizontalAlignment;
+import com.sun.star.util.XCloneable;
+
+/**
+ * a dummy implementation of css.awt.grid.XGridColumn
+ * @author frank.schoenheit@oracle.com
+ */
+public class DummyColumn implements XGridColumn
+{
+ public DummyColumn()
+ {
+ }
+
+ public Object getIdentifier()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void setIdentifier( Object o )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public int getColumnWidth()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void setColumnWidth( int i )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public int getMinWidth()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void setMinWidth( int i )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public int getMaxWidth()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void setMaxWidth( int i )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public boolean getResizeable()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void setResizeable( boolean bln )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public int getFlexibility()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void setFlexibility( int i ) throws IllegalArgumentException
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public HorizontalAlignment getHorizontalAlign()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void setHorizontalAlign( HorizontalAlignment ha )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public String getTitle()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void setTitle( String string )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public String getHelpText()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void setHelpText( String string )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public int getIndex()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public int getDataColumnIndex()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void setDataColumnIndex( int i )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void addGridColumnListener( XGridColumnListener xl )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void removeGridColumnListener( XGridColumnListener xl )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void dispose()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void addEventListener( XEventListener xl )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void removeEventListener( XEventListener xl )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public XCloneable createClone()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+}
diff --git a/toolkit/qa/complex/toolkit/awtgrid/GridDataListener.java b/toolkit/qa/complex/toolkit/awtgrid/GridDataListener.java
new file mode 100755
index 000000000000..c31f27796cf1
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/awtgrid/GridDataListener.java
@@ -0,0 +1,98 @@
+package complex.toolkit.awtgrid;
+
+import com.sun.star.awt.grid.GridDataEvent;
+import com.sun.star.awt.grid.XGridDataListener;
+import com.sun.star.lang.EventObject;
+import static org.junit.Assert.*;
+
+final public class GridDataListener implements XGridDataListener
+{
+ public GridDataListener()
+ {
+ }
+
+ public void rowsInserted( GridDataEvent i_event )
+ {
+ assertNull( m_rowInsertionEvent );
+ m_rowInsertionEvent = i_event;
+ }
+
+ public void rowsRemoved( GridDataEvent i_event )
+ {
+ assertNull( m_rowRemovalEvent );
+ m_rowRemovalEvent = i_event;
+ }
+
+ public void dataChanged( GridDataEvent i_event )
+ {
+ assertNull( m_dataChangeEvent );
+ m_dataChangeEvent = i_event;
+ }
+
+ public void rowHeadingChanged( GridDataEvent i_event )
+ {
+ assertNull( m_rowHeadingChangeEvent );
+ m_rowHeadingChangeEvent = i_event;
+ }
+
+ public void disposing( EventObject eo )
+ {
+ m_disposed = true;
+ }
+
+ public final GridDataEvent assertSingleRowInsertionEvent()
+ {
+ assertNotNull( m_rowInsertionEvent );
+ assertNull( m_rowRemovalEvent );
+ assertNull( m_dataChangeEvent );
+ assertNull( m_rowHeadingChangeEvent );
+ assertFalse( m_disposed );
+ return m_rowInsertionEvent;
+ }
+
+ public final GridDataEvent assertSingleRowRemovalEvent()
+ {
+ assertNull( m_rowInsertionEvent );
+ assertNotNull( m_rowRemovalEvent );
+ assertNull( m_dataChangeEvent );
+ assertNull( m_rowHeadingChangeEvent );
+ assertFalse( m_disposed );
+ return m_rowRemovalEvent;
+ }
+
+ public final GridDataEvent assertSingleDataChangeEvent()
+ {
+ assertNull( m_rowInsertionEvent );
+ assertNull( m_rowRemovalEvent );
+ assertNotNull( m_dataChangeEvent );
+ assertNull( m_rowHeadingChangeEvent );
+ assertFalse( m_disposed );
+ return m_dataChangeEvent;
+ }
+
+ public final GridDataEvent assertSingleRowHeadingChangeEvent()
+ {
+ assertNull( m_rowInsertionEvent );
+ assertNull( m_rowRemovalEvent );
+ assertNull( m_dataChangeEvent );
+ assertNotNull( m_rowHeadingChangeEvent );
+ assertFalse( m_disposed );
+ return m_rowHeadingChangeEvent;
+ }
+
+ public final boolean isDisposed()
+ {
+ return m_disposed;
+ }
+
+ public final void reset()
+ {
+ m_rowInsertionEvent = m_rowRemovalEvent = m_dataChangeEvent = m_rowHeadingChangeEvent = null;
+ // m_disposed is not reset intentionally
+ }
+ private GridDataEvent m_rowInsertionEvent = null;
+ private GridDataEvent m_rowRemovalEvent = null;
+ private GridDataEvent m_dataChangeEvent = null;
+ private GridDataEvent m_rowHeadingChangeEvent = null;
+ private boolean m_disposed = false;
+}
diff --git a/toolkit/qa/complex/toolkit/awtgrid/TMutableGridDataModel.java b/toolkit/qa/complex/toolkit/awtgrid/TMutableGridDataModel.java
new file mode 100755
index 000000000000..c550dd9a047d
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/awtgrid/TMutableGridDataModel.java
@@ -0,0 +1,314 @@
+/*************************************************************************
+ * 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.
+ *
+ *************************************************************************/
+
+package complex.toolkit.awtgrid;
+
+import java.lang.reflect.Method;
+import com.sun.star.awt.grid.GridDataEvent;
+import com.sun.star.awt.grid.XMutableGridDataModel;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.IndexOutOfBoundsException;
+import static org.junit.Assert.*;
+import static complex.toolkit.Assert.*;
+
+/** test for the <code>css.awt.grid.XMutableGridData</code> interface
+ *
+ * @author frank.schoenheit@oracle.com
+ */
+public class TMutableGridDataModel
+{
+ public TMutableGridDataModel( final XMutableGridDataModel i_dataModel )
+ {
+ m_dataModel = i_dataModel;
+
+ m_listener = new GridDataListener();
+ m_dataModel.addGridDataListener( m_listener );
+ }
+
+ /*
+ * tests the XMutableGridDataModel.addRow method
+ */
+ public void testAddRow() throws IndexOutOfBoundsException
+ {
+ m_dataModel.addRow( 1, m_rowValues[0] );
+ GridDataEvent event = m_listener.assertSingleRowInsertionEvent();
+ m_listener.reset();
+ assertEquals( "row insertion: wrong FirstRow (1)", 0, event.FirstRow );
+ assertEquals( "row insertion: wrong LastRow (1)", 0, event.LastRow );
+ impl_assertRowData( 0 );
+
+ m_dataModel.addRow( 2, m_rowValues[1] );
+ event = m_listener.assertSingleRowInsertionEvent();
+ m_listener.reset();
+ assertEquals( "row insertion: wrong FirstRow (2)", 1, event.FirstRow );
+ assertEquals( "row insertion: wrong LastRow (2)", 1, event.LastRow );
+ impl_assertRowData( 1 );
+ }
+
+ /**
+ * tests the XMutableGridDataModel.addRows method
+ */
+ public void testAddRows() throws IndexOutOfBoundsException, IllegalArgumentException
+ {
+ assertEquals( "precondition not met: call this directly after testAddRow, please!", 2, m_dataModel.getRowCount() );
+
+ m_dataModel.addRows( new Object[] { "3", 4.0, "5" }, new Object[][] { m_rowValues[2], m_rowValues[3], m_rowValues[4] } );
+ GridDataEvent event = m_listener.assertSingleRowInsertionEvent();
+ assertEquals( "row insertion: wrong FirstRow (1)", 2, event.FirstRow );
+ assertEquals( "row insertion: wrong LastRow (1)", 4, event.LastRow );
+ m_listener.reset();
+
+ assertEquals( "data model's row count is not adjusted when adding rows", m_rowValues.length, m_dataModel.getRowCount() );
+ assertEquals( "data model's column count is not adjusted when adding rows", m_rowValues[0].length, m_dataModel.getColumnCount() );
+ for ( int row=0; row<m_rowValues.length; ++row )
+ {
+ for ( int col=0; col<m_rowValues[row].length; ++col )
+ {
+ assertEquals( "added row values are not preserved",
+ m_rowValues[row][col], m_dataModel.getCellData( col, row ) );
+ }
+ }
+
+ assertException( "addRows is expected to throw when invoked with different-sized arrays",
+ m_dataModel, "addRows", new Object[] { new Object[0], new Object[1][2] }, IllegalArgumentException.class );
+ }
+
+ /**
+ * tests the XMutableGridDataModel.removeRow method
+ */
+ public void testRemoveRow() throws IndexOutOfBoundsException
+ {
+ assertEquals( "precondition not met: call this directly after testAddRows, please!", m_rowValues.length, m_dataModel.getRowCount() );
+
+ final int rowToRemove = 2;
+ m_dataModel.removeRow( rowToRemove );
+ GridDataEvent event = m_listener.assertSingleRowRemovalEvent();
+ assertEquals( "incorrect notification of row removal (FirstRow)", rowToRemove, event.FirstRow );
+ assertEquals( "incorrect notification of row removal (LastRow)", rowToRemove, event.LastRow );
+ m_listener.reset();
+
+ assertEquals( "data model's row count does not reflect the removed row", m_rowValues.length - 1, m_dataModel.getRowCount() );
+ for ( int row = rowToRemove; row<m_rowValues.length-1; ++row )
+ {
+ for ( int col=0; col<m_rowValues[row].length; ++col )
+ {
+ assertEquals( "unexpected row values after removing a row (col: " + col + ", row: " + row + ")",
+ m_rowValues[row+1][col], m_dataModel.getCellData( col, row ) );
+ }
+ }
+
+ assertException( "removeRow silently ignores an invalid index (1)",
+ m_dataModel, "removeRow", new Object[] { -1 }, IndexOutOfBoundsException.class );
+ assertException( "removeRow silently ignores an invalid index (2)",
+ m_dataModel, "removeRow", new Object[] { m_dataModel.getRowCount() }, IndexOutOfBoundsException.class );
+ }
+
+ /**
+ * tests the XMutableGridDataModel.removeAllRows method
+ */
+ public void testRemoveAllRows()
+ {
+ assertEquals( "precondition not met: call this directly after testRemoveRow, please!", m_rowValues.length - 1, m_dataModel.getRowCount() );
+
+ m_dataModel.removeAllRows();
+ final GridDataEvent event = m_listener.assertSingleRowRemovalEvent();
+ if ( event.FirstRow != -1 )
+ { // notifying "-1" is allowed, this means "all rows affected", by definition
+ assertEquals( "removeAllRows is not notifying properly (1)", 0, event.FirstRow );
+ assertEquals( "removeAllRows is not notifying properly (2)", m_rowValues.length - 1, event.LastRow );
+ }
+ m_listener.reset();
+ }
+
+ /**
+ * tests the XMutableGridDataModel.updateCellData method
+ */
+ public void testUpdateCellData() throws IndexOutOfBoundsException, IllegalArgumentException
+ {
+ assertEquals( "precondition not met: call this directly after testRemoveAllRows, please!", 0, m_dataModel.getRowCount() );
+
+ m_dataModel.addRows( new Object[] { 1, 2, 3, 4, 5 }, m_rowValues );
+ m_listener.assertSingleRowInsertionEvent();
+ m_listener.reset();
+
+ final Object[][] modifyValues = new Object[][] {
+ new Object[] { 2, 1, "text" },
+ new Object[] { 3, 0, null },
+ new Object[] { 0, 4, new Double( 33.0 ) }
+ };
+ for ( int i = 0; i < modifyValues.length; ++i )
+ {
+ final int row = ((Integer)modifyValues[i][0]).intValue();
+ final int col = ((Integer)modifyValues[i][1]).intValue();
+ final Object value = modifyValues[i][2];
+ m_dataModel.updateCellData( col, row, value );
+
+ final GridDataEvent event = m_listener.assertSingleDataChangeEvent();
+ assertEquals( "data change notification: FirstRow is invalid", row, event.FirstRow );
+ assertEquals( "data change notification: LastRow is invalid", row, event.LastRow );
+ assertEquals( "data change notification: FirstColumn is invalid", col, event.FirstColumn );
+ assertEquals( "data change notification: LastColumn is invalid", col, event.LastColumn );
+ m_listener.reset();
+
+ assertEquals( "data change at (" + col + ", " + row + ") not successful", value, m_dataModel.getCellData( col, row ) );
+ }
+
+ assertException( "updateCellData silently ignores an invalid index (1)",
+ m_dataModel, "updateCellData", new Class[] { int.class, int.class, Object.class },
+ new Object[] { -1, -1, "text" }, IndexOutOfBoundsException.class );
+ assertException( "updateCellData silently ignores an invalid index (2)",
+ m_dataModel, "updateCellData", new Class[] { int.class, int.class, Object.class },
+ new Object[] { 0, m_dataModel.getRowCount(), "text" }, IndexOutOfBoundsException.class );
+ assertException( "updateCellData silently ignores an invalid index (3)",
+ m_dataModel, "updateCellData", new Class[] { int.class, int.class, Object.class },
+ new Object[] { m_dataModel.getColumnCount(), 0, "text" }, IndexOutOfBoundsException.class );
+ }
+
+ /**
+ * tests the XMutableGridDataModel.updateRowData method
+ */
+ public void testUpdateRowData() throws IndexOutOfBoundsException, IllegalArgumentException
+ {
+ assertEquals( "precondition not met: call this directly after testRemoveAllRows, please!", m_rowValues.length, m_dataModel.getRowCount() );
+
+ // get data from before the update
+ final Object[][] preUpdateValues = impl_getCurrentData();
+
+ // do the update
+ final int[] colIndexes = new int[] {
+ 0, 3, 4
+ };
+ final Object[] values = new Object[] {
+ 13, null, 42.0
+ };
+ final int rowToUpdate = 2;
+ m_dataModel.updateRowData( colIndexes, rowToUpdate, values );
+ final GridDataEvent event = m_listener.assertSingleDataChangeEvent();
+ assertEquals( "row update notification: FirstRow is invalid", rowToUpdate, event.FirstRow );
+ assertEquals( "row update notification: LastRow is invalid", rowToUpdate, event.LastRow );
+ assertEquals( "row update notification: FirstColumn is invalid", 0, event.FirstColumn );
+ assertEquals( "row update notification: LastColumn is invalid", 4, event.LastColumn );
+ m_listener.reset();
+
+ // reflect the changes made in the pre-update data
+ for ( int i=0; i<colIndexes.length; ++i )
+ {
+ preUpdateValues[rowToUpdate][colIndexes[i]] = values[i];
+ }
+
+ // get data from after the update
+ final Object[][] postUpdateValues = impl_getCurrentData();
+
+ // ensure both the manually updated pre-update data and the post-update data are identical
+ assertArrayEquals( preUpdateValues, postUpdateValues );
+
+
+ assertException( "updateRowData silently ignores an invalid index (1)",
+ m_dataModel, "updateRowData", new Class[] { int[].class, int.class, Object[].class },
+ new Object[] { new int[] { -1 }, 0, new Object[] { "text" } }, IndexOutOfBoundsException.class );
+ assertException( "updateRowData silently ignores an invalid index (2)",
+ m_dataModel, "updateRowData", new Class[] { int[].class, int.class, Object[].class },
+ new Object[] { new int[] { 0 }, -1, new Object[] { "" } }, IndexOutOfBoundsException.class );
+ assertException( "updateRowData silently ignores different-sized arrays",
+ m_dataModel, "updateRowData", new Class[] { int[].class, int.class, Object[].class },
+ new Object[] { new int[] { 0, 0 }, 0, new Object[] { "" } }, IllegalArgumentException.class );
+ }
+
+ /**
+ * tests the XMutableGridDataModel.updateRowHeading method
+ */
+ public void testUpdateRowHeading() throws IndexOutOfBoundsException
+ {
+ assertEquals( "precondition not met: call this directly after testUpdateRowData, please!", m_rowValues.length, m_dataModel.getRowCount() );
+
+ final Object[] preUpdateHeadings = impl_getCurrentRowHeadings();
+
+ final int rowToUpdate = 2;
+ final String valueToUpdate = "some text";
+ m_dataModel.updateRowHeading( rowToUpdate, valueToUpdate );
+ final GridDataEvent event = m_listener.assertSingleRowHeadingChangeEvent();
+ assertEquals( "row heading update notification: FirstRow is invalid", rowToUpdate, event.FirstRow );
+ assertEquals( "row heading update notification: FirstRow is invalid", rowToUpdate, event.LastRow );
+ m_listener.reset();
+
+ preUpdateHeadings[rowToUpdate] = valueToUpdate;
+
+ final Object[] postUpdateHeadings = impl_getCurrentRowHeadings();
+ assertArrayEquals( preUpdateHeadings, postUpdateHeadings );
+
+ assertException( "updateRowHeading silently ignores an invalid index",
+ m_dataModel, "updateRowHeading", new Class[] { int.class, Object.class },
+ new Object[] { -1, "" }, IndexOutOfBoundsException.class );
+ }
+
+ public void cleanup()
+ {
+ m_dataModel.removeGridDataListener( m_listener );
+ }
+
+ private Object[][] impl_getCurrentData() throws IndexOutOfBoundsException
+ {
+ final int rowCount = m_dataModel.getRowCount();
+ final int colCount = m_dataModel.getColumnCount();
+ final Object[][] data = new Object[rowCount][colCount];
+ for ( int row=0; row<rowCount; ++row )
+ {
+ for ( int col=0; col<colCount; ++col )
+ {
+ data[row][col] = m_dataModel.getCellData( col, row );
+ }
+ }
+ return data;
+ }
+
+ private Object[] impl_getCurrentRowHeadings() throws IndexOutOfBoundsException
+ {
+ final int rowCount = m_dataModel.getRowCount();
+ final Object[] headings = new Object[rowCount];
+ for ( int row=0; row<rowCount; ++row )
+ headings[row] = m_dataModel.getRowHeading( row );
+ return headings;
+ }
+
+ private void impl_assertRowData( final int i_rowIndex ) throws IndexOutOfBoundsException
+ {
+ for ( int i=0; i<m_rowValues[i_rowIndex].length; ++i )
+ {
+ assertEquals( m_rowValues[i_rowIndex][i], m_dataModel.getCellData( i, i_rowIndex ) );
+ }
+ }
+
+ private final XMutableGridDataModel m_dataModel;
+ private final GridDataListener m_listener;
+
+ private final static Object[][] m_rowValues = new Object[][] {
+ new Object[] { 1, 2, "3", 4, 5 },
+ new Object[] { 2, 3, 4, "5", 6 },
+ new Object[] { "3", 4, 5, 6, 7 },
+ new Object[] { 4, 5, 6, 7, "8" },
+ new Object[] { 5, "6", 7, 8, 9 },
+ };
+}
diff --git a/toolkit/qa/complex/toolkit/makefile.mk b/toolkit/qa/complex/toolkit/makefile.mk
new file mode 100755
index 000000000000..ecb173f9bdac
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/makefile.mk
@@ -0,0 +1,97 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+.IF "$(OOO_JUNIT_JAR)" == ""
+nothing .PHONY:
+ @echo -----------------------------------------------------
+ @echo - JUnit not available, not building anything
+ @echo -----------------------------------------------------
+.ELSE # IF "$(OOO_JUNIT_JAR)" != ""
+
+PRJ = ../../..
+PRJNAME = toolkit
+TARGET = qa_complex_toolkit
+PACKAGE = complex/toolkit
+
+# --- Settings -----------------------------------------------------
+.INCLUDE: settings.mk
+
+#----- compile .java files -----------------------------------------
+
+JARFILES = OOoRunnerLight.jar ridl.jar test.jar unoil.jar
+EXTRAJARFILES = $(OOO_JUNIT_JAR)
+
+JAVAFILES = \
+ $(JAVATESTFILES) \
+ accessibility/_XAccessibleComponent.java \
+ accessibility/_XAccessibleContext.java \
+ accessibility/_XAccessibleEventBroadcaster.java \
+ accessibility/_XAccessibleExtendedComponent.java \
+ accessibility/_XAccessibleText.java \
+ Assert.java \
+ awtgrid/GridDataListener.java \
+ awtgrid/TMutableGridDataModel.java \
+ awtgrid/DummyColumn.java \
+
+#----- create a jar from compiled files ----------------------------
+
+JARTARGET = $(TARGET).jar
+
+#----- JUnit tests class -------------------------------------------
+
+JAVATESTFILES = \
+ GridControl.java \
+ UnitConversion.java \
+
+
+# disabled for now - the tests fail on at least one platform
+# no issue, yet (not sure this is worth it. Don't know who to give the issue to, and don't know whether the test really makes sense)
+DISABLED_JAVA_TEST_FILES=\
+ AccessibleStatusBar.java\
+ AccessibleStatusBarItem.java
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE: target.mk
+
+ALL : ALLTAR
+
+# --- subsequent tests ---------------------------------------------
+
+.IF "$(OOO_SUBSEQUENT_TESTS)" != ""
+
+.INCLUDE: installationtest.mk
+
+ALLTAR : javatest
+
+ # Sample how to debug
+ # JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y
+
+.END # "$(OOO_SUBSEQUENT_TESTS)" == ""
+
+.END # ELSE "$(OOO_JUNIT_JAR)" != ""
diff --git a/toolkit/qa/complex/xunitconversion/XUnitConversionTest.java b/toolkit/qa/complex/xunitconversion/XUnitConversionTest.java
deleted file mode 100644
index f9840e4bde6f..000000000000
--- a/toolkit/qa/complex/xunitconversion/XUnitConversionTest.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-package complex.xunitconversion;
-
-import com.sun.star.awt.XUnitConversion;
-import com.sun.star.uno.UnoRuntime;
-
-import com.sun.star.awt.XWindow;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.awt.XWindowPeer;
-
-import util.DesktopTools;
-
-// import org.junit.After;
-import org.junit.AfterClass;
-// import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.openoffice.test.OfficeConnection;
-import static org.junit.Assert.*;
-
-/**
- * This complex test is only for testing the com.sun.star.awt.XUnitConversion methods
- * These are converter methods to get the size of a well known awt component
- * in a com.sun.star.util.MeasureUnit you want.
- * You don't need to know the factors to calculate by hand.
- *
- * @author ll93751
- */
-public class XUnitConversionTest
-{
-// public String[] getTestMethodNames()
-// {
-// return new String[]{"testXUnitConversion"}; // function name of the test method
-// }
-
- /**
- * returns the delta value between a and b
- * @param a
- * @param b
- * @return
- */
- private int delta(int a, int b)
- {
- final int n = Math.abs(a - b);
- return n;
- }
-
- private XUnitConversion m_xConversion = null;
-
- /**
- * Not really a check,
- * only a simple test call to convertSizeToLogic(...) with different parameters
- * @param _aSize
- * @param _aMeasureUnit
- * @param _sEinheit
- */
- private void checkSize(com.sun.star.awt.Size _aSize, short _aMeasureUnit, String _sEinheit)
- {
- try
- {
- com.sun.star.awt.Size aSizeIn = m_xConversion.convertSizeToLogic(_aSize, _aMeasureUnit);
- System.out.println("Window size:");
- System.out.println("Width:" + aSizeIn.Width + " " + _sEinheit);
- System.out.println("Height:" + aSizeIn.Height + " " + _sEinheit);
- System.out.println("");
- }
- catch (com.sun.star.lang.IllegalArgumentException e)
- {
- System.out.println("Caught IllegalArgumentException in convertSizeToLogic with '" + _sEinheit + "' " + e.getMessage());
- }
- }
-
-/**
- * The real test function
- * 1. try to get the XMultiServiceFactory of an already running office. Therefore make sure an (open|star)office is running with
- * parameters like -accept="socket,host=localhost,port=8100;urp;"
- * 2. try to create an empty window
- * 3. try to convert the WindowPeer to an XWindow
- * 4. try to resize and move the window to an other position, so we get a well knowing position and size.
- * 5. run some more tests
- *
- * If no test fails, the test is well done and returns with 'PASSED, OK'
- *
- */
- @Test public void testXUnitConversion()
- {
- // XMultiServiceFactory xMSF = (XMultiServiceFactory) param.getMSF();
- final XMultiServiceFactory xMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
-
- assertNotNull("failed: There is no office.", xMSF);
-
- // create a window
- XWindowPeer xWindowPeer = DesktopTools.createFloatingWindow(xMSF);
- assertNotNull("failed: there is no window peer", xWindowPeer);
-
-
- // resize and move the window to a well known position and size
- XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, xWindowPeer);
- assertNotNull("failed: there is no window, cast wrong?", xWindow);
-
- xWindow.setVisible(Boolean.TRUE);
-
- int x = 100;
- int y = 100;
- int width = 640;
- int height = 480;
- xWindow.setPosSize(x, y, width, height, com.sun.star.awt.PosSize.POSSIZE);
-
- com.sun.star.awt.Rectangle aRect = xWindow.getPosSize();
- com.sun.star.awt.Point aPoint = new com.sun.star.awt.Point(aRect.X, aRect.Y);
- com.sun.star.awt.Size aSize = new com.sun.star.awt.Size(aRect.Width, aRect.Height);
-
- System.out.println("Window position and size in pixel:");
- System.out.println("X:" + aPoint.X);
- System.out.println("Y:" + aPoint.Y);
- System.out.println("Width:" + aSize.Width);
- System.out.println("Height:" + aSize.Height);
- System.out.println("");
-
- assertTrue("Window pos size wrong", aSize.Width == width && aSize.Height == height && aPoint.X == x && aPoint.Y == y);
-
- // XToolkit aToolkit = xWindowPeer.getToolkit();
- m_xConversion = UnoRuntime.queryInterface(XUnitConversion.class, xWindowPeer);
-
- // try to get the position of the window in 1/100mm with the XUnitConversion method
- try
- {
- com.sun.star.awt.Point aPointInMM_100TH = m_xConversion.convertPointToLogic(aPoint, com.sun.star.util.MeasureUnit.MM_100TH);
- System.out.println("Window position:");
- System.out.println("X:" + aPointInMM_100TH.X + " 1/100mm");
- System.out.println("Y:" + aPointInMM_100TH.Y + " 1/100mm");
- System.out.println("");
- }
- catch (com.sun.star.lang.IllegalArgumentException e)
- {
- fail("failed: IllegalArgumentException caught in convertPointToLogic " + e.getMessage());
- }
-
- // try to get the size of the window in 1/100mm with the XUnitConversion method
- com.sun.star.awt.Size aSizeInMM_100TH = null;
- com.sun.star.awt.Size aSizeInMM_10TH = null;
- try
- {
- aSizeInMM_100TH = m_xConversion.convertSizeToLogic(aSize, com.sun.star.util.MeasureUnit.MM_100TH);
- System.out.println("Window size:");
- System.out.println("Width:" + aSizeInMM_100TH.Width + " 1/100mm");
- System.out.println("Height:" + aSizeInMM_100TH.Height + " 1/100mm");
- System.out.println("");
-
- // try to get the size of the window in 1/10mm with the XUnitConversion method
-
- aSizeInMM_10TH = m_xConversion.convertSizeToLogic(aSize, com.sun.star.util.MeasureUnit.MM_10TH);
- System.out.println("Window size:");
- System.out.println("Width:" + aSizeInMM_10TH.Width + " 1/10mm");
- System.out.println("Height:" + aSizeInMM_10TH.Height + " 1/10mm");
- System.out.println("");
-
- // check the size with a delta which must be smaller a given difference
- assertTrue("Size.Width not correct", delta(aSizeInMM_100TH.Width, aSizeInMM_10TH.Width * 10) < 10);
- assertTrue("Size.Height not correct", delta(aSizeInMM_100TH.Height, aSizeInMM_10TH.Height * 10) < 10);
-
- // new
- checkSize(aSize, com.sun.star.util.MeasureUnit.PIXEL, "pixel");
- checkSize(aSize, com.sun.star.util.MeasureUnit.APPFONT, "appfont");
- checkSize(aSize, com.sun.star.util.MeasureUnit.SYSFONT, "sysfont");
-
- // simply check some more parameters
- checkSize(aSize, com.sun.star.util.MeasureUnit.MM, "mm");
- checkSize(aSize, com.sun.star.util.MeasureUnit.CM, "cm");
- checkSize(aSize, com.sun.star.util.MeasureUnit.INCH_1000TH, "1/1000inch");
- checkSize(aSize, com.sun.star.util.MeasureUnit.INCH_100TH, "1/100inch");
- checkSize(aSize, com.sun.star.util.MeasureUnit.INCH_10TH, "1/10inch");
- checkSize(aSize, com.sun.star.util.MeasureUnit.INCH, "inch");
- // checkSize(aSize, com.sun.star.util.MeasureUnit.M, "m");
- checkSize(aSize, com.sun.star.util.MeasureUnit.POINT, "point");
- checkSize(aSize, com.sun.star.util.MeasureUnit.TWIP, "twip");
- // checkSize(aSize, com.sun.star.util.MeasureUnit.KM, "km");
- // checkSize(aSize, com.sun.star.util.MeasureUnit.PICA, "pica");
- // checkSize(aSize, com.sun.star.util.MeasureUnit.FOOT, "foot");
- // checkSize(aSize, com.sun.star.util.MeasureUnit.MILE, "mile");
- }
- catch (com.sun.star.lang.IllegalArgumentException e)
- {
- fail("failed: IllegalArgumentException caught in convertSizeToLogic " + e.getMessage());
- }
-
- // convert the 1/100mm window size back to pixel
- try
- {
- com.sun.star.awt.Size aNewSize = m_xConversion.convertSizeToPixel(aSizeInMM_100TH, com.sun.star.util.MeasureUnit.MM_100TH);
- System.out.println("Window size:");
- System.out.println("Width:" + aNewSize.Width + " pixel");
- System.out.println("Height:" + aNewSize.Height + " pixel");
-
- // assure the pixels are the same as we already know
- assertTrue("failed: Size from pixel to 1/100mm to pixel", aSize.Width == aNewSize.Width && aSize.Height == aNewSize.Height);
- }
- catch (com.sun.star.lang.IllegalArgumentException e)
- {
- fail("failed: IllegalArgumentException caught in convertSizeToPixel " + e.getMessage());
- }
-
- // close the window.
- // IMHO a little bit stupid, but the XWindow doesn't support a XCloseable interface
- xWindow.dispose();
- }
-
-
-
- @BeforeClass public static void setUpConnection() throws Exception {
- System.out.println("setUpConnection()");
- connection.setUp();
- }
-
- @AfterClass public static void tearDownConnection()
- throws InterruptedException, com.sun.star.uno.Exception
- {
- System.out.println("tearDownConnection()");
- connection.tearDown();
- }
-
- private static final OfficeConnection connection = new OfficeConnection();
-
-}
diff --git a/toolkit/qa/unoapi/makefile.mk b/toolkit/qa/unoapi/makefile.mk
new file mode 100644
index 000000000000..9517601c3917
--- /dev/null
+++ b/toolkit/qa/unoapi/makefile.mk
@@ -0,0 +1,48 @@
+#*************************************************************************
+# 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.
+#***********************************************************************/
+
+.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
+nothing .PHONY:
+.ELSE
+
+PRJ = ../..
+PRJNAME = toolkit
+TARGET = qa_unoapi
+
+.IF "$(OOO_JUNIT_JAR)" != ""
+PACKAGE = org/openoffice/toolkit/qa/unoapi
+JAVATESTFILES = Test.java
+JAVAFILES = $(JAVATESTFILES)
+JARFILES = OOoRunner.jar ridl.jar test.jar
+EXTRAJARFILES = $(OOO_JUNIT_JAR)
+.END
+
+.INCLUDE: settings.mk
+.INCLUDE: target.mk
+.INCLUDE: installationtest.mk
+
+ALLTAR : javatest
+
+.END
diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx
index 80991e0a2a77..de5ebab36b2a 100644
--- a/toolkit/source/awt/vclxaccessiblecomponent.cxx
+++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx
@@ -445,7 +445,7 @@ void VCLXAccessibleComponent::FillAccessibleRelationSet( utl::AccessibleRelation
Window* pWindow = GetWindow();
if ( pWindow )
{
- Window *pLabeledBy = pWindow->GetLabeledBy();
+ Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy();
if ( pLabeledBy && pLabeledBy != pWindow )
{
uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
@@ -453,7 +453,7 @@ void VCLXAccessibleComponent::FillAccessibleRelationSet( utl::AccessibleRelation
rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABELED_BY, aSequence ) );
}
- Window* pLabelFor = pWindow->GetLabelFor();
+ Window* pLabelFor = pWindow->GetAccessibleRelationLabelFor();
if ( pLabelFor && pLabelFor != pWindow )
{
uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
diff --git a/toolkit/source/controls/animatedimages.cxx b/toolkit/source/controls/animatedimages.cxx
index 03cb2f26f324..c2fd91f1ea46 100755
--- a/toolkit/source/controls/animatedimages.cxx
+++ b/toolkit/source/controls/animatedimages.cxx
@@ -67,6 +67,7 @@ namespace toolkit
using ::com::sun::star::awt::XWindowPeer;
using ::com::sun::star::util::XModifyListener;
using ::com::sun::star::awt::XToolkit;
+ using ::com::sun::star::lang::XMultiServiceFactory;
/** === end UNO using === **/
namespace VisualEffect = ::com::sun::star::awt::VisualEffect;
namespace ImageScaleMode = ::com::sun::star::awt::ImageScaleMode;
@@ -75,8 +76,8 @@ namespace toolkit
//= AnimatedImagesControl
//==================================================================================================================
//------------------------------------------------------------------------------------------------------------------
- AnimatedImagesControl::AnimatedImagesControl()
- :AnimatedImagesControl_Base()
+ AnimatedImagesControl::AnimatedImagesControl( Reference< XMultiServiceFactory > const & i_factory )
+ :AnimatedImagesControl_Base( i_factory )
{
}
@@ -238,8 +239,9 @@ namespace toolkit
//= AnimatedImagesControlModel
//==================================================================================================================
//------------------------------------------------------------------------------------------------------------------
- AnimatedImagesControlModel::AnimatedImagesControlModel()
- :m_pData( new AnimatedImagesControlModel_Data )
+ AnimatedImagesControlModel::AnimatedImagesControlModel( Reference< XMultiServiceFactory > const & i_factory )
+ :AnimatedImagesControlModel_Base( i_factory )
+ ,m_pData( new AnimatedImagesControlModel_Data )
{
ImplRegisterProperty( BASEPROPERTY_AUTO_REPEAT );
ImplRegisterProperty( BASEPROPERTY_BORDER );
diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx
index 940b99bd41c3..f037f10bbe31 100644
--- a/toolkit/source/controls/controlmodelcontainerbase.cxx
+++ b/toolkit/source/controls/controlmodelcontainerbase.cxx
@@ -220,8 +220,9 @@ static const ::rtl::OUString& getStepPropertyName( )
// ----------------------------------------------------
// class ControlModelContainerBase
// ----------------------------------------------------
-ControlModelContainerBase::ControlModelContainerBase()
- :maContainerListeners( *this )
+ControlModelContainerBase::ControlModelContainerBase( const Reference< XMultiServiceFactory >& i_factory )
+ :ControlModelContainer_IBase( i_factory )
+ ,maContainerListeners( *this )
,maChangeListeners ( GetMutex() )
,mbGroupsUpToDate( sal_False )
{
@@ -339,61 +340,61 @@ Reference< XInterface > ControlModelContainerBase::createInstance( const ::rtl::
OGeometryControlModel_Base* pNewModel = NULL;
+ const Reference< XMultiServiceFactory > xFactory( maContext.getLegacyServiceFactory() );
if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlEditModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlEditModel >;
+ pNewModel = new OGeometryControlModel< UnoControlEditModel >( xFactory );
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFormattedFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlFormattedFieldModel >;
+ pNewModel = new OGeometryControlModel< UnoControlFormattedFieldModel >( xFactory );
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFileControlModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlFileControlModel >;
+ pNewModel = new OGeometryControlModel< UnoControlFileControlModel >( xFactory );
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlButtonModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlButtonModel >;
+ pNewModel = new OGeometryControlModel< UnoControlButtonModel >( xFactory );
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlImageControlModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlImageControlModel >;
+ pNewModel = new OGeometryControlModel< UnoControlImageControlModel >( xFactory );
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlRadioButtonModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlRadioButtonModel >;
+ pNewModel = new OGeometryControlModel< UnoControlRadioButtonModel >( xFactory );
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlCheckBoxModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlCheckBoxModel >;
+ pNewModel = new OGeometryControlModel< UnoControlCheckBoxModel >( xFactory );
else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlFixedHyperlinkModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlFixedHyperlinkModel >;
+ pNewModel = new OGeometryControlModel< UnoControlFixedHyperlinkModel >( xFactory );
else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlFixedTextModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlFixedTextModel >;
+ pNewModel = new OGeometryControlModel< UnoControlFixedTextModel >( xFactory );
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlGroupBoxModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlGroupBoxModel >;
+ pNewModel = new OGeometryControlModel< UnoControlGroupBoxModel >( xFactory );
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlListBoxModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlListBoxModel >;
+ pNewModel = new OGeometryControlModel< UnoControlListBoxModel >( xFactory );
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlComboBoxModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlComboBoxModel >;
+ pNewModel = new OGeometryControlModel< UnoControlComboBoxModel >( xFactory );
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlDateFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlDateFieldModel >;
+ pNewModel = new OGeometryControlModel< UnoControlDateFieldModel >( xFactory );
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlTimeFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlTimeFieldModel >;
+ pNewModel = new OGeometryControlModel< UnoControlTimeFieldModel >( xFactory );
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlNumericFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlNumericFieldModel >;
+ pNewModel = new OGeometryControlModel< UnoControlNumericFieldModel >( xFactory );
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlCurrencyFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlCurrencyFieldModel >;
+ pNewModel = new OGeometryControlModel< UnoControlCurrencyFieldModel >( xFactory );
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlPatternFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlPatternFieldModel >;
+ pNewModel = new OGeometryControlModel< UnoControlPatternFieldModel >( xFactory );
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlProgressBarModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlProgressBarModel >;
+ pNewModel = new OGeometryControlModel< UnoControlProgressBarModel >( xFactory );
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlScrollBarModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlScrollBarModel >;
+ pNewModel = new OGeometryControlModel< UnoControlScrollBarModel >( xFactory );
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFixedLineModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlFixedLineModel >;
+ pNewModel = new OGeometryControlModel< UnoControlFixedLineModel >( xFactory );
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlRoadmapModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlRoadmapModel >;
+ pNewModel = new OGeometryControlModel< UnoControlRoadmapModel >( xFactory );
else if ( aServiceSpecifier.compareToAscii( szServiceName_TreeControlModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoTreeModel >;
+ pNewModel = new OGeometryControlModel< UnoTreeModel >( xFactory );
else if ( aServiceSpecifier.compareToAscii( szServiceName_GridControlModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoGridModel >;
+ pNewModel = new OGeometryControlModel< UnoGridModel >( xFactory );
else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlTabPageContainerModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlTabPageContainerModel >;
+ pNewModel = new OGeometryControlModel< UnoControlTabPageContainerModel >( xFactory );
if ( !pNewModel )
{
- Reference< XMultiServiceFactory > xORB( ::comphelper::getProcessServiceFactory() );
- if ( xORB.is() )
+ if ( xFactory.is() )
{
- Reference< XInterface > xObject = xORB->createInstance( aServiceSpecifier );
+ Reference< XInterface > xObject = xFactory->createInstance( aServiceSpecifier );
Reference< XServiceInfo > xSI( xObject, UNO_QUERY );
Reference< XCloneable > xCloneAccess( xSI, UNO_QUERY );
Reference< XAggregation > xAgg( xCloneAccess, UNO_QUERY );
@@ -1313,9 +1314,10 @@ throw ( RuntimeException )
// ----------------------------------------------------
// class DialogContainerControl
// ----------------------------------------------------
-ControlContainerBase::ControlContainerBase() :
- mbSizeModified(false),
- mbPosModified(false)
+ControlContainerBase::ControlContainerBase( const Reference< XMultiServiceFactory >& i_factory )
+ :ContainerControl_IBase( i_factory )
+ ,mbSizeModified(false)
+ ,mbPosModified(false)
{
maComponentInfos.nWidth = 280;
maComponentInfos.nHeight = 400;
@@ -1339,8 +1341,8 @@ void ControlContainerBase::ImplInsertControl( Reference< XControlModel >& rxMode
::rtl::OUString aDefCtrl;
xP->getPropertyValue( GetPropertyName( BASEPROPERTY_DEFAULTCONTROL ) ) >>= aDefCtrl;
- Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
- Reference < XControl > xCtrl( xMSF->createInstance( aDefCtrl ), UNO_QUERY );
+ Reference < XControl > xCtrl;
+ maContext.createComponent( aDefCtrl, xCtrl );
DBG_ASSERT( xCtrl.is(), "UnoDialogControl::ImplInsertControl: could not create the control!" );
if ( xCtrl.is() )
@@ -1360,7 +1362,18 @@ void ControlContainerBase::ImplRemoveControl( Reference< XControlModel >& rxMode
Sequence< Reference< XControl > > aControls = getControls();
Reference< XControl > xCtrl = StdTabController::FindControl( aControls, rxModel );
if ( xCtrl.is() )
+ {
removeControl( xCtrl );
+ try
+ {
+ Reference< XComponent > const xControlComp( xCtrl, UNO_QUERY_THROW );
+ xControlComp->dispose();
+ }
+ catch( Exception const & )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
}
void ControlContainerBase::ImplSetPosSize( Reference< XControl >& rxCtrl )
@@ -1549,7 +1562,16 @@ void ControlContainerBase::elementInserted( const ContainerEvent& Event ) throw(
Event.Accessor >>= aName;
Event.Element >>= xModel;
- ImplInsertControl( xModel, aName );
+ ENSURE_OR_RETURN_VOID( xModel.is(), "UnoDialogControl::elementInserted: illegal element!" );
+ try
+ {
+ ImplInsertControl( xModel, aName );
+ }
+ catch ( const RuntimeException& e ) { throw; }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
void ControlContainerBase::elementRemoved( const ContainerEvent& Event ) throw(RuntimeException)
@@ -1558,8 +1580,16 @@ void ControlContainerBase::elementRemoved( const ContainerEvent& Event ) throw(R
Reference< XControlModel > xModel;
Event.Element >>= xModel;
- if ( xModel.is() )
+ ENSURE_OR_RETURN_VOID( xModel.is(), "UnoDialogControl::elementRemoved: illegal element!" );
+ try
+ {
ImplRemoveControl( xModel );
+ }
+ catch ( const RuntimeException& e ) { throw; }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
void ControlContainerBase::elementReplaced( const ContainerEvent& Event ) throw(RuntimeException)
@@ -1568,13 +1598,31 @@ void ControlContainerBase::elementReplaced( const ContainerEvent& Event ) throw(
Reference< XControlModel > xModel;
Event.ReplacedElement >>= xModel;
- if ( xModel.is() )
- ImplRemoveControl( xModel );
+ try
+ {
+ OSL_ENSURE( xModel.is(), "UnoDialogControl::elementReplaced: invalid ReplacedElement!" );
+ if ( xModel.is() )
+ ImplRemoveControl( xModel );
+ }
+ catch ( const RuntimeException& e ) { throw; }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
::rtl::OUString aName;
Event.Accessor >>= aName;
Event.Element >>= xModel;
- ImplInsertControl( xModel, aName );
+ ENSURE_OR_RETURN_VOID( xModel.is(), "UnoDialogControl::elementReplaced: invalid new element!" );
+ try
+ {
+ ImplInsertControl( xModel, aName );
+ }
+ catch ( const RuntimeException& e ) { throw; }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
// XPropertiesChangeListener
@@ -1761,9 +1809,8 @@ uno::Reference< graphic::XGraphic > ControlContainerBase::Impl_getGraphicFromURL
try
{
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
uno::Reference< graphic::XGraphicProvider > xProvider;
- if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
+ if ( maContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
{
uno::Sequence< beans::PropertyValue > aMediaProperties(1);
aMediaProperties[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
index 15eeb2aa1939..556acbf5d0d2 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -76,7 +76,8 @@ using namespace ::com::sun::star::util;
// ----------------------------------------------------
// class UnoControlDialogModel
// ----------------------------------------------------
-UnoControlDialogModel::UnoControlDialogModel()
+UnoControlDialogModel::UnoControlDialogModel( const Reference< XMultiServiceFactory >& i_factory )
+ :ControlModelContainerBase( i_factory )
{
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
// ImplRegisterProperty( BASEPROPERTY_BORDER );
@@ -163,9 +164,10 @@ Reference< XPropertySetInfo > UnoControlDialogModel::getPropertySetInfo( ) thro
// = class UnoDialogControl
// ============================================================================
-UnoDialogControl::UnoDialogControl() :
- maTopWindowListeners( *this ),
- mbWindowListener(false)
+UnoDialogControl::UnoDialogControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
+ :UnoDialogControl_Base( i_factory )
+ ,maTopWindowListeners( *this )
+ ,mbWindowListener(false)
{
maComponentInfos.nWidth = 300;
maComponentInfos.nHeight = 450;
@@ -186,24 +188,6 @@ UnoDialogControl::~UnoDialogControl()
return ::rtl::OUString::createFromAscii( "TabPage" );
}
-// XInterface
-Any UnoDialogControl::queryAggregation( const Type & rType ) throw(RuntimeException)
-{
- uno::Any aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( awt::XTopWindow*, this ) );
- if ( !aRet.hasValue() )
- aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( awt::XDialog*, this ) );
- if ( !aRet.hasValue() )
- aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( awt::XWindowListener*, this ) );
- return (aRet.hasValue() ? aRet : ControlContainerBase::queryAggregation( rType ));
-}
-//lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( UnoDialogControl)
- getCppuType( ( uno::Reference< awt::XTopWindow>* ) NULL ),
- getCppuType( ( uno::Reference< awt::XDialog>* ) NULL ),
- getCppuType( ( uno::Reference< awt::XWindowListener>* ) NULL ),
- ControlContainerBase::getTypes()
-IMPL_XTYPEPROVIDER_END
-
void UnoDialogControl::dispose() throw(RuntimeException)
{
vos::OGuard aSolarGuard( Application::GetSolarMutex() );
@@ -406,18 +390,30 @@ throw (::com::sun::star::uno::RuntimeException)
}
}
-void SAL_CALL UnoDialogControl::windowShown( const ::com::sun::star::lang::EventObject& e )
-throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL UnoDialogControl::windowShown( const EventObject& e ) throw (RuntimeException)
{
(void)e;
}
-void SAL_CALL UnoDialogControl::windowHidden( const ::com::sun::star::lang::EventObject& e )
-throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL UnoDialogControl::windowHidden( const EventObject& e ) throw (RuntimeException)
{
(void)e;
}
+void SAL_CALL UnoDialogControl::endDialog( ::sal_Int32 i_result ) throw (RuntimeException)
+{
+ Reference< XDialog2 > xPeerDialog( getPeer(), UNO_QUERY );
+ if ( xPeerDialog.is() )
+ xPeerDialog->endDialog( i_result );
+}
+
+void SAL_CALL UnoDialogControl::setHelpId( const rtl::OUString& i_id ) throw (RuntimeException)
+{
+ Reference< XDialog2 > xPeerDialog( getPeer(), UNO_QUERY );
+ if ( xPeerDialog.is() )
+ xPeerDialog->setHelpId( i_id );
+}
+
void UnoDialogControl::setTitle( const ::rtl::OUString& Title ) throw(RuntimeException)
{
vos::OGuard aSolarGuard( Application::GetSolarMutex() );
diff --git a/toolkit/source/controls/formattedcontrol.cxx b/toolkit/source/controls/formattedcontrol.cxx
index e9de3c5fac77..fb2d0f720c2e 100644
--- a/toolkit/source/controls/formattedcontrol.cxx
+++ b/toolkit/source/controls/formattedcontrol.cxx
@@ -125,8 +125,9 @@ namespace toolkit
// = UnoControlFormattedFieldModel
// ===================================================================
// -------------------------------------------------------------------
- UnoControlFormattedFieldModel::UnoControlFormattedFieldModel()
- :m_bRevokedAsClient( false )
+ UnoControlFormattedFieldModel::UnoControlFormattedFieldModel( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
+ ,m_bRevokedAsClient( false )
,m_bSettingValueAndText( false )
{
ImplRegisterProperty( BASEPROPERTY_ALIGN );
@@ -433,7 +434,8 @@ namespace toolkit
// = UnoFormattedFieldControl
// ===================================================================
// -------------------------------------------------------------------
- UnoFormattedFieldControl::UnoFormattedFieldControl()
+ UnoFormattedFieldControl::UnoFormattedFieldControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoSpinFieldControl( i_factory )
{
}
diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
index 011f3502cdd8..0195ddff09a2 100644
--- a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
+++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
@@ -27,174 +27,366 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_toolkit.hxx"
+
#include "defaultgridcolumnmodel.hxx"
-#include <comphelper/sequence.hxx>
-#include <toolkit/helper/servicenames.hxx>
+#include "gridcolumn.hxx"
+
+/** === begin UNO includes === **/
#include <com/sun/star/awt/XVclWindowPeer.hpp>
-#include <rtl/ref.hxx>
+/** === end UNO includes === **/
-using ::rtl::OUString;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::awt;
-using namespace ::com::sun::star::awt::grid;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::style;
+#include <comphelper/sequence.hxx>
+#include <comphelper/componentguard.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <tools/diagnose_ex.h>
+//......................................................................................................................
namespace toolkit
+//......................................................................................................................
{
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::awt::grid::XGridColumn;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::lang::XComponent;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::container::XContainerListener;
+ using ::com::sun::star::container::ContainerEvent;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::lang::IndexOutOfBoundsException;
+ using ::com::sun::star::util::XCloneable;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= DefaultGridColumnModel
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ DefaultGridColumnModel::DefaultGridColumnModel( const Reference< XMultiServiceFactory >& i_factory )
+ :DefaultGridColumnModel_Base( m_aMutex )
+ ,m_aContext( i_factory )
+ ,m_aContainerListeners( m_aMutex )
+ ,m_aColumns()
+ {
+ }
-///////////////////////////////////////////////////////////////////////
-// class DefaultGridColumnModel
-///////////////////////////////////////////////////////////////////////
-
-DefaultGridColumnModel::DefaultGridColumnModel(const Reference< XMultiServiceFactory >& xFactory)
-: columns(std::vector< Reference< XGridColumn > >())
- ,m_nColumnHeaderHeight(0)
- ,m_xFactory(xFactory)
-{
-}
+ //------------------------------------------------------------------------------------------------------------------
+ DefaultGridColumnModel::DefaultGridColumnModel( DefaultGridColumnModel const & i_copySource )
+ :cppu::BaseMutex()
+ ,DefaultGridColumnModel_Base( m_aMutex )
+ ,m_aContext( i_copySource.m_aContext )
+ ,m_aContainerListeners( m_aMutex )
+ ,m_aColumns()
+ {
+ Columns aColumns;
+ aColumns.reserve( i_copySource.m_aColumns.size() );
+ try
+ {
+ for ( Columns::const_iterator col = i_copySource.m_aColumns.begin();
+ col != i_copySource.m_aColumns.end();
+ ++col
+ )
+ {
+ Reference< XCloneable > const xCloneable( *col, UNO_QUERY_THROW );
+ Reference< XGridColumn > const xClone( xCloneable->createClone(), UNO_QUERY_THROW );
+
+ GridColumn* const pGridColumn = GridColumn::getImplementation( xClone );
+ if ( pGridColumn == NULL )
+ throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "invalid clone source implementation" ) ), *this );
+ // that's indeed a RuntimeException, not an IllegalArgumentException or some such:
+ // a DefaultGridColumnModel implementation whose columns are not GridColumn implementations
+ // is borked.
+ pGridColumn->setIndex( col - i_copySource.m_aColumns.begin() );
+
+ aColumns.push_back( xClone );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ if ( aColumns.size() == i_copySource.m_aColumns.size() )
+ m_aColumns.swap( aColumns );
+ }
-//---------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ DefaultGridColumnModel::~DefaultGridColumnModel()
+ {
+ }
-DefaultGridColumnModel::~DefaultGridColumnModel()
-{
-}
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL DefaultGridColumnModel::getColumnCount() throw (RuntimeException)
+ {
+ return m_aColumns.size();
+ }
-//---------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XGridColumn > SAL_CALL DefaultGridColumnModel::createColumn( ) throw (RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return new GridColumn();
+ }
-::sal_Int32 SAL_CALL DefaultGridColumnModel::getColumnCount() throw (::com::sun::star::uno::RuntimeException)
-{
- return columns.size();
-}
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL DefaultGridColumnModel::addColumn( const Reference< XGridColumn > & i_column ) throw (RuntimeException, IllegalArgumentException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
-//---------------------------------------------------------------------
+ GridColumn* const pGridColumn = GridColumn::getImplementation( i_column );
+ if ( pGridColumn == NULL )
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "invalid column implementation" ) ), *this, 1 );
-::sal_Int32 SAL_CALL DefaultGridColumnModel::addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- Reference<XGridColumn> xColumn(column);
- columns.push_back(xColumn);
- sal_Int32 index = columns.size() - 1;
- xColumn->setIndex(index);
- return index;
-}
+ m_aColumns.push_back( i_column );
+ sal_Int32 index = m_aColumns.size() - 1;
+ pGridColumn->setIndex( index );
-//---------------------------------------------------------------------
+ // fire insertion notifications
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Accessor <<= index;
+ aEvent.Element <<= i_column;
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > SAL_CALL DefaultGridColumnModel::getColumns() throw (::com::sun::star::uno::RuntimeException)
-{
- return comphelper::containerToSequence(columns);
-}
+ aGuard.clear();
+ m_aContainerListeners.notifyEach( &XContainerListener::elementInserted, aEvent );
-//---------------------------------------------------------------------
+ return index;
+ }
-::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL DefaultGridColumnModel::getColumn(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
-{
- if ( index >=0 && index < ((sal_Int32)columns.size()))
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridColumnModel::removeColumn( ::sal_Int32 i_columnIndex ) throw (RuntimeException, IndexOutOfBoundsException)
{
- return columns[index];
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+
+ if ( ( i_columnIndex < 0 ) || ( size_t( i_columnIndex ) >= m_aColumns.size() ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
+
+ Columns::iterator const pos = m_aColumns.begin() + i_columnIndex;
+ Reference< XGridColumn > const xColumn( *pos );
+ m_aColumns.erase( pos );
+
+ // update indexes of all subsequent columns
+ sal_Int32 columnIndex( i_columnIndex );
+ for ( Columns::iterator updatePos = m_aColumns.begin() + columnIndex;
+ updatePos != m_aColumns.end();
+ ++updatePos, ++columnIndex
+ )
+ {
+ GridColumn* pColumnImpl = GridColumn::getImplementation( *updatePos );
+ ENSURE_OR_CONTINUE( pColumnImpl, "DefaultGridColumnModel::removeColumn: invalid column implementation!" );
+ pColumnImpl->setIndex( columnIndex );
+ }
+
+ // fire removal notifications
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Accessor <<= i_columnIndex;
+ aEvent.Element <<= xColumn;
+
+ aGuard.clear();
+ m_aContainerListeners.notifyEach( &XContainerListener::elementRemoved, aEvent );
+
+ // dispose the removed column
+ try
+ {
+ Reference< XComponent > const xColComp( xColumn, UNO_QUERY_THROW );
+ xColComp->dispose();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
- else
- return Reference< XGridColumn >();
-}
-//---------------------------------------------------------------------
-void SAL_CALL DefaultGridColumnModel::setColumnHeaderHeight(sal_Int32 _value) throw (::com::sun::star::uno::RuntimeException)
-{
- m_nColumnHeaderHeight = _value;
-}
-//---------------------------------------------------------------------
-sal_Int32 SAL_CALL DefaultGridColumnModel::getColumnHeaderHeight() throw (::com::sun::star::uno::RuntimeException)
-{
- return m_nColumnHeaderHeight;
-}
-
-//---------------------------------------------------------------------
-void SAL_CALL DefaultGridColumnModel::setDefaultColumns(sal_Int32 rowElements) throw (::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- for(sal_Int32 i=0;i<rowElements;i++)
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< Reference< XGridColumn > > SAL_CALL DefaultGridColumnModel::getColumns() throw (RuntimeException)
{
- Reference<XGridColumn> xColumn( m_xFactory->createInstance ( OUString::createFromAscii( "com.sun.star.awt.grid.GridColumn" ) ), UNO_QUERY );
- columns.push_back(xColumn);
- xColumn->setIndex(i);
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return ::comphelper::containerToSequence( m_aColumns );
}
-}
-::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL DefaultGridColumnModel::copyColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException)
-{
- Reference<XGridColumn> xColumn( m_xFactory->createInstance ( OUString::createFromAscii( "com.sun.star.awt.grid.GridColumn" ) ), UNO_QUERY );
- xColumn->setColumnWidth(column->getColumnWidth());
- xColumn->setPreferredWidth(column->getPreferredWidth());
- xColumn->setMaxWidth(column->getMaxWidth());
- xColumn->setMinWidth(column->getMinWidth());
- xColumn->setPreferredWidth(column->getPreferredWidth());
- xColumn->setResizeable(column->getResizeable());
- xColumn->setTitle(column->getTitle());
- xColumn->setHorizontalAlign(column->getHorizontalAlign());
- return xColumn;
-}
-//---------------------------------------------------------------------
-// XComponent
-//---------------------------------------------------------------------
-
-void SAL_CALL DefaultGridColumnModel::dispose() throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- ::com::sun::star::lang::EventObject aEvent;
- aEvent.Source.set( static_cast< ::cppu::OWeakObject* >( this ) );
- BrdcstHelper.aLC.disposeAndClear( aEvent );
-
-}
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XGridColumn > SAL_CALL DefaultGridColumnModel::getColumn(::sal_Int32 index) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
-//---------------------------------------------------------------------
+ if ( index >=0 && index < ((sal_Int32)m_aColumns.size()))
+ return m_aColumns[index];
-void SAL_CALL DefaultGridColumnModel::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
-{
- BrdcstHelper.addListener( XEventListener::static_type(), xListener );
-}
+ throw IndexOutOfBoundsException();
+ }
-//---------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridColumnModel::setDefaultColumns(sal_Int32 rowElements) throw (RuntimeException)
+ {
+ ::std::vector< ContainerEvent > aRemovedColumns;
+ ::std::vector< ContainerEvent > aInsertedColumns;
+
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+
+ // remove existing columns
+ while ( !m_aColumns.empty() )
+ {
+ const size_t lastColIndex = m_aColumns.size() - 1;
+
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Accessor <<= sal_Int32( lastColIndex );
+ aEvent.Element <<= m_aColumns[ lastColIndex ];
+ aRemovedColumns.push_back( aEvent );
+
+ m_aColumns.erase( m_aColumns.begin() + lastColIndex );
+ }
+
+ // add new columns
+ for ( sal_Int32 i=0; i<rowElements; ++i )
+ {
+ ::rtl::Reference< GridColumn > const pGridColumn = new GridColumn();
+ Reference< XGridColumn > const xColumn( pGridColumn.get() );
+ ::rtl::OUStringBuffer colTitle;
+ colTitle.appendAscii( "Column " );
+ colTitle.append( i + 1 );
+ pGridColumn->setTitle( colTitle.makeStringAndClear() );
+ pGridColumn->setColumnWidth( 80 /* APPFONT */ );
+ pGridColumn->setFlexibility( 1 );
+ pGridColumn->setResizeable( sal_True );
+ pGridColumn->setDataColumnIndex( i );
+
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Accessor <<= i;
+ aEvent.Element <<= xColumn;
+ aInsertedColumns.push_back( aEvent );
+
+ m_aColumns.push_back( xColumn );
+ pGridColumn->setIndex( i );
+ }
+ }
+
+ // fire removal notifications
+ for ( ::std::vector< ContainerEvent >::const_iterator event = aRemovedColumns.begin();
+ event != aRemovedColumns.end();
+ ++event
+ )
+ {
+ m_aContainerListeners.notifyEach( &XContainerListener::elementRemoved, *event );
+ }
+
+ // fire insertion notifications
+ for ( ::std::vector< ContainerEvent >::const_iterator event = aInsertedColumns.begin();
+ event != aInsertedColumns.end();
+ ++event
+ )
+ {
+ m_aContainerListeners.notifyEach( &XContainerListener::elementInserted, *event );
+ }
+
+ // dispose removed columns
+ for ( ::std::vector< ContainerEvent >::const_iterator event = aRemovedColumns.begin();
+ event != aRemovedColumns.end();
+ ++event
+ )
+ {
+ try
+ {
+ const Reference< XComponent > xColComp( event->Element, UNO_QUERY_THROW );
+ xColComp->dispose();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
-void SAL_CALL DefaultGridColumnModel::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
-{
- BrdcstHelper.removeListener( XEventListener::static_type(), xListener );
-}
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL DefaultGridColumnModel::getImplementationName( ) throw (RuntimeException)
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.toolkit.DefaultGridColumnModel" ) );
+ }
-//---------------------------------------------------------------------
-// XServiceInfo
-//---------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool SAL_CALL DefaultGridColumnModel::supportsService( const ::rtl::OUString& i_serviceName ) throw (RuntimeException)
+ {
+ const Sequence< ::rtl::OUString > aServiceNames( getSupportedServiceNames() );
+ for ( sal_Int32 i=0; i<aServiceNames.getLength(); ++i )
+ if ( aServiceNames[i] == i_serviceName )
+ return sal_True;
+ return sal_False;
+ }
-::rtl::OUString SAL_CALL DefaultGridColumnModel::getImplementationName( ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- static const OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "toolkit.DefaultGridColumnModel" ) );
- return aImplName;
-}
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL DefaultGridColumnModel::getSupportedServiceNames( ) throw (RuntimeException)
+ {
+ const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( szServiceName_DefaultGridColumnModel ) );
+ const Sequence< ::rtl::OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+ }
-//---------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridColumnModel::addContainerListener( const Reference< XContainerListener >& i_listener ) throw (RuntimeException)
+ {
+ if ( i_listener.is() )
+ m_aContainerListeners.addInterface( i_listener );
+ }
-sal_Bool SAL_CALL DefaultGridColumnModel::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- return ServiceName.equalsAscii( szServiceName_DefaultGridColumnModel );
-}
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridColumnModel::removeContainerListener( const Reference< XContainerListener >& i_listener ) throw (RuntimeException)
+ {
+ if ( i_listener.is() )
+ m_aContainerListeners.removeInterface( i_listener );
+ }
-//---------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridColumnModel::disposing()
+ {
+ DefaultGridColumnModel_Base::disposing();
+
+ EventObject aEvent( *this );
+ m_aContainerListeners.disposeAndClear( aEvent );
+
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ // remove, dispose and clear columns
+ while ( !m_aColumns.empty() )
+ {
+ try
+ {
+ const Reference< XComponent > xColComponent( m_aColumns[ 0 ], UNO_QUERY_THROW );
+ xColComponent->dispose();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ m_aColumns.erase( m_aColumns.begin() );
+ }
+
+ Columns aEmpty;
+ m_aColumns.swap( aEmpty );
+ }
-::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL DefaultGridColumnModel::getSupportedServiceNames( ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- static const OUString aServiceName( OUString::createFromAscii( szServiceName_DefaultGridColumnModel ) );
- static const Sequence< OUString > aSeq( &aServiceName, 1 );
- return aSeq;
-}
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XCloneable > SAL_CALL DefaultGridColumnModel::createClone( ) throw (RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return new DefaultGridColumnModel( *this );
+ }
-}
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
-Reference< XInterface > SAL_CALL DefaultGridColumnModel_CreateInstance( const Reference< XMultiServiceFactory >& _rFactory)
+//----------------------------------------------------------------------------------------------------------------------
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DefaultGridColumnModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rFactory)
{
- return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridColumnModel( _rFactory ) );
+ return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridColumnModel( _rFactory ) );
}
-
diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx
index 8b8c8bfc795c..da0ef20e3287 100644
--- a/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx
+++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx
@@ -25,76 +25,73 @@
*
************************************************************************/
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_toolkit.hxx"
+/** === begin UNO includes === **/
#include <com/sun/star/awt/grid/XGridColumnModel.hpp>
#include <com/sun/star/awt/grid/XGridColumn.hpp>
-//#include <com/sun/star/awt/grid/GridColumnEvent.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <cppuhelper/implbase2.hxx>
-#include <cppuhelper/implbase3.hxx>
-#include <rtl/ref.hxx>
-#include <vector>
-#include <toolkit/helper/mutexandbroadcasthelper.hxx>
-#include <com/sun/star/util/Color.hpp>
#include <com/sun/star/style/VerticalAlignment.hpp>
-#include <com/sun/star/awt/grid/XGridColumnListener.hpp>
+#include <com/sun/star/util/Color.hpp>
+/** === end UNO includes === **/
-using ::rtl::OUString;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::awt;
-using namespace ::com::sun::star::awt::grid;
-using namespace ::com::sun::star::lang;
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <vector>
+
+namespace comphelper
+{
+ class ComponentGuard;
+}
namespace toolkit
{
//enum broadcast_type { column_added, column_removed, column_changed};
-class DefaultGridColumnModel : public ::cppu::WeakImplHelper2< XGridColumnModel, XServiceInfo >,
- public MutexAndBroadcastHelper
+typedef ::cppu::WeakComponentImplHelper2 < ::com::sun::star::awt::grid::XGridColumnModel
+ , ::com::sun::star::lang::XServiceInfo
+ > DefaultGridColumnModel_Base;
+
+class DefaultGridColumnModel :public ::cppu::BaseMutex
+ ,public DefaultGridColumnModel_Base
{
public:
- DefaultGridColumnModel(const Reference< XMultiServiceFactory >& xFactory);
+ DefaultGridColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+ DefaultGridColumnModel( DefaultGridColumnModel const & i_copySource );
virtual ~DefaultGridColumnModel();
// XGridColumnModel
-
- //virtual ::sal_Bool SAL_CALL getColumnSelectionAllowed() throw (::com::sun::star::uno::RuntimeException);
- //virtual void SAL_CALL setColumnSelectionAllowed(::sal_Bool the_value) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getColumnCount() throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL createColumn( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException);
+ virtual void SAL_CALL removeColumn( ::sal_Int32 i_columnIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException);
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > SAL_CALL getColumns() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL getColumn(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
- //virtual void SAL_CALL addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException);
- //virtual void SAL_CALL removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException);
- virtual void SAL_CALL setColumnHeaderHeight( sal_Int32 _value) throw (com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getColumnHeaderHeight() throw (com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL getColumn(::sal_Int32 index) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setDefaultColumns(sal_Int32 rowElements) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL copyColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException);
- // XComponent
- virtual void SAL_CALL dispose( ) throw (RuntimeException);
- virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException);
- virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException);
// XServiceInfo
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
-private:
- /*void broadcast( broadcast_type eType, const GridColumnEvent& aEvent );
- void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue, sal_Int32 index,const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn );
- void broadcast_add( sal_Int32 index,const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn );
- void broadcast_remove( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn );*/
+ // XContainer
+ virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XCloneable
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+private:
+ typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > Columns;
- std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > columns;
- sal_Bool selectionAllowed;
- sal_Int32 m_nColumnHeaderHeight;
- Reference< XMultiServiceFactory > m_xFactory;
+ ::comphelper::ComponentContext m_aContext;
+ ::cppu::OInterfaceContainerHelper m_aContainerListeners;
+ Columns m_aColumns;
};
}
diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.cxx b/toolkit/source/controls/grid/defaultgriddatamodel.cxx
index adc40b0426d7..4ef99d749ba1 100644
--- a/toolkit/source/controls/grid/defaultgriddatamodel.cxx
+++ b/toolkit/source/controls/grid/defaultgriddatamodel.cxx
@@ -27,318 +27,411 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_toolkit.hxx"
+
#include "defaultgriddatamodel.hxx"
-#include <comphelper/sequence.hxx>
+
+#include <comphelper/stlunosequence.hxx>
+#include <comphelper/componentguard.hxx>
#include <toolkit/helper/servicenames.hxx>
+#include <tools/diagnose_ex.h>
#include <rtl/ref.hxx>
-using ::rtl::OUString;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::awt;
-using namespace ::com::sun::star::awt::grid;
-using namespace ::com::sun::star::lang;
-
-#define ROWHEIGHT ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowHeight" ))
-#define ROWHEADERS ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowHeaders" ))
-#define CELLUPDATED ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CellUpdated" ))
-#define ROWUPDATED ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowUpdated" ))
-#define ROWHEADERWIDTH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowHeaderWidth" ))
+#include <algorithm>
+//......................................................................................................................
namespace toolkit
+//......................................................................................................................
{
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::lang::XComponent;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::util::XCloneable;
+ /** === end UNO using === **/
+
+ using ::comphelper::stl_begin;
+ using ::comphelper::stl_end;
+
+ //==================================================================================================================
+ //= DefaultGridDataModel
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ DefaultGridDataModel::DefaultGridDataModel()
+ :DefaultGridDataModel_Base( m_aMutex )
+ ,m_aRowHeaders()
+ ,m_nColumnCount(0)
+ {
+ }
-///////////////////////////////////////////////////////////////////////
-// class DefaultGridDataModel
-///////////////////////////////////////////////////////////////////////
+ //------------------------------------------------------------------------------------------------------------------
+ DefaultGridDataModel::DefaultGridDataModel( DefaultGridDataModel const & i_copySource )
+ :cppu::BaseMutex()
+ ,DefaultGridDataModel_Base( m_aMutex )
+ ,m_aData( i_copySource.m_aData )
+ ,m_aRowHeaders( i_copySource.m_aRowHeaders )
+ ,m_nColumnCount( i_copySource.m_nColumnCount )
+ {
+ }
-DefaultGridDataModel::DefaultGridDataModel()
-: rowHeight(0),
- rowHeaders(std::vector< ::rtl::OUString >()),
- m_nRowHeaderWidth(10)
-{
-}
+ //------------------------------------------------------------------------------------------------------------------
+ DefaultGridDataModel::~DefaultGridDataModel()
+ {
+ }
-//---------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ void DefaultGridDataModel::broadcast( GridDataEvent const & i_event,
+ void ( SAL_CALL XGridDataListener::*i_listenerMethod )( GridDataEvent const & ), ::comphelper::ComponentGuard & i_instanceLock )
+ {
+ ::cppu::OInterfaceContainerHelper* pListeners = rBHelper.getContainer( XGridDataListener::static_type() );
+ if ( !pListeners )
+ return;
-DefaultGridDataModel::~DefaultGridDataModel()
-{
-}
+ i_instanceLock.clear();
+ pListeners->notifyEach( i_listenerMethod, i_event );
+ }
-void DefaultGridDataModel::broadcast( broadcast_type eType, const GridDataEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException)
-{
- ::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( XGridDataListener::static_type() );
- if( pIter )
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL DefaultGridDataModel::getRowCount() throw (::com::sun::star::uno::RuntimeException)
{
- ::cppu::OInterfaceIteratorHelper aListIter(*pIter);
- while(aListIter.hasMoreElements())
- {
- XGridDataListener* pListener = static_cast<XGridDataListener*>(aListIter.next());
- switch( eType )
- {
- case row_added: pListener->rowAdded(aEvent); break;
- case row_removed: pListener->rowRemoved(aEvent); break;
- case data_changed: pListener->dataChanged(aEvent); break;
- }
- }
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_aData.size();
}
-}
-//---------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL DefaultGridDataModel::getColumnCount() throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_nColumnCount;
+ }
-void DefaultGridDataModel::broadcast_changed( ::rtl::OUString name, sal_Int32 index, Any oldValue, Any newValue) throw (::com::sun::star::uno::RuntimeException)
-{
- Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- GridDataEvent aEvent( xSource, name, oldValue, newValue, index, ::rtl::OUString(), Sequence< Any >());
- broadcast( data_changed, aEvent);
-}
+ //------------------------------------------------------------------------------------------------------------------
+ DefaultGridDataModel::CellData const & DefaultGridDataModel::impl_getCellData_throw( sal_Int32 const i_column, sal_Int32 const i_row ) const
+ {
+ if ( ( i_row < 0 ) || ( size_t( i_row ) > m_aData.size() )
+ || ( i_column < 0 ) || ( i_column > m_nColumnCount )
+ )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *const_cast< DefaultGridDataModel* >( this ) );
-//---------------------------------------------------------------------
+ RowData const & rRow( m_aData[ i_row ] );
+ if ( size_t( i_column ) < rRow.size() )
+ return rRow[ i_column ];
-void DefaultGridDataModel::broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName,
- ::com::sun::star::uno::Sequence< Any > rowData ) throw (::com::sun::star::uno::RuntimeException)
-{
- Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- GridDataEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, headerName, (const ::com::sun::star::uno::Sequence< Any >&)rowData );
- broadcast( row_added, aEvent);
-}
+ static CellData s_aEmpty;
+ return s_aEmpty;
+ }
-//---------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ DefaultGridDataModel::RowData& DefaultGridDataModel::impl_getRowDataAccess_throw( sal_Int32 const i_rowIndex, size_t const i_requiredColumnCount )
+ {
+ OSL_ENSURE( i_requiredColumnCount <= size_t( m_nColumnCount ), "DefaultGridDataModel::impl_getRowDataAccess_throw: invalid column count!" );
+ if ( ( i_rowIndex < 0 ) || ( size_t( i_rowIndex ) >= m_aData.size() ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
+
+ RowData& rRowData( m_aData[ i_rowIndex ] );
+ if ( rRowData.size() < i_requiredColumnCount )
+ rRowData.resize( i_requiredColumnCount );
+ return rRowData;
+ }
-void DefaultGridDataModel::broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName,
- ::com::sun::star::uno::Sequence< Any > rowData ) throw (::com::sun::star::uno::RuntimeException)
-{
- Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- GridDataEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, headerName, rowData );
- broadcast( row_removed, aEvent);
-}
+ //------------------------------------------------------------------------------------------------------------------
+ DefaultGridDataModel::CellData& DefaultGridDataModel::impl_getCellDataAccess_throw( sal_Int32 const i_columnIndex, sal_Int32 const i_rowIndex )
+ {
+ if ( ( i_columnIndex < 0 ) || ( i_columnIndex >= m_nColumnCount ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
-//---------------------------------------------------------------------
+ RowData& rRowData( impl_getRowDataAccess_throw( i_rowIndex, size_t( i_columnIndex + 1 ) ) );
+ return rRowData[ i_columnIndex ];
+ }
-//---------------------------------------------------------------------
-// XDefaultGridDataModel
-//---------------------------------------------------------------------
-::sal_Int32 SAL_CALL DefaultGridDataModel::getRowHeight() throw (::com::sun::star::uno::RuntimeException)
-{
- return rowHeight;
-}
+ //------------------------------------------------------------------------------------------------------------------
+ Any SAL_CALL DefaultGridDataModel::getCellData( ::sal_Int32 i_column, ::sal_Int32 i_row ) throw (RuntimeException, IndexOutOfBoundsException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return impl_getCellData_throw( i_column, i_row ).first;
+ }
-//---------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ Any SAL_CALL DefaultGridDataModel::getCellToolTip( ::sal_Int32 i_column, ::sal_Int32 i_row ) throw (RuntimeException, IndexOutOfBoundsException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return impl_getCellData_throw( i_column, i_row ).second;
+ }
-void SAL_CALL DefaultGridDataModel::setRowHeight(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
-{
- sal_Int32 oldValue = rowHeight;
- rowHeight = value;
+ //------------------------------------------------------------------------------------------------------------------
+ Any SAL_CALL DefaultGridDataModel::getRowHeading( ::sal_Int32 i_row ) throw (RuntimeException, IndexOutOfBoundsException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- broadcast_changed( ROWHEIGHT, 0, Any(oldValue), Any(value));
-}
+ if ( ( i_row < 0 ) || ( size_t( i_row ) >= m_aRowHeaders.size() ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
-//---------------------------------------------------------------------
+ return m_aRowHeaders[ i_row ];
+ }
-::sal_Int32 SAL_CALL DefaultGridDataModel::getRowCount() throw (::com::sun::star::uno::RuntimeException)
-{
- return data.size();
-}
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridDataModel::addRow( const Any& i_heading, const Sequence< Any >& i_data ) throw (RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
-//---------------------------------------------------------------------
+ sal_Int32 const columnCount = i_data.getLength();
-::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL DefaultGridDataModel::getRowHeaders() throw (::com::sun::star::uno::RuntimeException)
-{
- return comphelper::containerToSequence(rowHeaders);
-}
+ // store header name
+ m_aRowHeaders.push_back( i_heading );
-//---------------------------------------------------------------------
+ // store row m_aData
+ impl_addRow( i_data );
-void SAL_CALL DefaultGridDataModel::setRowHeaders(const ::com::sun::star::uno::Sequence< ::rtl::OUString > & value) throw (::com::sun::star::uno::RuntimeException)
-{
- ::com::sun::star::uno::Sequence< ::rtl::OUString > oldValue( comphelper::containerToSequence(rowHeaders) );
+ // update column count
+ if ( columnCount > m_nColumnCount )
+ m_nColumnCount = columnCount;
- std::vector< rtl::OUString>::iterator iterator;
- int i = 0;
- int sequenceSize = value.getLength();
+ sal_Int32 const rowIndex = sal_Int32( m_aData.size() - 1 );
+ broadcast(
+ GridDataEvent( *this, -1, -1, rowIndex, rowIndex ),
+ &XGridDataListener::rowsInserted,
+ aGuard
+ );
+ }
- for(iterator = rowHeaders.begin(); iterator != rowHeaders.end(); iterator++)
+ //------------------------------------------------------------------------------------------------------------------
+ void DefaultGridDataModel::impl_addRow( Sequence< Any > const & i_rowData, sal_Int32 const i_assumedColCount )
{
- if ( sequenceSize > i )
- *iterator = value[i];
- else
- *iterator = ::rtl::OUString();
- i++;
+ OSL_PRECOND( ( i_assumedColCount <= 0 ) || ( i_assumedColCount >= i_rowData.getLength() ),
+ "DefaultGridDataModel::impl_addRow: invalid column count!" );
+
+ RowData newRow( i_assumedColCount > 0 ? i_assumedColCount : i_rowData.getLength() );
+ RowData::iterator cellData = newRow.begin();
+ for ( const Any* pData = stl_begin( i_rowData ); pData != stl_end( i_rowData ); ++pData, ++cellData )
+ cellData->first = *pData;
+
+ m_aData.push_back( newRow );
}
- broadcast_changed( ROWHEADERS, 0, Any(oldValue), Any(comphelper::containerToSequence(rowHeaders)) );
-}
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridDataModel::addRows( const Sequence< Any >& i_headings, const Sequence< Sequence< Any > >& i_data ) throw (IllegalArgumentException, RuntimeException)
+ {
+ if ( i_headings.getLength() != i_data.getLength() )
+ throw IllegalArgumentException( ::rtl::OUString(), *this, -1 );
-//---------------------------------------------------------------------
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
-void SAL_CALL DefaultGridDataModel::addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< Any > & rRowdata) throw (::com::sun::star::uno::RuntimeException)
-{
- // store header name
- rowHeaders.push_back(headername);
+ sal_Int32 const rowCount = i_headings.getLength();
+ if ( rowCount == 0 )
+ return;
- // store row data
- std::vector< Any > newRow;
- for ( int i = 0; i < rRowdata.getLength();i++)
- {
- newRow.push_back(rRowdata[i]);
- }
+ // determine max col count in the new data
+ sal_Int32 maxColCount = 0;
+ for ( sal_Int32 row=0; row<rowCount; ++row )
+ if ( i_data[row].getLength() > maxColCount )
+ maxColCount = i_data[row].getLength();
- data.push_back( newRow );
+ if ( maxColCount < m_nColumnCount )
+ maxColCount = m_nColumnCount;
- broadcast_add( data.size()-1, headername, comphelper::containerToSequence(newRow));
+ for ( sal_Int32 row=0; row<rowCount; ++row )
+ {
+ m_aRowHeaders.push_back( i_headings[row] );
+ impl_addRow( i_data[row], maxColCount );
+ }
-}
+ if ( maxColCount > m_nColumnCount )
+ m_nColumnCount = maxColCount;
-//---------------------------------------------------------------------
+ sal_Int32 const firstRow = sal_Int32( m_aData.size() - rowCount );
+ sal_Int32 const lastRow = sal_Int32( m_aData.size() - 1 );
+ broadcast(
+ GridDataEvent( *this, -1, -1, firstRow, lastRow ),
+ &XGridDataListener::rowsInserted,
+ aGuard
+ );
+ }
-void SAL_CALL DefaultGridDataModel::removeRow(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
-{
- if ( index >= 0 && index <= getRowCount()-1)
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridDataModel::removeRow( ::sal_Int32 i_rowIndex ) throw (IndexOutOfBoundsException, RuntimeException)
{
- ::rtl::OUString headerName( (::rtl::OUString) rowHeaders[index] );
- rowHeaders.erase(rowHeaders.begin() + index);
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- Sequence< Any > rowData ( (Sequence< Any >&)data[index] );
- data.erase(data.begin() + index);
- broadcast_remove( index, headerName, rowData);
+ if ( ( i_rowIndex < 0 ) || ( size_t( i_rowIndex ) >= m_aData.size() ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
+
+ m_aRowHeaders.erase( m_aRowHeaders.begin() + i_rowIndex );
+ m_aData.erase( m_aData.begin() + i_rowIndex );
+
+ broadcast(
+ GridDataEvent( *this, -1, -1, i_rowIndex, i_rowIndex ),
+ &XGridDataListener::rowsRemoved,
+ aGuard
+ );
}
- else
- return;
-}
-//---------------------------------------------------------------------
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< Any > > SAL_CALL DefaultGridDataModel::getData() throw (::com::sun::star::uno::RuntimeException)
-{
- std::vector< std::vector< Any > >::iterator iterator;
- std::vector< Sequence< Any > > dummyContainer(0);
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridDataModel::removeAllRows( ) throw (RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+
+ m_aRowHeaders.clear();
+ m_aData.clear();
+ broadcast(
+ GridDataEvent( *this, -1, -1, -1, -1 ),
+ &XGridDataListener::rowsRemoved,
+ aGuard
+ );
+ }
- for(iterator = data.begin(); iterator != data.end(); iterator++)
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridDataModel::updateCellData( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex, const Any& i_value ) throw (IndexOutOfBoundsException, RuntimeException)
{
- Sequence< Any > cols(comphelper::containerToSequence(*iterator));
- dummyContainer.push_back( cols );
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+
+ impl_getCellDataAccess_throw( i_columnIndex, i_rowIndex ).first = i_value;
+
+ broadcast(
+ GridDataEvent( *this, i_columnIndex, i_columnIndex, i_rowIndex, i_rowIndex ),
+ &XGridDataListener::dataChanged,
+ aGuard
+ );
}
- Sequence< Sequence< Any > > dataSequence(comphelper::containerToSequence(dummyContainer));
- return dataSequence;
-}
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridDataModel::updateRowData( const Sequence< ::sal_Int32 >& i_columnIndexes, ::sal_Int32 i_rowIndex, const Sequence< Any >& i_values ) throw (IndexOutOfBoundsException, IllegalArgumentException, RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
-//---------------------------------------------------------------------
+ if ( ( i_rowIndex < 0 ) || ( size_t( i_rowIndex ) >= m_aData.size() ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
-void SAL_CALL DefaultGridDataModel::addDataListener( const Reference< XGridDataListener >& xListener ) throw (RuntimeException)
-{
- BrdcstHelper.addListener( XGridDataListener::static_type(), xListener );
-}
+ if ( i_columnIndexes.getLength() != i_values.getLength() )
+ throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
-//---------------------------------------------------------------------
+ sal_Int32 const columnCount = i_columnIndexes.getLength();
+ if ( columnCount == 0 )
+ return;
-void SAL_CALL DefaultGridDataModel::removeDataListener( const Reference< XGridDataListener >& xListener ) throw (RuntimeException)
-{
- BrdcstHelper.removeListener( XGridDataListener::static_type(), xListener );
-}
-//---------------------------------------------------------------------
-void SAL_CALL DefaultGridDataModel::removeAll() throw (RuntimeException)
-{
- rowHeaders.clear();
- data.clear();
- broadcast_remove( -1, ::rtl::OUString(), Sequence< Any >());
-}
-//---------------------------------------------------------------------
-void SAL_CALL DefaultGridDataModel::setRowHeaderWidth(sal_Int32 _value) throw (::com::sun::star::uno::RuntimeException)
-{
- sal_Int32 oldValue = m_nRowHeaderWidth;
- m_nRowHeaderWidth = _value;
- broadcast_changed( ROWHEADERWIDTH, 0, Any(oldValue), Any(_value) );
-}
-//---------------------------------------------------------------------
-sal_Int32 SAL_CALL DefaultGridDataModel::getRowHeaderWidth() throw (::com::sun::star::uno::RuntimeException)
-{
- return m_nRowHeaderWidth;
-}
-//---------------------------------------------------------------------
-void SAL_CALL DefaultGridDataModel::updateCell(::sal_Int32 row, ::sal_Int32 column, const Any& value) throw (::com::sun::star::uno::RuntimeException)
-{
- if(row >= 0 && row < (signed)data.size())
- {
- if(column >= 0 && column < (signed)data[0].size())
+ for ( sal_Int32 col = 0; col < columnCount; ++col )
{
- data[row][column] = value;
- Sequence< Any >dataSeq(comphelper::containerToSequence(data[row]));
- broadcast_changed( CELLUPDATED, row, Any(column), value );
+ if ( ( i_columnIndexes[col] < 0 ) || ( i_columnIndexes[col] > m_nColumnCount ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
}
- }
-}
-//---------------------------------------------------------------------
-void SAL_CALL DefaultGridDataModel::updateRow(::sal_Int32 row, const ::com::sun::star::uno::Sequence< ::sal_Int32 > & columns, const ::com::sun::star::uno::Sequence< Any > & values) throw (::com::sun::star::uno::RuntimeException)
-{
- if(row >= 0 && row < (signed)data.size())
- {
- if(columns.getLength() == values.getLength())
+
+ RowData& rDataRow = m_aData[ i_rowIndex ];
+ for ( sal_Int32 col = 0; col < columnCount; ++col )
{
- for(int i = 0; i < columns.getLength(); i++)
- data[row][i] = values[i];
- Sequence< Any >dataSeq(comphelper::containerToSequence(data[row]));
- broadcast_changed( ROWUPDATED, row, Any(columns), Any(values) );
+ sal_Int32 const columnIndex = i_columnIndexes[ col ];
+ if ( size_t( columnIndex ) >= rDataRow.size() )
+ rDataRow.resize( columnIndex + 1 );
+
+ rDataRow[ columnIndex ].first = i_values[ col ];
}
+
+ sal_Int32 const firstAffectedColumn = *::std::min_element( stl_begin( i_columnIndexes ), stl_end( i_columnIndexes ) );
+ sal_Int32 const lastAffectedColumn = *::std::max_element( stl_begin( i_columnIndexes ), stl_end( i_columnIndexes ) );
+ broadcast(
+ GridDataEvent( *this, firstAffectedColumn, lastAffectedColumn, i_rowIndex, i_rowIndex ),
+ &XGridDataListener::dataChanged,
+ aGuard
+ );
}
-}
-//---------------------------------------------------------------------
-// XComponent
-//---------------------------------------------------------------------
-void SAL_CALL DefaultGridDataModel::dispose() throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridDataModel::updateRowHeading( ::sal_Int32 i_rowIndex, const Any& i_heading ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- ::com::sun::star::lang::EventObject aEvent;
- aEvent.Source.set( static_cast< ::cppu::OWeakObject* >( this ) );
- BrdcstHelper.aLC.disposeAndClear( aEvent );
+ if ( ( i_rowIndex < 0 ) || ( size_t( i_rowIndex ) >= m_aRowHeaders.size() ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
-}
+ m_aRowHeaders[ i_rowIndex ] = i_heading;
-//---------------------------------------------------------------------
+ broadcast(
+ GridDataEvent( *this, -1, -1, i_rowIndex, i_rowIndex ),
+ &XGridDataListener::rowHeadingChanged,
+ aGuard
+ );
+ }
-void SAL_CALL DefaultGridDataModel::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
-{
- BrdcstHelper.addListener( XEventListener::static_type(), xListener );
-}
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridDataModel::updateCellToolTip( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex, const Any& i_value ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ impl_getCellDataAccess_throw( i_columnIndex, i_rowIndex ).second = i_value;
+ }
-//---------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridDataModel::updateRowToolTip( ::sal_Int32 i_rowIndex, const Any& i_value ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
-void SAL_CALL DefaultGridDataModel::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
-{
- BrdcstHelper.removeListener( XEventListener::static_type(), xListener );
-}
-//---------------------------------------------------------------------
-// XServiceInfo
-//---------------------------------------------------------------------
+ RowData& rRowData = impl_getRowDataAccess_throw( i_rowIndex, m_nColumnCount );
+ for ( RowData::iterator cell = rRowData.begin(); cell != rRowData.end(); ++cell )
+ cell->second = i_value;
+ }
-::rtl::OUString SAL_CALL DefaultGridDataModel::getImplementationName( ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- static const OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "toolkit.DefaultGridDataModel" ) );
- return aImplName;
-}
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridDataModel::addGridDataListener( const Reference< grid::XGridDataListener >& i_listener ) throw (RuntimeException)
+ {
+ rBHelper.addListener( XGridDataListener::static_type(), i_listener );
+ }
-//---------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridDataModel::removeGridDataListener( const Reference< grid::XGridDataListener >& i_listener ) throw (RuntimeException)
+ {
+ rBHelper.removeListener( XGridDataListener::static_type(), i_listener );
+ }
-sal_Bool SAL_CALL DefaultGridDataModel::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- return ServiceName.equalsAscii( szServiceName_DefaultGridDataModel );
-}
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridDataModel::disposing()
+ {
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source.set( *this );
+ rBHelper.aLC.disposeAndClear( aEvent );
-//---------------------------------------------------------------------
+ ::osl::MutexGuard aGuard( m_aMutex );
+ GridData aEmptyData;
+ m_aData.swap( aEmptyData );
-::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL DefaultGridDataModel::getSupportedServiceNames( ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- static const OUString aServiceName( OUString::createFromAscii( szServiceName_DefaultGridDataModel ) );
- static const Sequence< OUString > aSeq( &aServiceName, 1 );
- return aSeq;
-}
+ ::std::vector< Any > aEmptyRowHeaders;
+ m_aRowHeaders.swap( aEmptyRowHeaders );
-}
+ m_nColumnCount = 0;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL DefaultGridDataModel::getImplementationName( ) throw (RuntimeException)
+ {
+ static const ::rtl::OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "toolkit.DefaultGridDataModel" ) );
+ return aImplName;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool SAL_CALL DefaultGridDataModel::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException)
+ {
+ return ServiceName.equalsAscii( szServiceName_DefaultGridDataModel );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL DefaultGridDataModel::getSupportedServiceNames( ) throw (RuntimeException)
+ {
+ static const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( szServiceName_DefaultGridDataModel ) );
+ static const Sequence< ::rtl::OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XCloneable > SAL_CALL DefaultGridDataModel::createClone( ) throw (RuntimeException)
+ {
+ return new DefaultGridDataModel( *this );
+ }
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
Reference< XInterface > SAL_CALL DefaultGridDataModel_CreateInstance( const Reference< XMultiServiceFactory >& )
{
diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.hxx b/toolkit/source/controls/grid/defaultgriddatamodel.hxx
index ea11a8a9a00a..bf4b6cc3355e 100644
--- a/toolkit/source/controls/grid/defaultgriddatamodel.hxx
+++ b/toolkit/source/controls/grid/defaultgriddatamodel.hxx
@@ -25,60 +25,68 @@
*
************************************************************************/
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_toolkit.hxx"
-#include <com/sun/star/awt/grid/XGridDataModel.hpp>
-#include <com/sun/star/awt/grid/GridDataEvent.hpp>
-#include <com/sun/star/awt/grid/XGridDataListener.hpp>
-#include <com/sun/star/awt/XControl.hpp>
-#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/awt/grid/XMutableGridDataModel.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <cppuhelper/implbase2.hxx>
-#include <cppuhelper/implbase3.hxx>
-#include <rtl/ref.hxx>
-#include <vector>
+
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase2.hxx>
#include <toolkit/helper/mutexandbroadcasthelper.hxx>
-using ::rtl::OUString;
+#include <vector>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::awt::grid;
using namespace ::com::sun::star::lang;
+namespace comphelper
+{
+ class ComponentGuard;
+}
+
namespace toolkit
{
enum broadcast_type { row_added, row_removed, data_changed};
-class DefaultGridDataModel : public ::cppu::WeakImplHelper2< XGridDataModel, XServiceInfo >,
- public MutexAndBroadcastHelper
+typedef ::cppu::WeakComponentImplHelper2 < XMutableGridDataModel
+ , XServiceInfo
+ > DefaultGridDataModel_Base;
+
+class DefaultGridDataModel :public ::cppu::BaseMutex
+ ,public DefaultGridDataModel_Base
{
public:
DefaultGridDataModel();
+ DefaultGridDataModel( DefaultGridDataModel const & i_copySource );
virtual ~DefaultGridDataModel();
+ // XMutableGridDataModel
+ virtual void SAL_CALL addRow( const Any& i_heading, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Data ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>& Headings, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& Data ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeRow( ::sal_Int32 RowIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeAllRows( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateCellData( ::sal_Int32 ColumnIndex, ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateRowData( const ::com::sun::star::uno::Sequence< ::sal_Int32 >& ColumnIndexes, ::sal_Int32 RowIndex, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateRowHeading( ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Heading ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateCellToolTip( ::sal_Int32 ColumnIndex, ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateRowToolTip( ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addGridDataListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeGridDataListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+
// XGridDataModel
- virtual ::sal_Int32 SAL_CALL getRowHeight() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setRowHeight(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getRowCount() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getRowHeaders() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setRowHeaders(const ::com::sun::star::uno::Sequence< ::rtl::OUString > & value) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< Any > > SAL_CALL getData() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< Any > & data) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeRow(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addDataListener( const Reference< XGridDataListener >& xListener ) throw (RuntimeException);
- virtual void SAL_CALL removeDataListener( const Reference< XGridDataListener >& xListener ) throw (RuntimeException);
- virtual void SAL_CALL removeAll() throw (RuntimeException);
- virtual void SAL_CALL setRowHeaderWidth(sal_Int32 _value) throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getRowHeaderWidth() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateCell( ::sal_Int32 row, ::sal_Int32 column, const ::com::sun::star::uno::Any& value ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateRow( ::sal_Int32 row, const ::com::sun::star::uno::Sequence< ::sal_Int32 >& columns, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& values ) throw (::com::sun::star::uno::RuntimeException);
- // XComponent
- virtual void SAL_CALL dispose( ) throw (RuntimeException);
- virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException);
- virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getColumnCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getCellData( ::sal_Int32 Column, ::sal_Int32 Row ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getCellToolTip( ::sal_Int32 Column, ::sal_Int32 Row ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getRowHeading( ::sal_Int32 RowIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+ // XCloneable
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException);
// XServiceInfo
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException);
@@ -86,16 +94,25 @@ public:
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
private:
+ typedef ::std::pair< Any, Any > CellData;
+ typedef ::std::vector< CellData > RowData;
+ typedef ::std::vector< RowData > GridData;
+
+ void broadcast(
+ GridDataEvent const & i_event,
+ void ( SAL_CALL ::com::sun::star::awt::grid::XGridDataListener::*i_listenerMethod )( ::com::sun::star::awt::grid::GridDataEvent const & ),
+ ::comphelper::ComponentGuard & i_instanceLock
+ );
+
+ void impl_addRow( Sequence< Any > const & i_rowData, sal_Int32 const i_assumedColCount = -1 );
- void broadcast( broadcast_type eType, const GridDataEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException);
- void broadcast_changed( ::rtl::OUString name, sal_Int32 index, Any oldValue, Any newValue ) throw (::com::sun::star::uno::RuntimeException);
- void broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< Any > rowData ) throw (::com::sun::star::uno::RuntimeException);
- void broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< Any > rowData ) throw (::com::sun::star::uno::RuntimeException);
+ CellData const & impl_getCellData_throw( sal_Int32 const i_columnIndex, sal_Int32 const i_rowIndex ) const;
+ CellData& impl_getCellDataAccess_throw( sal_Int32 const i_columnIndex, sal_Int32 const i_rowIndex );
+ RowData& impl_getRowDataAccess_throw( sal_Int32 const i_rowIndex, size_t const i_requiredColumnCount );
- sal_Int32 rowHeight;
- std::vector< std::vector < Any > > data;
- std::vector< ::rtl::OUString > rowHeaders;
- sal_Int32 m_nRowHeaderWidth;
+ GridData m_aData;
+ ::std::vector< ::com::sun::star::uno::Any > m_aRowHeaders;
+ sal_Int32 m_nColumnCount;
};
}
diff --git a/toolkit/source/controls/grid/gridcolumn.cxx b/toolkit/source/controls/grid/gridcolumn.cxx
index 6720d639f5c1..c1216d53f328 100644
--- a/toolkit/source/controls/grid/gridcolumn.cxx
+++ b/toolkit/source/controls/grid/gridcolumn.cxx
@@ -25,281 +25,305 @@
*
************************************************************************/
-// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_toolkit.hxx"
#include "gridcolumn.hxx"
+
#include <comphelper/sequence.hxx>
+#include <cppuhelper/typeprovider.hxx>
#include <toolkit/helper/servicenames.hxx>
-#include <rtl/ref.hxx>
-
-using ::rtl::OUString;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::awt;
-using namespace ::com::sun::star::awt::grid;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::style;
-
-#define COLWIDTH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ColWidth" ))
-#define MAXWIDTH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "MaxWidth" ))
-#define MINWIDTH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "MinWidth" ))
-#define PREFWIDTH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "PrefWidth" ))
-#define HALIGN ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HAlign" ))
-#define TITLE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Title" ))
-#define COLRESIZE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ColumnResize" ))
-#define UPDATE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "UpdateWidth" ))
namespace toolkit
{
-
-///////////////////////////////////////////////////////////////////////
-// class GridColumn
-///////////////////////////////////////////////////////////////////////
-
-GridColumn::GridColumn()
-: identifier(Any())
-,index(0)
-,columnWidth(4)
-,preferredWidth(0)
-,maxWidth(0)
-,minWidth(0)
-,bResizeable(true)
-,horizontalAlign(HorizontalAlignment(0))
-{
-}
-
-//---------------------------------------------------------------------
-
-GridColumn::~GridColumn()
-{
-}
-
-//---------------------------------------------------------------------
-
-void GridColumn::broadcast( broadcast_column_type eType, const GridColumnEvent& aEvent )
-{
- ::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( XGridColumnListener::static_type() );
- if( pIter )
- {
- ::cppu::OInterfaceIteratorHelper aListIter(*pIter);
- while(aListIter.hasMoreElements())
- {
- XGridColumnListener* pListener = static_cast<XGridColumnListener*>(aListIter.next());
- switch( eType )
- {
- case column_attribute_changed: pListener->columnChanged(aEvent); break;
- }
- }
+ using namespace ::com::sun::star;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::awt;
+ using namespace ::com::sun::star::awt::grid;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::util;
+ using namespace ::com::sun::star::style;
+
+ //==================================================================================================================
+ //= DefaultGridColumnModel
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ GridColumn::GridColumn()
+ :GridColumn_Base( m_aMutex )
+ ,m_aIdentifier()
+ ,m_nIndex(-1)
+ ,m_nDataColumnIndex(-1)
+ ,m_nColumnWidth(4)
+ ,m_nMaxWidth(0)
+ ,m_nMinWidth(0)
+ ,m_nFlexibility(1)
+ ,m_bResizeable(true)
+ ,m_eHorizontalAlign( HorizontalAlignment_LEFT )
+ {
}
-}
-
-//---------------------------------------------------------------------
-
-void GridColumn::broadcast_changed(::rtl::OUString name, Any oldValue, Any newValue)
-{
- Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- GridColumnEvent aEvent( xSource, name, oldValue, newValue, index);
- broadcast( column_attribute_changed, aEvent);
-}
-
-void SAL_CALL GridColumn::updateColumn(const ::rtl::OUString& name, sal_Int32 width) throw (::com::sun::star::uno::RuntimeException)
-{
- if(PREFWIDTH == name)
- preferredWidth = width;
- else if (COLWIDTH == name)
- columnWidth = width;
-}
-//---------------------------------------------------------------------
-// XGridColumn
-//---------------------------------------------------------------------
-
-::com::sun::star::uno::Any SAL_CALL GridColumn::getIdentifier() throw (::com::sun::star::uno::RuntimeException)
-{
- return identifier;
-}
-//---------------------------------------------------------------------
-
-void SAL_CALL GridColumn::setIdentifier(const ::com::sun::star::uno::Any & value) throw (::com::sun::star::uno::RuntimeException)
-{
- value >>= identifier;
-}
+ //------------------------------------------------------------------------------------------------------------------
+ GridColumn::GridColumn( GridColumn const & i_copySource )
+ :cppu::BaseMutex()
+ ,GridColumn_Base( m_aMutex )
+ ,m_aIdentifier( i_copySource.m_aIdentifier )
+ ,m_nIndex( -1 )
+ ,m_nDataColumnIndex( i_copySource.m_nDataColumnIndex )
+ ,m_nColumnWidth( i_copySource.m_nColumnWidth )
+ ,m_nMaxWidth( i_copySource.m_nMaxWidth )
+ ,m_nMinWidth( i_copySource.m_nMinWidth )
+ ,m_nFlexibility( i_copySource.m_nFlexibility )
+ ,m_bResizeable( i_copySource.m_bResizeable )
+ ,m_sTitle( i_copySource.m_sTitle )
+ ,m_sHelpText( i_copySource.m_sHelpText )
+ ,m_eHorizontalAlign( i_copySource.m_eHorizontalAlign )
+ {
+ }
-//--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ GridColumn::~GridColumn()
+ {
+ }
-::sal_Int32 SAL_CALL GridColumn::getColumnWidth() throw (::com::sun::star::uno::RuntimeException)
-{
- broadcast_changed(UPDATE, Any(columnWidth), Any());
- return columnWidth;
-}
+ //------------------------------------------------------------------------------------------------------------------
+ void GridColumn::broadcast_changed( sal_Char const * const i_asciiAttributeName, Any i_oldValue, Any i_newValue,
+ ::comphelper::ComponentGuard& i_Guard )
+ {
+ Reference< XInterface > const xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ GridColumnEvent const aEvent(
+ xSource, ::rtl::OUString::createFromAscii( i_asciiAttributeName ),
+ i_oldValue, i_newValue, m_nIndex
+ );
-//--------------------------------------------------------------------
+ ::cppu::OInterfaceContainerHelper* pIter = rBHelper.getContainer( XGridColumnListener::static_type() );
-void SAL_CALL GridColumn::setColumnWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
-{
- columnWidth = value;
- broadcast_changed(COLWIDTH, Any(columnWidth),Any(value));
-}
-//--------------------------------------------------------------------
+ i_Guard.clear();
+ if( pIter )
+ pIter->notifyEach( &XGridColumnListener::columnChanged, aEvent );
+ }
-::sal_Int32 SAL_CALL GridColumn::getPreferredWidth() throw (::com::sun::star::uno::RuntimeException)
-{
- broadcast_changed(UPDATE, Any(preferredWidth), Any());
- return preferredWidth;
-}
+ //------------------------------------------------------------------------------------------------------------------
+ ::com::sun::star::uno::Any SAL_CALL GridColumn::getIdentifier() throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_aIdentifier;
+ }
-//--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::setIdentifier(const ::com::sun::star::uno::Any & value) throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ m_aIdentifier = value;
+ }
-void SAL_CALL GridColumn::setPreferredWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
-{
- preferredWidth = value;
- broadcast_changed(PREFWIDTH, Any(preferredWidth),Any(value));
-}
-//--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL GridColumn::getColumnWidth() throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_nColumnWidth;
+ }
-::sal_Int32 SAL_CALL GridColumn::getMaxWidth() throw (::com::sun::star::uno::RuntimeException)
-{
- return maxWidth;
-}
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::setColumnWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
+ {
+ impl_set( m_nColumnWidth, value, "ColumnWidth" );
+ }
-//--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL GridColumn::getMaxWidth() throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_nMaxWidth;
+ }
-void SAL_CALL GridColumn::setMaxWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
-{
- maxWidth = value;
- broadcast_changed(MAXWIDTH, Any(maxWidth),Any(value));
-}
-//--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::setMaxWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
+ {
+ impl_set( m_nMaxWidth, value, "MaxWidth" );
+ }
-::sal_Int32 SAL_CALL GridColumn::getMinWidth() throw (::com::sun::star::uno::RuntimeException)
-{
- return minWidth;
-}
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL GridColumn::getMinWidth() throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_nMinWidth;
+ }
-//--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::setMinWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
+ {
+ impl_set( m_nMinWidth, value, "MinWidth" );
+ }
-void SAL_CALL GridColumn::setMinWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
-{
- minWidth = value;
- broadcast_changed(MINWIDTH, Any(minWidth),Any(value));
-}
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL GridColumn::getTitle() throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_sTitle;
+ }
-//--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::setTitle(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException)
+ {
+ impl_set( m_sTitle, value, "Title" );
+ }
-::rtl::OUString SAL_CALL GridColumn::getTitle() throw (::com::sun::star::uno::RuntimeException)
-{
- return title;
-}
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL GridColumn::getHelpText() throw (RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_sHelpText;
+ }
-//--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::setHelpText( const ::rtl::OUString & value ) throw (RuntimeException)
+ {
+ impl_set( m_sHelpText, value, "HelpText" );
+ }
-void SAL_CALL GridColumn::setTitle(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException)
-{
- title = value;
- broadcast_changed(TITLE, Any(title),Any(value));
-}
-//--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool SAL_CALL GridColumn::getResizeable() throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_bResizeable;
+ }
-sal_Bool SAL_CALL GridColumn::getResizeable() throw (::com::sun::star::uno::RuntimeException)
-{
- return bResizeable;
-}
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::setResizeable(sal_Bool value) throw (::com::sun::star::uno::RuntimeException)
+ {
+ impl_set( m_bResizeable, value, "Resizeable" );
+ }
-//--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL GridColumn::getFlexibility() throw (RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_nFlexibility;
+ }
-void SAL_CALL GridColumn::setResizeable(sal_Bool value) throw (::com::sun::star::uno::RuntimeException)
-{
- bResizeable = value;
- broadcast_changed(COLRESIZE, Any(bResizeable),Any(value));
-}
-//---------------------------------------------------------------------
-HorizontalAlignment SAL_CALL GridColumn::getHorizontalAlign() throw (::com::sun::star::uno::RuntimeException)
-{
- return horizontalAlign;
-}
-//---------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::setFlexibility( ::sal_Int32 i_value ) throw (IllegalArgumentException, RuntimeException)
+ {
+ if ( i_value < 0 )
+ throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
+ impl_set( m_nFlexibility, i_value, "Flexibility" );
+ }
-void SAL_CALL GridColumn::setHorizontalAlign(HorizontalAlignment align) throw (::com::sun::star::uno::RuntimeException)
-{
- horizontalAlign = align;
- broadcast_changed(HALIGN, Any(horizontalAlign),Any(align));
-}
-//---------------------------------------------------------------------
-void SAL_CALL GridColumn::addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException)
-{
- BrdcstHelper.addListener( XGridColumnListener::static_type(), xListener );
-}
+ //------------------------------------------------------------------------------------------------------------------
+ HorizontalAlignment SAL_CALL GridColumn::getHorizontalAlign() throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_eHorizontalAlign;
+ }
-//---------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::setHorizontalAlign(HorizontalAlignment align) throw (::com::sun::star::uno::RuntimeException)
+ {
+ impl_set( m_eHorizontalAlign, align, "HorizontalAlign" );
+ }
-void SAL_CALL GridColumn::removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException)
-{
- BrdcstHelper.removeListener( XGridColumnListener::static_type(), xListener );
-}
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::addGridColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException)
+ {
+ rBHelper.addListener( XGridColumnListener::static_type(), xListener );
+ }
-//---------------------------------------------------------------------
-// XComponent
-//---------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::removeGridColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException)
+ {
+ rBHelper.removeListener( XGridColumnListener::static_type(), xListener );
+ }
-void SAL_CALL GridColumn::dispose() throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::disposing()
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ m_aIdentifier.clear();
+ m_sTitle = m_sHelpText = ::rtl::OUString();
+ }
- ::com::sun::star::lang::EventObject aEvent;
- aEvent.Source.set( static_cast< ::cppu::OWeakObject* >( this ) );
- BrdcstHelper.aLC.disposeAndClear( aEvent );
-}
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL GridColumn::getIndex() throw (RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_nIndex;
+ }
-//---------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ void GridColumn::setIndex( sal_Int32 const i_index )
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ m_nIndex = i_index;
+ }
-void SAL_CALL GridColumn::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
-{
- BrdcstHelper.addListener( XEventListener::static_type(), xListener );
-}
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL GridColumn::getDataColumnIndex() throw(RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_nDataColumnIndex;
+ }
-//---------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::setDataColumnIndex( ::sal_Int32 i_dataColumnIndex ) throw(RuntimeException)
+ {
+ impl_set( m_nDataColumnIndex, i_dataColumnIndex, "DataColumnIndex" );
+ }
-void SAL_CALL GridColumn::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
-{
- BrdcstHelper.removeListener( XEventListener::static_type(), xListener );
-}
-void SAL_CALL GridColumn::setIndex(sal_Int32 _nIndex) throw (::com::sun::star::uno::RuntimeException)
-{
- index = _nIndex;
-}
-//---------------------------------------------------------------------
-// XServiceInfo
-//---------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL GridColumn::getImplementationName( ) throw (RuntimeException)
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.toolkit.GridColumn" ) );
+ }
-::rtl::OUString SAL_CALL GridColumn::getImplementationName( ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- static const OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "toolkit.GridColumn" ) );
- return aImplName;
-}
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool SAL_CALL GridColumn::supportsService( const ::rtl::OUString& i_serviceName ) throw (RuntimeException)
+ {
+ const Sequence< ::rtl::OUString > aServiceNames( getSupportedServiceNames() );
+ for ( sal_Int32 i=0; i<aServiceNames.getLength(); ++i )
+ if ( aServiceNames[i] == i_serviceName )
+ return sal_True;
+ return sal_False;
+ }
-//---------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL GridColumn::getSupportedServiceNames( ) throw (RuntimeException)
+ {
+ const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( szServiceName_GridColumn ) );
+ const Sequence< ::rtl::OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+ }
-sal_Bool SAL_CALL GridColumn::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- return ServiceName.equalsAscii( szServiceName_GridColumn );
-}
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XCloneable > SAL_CALL GridColumn::createClone( ) throw (RuntimeException)
+ {
+ return new GridColumn( *this );
+ }
-//---------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Int64 SAL_CALL GridColumn::getSomething( const Sequence< sal_Int8 >& i_identifier ) throw(RuntimeException)
+ {
+ if ( ( i_identifier.getLength() == 16 ) && ( i_identifier == getUnoTunnelId() ) )
+ return ::sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ) );
+ return 0;
+ }
-::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL GridColumn::getSupportedServiceNames( ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- static const OUString aServiceName( OUString::createFromAscii( szServiceName_GridColumn ) );
- static const Sequence< OUString > aSeq( &aServiceName, 1 );
- return aSeq;
-}
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< sal_Int8 > GridColumn::getUnoTunnelId() throw()
+ {
+ static ::cppu::OImplementationId const aId;
+ return aId.getImplementationId();
+ }
+ //------------------------------------------------------------------------------------------------------------------
+ GridColumn* GridColumn::getImplementation( const Reference< XInterface >& i_component )
+ {
+ Reference< XUnoTunnel > const xTunnel( i_component, UNO_QUERY );
+ if ( xTunnel.is() )
+ return reinterpret_cast< GridColumn* >( ::sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething( getUnoTunnelId() ) ) );
+ return NULL;
+ }
}
-Reference< XInterface > SAL_CALL GridColumn_CreateInstance( const Reference< XMultiServiceFactory >& )
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GridColumn_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& )
{
- return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::GridColumn );
+ return *( new ::toolkit::GridColumn );
}
diff --git a/toolkit/source/controls/grid/gridcolumn.hxx b/toolkit/source/controls/grid/gridcolumn.hxx
index 38d43d55a07b..b1be836a3862 100644
--- a/toolkit/source/controls/grid/gridcolumn.hxx
+++ b/toolkit/source/controls/grid/gridcolumn.hxx
@@ -25,83 +25,111 @@
*
************************************************************************/
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_toolkit.hxx"
+
#include <com/sun/star/awt/grid/XGridColumn.hpp>
-#include <com/sun/star/awt/grid/XGridColumnListener.hpp>
-#include <com/sun/star/awt/grid/GridColumnEvent.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <cppuhelper/implbase2.hxx>
-#include <cppuhelper/implbase3.hxx>
+#include <com/sun/star/style/HorizontalAlignment.hpp>
+
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase3.hxx>
+#include <comphelper/componentguard.hxx>
#include <rtl/ref.hxx>
-#include <vector>
#include <toolkit/helper/mutexandbroadcasthelper.hxx>
-#include <com/sun/star/style/HorizontalAlignment.hpp>
-using ::rtl::OUString;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::awt;
-using namespace ::com::sun::star::awt::grid;
-using namespace ::com::sun::star::lang;
+#include <vector>
namespace toolkit
{
-enum broadcast_column_type { column_attribute_changed};
-class GridColumn : public ::cppu::WeakImplHelper2< XGridColumn, XServiceInfo >,
- public MutexAndBroadcastHelper
+typedef ::cppu::WeakComponentImplHelper3 < ::com::sun::star::awt::grid::XGridColumn
+ , ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::lang::XUnoTunnel
+ > GridColumn_Base;
+class GridColumn :public ::cppu::BaseMutex
+ ,public GridColumn_Base
{
public:
GridColumn();
+ GridColumn( GridColumn const & i_copySource );
virtual ~GridColumn();
- // XGridColumn
+ // ::com::sun::star::awt::grid::XGridColumn
virtual ::com::sun::star::uno::Any SAL_CALL getIdentifier() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setIdentifier(const ::com::sun::star::uno::Any & value) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getColumnWidth() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setColumnWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getPreferredWidth() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setPreferredWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getMaxWidth() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setMaxWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getMinWidth() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setMinWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL getResizeable() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setResizeable(::sal_Bool the_value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getFlexibility() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFlexibility( ::sal_Int32 _flexibility ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setTitle(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getHelpText() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setHelpText(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getIndex() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getDataColumnIndex() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDataColumnIndex( ::sal_Int32 i_dataColumnIndex ) throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::style::HorizontalAlignment SAL_CALL getHorizontalAlign() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setHorizontalAlign(::com::sun::star::style::HorizontalAlignment align) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateColumn( const ::rtl::OUString& name, ::sal_Int32 width ) throw (::com::sun::star::uno::RuntimeException);
- // XComponent
- virtual void SAL_CALL dispose( ) throw (RuntimeException);
- virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException);
- virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException);
+ virtual void SAL_CALL addGridColumnListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeGridColumnListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+ // XCloneable (base of XGridColumn)
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException);
// XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException);
- virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XUnoTunnel and friends
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& i_identifier ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelId() throw();
+ static GridColumn* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_component );
+
+ // attribute access
+ void setIndex( sal_Int32 const i_index );
- virtual void SAL_CALL setIndex(sal_Int32 _nIndex)throw (::com::sun::star::uno::RuntimeException);
private:
- void broadcast( broadcast_column_type eType, const GridColumnEvent& aEvent );
- void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue);
-
- Any identifier;
- sal_Int32 index;
- sal_Int32 columnWidth;
- sal_Int32 preferredWidth;
- sal_Int32 maxWidth;
- sal_Int32 minWidth;
- sal_Bool bResizeable;
- ::rtl::OUString title;
- ::com::sun::star::style::HorizontalAlignment horizontalAlign;
+ void broadcast_changed(
+ sal_Char const * const i_asciiAttributeName,
+ ::com::sun::star::uno::Any i_oldValue,
+ ::com::sun::star::uno::Any i_newValue,
+ ::comphelper::ComponentGuard& i_Guard
+ );
+
+ template< class TYPE >
+ void impl_set( TYPE & io_attribute, TYPE const & i_newValue, sal_Char const * i_attributeName )
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ if ( io_attribute == i_newValue )
+ return;
+
+ TYPE const aOldValue( io_attribute );
+ io_attribute = i_newValue;
+ broadcast_changed( i_attributeName, ::com::sun::star::uno::makeAny( aOldValue ), ::com::sun::star::uno::makeAny( io_attribute ), aGuard );
+ }
+
+ ::com::sun::star::uno::Any m_aIdentifier;
+ sal_Int32 m_nIndex;
+ sal_Int32 m_nDataColumnIndex;
+ sal_Int32 m_nColumnWidth;
+ sal_Int32 m_nMaxWidth;
+ sal_Int32 m_nMinWidth;
+ sal_Int32 m_nFlexibility;
+ sal_Bool m_bResizeable;
+ ::rtl::OUString m_sTitle;
+ ::rtl::OUString m_sHelpText;
+ ::com::sun::star::style::HorizontalAlignment m_eHorizontalAlign;
};
}
diff --git a/toolkit/source/controls/grid/gridcontrol.cxx b/toolkit/source/controls/grid/gridcontrol.cxx
index 5125c1349ade..acda52753a60 100644
--- a/toolkit/source/controls/grid/gridcontrol.cxx
+++ b/toolkit/source/controls/grid/gridcontrol.cxx
@@ -28,22 +28,27 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_toolkit.hxx"
-#include <gridcontrol.hxx>
+#include "gridcontrol.hxx"
+#include "grideventforwarder.hxx"
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/view/SelectionType.hpp>
#include <com/sun/star/awt/grid/XGridDataModel.hpp>
+#include <com/sun/star/awt/grid/XMutableGridDataModel.hpp>
+#include <com/sun/star/awt/grid/DefaultGridDataModel.hpp>
+#include <com/sun/star/awt/grid/SortableGridDataModel.hpp>
#include <com/sun/star/awt/grid/XGridColumnModel.hpp>
-#include <com/sun/star/awt/grid/ScrollBarMode.hpp>
#include <toolkit/helper/unopropertyarrayhelper.hxx>
#include <toolkit/helper/property.hxx>
#include <com/sun/star/awt/XVclWindowPeer.hpp>
#include <comphelper/processfactory.hxx>
-#include <osl/diagnose.h>
+#include <tools/diagnose_ex.h>
+#include <tools/color.hxx>
using ::rtl::OUString;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::awt::grid;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
@@ -52,10 +57,28 @@ using namespace ::com::sun::star::view;
namespace toolkit
{
-// ----------------------------------------------------
-// class UnoGridModel
-// ----------------------------------------------------
-UnoGridModel::UnoGridModel()
+//======================================================================================================================
+//= UnoGridModel
+//======================================================================================================================
+namespace
+{
+ Reference< XGridDataModel > lcl_getDefaultDataModel_throw( ::comphelper::ComponentContext const & i_context )
+ {
+ Reference< XMutableGridDataModel > const xDelegatorModel( DefaultGridDataModel::create( i_context.getUNOContext() ), UNO_QUERY_THROW );
+ Reference< XGridDataModel > const xDataModel( SortableGridDataModel::create( i_context.getUNOContext(), xDelegatorModel ), UNO_QUERY_THROW );
+ return xDataModel;
+ }
+
+ Reference< XGridColumnModel > lcl_getDefaultColumnModel_throw( ::comphelper::ComponentContext const & i_context )
+ {
+ Reference< XGridColumnModel > const xColumnModel( i_context.createComponent( "com.sun.star.awt.grid.DefaultGridColumnModel" ), UNO_QUERY_THROW );
+ return xColumnModel;
+ }
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+UnoGridModel::UnoGridModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
{
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
ImplRegisterProperty( BASEPROPERTY_BORDER );
@@ -71,36 +94,131 @@ UnoGridModel::UnoGridModel()
ImplRegisterProperty( BASEPROPERTY_VSCROLL );
ImplRegisterProperty( BASEPROPERTY_TABSTOP );
ImplRegisterProperty( BASEPROPERTY_GRID_SHOWROWHEADER );
+ ImplRegisterProperty( BASEPROPERTY_ROW_HEADER_WIDTH );
ImplRegisterProperty( BASEPROPERTY_GRID_SHOWCOLUMNHEADER );
- ImplRegisterProperty( BASEPROPERTY_GRID_DATAMODEL );
- ImplRegisterProperty( BASEPROPERTY_GRID_COLUMNMODEL );
+ ImplRegisterProperty( BASEPROPERTY_COLUMN_HEADER_HEIGHT );
+ ImplRegisterProperty( BASEPROPERTY_ROW_HEIGHT );
+ ImplRegisterProperty( BASEPROPERTY_GRID_DATAMODEL, makeAny( lcl_getDefaultDataModel_throw( maContext ) ) );
+ ImplRegisterProperty( BASEPROPERTY_GRID_COLUMNMODEL, makeAny( lcl_getDefaultColumnModel_throw( maContext ) ) );
ImplRegisterProperty( BASEPROPERTY_GRID_SELECTIONMODE );
ImplRegisterProperty( BASEPROPERTY_FONTRELIEF );
ImplRegisterProperty( BASEPROPERTY_FONTEMPHASISMARK );
ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
- ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN );
- ImplRegisterProperty( BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND );
- ImplRegisterProperty( BASEPROPERTY_GRID_HEADER_BACKGROUND );
+ ImplRegisterProperty( BASEPROPERTY_TEXTLINECOLOR );
+ ImplRegisterProperty( BASEPROPERTY_USE_GRID_LINES );
ImplRegisterProperty( BASEPROPERTY_GRID_LINE_COLOR );
- ImplRegisterProperty( BASEPROPERTY_GRID_ROW_BACKGROUND );
+ ImplRegisterProperty( BASEPROPERTY_GRID_HEADER_BACKGROUND );
+ ImplRegisterProperty( BASEPROPERTY_GRID_HEADER_TEXT_COLOR );
+ ImplRegisterProperty( BASEPROPERTY_GRID_ROW_BACKGROUND_COLORS );
+ ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN );
}
+//----------------------------------------------------------------------------------------------------------------------
UnoGridModel::UnoGridModel( const UnoGridModel& rModel )
-: UnoControlModel( rModel )
+ :UnoControlModel( rModel )
{
+ osl_incrementInterlockedCount( &m_refCount );
+ {
+ Reference< XGridDataModel > xDataModel;
+ // clone the data model
+ const Reference< XFastPropertySet > xCloneSource( &const_cast< UnoGridModel& >( rModel ) );
+ try
+ {
+ const Reference< XCloneable > xCloneable( xCloneSource->getFastPropertyValue( BASEPROPERTY_GRID_DATAMODEL ), UNO_QUERY_THROW );
+ xDataModel.set( xCloneable->createClone(), UNO_QUERY_THROW );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ if ( !xDataModel.is() )
+ xDataModel = lcl_getDefaultDataModel_throw( maContext );
+ UnoControlModel::setFastPropertyValue_NoBroadcast( BASEPROPERTY_GRID_DATAMODEL, makeAny( xDataModel ) );
+ // do *not* use setFastPropertyValue here: The UnoControlModel ctor did a simple copy of all property values,
+ // so before this call here, we share our data model with the own of the clone source. setFastPropertyValue,
+ // then, disposes the old data model - which means the data model which in fact belongs to the clone source.
+ // so, call the UnoControlModel's impl-method for setting the value.
+
+ // clone the column model
+ Reference< XGridColumnModel > xColumnModel;
+ try
+ {
+ const Reference< XCloneable > xCloneable( xCloneSource->getFastPropertyValue( BASEPROPERTY_GRID_COLUMNMODEL ), UNO_QUERY_THROW );
+ xColumnModel.set( xCloneable->createClone(), UNO_QUERY_THROW );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ if ( !xColumnModel.is() )
+ xColumnModel = lcl_getDefaultColumnModel_throw( maContext );
+ UnoControlModel::setFastPropertyValue_NoBroadcast( BASEPROPERTY_GRID_COLUMNMODEL, makeAny( xColumnModel ) );
+ // same comment as above: do not use our own setPropertyValue here.
+ }
+ osl_decrementInterlockedCount( &m_refCount );
}
+//----------------------------------------------------------------------------------------------------------------------
UnoControlModel* UnoGridModel::Clone() const
{
return new UnoGridModel( *this );
}
+//----------------------------------------------------------------------------------------------------------------------
+namespace
+{
+ void lcl_dispose_nothrow( const Any& i_component )
+ {
+ try
+ {
+ const Reference< XComponent > xComponent( i_component, UNO_QUERY_THROW );
+ xComponent->dispose();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoGridModel::dispose( ) throw(RuntimeException)
+{
+ lcl_dispose_nothrow( getFastPropertyValue( BASEPROPERTY_GRID_COLUMNMODEL ) );
+ lcl_dispose_nothrow( getFastPropertyValue( BASEPROPERTY_GRID_DATAMODEL ) );
+
+ UnoControlModel::dispose();
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoGridModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception)
+{
+ Any aOldSubModel;
+ if ( ( nHandle == BASEPROPERTY_GRID_COLUMNMODEL ) || ( nHandle == BASEPROPERTY_GRID_DATAMODEL ) )
+ {
+ aOldSubModel = getFastPropertyValue( nHandle );
+ if ( aOldSubModel == rValue )
+ {
+ OSL_ENSURE( false, "UnoGridModel::setFastPropertyValue_NoBroadcast: setting the same value, again!" );
+ // shouldn't this have been caught by convertFastPropertyValue?
+ aOldSubModel.clear();
+ }
+ }
+
+ UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
+
+ if ( aOldSubModel.hasValue() )
+ lcl_dispose_nothrow( aOldSubModel );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
OUString UnoGridModel::getServiceName() throw(RuntimeException)
{
return OUString::createFromAscii( szServiceName_GridControlModel );
}
+//----------------------------------------------------------------------------------------------------------------------
Any UnoGridModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
{
switch( nPropId )
@@ -110,27 +228,26 @@ Any UnoGridModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
case BASEPROPERTY_GRID_SELECTIONMODE:
return uno::makeAny( SelectionType(1) );
case BASEPROPERTY_GRID_SHOWROWHEADER:
+ case BASEPROPERTY_USE_GRID_LINES:
return uno::makeAny( (sal_Bool)sal_False );
+ case BASEPROPERTY_ROW_HEADER_WIDTH:
+ return uno::makeAny( sal_Int32( 10 ) );
case BASEPROPERTY_GRID_SHOWCOLUMNHEADER:
- return uno::makeAny( (sal_Bool)sal_False );
- case BASEPROPERTY_GRID_DATAMODEL:
- return uno::makeAny( Reference<XGridDataModel> ());
- case BASEPROPERTY_GRID_COLUMNMODEL:
- return uno::makeAny(Reference<XGridColumnModel>() );
- case BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND:
- return uno::makeAny( com::sun::star::util::Color(0xFFFFFF) );
+ return uno::makeAny( (sal_Bool)sal_True );
+ case BASEPROPERTY_COLUMN_HEADER_HEIGHT:
+ case BASEPROPERTY_ROW_HEIGHT:
case BASEPROPERTY_GRID_HEADER_BACKGROUND:
- return uno::makeAny( com::sun::star::util::Color(0xFFFFFF) );
+ case BASEPROPERTY_GRID_HEADER_TEXT_COLOR:
case BASEPROPERTY_GRID_LINE_COLOR:
- return uno::makeAny( com::sun::star::util::Color(0xFFFFFF) );
- case BASEPROPERTY_GRID_ROW_BACKGROUND:
- return uno::makeAny(com::sun::star::util::Color(0xFFFFFF) );
+ case BASEPROPERTY_GRID_ROW_BACKGROUND_COLORS:
+ return Any();
default:
return UnoControlModel::ImplGetDefaultValue( nPropId );
}
}
+//----------------------------------------------------------------------------------------------------------------------
::cppu::IPropertyArrayHelper& UnoGridModel::getInfoHelper()
{
static UnoPropertyArrayHelper* pHelper = NULL;
@@ -142,6 +259,7 @@ Any UnoGridModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
return *pHelper;
}
+//----------------------------------------------------------------------------------------------------------------------
// XMultiPropertySet
Reference< XPropertySetInfo > UnoGridModel::getPropertySetInfo( ) throw(RuntimeException)
{
@@ -150,20 +268,29 @@ Reference< XPropertySetInfo > UnoGridModel::getPropertySetInfo( ) throw(Runtime
}
-// ----------------------------------------------------
-// class UnoGridControl
-// ----------------------------------------------------
-UnoGridControl::UnoGridControl()
-: mSelectionMode(SelectionType(1)),
- m_aSelectionListeners( *this )
+//======================================================================================================================
+//= UnoGridControl
+//======================================================================================================================
+UnoGridControl::UnoGridControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoGridControl_Base( i_factory )
+ ,mSelectionMode(SelectionType(1))
+ ,m_aSelectionListeners( *this )
+ ,m_pEventForwarder( new GridEventForwarder( *this ) )
+{
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+UnoGridControl::~UnoGridControl()
{
}
+//----------------------------------------------------------------------------------------------------------------------
OUString UnoGridControl::GetComponentServiceName()
{
return OUString::createFromAscii( "Grid" );
}
+//----------------------------------------------------------------------------------------------------------------------
void SAL_CALL UnoGridControl::dispose( ) throw(RuntimeException)
{
lang::EventObject aEvt;
@@ -172,113 +299,155 @@ void SAL_CALL UnoGridControl::dispose( ) throw(RuntimeException)
UnoControl::dispose();
}
-void UnoGridControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
+//----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoGridControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
{
UnoControlBase::createPeer( rxToolkit, rParentPeer );
- Reference< XGridControl > xGrid( getPeer(), UNO_QUERY_THROW );
+ const Reference< XGridControl > xGrid( getPeer(), UNO_QUERY_THROW );
xGrid->addSelectionListener(&m_aSelectionListeners);
+}
- Reference<XGridDataListener> xListener ( getPeer(), UNO_QUERY_THROW );
- Reference<XGridColumnListener> xColListener ( getPeer(), UNO_QUERY_THROW );
- Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
-
- Reference<XGridDataModel> xGridDataModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "GridDataModel" )), UNO_QUERY_THROW );
- if(xGridDataModel != NULL)
- xGridDataModel->addDataListener(xListener);
- Reference<XGridColumnModel> xGridColumnModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "ColumnModel" )), UNO_QUERY_THROW );
- if(xGridColumnModel != NULL)
+//----------------------------------------------------------------------------------------------------------------------
+namespace
+{
+ void lcl_setEventForwarding( const Reference< XControlModel >& i_gridControlModel, const ::boost::scoped_ptr< GridEventForwarder >& i_listener,
+ bool const i_add )
{
- for(int i = 0;i<xGridColumnModel->getColumnCount();i++)
+ const Reference< XPropertySet > xModelProps( i_gridControlModel, UNO_QUERY );
+ if ( !xModelProps.is() )
+ return;
+
+ try
{
- xGridColumnModel->getColumn(i)->addColumnListener(xColListener);
+ Reference< XContainer > const xColModel(
+ xModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnModel" ) ) ),
+ UNO_QUERY_THROW );
+ if ( i_add )
+ xColModel->addContainerListener( i_listener.get() );
+ else
+ xColModel->removeContainerListener( i_listener.get() );
+
+ Reference< XGridDataModel > const xDataModel(
+ xModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GridDataModel" ) ) ),
+ UNO_QUERY_THROW
+ );
+ Reference< XMutableGridDataModel > const xMutableDataModel( xDataModel, UNO_QUERY );
+ if ( xMutableDataModel.is() )
+ {
+ if ( i_add )
+ xMutableDataModel->addGridDataListener( i_listener.get() );
+ else
+ xMutableDataModel->removeGridDataListener( i_listener.get() );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
}
}
}
+//----------------------------------------------------------------------------------------------------------------------
+sal_Bool SAL_CALL UnoGridControl::setModel( const Reference< XControlModel >& i_model ) throw(RuntimeException)
+{
+ lcl_setEventForwarding( getModel(), m_pEventForwarder, false );
+ if ( !UnoGridControl_Base::setModel( i_model ) )
+ return sal_False;
+ lcl_setEventForwarding( getModel(), m_pEventForwarder, true );
+ return sal_True;
+}
-// -------------------------------------------------------------------
-// XGridControl
-
-::sal_Int32 UnoGridControl::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
+//----------------------------------------------------------------------------------------------------------------------
+::sal_Int32 UnoGridControl::getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
{
- Reference< XGridControl > xGrid ( getPeer(), UNO_QUERY_THROW );
- return xGrid->getItemIndexAtPoint( x, y );
+ Reference< XGridControl > const xGrid ( getPeer(), UNO_QUERY_THROW );
+ return xGrid->getRowAtPoint( x, y );
}
-void SAL_CALL UnoGridControl::setToolTip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& text, const ::com::sun::star::uno::Sequence< ::sal_Int32 >& columns) throw (::com::sun::star::uno::RuntimeException)
+//----------------------------------------------------------------------------------------------------------------------
+::sal_Int32 UnoGridControl::getColumnAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->setToolTip( text, columns );
+ Reference< XGridControl > const xGrid ( getPeer(), UNO_QUERY_THROW );
+ return xGrid->getColumnAtPoint( x, y );
}
-// -------------------------------------------------------------------
-// XGridSelection
-// -------------------------------------------------------------------
-::sal_Int32 SAL_CALL UnoGridControl::getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException)
+//----------------------------------------------------------------------------------------------------------------------
+::sal_Int32 SAL_CALL UnoGridControl::getCurrentColumn( ) throw (RuntimeException)
{
- return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getMinSelectionIndex();
+ Reference< XGridControl > const xGrid ( getPeer(), UNO_QUERY_THROW );
+ return xGrid->getCurrentColumn();
}
-::sal_Int32 SAL_CALL UnoGridControl::getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException)
+//----------------------------------------------------------------------------------------------------------------------
+::sal_Int32 SAL_CALL UnoGridControl::getCurrentRow( ) throw (RuntimeException)
{
- return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getMaxSelectionIndex();
+ Reference< XGridControl > const xGrid ( getPeer(), UNO_QUERY_THROW );
+ return xGrid->getCurrentRow();
}
-void SAL_CALL UnoGridControl::selectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException)
+//----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoGridControl::selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException)
{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectRows( rangeOfRows);
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectRow( i_rowIndex );
}
+//----------------------------------------------------------------------------------------------------------------------
void SAL_CALL UnoGridControl::selectAllRows() throw (::com::sun::star::uno::RuntimeException)
{
Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectAllRows();
}
-void SAL_CALL UnoGridControl::deselectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException)
+
+//----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoGridControl::deselectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException)
{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->deselectRows( rangeOfRows);
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->deselectRow( i_rowIndex );
}
+//----------------------------------------------------------------------------------------------------------------------
void SAL_CALL UnoGridControl::deselectAllRows() throw (::com::sun::star::uno::RuntimeException)
{
Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->deselectAllRows();
}
+
+//----------------------------------------------------------------------------------------------------------------------
::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL UnoGridControl::getSelection() throw (::com::sun::star::uno::RuntimeException)
{
return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getSelection();
}
+//----------------------------------------------------------------------------------------------------------------------
::sal_Bool SAL_CALL UnoGridControl::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException)
{
return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->isSelectionEmpty();
}
+//----------------------------------------------------------------------------------------------------------------------
::sal_Bool SAL_CALL UnoGridControl::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
{
return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->isSelectedIndex( index );
}
-void SAL_CALL UnoGridControl::selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
-{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectRow( y );
-}
-
+//----------------------------------------------------------------------------------------------------------------------
void SAL_CALL UnoGridControl::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
{
m_aSelectionListeners.addInterface( listener );
}
+//----------------------------------------------------------------------------------------------------------------------
void SAL_CALL UnoGridControl::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
{
m_aSelectionListeners.removeInterface( listener );
}
+
}//namespace toolkit
-Reference< XInterface > SAL_CALL GridControl_CreateInstance( const Reference< XMultiServiceFactory >& )
+Reference< XInterface > SAL_CALL GridControl_CreateInstance( const Reference< XMultiServiceFactory >& i_factory )
{
- return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoGridControl );
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoGridControl( i_factory ) );
}
-Reference< XInterface > SAL_CALL GridControlModel_CreateInstance( const Reference< XMultiServiceFactory >& )
+Reference< XInterface > SAL_CALL GridControlModel_CreateInstance( const Reference< XMultiServiceFactory >& i_factory )
{
- return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoGridModel );
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoGridModel( i_factory ) );
}
diff --git a/toolkit/source/controls/grid/gridcontrol.hxx b/toolkit/source/controls/grid/gridcontrol.hxx
index 0c8ddb1c02b6..61d9f8fc0232 100644
--- a/toolkit/source/controls/grid/gridcontrol.hxx
+++ b/toolkit/source/controls/grid/gridcontrol.hxx
@@ -30,21 +30,20 @@
#include <com/sun/star/awt/grid/XGridControl.hpp>
#include <com/sun/star/view/SelectionType.hpp>
+
#include <toolkit/controls/unocontrolbase.hxx>
#include <toolkit/controls/unocontrolmodel.hxx>
#include <toolkit/helper/servicenames.hxx>
#include <cppuhelper/implbase1.hxx>
#include <comphelper/sequence.hxx>
-
#include <toolkit/helper/listenermultiplexer.hxx>
-namespace toolkit {
+#include <boost/scoped_ptr.hpp>
+
+namespace toolkit
+{
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::awt;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::container;
+class GridEventForwarder;
// ===================================================================
// = UnoGridModel
@@ -52,21 +51,27 @@ using namespace ::com::sun::star::container;
class UnoGridModel : public UnoControlModel
{
protected:
- Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoGridModel();
+ UnoGridModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoGridModel( const UnoGridModel& rModel );
UnoControlModel* Clone() const;
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
// ::com::sun::star::beans::XMultiPropertySet
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
// ::com::sun::star::io::XPersistObject
::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+ // OPropertySetHelper
+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
+
// XServiceInfo
DECLIMPL_SERVICEINFO_DERIVED( UnoGridModel, UnoControlModel, szServiceName_GridControlModel )
};
@@ -75,10 +80,13 @@ public:
// ===================================================================
// = UnoGridControl
// ===================================================================
-class UnoGridControl : public ::cppu::ImplInheritanceHelper1< UnoControlBase, ::com::sun::star::awt::grid::XGridControl >
+typedef ::cppu::ImplInheritanceHelper1 < UnoControlBase
+ , ::com::sun::star::awt::grid::XGridControl
+ > UnoGridControl_Base;
+class UnoGridControl : public UnoGridControl_Base
{
public:
- UnoGridControl();
+ UnoGridControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
// ::com::sun::star::lang::XComponent
@@ -86,24 +94,22 @@ public:
// ::com::sun::star::awt::XControl
void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel ) throw(::com::sun::star::uno::RuntimeException);
// ::com::sun::star::awt::grid::XGridControl
-
- virtual ::sal_Int32 SAL_CALL getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setToolTip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& text, const ::com::sun::star::uno::Sequence< ::sal_Int32 >& columns) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getColumnAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getCurrentColumn( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getCurrentRow( ) throw (::com::sun::star::uno::RuntimeException);
// ::com::sun::star::awt::grid::XGridSelection
-
- virtual ::sal_Int32 SAL_CALL getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL selectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL selectAllRows() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deselectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL deselectAllRows() throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelection() throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException);
@@ -111,9 +117,14 @@ public:
DECLIMPL_SERVICEINFO_DERIVED( UnoGridControl, UnoControlBase, szServiceName_GridControl )
using UnoControl::getPeer;
+
+protected:
+ ~UnoGridControl();
+
private:
- ::com::sun::star::view::SelectionType mSelectionMode;
- SelectionListenerMultiplexer m_aSelectionListeners;
+ ::com::sun::star::view::SelectionType mSelectionMode;
+ SelectionListenerMultiplexer m_aSelectionListeners;
+ ::boost::scoped_ptr< GridEventForwarder > m_pEventForwarder;
};
} // toolkit
diff --git a/toolkit/source/controls/grid/grideventforwarder.cxx b/toolkit/source/controls/grid/grideventforwarder.cxx
new file mode 100755
index 000000000000..c3760b8315a3
--- /dev/null
+++ b/toolkit/source/controls/grid/grideventforwarder.cxx
@@ -0,0 +1,149 @@
+/*************************************************************************
+ * 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.
+ *
+ ************************************************************************/
+
+#include "precompiled_toolkit.hxx"
+
+#include "grideventforwarder.hxx"
+#include "gridcontrol.hxx"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+//......................................................................................................................
+namespace toolkit
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::awt::grid::GridDataEvent;
+ using ::com::sun::star::container::ContainerEvent;
+ using ::com::sun::star::lang::EventObject;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= GridEventForwarder
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ GridEventForwarder::GridEventForwarder( UnoGridControl& i_parent )
+ :m_parent( i_parent )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ GridEventForwarder::~GridEventForwarder()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridEventForwarder::acquire() throw()
+ {
+ m_parent.acquire();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridEventForwarder::release() throw()
+ {
+ m_parent.release();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridEventForwarder::rowsInserted( const GridDataEvent& i_event ) throw (RuntimeException)
+ {
+ Reference< XGridDataListener > xPeer( m_parent.getPeer(), UNO_QUERY );
+ if ( xPeer.is() )
+ xPeer->rowsInserted( i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridEventForwarder::rowsRemoved( const GridDataEvent& i_event ) throw (RuntimeException)
+ {
+ Reference< XGridDataListener > xPeer( m_parent.getPeer(), UNO_QUERY );
+ if ( xPeer.is() )
+ xPeer->rowsRemoved( i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridEventForwarder::dataChanged( const GridDataEvent& i_event ) throw (RuntimeException)
+ {
+ Reference< XGridDataListener > xPeer( m_parent.getPeer(), UNO_QUERY );
+ if ( xPeer.is() )
+ xPeer->dataChanged( i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridEventForwarder::rowHeadingChanged( const GridDataEvent& i_event ) throw (RuntimeException)
+ {
+ Reference< XGridDataListener > xPeer( m_parent.getPeer(), UNO_QUERY );
+ if ( xPeer.is() )
+ xPeer->rowHeadingChanged( i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridEventForwarder::elementInserted( const ContainerEvent& i_event ) throw (RuntimeException)
+ {
+ Reference< XContainerListener > xPeer( m_parent.getPeer(), UNO_QUERY );
+ if ( xPeer.is() )
+ xPeer->elementInserted( i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridEventForwarder::elementRemoved( const ContainerEvent& i_event ) throw (RuntimeException)
+ {
+ Reference< XContainerListener > xPeer( m_parent.getPeer(), UNO_QUERY );
+ if ( xPeer.is() )
+ xPeer->elementRemoved( i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridEventForwarder::elementReplaced( const ContainerEvent& i_event ) throw (RuntimeException)
+ {
+ Reference< XContainerListener > xPeer( m_parent.getPeer(), UNO_QUERY );
+ if ( xPeer.is() )
+ xPeer->elementReplaced( i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridEventForwarder::disposing( const EventObject& i_event ) throw (RuntimeException)
+ {
+ Reference< XEventListener > xPeer( m_parent.getPeer(), UNO_QUERY );
+ if ( xPeer.is() )
+ xPeer->disposing( i_event );
+ }
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
diff --git a/toolkit/source/controls/grid/grideventforwarder.hxx b/toolkit/source/controls/grid/grideventforwarder.hxx
new file mode 100755
index 000000000000..5a8b03f57037
--- /dev/null
+++ b/toolkit/source/controls/grid/grideventforwarder.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef TOOLKIT_GRIDEVENTFORWARDER_HXX
+#define TOOLKIT_GRIDEVENTFORWARDER_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/grid/XGridDataListener.hpp>
+#include <com/sun/star/awt/grid/XGridColumnListener.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/implbase2.hxx>
+
+//......................................................................................................................
+namespace toolkit
+{
+//......................................................................................................................
+
+ class UnoGridControl;
+
+ //==================================================================================================================
+ //= GridEventForwarder
+ //==================================================================================================================
+ typedef ::cppu::ImplHelper2 < ::com::sun::star::awt::grid::XGridDataListener
+ , ::com::sun::star::container::XContainerListener
+ > GridEventForwarder_Base;
+
+ class GridEventForwarder : public GridEventForwarder_Base
+ {
+ public:
+ GridEventForwarder( UnoGridControl& i_parent );
+ virtual ~GridEventForwarder();
+
+ public:
+ // XInterface
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // XGridDataListener
+ virtual void SAL_CALL rowsInserted( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL rowsRemoved( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL dataChanged( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL rowHeadingChanged( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XContainerListener
+ virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& i_event ) throw (::com::sun::star::uno::RuntimeException);
+
+ private:
+ UnoGridControl& m_parent;
+ };
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
+
+#endif // TOOLKIT_GRIDEVENTFORWARDER_HXX
diff --git a/toolkit/source/controls/grid/initguard.hxx b/toolkit/source/controls/grid/initguard.hxx
new file mode 100755
index 000000000000..b2dddd2e5987
--- /dev/null
+++ b/toolkit/source/controls/grid/initguard.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef SVTOOLS_INITGUARD_HXX
+#define SVTOOLS_INITGUARD_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/NotInitializedException.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/componentguard.hxx>
+
+//......................................................................................................................
+namespace toolkit
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= InitGuard
+ //==================================================================================================================
+ template < class IMPL >
+ class InitGuard : public ::comphelper::ComponentGuard
+ {
+ public:
+ InitGuard( IMPL& i_component, ::cppu::OBroadcastHelper & i_broadcastHelper )
+ :comphelper::ComponentGuard( i_component, i_broadcastHelper )
+ {
+ if ( !i_component.isInitialized() )
+ throw ::com::sun::star::lang::NotInitializedException( ::rtl::OUString(), *&i_component );
+ }
+
+ ~InitGuard()
+ {
+ }
+ };
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
+
+#endif // SVTOOLS_INITGUARD_HXX
diff --git a/toolkit/source/controls/grid/sortablegriddatamodel.cxx b/toolkit/source/controls/grid/sortablegriddatamodel.cxx
new file mode 100755
index 000000000000..77a2ffa1637b
--- /dev/null
+++ b/toolkit/source/controls/grid/sortablegriddatamodel.cxx
@@ -0,0 +1,877 @@
+/*************************************************************************
+ * 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.
+ *
+ ************************************************************************/
+
+#include "precompiled_toolkit.hxx"
+
+#include "sortablegriddatamodel.hxx"
+#include "toolkit/helper/servicenames.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/i18n/XCollator.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/ucb/AlreadyInitializedException.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/anycompare.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <tools/diagnose_ex.h>
+#include <tools/debug.hxx>
+#include <vcl/svapp.hxx>
+
+#include <set>
+
+//......................................................................................................................
+namespace toolkit
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::TypeClass;
+ using ::com::sun::star::uno::TypeClass_VOID;
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::lang::IndexOutOfBoundsException;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::awt::grid::XGridDataListener;
+ using ::com::sun::star::beans::Pair;
+ using ::com::sun::star::util::XCloneable;
+ using ::com::sun::star::i18n::XCollator;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::awt::grid::GridDataEvent;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::ucb::AlreadyInitializedException;
+ /** === end UNO using === **/
+
+#ifdef DBG_UTIL
+ const char* SortableGridDataModel_checkInvariants( const void* _pInstance )
+ {
+ return static_cast< const SortableGridDataModel* >( _pInstance )->checkInvariants();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ const char* SortableGridDataModel::checkInvariants() const
+ {
+ if ( m_publicToPrivateRowIndex.size() != m_privateToPublicRowIndex.size() )
+ return "inconsistent index maps";
+
+ if ( m_delegator.is() )
+ {
+ if ( m_publicToPrivateRowIndex.size() != size_t( m_delegator->getRowCount() ) )
+ return "wrong cached row count";
+ }
+ else
+ {
+ if ( !m_publicToPrivateRowIndex.empty() )
+ return "disposed or not initialized, but having a non-empty map";
+ }
+
+ for ( size_t publicIndex=0; publicIndex<m_publicToPrivateRowIndex.size(); ++publicIndex )
+ {
+ ::sal_Int32 const privateIndex = m_publicToPrivateRowIndex[ publicIndex ];
+ if ( ( privateIndex < 0 ) || ( size_t( privateIndex ) >= m_privateToPublicRowIndex.size() ) )
+ return "invalid cached private index";
+
+ if ( m_privateToPublicRowIndex[ privateIndex ] != sal_Int32( publicIndex ) )
+ return "index map traversal not commutavive";
+ }
+
+ if ( impl_isSorted_nothrow() && m_publicToPrivateRowIndex.empty() )
+ return "sorted, but no row index translation tables";
+
+ if ( !impl_isSorted_nothrow() && !m_publicToPrivateRowIndex.empty() )
+ return "unsorted, but have index translation tables";
+
+ return NULL;
+ }
+#endif
+
+#define DBG_CHECK_ME() \
+ DBG_CHKTHIS( SortableGridDataModel, SortableGridDataModel_checkInvariants )
+
+ //------------------------------------------------------------------------------------------------------------------
+ namespace
+ {
+ template< class STLCONTAINER >
+ static void lcl_clear( STLCONTAINER& i_container )
+ {
+ STLCONTAINER empty;
+ empty.swap( i_container );
+ }
+ }
+
+ //==================================================================================================================
+ //= SortableGridDataModel
+ //==================================================================================================================
+ DBG_NAME( SortableGridDataModel )
+ //------------------------------------------------------------------------------------------------------------------
+ SortableGridDataModel::SortableGridDataModel( Reference< XMultiServiceFactory > const & i_factory )
+ :SortableGridDataModel_Base( m_aMutex )
+ ,SortableGridDataModel_PrivateBase()
+ ,m_context( i_factory )
+ ,m_isInitialized( false )
+ ,m_delegator()
+ ,m_collator()
+ ,m_currentSortColumn( -1 )
+ ,m_sortAscending( true )
+ ,m_publicToPrivateRowIndex()
+ ,m_privateToPublicRowIndex()
+ {
+ DBG_CTOR( SortableGridDataModel, SortableGridDataModel_checkInvariants );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ SortableGridDataModel::SortableGridDataModel( SortableGridDataModel const & i_copySource )
+ :cppu::BaseMutex()
+ ,SortableGridDataModel_Base( m_aMutex )
+ ,SortableGridDataModel_PrivateBase()
+ ,m_context( i_copySource.m_context )
+ ,m_isInitialized( true )
+ ,m_delegator()
+ ,m_collator( i_copySource.m_collator )
+ ,m_currentSortColumn( i_copySource.m_currentSortColumn )
+ ,m_sortAscending( i_copySource.m_sortAscending )
+ ,m_publicToPrivateRowIndex( i_copySource.m_publicToPrivateRowIndex )
+ ,m_privateToPublicRowIndex( i_copySource.m_privateToPublicRowIndex )
+ {
+ DBG_CTOR( SortableGridDataModel, SortableGridDataModel_checkInvariants );
+
+ ENSURE_OR_THROW( i_copySource.m_delegator.is(),
+ "not expected to be called for a disposed copy source!" );
+ m_delegator.set( i_copySource.m_delegator->createClone(), UNO_QUERY_THROW );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ SortableGridDataModel::~SortableGridDataModel()
+ {
+ if ( !rBHelper.bDisposed )
+ {
+ acquire();
+ dispose();
+ }
+
+ DBG_DTOR( SortableGridDataModel, SortableGridDataModel_checkInvariants );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Any SAL_CALL SortableGridDataModel::queryInterface( const Type& aType ) throw (RuntimeException)
+ {
+ Any aReturn( SortableGridDataModel_Base::queryInterface( aType ) );
+ if ( !aReturn.hasValue() )
+ aReturn = SortableGridDataModel_PrivateBase::queryInterface( aType );
+ return aReturn;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::acquire( ) throw ()
+ {
+ SortableGridDataModel_Base::acquire();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::release( ) throw ()
+ {
+ SortableGridDataModel_Base::release();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< Type > SAL_CALL SortableGridDataModel::getTypes( ) throw (RuntimeException)
+ {
+ return SortableGridDataModel_Base::getTypes();
+ // don't expose the types got via SortableGridDataModel_PrivateBase - they're private, after all
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::sal_Int8 > SAL_CALL SortableGridDataModel::getImplementationId( ) throw (RuntimeException)
+ {
+ static ::cppu::OImplementationId aId;
+ return aId.getImplementationId();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ namespace
+ {
+ Reference< XCollator > lcl_loadDefaultCollator_throw( ::comphelper::ComponentContext const & i_context )
+ {
+ Reference< XCollator > const xCollator( i_context.createComponent( "com.sun.star.i18n.Collator" ), UNO_QUERY_THROW );
+ xCollator->loadDefaultCollator( Application::GetSettings().GetLocale(), 0 );
+ return xCollator;
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::initialize( const Sequence< Any >& i_arguments ) throw (Exception, RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ if ( m_delegator.is() )
+ throw AlreadyInitializedException( ::rtl::OUString(), *this );
+
+ Reference< XMutableGridDataModel > xDelegator;
+ Reference< XCollator > xCollator;
+ switch ( i_arguments.getLength() )
+ {
+ case 1: // SortableGridDataModel.create( XMutableGridDataModel )
+ xDelegator.set( i_arguments[0], UNO_QUERY );
+ xCollator = lcl_loadDefaultCollator_throw( m_context );
+ break;
+
+ case 2: // SortableGridDataModel.createWithCollator( XMutableGridDataModel, XCollator )
+ xDelegator.set( i_arguments[0], UNO_QUERY );
+ xCollator.set( i_arguments[1], UNO_QUERY );
+ if ( !xCollator.is() )
+ throw IllegalArgumentException( ::rtl::OUString(), *this, 2 );
+ break;
+ }
+ if ( !xDelegator.is() )
+ throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
+
+ m_delegator = xDelegator;
+ m_collator = xCollator;
+
+ m_delegator->addGridDataListener( this );
+
+ m_isInitialized = true;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ GridDataEvent SortableGridDataModel::impl_createPublicEvent( GridDataEvent const & i_originalEvent ) const
+ {
+ GridDataEvent aEvent( i_originalEvent );
+ aEvent.Source = *const_cast< SortableGridDataModel* >( this );
+ aEvent.FirstRow = impl_getPublicRowIndex_nothrow( aEvent.FirstRow );
+ aEvent.LastRow = impl_getPublicRowIndex_nothrow( aEvent.LastRow );
+ return aEvent;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SortableGridDataModel::impl_broadcast( void ( SAL_CALL XGridDataListener::*i_listenerMethod )( const GridDataEvent & ),
+ GridDataEvent const & i_publicEvent, MethodGuard& i_instanceLock )
+ {
+ ::cppu::OInterfaceContainerHelper* pListeners = rBHelper.getContainer( XGridDataListener::static_type() );
+ if ( pListeners == NULL )
+ return;
+
+ i_instanceLock.clear();
+ pListeners->notifyEach( i_listenerMethod, i_publicEvent );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::rowsInserted( const GridDataEvent& i_event ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ // if the data is not sorted, broadcast the event unchanged
+ if ( !impl_isSorted_nothrow() )
+ {
+ GridDataEvent const aEvent( impl_createPublicEvent( i_event ) );
+ impl_broadcast( &XGridDataListener::rowsInserted, aEvent, aGuard );
+ return;
+ }
+
+ bool needReIndex = false;
+ if ( i_event.FirstRow > i_event.LastRow )
+ {
+ OSL_ENSURE( false, "SortableGridDataModel::rowsInserted: invalid event - invalid row indexes!" );
+ needReIndex = true;
+ }
+ else if ( size_t( i_event.FirstRow ) > m_privateToPublicRowIndex.size() )
+ {
+ OSL_ENSURE( false, "SortableGridDataModel::rowsInserted: invalid event - too large row index!" );
+ needReIndex = true;
+ }
+
+ if ( needReIndex )
+ {
+ impl_rebuildIndexesAndNotify( aGuard );
+ return;
+ }
+
+ // we do not insert the new rows into the sort order - if somebody adds rows while we're sorted, s/he has
+ // to resort. Instead, we simply append the rows, no matter where they were inserted in the delegator data
+ // model.
+ sal_Int32 const nPublicFirstRow = sal_Int32( m_privateToPublicRowIndex.size() );
+ sal_Int32 nPublicLastRow = nPublicFirstRow;
+ for ( sal_Int32 newRow = i_event.FirstRow; newRow <= i_event.LastRow; ++newRow, ++nPublicLastRow )
+ {
+ m_privateToPublicRowIndex.push_back( nPublicLastRow );
+ m_publicToPrivateRowIndex.push_back( nPublicLastRow );
+ }
+
+ // broadcast the event
+ GridDataEvent const aEvent( *this, -1, -1, nPublicFirstRow, nPublicLastRow );
+ impl_broadcast( &XGridDataListener::rowsInserted, aEvent, aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ namespace
+ {
+ void lcl_decrementValuesGreaterThan( ::std::vector< ::sal_Int32 > & io_indexMap, sal_Int32 const i_threshold )
+ {
+ for ( ::std::vector< ::sal_Int32 >::iterator loop = io_indexMap.begin();
+ loop != io_indexMap.end();
+ ++loop
+ )
+ {
+ if ( *loop >= i_threshold )
+ --*loop;
+ }
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SortableGridDataModel::impl_rebuildIndexesAndNotify( MethodGuard& i_instanceLock )
+ {
+ OSL_PRECOND( impl_isSorted_nothrow(), "SortableGridDataModel::impl_rebuildIndexesAndNotify: illegal call!" );
+
+ // clear the indexes
+ lcl_clear( m_publicToPrivateRowIndex );
+ lcl_clear( m_privateToPublicRowIndex );
+
+ // broadcast an artificial event, saying that all rows have been removed
+ GridDataEvent const aRemovalEvent( *this, -1, -1, -1, -1 );
+ impl_broadcast( &XGridDataListener::rowsRemoved, aRemovalEvent, i_instanceLock );
+ i_instanceLock.reset();
+
+ // rebuild the index
+ impl_reIndex_nothrow( m_currentSortColumn, m_sortAscending );
+
+ // broadcast an artificial event, saying that n rows have been added
+ GridDataEvent const aAdditionEvent( *this, -1, -1, 0, m_delegator->getRowCount() - 1 );
+ impl_broadcast( &XGridDataListener::rowsInserted, aAdditionEvent, i_instanceLock );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::rowsRemoved( const GridDataEvent& i_event ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ // if the data is not sorted, broadcast the event unchanged
+ if ( !impl_isSorted_nothrow() )
+ {
+ GridDataEvent const aEvent( impl_createPublicEvent( i_event ) );
+ impl_broadcast( &XGridDataListener::rowsRemoved, aEvent, aGuard );
+ return;
+ }
+
+ // if all rows have been removed, also simply multiplex to own listeners
+ if ( i_event.FirstRow < 0 )
+ {
+ lcl_clear( m_publicToPrivateRowIndex );
+ lcl_clear( m_privateToPublicRowIndex );
+ GridDataEvent aEvent( i_event );
+ aEvent.Source = *this;
+ impl_broadcast( &XGridDataListener::rowsRemoved, aEvent, aGuard );
+ return;
+ }
+
+ bool needReIndex = false;
+ if ( i_event.FirstRow != i_event.LastRow )
+ {
+ OSL_ENSURE( false, "SortableGridDataModel::rowsRemoved: missing implementation - removal of multiple rows!" );
+ needReIndex = true;
+ }
+ else if ( size_t( i_event.FirstRow ) >= m_privateToPublicRowIndex.size() )
+ {
+ OSL_ENSURE( false, "SortableGridDataModel::rowsRemoved: inconsistent/wrong data!" );
+ needReIndex = true;
+ }
+
+ if ( needReIndex )
+ {
+ impl_rebuildIndexesAndNotify( aGuard );
+ return;
+ }
+
+ // build public event version
+ GridDataEvent const aEvent( impl_createPublicEvent( i_event ) );
+
+ // remove the entries from the index maps
+ sal_Int32 const privateIndex = i_event.FirstRow;
+ sal_Int32 const publicIndex = aEvent.FirstRow;
+
+ m_publicToPrivateRowIndex.erase( m_publicToPrivateRowIndex.begin() + publicIndex );
+ m_privateToPublicRowIndex.erase( m_privateToPublicRowIndex.begin() + privateIndex );
+
+ // adjust remaining entries in the index maps
+ lcl_decrementValuesGreaterThan( m_publicToPrivateRowIndex, privateIndex );
+ lcl_decrementValuesGreaterThan( m_privateToPublicRowIndex, publicIndex );
+
+ // broadcast the event
+ impl_broadcast( &XGridDataListener::rowsRemoved, aEvent, aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::dataChanged( const GridDataEvent& i_event ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ GridDataEvent const aEvent( impl_createPublicEvent( i_event ) );
+ impl_broadcast( &XGridDataListener::dataChanged, aEvent, aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::rowHeadingChanged( const GridDataEvent& i_event ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ GridDataEvent const aEvent( impl_createPublicEvent( i_event ) );
+ impl_broadcast( &XGridDataListener::rowHeadingChanged, aEvent, aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::disposing( const EventObject& i_event ) throw (RuntimeException)
+ {
+ // not interested in
+ OSL_UNUSED( i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ namespace
+ {
+ class CellDataLessComparison : public ::std::binary_function< sal_Int32, sal_Int32, bool >
+ {
+ public:
+ CellDataLessComparison(
+ ::std::vector< Any > const & i_data,
+ ::comphelper::IKeyPredicateLess& i_predicate,
+ sal_Bool const i_sortAscending
+ )
+ :m_data( i_data )
+ ,m_predicate( i_predicate )
+ ,m_sortAscending( i_sortAscending )
+ {
+ }
+
+ bool operator()( sal_Int32 const i_lhs, sal_Int32 const i_rhs ) const
+ {
+ Any const & lhs = m_data[ i_lhs ];
+ Any const & rhs = m_data[ i_rhs ];
+ // <VOID/> is less than everything else
+ if ( !lhs.hasValue() )
+ return m_sortAscending;
+ if ( !rhs.hasValue() )
+ return !m_sortAscending;
+
+ // actually compare
+ if ( m_sortAscending )
+ return m_predicate.isLess( lhs, rhs );
+ else
+ return m_predicate.isLess( rhs, lhs );
+ }
+
+ private:
+ ::std::vector< Any > const & m_data;
+ ::comphelper::IKeyPredicateLess const & m_predicate;
+ sal_Bool const m_sortAscending;
+ };
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SortableGridDataModel::impl_reIndex_nothrow( ::sal_Int32 const i_columnIndex, sal_Bool const i_sortAscending )
+ {
+ ::sal_Int32 const rowCount( getRowCount() );
+ ::std::vector< ::sal_Int32 > aPublicToPrivate( rowCount );
+
+ try
+ {
+ // build an unsorted translation table, and retrieve the unsorted data
+ ::std::vector< Any > aColumnData( rowCount );
+ Type dataType;
+ for ( ::sal_Int32 rowIndex = 0; rowIndex < rowCount; ++rowIndex )
+ {
+ aColumnData[ rowIndex ] = m_delegator->getCellData( i_columnIndex, rowIndex );
+ aPublicToPrivate[ rowIndex ] = rowIndex;
+
+ // determine the data types we assume for the complete column
+ if ( ( dataType.getTypeClass() == TypeClass_VOID ) && aColumnData[ rowIndex ].hasValue() )
+ dataType = aColumnData[ rowIndex ].getValueType();
+ }
+
+ // get predicate object
+ ::std::auto_ptr< ::comphelper::IKeyPredicateLess > const pPredicate( ::comphelper::getStandardLessPredicate( dataType, m_collator ) );
+ ENSURE_OR_RETURN_VOID( pPredicate.get(), "SortableGridDataModel::impl_reIndex_nothrow: no sortable data found!" );
+
+ // then sort
+ CellDataLessComparison const aComparator( aColumnData, *pPredicate, i_sortAscending );
+ ::std::sort( aPublicToPrivate.begin(), aPublicToPrivate.end(), aComparator );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ return;
+ }
+
+ // also build the "private to public" mapping
+ ::std::vector< sal_Int32 > aPrivateToPublic( aPublicToPrivate.size() );
+ for ( size_t i=0; i<aPublicToPrivate.size(); ++i )
+ aPrivateToPublic[ aPublicToPrivate[i] ] = i;
+
+ m_publicToPrivateRowIndex.swap( aPublicToPrivate );
+ m_privateToPublicRowIndex.swap( aPrivateToPublic );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::sortByColumn( ::sal_Int32 i_columnIndex, ::sal_Bool i_sortAscending ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ if ( ( i_columnIndex < 0 ) || ( i_columnIndex >= getColumnCount() ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
+
+ impl_reIndex_nothrow( i_columnIndex, i_sortAscending );
+
+ m_currentSortColumn = i_columnIndex;
+ m_sortAscending = i_sortAscending;
+
+ impl_broadcast(
+ &XGridDataListener::dataChanged,
+ GridDataEvent( *this, -1, -1, -1, -1 ),
+ aGuard
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::removeColumnSort( ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ lcl_clear( m_publicToPrivateRowIndex );
+ lcl_clear( m_privateToPublicRowIndex );
+
+ m_currentSortColumn = -1;
+ m_sortAscending = sal_True;
+
+ impl_broadcast(
+ &XGridDataListener::dataChanged,
+ GridDataEvent( *this, -1, -1, -1, -1 ),
+ aGuard
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Pair< ::sal_Int32, ::sal_Bool > SAL_CALL SortableGridDataModel::getCurrentSortOrder( ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ return Pair< ::sal_Int32, ::sal_Bool >( m_currentSortColumn, m_sortAscending );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::addRow( const Any& i_heading, const Sequence< Any >& i_data ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ delegator->addRow( i_heading, i_data );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::addRows( const Sequence< Any >& i_headings, const Sequence< Sequence< Any > >& i_data ) throw (IllegalArgumentException, RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ delegator->addRows( i_headings, i_data );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::removeRow( ::sal_Int32 i_rowIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ delegator->removeRow( rowIndex );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::removeAllRows( ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ delegator->removeAllRows();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::updateCellData( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex, const Any& i_value ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ delegator->updateCellData( i_columnIndex, rowIndex, i_value );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::updateRowData( const Sequence< ::sal_Int32 >& i_columnIndexes, ::sal_Int32 i_rowIndex, const Sequence< Any >& i_values ) throw (IndexOutOfBoundsException, IllegalArgumentException, RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ delegator->updateRowData( i_columnIndexes, rowIndex, i_values );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::updateRowHeading( ::sal_Int32 i_rowIndex, const Any& i_heading ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ delegator->updateRowHeading( rowIndex, i_heading );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::updateCellToolTip( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex, const Any& i_value ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ delegator->updateCellToolTip( i_columnIndex, rowIndex, i_value );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::updateRowToolTip( ::sal_Int32 i_rowIndex, const Any& i_value ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ delegator->updateRowToolTip( rowIndex, i_value );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::addGridDataListener( const Reference< XGridDataListener >& i_listener ) throw (RuntimeException)
+ {
+ rBHelper.addListener( XGridDataListener::static_type(), i_listener );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::removeGridDataListener( const Reference< XGridDataListener >& i_listener ) throw (RuntimeException)
+ {
+ rBHelper.removeListener( XGridDataListener::static_type(), i_listener );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL SortableGridDataModel::getRowCount() throw (RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ return delegator->getRowCount();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL SortableGridDataModel::getColumnCount() throw (RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ return delegator->getColumnCount();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Any SAL_CALL SortableGridDataModel::getCellData( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ return delegator->getCellData( i_columnIndex, rowIndex );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Any SAL_CALL SortableGridDataModel::getCellToolTip( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ return delegator->getCellToolTip( i_columnIndex, rowIndex );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Any SAL_CALL SortableGridDataModel::getRowHeading( ::sal_Int32 i_rowIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ return delegator->getRowHeading( rowIndex );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::disposing()
+ {
+ m_currentSortColumn = -1;
+
+ Reference< XComponent > const delegatorComponent( m_delegator.get() );
+ m_delegator->removeGridDataListener( this );
+ m_delegator.clear();
+ delegatorComponent->dispose();
+
+ Reference< XComponent > const collatorComponent( m_collator, UNO_QUERY );
+ m_collator.clear();
+ if ( collatorComponent.is() )
+ collatorComponent->dispose();
+
+ lcl_clear( m_publicToPrivateRowIndex );
+ lcl_clear( m_privateToPublicRowIndex );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XCloneable > SAL_CALL SortableGridDataModel::createClone( ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ return new SortableGridDataModel( *this );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL SortableGridDataModel::getImplementationName( ) throw (RuntimeException)
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.toolkit.SortableGridDataModel" ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL SortableGridDataModel::supportsService( const ::rtl::OUString& i_serviceName ) throw (RuntimeException)
+ {
+ Sequence< ::rtl::OUString > const aServiceNames( getSupportedServiceNames() );
+ for ( sal_Int32 i=0; i<aServiceNames.getLength(); ++i )
+ if ( aServiceNames[i] == i_serviceName )
+ return sal_True;
+ return sal_False;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL SortableGridDataModel::getSupportedServiceNames( ) throw (RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aServiceNames(1);
+ aServiceNames[0] = ::rtl::OUString::createFromAscii( szServiceName_SortableGridDataModel );
+ return aServiceNames;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SortableGridDataModel::impl_getPrivateRowIndex_throw( ::sal_Int32 const i_publicRowIndex ) const
+ {
+ if ( ( i_publicRowIndex < 0 ) || ( i_publicRowIndex >= m_delegator->getRowCount() ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *const_cast< SortableGridDataModel* >( this ) );
+
+ if ( !impl_isSorted_nothrow() )
+ // no need to translate anything
+ return i_publicRowIndex;
+
+ ENSURE_OR_RETURN( size_t( i_publicRowIndex ) < m_publicToPrivateRowIndex.size(),
+ "SortableGridDataModel::impl_getPrivateRowIndex_throw: inconsistency!", i_publicRowIndex );
+ // obviously the translation table contains too few elements - it should have exactly |getRowCount()|
+ // elements
+
+ return m_publicToPrivateRowIndex[ i_publicRowIndex ];
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SortableGridDataModel::impl_getPublicRowIndex_nothrow( ::sal_Int32 const i_privateRowIndex ) const
+ {
+ if ( !impl_isSorted_nothrow() )
+ // no need to translate anything
+ return i_privateRowIndex;
+
+ if ( i_privateRowIndex < 0 )
+ return i_privateRowIndex;
+
+ ENSURE_OR_RETURN( size_t( i_privateRowIndex ) < m_privateToPublicRowIndex.size(),
+ "SortableGridDataModel::impl_getPublicRowIndex_nothrow: invalid index!", i_privateRowIndex );
+
+ return m_privateToPublicRowIndex[ i_privateRowIndex ];
+ }
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SortableGridDataModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
+{
+ return *( new ::toolkit::SortableGridDataModel( i_factory ) );
+}
diff --git a/toolkit/source/controls/grid/sortablegriddatamodel.hxx b/toolkit/source/controls/grid/sortablegriddatamodel.hxx
new file mode 100755
index 000000000000..50f08d3a7113
--- /dev/null
+++ b/toolkit/source/controls/grid/sortablegriddatamodel.hxx
@@ -0,0 +1,198 @@
+/*************************************************************************
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef TOOLKIT_SORTABLEGRIDDATAMODEL_HXX
+#define TOOLKIT_SORTABLEGRIDDATAMODEL_HXX
+
+#include "initguard.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/grid/XSortableMutableGridDataModel.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/i18n/XCollator.hpp>
+#include <com/sun/star/awt/grid/XGridDataListener.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/componentcontext.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase3.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+//......................................................................................................................
+namespace toolkit
+{
+//......................................................................................................................
+
+ class SortableGridDataModel;
+ typedef InitGuard< SortableGridDataModel > MethodGuard;
+
+ //==================================================================================================================
+ //= SortableGridDataModel
+ //==================================================================================================================
+ typedef ::cppu::WeakComponentImplHelper3 < ::com::sun::star::awt::grid::XSortableMutableGridDataModel
+ , ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::lang::XInitialization
+ > SortableGridDataModel_Base;
+ typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::grid::XGridDataListener
+ > SortableGridDataModel_PrivateBase;
+ class SortableGridDataModel :public ::cppu::BaseMutex
+ ,public SortableGridDataModel_Base
+ ,public SortableGridDataModel_PrivateBase
+ {
+ public:
+ SortableGridDataModel( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > const & i_factory );
+ SortableGridDataModel( SortableGridDataModel const & i_copySource );
+
+ bool isInitialized() const { return m_isInitialized; }
+
+#ifdef DBG_UTIL
+ const char* checkInvariants() const;
+#endif
+
+ protected:
+ ~SortableGridDataModel();
+
+ public:
+ // XSortableGridData
+ virtual void SAL_CALL sortByColumn( ::sal_Int32 ColumnIndex, ::sal_Bool SortAscending ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeColumnSort( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::beans::Pair< ::sal_Int32, ::sal_Bool > SAL_CALL getCurrentSortOrder( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XMutableGridDataModel
+ virtual void SAL_CALL addRow( const ::com::sun::star::uno::Any& Heading, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Data ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Headings, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& Data ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeRow( ::sal_Int32 RowIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeAllRows( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateCellData( ::sal_Int32 ColumnIndex, ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateRowData( const ::com::sun::star::uno::Sequence< ::sal_Int32 >& ColumnIndexes, ::sal_Int32 RowIndex, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateRowHeading( ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Heading ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateCellToolTip( ::sal_Int32 ColumnIndex, ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateRowToolTip( ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addGridDataListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeGridDataListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XGridDataModel
+ virtual ::sal_Int32 SAL_CALL getRowCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getColumnCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getCellData( ::sal_Int32 Column, ::sal_Int32 Row ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getCellToolTip( ::sal_Int32 Column, ::sal_Int32 Row ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getRowHeading( ::sal_Int32 RowIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+ // XCloneable
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // XGridDataListener
+ virtual void SAL_CALL rowsInserted( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL rowsRemoved( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL dataChanged( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL rowHeadingChanged( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& i_event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire( ) throw ();
+ virtual void SAL_CALL release( ) throw ();
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException);
+
+ private:
+ /** translates the given public index into one to be passed to our delegator
+ @throws ::com::sun::star::lang::IndexOutOfBoundsException
+ if the given index does not denote a valid row
+ */
+ ::sal_Int32 impl_getPrivateRowIndex_throw( ::sal_Int32 const i_publicRowIndex ) const;
+
+ /** translates the given private row index to a public one
+ */
+ ::sal_Int32 impl_getPublicRowIndex_nothrow( ::sal_Int32 const i_privateRowIndex ) const;
+
+ inline bool impl_isSorted_nothrow() const
+ {
+ return m_currentSortColumn >= 0;
+ }
+
+ /** rebuilds the index translation structure.
+
+ Neither <member>m_currentSortColumn</member> nor <member>m_sortAscending</member> are touched by this method.
+ Also, the given column index is not checked, this is the responsibility of the caller.
+ */
+ void impl_reIndex_nothrow( ::sal_Int32 const i_columnIndex, sal_Bool const i_sortAscending );
+
+ /** translates the given event, obtained from our delegator, to a version which can be broadcasted to our own
+ clients.
+ */
+ ::com::sun::star::awt::grid::GridDataEvent
+ impl_createPublicEvent( ::com::sun::star::awt::grid::GridDataEvent const & i_originalEvent ) const;
+
+ /** broadcasts the given event to our registered XGridDataListeners
+ */
+ void impl_broadcast(
+ void ( SAL_CALL ::com::sun::star::awt::grid::XGridDataListener::*i_listenerMethod )( const ::com::sun::star::awt::grid::GridDataEvent & ),
+ ::com::sun::star::awt::grid::GridDataEvent const & i_publicEvent,
+ MethodGuard& i_instanceLock
+ );
+
+ /** rebuilds our indexes, notifying row removal and row addition events
+
+ First, a rowsRemoved event is notified to our registered listeners. Then, the index translation tables are
+ rebuilt, and a rowsInserted event is notified.
+
+ Only to be called when we're sorted.
+ */
+ void impl_rebuildIndexesAndNotify( MethodGuard& i_instanceLock );
+
+ private:
+ ::comphelper::ComponentContext m_context;
+ bool m_isInitialized;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XMutableGridDataModel > m_delegator;
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > m_collator;
+ ::sal_Int32 m_currentSortColumn;
+ ::sal_Bool m_sortAscending;
+ ::std::vector< ::sal_Int32 > m_publicToPrivateRowIndex;
+ ::std::vector< ::sal_Int32 > m_privateToPublicRowIndex;
+ };
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
+
+#endif // TOOLKIT_SORTABLEGRIDDATAMODEL_HXX
diff --git a/toolkit/source/controls/roadmapcontrol.cxx b/toolkit/source/controls/roadmapcontrol.cxx
index 96f51b39dc72..875f05e2f80d 100644
--- a/toolkit/source/controls/roadmapcontrol.cxx
+++ b/toolkit/source/controls/roadmapcontrol.cxx
@@ -66,7 +66,9 @@ static void lcl_throwIndexOutOfBoundsException( )
// = UnoControlRoadmapModel
// ===================================================================
// -------------------------------------------------------------------
- UnoControlRoadmapModel::UnoControlRoadmapModel() : maContainerListeners( *this )
+ UnoControlRoadmapModel::UnoControlRoadmapModel( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlRoadmapModel_Base( i_factory )
+ ,maContainerListeners( *this )
{
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
ImplRegisterProperty( BASEPROPERTY_BORDER );
@@ -368,7 +370,9 @@ static void lcl_throwIndexOutOfBoundsException( )
// = UnoRoadmapControl
// ===================================================================
// -------------------------------------------------------------------
- UnoRoadmapControl::UnoRoadmapControl(): maItemListeners( *this )
+ UnoRoadmapControl::UnoRoadmapControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlRoadmap_Base( i_factory )
+ ,maItemListeners( *this )
{
}
diff --git a/toolkit/source/controls/spinningprogress.cxx b/toolkit/source/controls/spinningprogress.cxx
index d4b89d5123ec..cb02274e3997 100755
--- a/toolkit/source/controls/spinningprogress.cxx
+++ b/toolkit/source/controls/spinningprogress.cxx
@@ -55,13 +55,15 @@ namespace toolkit
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Type;
using ::com::sun::star::beans::XPropertySetInfo;
+ using ::com::sun::star::lang::XMultiServiceFactory;
/** === end UNO using === **/
//==================================================================================================================
//= SpinningProgressControlModel
//==================================================================================================================
//------------------------------------------------------------------------------------------------------------------
- SpinningProgressControlModel::SpinningProgressControlModel()
+ SpinningProgressControlModel::SpinningProgressControlModel( Reference< XMultiServiceFactory > const & i_factory )
+ :SpinningProgressControlModel_Base( i_factory )
{
// default image sets
osl_incrementInterlockedCount( &m_refCount );
diff --git a/toolkit/source/controls/tabpagecontainer.cxx b/toolkit/source/controls/tabpagecontainer.cxx
index b7e381ae27c7..808feca02e8a 100644
--- a/toolkit/source/controls/tabpagecontainer.cxx
+++ b/toolkit/source/controls/tabpagecontainer.cxx
@@ -54,7 +54,9 @@ using namespace ::com::sun::star::view;
// ----------------------------------------------------
// class UnoControlTabPageContainerModel
// ----------------------------------------------------
-UnoControlTabPageContainerModel::UnoControlTabPageContainerModel() : maContainerListeners( *this )
+UnoControlTabPageContainerModel::UnoControlTabPageContainerModel( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlTabPageContainerModel_Base( i_factory )
+ ,maContainerListeners( *this )
{
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
ImplRegisterProperty( BASEPROPERTY_BORDER );
@@ -176,8 +178,9 @@ void UnoControlTabPageContainerModel::removeContainerListener( const Reference<
// ----------------------------------------------------
// class UnoControlTabPageContainer
// ----------------------------------------------------
-UnoControlTabPageContainer::UnoControlTabPageContainer():
- m_aTabPageListeners( *this )
+UnoControlTabPageContainer::UnoControlTabPageContainer( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlTabPageContainer_Base( i_factory )
+ ,m_aTabPageListeners( *this )
{
}
@@ -290,12 +293,3 @@ void SAL_CALL UnoControlTabPageContainer::addControl( const ::rtl::OUString& Nam
xContainerListener->elementInserted( aEvent );
}
-Reference< XInterface > SAL_CALL UnoControlTabPageContainer_CreateInstance( const Reference< XMultiServiceFactory >& )
-{
- return Reference < XInterface >( ( ::cppu::OWeakObject* ) new UnoControlTabPageContainer );
-}
-
-Reference< XInterface > SAL_CALL UnoControlTabPageContainerModel_CreateInstance( const Reference< XMultiServiceFactory >& )
-{
- return Reference < XInterface >( ( ::cppu::OWeakObject* ) new OGeometryControlModel<UnoControlTabPageContainerModel>() );
-}
diff --git a/toolkit/source/controls/tabpagemodel.cxx b/toolkit/source/controls/tabpagemodel.cxx
index 4afd46724cab..f498fefd761b 100644
--- a/toolkit/source/controls/tabpagemodel.cxx
+++ b/toolkit/source/controls/tabpagemodel.cxx
@@ -143,7 +143,8 @@ using namespace ::com::sun::star::util;
// ----------------------------------------------------
// class UnoControlTabPageModel
// ----------------------------------------------------
-UnoControlTabPageModel::UnoControlTabPageModel(Reference< XComponentContext >const & i_xCompContext) : m_xCompContext(i_xCompContext)
+UnoControlTabPageModel::UnoControlTabPageModel( Reference< XMultiServiceFactory > const & i_factory )
+ :ControlModelContainerBase( i_factory )
{
ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
ImplRegisterProperty( BASEPROPERTY_TITLE );
@@ -209,7 +210,7 @@ void SAL_CALL UnoControlTabPageModel::initialize (const Sequence<Any>& rArgument
::rtl::OUString sURL;
if ( !( rArguments[ 1 ] >>= sURL ))
throw lang::IllegalArgumentException();
- Reference<container::XNameContainer > xDialogModel = awt::UnoControlDialogModelProvider::create(m_xCompContext,sURL);
+ Reference<container::XNameContainer > xDialogModel = awt::UnoControlDialogModelProvider::create( maContext.getUNOContext(),sURL);
if ( xDialogModel.is() )
{
Sequence< ::rtl::OUString> aNames = xDialogModel->getElementNames();
@@ -246,16 +247,6 @@ void SAL_CALL UnoControlTabPageModel::initialize (const Sequence<Any>& rArgument
m_nTabPageId = -1;
}
//===== Service ===============================================================
-Reference< XInterface > SAL_CALL UnoControlTabPageModel_CreateInstance( const Reference< XMultiServiceFactory >& xServiceFactory)
-{
- Reference < ::com::sun::star::beans::XPropertySet > xPropertySet (xServiceFactory, UNO_QUERY);
- Any any = xPropertySet->getPropertyValue(::rtl::OUString::createFromAscii("DefaultContext"));
- Reference < XComponentContext > xCompCtx;
- any >>= xCompCtx;
- return Reference < XInterface >( ( ::cppu::OWeakObject* ) new OGeometryControlModel<UnoControlTabPageModel>(xCompCtx) );
- //return Reference < XInterface > ( (::cppu::OWeakObject* ) new UnoControlTabPageModel(xCompCtx));
-}
-
::rtl::OUString UnoControlTabPageModel_getImplementationName (void) throw(RuntimeException)
{
return rtl::OUString::createFromAscii("com.sun.star.awt.tab.UnoControlTabPageModel");
@@ -272,8 +263,9 @@ Sequence<rtl::OUString> SAL_CALL UnoControlTabPageModel_getSupportedServiceNames
// = class UnoControlTabPage
// ============================================================================
-UnoControlTabPage::UnoControlTabPage() :
- m_bWindowListener(false)
+UnoControlTabPage::UnoControlTabPage( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlTabPage_Base( i_factory )
+ ,m_bWindowListener(false)
{
maComponentInfos.nWidth = 280;
maComponentInfos.nHeight = 400;
diff --git a/toolkit/source/controls/tkscrollbar.cxx b/toolkit/source/controls/tkscrollbar.cxx
index 2de8b56131c8..f75183186610 100644
--- a/toolkit/source/controls/tkscrollbar.cxx
+++ b/toolkit/source/controls/tkscrollbar.cxx
@@ -47,7 +47,8 @@ namespace toolkit
//= UnoControlScrollBarModel
//====================================================================
//--------------------------------------------------------------------
- UnoControlScrollBarModel::UnoControlScrollBarModel()
+ UnoControlScrollBarModel::UnoControlScrollBarModel( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
{
UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXScrollBar );
}
@@ -96,8 +97,9 @@ namespace toolkit
//====================================================================
//= UnoControlScrollBarModel
//====================================================================
- UnoScrollBarControl::UnoScrollBarControl()
- : maAdjustmentListeners( *this )
+ UnoScrollBarControl::UnoScrollBarControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
+ :UnoControlBase( i_factory )
+ ,maAdjustmentListeners( *this )
{
}
diff --git a/toolkit/source/controls/tksimpleanimation.cxx b/toolkit/source/controls/tksimpleanimation.cxx
index 6ad33608f6ee..90f56d5ad4bd 100644
--- a/toolkit/source/controls/tksimpleanimation.cxx
+++ b/toolkit/source/controls/tksimpleanimation.cxx
@@ -44,7 +44,8 @@ namespace toolkit
//= UnoSimpleAnimationControlModel
//====================================================================
//--------------------------------------------------------------------
- UnoSimpleAnimationControlModel::UnoSimpleAnimationControlModel()
+ UnoSimpleAnimationControlModel::UnoSimpleAnimationControlModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
{
ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
ImplRegisterProperty( BASEPROPERTY_REPEAT );
@@ -119,7 +120,8 @@ namespace toolkit
//= UnoSimpleAnimationControl
//====================================================================
//--------------------------------------------------------------------
- UnoSimpleAnimationControl::UnoSimpleAnimationControl()
+ UnoSimpleAnimationControl::UnoSimpleAnimationControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
+ :UnoSimpleAnimationControl_Base( i_factory )
{
}
diff --git a/toolkit/source/controls/tkspinbutton.cxx b/toolkit/source/controls/tkspinbutton.cxx
index 5929dc7a4635..9396aea43290 100644
--- a/toolkit/source/controls/tkspinbutton.cxx
+++ b/toolkit/source/controls/tkspinbutton.cxx
@@ -50,7 +50,8 @@ namespace toolkit
//= UnoSpinButtonModel
//====================================================================
//--------------------------------------------------------------------
- UnoSpinButtonModel::UnoSpinButtonModel()
+ UnoSpinButtonModel::UnoSpinButtonModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
{
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
ImplRegisterProperty( BASEPROPERTY_BORDER );
@@ -137,8 +138,9 @@ namespace toolkit
//= UnoSpinButtonControl
//====================================================================
//--------------------------------------------------------------------
- UnoSpinButtonControl::UnoSpinButtonControl()
- :maAdjustmentListeners( *this )
+ UnoSpinButtonControl::UnoSpinButtonControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlBase( i_factory )
+ ,maAdjustmentListeners( *this )
{
}
diff --git a/toolkit/source/controls/tkthrobber.cxx b/toolkit/source/controls/tkthrobber.cxx
index 1dc83f860e34..8a1927a732cb 100644
--- a/toolkit/source/controls/tkthrobber.cxx
+++ b/toolkit/source/controls/tkthrobber.cxx
@@ -44,7 +44,8 @@ namespace toolkit
//= UnoThrobberControlModel
//====================================================================
//--------------------------------------------------------------------
- UnoThrobberControlModel::UnoThrobberControlModel()
+ UnoThrobberControlModel::UnoThrobberControlModel( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
{
ImplRegisterProperty( BASEPROPERTY_BORDER );
ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
@@ -117,7 +118,8 @@ namespace toolkit
//= UnoThrobberControl
//====================================================================
//--------------------------------------------------------------------
- UnoThrobberControl::UnoThrobberControl()
+ UnoThrobberControl::UnoThrobberControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
+ :UnoControlBase( i_factory )
{
}
diff --git a/toolkit/source/controls/tree/treecontrol.cxx b/toolkit/source/controls/tree/treecontrol.cxx
index d56ca82bb845..d2c66c64b41a 100644
--- a/toolkit/source/controls/tree/treecontrol.cxx
+++ b/toolkit/source/controls/tree/treecontrol.cxx
@@ -55,7 +55,8 @@ namespace toolkit
// ----------------------------------------------------
// class UnoTreeModel
// ----------------------------------------------------
-UnoTreeModel::UnoTreeModel()
+UnoTreeModel::UnoTreeModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
{
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
ImplRegisterProperty( BASEPROPERTY_BORDER );
@@ -74,7 +75,7 @@ UnoTreeModel::UnoTreeModel()
ImplRegisterProperty( BASEPROPERTY_TREE_ROOTDISPLAYED );
ImplRegisterProperty( BASEPROPERTY_TREE_SHOWSHANDLES );
ImplRegisterProperty( BASEPROPERTY_TREE_SHOWSROOTHANDLES );
- ImplRegisterProperty( BASEPROPERTY_TREE_ROWHEIGHT );
+ ImplRegisterProperty( BASEPROPERTY_ROW_HEIGHT );
ImplRegisterProperty( BASEPROPERTY_TREE_INVOKESSTOPNODEEDITING );
ImplRegisterProperty( BASEPROPERTY_HIDEINACTIVESELECTION );
}
@@ -100,7 +101,7 @@ Any UnoTreeModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
{
case BASEPROPERTY_TREE_SELECTIONTYPE:
return Any( SelectionType_NONE );
- case BASEPROPERTY_TREE_ROWHEIGHT:
+ case BASEPROPERTY_ROW_HEIGHT:
return Any( sal_Int32( 0 ) );
case BASEPROPERTY_TREE_DATAMODEL:
return Any( Reference< XTreeDataModel >( 0 ) );
@@ -140,8 +141,9 @@ Reference< XPropertySetInfo > UnoTreeModel::getPropertySetInfo( ) throw(Runtime
// ----------------------------------------------------
// class UnoTreeControl
// ----------------------------------------------------
-UnoTreeControl::UnoTreeControl()
-: maSelectionListeners( *this )
+UnoTreeControl::UnoTreeControl( const Reference< XMultiServiceFactory >& i_factory )
+: UnoTreeControl_Base( i_factory )
+, maSelectionListeners( *this )
, maTreeExpansionListeners( *this )
, maTreeEditListeners( *this )
{
@@ -452,14 +454,14 @@ void UnoTreeControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolk
}
-Reference< XInterface > SAL_CALL TreeControl_CreateInstance( const Reference< XMultiServiceFactory >& )
+Reference< XInterface > SAL_CALL TreeControl_CreateInstance( const Reference< XMultiServiceFactory >& i_factory )
{
- return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoTreeControl );
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoTreeControl( i_factory ) );
}
-Reference< XInterface > SAL_CALL TreeControlModel_CreateInstance( const Reference< XMultiServiceFactory >& )
+Reference< XInterface > SAL_CALL TreeControlModel_CreateInstance( const Reference< XMultiServiceFactory >& i_factory )
{
- return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoTreeModel );
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoTreeModel( i_factory ) );
}
void SAL_CALL TreeEditListenerMultiplexer::nodeEditing( const Reference< XTreeNode >& Node ) throw (RuntimeException, ::com::sun::star::util::VetoException)
diff --git a/toolkit/source/controls/tree/treecontrol.hxx b/toolkit/source/controls/tree/treecontrol.hxx
index e646664c4a64..ff5ddb4e348c 100644
--- a/toolkit/source/controls/tree/treecontrol.hxx
+++ b/toolkit/source/controls/tree/treecontrol.hxx
@@ -54,7 +54,7 @@ protected:
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
public:
- UnoTreeModel();
+ UnoTreeModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoTreeModel( const UnoTreeModel& rModel );
UnoControlModel* Clone() const;
@@ -73,10 +73,11 @@ public:
// ===================================================================
// = UnoTreeControl
// ===================================================================
-class UnoTreeControl : public ::cppu::ImplInheritanceHelper1< UnoControlBase, ::com::sun::star::awt::tree::XTreeControl >
+typedef ::cppu::ImplInheritanceHelper1< UnoControlBase, ::com::sun::star::awt::tree::XTreeControl > UnoTreeControl_Base;
+class UnoTreeControl : public UnoTreeControl_Base
{
public:
- UnoTreeControl();
+ UnoTreeControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
::rtl::OUString GetComponentServiceName();
// ::com::sun::star::lang::XComponent
diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx
index 075080906900..38f2fd7c2603 100644
--- a/toolkit/source/controls/unocontrol.cxx
+++ b/toolkit/source/controls/unocontrol.cxx
@@ -52,6 +52,7 @@
#include <vcl/svapp.hxx>
#include <vcl/wrkwin.hxx>
#include <comphelper/stl_types.hxx>
+#include <comphelper/processfactory.hxx>
#include <toolkit/helper/property.hxx>
#include <toolkit/helper/servicenames.hxx>
#include <toolkit/helper/vclunohelper.hxx>
@@ -91,17 +92,6 @@ static const LanguageDependentProp aLanguageDependentProp[] =
{ 0, 0 }
};
-WorkWindow* lcl_GetDefaultWindow()
-{
- static WorkWindow* pW = NULL;
- if ( !pW )
- {
- pW = new WorkWindow( NULL, 0 );
- pW->EnableChildTransparentMode();
- }
- return pW;
-}
-
static Sequence< ::rtl::OUString> lcl_ImplGetPropertyNames( const Reference< XMultiPropertySet > & rxModel )
{
Sequence< ::rtl::OUString> aNames;
@@ -164,7 +154,26 @@ struct UnoControl_Data
// ----------------------------------------------------
DBG_NAME( UnoControl )
UnoControl::UnoControl()
- : maDisposeListeners( *this )
+ :maContext( ::comphelper::getProcessServiceFactory() )
+ ,maDisposeListeners( *this )
+ ,maWindowListeners( *this )
+ ,maFocusListeners( *this )
+ ,maKeyListeners( *this )
+ ,maMouseListeners( *this )
+ ,maMouseMotionListeners( *this )
+ ,maPaintListeners( *this )
+ ,maModeChangeListeners( GetMutex() )
+ ,mpData( new UnoControl_Data )
+{
+ DBG_CTOR( UnoControl, NULL );
+ OSL_ENSURE( false, "UnoControl::UnoControl: not implemented. Well, not really." );
+ // just implemented to let the various FooImplInheritanceHelper compile, you should use the
+ // version taking a service factory
+}
+
+UnoControl::UnoControl( const Reference< XMultiServiceFactory >& i_factory )
+ : maContext( i_factory )
+ , maDisposeListeners( *this )
, maWindowListeners( *this )
, maFocusListeners( *this )
, maKeyListeners( *this )
@@ -218,14 +227,15 @@ Reference< XWindowPeer > UnoControl::ImplGetCompatiblePeer( sal_Bool bAcceptE
Reference< XControl > xMe;
OWeakAggObject::queryInterface( ::getCppuType( &xMe ) ) >>= xMe;
- WorkWindow* pWW;
+ Window* pParentWindow( NULL );
{
osl::Guard< vos::IMutex > aGuard( Application::GetSolarMutex() );
- pWW = lcl_GetDefaultWindow();
+ pParentWindow = dynamic_cast< Window* >( Application::GetDefaultDevice() );
+ ENSURE_OR_THROW( pParentWindow != NULL, "could obtain a default parent window!" );
}
try
{
- xMe->createPeer( NULL, pWW->GetComponentInterface( sal_True ) );
+ xMe->createPeer( NULL, pParentWindow->GetComponentInterface( sal_True ) );
}
catch( const Exception& )
{
diff --git a/toolkit/source/controls/unocontrolbase.cxx b/toolkit/source/controls/unocontrolbase.cxx
index bbd0fc507e80..4dc1412ba661 100644
--- a/toolkit/source/controls/unocontrolbase.cxx
+++ b/toolkit/source/controls/unocontrolbase.cxx
@@ -32,6 +32,7 @@
#include <toolkit/controls/unocontrolbase.hxx>
#include <toolkit/helper/property.hxx>
+#include <comphelper/processfactory.hxx>
#include <tools/debug.hxx>
@@ -39,6 +40,14 @@
// class UnoControlBase
// ----------------------------------------------------
+UnoControlBase::UnoControlBase()
+ :UnoControl( ::comphelper::getProcessServiceFactory() )
+{
+ OSL_ENSURE( false, "UnoControlBase::UnoControlBase: not implemented. Well, not really." );
+ // just implemented to let the various FooImplInheritanceHelper compile, you should use the
+ // version taking a service factory
+}
+
sal_Bool UnoControlBase::ImplHasProperty( sal_uInt16 nPropId )
{
::rtl::OUString aPropName( GetPropertyName( nPropId ) );
diff --git a/toolkit/source/controls/unocontrolcontainer.cxx b/toolkit/source/controls/unocontrolcontainer.cxx
index 3afe3a90f1ee..bdbdc9aae7f1 100644
--- a/toolkit/source/controls/unocontrolcontainer.cxx
+++ b/toolkit/source/controls/unocontrolcontainer.cxx
@@ -412,13 +412,16 @@ void SAL_CALL DialogStepChangedListener::propertyChange( const beans::PropertyC
// ----------------------------------------------------
// class UnoControlContainer
// ----------------------------------------------------
-UnoControlContainer::UnoControlContainer() : maCListeners( *this )
+UnoControlContainer::UnoControlContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
+ :UnoControlContainer_Base( i_factory )
+ ,maCListeners( *this )
{
mpControls = new UnoControlHolderList;
}
-UnoControlContainer::UnoControlContainer( uno::Reference< awt::XWindowPeer > xP )
- : maCListeners( *this )
+UnoControlContainer::UnoControlContainer( const uno::Reference< lang::XMultiServiceFactory >& i_factory, const uno::Reference< awt::XWindowPeer >& xP )
+ :UnoControlContainer_Base( i_factory )
+ ,maCListeners( *this )
{
setPeer( xP );
mbDisposePeer = sal_False;
diff --git a/toolkit/source/controls/unocontrolcontainermodel.cxx b/toolkit/source/controls/unocontrolcontainermodel.cxx
index 7630971d8a57..66948ce095d1 100644
--- a/toolkit/source/controls/unocontrolcontainermodel.cxx
+++ b/toolkit/source/controls/unocontrolcontainermodel.cxx
@@ -36,7 +36,8 @@
// ----------------------------------------------------
// class UnoControlContainerModel
// ----------------------------------------------------
-UnoControlContainerModel::UnoControlContainerModel()
+UnoControlContainerModel::UnoControlContainerModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
{
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
ImplRegisterProperty( BASEPROPERTY_BORDER );
diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx
index 18bf0d9f02f7..7a2742abae57 100644
--- a/toolkit/source/controls/unocontrolmodel.cxx
+++ b/toolkit/source/controls/unocontrolmodel.cxx
@@ -154,7 +154,24 @@ static void lcl_ImplMergeFontProperty( FontDescriptor& rFD, sal_uInt16 nPropId,
// class UnoControlModel
// ----------------------------------------------------
UnoControlModel::UnoControlModel()
- : OPropertySetHelper( BrdcstHelper ), maDisposeListeners( *this )
+ :UnoControlModel_Base()
+ ,MutexAndBroadcastHelper()
+ ,OPropertySetHelper( BrdcstHelper )
+ ,maDisposeListeners( *this )
+ ,maContext( ::comphelper::getProcessServiceFactory() )
+{
+ OSL_ENSURE( false, "UnoControlModel::UnoControlModel: not implemented. Well, not really." );
+ // just implemented to let the various FooImplInheritanceHelper compile, you should use the
+ // version taking a service factory
+ mpData = new ImplPropertyTable;
+}
+
+UnoControlModel::UnoControlModel( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel_Base()
+ ,MutexAndBroadcastHelper()
+ ,OPropertySetHelper( BrdcstHelper )
+ ,maDisposeListeners( *this )
+ ,maContext( i_factory )
{
// Die Properties muessen vom Model in die Tabelle gestopft werden,
// nur vorhandene Properties sind gueltige Properties, auch wenn VOID.
@@ -162,18 +179,11 @@ UnoControlModel::UnoControlModel()
}
UnoControlModel::UnoControlModel( const UnoControlModel& rModel )
- : XControlModel()
- , XPropertyState()
- , XPersistObject()
- , XComponent()
- , XServiceInfo()
- , XTypeProvider()
- , XUnoTunnel()
- , XCloneable()
+ : UnoControlModel_Base()
, MutexAndBroadcastHelper()
, OPropertySetHelper( BrdcstHelper )
- , OWeakAggObject()
, maDisposeListeners( *this )
+ , maContext( rModel.maContext )
{
mpData = new ImplPropertyTable;
@@ -403,7 +413,7 @@ sal_Bool UnoControlModel::ImplHasProperty( sal_uInt16 nPropId ) const
aLocale.Country = sDefaultCurrency.copy( nSepPos + 1 );
}
- LocaleDataWrapper aLocaleInfo( ::comphelper::getProcessServiceFactory(), aLocale );
+ LocaleDataWrapper aLocaleInfo( maContext.getLegacyServiceFactory(), aLocale );
if ( !sBankSymbol.getLength() )
sBankSymbol = aLocaleInfo.getCurrBankSymbol();
@@ -484,36 +494,20 @@ void UnoControlModel::ImplRegisterProperties( const std::list< sal_uInt16 > &rId
// ::com::sun::star::uno::XInterface
::com::sun::star::uno::Any UnoControlModel::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
{
- ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( ::com::sun::star::awt::XControlModel*, this ),
- SAL_STATIC_CAST( ::com::sun::star::io::XPersistObject*, this ),
- SAL_STATIC_CAST( ::com::sun::star::lang::XComponent*, this ),
- SAL_STATIC_CAST( ::com::sun::star::lang::XServiceInfo*, this ),
- SAL_STATIC_CAST( ::com::sun::star::util::XCloneable*, this ),
- SAL_STATIC_CAST( ::com::sun::star::beans::XPropertyState*, this ),
- SAL_STATIC_CAST( ::com::sun::star::beans::XMultiPropertySet*, this ),
- SAL_STATIC_CAST( ::com::sun::star::beans::XFastPropertySet*, this ),
- SAL_STATIC_CAST( ::com::sun::star::beans::XPropertySet*, this ),
- SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ),
- SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ) );
- return (aRet.hasValue() ? aRet : OWeakAggObject::queryAggregation( rType ));
+ Any aRet = UnoControlModel_Base::queryAggregation( rType );
+ if ( !aRet.hasValue() )
+ aRet = ::cppu::OPropertySetHelper::queryInterface( rType );
+ return aRet;
}
// ::com::sun::star::lang::XUnoTunnel
IMPL_XUNOTUNNEL( UnoControlModel )
+// XInterface
+IMPLEMENT_FORWARD_REFCOUNT( UnoControlModel, UnoControlModel_Base )
+
// ::com::sun::star::lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( UnoControlModel )
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>* ) NULL )
-IMPL_XTYPEPROVIDER_END
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoControlModel, UnoControlModel_Base, ::cppu::OPropertySetHelper )
uno::Reference< util::XCloneable > UnoControlModel::createClone() throw(::com::sun::star::uno::RuntimeException)
diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx
index 1cc305462b38..210fc08a2680 100644
--- a/toolkit/source/controls/unocontrols.cxx
+++ b/toolkit/source/controls/unocontrols.cxx
@@ -42,7 +42,6 @@
#include <toolkit/controls/formattedcontrol.hxx>
#include <toolkit/controls/roadmapcontrol.hxx>
#include <toolkit/controls/unocontrols.hxx>
-#include <toolkit/controls/geometrycontrolmodel.hxx>
#include <toolkit/controls/stdtabcontroller.hxx>
#include <toolkit/helper/property.hxx>
#include <toolkit/helper/unopropertyarrayhelper.hxx>
@@ -95,7 +94,8 @@ using namespace ::toolkit;
// ----------------------------------------------------
// class UnoControlEditModel
// ----------------------------------------------------
-UnoControlEditModel::UnoControlEditModel()
+UnoControlEditModel::UnoControlEditModel( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
{
UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXEdit );
}
@@ -146,8 +146,9 @@ uno::Reference< beans::XPropertySetInfo > UnoControlEditModel::getPropertySetInf
// ----------------------------------------------------
// class UnoEditControl
// ----------------------------------------------------
-UnoEditControl::UnoEditControl()
- :maTextListeners( *this )
+UnoEditControl::UnoEditControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlBase( i_factory )
+ ,maTextListeners( *this )
,mnMaxTextLen( 0 )
,mbSetTextInPeer( sal_False )
,mbSetMaxTextLenInPeer( sal_False )
@@ -460,7 +461,8 @@ void UnoEditControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) t
// ----------------------------------------------------
// class UnoControlFileControlModel
// ----------------------------------------------------
-UnoControlFileControlModel::UnoControlFileControlModel()
+UnoControlFileControlModel::UnoControlFileControlModel( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
{
ImplRegisterProperty( BASEPROPERTY_ALIGN );
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
@@ -519,7 +521,8 @@ uno::Reference< beans::XPropertySetInfo > UnoControlFileControlModel::getPropert
// ----------------------------------------------------
// class UnoFileControl
// ----------------------------------------------------
-UnoFileControl::UnoFileControl()
+UnoFileControl::UnoFileControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoEditControl( i_factory )
{
}
@@ -547,8 +550,7 @@ uno::Any GraphicControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
// graphic manager uniqueid
rtl::OUString sID = _rURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
// get the DefaultContext
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
- mxGrfObj = graphic::GraphicObject::createWithId( aContext.getUNOContext(), sID );
+ mxGrfObj = graphic::GraphicObject::createWithId( maContext.getUNOContext(), sID );
}
else // linked
mxGrfObj = NULL; // release the GraphicObject
@@ -558,9 +560,8 @@ uno::Any GraphicControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
try
{
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
uno::Reference< graphic::XGraphicProvider > xProvider;
- if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
+ if ( maContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
{
uno::Sequence< beans::PropertyValue > aMediaProperties(1);
aMediaProperties[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
@@ -638,7 +639,8 @@ void SAL_CALL GraphicControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 n
// ----------------------------------------------------
// class UnoControlButtonModel
// ----------------------------------------------------
-UnoControlButtonModel::UnoControlButtonModel()
+UnoControlButtonModel::UnoControlButtonModel( const Reference< XMultiServiceFactory >& i_factory )
+ :GraphicControlModel( i_factory )
{
UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXButton );
@@ -694,9 +696,10 @@ uno::Reference< beans::XPropertySetInfo > UnoControlButtonModel::getPropertySetI
// ----------------------------------------------------
// class UnoButtonControl
// ----------------------------------------------------
-UnoButtonControl::UnoButtonControl()
- : maActionListeners( *this )
- , maItemListeners( *this )
+UnoButtonControl::UnoButtonControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
+ :UnoButtonControl_Base( i_factory )
+ ,maActionListeners( *this )
+ ,maItemListeners( *this )
{
maComponentInfos.nWidth = 50;
maComponentInfos.nHeight = 14;
@@ -833,8 +836,9 @@ awt::Size UnoButtonControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(
// ----------------------------------------------------
// class UnoControlImageControlModel
// ----------------------------------------------------
-UnoControlImageControlModel::UnoControlImageControlModel()
- :mbAdjustingImageScaleMode( false )
+UnoControlImageControlModel::UnoControlImageControlModel( const Reference< XMultiServiceFactory >& i_factory )
+ :GraphicControlModel( i_factory )
+ ,mbAdjustingImageScaleMode( false )
{
UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXImageControl );
}
@@ -914,8 +918,9 @@ void SAL_CALL UnoControlImageControlModel::setFastPropertyValue_NoBroadcast( sal
// ----------------------------------------------------
// class UnoImageControlControl
// ----------------------------------------------------
-UnoImageControlControl::UnoImageControlControl()
- : maActionListeners( *this )
+UnoImageControlControl::UnoImageControlControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoImageControlControl_Base( i_factory )
+ ,maActionListeners( *this )
{
// Woher die Defaults nehmen?
maComponentInfos.nWidth = 100;
@@ -958,7 +963,8 @@ awt::Size UnoImageControlControl::calcAdjustedSize( const awt::Size& rNewSize )
// ----------------------------------------------------
// class UnoControlRadioButtonModel
// ----------------------------------------------------
-UnoControlRadioButtonModel::UnoControlRadioButtonModel()
+UnoControlRadioButtonModel::UnoControlRadioButtonModel( const Reference< XMultiServiceFactory >& i_factory )
+ :GraphicControlModel( i_factory )
{
UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXRadioButton );
}
@@ -1005,8 +1011,10 @@ uno::Reference< beans::XPropertySetInfo > UnoControlRadioButtonModel::getPropert
// ----------------------------------------------------
// class UnoRadioButtonControl
// ----------------------------------------------------
-UnoRadioButtonControl::UnoRadioButtonControl()
- : maItemListeners( *this ), maActionListeners( *this )
+UnoRadioButtonControl::UnoRadioButtonControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoRadioButtonControl_Base( i_factory )
+ ,maItemListeners( *this )
+ ,maActionListeners( *this )
{
maComponentInfos.nWidth = 100;
maComponentInfos.nHeight = 12;
@@ -1165,7 +1173,8 @@ awt::Size UnoRadioButtonControl::calcAdjustedSize( const awt::Size& rNewSize ) t
// ----------------------------------------------------
// class UnoControlCheckBoxModel
// ----------------------------------------------------
-UnoControlCheckBoxModel::UnoControlCheckBoxModel()
+UnoControlCheckBoxModel::UnoControlCheckBoxModel( const Reference< XMultiServiceFactory >& i_factory )
+ :GraphicControlModel( i_factory )
{
UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXCheckBox );
}
@@ -1212,8 +1221,9 @@ uno::Reference< beans::XPropertySetInfo > UnoControlCheckBoxModel::getPropertySe
// ----------------------------------------------------
// class UnoCheckBoxControl
// ----------------------------------------------------
-UnoCheckBoxControl::UnoCheckBoxControl()
- : maItemListeners( *this ), maActionListeners( *this )
+UnoCheckBoxControl::UnoCheckBoxControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
+ :UnoCheckBoxControl_Base( i_factory )
+ ,maItemListeners( *this ), maActionListeners( *this )
{
maComponentInfos.nWidth = 100;
maComponentInfos.nHeight = 12;
@@ -1348,7 +1358,8 @@ awt::Size UnoCheckBoxControl::calcAdjustedSize( const awt::Size& rNewSize ) thro
// ----------------------------------------------------
// class UnoControlFixedHyperlinkModel
// ----------------------------------------------------
-UnoControlFixedHyperlinkModel::UnoControlFixedHyperlinkModel()
+UnoControlFixedHyperlinkModel::UnoControlFixedHyperlinkModel( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
{
UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXFixedHyperlink );
}
@@ -1403,8 +1414,9 @@ uno::Reference< beans::XPropertySetInfo > UnoControlFixedHyperlinkModel::getProp
// ----------------------------------------------------
// class UnoFixedHyperlinkControl
// ----------------------------------------------------
-UnoFixedHyperlinkControl::UnoFixedHyperlinkControl()
- : maActionListeners( *this )
+UnoFixedHyperlinkControl::UnoFixedHyperlinkControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlBase( i_factory )
+ ,maActionListeners( *this )
{
maComponentInfos.nWidth = 100;
maComponentInfos.nHeight = 12;
@@ -1533,7 +1545,8 @@ void UnoFixedHyperlinkControl::removeActionListener(const uno::Reference< awt::X
// ----------------------------------------------------
// class UnoControlFixedTextModel
// ----------------------------------------------------
-UnoControlFixedTextModel::UnoControlFixedTextModel()
+UnoControlFixedTextModel::UnoControlFixedTextModel( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
{
UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXFixedText );
}
@@ -1583,7 +1596,8 @@ uno::Reference< beans::XPropertySetInfo > UnoControlFixedTextModel::getPropertyS
// ----------------------------------------------------
// class UnoFixedTextControl
// ----------------------------------------------------
-UnoFixedTextControl::UnoFixedTextControl()
+UnoFixedTextControl::UnoFixedTextControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlBase( i_factory )
{
maComponentInfos.nWidth = 100;
maComponentInfos.nHeight = 12;
@@ -1663,7 +1677,8 @@ awt::Size UnoFixedTextControl::calcAdjustedSize( const awt::Size& rNewSize ) thr
// ----------------------------------------------------
// class UnoControlGroupBoxModel
// ----------------------------------------------------
-UnoControlGroupBoxModel::UnoControlGroupBoxModel()
+UnoControlGroupBoxModel::UnoControlGroupBoxModel( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
{
ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
ImplRegisterProperty( BASEPROPERTY_ENABLED );
@@ -1714,7 +1729,8 @@ uno::Reference< beans::XPropertySetInfo > UnoControlGroupBoxModel::getPropertySe
// ----------------------------------------------------
// class UnoGroupBoxControl
// ----------------------------------------------------
-UnoGroupBoxControl::UnoGroupBoxControl()
+UnoGroupBoxControl::UnoGroupBoxControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlBase( i_factory )
{
maComponentInfos.nWidth = 100;
maComponentInfos.nHeight = 100;
@@ -1836,21 +1852,16 @@ private:
// = UnoControlListBoxModel
// =====================================================================================================================
// ---------------------------------------------------------------------------------------------------------------------
-UnoControlListBoxModel::UnoControlListBoxModel()
- :UnoControlListBoxModel_Base()
- ,m_pData( new UnoControlListBoxModel_Data( *this ) )
- ,m_aItemListListeners( GetMutex() )
-{
- UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXListBox );
-}
-// ---------------------------------------------------------------------------------------------------------------------
-UnoControlListBoxModel::UnoControlListBoxModel(bool)
- :UnoControlListBoxModel_Base()
+UnoControlListBoxModel::UnoControlListBoxModel( const Reference< XMultiServiceFactory >& i_factory, ConstructorMode const i_mode )
+ :UnoControlListBoxModel_Base( i_factory )
,m_pData( new UnoControlListBoxModel_Data( *this ) )
,m_aItemListListeners( GetMutex() )
{
+ if ( i_mode == ConstructDefault )
+ {
+ UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXListBox );
+ }
}
-
// ---------------------------------------------------------------------------------------------------------------------
UnoControlListBoxModel::UnoControlListBoxModel( const UnoControlListBoxModel& i_rSource )
:UnoControlListBoxModel_Base( i_rSource )
@@ -1868,6 +1879,7 @@ IMPL_SERVICEINFO_DERIVED( UnoControlListBoxModel, UnoControlModel, szServiceName
{
return ::rtl::OUString::createFromAscii( szServiceName_UnoControlListBoxModel );
}
+
// ---------------------------------------------------------------------------------------------------------------------
uno::Any UnoControlListBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
{
@@ -2283,8 +2295,9 @@ void UnoControlListBoxModel::impl_notifyItemListEvent_nolck( const sal_Int32 i_n
// ----------------------------------------------------
// class UnoListBoxControl
// ----------------------------------------------------
-UnoListBoxControl::UnoListBoxControl()
- :maActionListeners( *this )
+UnoListBoxControl::UnoListBoxControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoListBoxControl_Base( i_factory )
+ ,maActionListeners( *this )
,maItemListeners( *this )
{
maComponentInfos.nWidth = 100;
@@ -2713,7 +2726,8 @@ ItemListenerMultiplexer& UnoListBoxControl::getItemListeners()
// ----------------------------------------------------
// class UnoControlComboBoxModel
// ----------------------------------------------------
-UnoControlComboBoxModel::UnoControlComboBoxModel() : UnoControlListBoxModel(true)
+UnoControlComboBoxModel::UnoControlComboBoxModel( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlListBoxModel( i_factory, ConstructWithoutProperties )
{
UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXComboBox );
}
@@ -2788,9 +2802,10 @@ uno::Any UnoControlComboBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) cons
// ----------------------------------------------------
// class UnoComboBoxControl
// ----------------------------------------------------
-UnoComboBoxControl::UnoComboBoxControl()
- : maActionListeners( *this ),
- maItemListeners( *this )
+UnoComboBoxControl::UnoComboBoxControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoEditControl( i_factory )
+ ,maActionListeners( *this )
+ ,maItemListeners( *this )
{
maComponentInfos.nWidth = 100;
maComponentInfos.nHeight = 12;
@@ -3108,7 +3123,9 @@ sal_Int16 UnoComboBoxControl::getDropDownLineCount() throw(uno::RuntimeException
// ----------------------------------------------------
// UnoSpinFieldControl
// ----------------------------------------------------
-UnoSpinFieldControl::UnoSpinFieldControl() : maSpinListeners( *this )
+UnoSpinFieldControl::UnoSpinFieldControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoEditControl( i_factory )
+ ,maSpinListeners( *this )
{
mbRepeat = sal_False;
}
@@ -3198,7 +3215,8 @@ void UnoSpinFieldControl::enableRepeat( sal_Bool bRepeat ) throw(::com::sun::sta
// ----------------------------------------------------
// class UnoControlDateFieldModel
// ----------------------------------------------------
-UnoControlDateFieldModel::UnoControlDateFieldModel()
+UnoControlDateFieldModel::UnoControlDateFieldModel( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
{
UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXDateField );
}
@@ -3243,7 +3261,8 @@ uno::Reference< beans::XPropertySetInfo > UnoControlDateFieldModel::getPropertyS
// ----------------------------------------------------
// class UnoDateFieldControl
// ----------------------------------------------------
-UnoDateFieldControl::UnoDateFieldControl()
+UnoDateFieldControl::UnoDateFieldControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoSpinFieldControl( i_factory )
{
mnFirst = Date( 1, 1, 1900 ).GetDate();
mnLast = Date( 31, 12, 2200 ).GetDate();
@@ -3438,7 +3457,8 @@ sal_Bool UnoDateFieldControl::isStrictFormat() throw(uno::RuntimeException)
// ----------------------------------------------------
// class UnoControlTimeFieldModel
// ----------------------------------------------------
-UnoControlTimeFieldModel::UnoControlTimeFieldModel()
+UnoControlTimeFieldModel::UnoControlTimeFieldModel( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
{
UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXTimeField );
}
@@ -3483,7 +3503,8 @@ uno::Reference< beans::XPropertySetInfo > UnoControlTimeFieldModel::getPropertyS
// ----------------------------------------------------
// class UnoTimeFieldControl
// ----------------------------------------------------
-UnoTimeFieldControl::UnoTimeFieldControl()
+UnoTimeFieldControl::UnoTimeFieldControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoSpinFieldControl( i_factory )
{
mnFirst = Time( 0, 0 ).GetTime();
mnLast = Time( 23, 59, 59, 99 ).GetTime();
@@ -3637,7 +3658,8 @@ sal_Bool UnoTimeFieldControl::isStrictFormat() throw(uno::RuntimeException)
// ----------------------------------------------------
// class UnoControlNumericFieldModel
// ----------------------------------------------------
-UnoControlNumericFieldModel::UnoControlNumericFieldModel()
+UnoControlNumericFieldModel::UnoControlNumericFieldModel( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
{
UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXNumericField );
}
@@ -3682,7 +3704,8 @@ uno::Reference< beans::XPropertySetInfo > UnoControlNumericFieldModel::getProper
// ----------------------------------------------------
// class UnoNumericFieldControl
// ----------------------------------------------------
-UnoNumericFieldControl::UnoNumericFieldControl()
+UnoNumericFieldControl::UnoNumericFieldControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoSpinFieldControl( i_factory )
{
mnFirst = 0;
mnLast = 0x7FFFFFFF;
@@ -3833,7 +3856,8 @@ sal_Int16 UnoNumericFieldControl::getDecimalDigits() throw(uno::RuntimeException
// ----------------------------------------------------
// class UnoControlCurrencyFieldModel
// ----------------------------------------------------
-UnoControlCurrencyFieldModel::UnoControlCurrencyFieldModel()
+UnoControlCurrencyFieldModel::UnoControlCurrencyFieldModel( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
{
UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXCurrencyField );
}
@@ -3882,7 +3906,8 @@ uno::Reference< beans::XPropertySetInfo > UnoControlCurrencyFieldModel::getPrope
// ----------------------------------------------------
// class UnoCurrencyFieldControl
// ----------------------------------------------------
-UnoCurrencyFieldControl::UnoCurrencyFieldControl()
+UnoCurrencyFieldControl::UnoCurrencyFieldControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoSpinFieldControl( i_factory )
{
mnFirst = 0;
mnLast = 0x7FFFFFFF;
@@ -4032,7 +4057,8 @@ sal_Int16 UnoCurrencyFieldControl::getDecimalDigits() throw(uno::RuntimeExceptio
// ----------------------------------------------------
// class UnoControlPatternFieldModel
// ----------------------------------------------------
-UnoControlPatternFieldModel::UnoControlPatternFieldModel()
+UnoControlPatternFieldModel::UnoControlPatternFieldModel( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
{
UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXPatternField );
}
@@ -4075,7 +4101,8 @@ uno::Reference< beans::XPropertySetInfo > UnoControlPatternFieldModel::getProper
// ----------------------------------------------------
// class UnoPatternFieldControl
// ----------------------------------------------------
-UnoPatternFieldControl::UnoPatternFieldControl()
+UnoPatternFieldControl::UnoPatternFieldControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoSpinFieldControl( i_factory )
{
}
@@ -4164,7 +4191,8 @@ sal_Bool UnoPatternFieldControl::isStrictFormat() throw(uno::RuntimeException)
// ----------------------------------------------------
// class UnoControlProgressBarModel
// ----------------------------------------------------
-UnoControlProgressBarModel::UnoControlProgressBarModel()
+UnoControlProgressBarModel::UnoControlProgressBarModel( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
{
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
ImplRegisterProperty( BASEPROPERTY_BORDER );
@@ -4220,7 +4248,8 @@ uno::Reference< beans::XPropertySetInfo > UnoControlProgressBarModel::getPropert
// ----------------------------------------------------
// class UnoProgressBarControl
// ----------------------------------------------------
-UnoProgressBarControl::UnoProgressBarControl()
+UnoProgressBarControl::UnoProgressBarControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlBase( i_factory )
{
}
@@ -4296,7 +4325,8 @@ sal_Int32 UnoProgressBarControl::getValue() throw(::com::sun::star::uno::Runtime
// ----------------------------------------------------
// class UnoControlFixedLineModel
// ----------------------------------------------------
-UnoControlFixedLineModel::UnoControlFixedLineModel()
+UnoControlFixedLineModel::UnoControlFixedLineModel( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
{
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
@@ -4347,7 +4377,8 @@ uno::Reference< beans::XPropertySetInfo > UnoControlFixedLineModel::getPropertyS
// ----------------------------------------------------
// class UnoFixedLineControl
// ----------------------------------------------------
-UnoFixedLineControl::UnoFixedLineControl()
+UnoFixedLineControl::UnoFixedLineControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlBase( i_factory )
{
maComponentInfos.nWidth = 100; // ??
maComponentInfos.nHeight = 100; // ??
diff --git a/toolkit/source/helper/formpdfexport.cxx b/toolkit/source/helper/formpdfexport.cxx
index bff2d6008d10..1bde6f66a3c0 100644
--- a/toolkit/source/helper/formpdfexport.cxx
+++ b/toolkit/source/helper/formpdfexport.cxx
@@ -28,58 +28,27 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_toolkit.hxx"
-#ifndef _TOOLKIT_HELPER_FORM_FORMPDFEXPORT_HXX
#include <toolkit/helper/formpdfexport.hxx>
-#endif
/** === begin UNO includes === **/
-#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
#include <com/sun/star/container/XIndexAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
#include <com/sun/star/container/XNameAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
#include <com/sun/star/container/XNameContainer.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FORM_XFORM_HPP_
#include <com/sun/star/form/XForm.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_
#include <com/sun/star/container/XChild.hpp>
-#endif
-#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
#include <com/sun/star/lang/XServiceInfo.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FORM_FORMCOMPONENTTYPE_HPP_
#include <com/sun/star/form/FormComponentType.hpp>
-#endif
-#ifndef _COM_SUN_STAR_AWT_TEXTALIGN_HPP_
#include <com/sun/star/awt/TextAlign.hpp>
-#endif
-#ifndef _COM_SUN_STAR_STYLE_VERTICALALIGNMENT_HPP_
#include <com/sun/star/style/VerticalAlignment.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FORM_FORMBUTTONTYPE_HPP_
#include <com/sun/star/form/FormButtonType.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FORM_SUBMITMETHOD_HPP_
#include <com/sun/star/form/FormSubmitMethod.hpp>
-#endif
/** === end UNO includes === **/
-#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
#include <toolkit/helper/vclunohelper.hxx>
-#endif
-#ifndef _VCL_PDFEXTOUTDEVDATA_HXX
+#include <tools/diagnose_ex.h>
#include <vcl/pdfextoutdevdata.hxx>
-#endif
-#ifndef _SV_OUTDEV_HXX
#include <vcl/outdev.hxx>
-#endif
#include <functional>
#include <algorithm>
@@ -315,7 +284,8 @@ namespace toolkitform
//--------------------------------------------------------------------
/** creates a PDF compatible control descriptor for the given control
*/
- void TOOLKIT_DLLPUBLIC describePDFControl( const Reference< XControl >& _rxControl, ::std::auto_ptr< ::vcl::PDFWriter::AnyWidget >& _rpDescriptor ) SAL_THROW(())
+ void TOOLKIT_DLLPUBLIC describePDFControl( const Reference< XControl >& _rxControl,
+ ::std::auto_ptr< ::vcl::PDFWriter::AnyWidget >& _rpDescriptor, ::vcl::PDFExtOutDevData& i_pdfExportData ) SAL_THROW(())
{
_rpDescriptor.reset( NULL );
OSL_ENSURE( _rxControl.is(), "describePDFControl: invalid (NULL) control!" );
@@ -529,7 +499,25 @@ namespace toolkitform
}
else if ( eButtonType == FormButtonType_URL )
{
- OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_TARGET_URL ) >>= pButtonWidget->URL);
+ ::rtl::OUString sURL;
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_TARGET_URL ) >>= sURL );
+ const bool bDocumentLocalTarget = ( sURL.getLength() > 0 ) && ( sURL.getStr()[0] == '#' );
+ if ( bDocumentLocalTarget )
+ {
+ const ::rtl::OUString sDestinationName( sURL.copy(1) );
+ // Register the destination for for future handling ...
+ pButtonWidget->Dest = i_pdfExportData.RegisterDest();
+
+ // and put it into the bookmarks, to ensure the future handling really happens
+ ::std::vector< ::vcl::PDFExtOutDevBookmarkEntry >& rBookmarks( i_pdfExportData.GetBookmarks() );
+ ::vcl::PDFExtOutDevBookmarkEntry aBookmark;
+ aBookmark.nDestId = pButtonWidget->Dest;
+ aBookmark.aBookmark = sURL;
+ rBookmarks.push_back( aBookmark );
+ }
+ else
+ pButtonWidget->URL = sURL;
+
pButtonWidget->Submit = false;
}
@@ -630,7 +618,7 @@ namespace toolkitform
}
catch( const Exception& )
{
- OSL_ENSURE( sal_False, "describePDFControl: caught an exception!" );
+ DBG_UNHANDLED_EXCEPTION();
}
}
diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx
index 1e90c0172e83..a418b4a00b7b 100644
--- a/toolkit/source/helper/property.cxx
+++ b/toolkit/source/helper/property.cxx
@@ -48,7 +48,6 @@
#include <com/sun/star/awt/tree/XTreeDataModel.hpp>
#include <com/sun/star/awt/grid/XGridDataModel.hpp>
#include <com/sun/star/awt/grid/XGridColumnModel.hpp>
-#include <com/sun/star/awt/grid/ScrollBarMode.hpp>
#include <com/sun/star/view/SelectionType.hpp>
#include <com/sun/star/style/VerticalAlignment.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
@@ -273,23 +272,26 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
DECL_PROP_2 ( "RootDisplayed", TREE_ROOTDISPLAYED, sal_Bool, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "ShowsHandles", TREE_SHOWSHANDLES, sal_Bool, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "ShowsRootHandles", TREE_SHOWSROOTHANDLES, sal_Bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "RowHeight", TREE_ROWHEIGHT, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "RowHeight", ROW_HEIGHT, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
DECL_PROP_2 ( "InvokesStopNodeEditing", TREE_INVOKESSTOPNODEEDITING, sal_Bool, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "DialogSourceURL", DIALOGSOURCEURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "URL", URL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "WritingMode", WRITING_MODE, sal_Int16, BOUND, MAYBEDEFAULT ),
DECL_PROP_3 ( "ContextWritingMode", CONTEXT_WRITING_MODE, sal_Int16, BOUND, MAYBEDEFAULT, TRANSIENT ),
- DECL_PROP_2 ( "ShowRowHeader", GRID_SHOWROWHEADER, sal_Bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "ShowColumnHeader", GRID_SHOWCOLUMNHEADER, sal_Bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "GridDataModel", GRID_DATAMODEL, Reference< ::com::sun::star::awt::grid::XGridDataModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_3 ( "ColumnModel", GRID_COLUMNMODEL, Reference< ::com::sun::star::awt::grid::XGridColumnModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "ShowRowHeader", GRID_SHOWROWHEADER, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "RowHeaderWidth", ROW_HEADER_WIDTH, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ShowColumnHeader", GRID_SHOWCOLUMNHEADER, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "ColumnHeaderHeight", COLUMN_HEADER_HEIGHT, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_1 ( "GridDataModel", GRID_DATAMODEL, Reference< ::com::sun::star::awt::grid::XGridDataModel >, BOUND ),
+ DECL_PROP_1 ( "ColumnModel", GRID_COLUMNMODEL, Reference< ::com::sun::star::awt::grid::XGridColumnModel >, BOUND ),
DECL_PROP_3 ( "SelectionModel", GRID_SELECTIONMODE, ::com::sun::star::view::SelectionType, BOUND, MAYBEDEFAULT, MAYBEVOID ),
DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT ),
DECL_PROP_3 ( "ReferenceDevice", REFERENCE_DEVICE, Reference< XDevice >,BOUND, MAYBEDEFAULT, TRANSIENT ),
- DECL_PROP_3 ( "EvenRowBackgroundColor", GRID_EVEN_ROW_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_3 ( "HeaderBackgroundColor", GRID_HEADER_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_3 ( "GridLineColor", GRID_LINE_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_3 ( "RowBackgroundColor", GRID_ROW_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID )
+ DECL_PROP_3 ( "HeaderBackgroundColor", GRID_HEADER_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "HeaderTextColor", GRID_HEADER_TEXT_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "GridLineColor", GRID_LINE_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "RowBackgroundColors", GRID_ROW_BACKGROUND_COLORS, Sequence< sal_Int32 >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "UseGridLines", USE_GRID_LINES, sal_Bool, BOUND, MAYBEDEFAULT ),
};
pPropertyInfos = aImplPropertyInfos;
nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo );
diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx
index 37f33c4168ff..8a6b1d8de4b9 100644
--- a/toolkit/source/helper/registerservices.cxx
+++ b/toolkit/source/helper/registerservices.cxx
@@ -125,97 +125,92 @@ namespace toolkit
{ return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new ImplName ); }
#define IMPL_CREATEINSTANCE2( ImplName ) \
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ImplName##_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSMgr) \
- { return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new ImplName( rSMgr ) ); }
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ImplName##_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory ) \
+ { return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new ImplName( i_factory ) ); }
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL UnoControlDialogModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& )
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL UnoControlDialogModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
{
- return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new OGeometryControlModel<UnoControlDialogModel> );
+ return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new OGeometryControlModel<UnoControlDialogModel>( i_factory ) );
}
-#define CHECKANDCREATEFACTORY( ImplName, ServiceName1, ServiceName2 ) \
- pRet = tryCreateFactory( sImplementationName, "stardiv.Toolkit." #ImplName, \
+#define GET_FACTORY_WITH_IMPL_PREFIX( ClassName, ImplNamePrefix, ServiceName1, ServiceName2 ) \
+ pRet = tryCreateFactory( sImplementationName, ImplNamePrefix "." #ClassName, \
ServiceName1, ServiceName2, \
- ImplName##_CreateInstance, xServiceFactory \
+ ClassName##_CreateInstance, xServiceFactory \
); \
if ( pRet ) \
return pRet; \
-#define TRY_OOO_FACTORY( ImplName, ServiceName ) \
- pRet = tryCreateFactory( sImplementationName, "org.openoffice.comp.toolkit." #ImplName, \
- ServiceName, NULL, \
- ImplName##_CreateInstance, xServiceFactory \
- ); \
- if ( pRet ) \
- return pRet; \
+#define GET_FACTORY( ImplName, ServiceName1, ServiceName2 ) \
+ GET_FACTORY_WITH_IMPL_PREFIX( ImplName, "stardiv.Toolkit", ServiceName1, ServiceName2 )
using namespace toolkit;
IMPL_CREATEINSTANCE2( VCLXToolkit )
IMPL_CREATEINSTANCE( StdTabController )
IMPL_CREATEINSTANCE( StdTabControllerModel )
-IMPL_CREATEINSTANCE( UnoButtonControl )
-IMPL_CREATEINSTANCE( UnoCheckBoxControl )
-IMPL_CREATEINSTANCE( UnoComboBoxControl )
-IMPL_CREATEINSTANCE( UnoControlButtonModel )
-IMPL_CREATEINSTANCE( UnoControlCheckBoxModel )
-IMPL_CREATEINSTANCE( UnoControlComboBoxModel )
-IMPL_CREATEINSTANCE( UnoControlContainer )
-IMPL_CREATEINSTANCE( UnoControlContainerModel )
-IMPL_CREATEINSTANCE( UnoControlCurrencyFieldModel )
-IMPL_CREATEINSTANCE( UnoControlDateFieldModel )
-IMPL_CREATEINSTANCE( UnoControlEditModel )
-IMPL_CREATEINSTANCE( UnoControlFileControlModel )
-IMPL_CREATEINSTANCE( UnoControlFixedHyperlinkModel )
-IMPL_CREATEINSTANCE( UnoControlFixedTextModel )
-IMPL_CREATEINSTANCE( UnoControlFormattedFieldModel )
-IMPL_CREATEINSTANCE( UnoControlGroupBoxModel )
-IMPL_CREATEINSTANCE( UnoControlImageControlModel )
-IMPL_CREATEINSTANCE( UnoControlListBoxModel )
-IMPL_CREATEINSTANCE( UnoControlNumericFieldModel )
-IMPL_CREATEINSTANCE( UnoControlPatternFieldModel )
-IMPL_CREATEINSTANCE( UnoControlRadioButtonModel )
-IMPL_CREATEINSTANCE( UnoControlTimeFieldModel )
-IMPL_CREATEINSTANCE( UnoControlProgressBarModel )
-IMPL_CREATEINSTANCE( UnoControlScrollBarModel )
-IMPL_CREATEINSTANCE( UnoSpinButtonModel )
-IMPL_CREATEINSTANCE( UnoControlFixedLineModel )
-IMPL_CREATEINSTANCE( UnoCurrencyFieldControl )
-IMPL_CREATEINSTANCE( UnoDateFieldControl )
-IMPL_CREATEINSTANCE( UnoDialogControl )
-IMPL_CREATEINSTANCE( UnoEditControl )
-IMPL_CREATEINSTANCE( UnoFileControl )
-IMPL_CREATEINSTANCE( UnoFixedHyperlinkControl )
-IMPL_CREATEINSTANCE( UnoFixedTextControl )
-IMPL_CREATEINSTANCE( UnoFormattedFieldControl )
-IMPL_CREATEINSTANCE( UnoGroupBoxControl )
-IMPL_CREATEINSTANCE( UnoImageControlControl )
-IMPL_CREATEINSTANCE( UnoListBoxControl )
-IMPL_CREATEINSTANCE( UnoNumericFieldControl )
-IMPL_CREATEINSTANCE( UnoPatternFieldControl )
-IMPL_CREATEINSTANCE( UnoRadioButtonControl )
-IMPL_CREATEINSTANCE( UnoTimeFieldControl )
-IMPL_CREATEINSTANCE( UnoProgressBarControl )
-IMPL_CREATEINSTANCE( UnoScrollBarControl )
-IMPL_CREATEINSTANCE( UnoSpinButtonControl )
-IMPL_CREATEINSTANCE( UnoFixedLineControl )
+IMPL_CREATEINSTANCE2( UnoButtonControl )
+IMPL_CREATEINSTANCE2( UnoCheckBoxControl )
+IMPL_CREATEINSTANCE2( UnoComboBoxControl )
+IMPL_CREATEINSTANCE2( UnoControlButtonModel )
+IMPL_CREATEINSTANCE2( UnoControlCheckBoxModel )
+IMPL_CREATEINSTANCE2( UnoControlComboBoxModel )
+IMPL_CREATEINSTANCE2( UnoControlContainer )
+IMPL_CREATEINSTANCE2( UnoControlContainerModel )
+IMPL_CREATEINSTANCE2( UnoControlCurrencyFieldModel )
+IMPL_CREATEINSTANCE2( UnoControlDateFieldModel )
+IMPL_CREATEINSTANCE2( UnoControlEditModel )
+IMPL_CREATEINSTANCE2( UnoControlFileControlModel )
+IMPL_CREATEINSTANCE2( UnoControlFixedHyperlinkModel )
+IMPL_CREATEINSTANCE2( UnoControlFixedTextModel )
+IMPL_CREATEINSTANCE2( UnoControlFormattedFieldModel )
+IMPL_CREATEINSTANCE2( UnoControlGroupBoxModel )
+IMPL_CREATEINSTANCE2( UnoControlImageControlModel )
+IMPL_CREATEINSTANCE2( UnoControlListBoxModel )
+IMPL_CREATEINSTANCE2( UnoControlNumericFieldModel )
+IMPL_CREATEINSTANCE2( UnoControlPatternFieldModel )
+IMPL_CREATEINSTANCE2( UnoControlRadioButtonModel )
+IMPL_CREATEINSTANCE2( UnoControlTimeFieldModel )
+IMPL_CREATEINSTANCE2( UnoControlProgressBarModel )
+IMPL_CREATEINSTANCE2( UnoControlScrollBarModel )
+IMPL_CREATEINSTANCE2( UnoSpinButtonModel )
+IMPL_CREATEINSTANCE2( UnoControlFixedLineModel )
+IMPL_CREATEINSTANCE2( UnoCurrencyFieldControl )
+IMPL_CREATEINSTANCE2( UnoDateFieldControl )
+IMPL_CREATEINSTANCE2( UnoDialogControl )
+IMPL_CREATEINSTANCE2( UnoEditControl )
+IMPL_CREATEINSTANCE2( UnoFileControl )
+IMPL_CREATEINSTANCE2( UnoFixedHyperlinkControl )
+IMPL_CREATEINSTANCE2( UnoFixedTextControl )
+IMPL_CREATEINSTANCE2( UnoFormattedFieldControl )
+IMPL_CREATEINSTANCE2( UnoGroupBoxControl )
+IMPL_CREATEINSTANCE2( UnoImageControlControl )
+IMPL_CREATEINSTANCE2( UnoListBoxControl )
+IMPL_CREATEINSTANCE2( UnoNumericFieldControl )
+IMPL_CREATEINSTANCE2( UnoPatternFieldControl )
+IMPL_CREATEINSTANCE2( UnoRadioButtonControl )
+IMPL_CREATEINSTANCE2( UnoTimeFieldControl )
+IMPL_CREATEINSTANCE2( UnoProgressBarControl )
+IMPL_CREATEINSTANCE2( UnoScrollBarControl )
+IMPL_CREATEINSTANCE2( UnoSpinButtonControl )
+IMPL_CREATEINSTANCE2( UnoFixedLineControl )
IMPL_CREATEINSTANCE( VCLXMenuBar )
IMPL_CREATEINSTANCE( VCLXPointer )
IMPL_CREATEINSTANCE( VCLXPopupMenu )
IMPL_CREATEINSTANCE( VCLXPrinterServer )
-IMPL_CREATEINSTANCE( UnoRoadmapControl )
-IMPL_CREATEINSTANCE( UnoControlRoadmapModel )
-IMPL_CREATEINSTANCE( UnoSimpleAnimationControl )
-IMPL_CREATEINSTANCE( UnoSimpleAnimationControlModel )
-IMPL_CREATEINSTANCE( UnoThrobberControl )
-IMPL_CREATEINSTANCE( UnoThrobberControlModel )
-IMPL_CREATEINSTANCE( UnoControlTabPage )
-//IMPL_CREATEINSTANCE( UnoControlTabPageModel )
-//IMPL_CREATEINSTANCE( UnoControlTabPageContainer )
-//IMPL_CREATEINSTANCE( UnoControlTabPageContainerModel )
-IMPL_CREATEINSTANCE( AnimatedImagesControl )
-IMPL_CREATEINSTANCE( AnimatedImagesControlModel )
-IMPL_CREATEINSTANCE( SpinningProgressControlModel )
+IMPL_CREATEINSTANCE2( UnoRoadmapControl )
+IMPL_CREATEINSTANCE2( UnoControlRoadmapModel )
+IMPL_CREATEINSTANCE2( UnoSimpleAnimationControl )
+IMPL_CREATEINSTANCE2( UnoSimpleAnimationControlModel )
+IMPL_CREATEINSTANCE2( UnoThrobberControl )
+IMPL_CREATEINSTANCE2( UnoThrobberControlModel )
+IMPL_CREATEINSTANCE2( UnoControlTabPage )
+IMPL_CREATEINSTANCE2( UnoControlTabPageModel )
+IMPL_CREATEINSTANCE2( UnoControlTabPageContainer )
+IMPL_CREATEINSTANCE2( UnoControlTabPageContainerModel )
+IMPL_CREATEINSTANCE2( AnimatedImagesControl )
+IMPL_CREATEINSTANCE2( AnimatedImagesControlModel )
+IMPL_CREATEINSTANCE2( SpinningProgressControlModel )
extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL TreeControl_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL TreeControlModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
@@ -225,11 +220,7 @@ extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL
extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DefaultGridDataModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DefaultGridColumnModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GridColumn_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
-extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL UnoControlTabPageContainer_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
-extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL UnoControlTabPageContainerModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
-
-//extern sal_Bool SAL_CALL UnoControlTabPageModel_component_writeInfo(void * serviceManager, void * registryKey);
-extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL UnoControlTabPageModel_CreateInstance (const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SortableGridDataModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
extern void * SAL_CALL comp_AsyncCallback_component_getFactory( const char * implName, void * serviceManager, void * registryKey );
@@ -252,83 +243,83 @@ TOOLKIT_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* sImplemen
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory =
static_cast< ::com::sun::star::lang::XMultiServiceFactory* >( _pServiceManager );
- CHECKANDCREATEFACTORY( VCLXToolkit, szServiceName_Toolkit, szServiceName2_Toolkit )
- CHECKANDCREATEFACTORY( VCLXPopupMenu, szServiceName_PopupMenu, szServiceName2_PopupMenu )
- CHECKANDCREATEFACTORY( VCLXMenuBar, szServiceName_MenuBar, szServiceName2_MenuBar )
- CHECKANDCREATEFACTORY( VCLXPointer, szServiceName_Pointer, szServiceName2_Pointer )
- CHECKANDCREATEFACTORY( UnoControlContainer, szServiceName_UnoControlContainer, szServiceName2_UnoControlContainer )
- CHECKANDCREATEFACTORY( UnoControlContainerModel, szServiceName_UnoControlContainerModel, szServiceName2_UnoControlContainerModel )
- CHECKANDCREATEFACTORY( StdTabController, szServiceName_TabController, szServiceName2_TabController )
- CHECKANDCREATEFACTORY( StdTabControllerModel, szServiceName_TabControllerModel, szServiceName2_TabControllerModel )
- CHECKANDCREATEFACTORY( UnoDialogControl, szServiceName_UnoControlDialog, szServiceName2_UnoControlDialog )
- CHECKANDCREATEFACTORY( UnoControlDialogModel, szServiceName_UnoControlDialogModel, szServiceName2_UnoControlDialogModel )
- CHECKANDCREATEFACTORY( UnoEditControl, szServiceName_UnoControlEdit, szServiceName2_UnoControlEdit )
- CHECKANDCREATEFACTORY( UnoControlEditModel, szServiceName_UnoControlEditModel, szServiceName2_UnoControlEditModel )
- CHECKANDCREATEFACTORY( UnoDateFieldControl, szServiceName_UnoControlDateField, szServiceName2_UnoControlDateField )
- CHECKANDCREATEFACTORY( UnoControlDateFieldModel, szServiceName_UnoControlDateFieldModel, szServiceName2_UnoControlDateFieldModel )
- CHECKANDCREATEFACTORY( UnoTimeFieldControl, szServiceName_UnoControlTimeField, szServiceName2_UnoControlTimeField )
- CHECKANDCREATEFACTORY( UnoControlTimeFieldModel, szServiceName_UnoControlTimeFieldModel, szServiceName2_UnoControlTimeFieldModel )
- CHECKANDCREATEFACTORY( UnoNumericFieldControl, szServiceName_UnoControlNumericField, szServiceName2_UnoControlNumericField )
- CHECKANDCREATEFACTORY( UnoControlNumericFieldModel, szServiceName_UnoControlNumericFieldModel, szServiceName2_UnoControlNumericFieldModel )
- CHECKANDCREATEFACTORY( UnoCurrencyFieldControl, szServiceName_UnoControlCurrencyField, szServiceName2_UnoControlCurrencyField )
- CHECKANDCREATEFACTORY( UnoControlCurrencyFieldModel, szServiceName_UnoControlCurrencyFieldModel, szServiceName2_UnoControlCurrencyFieldModel )
- CHECKANDCREATEFACTORY( UnoPatternFieldControl, szServiceName_UnoControlPatternField, szServiceName2_UnoControlPatternField )
- CHECKANDCREATEFACTORY( UnoControlPatternFieldModel, szServiceName_UnoControlPatternFieldModel, szServiceName2_UnoControlPatternFieldModel )
- CHECKANDCREATEFACTORY( UnoFormattedFieldControl, szServiceName_UnoControlFormattedField, szServiceName2_UnoControlFormattedField )
- CHECKANDCREATEFACTORY( UnoControlFormattedFieldModel, szServiceName_UnoControlFormattedFieldModel, szServiceName2_UnoControlFormattedFieldModel )
- CHECKANDCREATEFACTORY( UnoFileControl, szServiceName_UnoControlFileControl, szServiceName2_UnoControlFileControl )
- CHECKANDCREATEFACTORY( UnoControlFileControlModel, szServiceName_UnoControlFileControlModel, szServiceName2_UnoControlFileControlModel )
- CHECKANDCREATEFACTORY( UnoButtonControl, szServiceName_UnoControlButton, szServiceName2_UnoControlButton )
- CHECKANDCREATEFACTORY( UnoControlButtonModel, szServiceName_UnoControlButtonModel, szServiceName2_UnoControlButtonModel )
- CHECKANDCREATEFACTORY( UnoImageControlControl, szServiceName_UnoControlImageButton, szServiceName2_UnoControlImageButton )
- CHECKANDCREATEFACTORY( UnoControlImageControlModel, szServiceName_UnoControlImageButtonModel, szServiceName2_UnoControlImageButtonModel )
- CHECKANDCREATEFACTORY( UnoImageControlControl, szServiceName_UnoControlImageControl, szServiceName2_UnoControlImageControl )
- CHECKANDCREATEFACTORY( UnoControlImageControlModel, szServiceName_UnoControlImageControlModel, szServiceName2_UnoControlImageControlModel )
- CHECKANDCREATEFACTORY( UnoRadioButtonControl, szServiceName_UnoControlRadioButton, szServiceName2_UnoControlRadioButton )
- CHECKANDCREATEFACTORY( UnoControlRadioButtonModel, szServiceName_UnoControlRadioButtonModel, szServiceName2_UnoControlRadioButtonModel )
- CHECKANDCREATEFACTORY( UnoCheckBoxControl, szServiceName_UnoControlCheckBox, szServiceName2_UnoControlCheckBox )
- CHECKANDCREATEFACTORY( UnoControlCheckBoxModel, szServiceName_UnoControlCheckBoxModel, szServiceName2_UnoControlCheckBoxModel )
- CHECKANDCREATEFACTORY( UnoListBoxControl, szServiceName_UnoControlListBox, szServiceName2_UnoControlListBox )
- CHECKANDCREATEFACTORY( UnoControlListBoxModel, szServiceName_UnoControlListBoxModel, szServiceName2_UnoControlListBoxModel )
- CHECKANDCREATEFACTORY( UnoComboBoxControl, szServiceName_UnoControlComboBox, szServiceName2_UnoControlComboBox )
- CHECKANDCREATEFACTORY( UnoControlComboBoxModel, szServiceName_UnoControlComboBoxModel, szServiceName2_UnoControlComboBoxModel )
- CHECKANDCREATEFACTORY( UnoFixedTextControl, szServiceName_UnoControlFixedText, szServiceName2_UnoControlFixedText )
- CHECKANDCREATEFACTORY( UnoControlFixedTextModel, szServiceName_UnoControlFixedTextModel, szServiceName2_UnoControlFixedTextModel )
- CHECKANDCREATEFACTORY( UnoGroupBoxControl, szServiceName_UnoControlGroupBox, szServiceName2_UnoControlGroupBox )
- CHECKANDCREATEFACTORY( UnoControlGroupBoxModel, szServiceName_UnoControlGroupBoxModel, szServiceName2_UnoControlGroupBoxModel )
- CHECKANDCREATEFACTORY( UnoProgressBarControl, szServiceName_UnoControlProgressBar, szServiceName2_UnoControlProgressBar )
- CHECKANDCREATEFACTORY( UnoControlProgressBarModel, szServiceName_UnoControlProgressBarModel, szServiceName2_UnoControlProgressBarModel )
- CHECKANDCREATEFACTORY( UnoScrollBarControl, szServiceName_UnoControlScrollBar, szServiceName2_UnoControlScrollBar )
- CHECKANDCREATEFACTORY( UnoControlScrollBarModel, szServiceName_UnoControlScrollBarModel, szServiceName2_UnoControlScrollBarModel )
- CHECKANDCREATEFACTORY( UnoFixedLineControl, szServiceName_UnoControlFixedLine, szServiceName2_UnoControlFixedLine )
- CHECKANDCREATEFACTORY( UnoControlFixedLineModel, szServiceName_UnoControlFixedLineModel, szServiceName2_UnoControlFixedLineModel )
- CHECKANDCREATEFACTORY( VCLXPrinterServer, szServiceName_PrinterServer, szServiceName2_PrinterServer )
- CHECKANDCREATEFACTORY( UnoRoadmapControl, szServiceName_UnoControlRoadmap, szServiceName2_UnoControlRoadmap )
- CHECKANDCREATEFACTORY( UnoControlRoadmapModel, szServiceName_UnoControlRoadmapModel, szServiceName2_UnoControlRoadmapModel )
- CHECKANDCREATEFACTORY( UnoSpinButtonModel, szServiceName_UnoSpinButtonModel, NULL )
- CHECKANDCREATEFACTORY( UnoSpinButtonControl, szServiceName_UnoSpinButtonControl, NULL )
- CHECKANDCREATEFACTORY( TreeControl, szServiceName_TreeControl, NULL )
- CHECKANDCREATEFACTORY( TreeControlModel, szServiceName_TreeControlModel, NULL )
- CHECKANDCREATEFACTORY( MutableTreeDataModel, szServiceName_MutableTreeDataModel, NULL )
- CHECKANDCREATEFACTORY( UnoSimpleAnimationControlModel, szServiceName_UnoSimpleAnimationControlModel, szServiceName2_UnoSimpleAnimationControlModel )
- CHECKANDCREATEFACTORY( UnoSimpleAnimationControl, szServiceName_UnoSimpleAnimationControl, szServiceName2_UnoSimpleAnimationControl )
- CHECKANDCREATEFACTORY( UnoThrobberControlModel, szServiceName_UnoThrobberControlModel, szServiceName2_UnoThrobberControlModel )
- CHECKANDCREATEFACTORY( UnoThrobberControl, szServiceName_UnoThrobberControl, szServiceName2_UnoThrobberControl )
- TRY_OOO_FACTORY( AnimatedImagesControl, szServiceName_AnimatedImagesControl )
- TRY_OOO_FACTORY( AnimatedImagesControlModel, szServiceName_AnimatedImagesControlModel )
- TRY_OOO_FACTORY( SpinningProgressControlModel, szServiceName_SpinningProgressControlModel )
- CHECKANDCREATEFACTORY( UnoFixedHyperlinkControl, szServiceName_UnoControlFixedHyperlink, NULL )
- CHECKANDCREATEFACTORY( UnoControlFixedHyperlinkModel, szServiceName_UnoControlFixedHyperlinkModel, NULL )
- CHECKANDCREATEFACTORY( GridControl, szServiceName_GridControl, NULL )
- CHECKANDCREATEFACTORY( GridControlModel, szServiceName_GridControlModel, NULL )
- CHECKANDCREATEFACTORY( DefaultGridDataModel, szServiceName_DefaultGridDataModel, NULL )
- CHECKANDCREATEFACTORY( DefaultGridColumnModel, szServiceName_DefaultGridColumnModel, NULL )
- CHECKANDCREATEFACTORY( GridColumn, szServiceName_GridColumn, NULL )
- CHECKANDCREATEFACTORY( UnoControlTabPageModel, szServiceName_UnoControlTabPageModel, NULL )
- CHECKANDCREATEFACTORY( UnoControlTabPage, szServiceName_UnoControlTabPage, NULL )
- CHECKANDCREATEFACTORY( UnoControlTabPageContainerModel, szServiceName_UnoControlTabPageContainerModel, NULL )
- CHECKANDCREATEFACTORY( UnoControlTabPageContainer, szServiceName_UnoControlTabPageContainer, NULL )
-
+ GET_FACTORY( VCLXToolkit, szServiceName_Toolkit, szServiceName2_Toolkit )
+ GET_FACTORY( VCLXPopupMenu, szServiceName_PopupMenu, szServiceName2_PopupMenu )
+ GET_FACTORY( VCLXMenuBar, szServiceName_MenuBar, szServiceName2_MenuBar )
+ GET_FACTORY( VCLXPointer, szServiceName_Pointer, szServiceName2_Pointer )
+ GET_FACTORY( UnoControlContainer, szServiceName_UnoControlContainer, szServiceName2_UnoControlContainer )
+ GET_FACTORY( UnoControlContainerModel, szServiceName_UnoControlContainerModel, szServiceName2_UnoControlContainerModel )
+ GET_FACTORY( StdTabController, szServiceName_TabController, szServiceName2_TabController )
+ GET_FACTORY( StdTabControllerModel, szServiceName_TabControllerModel, szServiceName2_TabControllerModel )
+ GET_FACTORY( UnoDialogControl, szServiceName_UnoControlDialog, szServiceName2_UnoControlDialog )
+ GET_FACTORY( UnoControlDialogModel, szServiceName_UnoControlDialogModel, szServiceName2_UnoControlDialogModel )
+ GET_FACTORY( UnoEditControl, szServiceName_UnoControlEdit, szServiceName2_UnoControlEdit )
+ GET_FACTORY( UnoControlEditModel, szServiceName_UnoControlEditModel, szServiceName2_UnoControlEditModel )
+ GET_FACTORY( UnoDateFieldControl, szServiceName_UnoControlDateField, szServiceName2_UnoControlDateField )
+ GET_FACTORY( UnoControlDateFieldModel, szServiceName_UnoControlDateFieldModel, szServiceName2_UnoControlDateFieldModel )
+ GET_FACTORY( UnoTimeFieldControl, szServiceName_UnoControlTimeField, szServiceName2_UnoControlTimeField )
+ GET_FACTORY( UnoControlTimeFieldModel, szServiceName_UnoControlTimeFieldModel, szServiceName2_UnoControlTimeFieldModel )
+ GET_FACTORY( UnoNumericFieldControl, szServiceName_UnoControlNumericField, szServiceName2_UnoControlNumericField )
+ GET_FACTORY( UnoControlNumericFieldModel, szServiceName_UnoControlNumericFieldModel, szServiceName2_UnoControlNumericFieldModel )
+ GET_FACTORY( UnoCurrencyFieldControl, szServiceName_UnoControlCurrencyField, szServiceName2_UnoControlCurrencyField )
+ GET_FACTORY( UnoControlCurrencyFieldModel, szServiceName_UnoControlCurrencyFieldModel, szServiceName2_UnoControlCurrencyFieldModel )
+ GET_FACTORY( UnoPatternFieldControl, szServiceName_UnoControlPatternField, szServiceName2_UnoControlPatternField )
+ GET_FACTORY( UnoControlPatternFieldModel, szServiceName_UnoControlPatternFieldModel, szServiceName2_UnoControlPatternFieldModel )
+ GET_FACTORY( UnoFormattedFieldControl, szServiceName_UnoControlFormattedField, szServiceName2_UnoControlFormattedField )
+ GET_FACTORY( UnoControlFormattedFieldModel, szServiceName_UnoControlFormattedFieldModel, szServiceName2_UnoControlFormattedFieldModel )
+ GET_FACTORY( UnoFileControl, szServiceName_UnoControlFileControl, szServiceName2_UnoControlFileControl )
+ GET_FACTORY( UnoControlFileControlModel, szServiceName_UnoControlFileControlModel, szServiceName2_UnoControlFileControlModel )
+ GET_FACTORY( UnoButtonControl, szServiceName_UnoControlButton, szServiceName2_UnoControlButton )
+ GET_FACTORY( UnoControlButtonModel, szServiceName_UnoControlButtonModel, szServiceName2_UnoControlButtonModel )
+ GET_FACTORY( UnoImageControlControl, szServiceName_UnoControlImageButton, szServiceName2_UnoControlImageButton )
+ GET_FACTORY( UnoControlImageControlModel, szServiceName_UnoControlImageButtonModel, szServiceName2_UnoControlImageButtonModel )
+ GET_FACTORY( UnoImageControlControl, szServiceName_UnoControlImageControl, szServiceName2_UnoControlImageControl )
+ GET_FACTORY( UnoControlImageControlModel, szServiceName_UnoControlImageControlModel, szServiceName2_UnoControlImageControlModel )
+ GET_FACTORY( UnoRadioButtonControl, szServiceName_UnoControlRadioButton, szServiceName2_UnoControlRadioButton )
+ GET_FACTORY( UnoControlRadioButtonModel, szServiceName_UnoControlRadioButtonModel, szServiceName2_UnoControlRadioButtonModel )
+ GET_FACTORY( UnoCheckBoxControl, szServiceName_UnoControlCheckBox, szServiceName2_UnoControlCheckBox )
+ GET_FACTORY( UnoControlCheckBoxModel, szServiceName_UnoControlCheckBoxModel, szServiceName2_UnoControlCheckBoxModel )
+ GET_FACTORY( UnoListBoxControl, szServiceName_UnoControlListBox, szServiceName2_UnoControlListBox )
+ GET_FACTORY( UnoControlListBoxModel, szServiceName_UnoControlListBoxModel, szServiceName2_UnoControlListBoxModel )
+ GET_FACTORY( UnoComboBoxControl, szServiceName_UnoControlComboBox, szServiceName2_UnoControlComboBox )
+ GET_FACTORY( UnoControlComboBoxModel, szServiceName_UnoControlComboBoxModel, szServiceName2_UnoControlComboBoxModel )
+ GET_FACTORY( UnoFixedTextControl, szServiceName_UnoControlFixedText, szServiceName2_UnoControlFixedText )
+ GET_FACTORY( UnoControlFixedTextModel, szServiceName_UnoControlFixedTextModel, szServiceName2_UnoControlFixedTextModel )
+ GET_FACTORY( UnoGroupBoxControl, szServiceName_UnoControlGroupBox, szServiceName2_UnoControlGroupBox )
+ GET_FACTORY( UnoControlGroupBoxModel, szServiceName_UnoControlGroupBoxModel, szServiceName2_UnoControlGroupBoxModel )
+ GET_FACTORY( UnoProgressBarControl, szServiceName_UnoControlProgressBar, szServiceName2_UnoControlProgressBar )
+ GET_FACTORY( UnoControlProgressBarModel, szServiceName_UnoControlProgressBarModel, szServiceName2_UnoControlProgressBarModel )
+ GET_FACTORY( UnoScrollBarControl, szServiceName_UnoControlScrollBar, szServiceName2_UnoControlScrollBar )
+ GET_FACTORY( UnoControlScrollBarModel, szServiceName_UnoControlScrollBarModel, szServiceName2_UnoControlScrollBarModel )
+ GET_FACTORY( UnoFixedLineControl, szServiceName_UnoControlFixedLine, szServiceName2_UnoControlFixedLine )
+ GET_FACTORY( UnoControlFixedLineModel, szServiceName_UnoControlFixedLineModel, szServiceName2_UnoControlFixedLineModel )
+ GET_FACTORY( VCLXPrinterServer, szServiceName_PrinterServer, szServiceName2_PrinterServer )
+ GET_FACTORY( UnoRoadmapControl, szServiceName_UnoControlRoadmap, szServiceName2_UnoControlRoadmap )
+ GET_FACTORY( UnoControlRoadmapModel, szServiceName_UnoControlRoadmapModel, szServiceName2_UnoControlRoadmapModel )
+ GET_FACTORY( UnoSpinButtonModel, szServiceName_UnoSpinButtonModel, NULL )
+ GET_FACTORY( UnoSpinButtonControl, szServiceName_UnoSpinButtonControl, NULL )
+ GET_FACTORY( TreeControl, szServiceName_TreeControl, NULL )
+ GET_FACTORY( TreeControlModel, szServiceName_TreeControlModel, NULL )
+ GET_FACTORY( MutableTreeDataModel, szServiceName_MutableTreeDataModel, NULL )
+ GET_FACTORY( UnoSimpleAnimationControlModel, szServiceName_UnoSimpleAnimationControlModel, szServiceName2_UnoSimpleAnimationControlModel )
+ GET_FACTORY( UnoSimpleAnimationControl, szServiceName_UnoSimpleAnimationControl, szServiceName2_UnoSimpleAnimationControl )
+ GET_FACTORY( UnoThrobberControlModel, szServiceName_UnoThrobberControlModel, szServiceName2_UnoThrobberControlModel )
+ GET_FACTORY( UnoThrobberControl, szServiceName_UnoThrobberControl, szServiceName2_UnoThrobberControl )
+ GET_FACTORY( UnoFixedHyperlinkControl, szServiceName_UnoControlFixedHyperlink, NULL )
+ GET_FACTORY( UnoControlFixedHyperlinkModel, szServiceName_UnoControlFixedHyperlinkModel, NULL )
+ GET_FACTORY( GridControl, szServiceName_GridControl, NULL );
+ GET_FACTORY( GridControlModel, szServiceName_GridControlModel, NULL );
+ GET_FACTORY( DefaultGridDataModel, szServiceName_DefaultGridDataModel, NULL );
+ GET_FACTORY( DefaultGridColumnModel, szServiceName_DefaultGridColumnModel, NULL );
+ GET_FACTORY_WITH_IMPL_PREFIX( GridColumn, "org.openoffice.comp.toolkit", szServiceName_GridColumn, NULL );
+ GET_FACTORY_WITH_IMPL_PREFIX( SortableGridDataModel, "org.openoffice.comp.toolkit", szServiceName_SortableGridDataModel, NULL );
+ GET_FACTORY_WITH_IMPL_PREFIX( AnimatedImagesControl, "org.openoffice.comp.toolkit", szServiceName_AnimatedImagesControl, NULL )
+ GET_FACTORY_WITH_IMPL_PREFIX( AnimatedImagesControlModel, "org.openoffice.comp.toolkit", szServiceName_AnimatedImagesControlModel, NULL )
+ GET_FACTORY_WITH_IMPL_PREFIX( SpinningProgressControlModel, "org.openoffice.comp.toolkit", szServiceName_SpinningProgressControlModel, NULL )
+ GET_FACTORY( UnoControlTabPageModel, szServiceName_UnoControlTabPageModel, NULL )
+ GET_FACTORY( UnoControlTabPage, szServiceName_UnoControlTabPage, NULL )
+ GET_FACTORY( UnoControlTabPageContainerModel, szServiceName_UnoControlTabPageContainerModel, NULL )
+ GET_FACTORY( UnoControlTabPageContainer, szServiceName_UnoControlTabPageContainer, NULL )
if ( rtl_str_compare( sImplementationName, "com.sun.star.awt.comp.AsyncCallback" ) == 0 )
return comp_AsyncCallback_component_getFactory( sImplementationName, _pServiceManager, _pRegistryKey );
diff --git a/toolkit/source/helper/servicenames.cxx b/toolkit/source/helper/servicenames.cxx
index 383adb22b9de..293d257da832 100644
--- a/toolkit/source/helper/servicenames.cxx
+++ b/toolkit/source/helper/servicenames.cxx
@@ -109,4 +109,5 @@ const sal_Char __FAR_DATA szServiceName_UnoControlTabPage[] = "com.sun.star.awt.
const sal_Char __FAR_DATA szServiceName_UnoControlTabPageModel[] = "com.sun.star.awt.tab.UnoControlTabPageModel";
const sal_Char __FAR_DATA szServiceName_UnoControlTabPageContainerModel[] = "com.sun.star.awt.tab.UnoControlTabPageContainerModel";
const sal_Char __FAR_DATA szServiceName_UnoControlTabPageContainer[] = "com.sun.star.awt.tab.UnoControlTabPageContainer";
+const sal_Char __FAR_DATA szServiceName_SortableGridDataModel[] = "com.sun.star.awt.grid.SortableGridDataModel";
diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx
index 1b676ec0edb3..943723ea5910 100644
--- a/toolkit/source/helper/unowrapper.cxx
+++ b/toolkit/source/helper/unowrapper.cxx
@@ -68,7 +68,6 @@ using namespace ::com::sun::star;
// instead of only a <VCLXWindow> instance, especially regarding its
// corresponding accessibility API.
case WINDOW_METRICBOX:
- // <--
case WINDOW_COMBOBOX: return new VCLXComboBox;
case WINDOW_SPINFIELD:
case WINDOW_NUMERICFIELD:
diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx
index da91945c0b0e..600687a3633b 100644
--- a/toolkit/source/helper/vclunohelper.cxx
+++ b/toolkit/source/helper/vclunohelper.cxx
@@ -212,10 +212,11 @@ Polygon VCLUnoHelper::CreatePolygon( const ::com::sun::star::uno::Sequence< sal_
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer> VCLUnoHelper::CreateControlContainer( Window* pWindow )
{
- UnoControlContainer* pContainer = new UnoControlContainer( pWindow->GetComponentInterface( sal_True ) );
+ const uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ UnoControlContainer* pContainer = new UnoControlContainer( xFactory, pWindow->GetComponentInterface( sal_True ) );
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > x = pContainer;
- UnoControlModel* pContainerModel = new UnoControlContainerModel;
+ UnoControlModel* pContainerModel = new UnoControlContainerModel( xFactory );
pContainer->setModel( (::com::sun::star::awt::XControlModel*)pContainerModel );
return x;
diff --git a/toolkit/util/tk.component b/toolkit/util/tk.component
index c147d2b2521d..690b3f324498 100644
--- a/toolkit/util/tk.component
+++ b/toolkit/util/tk.component
@@ -53,9 +53,12 @@
<implementation name="stardiv.Toolkit.DefaultGridDataModel">
<service name="com.sun.star.awt.grid.DefaultGridDataModel"/>
</implementation>
- <implementation name="stardiv.Toolkit.GridColumn">
+ <implementation name="org.openoffice.comp.toolkit.GridColumn">
<service name="com.sun.star.awt.grid.GridColumn"/>
</implementation>
+ <implementation name="org.openoffice.comp.toolkit.SortableGridDataModel">
+ <service name="com.sun.star.awt.grid.SortableGridDataModel"/>
+ </implementation>
<implementation name="stardiv.Toolkit.GridControl">
<service name="com.sun.star.awt.grid.UnoControlGrid"/>
</implementation>
diff --git a/tools/inc/tools/debug.hxx b/tools/inc/tools/debug.hxx
index 4d640642c69d..63a94555a8c1 100644
--- a/tools/inc/tools/debug.hxx
+++ b/tools/inc/tools/debug.hxx
@@ -80,7 +80,7 @@ typedef void (*DbgTestSolarMutexProc)();
#define DBG_OUT_MSGBOX 4
#define DBG_OUT_TESTTOOL 5
#define DBG_OUT_DEBUGGER 6
-#define DBG_OUT_COREDUMP 7
+#define DBG_OUT_ABORT 7
#define DBG_OUT_COUNT 8
@@ -137,6 +137,7 @@ struct DbgDataType
#define DBG_FUNC_GETPRINTMSGBOX 17
#define DBG_FUNC_FILTERMESSAGE 18 // new for #i38967
#define DBG_FUNC_UPDATEOSLHOOK 19
+#define DBG_FUNC_SET_ABORT 20
TOOLS_DLLPUBLIC void* DbgFunc( sal_uInt16 nAction, void* pData = NULL );
@@ -180,6 +181,11 @@ inline void DbgSetPrintTestTool( DbgPrintLine pProc )
DbgFunc( DBG_FUNC_SETPRINTTESTTOOL, (void*)(long)pProc );
}
+inline void DbgSetAbort( DbgPrintLine pProc )
+{
+ DbgFunc( DBG_FUNC_SET_ABORT, (void*)(long)pProc );
+}
+
typedef sal_uInt16 DbgChannelId;
/** registers a user-defined channel for emitting the diagnostic messages
diff --git a/tools/inc/tools/mempool.hxx b/tools/inc/tools/mempool.hxx
index 4c6c68ab0dd9..74df068908f7 100644
--- a/tools/inc/tools/mempool.hxx
+++ b/tools/inc/tools/mempool.hxx
@@ -28,7 +28,7 @@
#define _SVMEMPOOL_HXX
#include "tools/toolsdllapi.h"
-#include <tools/solar.h>
+#include "tools/solar.h"
// ----------------
// - FixedMemPool -
@@ -39,9 +39,11 @@ struct FixedMemPool_Impl;
class TOOLS_DLLPUBLIC FixedMemPool
{
FixedMemPool_Impl * m_pImpl;
+ char const * m_pTypeName;
public:
- FixedMemPool( sal_uInt16 nTypeSize,
+ FixedMemPool( char const * pTypeName,
+ sal_uInt16 nTypeSize,
sal_uInt16 nInitSize = 512,
sal_uInt16 nGrowSize = 256 );
~FixedMemPool();
@@ -97,8 +99,11 @@ IMPL_FIXEDMEMPOOL_DEL_BODY( Class, aPool )
DECL_FIXEDMEMPOOL_NEW_INLINE( Class, aPool ) \
DECL_FIXEDMEMPOOL_DEL_INLINE( Class, aPool )
+#define IMPL_FIXEDMEMPOOL_STRING(x) IMPL_FIXEDMEMPOOL_MAKESTRING(x)
+#define IMPL_FIXEDMEMPOOL_MAKESTRING(x) #x
+
#define IMPL_FIXEDMEMPOOL_NEWDEL( Class, InitSize, GrowSize) \
- FixedMemPool Class::aPool( sizeof( Class ), (InitSize), (GrowSize) );
+ FixedMemPool Class::aPool( IMPL_FIXEDMEMPOOL_STRING( Class ), sizeof( Class ), (InitSize), (GrowSize) );
#define DECL_FIXEDMEMPOOL_NEWDEL_DLL( Class ) \
private: \
@@ -108,13 +113,13 @@ IMPL_FIXEDMEMPOOL_DEL_BODY( Class, aPool )
DECL_FIXEDMEMPOOL_DEL_DECL();
#define IMPL_FIXEDMEMPOOL_NEWDEL_DLL( Class, InitSize, GrowSize) \
- FixedMemPool Class::aPool( sizeof( Class ), (InitSize), (GrowSize) ); \
+ FixedMemPool Class::aPool( IMPL_FIXEDMEMPOOL_STRING( Class ), sizeof( Class ), (InitSize), (GrowSize) ); \
DECL_FIXEDMEMPOOL_NEW_IMPL( Class ) \
IMPL_FIXEDMEMPOOL_NEW_BODY( Class, aPool ) \
DECL_FIXEDMEMPOOL_DEL_IMPL( Class ) \
IMPL_FIXEDMEMPOOL_DEL_BODY( Class, aPool )
-#define INIT_FIXEDMEMPOOL_NEWDEL_DLL( class, aPool, InitSize, GrowSize ) \
- aPool( sizeof( class ), InitSize, GrowSize )
+#define INIT_FIXEDMEMPOOL_NEWDEL_DLL( Class, aPool, InitSize, GrowSize ) \
+ aPool( IMPL_FIXEDMEMPOOL_STRING( Class ), sizeof( Class ), (InitSize), (GrowSize) )
#endif // _SVMEMPOOL_HXX
diff --git a/tools/inc/tools/stream.hxx b/tools/inc/tools/stream.hxx
index 66034d1dc10e..841b364fef6e 100644
--- a/tools/inc/tools/stream.hxx
+++ b/tools/inc/tools/stream.hxx
@@ -460,9 +460,20 @@ public:
/// Switch to no endian swapping and write 0xfeff
sal_Bool StartWritingUnicodeText();
- /// Read 16bit, if 0xfeff do nothing, if 0xfffe switch
- /// endian swapping, if none of them put back
- sal_Bool StartReadingUnicodeText();
+
+ /** If eReadBomCharSet==RTL_TEXTENCODING_DONTKNOW: read 16bit,
+ if 0xfeff do nothing (UTF-16), if 0xfffe switch endian
+ swapping (UTF-16), if 0xefbb or 0xbbef read another byte
+ and check for UTF-8. If no UTF-* BOM was detected put all
+ read bytes back. This means that if 2 bytes were read it
+ was an UTF-16 BOM, if 3 bytes were read it was an UTF-8
+ BOM. There is no UTF-7, UTF-32 or UTF-EBCDIC BOM detection!
+
+ If eReadBomCharSet!=RTL_TEXTENCODING_DONTKNOW: only read a
+ BOM of that encoding and switch endian swapping if UTF-16
+ and 0xfffe.
+ */
+ sal_Bool StartReadingUnicodeText( rtl_TextEncoding eReadBomCharSet );
/// Read a line of Unicode
sal_Bool ReadUniStringLine( String& rStr );
diff --git a/tools/inc/tools/wintypes.hxx b/tools/inc/tools/wintypes.hxx
index 3e6081fa2b82..18adfbab37ef 100644
--- a/tools/inc/tools/wintypes.hxx
+++ b/tools/inc/tools/wintypes.hxx
@@ -117,7 +117,8 @@ typedef sal_uInt16 WindowType;
#define WINDOW_INTROWINDOW (WINDOW_FIRST + 0x4f)
#define WINDOW_LISTBOXWINDOW (WINDOW_FIRST + 0x50)
#define WINDOW_DOCKINGAREA (WINDOW_FIRST + 0x51)
-#define WINDOW_LAST (WINDOW_DOCKINGAREA)
+#define WINDOW_RULER (WINDOW_FIRST + 0x52)
+#define WINDOW_LAST (WINDOW_RULER)
// ---------------
diff --git a/tools/source/debug/debug.cxx b/tools/source/debug/debug.cxx
index fd6f499b4036..bbde4efe6d9e 100644
--- a/tools/source/debug/debug.cxx
+++ b/tools/source/debug/debug.cxx
@@ -152,6 +152,7 @@ struct DebugData
DbgPrintLine pDbgPrintMsgBox;
DbgPrintLine pDbgPrintWindow;
DbgPrintLine pDbgPrintTestTool;
+ DbgPrintLine pDbgAbort;
::std::vector< DbgPrintLine >
aDbgPrintUserChannels;
PointerList* pProfList;
@@ -163,9 +164,10 @@ struct DebugData
DebugData()
:bInit( sal_False )
- ,pDbgPrintMsgBox( sal_False )
+ ,pDbgPrintMsgBox( NULL )
,pDbgPrintWindow( NULL )
,pDbgPrintTestTool( NULL )
+ ,pDbgAbort( NULL )
,pProfList( NULL )
,pXtorList( NULL )
,pDbgTestSolarMutex( NULL )
@@ -420,7 +422,7 @@ namespace
{
const sal_Char* names[ DBG_OUT_COUNT ] =
{
- "dev/null", "file", "window", "shell", "messagebox", "testtool", "debugger", "coredump"
+ "dev/null", "file", "window", "shell", "messagebox", "testtool", "debugger", "abort"
};
lcl_writeConfigString( _pFile, _pKeyName, names[ _nValue ] );
}
@@ -471,26 +473,30 @@ namespace
if ( nValueLen )
*_out_pnValue = strcmp( aBuf, "1" ) == 0 ? sal_True : sal_False;
}
- void lcl_tryReadOutputChannel( const sal_Char* _pLine, size_t _nLineLen, const sal_Char* _pKeyName, sal_uIntPtr* _out_pnValue )
+ void lcl_matchOutputChannel( sal_Char const * i_buffer, sal_uIntPtr* o_value )
{
+ if ( i_buffer == NULL )
+ return;
const sal_Char* names[ DBG_OUT_COUNT ] =
{
- "dev/null", "file", "window", "shell", "messagebox", "testtool", "debugger", "coredump"
+ "dev/null", "file", "window", "shell", "messagebox", "testtool", "debugger", "abort"
};
- sal_Char aBuf[20];
- size_t nValueLen = lcl_tryReadConfigString( _pLine, _nLineLen, _pKeyName, aBuf, sizeof( aBuf ) );
- if ( nValueLen )
+ for ( sal_uIntPtr name = 0; name < sizeof( names ) / sizeof( names[0] ); ++name )
{
- for ( sal_uIntPtr name = 0; name < sizeof( names ) / sizeof( names[0] ); ++name )
+ if ( strcmp( i_buffer, names[ name ] ) == 0 )
{
- if ( strcmp( aBuf, names[ name ] ) == 0 )
- {
- *_out_pnValue = name;
- return;
- }
+ *o_value = name;
+ return;
}
}
}
+ void lcl_tryReadOutputChannel( const sal_Char* _pLine, size_t _nLineLen, const sal_Char* _pKeyName, sal_uIntPtr* _out_pnValue )
+ {
+ sal_Char aBuf[20];
+ size_t nValueLen = lcl_tryReadConfigString( _pLine, _nLineLen, _pKeyName, aBuf, sizeof( aBuf ) );
+ if ( nValueLen )
+ lcl_matchOutputChannel( aBuf, _out_pnValue );
+ }
void lcl_tryReadConfigFlag( const sal_Char* _pLine, size_t _nLineLen, const sal_Char* _pKeyName, sal_uIntPtr* _out_pnAllFlags, sal_uIntPtr _nCheckFlag )
{
sal_Char aBuf[2];
@@ -811,6 +817,13 @@ static DebugData* GetDebugData()
FileClose( pIniFile );
}
+ else
+ {
+ lcl_matchOutputChannel( getenv( "DBGSV_TRACE_OUT" ), &aDebugData.aDbgData.nTraceOut );
+ lcl_matchOutputChannel( getenv( "DBGSV_WARNING_OUT" ), &aDebugData.aDbgData.nWarningOut );
+ lcl_matchOutputChannel( getenv( "DBGSV_ERROR_OUT" ), &aDebugData.aDbgData.nErrorOut );
+
+ }
getcwd( aCurPath, sizeof( aCurPath ) );
@@ -1199,6 +1212,10 @@ void* DbgFunc( sal_uInt16 nAction, void* pParam )
pDebugData->pDbgPrintTestTool = (DbgPrintLine)(long)pParam;
break;
+ case DBG_FUNC_SET_ABORT:
+ pDebugData->pDbgAbort = (DbgPrintLine)(long)pParam;
+ break;
+
case DBG_FUNC_SAVEDATA:
{
const DbgData* pData = static_cast< const DbgData* >( pParam );
@@ -1706,10 +1723,11 @@ void DbgOut( const sal_Char* pMsg, sal_uInt16 nDbgOut, const sal_Char* pFile, sa
nOut = DBG_OUT_DEBUGGER;
}
- if ( nOut == DBG_OUT_COREDUMP )
+ if ( nOut == DBG_OUT_ABORT )
{
- if ( !ImplCoreDump() )
- nOut = DBG_OUT_DEBUGGER;
+ if ( pData->pDbgAbort != NULL )
+ pData->pDbgAbort( aBufOut );
+ abort();
}
if ( nOut == DBG_OUT_DEBUGGER )
diff --git a/tools/source/memtools/mempool.cxx b/tools/source/memtools/mempool.cxx
index 27054a3b79db..e8be417b15a2 100755
--- a/tools/source/memtools/mempool.cxx
+++ b/tools/source/memtools/mempool.cxx
@@ -28,7 +28,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_tools.hxx"
-#include <tools/mempool.hxx>
+#include "tools/mempool.hxx"
+#include "osl/diagnose.h"
#include "rtl/alloc.h"
#ifndef INCLUDED_STDIO_H
@@ -42,11 +43,13 @@
*************************************************************************/
FixedMemPool::FixedMemPool (
- sal_uInt16 _nTypeSize, sal_uInt16, sal_uInt16)
+ char const * pTypeName, sal_uInt16 nTypeSize, sal_uInt16, sal_uInt16)
+ : m_pTypeName (pTypeName)
{
char name[RTL_CACHE_NAME_LENGTH + 1];
- snprintf (name, sizeof(name), "FixedMemPool_%d", (int)_nTypeSize);
- m_pImpl = (FixedMemPool_Impl*)rtl_cache_create (name, _nTypeSize, 0, NULL, NULL, NULL, 0, NULL, 0);
+ snprintf (name, sizeof(name), "FixedMemPool_%d", (int)nTypeSize);
+ m_pImpl = (FixedMemPool_Impl*)rtl_cache_create (name, nTypeSize, 0, NULL, NULL, NULL, 0, NULL, 0);
+ OSL_TRACE("FixedMemPool::ctor(\"%s\"): %p", m_pTypeName, m_pImpl);
}
/*************************************************************************
@@ -57,7 +60,8 @@ FixedMemPool::FixedMemPool (
FixedMemPool::~FixedMemPool()
{
- rtl_cache_destroy ((rtl_cache_type*)(m_pImpl));
+ OSL_TRACE("FixedMemPool::dtor(\"%s\"): %p", m_pTypeName, m_pImpl);
+ rtl_cache_destroy ((rtl_cache_type*)(m_pImpl)), m_pImpl = 0;
}
/*************************************************************************
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 6e1a6401b7a0..5d0da0f3e29d 100755
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -1046,21 +1046,59 @@ sal_Bool SvStream::StartWritingUnicodeText()
|*
*************************************************************************/
-sal_Bool SvStream::StartReadingUnicodeText()
+sal_Bool SvStream::StartReadingUnicodeText( rtl_TextEncoding eReadBomCharSet )
{
+ if (!( eReadBomCharSet == RTL_TEXTENCODING_DONTKNOW ||
+ eReadBomCharSet == RTL_TEXTENCODING_UNICODE ||
+ eReadBomCharSet == RTL_TEXTENCODING_UTF8))
+ return sal_True; // nothing to read
+
+ bool bTryUtf8 = false;
sal_uInt16 nFlag;
+ sal_sSize nBack = sizeof(nFlag);
*this >> nFlag;
switch ( nFlag )
{
case 0xfeff :
- // native
+ // native UTF-16
+ if ( eReadBomCharSet == RTL_TEXTENCODING_DONTKNOW ||
+ eReadBomCharSet == RTL_TEXTENCODING_UNICODE)
+ nBack = 0;
break;
case 0xfffe :
- SetEndianSwap( !bSwap );
+ // swapped UTF-16
+ if ( eReadBomCharSet == RTL_TEXTENCODING_DONTKNOW ||
+ eReadBomCharSet == RTL_TEXTENCODING_UNICODE)
+ {
+ SetEndianSwap( !bSwap );
+ nBack = 0;
+ }
+ break;
+ case 0xefbb :
+ if (nNumberFormatInt == NUMBERFORMAT_INT_BIGENDIAN &&
+ (eReadBomCharSet == RTL_TEXTENCODING_DONTKNOW ||
+ eReadBomCharSet == RTL_TEXTENCODING_UTF8))
+ bTryUtf8 = true;
+ break;
+ case 0xbbef :
+ if (nNumberFormatInt == NUMBERFORMAT_INT_LITTLEENDIAN &&
+ (eReadBomCharSet == RTL_TEXTENCODING_DONTKNOW ||
+ eReadBomCharSet == RTL_TEXTENCODING_UTF8))
+ bTryUtf8 = true;
break;
default:
- SeekRel( -((sal_sSize)sizeof(nFlag)) ); // no BOM, pure data
+ ; // nothing
+ }
+ if (bTryUtf8)
+ {
+ sal_uChar nChar;
+ nBack += sizeof(nChar);
+ *this >> nChar;
+ if (nChar == 0xbf)
+ nBack = 0; // it is UTF-8
}
+ if (nBack)
+ SeekRel( -nBack ); // no BOM, pure data
return nError == SVSTREAM_OK;
}
diff --git a/tools/workben/makefile.mk b/tools/workben/makefile.mk
new file mode 100644
index 000000000000..d97156c7f66c
--- /dev/null
+++ b/tools/workben/makefile.mk
@@ -0,0 +1,68 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ = ..
+PRJNAME = tools
+TARGET = workben
+LIBTARGET = NO
+TARGETTYPE = CUI
+ENABLE_EXCEPTIONS=TRUE
+
+.INCLUDE: settings.mk
+
+OBJFILES = \
+ $(OBJ)$/solar.obj \
+ $(OBJ)$/urltest.obj \
+ $(OBJ)$/inetmimetest.obj \
+ $(OBJ)$/mempooltest.obj
+
+APP1TARGET = solar
+APP1OBJS = $(OBJ)$/solar.obj
+.IF "$(GUI)" == "UNX" || "$(GUI)" == "OS2"
+APP1STDLIBS = $(TOOLSLIB)
+.ELSE
+APP1LIBS = $(LB)$/itools.lib
+.ENDIF
+
+APP2TARGET = urltest
+APP2OBJS = $(OBJ)$/urltest.obj
+.IF "$(GUI)" == "UNX" || "$(GUI)" == "OS2"
+APP2STDLIBS = $(TOOLSLIB) $(VOSLIB) $(SALLIB) $(CPPULIB) $(CPPUHELPERLIB)
+.ELSE
+APP2STDLIBS = $(LB)$/itools.lib $(VOSLIB) $(SALLIB) $(CPPULIB) $(CPPUHELPERLIB)
+.ENDIF
+
+APP3TARGET = inetmimetest
+APP3OBJS = $(OBJ)$/inetmimetest.obj
+APP3STDLIBS = $(SALLIB) $(TOOLSLIB)
+
+APP4TARGET = mempooltest
+APP4OBJS = $(OBJ)$/mempooltest.obj
+APP4STDLIBS = $(TOOLSLIB)
+APP4RPATH = UREBIN
+
+.INCLUDE: target.mk
diff --git a/tools/workben/mempooltest.cxx b/tools/workben/mempooltest.cxx
new file mode 100644
index 000000000000..bf00343bc9d6
--- /dev/null
+++ b/tools/workben/mempooltest.cxx
@@ -0,0 +1,18 @@
+#include "tools/mempool.hxx"
+
+struct MempoolTest
+{
+ int m_int;
+
+ DECL_FIXEDMEMPOOL_NEWDEL(MempoolTest);
+};
+
+IMPL_FIXEDMEMPOOL_NEWDEL(MempoolTest, 0, 0);
+
+int main()
+{
+ MempoolTest * p = new MempoolTest();
+ if (p != 0)
+ delete p;
+ return 1;
+}
diff --git a/unotools/inc/unotools/textsearch.hxx b/unotools/inc/unotools/textsearch.hxx
index fb89e0f15179..39b201cc672e 100644
--- a/unotools/inc/unotools/textsearch.hxx
+++ b/unotools/inc/unotools/textsearch.hxx
@@ -127,15 +127,6 @@ public:
class UNOTOOLS_DLLPUBLIC TextSearch
{
- struct CachedTextSearch
- {
- ::osl::Mutex mutex;
- ::com::sun::star::util::SearchOptions Options;
- ::com::sun::star::uno::Reference< ::com::sun::star::util::XTextSearch > xTextSearch;
- };
-
- static CachedTextSearch maCache;
-
static ::com::sun::star::uno::Reference< ::com::sun::star::util::XTextSearch >
getXTextSearch( const ::com::sun::star::util::SearchOptions& rPara );
diff --git a/unotools/source/i18n/textsearch.cxx b/unotools/source/i18n/textsearch.cxx
index 317e6f9b6e45..c40654ebef1f 100644
--- a/unotools/source/i18n/textsearch.cxx
+++ b/unotools/source/i18n/textsearch.cxx
@@ -40,6 +40,7 @@
#include <unotools/charclass.hxx>
#include <comphelper/processfactory.hxx>
#include <unotools/textsearch.hxx>
+#include <rtl/instance.hxx>
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::uno;
@@ -90,13 +91,6 @@ SearchParam::SearchParam( const SearchParam& rParam )
nTransliterationFlags = rParam.nTransliterationFlags;
}
-// Klasse zum Suchen eines Strings in einem Text. Es wird genau nach
-// dem String gesucht.
-// ( Die Unterscheidung der Gross/Klein-Schreibung kann mit einen Flag
-// unterdrueckt werden )
-
-TextSearch::CachedTextSearch TextSearch::maCache;
-
static bool lcl_Equals( const SearchOptions& rSO1, const SearchOptions& rSO2 )
{
return rSO1.algorithmType == rSO2.algorithmType &&
@@ -112,27 +106,42 @@ static bool lcl_Equals( const SearchOptions& rSO1, const SearchOptions& rSO2 )
rSO1.transliterateFlags == rSO2.transliterateFlags;
}
+namespace
+{
+ struct CachedTextSearch
+ {
+ ::osl::Mutex mutex;
+ ::com::sun::star::util::SearchOptions Options;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XTextSearch > xTextSearch;
+ };
+
+ struct theCachedTextSearch
+ : public rtl::Static< CachedTextSearch, theCachedTextSearch > {};
+}
+
Reference<XTextSearch> TextSearch::getXTextSearch( const SearchOptions& rPara )
{
- osl::MutexGuard aGuard(maCache.mutex);
+ CachedTextSearch &rCache = theCachedTextSearch::get();
+
+ osl::MutexGuard aGuard(rCache.mutex);
- if ( lcl_Equals(maCache.Options, rPara) )
- return maCache.xTextSearch;
+ if ( lcl_Equals(rCache.Options, rPara) )
+ return rCache.xTextSearch;
try
{
Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
- maCache.xTextSearch.set( xMSF->createInstance(
+ rCache.xTextSearch.set( xMSF->createInstance(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.util.TextSearch" ) ) ), UNO_QUERY_THROW );
- maCache.xTextSearch->setOptions( rPara );
- maCache.Options = rPara;
+ rCache.xTextSearch->setOptions( rPara );
+ rCache.Options = rPara;
}
catch ( Exception& )
{
DBG_ERRORFILE( "TextSearch ctor: Exception caught!" );
}
- return maCache.xTextSearch;
+ return rCache.xTextSearch;
}
TextSearch::TextSearch(const SearchParam & rParam, LanguageType eLang )
diff --git a/vcl/aqua/inc/salframeview.h b/vcl/aqua/inc/salframeview.h
index 5e93839719b5..a41e5cf656ba 100755
--- a/vcl/aqua/inc/salframeview.h
+++ b/vcl/aqua/inc/salframeview.h
@@ -85,6 +85,7 @@
}
+(void)unsetMouseFrame: (AquaSalFrame*)pFrame;
-(id)initWithSalFrame: (AquaSalFrame*)pFrame;
+-(AquaSalFrame*)getSalFrame;
-(BOOL)acceptsFirstResponder;
-(BOOL)acceptsFirstMouse: (NSEvent *)pEvent;
-(BOOL)isOpaque;
diff --git a/vcl/aqua/inc/salgdi.h b/vcl/aqua/inc/salgdi.h
index 8043f38defad..7c0acc7598a8 100644
--- a/vcl/aqua/inc/salgdi.h
+++ b/vcl/aqua/inc/salgdi.h
@@ -176,8 +176,7 @@ public:
// InvalidateContext does an UnsetState and sets mrContext to 0
void InvalidateContext();
- virtual sal_Bool unionClipRegion( long nX, long nY, long nWidth, long nHeight );
- virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& );
+ virtual bool setClipRegion( const Region& );
// draw --> LineColor and FillColor and RasterOp and ClipRegion
virtual void drawPixel( long nX, long nY );
@@ -250,11 +249,6 @@ public:
// set the clip region to empty
virtual void ResetClipRegion();
- // begin setting the clip region, add rectangles to the
- // region with the UnionClipRegion call
- virtual void BeginSetClipRegion( sal_uLong nCount );
- // all rectangles were added and the clip region should be set now
- virtual void EndSetClipRegion();
// set the line color to transparent (= don't draw lines)
virtual void SetLineColor();
diff --git a/vcl/aqua/source/dtrans/DragSource.cxx b/vcl/aqua/source/dtrans/DragSource.cxx
index 62b153176893..dab882e75716 100644
--- a/vcl/aqua/source/dtrans/DragSource.cxx
+++ b/vcl/aqua/source/dtrans/DragSource.cxx
@@ -47,6 +47,7 @@
using namespace rtl;
using namespace cppu;
using namespace osl;
+using namespace com::sun::star;
using namespace com::sun::star::datatransfer;
using namespace com::sun::star::datatransfer::clipboard;
using namespace com::sun::star::datatransfer::dnd;
@@ -61,7 +62,7 @@ using namespace std;
// For OOo internal D&D we provide the Transferable without NSDragPboard
// interference as a shortcut
-Reference<XTransferable> DragSource::g_XTransferable = Reference<XTransferable>();
+uno::Reference<XTransferable> DragSource::g_XTransferable;
NSView* DragSource::g_DragSourceView = nil;
bool DragSource::g_DropSuccessSet = false;
bool DragSource::g_DropSuccess = false;
@@ -138,7 +139,7 @@ Sequence<OUString> dragSource_getSupportedServiceNames()
bDropSuccess );
mDragSource->mXDragSrcListener->dragDropEnd(dsde);
- mDragSource->mXDragSrcListener = Reference<XDragSourceListener>();
+ mDragSource->mXDragSrcListener = uno::Reference<XDragSourceListener>();
}
@@ -242,8 +243,8 @@ void SAL_CALL DragSource::startDrag(const DragGestureEvent& trigger,
sal_Int8 sourceActions,
sal_Int32 cursor,
sal_Int32 image,
- const Reference<XTransferable >& transferable,
- const Reference<XDragSourceListener >& listener )
+ const uno::Reference<XTransferable >& transferable,
+ const uno::Reference<XDragSourceListener >& listener )
throw( RuntimeException)
{
MutexGuard guard(m_aMutex);
@@ -257,7 +258,7 @@ void SAL_CALL DragSource::startDrag(const DragGestureEvent& trigger,
mXCurrentContext = static_cast<XDragSourceContext*>(new DragSourceContext(this));
auto_ptr<AquaClipboard> clipb(new AquaClipboard(NULL, false));
g_XTransferable = transferable;
- clipb->setContents(g_XTransferable, Reference<XClipboardOwner>());
+ clipb->setContents(g_XTransferable, uno::Reference<XClipboardOwner>());
mDragSourceActions = sourceActions;
g_DragSourceView = mView;
@@ -297,7 +298,7 @@ void SAL_CALL DragSource::startDrag(const DragGestureEvent& trigger,
[dragImage release];
- g_XTransferable = Reference<XTransferable>();
+ g_XTransferable = uno::Reference<XTransferable>();
g_DragSourceView = nil;
// reset drop success flags
diff --git a/vcl/aqua/source/dtrans/DropTarget.cxx b/vcl/aqua/source/dtrans/DropTarget.cxx
index 01a58b171b02..103b6dc47d44 100644
--- a/vcl/aqua/source/dtrans/DropTarget.cxx
+++ b/vcl/aqua/source/dtrans/DropTarget.cxx
@@ -50,6 +50,8 @@
#include <Carbon/Carbon.h>
#include <postmac.h>
+#include <salframe.h>
+#include <salframeview.h>
using namespace rtl;
using namespace cppu;
@@ -60,6 +62,7 @@ using namespace com::sun::star::datatransfer::dnd::DNDConstants;
using namespace com::sun::star::datatransfer::clipboard;
using namespace com::sun::star::lang;
using namespace com::sun::star::uno;
+using namespace com::sun::star;
using namespace comphelper;
OUString dropTarget_getImplementationName()
@@ -149,6 +152,8 @@ namespace /* private */
DropTarget::DropTarget() :
WeakComponentImplHelper5<XInitialization, XDropTarget, XDropTargetDragContext, XDropTargetDropContext, XServiceInfo>(m_aMutex),
+ mView(nil),
+ mpFrame(NULL),
mDropTargetHelper(nil),
mbActive(false),
mDragSourceSupportedActions(DNDConstants::ACTION_NONE),
@@ -161,8 +166,9 @@ DropTarget::DropTarget() :
DropTarget::~DropTarget()
{
- [(id <DraggingDestinationHandler>)mView unregisterDraggingDestinationHandler:mDropTargetHelper];
- [mDropTargetHelper release];
+ if( AquaSalFrame::isAlive( mpFrame ) )
+ [(id <DraggingDestinationHandler>)mView unregisterDraggingDestinationHandler:mDropTargetHelper];
+ [mDropTargetHelper release];
}
@@ -243,7 +249,7 @@ NSDragOperation DropTarget::draggingEntered(id sender)
NSPasteboard* dragPboard = [sender draggingPasteboard];
mXCurrentDragClipboard = new AquaClipboard(dragPboard, false);
- Reference<XTransferable> xTransferable = DragSource::g_XTransferable.is() ?
+ uno::Reference<XTransferable> xTransferable = DragSource::g_XTransferable.is() ?
DragSource::g_XTransferable : mXCurrentDragClipboard->getContents();
DropTargetDragEnterEvent dtdee(static_cast<OWeakObject*>(this),
@@ -333,7 +339,7 @@ BOOL DropTarget::performDragOperation(id sender)
if (mSelectedDropAction != DNDConstants::ACTION_NONE)
{
- Reference<XTransferable> xTransferable = DragSource::g_XTransferable;
+ uno::Reference<XTransferable> xTransferable = DragSource::g_XTransferable;
if (!DragSource::g_XTransferable.is())
{
@@ -370,7 +376,7 @@ BOOL DropTarget::performDragOperation(id sender)
{
mDragSourceSupportedActions = DNDConstants::ACTION_NONE;
mSelectedDropAction = DNDConstants::ACTION_NONE;
- mXCurrentDragClipboard = Reference<XClipboard>();
+ mXCurrentDragClipboard = uno::Reference<XClipboard>();
SetThemeCursor(kThemeArrowCursor);
}
@@ -396,6 +402,7 @@ BOOL DropTarget::performDragOperation(id sender)
sal_uInt64 tmp = 0;
pNSView >>= tmp;
mView = (id)tmp;
+ mpFrame = [(SalFrameView*)mView getSalFrame];
mDropTargetHelper = [[DropTargetHelper alloc] initWithDropTarget: this];
@@ -415,14 +422,14 @@ BOOL DropTarget::performDragOperation(id sender)
}
- void SAL_CALL DropTarget::addDropTargetListener(const Reference<XDropTargetListener>& dtl)
+ void SAL_CALL DropTarget::addDropTargetListener(const uno::Reference<XDropTargetListener>& dtl)
throw(RuntimeException)
{
rBHelper.addListener(::getCppuType(&dtl), dtl);
}
- void SAL_CALL DropTarget::removeDropTargetListener(const Reference<XDropTargetListener>& dtl)
+ void SAL_CALL DropTarget::removeDropTargetListener(const uno::Reference<XDropTargetListener>& dtl)
throw(RuntimeException)
{
rBHelper.removeListener(::getCppuType(&dtl), dtl);
@@ -486,7 +493,7 @@ BOOL DropTarget::performDragOperation(id sender)
{
// Reset the internal transferable used as shortcut in case this is
// an internal D&D operation
- DragSource::g_XTransferable = Reference<XTransferable>();
+ DragSource::g_XTransferable = uno::Reference<XTransferable>();
DragSource::g_DropSuccessSet = true;
DragSource::g_DropSuccess = success;
}
@@ -494,13 +501,13 @@ BOOL DropTarget::performDragOperation(id sender)
void DropTarget::fire_drop( const DropTargetDropEvent& dte)
{
- OInterfaceContainerHelper* pContainer= rBHelper.getContainer( getCppuType( (Reference<XDropTargetListener>* )0 ) );
+ OInterfaceContainerHelper* pContainer= rBHelper.getContainer( getCppuType( (uno::Reference<XDropTargetListener>* )0 ) );
if( pContainer)
{
OInterfaceIteratorHelper iter( *pContainer);
while( iter.hasMoreElements())
{
- Reference<XDropTargetListener> listener( static_cast<XDropTargetListener*>( iter.next()));
+ uno::Reference<XDropTargetListener> listener( static_cast<XDropTargetListener*>( iter.next()));
try { listener->drop( dte); }
catch(RuntimeException&) {}
@@ -511,13 +518,13 @@ BOOL DropTarget::performDragOperation(id sender)
void DropTarget::fire_dragEnter(const DropTargetDragEnterEvent& e)
{
- OInterfaceContainerHelper* pContainer= rBHelper.getContainer( getCppuType( (Reference<XDropTargetListener>* )0 ) );
+ OInterfaceContainerHelper* pContainer= rBHelper.getContainer( getCppuType( (uno::Reference<XDropTargetListener>* )0 ) );
if( pContainer)
{
OInterfaceIteratorHelper iter( *pContainer);
while( iter.hasMoreElements())
{
- Reference<XDropTargetListener> listener( static_cast<XDropTargetListener*>( iter.next()));
+ uno::Reference<XDropTargetListener> listener( static_cast<XDropTargetListener*>( iter.next()));
try { listener->dragEnter( e); }
catch (RuntimeException&) {}
@@ -528,14 +535,14 @@ BOOL DropTarget::performDragOperation(id sender)
void DropTarget::fire_dragExit(const DropTargetEvent& dte)
{
- OInterfaceContainerHelper* pContainer= rBHelper.getContainer( getCppuType( (Reference<XDropTargetListener>* )0 ) );
+ OInterfaceContainerHelper* pContainer= rBHelper.getContainer( getCppuType( (uno::Reference<XDropTargetListener>* )0 ) );
if( pContainer)
{
OInterfaceIteratorHelper iter( *pContainer);
while( iter.hasMoreElements())
{
- Reference<XDropTargetListener> listener( static_cast<XDropTargetListener*>( iter.next()));
+ uno::Reference<XDropTargetListener> listener( static_cast<XDropTargetListener*>( iter.next()));
try { listener->dragExit( dte); }
catch (RuntimeException&) {}
@@ -546,13 +553,13 @@ BOOL DropTarget::performDragOperation(id sender)
void DropTarget::fire_dragOver(const DropTargetDragEvent& dtde)
{
- OInterfaceContainerHelper* pContainer= rBHelper.getContainer( getCppuType( (Reference<XDropTargetListener>* )0 ) );
+ OInterfaceContainerHelper* pContainer= rBHelper.getContainer( getCppuType( (uno::Reference<XDropTargetListener>* )0 ) );
if( pContainer)
{
OInterfaceIteratorHelper iter( *pContainer );
while( iter.hasMoreElements())
{
- Reference<XDropTargetListener> listener( static_cast<XDropTargetListener*>( iter.next()));
+ uno::Reference<XDropTargetListener> listener( static_cast<XDropTargetListener*>( iter.next()));
try { listener->dragOver( dtde); }
catch (RuntimeException&) {}
@@ -563,13 +570,13 @@ BOOL DropTarget::performDragOperation(id sender)
void DropTarget::fire_dropActionChanged(const DropTargetDragEvent& dtde)
{
- OInterfaceContainerHelper* pContainer= rBHelper.getContainer( getCppuType( (Reference<XDropTargetListener>* )0 ) );
+ OInterfaceContainerHelper* pContainer= rBHelper.getContainer( getCppuType( (uno::Reference<XDropTargetListener>* )0 ) );
if( pContainer)
{
OInterfaceIteratorHelper iter( *pContainer);
while( iter.hasMoreElements())
{
- Reference<XDropTargetListener> listener( static_cast<XDropTargetListener*>( iter.next()));
+ uno::Reference<XDropTargetListener> listener( static_cast<XDropTargetListener*>( iter.next()));
try { listener->dropActionChanged( dtde); }
catch (RuntimeException&) {}
diff --git a/vcl/aqua/source/dtrans/DropTarget.hxx b/vcl/aqua/source/dtrans/DropTarget.hxx
index 231df7fd5157..77e2a08c5de7 100644
--- a/vcl/aqua/source/dtrans/DropTarget.hxx
+++ b/vcl/aqua/source/dtrans/DropTarget.hxx
@@ -51,6 +51,7 @@
#include <postmac.h>
class DropTarget;
+class AquaSalFrame;
/* The functions declared in this protocol are actually
declared in vcl/aqua/inc/salframe.h. Because we want
@@ -159,6 +160,7 @@ private:
com::sun::star::uno::Reference< com::sun::star::datatransfer::clipboard::XClipboard > mXCurrentDragClipboard;
DataFlavorMapperPtr_t mDataFlavorMapper;
id mView;
+ AquaSalFrame* mpFrame;
DropTargetHelper* mDropTargetHelper;
bool mbActive;
sal_Int8 mDragSourceSupportedActions;
diff --git a/vcl/aqua/source/dtrans/service_entry.cxx b/vcl/aqua/source/dtrans/service_entry.cxx
index 222b5cf40e04..ca207c23bdee 100644
--- a/vcl/aqua/source/dtrans/service_entry.cxx
+++ b/vcl/aqua/source/dtrans/service_entry.cxx
@@ -38,37 +38,37 @@
using namespace ::osl;
using namespace ::rtl;
+using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::cppu;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::datatransfer::clipboard;
-Reference< XInterface > AquaSalInstance::CreateClipboard( const Sequence< Any >& i_rArguments )
+uno::Reference< XInterface > AquaSalInstance::CreateClipboard( const Sequence< Any >& i_rArguments )
{
if ( Application::IsHeadlessModeEnabled() )
return SalInstance::CreateClipboard( i_rArguments );
SalData* pSalData = GetSalData();
if( ! pSalData->mxClipboard.is() )
- pSalData->mxClipboard = Reference<XInterface>(static_cast< XClipboard* >(new AquaClipboard()), UNO_QUERY);
+ pSalData->mxClipboard = uno::Reference<XInterface>(static_cast< XClipboard* >(new AquaClipboard()), UNO_QUERY);
return pSalData->mxClipboard;
}
-
-Reference<XInterface> AquaSalInstance::CreateDragSource()
+uno::Reference<XInterface> AquaSalInstance::CreateDragSource()
{
if ( Application::IsHeadlessModeEnabled() )
return SalInstance::CreateDragSource();
- return Reference<XInterface>(static_cast< XInitialization* >(new DragSource()), UNO_QUERY);
+ return uno::Reference<XInterface>(static_cast< XInitialization* >(new DragSource()), UNO_QUERY);
}
-Reference<XInterface> AquaSalInstance::CreateDropTarget()
+uno::Reference<XInterface> AquaSalInstance::CreateDropTarget()
{
if ( Application::IsHeadlessModeEnabled() )
return SalInstance::CreateDropTarget();
- return Reference<XInterface>(static_cast< XInitialization* >(new DropTarget()), UNO_QUERY);
+ return uno::Reference<XInterface>(static_cast< XInitialization* >(new DropTarget()), UNO_QUERY);
}
diff --git a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm
index 038f366b584c..82119fb9c50a 100644
--- a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm
+++ b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm
@@ -816,7 +816,6 @@ static void addBool( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachO
[pBtn setEnabled: NO];
linebreakCell( [pBtn cell], rText );
[pBtn sizeToFit];
- [pCurParent addSubview: [pBtn autorelease]];
rRightColumn.push_back( ColumnItem( pBtn ) );
@@ -828,10 +827,17 @@ static void addBool( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachO
[pBtn setTag: nTag];
aCheckRect = [pBtn frame];
+ // #i115837# add a murphy factor; it can apparently occasionally happen
+ // that sizeToFit does not a perfect job and that the button linebreaks again
+ // if - and only if - there is already a '\n' contained in the text and the width
+ // is minimally of
+ aCheckRect.size.width += 1;
// move to rCurY
aCheckRect.origin.y = rCurY - aCheckRect.size.height;
[pBtn setFrame: aCheckRect];
+
+ [pCurParent addSubview: [pBtn autorelease]];
// update rCurY
rCurY = aCheckRect.origin.y - 5;
diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx
index 7a3a2a76f173..62906a5df268 100644
--- a/vcl/aqua/source/gdi/salgdi.cxx
+++ b/vcl/aqua/source/gdi/salgdi.cxx
@@ -41,6 +41,7 @@
#include "vcl/sysdata.hxx"
#include "vcl/sallayout.hxx"
#include "vcl/svapp.hxx"
+#include "vcl/region.h"
#include "osl/file.hxx"
#include "osl/process.h"
@@ -562,7 +563,7 @@ void AquaSalGraphics::ResetClipRegion()
// -----------------------------------------------------------------------
-void AquaSalGraphics::BeginSetClipRegion( sal_uLong nRectCount )
+bool AquaSalGraphics::setClipRegion( const Region& i_rClip )
{
// release old clip path
if( mxClipPath )
@@ -570,41 +571,33 @@ void AquaSalGraphics::BeginSetClipRegion( sal_uLong nRectCount )
CGPathRelease( mxClipPath );
mxClipPath = NULL;
}
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool AquaSalGraphics::unionClipRegion( long nX, long nY, long nWidth, long nHeight )
-{
- if( (nWidth <= 0) || (nHeight <= 0) )
- return sal_True;
-
- if( !mxClipPath )
- mxClipPath = CGPathCreateMutable();
- const CGRect aClipRect = {{nX,nY},{nWidth,nHeight}};
- CGPathAddRect( mxClipPath, NULL, aClipRect );
- return sal_True;
-}
+ mxClipPath = CGPathCreateMutable();
-// -----------------------------------------------------------------------
-
-bool AquaSalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& rPolyPolygon )
-{
- if( rPolyPolygon.count() <= 0 )
- return true;
-
- if( !mxClipPath )
- mxClipPath = CGPathCreateMutable();
- AddPolyPolygonToPath( mxClipPath, rPolyPolygon, !getAntiAliasB2DDraw(), false );
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-void AquaSalGraphics::EndSetClipRegion()
-{
+ // set current path, either as polypolgon or sequence of rectangles
+ if( i_rClip.HasPolyPolygon() )
+ {
+ basegfx::B2DPolyPolygon aClip( const_cast<Region&>(i_rClip).ConvertToB2DPolyPolygon() );
+ AddPolyPolygonToPath( mxClipPath, aClip, !getAntiAliasB2DDraw(), false );
+ }
+ else
+ {
+ long nX, nY, nW, nH;
+ ImplRegionInfo aInfo;
+ bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH );
+ while( bRegionRect )
+ {
+ if( nW && nH )
+ {
+ CGRect aRect = {{nX,nY}, {nW,nH}};
+ CGPathAddRect( mxClipPath, NULL, aRect );
+ }
+ bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH );
+ }
+ }
+ // set the current path as clip region
if( CheckContext() )
SetState();
+ return true;
}
// -----------------------------------------------------------------------
diff --git a/vcl/aqua/source/gdi/salprn.cxx b/vcl/aqua/source/gdi/salprn.cxx
index 0df146eef8fa..ed80110cacc6 100644
--- a/vcl/aqua/source/gdi/salprn.cxx
+++ b/vcl/aqua/source/gdi/salprn.cxx
@@ -380,14 +380,14 @@ static bool getUseNativeDialog()
try
{
// get service provider
- Reference< XMultiServiceFactory > xSMgr( unohelper::GetMultiServiceFactory() );
+ uno::Reference< XMultiServiceFactory > xSMgr( unohelper::GetMultiServiceFactory() );
// create configuration hierachical access name
if( xSMgr.is() )
{
try
{
- Reference< XMultiServiceFactory > xConfigProvider(
- Reference< XMultiServiceFactory >(
+ uno::Reference< XMultiServiceFactory > xConfigProvider(
+ uno::Reference< XMultiServiceFactory >(
xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.configuration.ConfigurationProvider" ))),
UNO_QUERY )
@@ -399,8 +399,8 @@ static bool getUseNativeDialog()
aVal.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) );
aVal.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common/Misc" ) );
aArgs.getArray()[0] <<= aVal;
- Reference< XNameAccess > xConfigAccess(
- Reference< XNameAccess >(
+ uno::Reference< XNameAccess > xConfigAccess(
+ uno::Reference< XNameAccess >(
xConfigProvider->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.configuration.ConfigurationAccess" )),
aArgs ),
@@ -834,12 +834,24 @@ void AquaSalInfoPrinter::InitPaperFormats( const ImplJobSetup* i_pSetupData )
for( unsigned int i = 0; i < nPapers; i++ )
{
NSString* pPaper = [pPaperNames objectAtIndex: i];
- NSSize aPaperSize = [mpPrinter pageSizeForPaper: pPaper];
- if( aPaperSize.width > 0 && aPaperSize.height > 0 )
+ // first try to match the name
+ rtl::OString aPaperName( [pPaper UTF8String] );
+ Paper ePaper = PaperInfo::fromPSName( aPaperName );
+ if( ePaper != PAPER_USER )
{
- PaperInfo aInfo( PtTo10Mu( aPaperSize.width ),
- PtTo10Mu( aPaperSize.height ) );
- m_aPaperFormats.push_back( aInfo );
+ m_aPaperFormats.push_back( PaperInfo( ePaper ) );
+ }
+ else
+ {
+ NSSize aPaperSize = [mpPrinter pageSizeForPaper: pPaper];
+ if( aPaperSize.width > 0 && aPaperSize.height > 0 )
+ {
+ PaperInfo aInfo( PtTo10Mu( aPaperSize.width ),
+ PtTo10Mu( aPaperSize.height ) );
+ if( aInfo.getPaper() == PAPER_USER )
+ aInfo.doSloppyFit();
+ m_aPaperFormats.push_back( aInfo );
+ }
}
}
}
diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm
index 783d203c76fd..ba8751307c70 100755
--- a/vcl/aqua/source/window/salframeview.mm
+++ b/vcl/aqua/source/window/salframeview.mm
@@ -398,6 +398,11 @@ static AquaSalFrame* getMouseContainerFrame()
return self;
}
+-(AquaSalFrame*)getSalFrame
+{
+ return mpFrame;
+}
+
-(void)resetCursorRects
{
if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
diff --git a/vcl/inc/vcl/cursor.hxx b/vcl/inc/vcl/cursor.hxx
index 14fd58296b0d..c143e49002fa 100644
--- a/vcl/inc/vcl/cursor.hxx
+++ b/vcl/inc/vcl/cursor.hxx
@@ -64,15 +64,13 @@ private:
sal_Bool mbVisible; // Ist Cursor sichtbar
unsigned char mnDirection; // indicates direction
-//#if 0 // _SOLAR__PRIVATE
public:
SAL_DLLPRIVATE void ImplDraw();
SAL_DLLPRIVATE void ImplRestore();
DECL_DLLPRIVATE_LINK( ImplTimerHdl, AutoTimer* );
- SAL_DLLPRIVATE void ImplShow( sal_Bool bDrawDirect = sal_True );
- SAL_DLLPRIVATE void ImplHide();
+ SAL_DLLPRIVATE void ImplShow( bool bDrawDirect = true, bool bRestore = false );
+ SAL_DLLPRIVATE bool ImplHide();
SAL_DLLPRIVATE void ImplNew();
-//#endif
public:
Cursor();
diff --git a/vcl/inc/vcl/cvtsvm.hxx b/vcl/inc/vcl/cvtsvm.hxx
index 00c7c5270a0d..ad4e38816830 100644
--- a/vcl/inc/vcl/cvtsvm.hxx
+++ b/vcl/inc/vcl/cvtsvm.hxx
@@ -92,7 +92,7 @@
class Stack;
-class VCL_DLLPUBLIC SVMConverter
+class VCL_PLUGIN_PUBLIC SVMConverter
{
private:
//#if 0 // _SOLAR__PRIVATE
diff --git a/vcl/inc/vcl/displayconnectiondispatch.hxx b/vcl/inc/vcl/displayconnectiondispatch.hxx
new file mode 100644
index 000000000000..fea1d0b7cba9
--- /dev/null
+++ b/vcl/inc/vcl/displayconnectiondispatch.hxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+*
+* 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.
+*
+************************************************************************/
+
+#ifndef INCLUDED_VCL_DISPLAYCONNECTIONDISPATCH_HXX
+#define INCLUDED_VCL_DISPLAYCONNECTIONDISPATCH_HXX
+
+#include "sal/config.h"
+
+#include "com/sun/star/awt/XDisplayConnection.hpp"
+#include "cppuhelper/implbase1.hxx"
+
+namespace vcl {
+
+class DisplayConnectionDispatch:
+ public cppu::WeakImplHelper1< com::sun::star::awt::XDisplayConnection >
+{
+public:
+ virtual bool dispatchEvent(void * pData, int nBytes) = 0;
+
+ virtual bool dispatchErrorEvent(void * pData, int nBytes) = 0;
+
+protected:
+ virtual ~DisplayConnectionDispatch() {}
+};
+
+}
+
+#endif
diff --git a/vcl/inc/vcl/dllapi.h b/vcl/inc/vcl/dllapi.h
index bcf4001aa671..2c5c2c6801ac 100644
--- a/vcl/inc/vcl/dllapi.h
+++ b/vcl/inc/vcl/dllapi.h
@@ -37,4 +37,10 @@
#define VCL_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
#endif
+#if defined UNX && ! defined MACOS
+#define VCL_PLUGIN_PUBLIC VCL_DLLPUBLIC
+#else
+#define VCL_PLUGIN_PUBLIC SAL_DLLPRIVATE
+#endif
+
#endif
diff --git a/vcl/inc/vcl/fontcache.hxx b/vcl/inc/vcl/fontcache.hxx
index b18748ed5791..7747b99015fe 100644
--- a/vcl/inc/vcl/fontcache.hxx
+++ b/vcl/inc/vcl/fontcache.hxx
@@ -38,7 +38,7 @@
namespace psp
{
-class VCL_DLLPUBLIC FontCache
+class VCL_PLUGIN_PUBLIC FontCache
{
struct FontDir;
friend class FontDir;
diff --git a/vcl/inc/vcl/fontmanager.hxx b/vcl/inc/vcl/fontmanager.hxx
index 33fece8d88e1..f97f21a8f72d 100644
--- a/vcl/inc/vcl/fontmanager.hxx
+++ b/vcl/inc/vcl/fontmanager.hxx
@@ -222,7 +222,7 @@ class FontCache;
class FontCache;
-class VCL_DLLPUBLIC PrintFontManager
+class VCL_PLUGIN_PUBLIC PrintFontManager
{
struct PrintFont;
struct TrueTypeFontFile;
diff --git a/vcl/inc/vcl/glyphcache.hxx b/vcl/inc/vcl/glyphcache.hxx
index 20c3f9aaa68e..a44935bf0e54 100644
--- a/vcl/inc/vcl/glyphcache.hxx
+++ b/vcl/inc/vcl/glyphcache.hxx
@@ -57,7 +57,7 @@ class ServerFontLayout;
// =======================================================================
-class VCL_DLLPUBLIC GlyphCache
+class VCL_PLUGIN_PUBLIC GlyphCache
{
public:
explicit GlyphCache( GlyphCachePeer& );
@@ -172,7 +172,7 @@ private:
// =======================================================================
-class VCL_DLLPUBLIC ServerFont
+class VCL_PLUGIN_PUBLIC ServerFont
{
public:
virtual const ::rtl::OString* GetFontFileName() const { return NULL; }
@@ -254,7 +254,7 @@ private:
// =======================================================================
// a class for cache entries for physical font instances that are based on serverfonts
-class VCL_DLLPUBLIC ImplServerFontEntry : public ImplFontEntry
+class VCL_PLUGIN_PUBLIC ImplServerFontEntry : public ImplFontEntry
{
private:
ServerFont* mpServerFont;
@@ -271,7 +271,7 @@ public:
// =======================================================================
-class VCL_DLLPUBLIC ServerFontLayout : public GenericSalLayout
+class VCL_PLUGIN_PUBLIC ServerFontLayout : public GenericSalLayout
{
private:
ServerFont& mrServerFont;
@@ -316,7 +316,7 @@ protected:
// =======================================================================
-class VCL_DLLPUBLIC RawBitmap
+class VCL_PLUGIN_PUBLIC RawBitmap
{
public:
RawBitmap();
@@ -349,7 +349,7 @@ inline void ServerFont::SetExtended( int nInfo, void* pVoid )
// ExtraKernInfo allows an on-demand query of extra kerning info #i29881#
// The kerning values have to be scaled to match the font size before use
-class VCL_DLLPUBLIC ExtraKernInfo
+class VCL_PLUGIN_PUBLIC ExtraKernInfo
{
public:
ExtraKernInfo( sal_IntPtr nFontId );
diff --git a/vcl/inc/vcl/graphite_adaptors.hxx b/vcl/inc/vcl/graphite_adaptors.hxx
index ae2ff2962adb..66f264faf9ef 100644
--- a/vcl/inc/vcl/graphite_adaptors.hxx
+++ b/vcl/inc/vcl/graphite_adaptors.hxx
@@ -84,7 +84,7 @@ namespace grutils
// the Graphite engine.
// @author tse
//
-class VCL_DLLPUBLIC GraphiteFontAdaptor : public gr::Font
+class VCL_PLUGIN_PUBLIC GraphiteFontAdaptor : public gr::Font
{
typedef std::map<const gr::gid16, std::pair<gr::Rect, gr::Point> > GlyphMetricMap;
friend class GrFontHasher;
diff --git a/vcl/inc/vcl/graphite_layout.hxx b/vcl/inc/vcl/graphite_layout.hxx
index cd22abdcdb26..ebd323bebf28 100644
--- a/vcl/inc/vcl/graphite_layout.hxx
+++ b/vcl/inc/vcl/graphite_layout.hxx
@@ -85,7 +85,7 @@ namespace grutils { class GrFeatureParser; }
// This class uses the SIL Graphite engine to provide complex text layout services to the VCL
// @author tse
//
-class VCL_DLLPUBLIC GraphiteLayout : public SalLayout
+class VCL_PLUGIN_PUBLIC GraphiteLayout : public SalLayout
{
public:
// Mask to allow Word break status to be stored within mvChar2BaseGlyph
@@ -133,7 +133,7 @@ private:
const grutils::GrFeatureParser * mpFeatures;
public:
- GraphiteLayout(const gr::Font & font, const grutils::GrFeatureParser * features = NULL) throw();
+ explicit GraphiteLayout( const gr::Font& font, const grutils::GrFeatureParser* features = NULL ) throw();
// used by upper layers
virtual bool LayoutText( ImplLayoutArgs& ); // first step of layout
@@ -183,6 +183,4 @@ private:
void expandOrCondense(ImplLayoutArgs &rArgs);
};
-
-
#endif // _SV_GRAPHITELAYOUT_HXX
diff --git a/vcl/inc/vcl/graphite_serverfont.hxx b/vcl/inc/vcl/graphite_serverfont.hxx
index 19eb70b11908..cdaed20476e2 100644
--- a/vcl/inc/vcl/graphite_serverfont.hxx
+++ b/vcl/inc/vcl/graphite_serverfont.hxx
@@ -37,7 +37,7 @@
// Modules
-class VCL_DLLPUBLIC GraphiteLayoutImpl : public GraphiteLayout
+class VCL_PLUGIN_PUBLIC GraphiteLayoutImpl : public GraphiteLayout
{
public:
GraphiteLayoutImpl(const gr::Font & font, const grutils::GrFeatureParser * features, GraphiteFontAdaptor * pFont) throw()
@@ -51,14 +51,14 @@ private:
// This class implments the server font specific parts.
// @author tse
//
-class VCL_DLLPUBLIC GraphiteServerFontLayout : public ServerFontLayout
+class VCL_PLUGIN_PUBLIC GraphiteServerFontLayout : public ServerFontLayout
{
private:
mutable GraphiteFontAdaptor * mpFont;
// mutable so that the DrawOffset/DrawBase can be set
mutable GraphiteLayoutImpl maImpl;
public:
- GraphiteServerFontLayout(GraphiteFontAdaptor * font) throw();
+ explicit GraphiteServerFontLayout( GraphiteFontAdaptor* font ) throw();
virtual bool LayoutText( ImplLayoutArgs& rArgs) { SalLayout::AdjustLayout(rArgs); return maImpl.LayoutText(rArgs); }; // first step of layout
virtual void AdjustLayout( ImplLayoutArgs& rArgs)
@@ -94,7 +94,5 @@ public:
int getMaxCharPos() const { return mnEndCharPos; }
};
-
-
#endif
#endif //_SV_GRAPHITESERVERFONT_HXX
diff --git a/vcl/inc/vcl/help.hxx b/vcl/inc/vcl/help.hxx
index 752fc6e6e4f9..b80b9a86627a 100644
--- a/vcl/inc/vcl/help.hxx
+++ b/vcl/inc/vcl/help.hxx
@@ -40,16 +40,22 @@ class Window;
// - Help-Types -
// --------------
-#define QUICKHELP_LEFT ((sal_uInt16)0x0001)
-#define QUICKHELP_CENTER ((sal_uInt16)0x0002)
-#define QUICKHELP_RIGHT ((sal_uInt16)0x0004)
-#define QUICKHELP_TOP ((sal_uInt16)0x0008)
-#define QUICKHELP_VCENTER ((sal_uInt16)0x0010)
-#define QUICKHELP_BOTTOM ((sal_uInt16)0x0020)
-#define QUICKHELP_NOAUTOPOS (QUICKHELP_LEFT | QUICKHELP_CENTER | QUICKHELP_RIGHT | QUICKHELP_TOP | QUICKHELP_VCENTER | QUICKHELP_BOTTOM)
-#define QUICKHELP_CTRLTEXT ((sal_uInt16)0x0040)
-#define QUICKHELP_NOEVADEPOINTER ((sal_uInt16)0x4000)
-#define QUICKHELP_BIDI_RTL ((sal_uInt16)0x8000)
+#define QUICKHELP_LEFT ((sal_uInt16)0x0001)
+#define QUICKHELP_CENTER ((sal_uInt16)0x0002)
+#define QUICKHELP_RIGHT ((sal_uInt16)0x0004)
+#define QUICKHELP_TOP ((sal_uInt16)0x0008)
+#define QUICKHELP_VCENTER ((sal_uInt16)0x0010)
+#define QUICKHELP_BOTTOM ((sal_uInt16)0x0020)
+#define QUICKHELP_NOAUTOPOS (QUICKHELP_LEFT | QUICKHELP_CENTER | QUICKHELP_RIGHT | QUICKHELP_TOP | QUICKHELP_VCENTER | QUICKHELP_BOTTOM)
+#define QUICKHELP_CTRLTEXT ((sal_uInt16)0x0040)
+/// force the existent tip window to be re-positioned, even if the previous incarnation has the same text. Applies to ShowBallon and ShowQuickHelp.
+#define QUICKHELP_FORCE_REPOSITION ((sal_uInt16)0x0080)
+/// no delay when opening the quick help. Applies to ShowBallon and ShowQuickHelp
+#define QUICKHELP_NO_DELAY ((sal_uInt16)0x0100)
+/// force balloon-style in ShowTip
+#define QUICKHELP_TIP_STYLE_BALLOON ((sal_uInt16)0x0200)
+#define QUICKHELP_NOEVADEPOINTER ((sal_uInt16)0x4000)
+#define QUICKHELP_BIDI_RTL ((sal_uInt16)0x8000)
// By changes you must also change: rsc/vclrsc.hxx
#define OOO_HELP_INDEX ".help:index"
@@ -101,21 +107,25 @@ public:
static void EnableQuickHelp();
static void DisableQuickHelp();
- static sal_Bool IsQuickHelpEnabled();
- static sal_Bool ShowQuickHelp( Window* pParent,
+ static sal_Bool IsQuickHelpEnabled();
+ static sal_Bool ShowQuickHelp( Window* pParent,
const Rectangle& rScreenRect,
const XubString& rHelpText,
const XubString& rLongHelpText,
sal_uInt16 nStyle = 0 );
- static sal_Bool ShowQuickHelp( Window* pParent,
+ static sal_Bool ShowQuickHelp( Window* pParent,
const Rectangle& rScreenRect,
const XubString& rHelpText,
sal_uInt16 nStyle = 0 )
{ return Help::ShowQuickHelp( pParent, rScreenRect, rHelpText, XubString(), nStyle ); }
- static sal_uLong ShowTip( Window* pParent,
+ static sal_uLong ShowTip( Window* pParent,
const Rectangle& rScreenRect,
const XubString& rText, sal_uInt16 nStyle = 0 );
+ static void UpdateTip( sal_uLong nId,
+ Window* pParent,
+ const Rectangle& rScreenRect,
+ const XubString& rText );
static void HideTip( sal_uLong nId );
};
diff --git a/vcl/inc/vcl/helpwin.hxx b/vcl/inc/vcl/helpwin.hxx
index a3fd0a81da36..fc3e2d5ffce8 100644
--- a/vcl/inc/vcl/helpwin.hxx
+++ b/vcl/inc/vcl/helpwin.hxx
@@ -65,7 +65,8 @@ public:
const String& GetHelpText() const { return maHelpText; }
void SetHelpText( const String& rHelpText );
- sal_uInt16 GetWinStyle() const { return mnHelpWinStyle; }
+ sal_uInt16 GetWinStyle() const { return mnHelpWinStyle; }
+ sal_uInt16 GetStyle() const { return mnStyle; }
// Nur merken:
void SetStatusText( const String& rStatusText ) { maStatusText = rStatusText; }
diff --git a/vcl/inc/vcl/impfont.hxx b/vcl/inc/vcl/impfont.hxx
index c0ff0a080b17..cc4271932b47 100644
--- a/vcl/inc/vcl/impfont.hxx
+++ b/vcl/inc/vcl/impfont.hxx
@@ -174,7 +174,7 @@ public:
class CmapResult;
-class VCL_DLLPUBLIC ImplFontCharMap
+class VCL_PLUGIN_PUBLIC ImplFontCharMap
{
public:
explicit ImplFontCharMap( const CmapResult& );
@@ -218,11 +218,7 @@ private:
};
// CmapResult is a normalized version of the many CMAP formats
-class
-#ifdef UNX
- VCL_DLLPUBLIC // vcl-plugins need it
-#endif // UNX
-CmapResult
+class VCL_PLUGIN_PUBLIC CmapResult
{
public:
explicit CmapResult( bool bSymbolic = false,
diff --git a/vcl/inc/vcl/lineinfo.hxx b/vcl/inc/vcl/lineinfo.hxx
index 6332acb907ee..ca498c157bd7 100644
--- a/vcl/inc/vcl/lineinfo.hxx
+++ b/vcl/inc/vcl/lineinfo.hxx
@@ -56,6 +56,8 @@ struct ImplLineInfo
ImplLineInfo();
ImplLineInfo( const ImplLineInfo& rImplLineInfo );
+ bool operator==( const ImplLineInfo& ) const;
+
friend SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo );
friend SvStream& operator<<( SvStream& rOStm, const ImplLineInfo& rImplLineInfo );
};
diff --git a/vcl/inc/vcl/octree.hxx b/vcl/inc/vcl/octree.hxx
index 684155d075f9..88de6bcc9e68 100644
--- a/vcl/inc/vcl/octree.hxx
+++ b/vcl/inc/vcl/octree.hxx
@@ -65,7 +65,7 @@ typedef PNODE* PPNODE;
class ImpNodeCache;
class BitmapReadAccess;
-class VCL_DLLPUBLIC Octree
+class VCL_PLUGIN_PUBLIC Octree
{
private:
@@ -127,7 +127,7 @@ inline sal_uInt16 Octree::GetBestPaletteIndex( const BitmapColor& rColor )
// - InverseColorMap -
// -------------------
-class VCL_DLLPUBLIC InverseColorMap
+class VCL_PLUGIN_PUBLIC InverseColorMap
{
private:
@@ -143,7 +143,7 @@ private:
public:
- InverseColorMap( const BitmapPalette& rPal );
+ explicit InverseColorMap( const BitmapPalette& rPal );
~InverseColorMap();
inline sal_uInt16 GetBestPaletteIndex( const BitmapColor& rColor );
diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx
index 0f28ef8679e8..601670592194 100644..100755
--- a/vcl/inc/vcl/outdev.hxx
+++ b/vcl/inc/vcl/outdev.hxx
@@ -401,7 +401,6 @@ public:
SAL_DLLPRIVATE void ImplInitClipRegion();
SAL_DLLPRIVATE bool ImplSelectClipRegion( const Region&, SalGraphics* pGraphics = NULL );
SAL_DLLPRIVATE void ImplSetClipRegion( const Region* pRegion );
- SAL_DLLPRIVATE void ImplSetTriangleClipRegion( const PolyPolygon &rPolyPolygon );
SAL_DLLPRIVATE SalLayout* ImplLayout( const String&, xub_StrLen nIndex,
xub_StrLen nLen, const Point& rLogicPos = Point(0,0),
@@ -851,7 +850,6 @@ public:
void SetClipRegion();
void SetClipRegion( const Region& rRegion );
- void SetTriangleClipRegion( const PolyPolygon &rRegion );
Region GetClipRegion() const;
sal_Bool IsClipRegion() const { return mbClipRegion; }
Region GetActiveClipRegion() const;
@@ -1121,6 +1119,10 @@ public:
void Push( sal_uInt16 nFlags = PUSH_ALL );
void Pop();
+ // returns the curren stack depth; that is the number of Push() calls minus the number of Pop() calls
+ // this should not normally be used since Push and Pop must always be used symmetrically
+ // however this may be e.g. a help when debugging code in which this somehow is not the case
+ sal_uInt32 GetGCStackDepth() const;
/** Query availability of alpha channel
diff --git a/vcl/inc/vcl/outfont.hxx b/vcl/inc/vcl/outfont.hxx
index f31e6590a315..aabc6bd2797f 100644
--- a/vcl/inc/vcl/outfont.hxx
+++ b/vcl/inc/vcl/outfont.hxx
@@ -116,7 +116,7 @@ public: // TODO: hide members behind accessor methods
// TODO: make cloning cheaper
// abstract base class for physical font faces
-class VCL_DLLPUBLIC ImplFontData : public ImplDevFontAttributes
+class VCL_PLUGIN_PUBLIC ImplFontData : public ImplDevFontAttributes
{
public:
// by using an ImplFontData object as a factory for its corresponding
@@ -185,7 +185,7 @@ public: // TODO: change to private
// TODO: merge with ImplFontCache
// TODO: rename to LogicalFontManager
-class VCL_DLLPUBLIC ImplDevFontList
+class VCL_PLUGIN_PUBLIC ImplDevFontList
{
private:
friend class WinGlyphFallbackSubstititution;
@@ -324,7 +324,7 @@ public: // TODO: hide members behind accessor methods
// TODO: rename ImplFontEntry to LogicalFontInstance
// TODO: allow sharing of metrics for related fonts
-class VCL_DLLPUBLIC ImplFontEntry
+class VCL_PLUGIN_PUBLIC ImplFontEntry
{
public:
explicit ImplFontEntry( const ImplFontSelectData& );
diff --git a/vcl/inc/vcl/pdfextoutdevdata.hxx b/vcl/inc/vcl/pdfextoutdevdata.hxx
index f1e203a84431..bf2a09c1dd42 100644
--- a/vcl/inc/vcl/pdfextoutdevdata.hxx
+++ b/vcl/inc/vcl/pdfextoutdevdata.hxx
@@ -52,8 +52,24 @@ namespace vcl
*/
struct PDFExtOutDevBookmarkEntry
{
+ /** ID of the link pointing to the bookmark, or -1 if the entry denotes a destination instead of a link.
+ */
sal_Int32 nLinkId;
+
+ /** ID of the named destination denoted by the bookmark, or -1 if the entry denotes a link instead of a named destination.
+ */
+ sal_Int32 nDestId;
+
+ /** link target name, respectively destination name
+ */
rtl::OUString aBookmark;
+
+ PDFExtOutDevBookmarkEntry()
+ :nLinkId( -1 )
+ ,nDestId( -1 )
+ ,aBookmark()
+ {
+ }
};
/*
@@ -195,6 +211,24 @@ public :
-1 if page id does not exist
*/
sal_Int32 CreateNamedDest( const String& sDestName, const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ );
+
+ /** registers a destination for which a destinatin ID needs to be known immediately, instead of later on setting it via
+ SetLinkDest.
+
+ This is used in contexts where a destination is referenced by means other than a link.
+
+ Later in the export process, a call to DescribeRegisteredDest must be made, providing the information about
+ the destination.
+
+ @return
+ the unique Id of the destination
+ */
+ sal_Int32 RegisterDest();
+
+ /** provides detailed information about a destination range which previously has been registered using RegisterDest.
+ */
+ void DescribeRegisteredDest( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ );
+
//<---i56629
/** Create a new destination to be used in a link
diff --git a/vcl/inc/vcl/pdfwriter.hxx b/vcl/inc/vcl/pdfwriter.hxx
index 0f7cb805d914..09a8a08d5aca 100644
--- a/vcl/inc/vcl/pdfwriter.hxx
+++ b/vcl/inc/vcl/pdfwriter.hxx
@@ -537,6 +537,11 @@ The following structure describes the permissions used in PDF security
String Producer; // OpenOffice
};
+ enum ColorMode
+ {
+ DrawColor, DrawGreyscale
+ };
+
struct PDFWriterContext
{
/* must be a valid file: URL usable by osl */
@@ -599,6 +604,7 @@ The following structure describes the permissions used in PDF security
com::sun::star::lang::Locale DocumentLocale; // defines the document default language
sal_uInt32 DPIx, DPIy; // how to handle MapMode( MAP_PIXEL )
// 0 here specifies a default handling
+ PDFWriter::ColorMode ColorMode;
PDFWriterContext() :
RelFsys( false ), //i56629, i49415?, i64585?
@@ -627,7 +633,8 @@ The following structure describes the permissions used in PDF security
OpenBookmarkLevels( -1 ),
Encryption(),
DPIx( 0 ),
- DPIy( 0 )
+ DPIy( 0 ),
+ ColorMode( PDFWriter::DrawColor )
{}
};
@@ -932,6 +939,29 @@ The following structure describes the permissions used in PDF security
-1 if page id does not exist
*/
sal_Int32 CreateLink( const Rectangle& rRect, sal_Int32 nPageNr = -1 );
+
+ /** creates a destination which is not intended to be referred to by a link, but by a public destination Id.
+
+ Form widgets, for instance, might refer to a destination, without ever actually creating a source link to
+ point to this destination. In such cases, a public destination Id will be assigned to the form widget,
+ and later on, the concrete destination data for this public Id will be registered using RegisterDestReference.
+
+ @param rRect
+ target rectangle on page to be displayed if dest is jumped to
+
+ @param nPageNr
+ number of page the dest is on (as returned by NewPage)
+ or -1 in which case the current page is used
+
+ @param eType
+ what dest type to use
+
+ @returns
+ the internal destination Id.
+ */
+ sal_Int32 RegisterDestReference( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr = -1, DestAreaType eType = XYZ );
+
+
/** Set the destination for a link
<p>will change a URL type link to a dest link if necessary</p>
diff --git a/vcl/inc/vcl/print.h b/vcl/inc/vcl/print.h
index 78c1bb647575..7ac0d04d6dac 100644
--- a/vcl/inc/vcl/print.h
+++ b/vcl/inc/vcl/print.h
@@ -55,7 +55,7 @@ struct ImplPrnQueueData
// - ImplPrnQueueList -
// --------------------
-class VCL_DLLPUBLIC ImplPrnQueueList
+class VCL_PLUGIN_PUBLIC ImplPrnQueueList
{
public:
std::hash_map< rtl::OUString, sal_Int32, rtl::OUStringHash >
diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx
index 3584a20a92b5..2ce69ab0b660 100644
--- a/vcl/inc/vcl/print.hxx
+++ b/vcl/inc/vcl/print.hxx
@@ -340,6 +340,9 @@ public:
sal_Bool SetPaperSizeUser( const Size& rSize );
sal_Bool SetPaperSizeUser( const Size& rSize, bool bMatchNearest );
Paper GetPaper() const;
+ static rtl::OUString GetPaperName( Paper ePaper );
+ // return a UI string for the current paper; i_bPaperUser == false means an empty string for PAPER_USER
+ rtl::OUString GetPaperName( bool i_bPaperUser = true ) const;
// returns number of available paper formats
int GetPaperInfoCount() const;
@@ -520,24 +523,24 @@ public:
bool isDirectPrint() const;
// implementation details, not usable outside vcl
- // don't use outside vcl. Some of these ar exported for
+ // don't use outside vcl. Some of these are exported for
// the benefit of vcl's plugins.
// Still: DO NOT USE OUTSIDE VCL
- int getFilteredPageCount();
+ VCL_PLUGIN_PUBLIC int getFilteredPageCount();
SAL_DLLPRIVATE PageSize getPageFile( int i_inUnfilteredPage, GDIMetaFile& rMtf, bool i_bMayUseCache = false );
- PageSize getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache = false );
+ VCL_PLUGIN_PUBLIC PageSize getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache = false );
SAL_DLLPRIVATE void printFilteredPage( int i_nPage );
SAL_DLLPRIVATE void setPrinter( const boost::shared_ptr<Printer>& );
SAL_DLLPRIVATE void setOptionChangeHdl( const Link& );
- void createProgressDialog();
- bool isProgressCanceled() const;
+ VCL_PLUGIN_PUBLIC void createProgressDialog();
+ VCL_PLUGIN_PUBLIC bool isProgressCanceled() const;
SAL_DLLPRIVATE void setMultipage( const MultiPageSetup& );
SAL_DLLPRIVATE const MultiPageSetup& getMultipage() const;
- void setLastPage( sal_Bool i_bLastPage );
+ VCL_PLUGIN_PUBLIC void setLastPage( sal_Bool i_bLastPage );
SAL_DLLPRIVATE void setReversePrint( sal_Bool i_bReverse );
SAL_DLLPRIVATE bool getReversePrint() const;
SAL_DLLPRIVATE void pushPropertiesToPrinter();
- void setJobState( com::sun::star::view::PrintableState );
+ VCL_PLUGIN_PUBLIC void setJobState( com::sun::star::view::PrintableState );
SAL_DLLPRIVATE bool setupPrinter( Window* i_pDlgParent );
SAL_DLLPRIVATE int getPageCountProtected() const;
diff --git a/vcl/inc/vcl/prndlg.hxx b/vcl/inc/vcl/prndlg.hxx
index d21e517d12f7..39f326d6d089 100644
--- a/vcl/inc/vcl/prndlg.hxx
+++ b/vcl/inc/vcl/prndlg.hxx
@@ -73,7 +73,9 @@ namespace vcl
virtual void Resize();
virtual void DataChanged( const DataChangedEvent& );
- void setPreview( const GDIMetaFile&, const Size&, const rtl::OUString&,
+ void setPreview( const GDIMetaFile&, const Size& i_rPaperSize,
+ const rtl::OUString& i_rPaperName,
+ const rtl::OUString& i_rNoPageString,
sal_Int32 i_nDPIX, sal_Int32 i_nDPIY,
bool i_bGreyscale
);
@@ -169,6 +171,7 @@ namespace vcl
NumericField maCopyCountField;
CheckBox maCollateBox;
FixedImage maCollateImage;
+ CheckBox maReverseOrderBox;
Image maCollateImg;
Image maCollateHCImg;
@@ -197,7 +200,6 @@ namespace vcl
FixedLine maOptionsLine;
CheckBox maToFileBox;
CheckBox maCollateSingleJobsBox;
- CheckBox maReverseOrderBox;
boost::shared_ptr<vcl::RowOrColumn> mxOptGroup;
diff --git a/vcl/inc/vcl/region.hxx b/vcl/inc/vcl/region.hxx
index d4a9f5f5c0ab..fce105bfa8f8 100644..100755
--- a/vcl/inc/vcl/region.hxx
+++ b/vcl/inc/vcl/region.hxx
@@ -69,14 +69,19 @@ private:
SAL_DLLPRIVATE inline void ImplPolyPolyRegionToBandRegion();
SAL_DLLPRIVATE const ImplRegion* ImplGetImplRegion() const { return mpImplRegion; }
SAL_DLLPRIVATE ImplRegion* ImplGetImplRegion() { return mpImplRegion; }
- SAL_DLLPRIVATE sal_Bool ImplGetFirstRect( ImplRegionInfo& rImplRegionInfo,
- long& nX, long& nY, long& nWidth, long& nHeight ) const;
- SAL_DLLPRIVATE sal_Bool ImplGetNextRect( ImplRegionInfo& rImplRegionInfo,
- long& nX, long& nY, long& nWidth, long& nHeight ) const;
SAL_DLLPRIVATE void ImplBeginAddRect( );
SAL_DLLPRIVATE sal_Bool ImplAddRect( const Rectangle& rRect );
SAL_DLLPRIVATE void ImplEndAddRect( );
+ SAL_DLLPRIVATE void ImplIntersectWithPolyPolygon( const Region& );
+ SAL_DLLPRIVATE void ImplExcludePolyPolygon( const Region& );
+ SAL_DLLPRIVATE void ImplUnionPolyPolygon( const Region& );
+ SAL_DLLPRIVATE void ImplXOrPolyPolygon( const Region& );
+public: // public within vcl
+ VCL_PLUGIN_PUBLIC bool ImplGetFirstRect( ImplRegionInfo& rImplRegionInfo,
+ long& nX, long& nY, long& nWidth, long& nHeight ) const;
+ VCL_PLUGIN_PUBLIC bool ImplGetNextRect( ImplRegionInfo& rImplRegionInfo,
+ long& nX, long& nY, long& nWidth, long& nHeight ) const;
#ifdef DBG_UTIL
friend const char* ImplDbgTestRegion( const void* pObj );
#endif
diff --git a/vcl/inc/vcl/salbmp.hxx b/vcl/inc/vcl/salbmp.hxx
index e12d5a21152c..b19c2ac33aeb 100644
--- a/vcl/inc/vcl/salbmp.hxx
+++ b/vcl/inc/vcl/salbmp.hxx
@@ -38,7 +38,7 @@ class SalGraphics;
class BitmapPalette;
struct BitmapSystemData;
-class VCL_DLLPUBLIC SalBitmap
+class VCL_PLUGIN_PUBLIC SalBitmap
{
public:
SalBitmap() {}
diff --git a/vcl/inc/vcl/saldatabasic.hxx b/vcl/inc/vcl/saldatabasic.hxx
index a40cd045611c..d3c1a7254513 100644
--- a/vcl/inc/vcl/saldatabasic.hxx
+++ b/vcl/inc/vcl/saldatabasic.hxx
@@ -37,7 +37,7 @@ namespace psp
class PrinterInfoManager;
}
-class VCL_DLLPUBLIC SalData
+class VCL_PLUGIN_PUBLIC SalData
{
public:
SalInstance* m_pInstance; // pointer to instance
diff --git a/vcl/inc/vcl/salframe.hxx b/vcl/inc/vcl/salframe.hxx
index c5e9aba8d272..672f290b9d45 100644
--- a/vcl/inc/vcl/salframe.hxx
+++ b/vcl/inc/vcl/salframe.hxx
@@ -143,7 +143,7 @@ using namespace rtl;
struct SystemParentData;
-class VCL_DLLPUBLIC SalFrame : public vcl::DeletionNotifier
+class VCL_PLUGIN_PUBLIC SalFrame : public vcl::DeletionNotifier
{
// the VCL window corresponding to this frame
Window* m_pWindow;
diff --git a/vcl/inc/vcl/salgdi.hxx b/vcl/inc/vcl/salgdi.hxx
index e6d60e2b329c..1a9b9ccaea59 100644..100755
--- a/vcl/inc/vcl/salgdi.hxx
+++ b/vcl/inc/vcl/salgdi.hxx
@@ -96,7 +96,7 @@ typedef std::vector< sal_Int32 > Int32Vector;
// note: all positions are in pixel and relative to
// the top/left-position of the virtual output area
-class VCL_DLLPUBLIC SalGraphics
+class VCL_PLUGIN_PUBLIC SalGraphics
{
int m_nLayout; // 0: mirroring off, 1: mirror x-axis
@@ -113,8 +113,7 @@ public:
virtual ~SalGraphics();
protected:
- virtual sal_Bool unionClipRegion( long nX, long nY, long nWidth, long nHeight ) = 0;
- virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& ) = 0;
+ virtual bool setClipRegion( const Region& ) = 0;
// draw --> LineColor and FillColor and RasterOp and ClipRegion
virtual void drawPixel( long nX, long nY ) = 0;
virtual void drawPixel( long nX, long nY, SalColor nSalColor ) = 0;
@@ -204,11 +203,6 @@ public:
// set the clip region to empty
virtual void ResetClipRegion() = 0;
- // begin setting the clip region, add rectangles to the
- // region with the UnionClipRegion call
- virtual void BeginSetClipRegion( sal_uLong nCount ) = 0;
- // all rectangles were added and the clip region should be set now
- virtual void EndSetClipRegion() = 0;
// set the line color to transparent (= don't draw lines)
virtual void SetLineColor() = 0;
@@ -355,10 +349,9 @@ public:
basegfx::B2DPolygon mirror( const basegfx::B2DPolygon& i_rPoly, const OutputDevice *pOutDev, bool bBack = false ) const;
basegfx::B2DPolyPolygon mirror( const basegfx::B2DPolyPolygon& i_rPoly, const OutputDevice *pOutDev, bool bBack = false ) const;
- // non virtual methods; these do eventual coordinate mirroring and
+ // non virtual methods; these do possible coordinate mirroring and
// then delegate to protected virtual methods
- sal_Bool UnionClipRegion( long nX, long nY, long nWidth, long nHeight, const OutputDevice *pOutDev );
- sal_Bool UnionClipRegion( const ::basegfx::B2DPolyPolygon&, const OutputDevice* );
+ bool SetClipRegion( const Region&, const OutputDevice *pOutDev );
// draw --> LineColor and FillColor and RasterOp and ClipRegion
void DrawPixel( long nX, long nY, const OutputDevice *pOutDev );
diff --git a/vcl/inc/vcl/salimestatus.hxx b/vcl/inc/vcl/salimestatus.hxx
index 779a75c9afaa..20184a059d9a 100644
--- a/vcl/inc/vcl/salimestatus.hxx
+++ b/vcl/inc/vcl/salimestatus.hxx
@@ -30,7 +30,7 @@
#include <vcl/dllapi.h>
-class VCL_DLLPUBLIC SalI18NImeStatus
+class VCL_PLUGIN_PUBLIC SalI18NImeStatus
{
public:
SalI18NImeStatus() {}
diff --git a/vcl/inc/vcl/salinst.hxx b/vcl/inc/vcl/salinst.hxx
index e1ed7288651a..51f1f5b3b4e0 100644
--- a/vcl/inc/vcl/salinst.hxx
+++ b/vcl/inc/vcl/salinst.hxx
@@ -31,10 +31,12 @@
#include "com/sun/star/uno/Reference.hxx"
#include "vcl/sv.h"
+#include "vcl/displayconnectiondispatch.hxx"
#include "vcl/dllapi.h"
#include "tools/string.hxx"
+#include "rtl/ref.hxx"
#include "rtl/string.hxx"
#include <list>
@@ -68,23 +70,13 @@ namespace vos { class IMutex; }
// - SalInstance -
// ---------------
-class VCL_DLLPUBLIC SalInstance
+class VCL_PLUGIN_PUBLIC SalInstance
{
-public:
- typedef bool(*Callback)(void*,void*,int);
private:
- void* m_pEventInst;
- void* m_pErrorInst;
- Callback m_pEventCallback;
- Callback m_pErrorCallback;
+ rtl::Reference< vcl::DisplayConnectionDispatch > m_pEventInst;
public:
- SalInstance() :
- m_pEventInst( NULL ),
- m_pErrorInst( NULL ),
- m_pEventCallback( NULL ),
- m_pErrorCallback( NULL )
- {}
+ SalInstance() {}
virtual ~SalInstance();
// Frame
@@ -154,22 +146,12 @@ public:
// methods for XDisplayConnection
- // the parameters for the callbacks are:
- // void* pInst: pInstance form the SetCallback call
- // void* pEvent: address of the system specific event structure
- // int nBytes: length of the system specific event structure
- void SetEventCallback( void* pInstance, Callback pCallback )
- { m_pEventInst = pInstance; m_pEventCallback = pCallback; }
- Callback GetEventCallback() const
- { return m_pEventCallback; }
+ void SetEventCallback( rtl::Reference< vcl::DisplayConnectionDispatch > const & pInstance )
+ { m_pEventInst = pInstance; }
bool CallEventCallback( void* pEvent, int nBytes )
- { return m_pEventCallback ? m_pEventCallback( m_pEventInst, pEvent, nBytes ) : false; }
- void SetErrorEventCallback( void* pInstance, Callback pCallback )
- { m_pErrorInst = pInstance; m_pErrorCallback = pCallback; }
- Callback GetErrorEventCallback() const
- { return m_pErrorCallback; }
+ { return m_pEventInst.is() && m_pEventInst->dispatchEvent( pEvent, nBytes ); }
bool CallErrorCallback( void* pEvent, int nBytes )
- { return m_pErrorCallback ? m_pErrorCallback( m_pErrorInst, pEvent, nBytes ) : false; }
+ { return m_pEventInst.is() && m_pEventInst->dispatchErrorEvent( pEvent, nBytes ); }
enum ConnectionIdentifierType { AsciiCString, Blob };
virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) = 0;
@@ -197,7 +179,7 @@ void DestroySalInstance( SalInstance* pInst );
void SalAbort( const XubString& rErrorText );
-VCL_DLLPUBLIC const ::rtl::OUString& SalGetDesktopEnvironment();
+VCL_PLUGIN_PUBLIC const ::rtl::OUString& SalGetDesktopEnvironment();
// -----------
// - SalData -
diff --git a/vcl/inc/vcl/sallayout.hxx b/vcl/inc/vcl/sallayout.hxx
index e23090c42392..bb5c6e829a70 100755
--- a/vcl/inc/vcl/sallayout.hxx
+++ b/vcl/inc/vcl/sallayout.hxx
@@ -72,7 +72,7 @@ class ImplFontData;
// -----------------
// used for managing runs e.g. for BiDi, glyph and script fallback
-class VCL_DLLPUBLIC ImplLayoutRuns
+class VCL_PLUGIN_PUBLIC ImplLayoutRuns
{
private:
int mnRunIndex;
@@ -148,7 +148,7 @@ sal_UCS4 GetVerticalChar( sal_UCS4 );
// #i80090# GetMirroredChar also needed outside vcl, moved to svapp.hxx
// VCL_DLLPUBLIC sal_UCS4 GetMirroredChar( sal_UCS4 );
sal_UCS4 GetLocalizedChar( sal_UCS4, LanguageType );
-VCL_DLLPUBLIC const char* GetAutofallback( sal_UCS4 ) ;
+VCL_PLUGIN_PUBLIC const char* GetAutofallback( sal_UCS4 ) ;
// -------------
// - SalLayout -
@@ -179,7 +179,7 @@ typedef sal_uInt32 sal_GlyphId;
// all positions/widths are in font units
// one exception: drawposition is in pixel units
-class VCL_DLLPUBLIC SalLayout
+class VCL_PLUGIN_PUBLIC SalLayout
{
public:
// used by upper layers
@@ -258,7 +258,7 @@ protected:
// - MultiSalLayout -
// ------------------
-class VCL_DLLPUBLIC MultiSalLayout : public SalLayout
+class VCL_PLUGIN_PUBLIC MultiSalLayout : public SalLayout
{
public:
virtual void DrawText( SalGraphics& ) const;
@@ -271,7 +271,7 @@ public:
virtual bool GetBoundRect( SalGraphics&, Rectangle& ) const;
// used only by OutputDevice::ImplLayout, TODO: make friend
- MultiSalLayout( SalLayout& rBaseLayout,
+ explicit MultiSalLayout( SalLayout& rBaseLayout,
const ImplFontData* pBaseFont = NULL );
virtual bool AddFallback( SalLayout& rFallbackLayout,
ImplLayoutRuns&, const ImplFontData* pFallbackFont );
@@ -341,7 +341,7 @@ typedef std::vector<GlyphItem> GlyphVector;
// ---------------
-class VCL_DLLPUBLIC GenericSalLayout : public SalLayout
+class VCL_PLUGIN_PUBLIC GenericSalLayout : public SalLayout
{
public:
// used by layout engines
diff --git a/vcl/inc/vcl/salmenu.hxx b/vcl/inc/vcl/salmenu.hxx
index ab9f44922aa8..030952388dfb 100644
--- a/vcl/inc/vcl/salmenu.hxx
+++ b/vcl/inc/vcl/salmenu.hxx
@@ -60,14 +60,14 @@ struct SalMenuButtonItem
: mnId( i_nId ), maImage( rImg ), maToolTipText( i_rTTText ) {}
};
-class VCL_DLLPUBLIC SalMenuItem
+class VCL_PLUGIN_PUBLIC SalMenuItem
{
public:
SalMenuItem() {}
virtual ~SalMenuItem();
};
-class VCL_DLLPUBLIC SalMenu
+class VCL_PLUGIN_PUBLIC SalMenu
{
public:
SalMenu() {}
diff --git a/vcl/inc/vcl/salnativewidgets.hxx b/vcl/inc/vcl/salnativewidgets.hxx
index fe062429121a..f78af4321398 100755
--- a/vcl/inc/vcl/salnativewidgets.hxx
+++ b/vcl/inc/vcl/salnativewidgets.hxx
@@ -307,7 +307,7 @@ class VCL_DLLPUBLIC ImplControlValue
*
* Value container for scrollbars.
*/
- class VCL_DLLPUBLIC ScrollbarValue : public ImplControlValue
+class VCL_DLLPUBLIC ScrollbarValue : public ImplControlValue
{
public:
long mnMin;
diff --git a/vcl/inc/vcl/salobj.hxx b/vcl/inc/vcl/salobj.hxx
index 649058289699..157d817d7d0a 100644
--- a/vcl/inc/vcl/salobj.hxx
+++ b/vcl/inc/vcl/salobj.hxx
@@ -47,7 +47,7 @@ struct SystemEnvData;
// - SalObject -
// -------------
-class VCL_DLLPUBLIC SalObject
+class VCL_PLUGIN_PUBLIC SalObject
{
void* m_pInst;
SALOBJECTPROC m_pCallback;
diff --git a/vcl/inc/vcl/salprn.hxx b/vcl/inc/vcl/salprn.hxx
index ae21a8a5b438..572b766ea909 100644
--- a/vcl/inc/vcl/salprn.hxx
+++ b/vcl/inc/vcl/salprn.hxx
@@ -44,7 +44,7 @@ namespace vcl { class PrinterController; }
// - SalPrinterQueueInfo -
// -----------------------
-struct VCL_DLLPUBLIC SalPrinterQueueInfo
+struct VCL_PLUGIN_PUBLIC SalPrinterQueueInfo
{
XubString maPrinterName;
XubString maDriver;
@@ -62,7 +62,7 @@ struct VCL_DLLPUBLIC SalPrinterQueueInfo
// - SalInfoPrinter -
// ------------------
-class VCL_DLLPUBLIC SalInfoPrinter
+class VCL_PLUGIN_PUBLIC SalInfoPrinter
{
public:
std::vector< PaperInfo > m_aPaperFormats; // all printer supported formats
@@ -104,7 +104,7 @@ public:
// - SalPrinter -
// --------------
-class VCL_DLLPUBLIC SalPrinter
+class VCL_PLUGIN_PUBLIC SalPrinter
{
public: // public for Sal Implementation
SalPrinter() {}
diff --git a/vcl/inc/vcl/salsession.hxx b/vcl/inc/vcl/salsession.hxx
index 2da1ae551074..c11054a79eef 100644
--- a/vcl/inc/vcl/salsession.hxx
+++ b/vcl/inc/vcl/salsession.hxx
@@ -85,7 +85,7 @@ struct SalSessionQuitEvent : public SalSessionEvent
typedef void(*SessionProc)( SalSessionEvent *pEvent);
-class VCL_DLLPUBLIC SalSession
+class VCL_PLUGIN_PUBLIC SalSession
{
SessionProc m_aProc;
public:
diff --git a/vcl/inc/vcl/salsys.hxx b/vcl/inc/vcl/salsys.hxx
index 310b0a27e30f..da16d8d5b656 100644
--- a/vcl/inc/vcl/salsys.hxx
+++ b/vcl/inc/vcl/salsys.hxx
@@ -58,7 +58,7 @@ const int SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO = 7;
// - SalSystem -
// -------------
-class VCL_DLLPUBLIC SalSystem
+class VCL_PLUGIN_PUBLIC SalSystem
{
public:
SalSystem() {}
diff --git a/vcl/inc/vcl/saltimer.hxx b/vcl/inc/vcl/saltimer.hxx
index 13b85d609e9e..9e69b83e6042 100644
--- a/vcl/inc/vcl/saltimer.hxx
+++ b/vcl/inc/vcl/saltimer.hxx
@@ -42,7 +42,7 @@
* this needed to be virtualized for the sal plugin migration
*/
-class VCL_DLLPUBLIC SalTimer
+class VCL_PLUGIN_PUBLIC SalTimer
{
SALTIMERPROC m_pProc;
public:
diff --git a/vcl/inc/vcl/salvd.hxx b/vcl/inc/vcl/salvd.hxx
index 6aa3222c5d96..6bf4b820a176 100644
--- a/vcl/inc/vcl/salvd.hxx
+++ b/vcl/inc/vcl/salvd.hxx
@@ -37,7 +37,7 @@ class SalGraphics;
// - SalVirtualDevice -
// --------------------
-class VCL_DLLPUBLIC SalVirtualDevice
+class VCL_PLUGIN_PUBLIC SalVirtualDevice
{
public: // public for Sal Implementation
SalVirtualDevice() {}
diff --git a/vcl/inc/vcl/svdata.hxx b/vcl/inc/vcl/svdata.hxx
index 24d85c873572..9c91915823b2 100644
--- a/vcl/inc/vcl/svdata.hxx
+++ b/vcl/inc/vcl/svdata.hxx
@@ -28,6 +28,7 @@
#ifndef _SV_SVDATA_HXX
#define _SV_SVDATA_HXX
+#include "rtl/ref.hxx"
#include "vos/thread.hxx"
#include "tools/string.hxx"
#include "tools/gen.hxx"
@@ -42,6 +43,8 @@
#include "com/sun/star/uno/Reference.hxx"
#include "unotools/options.hxx"
+#include <hash_map>
+
namespace com {
namespace sun {
namespace star {
@@ -51,9 +54,6 @@ namespace lang {
namespace frame {
class XSessionManagerClient;
}
-namespace awt {
- class XDisplayConnection;
-}
}}}
struct ImplTimerData;
@@ -361,21 +361,21 @@ struct ImplSVData
sal_Bool mbIsTestTool;
vos::OThread::TThreadIdentifier mnMainThreadId;
- ::com::sun::star::uno::Reference<
- ::com::sun::star::awt::XDisplayConnection > mxDisplayConnection;
+ rtl::Reference< vcl::DisplayConnection > mxDisplayConnection;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxAccessBridge;
com::sun::star::uno::Reference< com::sun::star::frame::XSessionManagerClient > xSMClient;
::vcl::SettingsConfigItem* mpSettingsConfigItem;
std::list< vcl::DeleteOnDeinitBase* >* mpDeinitDeleteList;
+ std::hash_map< int, rtl::OUString >* mpPaperNames;
};
void ImplInitSVData();
void ImplDeInitSVData();
void ImplDestroySVData();
Window* ImplGetDefaultWindow();
-VCL_DLLPUBLIC ResMgr* ImplGetResMgr();
-VCL_DLLPUBLIC ResId VclResId( sal_Int32 nId ); // throws std::bad_alloc if no res mgr
+VCL_PLUGIN_PUBLIC ResMgr* ImplGetResMgr();
+VCL_PLUGIN_PUBLIC ResId VclResId( sal_Int32 nId ); // throws std::bad_alloc if no res mgr
DockingManager* ImplGetDockingManager();
void ImplWindowAutoMnemonic( Window* pWindow );
@@ -391,8 +391,8 @@ void ImplFreeEventHookData();
long ImplCallPreNotify( NotifyEvent& rEvt );
long ImplCallEvent( NotifyEvent& rEvt );
-extern VCL_DLLPUBLIC ImplSVData* pImplSVData;
-inline VCL_DLLPUBLIC ImplSVData* ImplGetSVData() { return pImplSVData; }
+extern VCL_PLUGIN_PUBLIC ImplSVData* pImplSVData;
+inline VCL_PLUGIN_PUBLIC ImplSVData* ImplGetSVData() { return pImplSVData; }
inline ImplSVData* ImplGetAppSVData() { return ImplGetSVData(); }
bool ImplInitAccessBridge( sal_Bool bAllowCancel, sal_Bool &rCancelled );
diff --git a/vcl/inc/vcl/svids.hrc b/vcl/inc/vcl/svids.hrc
index 432a30c3a748..61622bcabade 100644
--- a/vcl/inc/vcl/svids.hrc
+++ b/vcl/inc/vcl/svids.hrc
@@ -58,6 +58,8 @@
#define SV_DISCLOSURE_PLUS_HC 1062
#define SV_DISCLOSURE_MINUS_HC 1063
+#define RID_STR_PAPERNAMES 1070
+
#define SV_RESID_MENU_EDIT 2000
#define SV_MENU_EDIT_UNDO 1
#define SV_MENU_EDIT_CUT 2
@@ -147,12 +149,12 @@
#define SV_PRINT_LOCATION_TXT 21
#define SV_PRINT_COMMENT_TXT 22
#define SV_PRINT_DETAILS_BTN 23
+#define SV_PRINT_OPT_REVERSE 24
#define SV_PRINT_TAB_OPT 3
#define SV_PRINT_OPT_PRINT_FL 1
#define SV_PRINT_OPT_TOFILE 2
#define SV_PRINT_OPT_SINGLEJOBS 3
-#define SV_PRINT_OPT_REVERSE 4
#define SV_DLG_PRINT_PROGRESS 2049
#define SV_PRINT_PROGRESS_CANCEL 1
diff --git a/vcl/inc/vcl/sysdata.hxx b/vcl/inc/vcl/sysdata.hxx
index 1146f1b3b842..b9feeaf3a2aa 100644
--- a/vcl/inc/vcl/sysdata.hxx
+++ b/vcl/inc/vcl/sysdata.hxx
@@ -150,6 +150,7 @@ struct SystemGlyphData
unsigned long index;
double x;
double y;
+ int fallbacklevel;
};
@@ -178,12 +179,14 @@ struct SystemFontData
// - SystemTextLayoutData -
// --------------------
+typedef std::vector<SystemGlyphData> SystemGlyphDataVector;
+
struct SystemTextLayoutData
{
unsigned long nSize; // size in bytes of this structure
std::vector<SystemGlyphData> rGlyphData; // glyph data
int orientation; // Text orientation
- SystemFontData aSysFontData; // Font data for the text layout
};
#endif // _SV_SYSDATA_HXX
+
diff --git a/vcl/inc/vcl/syswin.hxx b/vcl/inc/vcl/syswin.hxx
index 6f8273731f36..696a07ca3d42 100644
--- a/vcl/inc/vcl/syswin.hxx
+++ b/vcl/inc/vcl/syswin.hxx
@@ -85,7 +85,7 @@ class TaskPaneList;
#define WINDOWSTATE_STATE_MAXIMIZED_HORZ ((sal_uLong)0x00000010)
#define WINDOWSTATE_STATE_MAXIMIZED_VERT ((sal_uLong)0x00000020)
-class VCL_DLLPUBLIC WindowStateData
+class VCL_PLUGIN_PUBLIC WindowStateData
{
private:
sal_uInt32 mnValidMask;
diff --git a/vcl/inc/vcl/window.h b/vcl/inc/vcl/window.h
index 4a9afddea8b0..4011584890cf 100644
--- a/vcl/inc/vcl/window.h
+++ b/vcl/inc/vcl/window.h
@@ -210,6 +210,24 @@ struct ImplFrameData
sal_Bool mbInternalDragGestureRecognizer;
};
+// -----------------------
+// - ImplAccessibleInfos -
+// -----------------------
+
+struct ImplAccessibleInfos
+{
+ sal_uInt16 nAccessibleRole;
+ String* pAccessibleName;
+ String* pAccessibleDescription;
+ Window* pLabeledByWindow;
+ Window* pLabelForWindow;
+ Window* pMemberOfWindow;
+
+ ImplAccessibleInfos();
+ ~ImplAccessibleInfos();
+};
+
+
// ---------------
// - WindowImpl -
// ---------------
diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx
index 364fef4ef015..f367be85051d 100755..100644
--- a/vcl/inc/vcl/window.hxx
+++ b/vcl/inc/vcl/window.hxx
@@ -1053,9 +1053,20 @@ public:
void SetAccessibleDescription( const String& rDescr );
String GetAccessibleDescription() const;
+ void SetAccessibleRelationLabeledBy( Window* pLabeledBy );
+ Window* GetAccessibleRelationLabeledBy() const;
+
+ void SetAccessibleRelationLabelFor( Window* pLabelFor );
+ Window* GetAccessibleRelationLabelFor() const;
+
+ void SetAccessibleRelationMemberOf( Window* pMemberOf );
+ Window* GetAccessibleRelationMemberOf() const;
+
+
// to avoid sending accessibility events in cases like closing dialogs
// by default checks complete parent path
sal_Bool IsAccessibilityEventsSuppressed( sal_Bool bTraverseParentPath = sal_True );
+ void SetAccessibilityEventsSuppressed(sal_Bool bSuppressed);
/// request XCanvas render interface for this window
::com::sun::star::uno::Reference<
@@ -1080,8 +1091,7 @@ public:
sal_Bool IsCreatedWithToolkit() const;
void SetCreatedWithToolkit( sal_Bool b );
- Window* GetLabelFor() const;
- Window* GetLabeledBy() const;
+ // Deprecated - can use SetAccessibleRelationLabelFor/By nowadys
virtual Window* GetParentLabelFor( const Window* pLabel ) const;
virtual Window* GetParentLabeledBy( const Window* pLabeled ) const;
KeyEvent GetActivationKey() const;
diff --git a/vcl/inc/vcl/xconnection.hxx b/vcl/inc/vcl/xconnection.hxx
index aa9d37430ea6..d43e02941cb3 100644
--- a/vcl/inc/vcl/xconnection.hxx
+++ b/vcl/inc/vcl/xconnection.hxx
@@ -28,11 +28,12 @@
#ifndef _VCL_XCONNECTION_HXX
#define _VCL_XCONNECTION_HXX
-#include <com/sun/star/awt/XDisplayConnection.hpp>
-#include <cppuhelper/implbase1.hxx>
#include <osl/mutex.hxx>
+#include <rtl/ref.hxx>
#include <com/sun/star/uno/Reference.hxx>
+#include "vcl/displayconnectiondispatch.hxx"
+
#ifndef _STLP_LIST
#include <list>
#endif
@@ -40,7 +41,7 @@
namespace vcl {
class DisplayConnection :
- public ::cppu::WeakImplHelper1< ::com::sun::star::awt::XDisplayConnection >
+ public DisplayConnectionDispatch
{
::osl::Mutex m_aMutex;
::std::list< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XEventHandler > >
@@ -52,9 +53,11 @@ namespace vcl {
DisplayConnection();
virtual ~DisplayConnection();
- static bool dispatchEvent( void* pThis, void* pData, int nBytes );
- static bool dispatchErrorEvent( void* pThis, void* pData, int nBytes );
- void dispatchDowningEvent();
+ void start();
+ void terminate();
+
+ virtual bool dispatchEvent( void* pData, int nBytes );
+ virtual bool dispatchErrorEvent( void* pData, int nBytes );
// XDisplayConnection
virtual void SAL_CALL addEventHandler( const ::com::sun::star::uno::Any& window, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XEventHandler >& handler, sal_Int32 eventMask ) throw();
diff --git a/vcl/os2/inc/salgdi.h b/vcl/os2/inc/salgdi.h
index 94b2b98b4183..1c9b66d89a0b 100644
--- a/vcl/os2/inc/salgdi.h
+++ b/vcl/os2/inc/salgdi.h
@@ -151,8 +151,6 @@ public:
virtual ~Os2SalGraphics();
protected:
- virtual BOOL unionClipRegion( long nX, long nY, long nWidth, long nHeight );
- virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& );
// draw --> LineColor and FillColor and RasterOp and ClipRegion
virtual void drawPixel( long nX, long nY );
virtual void drawPixel( long nX, long nY, SalColor nSalColor );
@@ -226,11 +224,7 @@ public:
// set the clip region to empty
virtual void ResetClipRegion();
- // begin setting the clip region, add rectangles to the
- // region with the UnionClipRegion call
- virtual void BeginSetClipRegion( ULONG nCount );
- // all rectangles were added and the clip region should be set now
- virtual void EndSetClipRegion();
+ virtual bool setClipRegion( const Region& );
// set the line color to transparent (= don't draw lines)
virtual void SetLineColor();
diff --git a/vcl/os2/source/gdi/salgdi.cxx b/vcl/os2/source/gdi/salgdi.cxx
index dff1557170fb..069abb1026e3 100644
--- a/vcl/os2/source/gdi/salgdi.cxx
+++ b/vcl/os2/source/gdi/salgdi.cxx
@@ -38,6 +38,7 @@
#ifndef _RTL_STRINGBUF_HXX
#include <rtl/strbuf.hxx>
#endif
+#include "vcl/region.h"
#ifndef __H_FT2LIB
#include <wingdi.h>
@@ -217,38 +218,29 @@ void Os2SalGraphics::ResetClipRegion()
// -----------------------------------------------------------------------
-void Os2SalGraphics::BeginSetClipRegion( ULONG nCount )
+bool Os2SalGraphics::setClipRegion( const Region& i_rClip )
{
+ ULONG nCount = i_rClip.GetRectCount();
+
mpClipRectlAry = new RECTL[ nCount ];
mnClipElementCount = 0;
-}
-
-// -----------------------------------------------------------------------
-BOOL Os2SalGraphics::unionClipRegion( long nX, long nY, long nWidth, long nHeight )
-{
- RECTL* pClipRect = &mpClipRectlAry[ mnClipElementCount ];
- pClipRect->xLeft = nX;
- pClipRect->yTop = mnHeight - nY;
- pClipRect->xRight = nX + nWidth;
- pClipRect->yBottom = mnHeight - (nY + nHeight);
- mnClipElementCount++;
-
- return TRUE;
-}
-
-// -----------------------------------------------------------------------
-
-bool Os2SalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& )
-{
- // TODO: implement and advertise OutDevSupport_B2DClip support
- return false;
-}
-
-// -----------------------------------------------------------------------
-
-void Os2SalGraphics::EndSetClipRegion()
-{
+ ImplRegionInfo aInfo;
+ long nX, nY, nW, nH;
+ bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH );
+ while( bRegionRect )
+ {
+ if ( nW && nH )
+ {
+ RECTL* pClipRect = &mpClipRectlAry[ mnClipElementCount ];
+ pClipRect->xLeft = nX;
+ pClipRect->yTop = mnHeight - nY;
+ pClipRect->xRight = nX + nW;
+ pClipRect->yBottom = mnHeight - (nY + nH);
+ mnClipElementCount++;
+ }
+ bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH );
+ }
#ifdef SAL_PRINTER_CLIPPATH
if ( mbPrinter )
{
@@ -287,6 +279,8 @@ void Os2SalGraphics::EndSetClipRegion()
}
delete [] mpClipRectlAry;
+
+ return true;
}
// -----------------------------------------------------------------------
diff --git a/vcl/prj/build.lst b/vcl/prj/build.lst
index af15ad73e19d..d8426a092093 100644
--- a/vcl/prj/build.lst
+++ b/vcl/prj/build.lst
@@ -1,4 +1,4 @@
-vc vcl : l10n apple_remote BOOST:boost rsc sot ucbhelper unotools ICU:icu GRAPHITE:graphite i18npool i18nutil unoil ridljar X11_EXTENSIONS:x11_extensions offuh basegfx basebmp tools l10ntools icc SO:print_header cpputools shell svl LIBXSLT:libxslt NULL
+vc vcl : L10N:l10n apple_remote BOOST:boost rsc sot ucbhelper unotools ICU:icu GRAPHITE:graphite i18npool i18nutil unoil ridljar X11_EXTENSIONS:x11_extensions offuh basegfx basebmp tools l10ntools icc SO:print_header cpputools shell svl LIBXSLT:libxslt NULL
vc vcl usr1 - all vc_mkout NULL
vc vcl\inc nmake - all vc_inc NULL
vc vcl\source\glyphs nmake - all vc_glyphs vc_inc NULL
diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx
index a50c8aeec149..6649f19e0030 100644
--- a/vcl/source/app/dbggui.cxx
+++ b/vcl/source/app/dbggui.cxx
@@ -346,8 +346,8 @@ static const sal_Char* pDbgHelpText[] =
"Attempt to activate the debugger and produce the message there, in order to "
"always obtain the corresponding stack trace in the debugger.\n",
"\n",
-"CoreDump\n",
-"Causes a crash\n",
+"Abort\n",
+"Aborts the application\n",
"\n",
"\n",
"Reroute osl messages - Checkbox\n",
@@ -1083,7 +1083,7 @@ DbgDialog::DbgDialog() :
maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "MessageBox" ) ) );
maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "TestTool" ) ) );
maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Debugger" ) ) );
- maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "CoreDump" ) ) );
+ maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Abort" ) ) );
ImplAppendUserDefinedChannels( maTraceBox );
ImplSelectChannel( maTraceBox, pData->nTraceOut, 0 );
maTraceBox.Show();
@@ -1106,7 +1106,7 @@ DbgDialog::DbgDialog() :
maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "MessageBox" ) ) );
maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "TestTool" ) ) );
maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Debugger" ) ) );
- maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "CoreDump" ) ) );
+ maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Abort" ) ) );
ImplAppendUserDefinedChannels( maWarningBox );
ImplSelectChannel( maWarningBox, pData->nWarningOut, 0 );
maWarningBox.Show();
@@ -1135,7 +1135,7 @@ DbgDialog::DbgDialog() :
maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "MessageBox" ) ) );
maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "TestTool" ) ) );
maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Debugger" ) ) );
- maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "CoreDump" ) ) );
+ maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Abort" ) ) );
ImplAppendUserDefinedChannels( maErrorBox );
ImplSelectChannel( maErrorBox, pData->nErrorOut, mnErrorOff );
maErrorBox.Show();
@@ -1962,6 +1962,14 @@ void DbgPrintWindow( const char* pLine )
bIn = sal_False;
}
+// -----------------------------------------------------------------------
+
+void DbgAbort( char const * i_message )
+{
+ ::rtl::OUString const message( i_message, strlen( i_message ), osl_getThreadTextEncoding() );
+ Application::Abort( message );
+}
+
// =======================================================================
void ImplDbgTestSolarMutex()
@@ -1977,6 +1985,7 @@ void DbgGUIInit()
DbgSetPrintMsgBox( DbgPrintMsgBox );
DbgSetPrintWindow( DbgPrintWindow );
DbgSetTestSolarMutex( ImplDbgTestSolarMutex );
+ DbgSetAbort( DbgAbort );
}
// -----------------------------------------------------------------------
@@ -1986,6 +1995,7 @@ void DbgGUIDeInit()
DbgSetPrintMsgBox( NULL );
DbgSetPrintWindow( NULL );
DbgSetTestSolarMutex( NULL );
+ DbgSetAbort( NULL );
DbgWindow* pDbgWindow = ImplGetSVData()->maWinData.mpDbgWin;
if ( pDbgWindow )
diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx
index 275280eff692..13fb2d3c0893 100644
--- a/vcl/source/app/help.cxx
+++ b/vcl/source/app/help.cxx
@@ -36,6 +36,7 @@
#include "vcl/help.hxx"
#include "vcl/helpwin.hxx"
#include "tools/debug.hxx"
+#include "tools/diagnose_ex.h"
#include "tools/time.hxx"
// =======================================================================
@@ -274,18 +275,32 @@ sal_Bool Help::ShowQuickHelp( Window* pParent,
// -----------------------------------------------------------------------
-sal_uIntPtr Help::ShowTip( Window* pParent, const Rectangle& rRect,
+sal_uIntPtr Help::ShowTip( Window* pParent, const Rectangle& rScreenRect,
const XubString& rText, sal_uInt16 nStyle )
{
- sal_uInt16 nHelpWinStyle = HELPWINSTYLE_QUICK;
+ sal_uInt16 nHelpWinStyle = ( ( nStyle & QUICKHELP_TIP_STYLE_BALLOON ) != 0 ) ? HELPWINSTYLE_BALLOON : HELPWINSTYLE_QUICK;
HelpTextWindow* pHelpWin = new HelpTextWindow( pParent, rText, nHelpWinStyle, nStyle );
+ sal_uIntPtr nId = reinterpret_cast< sal_uIntPtr >( pHelpWin );
+ UpdateTip( nId, pParent, rScreenRect, rText );
+
+ pHelpWin->ShowHelp( HELPDELAY_NONE );
+ return nId;
+}
+
+// -----------------------------------------------------------------------
+
+void Help::UpdateTip( sal_uIntPtr nId, Window* pParent, const Rectangle& rScreenRect, const XubString& rText )
+{
+ HelpTextWindow* pHelpWin = reinterpret_cast< HelpTextWindow* >( nId );
+ ENSURE_OR_RETURN_VOID( pHelpWin != NULL, "Help::UpdateTip: invalid ID!" );
+
Size aSz = pHelpWin->CalcOutSize();
pHelpWin->SetOutputSizePixel( aSz );
- ImplSetHelpWindowPos( pHelpWin, nHelpWinStyle, nStyle,
- pParent->OutputToScreenPixel( pParent->GetPointerPosPixel() ), &rRect );
- pHelpWin->ShowHelp( HELPDELAY_NONE );
- return (sal_uIntPtr)pHelpWin;
+ ImplSetHelpWindowPos( pHelpWin, pHelpWin->GetWinStyle(), pHelpWin->GetStyle(),
+ pParent->OutputToScreenPixel( pParent->GetPointerPosPixel() ), &rScreenRect );
+
+ pHelpWin->SetHelpText( rText );
}
// -----------------------------------------------------------------------
@@ -590,10 +605,14 @@ void ImplShowHelpWindow( Window* pParent, sal_uInt16 nHelpWinStyle, sal_uInt16 n
{
DBG_ASSERT( pHelpWin != pParent, "HelpInHelp ?!" );
- if ( (( pHelpWin->GetHelpText() != rHelpText ) ||
- ( pHelpWin->GetWinStyle() != nHelpWinStyle ) ||
- ( pHelpArea && ( pHelpWin->GetHelpArea() != *pHelpArea ) ) )
- && pSVData->maHelpData.mbRequestingHelp )
+ if ( ( ( pHelpWin->GetHelpText() != rHelpText )
+ || ( pHelpWin->GetWinStyle() != nHelpWinStyle )
+ || ( pHelpArea
+ && ( pHelpWin->GetHelpArea() != *pHelpArea )
+ )
+ )
+ && pSVData->maHelpData.mbRequestingHelp
+ )
{
// remove help window if no HelpText or other HelpText or
// other help mode. but keep it if we are scrolling, ie not requesting help
@@ -605,8 +624,8 @@ void ImplShowHelpWindow( Window* pParent, sal_uInt16 nHelpWinStyle, sal_uInt16 n
}
else
{
- bool bTextChanged = rHelpText != pHelpWin->GetHelpText();
- if( bTextChanged )
+ bool const bTextChanged = rHelpText != pHelpWin->GetHelpText();
+ if ( bTextChanged || ( ( nStyle & QUICKHELP_FORCE_REPOSITION ) != 0 ) )
{
Window * pWindow = pHelpWin->GetParent()->ImplGetFrameWindow();
Rectangle aInvRect( pHelpWin->GetWindowExtentsRelative( pWindow ) );
@@ -625,7 +644,9 @@ void ImplShowHelpWindow( Window* pParent, sal_uInt16 nHelpWinStyle, sal_uInt16 n
if ( !pHelpWin && rHelpText.Len() )
{
sal_uLong nCurTime = Time::GetSystemTicks();
- if( (nCurTime - pSVData->maHelpData.mnLastHelpHideTime) < pParent->GetSettings().GetHelpSettings().GetTipDelay() )
+ if ( ( ( nCurTime - pSVData->maHelpData.mnLastHelpHideTime ) < pParent->GetSettings().GetHelpSettings().GetTipDelay() )
+ || ( ( nStyle & QUICKHELP_NO_DELAY ) != 0 )
+ )
nDelayMode = HELPDELAY_NONE;
DBG_ASSERT( !pHelpWin, "Noch ein HelpWin ?!" );
diff --git a/vcl/source/app/session.cxx b/vcl/source/app/session.cxx
index 066d58ce4eec..c8d55d109134 100644
--- a/vcl/source/app/session.cxx
+++ b/vcl/source/app/session.cxx
@@ -39,6 +39,12 @@
#include <list>
+namespace {
+
+namespace css = com::sun::star;
+
+}
+
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::frame;
@@ -52,12 +58,12 @@ class VCLSession : public cppu::WeakComponentImplHelper1 < XSessionManagerClient
{
struct Listener
{
- Reference< XSessionManagerListener > m_xListener;
+ css::uno::Reference< XSessionManagerListener > m_xListener;
bool m_bInteractionRequested;
bool m_bInteractionDone;
bool m_bSaveDone;
- Listener( const Reference< XSessionManagerListener >& xListener )
+ Listener( const css::uno::Reference< XSessionManagerListener >& xListener )
: m_xListener( xListener ),
m_bInteractionRequested( false ),
m_bInteractionDone( false ),
@@ -84,11 +90,11 @@ public:
VCLSession();
virtual ~VCLSession();
- virtual void SAL_CALL addSessionManagerListener( const Reference< XSessionManagerListener >& xListener ) throw( RuntimeException );
- virtual void SAL_CALL removeSessionManagerListener( const Reference< XSessionManagerListener>& xListener ) throw( RuntimeException );
- virtual void SAL_CALL queryInteraction( const Reference< XSessionManagerListener >& xListener ) throw( RuntimeException );
- virtual void SAL_CALL interactionDone( const Reference< XSessionManagerListener >& xListener ) throw( RuntimeException );
- virtual void SAL_CALL saveDone( const Reference< XSessionManagerListener >& xListener ) throw( RuntimeException );
+ virtual void SAL_CALL addSessionManagerListener( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException );
+ virtual void SAL_CALL removeSessionManagerListener( const css::uno::Reference< XSessionManagerListener>& xListener ) throw( RuntimeException );
+ virtual void SAL_CALL queryInteraction( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException );
+ virtual void SAL_CALL interactionDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException );
+ virtual void SAL_CALL saveDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException );
virtual sal_Bool SAL_CALL cancelShutdown() throw( RuntimeException );
};
@@ -212,7 +218,7 @@ void VCLSession::callQuit()
sal_uLong nAcquireCount = Application::ReleaseSolarMutex();
for( std::list< Listener >::const_iterator it = aListeners.begin(); it != aListeners.end(); ++it )
{
- Reference< XSessionManagerListener2 > xListener2( it->m_xListener, UNO_QUERY );
+ css::uno::Reference< XSessionManagerListener2 > xListener2( it->m_xListener, UNO_QUERY );
if( xListener2.is() )
xListener2->doQuit();
}
@@ -244,14 +250,14 @@ void VCLSession::SalSessionEventProc( SalSessionEvent* pEvent )
}
}
-void SAL_CALL VCLSession::addSessionManagerListener( const Reference<XSessionManagerListener>& xListener ) throw( RuntimeException )
+void SAL_CALL VCLSession::addSessionManagerListener( const css::uno::Reference<XSessionManagerListener>& xListener ) throw( RuntimeException )
{
osl::MutexGuard aGuard( m_aMutex );
m_aListeners.push_back( Listener( xListener ) );
}
-void SAL_CALL VCLSession::removeSessionManagerListener( const Reference<XSessionManagerListener>& xListener ) throw( RuntimeException )
+void SAL_CALL VCLSession::removeSessionManagerListener( const css::uno::Reference<XSessionManagerListener>& xListener ) throw( RuntimeException )
{
osl::MutexGuard aGuard( m_aMutex );
@@ -268,7 +274,7 @@ void SAL_CALL VCLSession::removeSessionManagerListener( const Reference<XSession
}
}
-void SAL_CALL VCLSession::queryInteraction( const Reference<XSessionManagerListener>& xListener ) throw( RuntimeException )
+void SAL_CALL VCLSession::queryInteraction( const css::uno::Reference<XSessionManagerListener>& xListener ) throw( RuntimeException )
{
if( m_bInteractionGranted )
{
@@ -295,7 +301,7 @@ void SAL_CALL VCLSession::queryInteraction( const Reference<XSessionManagerListe
}
}
-void SAL_CALL VCLSession::interactionDone( const Reference< XSessionManagerListener >& xListener ) throw( RuntimeException )
+void SAL_CALL VCLSession::interactionDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException )
{
osl::MutexGuard aGuard( m_aMutex );
int nRequested = 0, nDone = 0;
@@ -318,7 +324,7 @@ void SAL_CALL VCLSession::interactionDone( const Reference< XSessionManagerListe
}
}
-void SAL_CALL VCLSession::saveDone( const Reference< XSessionManagerListener >& xListener ) throw( RuntimeException )
+void SAL_CALL VCLSession::saveDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException )
{
osl::MutexGuard aGuard( m_aMutex );
@@ -359,11 +365,11 @@ Sequence< rtl::OUString > SAL_CALL vcl_session_getSupportedServiceNames()
return aRet;
}
-Reference< XInterface > SAL_CALL vcl_session_createInstance( const Reference< XMultiServiceFactory > & /*xMultiServiceFactory*/ )
+css::uno::Reference< XInterface > SAL_CALL vcl_session_createInstance( const css::uno::Reference< XMultiServiceFactory > & /*xMultiServiceFactory*/ )
{
ImplSVData* pSVData = ImplGetSVData();
if( ! pSVData->xSMClient.is() )
pSVData->xSMClient = new VCLSession();
- return Reference< XInterface >(pSVData->xSMClient, UNO_QUERY );
+ return css::uno::Reference< XInterface >(pSVData->xSMClient, UNO_QUERY );
}
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 191c39ba477e..c61ddc0af6ae 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1760,9 +1760,12 @@ void Application::SetUnoWrapper( UnoWrapperBase* pWrapper )
ImplSVData* pSVData = ImplGetSVData();
if( !pSVData->mxDisplayConnection.is() )
+ {
pSVData->mxDisplayConnection.set( new ::vcl::DisplayConnection );
+ pSVData->mxDisplayConnection->start();
+ }
- return pSVData->mxDisplayConnection;
+ return pSVData->mxDisplayConnection.get();
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
index f5b03f2b9b91..b749fa78ea59 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -53,6 +53,7 @@
#include "vcl/salimestatus.hxx"
#include "vcl/salsys.hxx"
#include "vcl/svids.hrc"
+#include "vcl/xconnection.hxx"
#include "unotools/fontcfg.hxx"
@@ -71,6 +72,12 @@
#include <stdio.h>
+namespace {
+
+namespace css = com::sun::star;
+
+}
+
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::awt;
@@ -172,6 +179,8 @@ void ImplDeInitSVData()
delete pSVData->maCtrlData.mpFieldUnitStrings, pSVData->maCtrlData.mpFieldUnitStrings = NULL;
if( pSVData->maCtrlData.mpCleanUnitStrings )
delete pSVData->maCtrlData.mpCleanUnitStrings, pSVData->maCtrlData.mpCleanUnitStrings = NULL;
+ if( pSVData->mpPaperNames )
+ delete pSVData->mpPaperNames, pSVData->mpPaperNames = NULL;
}
// -----------------------------------------------------------------------
@@ -362,12 +371,12 @@ bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled)
ImplSVData* pSVData = ImplGetSVData();
if( ! pSVData->mxAccessBridge.is() )
{
- Reference< XMultiServiceFactory > xFactory(vcl::unohelper::GetMultiServiceFactory());
+ css::uno::Reference< XMultiServiceFactory > xFactory(vcl::unohelper::GetMultiServiceFactory());
if( xFactory.is() )
{
- Reference< XExtendedToolkit > xToolkit =
- Reference< XExtendedToolkit >(Application::GetVCLToolkit(), UNO_QUERY);
+ css::uno::Reference< XExtendedToolkit > xToolkit =
+ css::uno::Reference< XExtendedToolkit >(Application::GetVCLToolkit(), UNO_QUERY);
Sequence< Any > arguments(1);
arguments[0] = makeAny(xToolkit);
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index 44990c39c05a..115d0afbb24d 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -89,6 +89,12 @@
#include "rtl/strbuf.hxx"
#endif
+namespace {
+
+namespace css = com::sun::star;
+
+}
+
using namespace ::rtl;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
@@ -171,7 +177,7 @@ sal_Bool ImplSVMain()
DBG_ASSERT( pSVData->mpApp, "no instance of class Application" );
- Reference<XMultiServiceFactory> xMS;
+ css::uno::Reference<XMultiServiceFactory> xMS;
sal_Bool bInit = InitVCL( xMS );
@@ -186,11 +192,7 @@ sal_Bool ImplSVMain()
if( pSVData->mxDisplayConnection.is() )
{
- vcl::DisplayConnection* pConnection =
- dynamic_cast<vcl::DisplayConnection*>(pSVData->mxDisplayConnection.get());
-
- if( pConnection )
- pConnection->dispatchDowningEvent();
+ pSVData->mxDisplayConnection->terminate();
pSVData->mxDisplayConnection.clear();
}
@@ -199,7 +201,7 @@ sal_Bool ImplSVMain()
// be some events in the AWT EventQueue, which need the SolarMutex which
// - on the other hand - is destroyed in DeInitVCL(). So empty the queue
// here ..
- Reference< XComponent > xComponent(pSVData->mxAccessBridge, UNO_QUERY);
+ css::uno::Reference< XComponent > xComponent(pSVData->mxAccessBridge, UNO_QUERY);
if( xComponent.is() )
{
sal_uLong nCount = Application::ReleaseSolarMutex();
@@ -368,7 +370,9 @@ void DeInitVCL()
aBuf.append( rtl::OUStringToOString( pWin->GetText(), osl_getThreadTextEncoding() ) );
aBuf.append( "\" type = \"" );
aBuf.append( typeid(*pWin).name() );
- aBuf.append( "\"\n" );
+ aBuf.append( "\", ptr = 0x" );
+ aBuf.append( sal_Int64( pWin ), 16 );
+ aBuf.append( "\n" );
}
}
DBG_ASSERT( nBadTopWindows==0, aBuf.getStr() );
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index f166a3c1f535..769614a9259b 100755
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -795,19 +795,19 @@ String Edit::ImplGetValidString( const String& rString ) const
}
// -----------------------------------------------------------------------
-Reference < i18n::XBreakIterator > Edit::ImplGetBreakIterator() const
+uno::Reference < i18n::XBreakIterator > Edit::ImplGetBreakIterator() const
{
//!! since we don't want to become incompatible in the next minor update
//!! where this code will get integrated into, xISC will be a local
//!! variable instead of a class member!
- Reference < i18n::XBreakIterator > xBI;
+ uno::Reference < i18n::XBreakIterator > xBI;
// if ( !xBI.is() )
{
- Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
- Reference < XInterface > xI = xMSF->createInstance( OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) );
+ uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ uno::Reference < XInterface > xI = xMSF->createInstance( OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) );
if ( xI.is() )
{
- Any x = xI->queryInterface( ::getCppuType((const Reference< i18n::XBreakIterator >*)0) );
+ Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XBreakIterator >*)0) );
x >>= xBI;
}
}
@@ -815,19 +815,19 @@ Reference < i18n::XBreakIterator > Edit::ImplGetBreakIterator() const
}
// -----------------------------------------------------------------------
-Reference < i18n::XExtendedInputSequenceChecker > Edit::ImplGetInputSequenceChecker() const
+uno::Reference < i18n::XExtendedInputSequenceChecker > Edit::ImplGetInputSequenceChecker() const
{
//!! since we don't want to become incompatible in the next minor update
//!! where this code will get integrated into, xISC will be a local
//!! variable instead of a class member!
- Reference < i18n::XExtendedInputSequenceChecker > xISC;
+ uno::Reference < i18n::XExtendedInputSequenceChecker > xISC;
// if ( !xISC.is() )
{
- Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
- Reference < XInterface > xI = xMSF->createInstance( OUString::createFromAscii( "com.sun.star.i18n.InputSequenceChecker" ) );
+ uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ uno::Reference < XInterface > xI = xMSF->createInstance( OUString::createFromAscii( "com.sun.star.i18n.InputSequenceChecker" ) );
if ( xI.is() )
{
- Any x = xI->queryInterface( ::getCppuType((const Reference< i18n::XExtendedInputSequenceChecker >*)0) );
+ Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XExtendedInputSequenceChecker >*)0) );
x >>= xISC;
}
}
@@ -902,8 +902,8 @@ void Edit::ImplInsertText( const XubString& rStr, const Selection* pNewSel, sal_
// get access to the configuration of this office module
try
{
- Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
- Reference< container::XNameAccess > xModuleCfg( ::comphelper::ConfigurationHelper::openConfig(
+ uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ uno::Reference< container::XNameAccess > xModuleCfg( ::comphelper::ConfigurationHelper::openConfig(
xMSF,
sModule,
::comphelper::ConfigurationHelper::E_READONLY ),
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index 670d6dad0ada..793d12a0e93e 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -2069,8 +2069,6 @@ void ImplListBoxWindow::SetTopEntry( sal_uInt16 nTop )
mnTop = nTop;
Scroll( 0, nDiff );
Update();
- maFocusRect.Top() += nDiff;
- maFocusRect.Bottom() += nDiff;
if( HasFocus() )
ImplShowFocusRect();
maScrollHdl.Call( this );
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 31de70d73616..3140d100aa86 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -355,15 +355,18 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth )
Rectangle TabControl::ImplGetTabRect( sal_uInt16 nItemPos, long nWidth, long nHeight )
{
Size aWinSize = Control::GetOutputSizePixel();
- if ( nWidth == -1 )
+ if ( nWidth < 0 )
nWidth = aWinSize.Width();
- if ( nHeight == -1 )
+ if ( nHeight < 0 )
nHeight = aWinSize.Height();
if ( mpTabCtrlData->maItemList.empty() )
{
- return Rectangle( Point( TAB_OFFSET, TAB_OFFSET ),
- Size( nWidth-TAB_OFFSET*2, nHeight-TAB_OFFSET*2 ) );
+ long nW = nWidth-TAB_OFFSET*2;
+ long nH = nHeight-TAB_OFFSET*2;
+ return (nW > 0 && nH > 0)
+ ? Rectangle( Point( TAB_OFFSET, TAB_OFFSET ), Size( nW, nH ) )
+ : Rectangle();
}
if ( nItemPos == TAB_PAGERECT )
@@ -375,9 +378,11 @@ Rectangle TabControl::ImplGetTabRect( sal_uInt16 nItemPos, long nWidth, long nHe
nLastPos = 0;
Rectangle aRect = ImplGetTabRect( nLastPos, nWidth, nHeight );
- aRect = Rectangle( Point( TAB_OFFSET, aRect.Bottom()+TAB_OFFSET ),
- Size( nWidth-TAB_OFFSET*2,
- nHeight-aRect.Bottom()-TAB_OFFSET*2 ) );
+ long nW = nWidth-TAB_OFFSET*2;
+ long nH = nHeight-aRect.Bottom()-TAB_OFFSET*2;
+ aRect = (nW > 0 && nH > 0)
+ ? Rectangle( Point( TAB_OFFSET, aRect.Bottom()+TAB_OFFSET ), Size( nW, nH ) )
+ : Rectangle();
return aRect;
}
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index 5f434f9ba48a..8d831961f8af 100644
--- a/vcl/source/gdi/bitmap.cxx
+++ b/vcl/source/gdi/bitmap.cxx
@@ -236,9 +236,13 @@ bool BitmapPalette::IsGreyPalette() const
const int nEntryCount = GetEntryCount();
if( !nEntryCount ) // NOTE: an empty palette means 1:1 mapping
return true;
- const BitmapPalette& rGreyPalette = Bitmap::GetGreyPalette( nEntryCount );
- if( rGreyPalette == *this )
- return true;
+ // see above: only certain entry values will result in a valid call to GetGreyPalette
+ if( nEntryCount == 2 || nEntryCount == 4 || nEntryCount == 16 || nEntryCount == 256 )
+ {
+ const BitmapPalette& rGreyPalette = Bitmap::GetGreyPalette( nEntryCount );
+ if( rGreyPalette == *this )
+ return true;
+ }
// TODO: is it worth to compare the entries?
return false;
}
diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx
index ff3c9a20ef06..8321e56443f3 100644
--- a/vcl/source/gdi/jobset.cxx
+++ b/vcl/source/gdi/jobset.cxx
@@ -299,13 +299,16 @@ SvStream& operator>>( SvStream& rIStream, JobSetup& rJobSetup )
// Zur Zeit haben wir noch kein neues FileFormat
// if ( rIStream.GetVersion() < JOBSET_FILEFORMAT2 )
{
- sal_uInt16 nLen;
- sal_uInt16 nSystem;
sal_Size nFirstPos = rIStream.Tell();
+
+ sal_uInt16 nLen = 0;
rIStream >> nLen;
if ( !nLen )
return rIStream;
+
+ sal_uInt16 nSystem = 0;
rIStream >> nSystem;
+
char* pTempBuf = new char[nLen];
rIStream.Read( pTempBuf, nLen - sizeof( nLen ) - sizeof( nSystem ) );
if ( nLen >= sizeof(ImplOldJobSetupData)+4 )
diff --git a/vcl/source/gdi/lineinfo.cxx b/vcl/source/gdi/lineinfo.cxx
index b7020874ca9c..ebd55a48f593 100644
--- a/vcl/source/gdi/lineinfo.cxx
+++ b/vcl/source/gdi/lineinfo.cxx
@@ -70,6 +70,20 @@ ImplLineInfo::ImplLineInfo( const ImplLineInfo& rImplLineInfo ) :
{
}
+// -----------------------------------------------------------------------
+
+inline bool ImplLineInfo::operator==( const ImplLineInfo& rB ) const
+{
+ return(meStyle == rB.meStyle
+ && mnWidth == rB.mnWidth
+ && mnDashCount == rB.mnDashCount
+ && mnDashLen == rB.mnDashLen
+ && mnDotCount == rB.mnDotCount
+ && mnDotLen == rB.mnDotLen
+ && mnDistance == rB.mnDistance
+ && meLineJoin == rB.meLineJoin);
+}
+
// ------------
// - LineInfo -
// ------------
@@ -125,13 +139,7 @@ sal_Bool LineInfo::operator==( const LineInfo& rLineInfo ) const
DBG_CHKOBJ( &rLineInfo, LineInfo, NULL );
return( mpImplLineInfo == rLineInfo.mpImplLineInfo ||
- ( mpImplLineInfo->meStyle == rLineInfo.mpImplLineInfo->meStyle &&
- mpImplLineInfo->mnWidth == rLineInfo.mpImplLineInfo->mnWidth &&
- mpImplLineInfo->mnDashCount == rLineInfo.mpImplLineInfo->mnDashCount &&
- mpImplLineInfo->mnDashLen == rLineInfo.mpImplLineInfo->mnDashLen &&
- mpImplLineInfo->mnDotCount == rLineInfo.mpImplLineInfo->mnDotCount &&
- mpImplLineInfo->mnDotLen == rLineInfo.mpImplLineInfo->mnDotLen &&
- mpImplLineInfo->mnDistance == rLineInfo.mpImplLineInfo->mnDistance ) );
+ *mpImplLineInfo == *rLineInfo.mpImplLineInfo );
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx
index ad89fda760b9..b5ecb0761949 100644..100755
--- a/vcl/source/gdi/outdev.cxx
+++ b/vcl/source/gdi/outdev.cxx
@@ -202,10 +202,6 @@ bool OutputDevice::ImplSelectClipRegion( const Region& rRegion, SalGraphics* pGr
{
DBG_TESTSOLARMUTEX();
- // TODO(Q3): Change from static to plain method - everybody's
- // calling it with pOutDev=this!
- // => done, but only with minimal changes for now => TODO
- OutputDevice* const pOutDev = this;
if( !pGraphics )
{
if( !mpGraphics )
@@ -214,91 +210,8 @@ bool OutputDevice::ImplSelectClipRegion( const Region& rRegion, SalGraphics* pGr
pGraphics = mpGraphics;
}
- if( rRegion.HasPolyPolygon()
- && pGraphics->supportsOperation( OutDevSupport_B2DClip ) )
- {
- const ::basegfx::B2DPolyPolygon& rB2DPolyPolygon = rRegion.GetB2DPolyPolygon();
- pGraphics->BeginSetClipRegion( 0 );
- pGraphics->UnionClipRegion( rB2DPolyPolygon, pOutDev );
- pGraphics->EndSetClipRegion();
- return true;
- }
-
- long nX;
- long nY;
- long nWidth;
- long nHeight;
- sal_uLong nRectCount;
- ImplRegionInfo aInfo;
- sal_Bool bRegionRect;
- sal_Bool bClipRegion = sal_True;
- const sal_Bool bClipDeviceBounds( !pOutDev->GetPDFWriter()
- && pOutDev->GetOutDevType() != OUTDEV_PRINTER );
-
- nRectCount = rRegion.GetRectCount();
- pGraphics->BeginSetClipRegion( nRectCount );
- bRegionRect = rRegion.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight );
- if( bClipDeviceBounds )
- {
- // #b6520266# Perform actual rect clip against outdev
- // dimensions, to generate empty clips whenever one of the
- // values is completely off the device.
- const long nOffX( pOutDev->mnOutOffX );
- const long nOffY( pOutDev->mnOutOffY );
- const long nDeviceWidth( pOutDev->GetOutputWidthPixel() );
- const long nDeviceHeight( pOutDev->GetOutputHeightPixel() );
- Rectangle aDeviceBounds( nOffX, nOffY,
- nOffX+nDeviceWidth-1,
- nOffY+nDeviceHeight-1 );
- while ( bRegionRect )
- {
- // #i59315# Limit coordinates passed to sal layer to actual
- // outdev dimensions - everything else bears the risk of
- // overflowing internal coordinates (e.g. the 16 bit wire
- // format of X11).
- Rectangle aTmpRect(nX,nY,nX+nWidth-1,nY+nHeight-1);
- aTmpRect.Intersection(aDeviceBounds);
-
- if( !aTmpRect.IsEmpty() )
- {
- if ( !pGraphics->UnionClipRegion( aTmpRect.Left(),
- aTmpRect.Top(),
- aTmpRect.GetWidth(),
- aTmpRect.GetHeight(),
- pOutDev ) )
- {
- bClipRegion = sal_False;
- }
- }
- else
- {
- // #i79850# Fake off-screen clip
- if ( !pGraphics->UnionClipRegion( nDeviceWidth+1,
- nDeviceHeight+1,
- 1, 1,
- pOutDev ) )
- {
- bClipRegion = sal_False;
- }
- }
- DBG_ASSERT( bClipRegion, "OutputDevice::ImplSelectClipRegion() - can't create region" );
- bRegionRect = rRegion.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight );
- }
- }
- else
- {
- // #i65720# Actually, _don't_ clip anything on printer or PDF
- // export, since output might be visible outside the specified
- // device boundaries.
- while ( bRegionRect )
- {
- if ( !pGraphics->UnionClipRegion( nX, nY, nWidth, nHeight, pOutDev ) )
- bClipRegion = sal_False;
- DBG_ASSERT( bClipRegion, "OutputDevice::ImplSelectClipRegion() - can't cerate region" );
- bRegionRect = rRegion.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight );
- }
- }
- pGraphics->EndSetClipRegion();
+ bool bClipRegion = pGraphics->SetClipRegion( rRegion, this );
+ OSL_ENSURE( bClipRegion, "OutputDevice::ImplSelectClipRegion() - can't cerate region" );
return bClipRegion;
}
@@ -1075,9 +988,22 @@ void OutputDevice::ImplInitClipRegion()
else
{
mbOutputClipped = sal_False;
- ImplSelectClipRegion(
- // #102532# Respect output offset also for clip region
- ImplPixelToDevicePixel( maRegion ) );
+
+ // #102532# Respect output offset also for clip region
+ Region aRegion( ImplPixelToDevicePixel( maRegion ) );
+ const bool bClipDeviceBounds( ! GetPDFWriter()
+ && GetOutDevType() != OUTDEV_PRINTER );
+ if( bClipDeviceBounds )
+ {
+ // #b6520266# Perform actual rect clip against outdev
+ // dimensions, to generate empty clips whenever one of the
+ // values is completely off the device.
+ Rectangle aDeviceBounds( mnOutOffX, mnOutOffY,
+ mnOutOffX+GetOutputWidthPixel()-1,
+ mnOutOffY+GetOutputHeightPixel()-1 );
+ aRegion.Intersect( aDeviceBounds );
+ }
+ ImplSelectClipRegion( aRegion );
}
mbClipRegionSet = sal_True;
@@ -1122,693 +1048,6 @@ void OutputDevice::ImplSetClipRegion( const Region* pRegion )
// -----------------------------------------------------------------------
-namespace
-{
- inline int iround( float x )
- {
- union
- {
- float f;
- sal_Int32 i;
- };
- f = x;
- sal_Int32 exponent = (127 + 31) - ((i >> 23) & 0xFF);
- sal_Int32 r = ((sal_Int32(i) << 8) | (1U << 31)) >> exponent;
- r &= ((exponent - 32) >> 31);
- sal_Int32 sign = i >> 31;
- return r = (r ^ sign) - sign;
- }
-
- inline int floorDiv(int a, int b)
- {
- if(b == 0)
- return 0x80000000;
- if(a >= 0)
- return a / b;
- int q = -(-a / b); // quotient
- int r = -a % b; // remainder
- if(r)
- q--;
- return q;
- }
-
- inline int floorMod( int a, int b )
- {
- if(b == 0)
- return 0x80000000;
- if(a >= 0)
- return a % b;
- int r = -a % b; // remainder
- if(r)
- r = b - r;
- return r;
- }
-
- inline int ceilDiv( int a, int b )
- {
- if(b == 0)
- return 0x80000000;
- a += - 1 + b;
- if(a >= 0)
- return a / b;
- int q = -(-a / b); // quotient
- int r = -a % b; // remainder
- if(r)
- q--;
- return q;
- }
-
- inline int ceilMod( int a, int b )
- {
- if(b == 0)
- return 0x80000000;
- a += - 1 + b;
- if(a >= 0)
- return (a % b) + 1 - b;
- int r = -a % b;
- if(r)
- r = b - r;
- return r + 1 - b;
- }
-
- inline int ceilFix4(int x) { return (x + 0xF) & 0xFFFFFFF0; }
-
- struct vertex
- {
- float x,y;
- inline vertex( const Point &p )
- : x((float)p.getX()),y((float)p.getY()) {}
- };
-
- template<class T> inline void swap(T &a, T &b) { T t=a; a=b; b=t; }
-
- class SpanIterator
- {
- public:
-
- SpanIterator( sal_Int32 *pTable, size_t dwPitch, sal_Int32 dwNumScanlines );
- std::pair<sal_Int32,sal_Int32> GetNextSpan( void );
- sal_Int32 GetNumRemainingScanlines( void );
- sal_Int32 GetNumEqualScanlines( void );
- SpanIterator &operator++ ();
- SpanIterator &Skip( sal_Int32 dwNumScanlines );
- sal_Int32 GetRemainingSpans( void ) const { return maNumSpans; }
-
- private:
-
- sal_Int32 *mpTable;
- sal_Int32 *mpSpanArray;
- sal_Int32 maNumSpans;
- sal_Int32 maRemainingScanlines;
- size_t maPitch;
- };
-
- inline SpanIterator::SpanIterator( sal_Int32 *pTable, size_t dwPitch, sal_Int32 dwNumScanlines )
- : mpTable(pTable),maRemainingScanlines(dwNumScanlines),maPitch(dwPitch)
- {
- sal_Int32 *pNumSpans = mpTable;
- mpSpanArray = reinterpret_cast<sal_Int32 *>(pNumSpans+2);
- maNumSpans = *pNumSpans;
- }
-
- inline SpanIterator &SpanIterator::operator++ ()
- {
- --maRemainingScanlines;
- mpTable += maPitch;
- sal_Int32 *pNumSpans = mpTable;
- mpSpanArray = reinterpret_cast<sal_Int32 *>(pNumSpans+2);
- maNumSpans = *pNumSpans;
- return (*this);
- }
-
- inline SpanIterator &SpanIterator::Skip( sal_Int32 dwNumScanlines )
- {
- // don't skip more scanlines than there are...
- if(dwNumScanlines > maRemainingScanlines)
- dwNumScanlines = maRemainingScanlines;
-
- // skip in one fellow swoop...
- maRemainingScanlines -= dwNumScanlines;
- mpTable += maPitch * dwNumScanlines;
-
- // initialize necessary query fields...
- sal_Int32 *pNumSpans = mpTable;
- mpSpanArray = reinterpret_cast<sal_Int32 *>(pNumSpans+2);
- maNumSpans = *pNumSpans;
- return (*this);
- }
-
- inline std::pair<sal_Int32,sal_Int32> SpanIterator::GetNextSpan( void )
- {
- sal_Int32 x(0);
- sal_Int32 w(0);
- if(maNumSpans)
- {
- x = *mpSpanArray++;
- w = *mpSpanArray++;
- --maNumSpans;
- }
- return std::pair<sal_Int32,sal_Int32>(x,w);
- }
-
- inline sal_Int32 SpanIterator::GetNumEqualScanlines( void )
- {
- return mpTable[1];
- }
-
- inline sal_Int32 SpanIterator::GetNumRemainingScanlines( void )
- {
- return maRemainingScanlines;
- }
-
- class ScanlineContainer
- {
-
- public:
-
- ScanlineContainer( sal_uInt32 dwNumScanlines,
- sal_uInt32 dwNumSpansPerScanline );
-
- ~ScanlineContainer( void );
-
- void InsertSpan( sal_Int32 y, sal_Int32 lx, sal_Int32 rx );
-
- SpanIterator Iterate( void ) const { return SpanIterator(mpTable,maPitch,maNumScanlines); }
-
- inline sal_uInt32 GetNumSpans( void ) const { return maNumberOfSpans; }
-
- void Consolidate( void );
-
- private:
-
- // the span table will assist in determinate exactly how many clipping
- // regions [that is *spans*] we will end up with.
- // the counter for this purpose is right ahead.
- sal_uInt32 maNumberOfSpans;
-
- struct span
- {
- sal_Int32 x;
- sal_Int32 w;
- };
-
- sal_uInt32 maNumScanlines;
- sal_uInt32 maNumSpansPerScanline;
- sal_Int32 *mpTable;
- size_t maPitch;
- };
-
- ScanlineContainer::ScanlineContainer( sal_uInt32 dwNumScanlines,
- sal_uInt32 dwNumSpansPerScanline ) : maNumScanlines(dwNumScanlines),
- maNumSpansPerScanline(dwNumSpansPerScanline)
- {
- // #128002# add one scanline buffer at the end, as
- // SpanIterator::Skip reads two bytes past the end.
- ++dwNumScanlines;
-
- // since each triangle could possibly add another span
- // we can calculate the upper limit by [num scanlines * num triangles].
- const sal_uInt32 dwNumPossibleRegions = dwNumScanlines*dwNumSpansPerScanline;
-
- // calculate the number of bytes the span table will consume
- const size_t dwTableSize = dwNumPossibleRegions*sizeof(span)+dwNumScanlines*(sizeof(sal_Int32)<<1);
-
- // allocate the span table [on the stack]
- mpTable = static_cast<sal_Int32 *>(rtl_allocateMemory(dwTableSize));
-
- // calculate the table pitch, that is how many int's do i need to get from a scanline to the next.
- maPitch = (dwNumSpansPerScanline*sizeof(span)/sizeof(sal_Int32))+2;
-
- // we need to initialize the table here.
- // the first *int* on each scanline tells us how many spans are on it.
- sal_Int32 *pNumSpans = mpTable;
- for(unsigned int i=0; i<dwNumScanlines; ++i)
- {
- pNumSpans[0] = 0;
- pNumSpans[1] = 0;
- pNumSpans += maPitch;
- }
-
- maNumberOfSpans = 0;
- }
-
- ScanlineContainer::~ScanlineContainer( void )
- {
- rtl_freeMemory(mpTable);
- }
-
- void ScanlineContainer::InsertSpan( sal_Int32 y, sal_Int32 lx, sal_Int32 rx )
- {
- // there's new incoming span which we need to store in the table.
- // first see if its width contributes a valid span.
- if(sal_Int32 dwSpanWidth = rx-lx)
- {
- // first select the appropriate scanline the new span.
- sal_Int32 *pNumSpans = mpTable+(y*maPitch);
- span *pSpanArray = reinterpret_cast<span *>(pNumSpans+2);
-
- // retrieve the number of already contained spans.
- sal_Int32 dwNumSpan = *pNumSpans;
-
- // since we need to sort the spans from top to bottom
- // and left to right, we need to find the correct location
- // in the table.
- sal_Int32 dwIndex = 0;
- while(dwIndex<dwNumSpan)
- {
- // since we would like to avoid unnecessary spans
- // we try to consolidate them if possible.
- // consolidate with right neighbour
- if(pSpanArray[dwIndex].x == rx)
- {
- pSpanArray[dwIndex].x = lx;
- pSpanArray[dwIndex].w += dwSpanWidth;
- return;
- }
-
- // consolidate with left neighbour
- if((pSpanArray[dwIndex].x+pSpanArray[dwIndex].w) == lx)
- {
- pSpanArray[dwIndex].w += rx-lx;
- return;
- }
-
- // no consolidation possible, either this is a completely
- // seperate span or it is the first in the list.
- if(pSpanArray[dwIndex].x > lx)
- break;
-
- // forward to next element in the list.
- ++dwIndex;
- }
-
- // if we reach here, the new span needs to be stored
- // in the table, increase the number of spans in the
- // current scanline.
- *pNumSpans = dwNumSpan+1;
-
- // keep the list of spans in sorted order. 'dwIndex'
- // is where we want to store the new span. 'dwNumSpan'
- // is the number of spans already there. now we need
- // to move the offending spans out of the way.
- while(dwIndex != dwNumSpan)
- {
- pSpanArray[dwNumSpan].x = pSpanArray[dwNumSpan-1].x;
- pSpanArray[dwNumSpan].w = pSpanArray[dwNumSpan-1].w;
- --dwNumSpan;
- }
-
- // insert the new span
- pSpanArray[dwIndex].x = lx;
- pSpanArray[dwIndex].w = rx-lx;
-
- // remember the total number of spans in the table.
- ++maNumberOfSpans;
- }
- }
-
- void ScanlineContainer::Consolidate( void )
- {
- sal_Int32 *pScanline = mpTable;
-
- sal_Int32 dwRemaining = maNumScanlines;
- while(dwRemaining)
- {
- sal_Int32 dwNumSpans = pScanline[0];
- sal_Int32 *pSpanArray = pScanline+2;
-
- sal_Int32 dwRest = dwRemaining-1;
- sal_Int32 *pNext = pScanline;
- while(dwRest)
- {
- pNext += maPitch;
- sal_Int32 dwNumNextSpans = pNext[0];
- sal_Int32 *pSpanArrayNext = pNext+2;
- if(dwNumSpans != dwNumNextSpans)
- break;
-
- sal_Int32 dwCompare = dwNumSpans<<1;
- while(dwCompare)
- {
- if(pSpanArray[dwCompare-1] != pSpanArrayNext[dwCompare-1])
- break;
- --dwCompare;
- }
- if(dwCompare)
- break;
-
- --dwRest;
- }
-
- const sal_Int32 dwNumEqualScanlines(dwRemaining-dwRest);
- pScanline[1] = dwNumEqualScanlines;
- pScanline += maPitch*dwNumEqualScanlines;
- dwRemaining -= dwNumEqualScanlines;
-
- // since we track the total number of spans to generate,
- // we need to account for consolidated scanlines here.
- if(dwNumEqualScanlines > 1)
- maNumberOfSpans -= dwNumSpans * (dwNumEqualScanlines-1);
- }
- }
-}
-
-// TODO: we should consider passing a basegfx b2dpolypolygon here to
-// ensure that the signature isn't misleading.
-// if we could pass a b2dpolypolygon here, we could easily triangulate it.
-void OutputDevice::ImplSetTriangleClipRegion( const PolyPolygon &rPolyPolygon )
-{
- DBG_TESTSOLARMUTEX();
-
- if(!(IsDeviceOutputNecessary()))
- return;
- if(!(mpGraphics))
- if(!(ImplGetGraphics()))
- return;
-
- if( mpGraphics->supportsOperation( OutDevSupport_B2DClip ) )
- {
-#if 0
- ::basegfx::B2DPolyPolygon aB2DPolyPolygon = rPolyPolygon.getB2DPolyPolygon();
-#else
- // getB2DPolyPolygon() "optimizes away" some points
- // which prevents reliable undoing of the "triangle thingy" parameter
- // so the toolspoly -> b2dpoly conversion has to be done manually
- ::basegfx::B2DPolyPolygon aB2DPolyPolygon;
- for( sal_uInt16 nPolyIdx = 0; nPolyIdx < rPolyPolygon.Count(); ++nPolyIdx )
- {
- const Polygon& rPolygon = rPolyPolygon[ nPolyIdx ];
- ::basegfx::B2DPolygon aB2DPoly;
- for( sal_uInt16 nPointIdx = 0; nPointIdx < rPolygon.GetSize(); ++nPointIdx )
- {
- const Point& rPoint = rPolygon[ nPointIdx ];
- const ::basegfx::B2DPoint aB2DPoint( rPoint.X(), rPoint.Y() );
- aB2DPoly.append( aB2DPoint );
- }
- aB2DPolyPolygon.append( aB2DPoly );
- }
-#endif
-
- const ::basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation();
- aB2DPolyPolygon.transform( aTransform );
-
- // the rPolyPolygon argument is a "triangle thingy"
- // so convert it to a normal polypolyon first
- ::basegfx::B2DPolyPolygon aPolyTriangle;
- const int nPolyCount = aB2DPolyPolygon.count();
- for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx )
- {
- const ::basegfx::B2DPolygon rPolygon = aB2DPolyPolygon.getB2DPolygon( nPolyIdx );
- const int nPointCount = rPolygon.count();
- for( int nPointIdx = 0; nPointIdx+2 < nPointCount; nPointIdx +=3 )
- {
- ::basegfx::B2DPolygon aTriangle;
- aTriangle.append( rPolygon.getB2DPoint( nPointIdx+0 ) );
- aTriangle.append( rPolygon.getB2DPoint( nPointIdx+1 ) );
- aTriangle.append( rPolygon.getB2DPoint( nPointIdx+2 ) );
- aPolyTriangle.append( aTriangle );
- }
- }
-
- // now set the clip region with the real polypolygon
- mpGraphics->BeginSetClipRegion( 0 );
- mpGraphics->UnionClipRegion( aPolyTriangle, this );
- mpGraphics->EndSetClipRegion();
-
- // and mark the clip status as ready
- mbOutputClipped = sal_False;
- mbClipRegion = sal_True;
- mbClipRegionSet = sal_True;
- mbInitClipRegion = sal_False;
- return;
- }
-
- sal_Int32 offset_x = 0;
- sal_Int32 offset_y = 0;
- if ( GetOutDevType() == OUTDEV_WINDOW )
- {
- offset_x = mnOutOffX+mnOutOffOrigX;
- offset_y = mnOutOffY+mnOutOffOrigY;
- }
-
- // first of all we need to know the upper limit
- // of the amount of possible clipping regions.
- sal_Int32 maxy = SAL_MIN_INT32;
- sal_Int32 miny = SAL_MAX_INT32;
- sal_uInt32 dwNumTriangles = 0;
- for(sal_uInt16 i=0; i<rPolyPolygon.Count(); ++i)
- {
- const Polygon &rPoly = rPolyPolygon.GetObject(i);
- const sal_Int32 dwNumVertices = rPoly.GetSize();
- if(!(dwNumVertices % 3))
- {
- for(sal_uInt16 j=0; j<rPoly.GetSize(); ++j)
- {
- const Point &p = rPoly.GetPoint(j);
- if(p.Y() < miny)
- miny = p.Y();
- if(p.Y() > maxy)
- maxy = p.Y();
- }
- dwNumTriangles += dwNumVertices / 3;
- }
- }
-
- const sal_uInt32 dwNumScanlines = (maxy-miny);
- if(!(dwNumScanlines))
- {
- // indicates that no output needs to be produced
- // since the clipping region did not provide any
- // visible areas.
- mbOutputClipped = sal_True;
-
- // indicates that a clip region has been
- // presented to the output device.
- mbClipRegion = sal_True;
-
- // indicates that the set clipping region
- // has been processed.
- mbClipRegionSet = sal_True;
-
- // under 'normal' circumstances a new clipping region
- // needs to be processed by ImplInitClipRegion(),
- // which we need to circumvent.
- mbInitClipRegion = sal_False;
- return;
- }
-
- // this container provides all services we need to
- // efficiently store/retrieve spans from the table.
- const sal_uInt32 dwNumSpansPerScanline = dwNumTriangles;
- ScanlineContainer container(dwNumScanlines,dwNumSpansPerScanline);
-
- // convert the incoming polypolygon to spans, we assume that
- // the polypolygon has already been triangulated since we don't
- // want to use the basegfx-types here. this could be leveraged
- // after the tools-types had been removed.
- for(sal_uInt16 i=0; i<rPolyPolygon.Count(); ++i)
- {
- const Polygon &rPoly = rPolyPolygon.GetObject(i);
- const sal_uInt16 dwNumVertices = rPoly.GetSize();
- if(!(dwNumVertices % 3))
- {
- for(sal_uInt16 j=0; j<dwNumVertices; j+=3)
- {
- const Point &p0 = rPoly.GetPoint(j+0);
- const Point &p1 = rPoly.GetPoint(j+1);
- const Point &p2 = rPoly.GetPoint(j+2);
-
- // what now follows is an extremely fast triangle
- // rasterizer from which all tricky and interesting
- // parts were forcibly amputated.
- // note: top.left fill-convention
- vertex v0(p0);
- vertex v1(p1);
- vertex v2(p2);
-
- //sprintf(string,"[%f,%f] [%f,%f] [%f,%f]\n",v0.x,v0.y,v1.x,v1.y,v2.x,v2.y);
- //OSL_TRACE(string);
-
- if(v0.y > v2.y) ::swap(v0, v2);
- if(v1.y > v2.y) ::swap(v1, v2);
- if(v0.y > v1.y) ::swap(v0, v1);
-
- const float float2fixed(16.0f);
-
- // vertex coordinates of the triangle [28.4 fixed-point]
- const int i4x0 = iround(float2fixed * (v0.x - 0.5f));
- const int i4y0 = iround(float2fixed * (v0.y - 0.5f));
- const int i4x1 = iround(float2fixed * (v1.x - 0.5f));
- const int i4y1 = iround(float2fixed * (v1.y - 0.5f));
- const int i4x2 = iround(float2fixed * (v2.x - 0.5f));
- const int i4y2 = iround(float2fixed * (v2.y - 0.5f));
-
- // vertex coordinate deltas [28.4 fixed-point]
- const int i4dx12 = i4x1-i4x0;
- const int i4dy12 = i4y1-i4y0;
- const int i4dx13 = i4x2-i4x0;
- const int i4dy13 = i4y2-i4y0;
- const int i4dx23 = i4x2-i4x1;
- const int i4dy23 = i4y2-i4y1;
-
- // slope of edges [quotient,remainder]
- const int mq12 = floorDiv(i4dx12 << 4, i4dy12 << 4);
- const int mq13 = floorDiv(i4dx13 << 4, i4dy13 << 4);
- const int mq23 = floorDiv(i4dx23 << 4, i4dy23 << 4);
- const int mr12 = floorMod(i4dx12 << 4, i4dy12 << 4);
- const int mr13 = floorMod(i4dx13 << 4, i4dy13 << 4);
- const int mr23 = floorMod(i4dx23 << 4, i4dy23 << 4);
-
- // convert the vertical coordinates back to integers.
- // according to the top-left fillrule we need to step
- // the coordinates to the ceiling.
- const int y0 = (i4y0+15)>>4;
- const int y1 = (i4y1+15)>>4;
- const int y2 = (i4y2+15)>>4;
-
- // calculate the value of the horizontal coordinate
- // from the edge that 'spans' the triangle.
- const int x = ceilDiv(i4dx13*i4dy12 + i4x0*i4dy13, i4dy13);
-
- // this will hold the horizontal coordinates
- // of the seperate spans during the rasterization process.
- int lx,rx;
-
- // this pair will serve as the error accumulator while
- // we step along the edges.
- int ld,rd,lD,rD;
-
- // these are the edge and error stepping values that
- // will be used while stepping.
- int lQ,rQ,lR,rR;
-
- if(i4x1 < x)
- {
- lx = ceilDiv(i4dx12 * (ceilFix4(i4y0) - i4y0) + i4x0 * i4dy12, i4dy12 << 4);
- ld = ceilMod(i4dx12 * (ceilFix4(i4y0) - i4y0) + i4x0 * i4dy12, i4dy12 << 4);
- rx = ceilDiv(i4dx13 * (ceilFix4(i4y0) - i4y0) + i4x0 * i4dy13, i4dy13 << 4);
- rd = ceilMod(i4dx13 * (ceilFix4(i4y0) - i4y0) + i4x0 * i4dy13, i4dy13 << 4);
- lQ = mq12;
- rQ = mq13;
- lR = mr12;
- rR = mr13;
- lD = i4dy12 << 4;
- rD = i4dy13 << 4;
- }
- else
- {
- lx = ceilDiv(i4dx13 * (ceilFix4(i4y0) - i4y0) + i4x0 * i4dy13, i4dy13 << 4);
- ld = ceilMod(i4dx13 * (ceilFix4(i4y0) - i4y0) + i4x0 * i4dy13, i4dy13 << 4);
- rx = ceilDiv(i4dx12 * (ceilFix4(i4y0) - i4y0) + i4x0 * i4dy12, i4dy12 << 4);
- rd = ceilMod(i4dx12 * (ceilFix4(i4y0) - i4y0) + i4x0 * i4dy12, i4dy12 << 4);
- lQ = mq13;
- rQ = mq12;
- lR = mr13;
- rR = mr12;
- lD = i4dy13 << 4;
- rD = i4dy12 << 4;
- }
-
- for(signed int y=y0; y<y1; y++)
- {
- container.InsertSpan(y-miny,lx,rx);
-
- lx += lQ; ld += lR;
- if(ld > 0) { ld -= lD; lx += 1; }
- rx += rQ; rd += rR;
- if(rd > 0) { rd -= rD; rx += 1; }
- }
-
- if(i4x1 < x)
- {
- lx = ceilDiv(i4dx23 * (ceilFix4(i4y1) - i4y1) + i4x1 * i4dy23, i4dy23 << 4);
- ld = ceilMod(i4dx23 * (ceilFix4(i4y1) - i4y1) + i4x1 * i4dy23, i4dy23 << 4);
- rx = ceilDiv(i4dx13 * (ceilFix4(i4y1) - i4y0) + i4x0 * i4dy13, i4dy13 << 4);
- rd = ceilMod(i4dx13 * (ceilFix4(i4y1) - i4y0) + i4x0 * i4dy13, i4dy13 << 4);
- lQ = mq23;
- lR = mr23;
- lD = i4dy23 << 4;
- }
- else
- {
- rx = ceilDiv(i4dx23 * (ceilFix4(i4y1) - i4y1) + i4x1 * i4dy23, i4dy23 << 4);
- rd = ceilMod(i4dx23 * (ceilFix4(i4y1) - i4y1) + i4x1 * i4dy23, i4dy23 << 4);
- rQ = mq23;
- rR = mr23;
- rD = i4dy23 << 4;
- }
-
- for(signed int y=y1; y<y2; y++)
- {
- container.InsertSpan(y-miny,lx,rx);
-
- lx += lQ; ld += lR;
- if(ld > 0) { ld -= lD; lx += 1; }
- rx += rQ; rd += rR;
- if(rd > 0) { rd -= rD; rx += 1; }
- }
- }
- }
- }
-
- // now try to consolidate as many scanlines as possible.
- // please note that this will probably change the number
- // of spans [at least this is why we do all this hassle].
- // so, if you use 'consolidate' you should *use* this
- // information during iteration, because the 'graphics'
- // object we tell all those regions about is a bit,
- // hm, how to say, *picky* if you supply not correctly
- // the amount of regions.
- container.Consolidate();
-
- // now forward the spantable to the graphics handler.
- SpanIterator it(container.Iterate());
- mpGraphics->BeginSetClipRegion( container.GetNumSpans() );
- while(miny < maxy)
- {
- const sal_Int32 dwNumEqual(it.GetNumEqualScanlines());
- while(it.GetRemainingSpans())
- {
- // retrieve the next span [x-coordinate, width] from the current scanline.
- std::pair<sal_Int32,sal_Int32> span(it.GetNextSpan());
-
- // now forward this to the graphics object.
- // the only part that is worth noting is that we use
- // the number of equal spanlines [the current is always the
- // first one of the equal bunch] as the height of the region.
- mpGraphics->UnionClipRegion( offset_x+span.first,
- offset_y+miny,
- span.second,
- dwNumEqual,
- this );
- }
- it.Skip(dwNumEqual);
- miny += dwNumEqual;
- }
- mpGraphics->EndSetClipRegion();
-
- // indicates that no output needs to be produced
- // since the clipping region did not provide any
- // visible areas. the clip covers the whole area
- // if there's not a single region.
- mbOutputClipped = (container.GetNumSpans() == 0);
-
- // indicates that a clip region has been
- // presented to the output device.
- mbClipRegion = sal_True;
-
- // indicates that the set clipping region
- // has been processed.
- mbClipRegionSet = sal_True;
-
- // under 'normal' circumstances a new clipping region
- // needs to be processed by ImplInitClipRegion(),
- // which we need to circumvent.
- mbInitClipRegion = sal_False;
-}
-
-// -----------------------------------------------------------------------
-
void OutputDevice::SetClipRegion()
{
DBG_TRACE( "OutputDevice::SetClipRegion()" );
@@ -1848,42 +1087,6 @@ void OutputDevice::SetClipRegion( const Region& rRegion )
// -----------------------------------------------------------------------
-void OutputDevice::SetTriangleClipRegion( const PolyPolygon &rPolyPolygon )
-{
- DBG_TRACE( "OutputDevice::SetTriangleClipRegion( rPolyPolygon )" );
- DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
-
- // in case the passed polypolygon is empty, use the
- // existing SetClipRegion() method which gracefully
- // unsets any previously set clipping region.
- if(!(rPolyPolygon.Count()))
- SetClipRegion();
-
- sal_Int32 offset_x = 0;
- sal_Int32 offset_y = 0;
- if ( GetOutDevType() == OUTDEV_WINDOW )
- {
- offset_x = mnOutOffX+mnOutOffOrigX;
- offset_y = mnOutOffY+mnOutOffOrigY;
- }
-
- // play nice with the rest of the system and provide an old-style region.
- // the rest of this method does not rely on this.
- maRegion = Region::GetRegionFromPolyPolygon( LogicToPixel(rPolyPolygon) );
- maRegion.Move(offset_x,offset_x);
-
- // feed region to metafile
- if ( mpMetaFile )
- mpMetaFile->AddAction( new MetaClipRegionAction( maRegion, sal_True ) );
-
- ImplSetTriangleClipRegion( rPolyPolygon );
-
- if( mpAlphaVDev )
- mpAlphaVDev->SetTriangleClipRegion( rPolyPolygon );
-}
-
-// -----------------------------------------------------------------------
-
Region OutputDevice::GetClipRegion() const
{
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
@@ -3159,6 +2362,20 @@ void OutputDevice::DrawPolyLine(
// -----------------------------------------------------------------------
+sal_uInt32 OutputDevice::GetGCStackDepth() const
+{
+ const ImplObjStack* pData = mpObjStack;
+ sal_uInt32 nDepth = 0;
+ while( pData )
+ {
+ nDepth++;
+ pData = pData->mpPrev;
+ }
+ return nDepth;
+}
+
+// -----------------------------------------------------------------------
+
void OutputDevice::Push( sal_uInt16 nFlags )
{
DBG_TRACE( "OutputDevice::Push()" );
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 25e589e70c95..10f618d6e7c1 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -7414,7 +7414,6 @@ SystemTextLayoutData OutputDevice::GetSysTextLayoutData(const Point& rStartPt, c
// setup glyphs
Point aPos;
sal_GlyphId aGlyphId;
- int nFallbacklevel = 0;
for( int nStart = 0; rLayout->GetNextGlyphs( 1, &aGlyphId, aPos, nStart ); )
{
// NOTE: Windows backend is producing unicode chars (ucs4), so on windows,
@@ -7424,15 +7423,12 @@ SystemTextLayoutData OutputDevice::GetSysTextLayoutData(const Point& rStartPt, c
aGlyph.index = static_cast<unsigned long> (aGlyphId & GF_IDXMASK);
aGlyph.x = aPos.X();
aGlyph.y = aPos.Y();
- aSysLayoutData.rGlyphData.push_back(aGlyph);
-
int nLevel = (aGlyphId & GF_FONTMASK) >> GF_FONTSHIFT;
- if (nLevel > nFallbacklevel && nLevel < MAX_FALLBACK)
- nFallbacklevel = nLevel;
+ aGlyph.fallbacklevel = nLevel < MAX_FALLBACK ? nLevel : 0;
+ aSysLayoutData.rGlyphData.push_back(aGlyph);
}
// Get font data
- aSysLayoutData.aSysFontData = GetSysFontData(nFallbacklevel);
aSysLayoutData.orientation = rLayout->GetOrientation();
rLayout->Release();
diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx
index 77458d2b26fd..c47b034e1011 100644
--- a/vcl/source/gdi/pdfextoutdevdata.cxx
+++ b/vcl/source/gdi/pdfextoutdevdata.cxx
@@ -31,22 +31,25 @@
#include "vcl/graph.hxx"
#include "vcl/outdev.hxx"
#include "vcl/gfxlink.hxx"
+#include "vcl/dllapi.h"
#include "basegfx/polygon/b2dpolygon.hxx"
#include "basegfx/polygon/b2dpolygontools.hxx"
#include <boost/shared_ptr.hpp>
#include <set>
+#include <map>
namespace vcl
{
-struct PDFExtOutDevDataSync
+struct SAL_DLLPRIVATE PDFExtOutDevDataSync
{
enum Action{ CreateNamedDest,
CreateDest,
CreateLink,
SetLinkDest,
SetLinkURL,
+ RegisterDest,
CreateOutlineItem,
SetOutlineItemParent,
SetOutlineItemText,
@@ -73,7 +76,15 @@ struct PDFExtOutDevDataSync
Action eAct;
};
-struct GlobalSyncData
+struct SAL_DLLPRIVATE PDFLinkDestination
+{
+ Rectangle mRect;
+ MapMode mMapMode;
+ sal_Int32 mPageNr;
+ PDFWriter::DestAreaType mAreaType;
+};
+
+struct SAL_DLLPRIVATE GlobalSyncData
{
std::deque< PDFExtOutDevDataSync::Action > mActions;
std::deque< MapMode > mParaMapModes;
@@ -84,6 +95,7 @@ struct GlobalSyncData
std::deque< PDFWriter::DestAreaType > mParaDestAreaTypes;
std::deque< PDFNote > mParaPDFNotes;
std::deque< PDFWriter::PageTransition > mParaPageTransitions;
+ ::std::map< sal_Int32, PDFLinkDestination > mFutureDestinations;
sal_Int32 GetMappedId();
sal_Int32 GetMappedStructId( sal_Int32 );
@@ -145,7 +157,7 @@ void GlobalSyncData::PlayGlobalActions( PDFWriter& rWriter )
{
switch( *aIter )
{
- case PDFExtOutDevDataSync::CreateNamedDest : //i56629
+ case PDFExtOutDevDataSync::CreateNamedDest : //i56629
{
rWriter.Push( PUSH_MAPMODE );
rWriter.SetMapMode( mParaMapModes.front() );
@@ -197,6 +209,21 @@ void GlobalSyncData::PlayGlobalActions( PDFWriter& rWriter )
mParaOUStrings.pop_front();
}
break;
+ case PDFExtOutDevDataSync::RegisterDest :
+ {
+ const sal_Int32 nDestId = mParaInts.front();
+ mParaInts.pop_front();
+ OSL_ENSURE( mFutureDestinations.find( nDestId ) != mFutureDestinations.end(),
+ "GlobalSyncData::PlayGlobalActions: DescribeRegisteredRequest has not been called for that destination!" );
+
+ PDFLinkDestination& rDest = mFutureDestinations[ nDestId ];
+
+ rWriter.Push( PUSH_MAPMODE );
+ rWriter.SetMapMode( rDest.mMapMode );
+ mParaIds.push_back( rWriter.RegisterDestReference( nDestId, rDest.mRect, rDest.mPageNr, rDest.mAreaType ) );
+ rWriter.Pop();
+ }
+ break;
case PDFExtOutDevDataSync::CreateOutlineItem :
{
sal_Int32 nParent = GetMappedId();
@@ -459,6 +486,7 @@ sal_Bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIM
case PDFExtOutDevDataSync::CreateLink:
case PDFExtOutDevDataSync::SetLinkDest:
case PDFExtOutDevDataSync::SetLinkURL:
+ case PDFExtOutDevDataSync::RegisterDest:
case PDFExtOutDevDataSync::CreateOutlineItem:
case PDFExtOutDevDataSync::SetOutlineItemParent:
case PDFExtOutDevDataSync::SetOutlineItemText:
@@ -617,9 +645,28 @@ sal_Int32 PDFExtOutDevData::CreateNamedDest(const String& sDestName, const Rect
mpGlobalSyncData->mParaMapModes.push_back( mrOutDev.GetMapMode() );
mpGlobalSyncData->mParaInts.push_back( nPageNr == -1 ? mnPage : nPageNr );
mpGlobalSyncData->mParaDestAreaTypes.push_back( eType );
+
return mpGlobalSyncData->mCurId++;
}
//<---i56629
+sal_Int32 PDFExtOutDevData::RegisterDest()
+{
+ const sal_Int32 nLinkDestID = mpGlobalSyncData->mCurId++;
+ mpGlobalSyncData->mActions.push_back( PDFExtOutDevDataSync::RegisterDest );
+ mpGlobalSyncData->mParaInts.push_back( nLinkDestID );
+
+ return nLinkDestID;
+}
+void PDFExtOutDevData::DescribeRegisteredDest( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType )
+{
+ OSL_PRECOND( nDestId != -1, "PDFExtOutDevData::DescribeRegisteredDest: invalid destination Id!" );
+ PDFLinkDestination aLinkDestination;
+ aLinkDestination.mRect = rRect;
+ aLinkDestination.mMapMode = mrOutDev.GetMapMode();
+ aLinkDestination.mPageNr = nPageNr == -1 ? mnPage : nPageNr;
+ aLinkDestination.mAreaType = eType;
+ mpGlobalSyncData->mFutureDestinations[ nDestId ] = aLinkDestination;
+}
sal_Int32 PDFExtOutDevData::CreateDest( const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType )
{
mpGlobalSyncData->mActions.push_back( PDFExtOutDevDataSync::CreateDest );
diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx
index 445365e83dd4..d6c5aed6b52a 100644
--- a/vcl/source/gdi/pdfwriter.cxx
+++ b/vcl/source/gdi/pdfwriter.cxx
@@ -420,6 +420,10 @@ sal_Int32 PDFWriter::CreateLink( const Rectangle& rRect, sal_Int32 nPageNr )
{
return ((PDFWriterImpl*)pImplementation)->createLink( rRect, nPageNr );
}
+sal_Int32 PDFWriter::RegisterDestReference( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr, DestAreaType eType )
+{
+ return ((PDFWriterImpl*)pImplementation)->registerDestReference( nDestId, rRect, nPageNr, eType );
+}
//--->i56629
sal_Int32 PDFWriter::CreateNamedDest( const rtl::OUString& sDestName, const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType )
{
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 32f534129e07..f8a2bbc051a0 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -54,6 +54,7 @@
#include <vcl/metric.hxx>
#include <vcl/fontsubset.hxx>
#include <vcl/textlayout.hxx>
+#include <vcl/cvtgrf.hxx>
#include <svsys.h>
#include <vcl/salgdi.hxx>
#include <vcl/svapp.hxx>
@@ -887,34 +888,44 @@ static void appendDouble( double fValue, OStringBuffer& rBuffer, sal_Int32 nPrec
}
-static void appendColor( const Color& rColor, OStringBuffer& rBuffer )
+static void appendColor( const Color& rColor, OStringBuffer& rBuffer, bool bConvertToGrey = false )
{
if( rColor != Color( COL_TRANSPARENT ) )
{
- appendDouble( (double)rColor.GetRed() / 255.0, rBuffer );
- rBuffer.append( ' ' );
- appendDouble( (double)rColor.GetGreen() / 255.0, rBuffer );
- rBuffer.append( ' ' );
- appendDouble( (double)rColor.GetBlue() / 255.0, rBuffer );
+ if( bConvertToGrey )
+ {
+ sal_uInt8 cByte = rColor.GetLuminance();
+ appendDouble( (double)cByte / 255.0, rBuffer );
+ }
+ else
+ {
+ appendDouble( (double)rColor.GetRed() / 255.0, rBuffer );
+ rBuffer.append( ' ' );
+ appendDouble( (double)rColor.GetGreen() / 255.0, rBuffer );
+ rBuffer.append( ' ' );
+ appendDouble( (double)rColor.GetBlue() / 255.0, rBuffer );
+ }
}
}
-static void appendStrokingColor( const Color& rColor, OStringBuffer& rBuffer )
+void PDFWriterImpl::appendStrokingColor( const Color& rColor, OStringBuffer& rBuffer )
{
if( rColor != Color( COL_TRANSPARENT ) )
{
- appendColor( rColor, rBuffer );
- rBuffer.append( " RG" );
+ bool bGrey = m_aContext.ColorMode == PDFWriter::DrawGreyscale;
+ appendColor( rColor, rBuffer, bGrey );
+ rBuffer.append( bGrey ? " G" : " RG" );
}
}
-static void appendNonStrokingColor( const Color& rColor, OStringBuffer& rBuffer )
+void PDFWriterImpl::appendNonStrokingColor( const Color& rColor, OStringBuffer& rBuffer )
{
if( rColor != Color( COL_TRANSPARENT ) )
{
- appendColor( rColor, rBuffer );
- rBuffer.append( " rg" );
+ bool bGrey = m_aContext.ColorMode == PDFWriter::DrawGreyscale;
+ appendColor( rColor, rBuffer, bGrey );
+ rBuffer.append( bGrey ? " g" : " rg" );
}
}
@@ -2037,9 +2048,25 @@ inline void PDFWriterImpl::appendLiteralStringEncrypt( const rtl::OString& rInSt
appendLiteralStringEncrypt( aBufferString, nInObjectNumber, rOutBuffer);
}
-inline void PDFWriterImpl::appendLiteralStringEncrypt( const rtl::OUString& rInString, const sal_Int32 nInObjectNumber, rtl::OStringBuffer& rOutBuffer )
+void PDFWriterImpl::appendLiteralStringEncrypt( const rtl::OUString& rInString, const sal_Int32 nInObjectNumber, rtl::OStringBuffer& rOutBuffer, rtl_TextEncoding nEnc )
{
- rtl::OString aBufferString( rtl::OUStringToOString( rInString, RTL_TEXTENCODING_ASCII_US ) );
+ rtl::OString aBufferString( rtl::OUStringToOString( rInString, nEnc ) );
+ sal_Int32 nLen = aBufferString.getLength();
+ rtl::OStringBuffer aBuf( nLen );
+ const sal_Char* pT = aBufferString.getStr();
+
+ for( sal_Int32 i = 0; i < nLen; i++, pT++ )
+ {
+ if( (*pT & 0x80) == 0 )
+ aBuf.append( *pT );
+ else
+ {
+ aBuf.append( '<' );
+ appendHex( *pT, aBuf );
+ aBuf.append( '>' );
+ }
+ }
+ aBufferString = aBuf.makeStringAndClear();
appendLiteralStringEncrypt( aBufferString, nInObjectNumber, rOutBuffer);
}
@@ -2946,12 +2973,9 @@ bool PDFWriterImpl::emitTilings()
aTilingObj.setLength( 0 );
-#if OSL_DEBUG_LEVEL > 1
- {
- OStringBuffer aLine( "PDFWriterImpl::emitTilings" );
- emitComment( aLine.getStr() );
- }
-#endif
+ #if OSL_DEBUG_LEVEL > 1
+ emitComment( "PDFWriterImpl::emitTilings" );
+ #endif
sal_Int32 nX = (sal_Int32)it->m_aRectangle.Left();
sal_Int32 nY = (sal_Int32)it->m_aRectangle.Top();
@@ -3439,10 +3463,7 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFont
// now we can actually write the font stream !
#if OSL_DEBUG_LEVEL > 1
- {
- OStringBuffer aLine( " PDFWriterImpl::emitEmbeddedFont" );
- emitComment( aLine.getStr() );
- }
+ emitComment( " PDFWriterImpl::emitEmbeddedFont" );
#endif
OStringBuffer aLine( 512 );
nStreamObject = createObject();
@@ -3868,12 +3889,9 @@ sal_Int32 PDFWriterImpl::createToUnicodeCMap( sal_uInt8* pEncoding,
delete pCodec;
#endif
-#if OSL_DEBUG_LEVEL > 1
- {
- OStringBuffer aLine( " PDFWriterImpl::createToUnicodeCMap" );
- emitComment( aLine.getStr() );
- }
-#endif
+ #if OSL_DEBUG_LEVEL > 1
+ emitComment( "PDFWriterImpl::createToUnicodeCMap" );
+ #endif
OStringBuffer aLine( 40 );
aLine.append( nStream );
@@ -4060,10 +4078,7 @@ bool PDFWriterImpl::emitFonts()
CHECK_RETURN( (osl_File_E_None == osl_setFilePos( aFontFile, osl_Pos_Absolut, 0 ) ) );
#if OSL_DEBUG_LEVEL > 1
- {
- OStringBuffer aLine1( " PDFWriterImpl::emitFonts" );
- emitComment( aLine1.getStr() );
- }
+ emitComment( "PDFWriterImpl::emitFonts" );
#endif
sal_Int32 nFontStream = createObject();
sal_Int32 nStreamLengthObject = createObject();
@@ -4634,18 +4649,20 @@ we check in the following sequence:
{
aLine.append( "/Launch/Win<</F" );
// INetURLObject is not good with UNC paths, use original path
- appendLiteralStringEncrypt( rLink.m_aURL, rLink.m_nObject, aLine );
+ appendLiteralStringEncrypt( rLink.m_aURL, rLink.m_nObject, aLine, osl_getThreadTextEncoding() );
aLine.append( ">>" );
}
else
{
- sal_Int32 nSetRelative = 0;
+ bool bSetRelative = false;
+ bool bFileSpec = false;
//check if relative file link is requested and if the protocol is 'file://'
if( m_aContext.RelFsys && eBaseProtocol == eTargetProtocol && eTargetProtocol == INET_PROT_FILE )
- nSetRelative++;
+ bSetRelative = true;
rtl::OUString aFragment = aTargetURL.GetMark( INetURLObject::NO_DECODE /*DECODE_WITH_CHARSET*/ ); //fragment as is,
if( nSetGoToRMode == 0 )
+ {
switch( m_aContext.DefaultLinkAction )
{
default:
@@ -4665,19 +4682,24 @@ we check in the following sequence:
eTargetProtocol != INET_PROT_FILE )
aLine.append( "/URI/URI" );
else
+ {
aLine.append( "/Launch/F" );
+ bFileSpec = true;
+ }
break;
}
+ }
//fragment are encoded in the same way as in the named destination processing
- rtl::OUString aURLNoMark = aTargetURL.GetURLNoMark( INetURLObject::DECODE_WITH_CHARSET );
if( nSetGoToRMode )
{//add the fragment
+ rtl::OUString aURLNoMark = aTargetURL.GetURLNoMark( INetURLObject::DECODE_WITH_CHARSET );
aLine.append("/GoToR");
aLine.append("/F");
- appendLiteralStringEncrypt( nSetRelative ? INetURLObject::GetRelURL( m_aContext.BaseURL, aURLNoMark,
+ bFileSpec = true;
+ appendLiteralStringEncrypt( bSetRelative ? INetURLObject::GetRelURL( m_aContext.BaseURL, aURLNoMark,
INetURLObject::WAS_ENCODED,
INetURLObject::DECODE_WITH_CHARSET ) :
- aURLNoMark, rLink.m_nObject, aLine );
+ aURLNoMark, rLink.m_nObject, aLine, osl_getThreadTextEncoding() );
if( aFragment.getLength() > 0 )
{
aLine.append("/D/");
@@ -4696,13 +4718,16 @@ we check in the following sequence:
//substitute the fragment
aTargetURL.SetMark( aLineLoc.getStr() );
}
- rtl::OUString aURL = aTargetURL.GetMainURL( (nSetRelative || eTargetProtocol == INET_PROT_FILE) ? INetURLObject::DECODE_WITH_CHARSET : INetURLObject::NO_DECODE );
+ rtl::OUString aURL = aTargetURL.GetMainURL( bFileSpec ? INetURLObject::DECODE_WITH_CHARSET : INetURLObject::NO_DECODE );
// check if we have a URL available, if the string is empty, set it as the original one
// if( aURL.getLength() == 0 )
// appendLiteralStringEncrypt( rLink.m_aURL , rLink.m_nObject, aLine );
// else
- appendLiteralStringEncrypt( nSetRelative ? INetURLObject::GetRelURL( m_aContext.BaseURL, aURL ) :
- aURL , rLink.m_nObject, aLine );
+ appendLiteralStringEncrypt( bSetRelative ? INetURLObject::GetRelURL( m_aContext.BaseURL, aURL,
+ INetURLObject::WAS_ENCODED,
+ bFileSpec ? INetURLObject::DECODE_WITH_CHARSET : INetURLObject::NO_DECODE
+ ) :
+ aURL , rLink.m_nObject, aLine, osl_getThreadTextEncoding() );
}
//<--- i56629
}
@@ -5358,12 +5383,9 @@ bool PDFWriterImpl::emitAppearances( PDFWidget& rWidget, OStringBuffer& rAnnotDi
pApppearanceStream->Seek( STREAM_SEEK_TO_BEGIN );
sal_Int32 nObject = createObject();
CHECK_RETURN( updateObject( nObject ) );
-#if OSL_DEBUG_LEVEL > 1
- {
- OStringBuffer aLine( " PDFWriterImpl::emitAppearances" );
- emitComment( aLine.getStr() );
- }
-#endif
+ #if OSL_DEBUG_LEVEL > 1
+ emitComment( "PDFWriterImpl::emitAppearances" );
+ #endif
OStringBuffer aLine;
aLine.append( nObject );
@@ -5591,7 +5613,7 @@ bool PDFWriterImpl::emitWidgetAnnotations()
if(!m_bIsPDF_A1)
{
OStringBuffer aDest;
- if( rWidget.m_nDest != -1 && appendDest( rWidget.m_nDest, aDest ) )
+ if( rWidget.m_nDest != -1 && appendDest( m_aDestinationIdTranslation[ rWidget.m_nDest ], aDest ) )
{
aLine.append( "/AA<</D<</Type/Action/S/GoTo/D " );
aLine.append( aDest.makeStringAndClear() );
@@ -5606,7 +5628,7 @@ bool PDFWriterImpl::emitWidgetAnnotations()
{
// create a submit form action
aLine.append( "/AA<</D<</Type/Action/S/SubmitForm/F" );
- appendLiteralStringEncrypt( rWidget.m_aListEntries.front(), rWidget.m_nObject, aLine );
+ appendLiteralStringEncrypt( rWidget.m_aListEntries.front(), rWidget.m_nObject, aLine, osl_getThreadTextEncoding() );
aLine.append( "/Flags " );
sal_Int32 nFlags = 0;
@@ -9251,12 +9273,9 @@ bool PDFWriterImpl::writeTransparentObject( TransparencyEmit& rObject )
rObject.m_pContentStream->Seek( STREAM_SEEK_TO_END );
sal_uLong nSize = rObject.m_pContentStream->Tell();
rObject.m_pContentStream->Seek( STREAM_SEEK_TO_BEGIN );
-#if OSL_DEBUG_LEVEL > 1
- {
- OStringBuffer aLine( " PDFWriterImpl::writeTransparentObject" );
- emitComment( aLine.getStr() );
- }
-#endif
+ #if OSL_DEBUG_LEVEL > 1
+ emitComment( "PDFWriterImpl::writeTransparentObject" );
+ #endif
OStringBuffer aLine( 512 );
CHECK_RETURN( updateObject( rObject.m_nObject ) );
aLine.append( rObject.m_nObject );
@@ -9400,28 +9419,25 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit& rObject )
sal_Int32 nFunctionObject = createObject();
CHECK_RETURN( updateObject( nFunctionObject ) );
- OutputDevice* pRefDevice = getReferenceDevice();
- pRefDevice->Push( PUSH_ALL );
- if( rObject.m_aSize.Width() > pRefDevice->GetOutputSizePixel().Width() )
- rObject.m_aSize.Width() = pRefDevice->GetOutputSizePixel().Width();
- if( rObject.m_aSize.Height() > pRefDevice->GetOutputSizePixel().Height() )
- rObject.m_aSize.Height() = pRefDevice->GetOutputSizePixel().Height();
- pRefDevice->SetMapMode( MapMode( MAP_PIXEL ) );
- pRefDevice->DrawGradient( Rectangle( Point( 0, 0 ), rObject.m_aSize ), rObject.m_aGradient );
+ VirtualDevice aDev;
+ aDev.SetOutputSizePixel( rObject.m_aSize );
+ aDev.SetMapMode( MapMode( MAP_PIXEL ) );
+ if( m_aContext.ColorMode == PDFWriter::DrawGreyscale )
+ aDev.SetDrawMode( aDev.GetDrawMode() |
+ ( DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_GRAYTEXT |
+ DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT ) );
+ aDev.DrawGradient( Rectangle( Point( 0, 0 ), rObject.m_aSize ), rObject.m_aGradient );
- Bitmap aSample = pRefDevice->GetBitmap( Point( 0, 0 ), rObject.m_aSize );
+ Bitmap aSample = aDev.GetBitmap( Point( 0, 0 ), rObject.m_aSize );
BitmapReadAccess* pAccess = aSample.AcquireReadAccess();
AccessReleaser aReleaser( pAccess );
Size aSize = aSample.GetSizePixel();
sal_Int32 nStreamLengthObject = createObject();
-#if OSL_DEBUG_LEVEL > 1
- {
- OStringBuffer aLine( " PDFWriterImpl::writeGradientFunction" );
- emitComment( aLine.getStr() );
- }
-#endif
+ #if OSL_DEBUG_LEVEL > 1
+ emitComment( "PDFWriterImpl::writeGradientFunction" );
+ #endif
OStringBuffer aLine( 120 );
aLine.append( nFunctionObject );
aLine.append( " 0 obj\n"
@@ -9434,6 +9450,7 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit& rObject )
aLine.append( " ]\n"
"/BitsPerSample 8\n"
"/Range[ 0 1 0 1 0 1 ]\n"
+ "/Order 3\n"
"/Length " );
aLine.append( nStreamLengthObject );
aLine.append( " 0 R\n"
@@ -9449,7 +9466,7 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit& rObject )
checkAndEnableStreamEncryption( nFunctionObject );
beginCompression();
- for( int y = 0; y < aSize.Height(); y++ )
+ for( int y = aSize.Height()-1; y >= 0; y-- )
{
for( int x = 0; x < aSize.Width(); x++ )
{
@@ -9500,8 +9517,6 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit& rObject )
"endobj\n\n" );
CHECK_RETURN( writeBuffer( aLine.getStr(), aLine.getLength() ) );
- pRefDevice->Pop();
-
return true;
}
@@ -9530,12 +9545,9 @@ bool PDFWriterImpl::writeJPG( JPGEmit& rObject )
m_aErrors.insert( PDFWriter::Warning_Transparency_Omitted_PDF13 );
}
-#if OSL_DEBUG_LEVEL > 1
- {
- OStringBuffer aLine( " PDFWriterImpl::writeJPG" );
- emitComment( aLine.getStr() );
- }
-#endif
+ #if OSL_DEBUG_LEVEL > 1
+ emitComment( "PDFWriterImpl::writeJPG" );
+ #endif
OStringBuffer aLine(200);
aLine.append( rObject.m_nObject );
@@ -9655,26 +9667,32 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask )
sal_Int32 nStreamLengthObject = createObject();
sal_Int32 nMaskObject = 0;
-#if OSL_DEBUG_LEVEL > 1
- {
- OStringBuffer aLine( " PDFWriterImpl::writeBitmapObject" );
- emitComment( aLine.getStr() );
- }
-#endif
+ #if OSL_DEBUG_LEVEL > 1
+ emitComment( "PDFWriterImpl::writeBitmapObject" );
+ #endif
OStringBuffer aLine(1024);
aLine.append( rObject.m_nObject );
aLine.append( " 0 obj\n"
"<</Type/XObject/Subtype/Image/Width " );
aLine.append( (sal_Int32)aBitmap.GetSizePixel().Width() );
- aLine.append( " /Height " );
+ aLine.append( "/Height " );
aLine.append( (sal_Int32)aBitmap.GetSizePixel().Height() );
- aLine.append( " /BitsPerComponent " );
+ aLine.append( "/BitsPerComponent " );
aLine.append( nBitsPerComponent );
- aLine.append( " /Length " );
+ aLine.append( "/Length " );
aLine.append( nStreamLengthObject );
aLine.append( " 0 R\n" );
#ifndef DEBUG_DISABLE_PDFCOMPRESSION
- aLine.append( "/Filter/FlateDecode" );
+ if( nBitsPerComponent != 1 )
+ {
+ aLine.append( "/Filter/FlateDecode" );
+ }
+ else
+ {
+ aLine.append( "/Filter/CCITTFaxDecode/DecodeParms<</K -1/BlackIs1 true/Columns " );
+ aLine.append( (sal_Int32)aBitmap.GetSizePixel().Width() );
+ aLine.append( ">>\n" );
+ }
#endif
if( ! bMask )
{
@@ -9742,7 +9760,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask )
{
if( aBitmap.GetBitCount() == 1 )
{
- aLine.append( " /ImageMask true\n" );
+ aLine.append( "/ImageMask true\n" );
sal_Int32 nBlackIndex = pAccess->GetBestPaletteIndex( BitmapColor( Color( COL_BLACK ) ) );
DBG_ASSERT( nBlackIndex == 0 || nBlackIndex == 1, "wrong black index" );
if( nBlackIndex )
@@ -9804,33 +9822,42 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask )
CHECK_RETURN( (osl_File_E_None == osl_getFilePos( m_aFile, &nStartPos )) );
checkAndEnableStreamEncryption( rObject.m_nObject );
- beginCompression();
- if( ! bTrueColor || pAccess->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB )
+#ifndef DEBUG_DISABLE_PDFCOMPRESSION
+ if( nBitsPerComponent == 1 )
{
- const int nScanLineBytes = 1 + ( pAccess->GetBitCount() * ( pAccess->Width() - 1 ) / 8U );
-
- for( int i = 0; i < pAccess->Height(); i++ )
- {
- CHECK_RETURN( writeBuffer( pAccess->GetScanline( i ), nScanLineBytes ) );
- }
+ writeG4Stream( pAccess );
}
else
+#endif
{
- const int nScanLineBytes = pAccess->Width()*3;
- boost::shared_array<sal_uInt8> pCol( new sal_uInt8[ nScanLineBytes ] );
- for( int y = 0; y < pAccess->Height(); y++ )
+ beginCompression();
+ if( ! bTrueColor || pAccess->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB )
{
- for( int x = 0; x < pAccess->Width(); x++ )
+ const int nScanLineBytes = 1 + ( pAccess->GetBitCount() * ( pAccess->Width() - 1 ) / 8U );
+
+ for( int i = 0; i < pAccess->Height(); i++ )
{
- BitmapColor aColor = pAccess->GetColor( y, x );
- pCol[3*x+0] = aColor.GetRed();
- pCol[3*x+1] = aColor.GetGreen();
- pCol[3*x+2] = aColor.GetBlue();
+ CHECK_RETURN( writeBuffer( pAccess->GetScanline( i ), nScanLineBytes ) );
}
- CHECK_RETURN( writeBuffer( pCol.get(), nScanLineBytes ) );
}
+ else
+ {
+ const int nScanLineBytes = pAccess->Width()*3;
+ boost::shared_array<sal_uInt8> pCol( new sal_uInt8[ nScanLineBytes ] );
+ for( int y = 0; y < pAccess->Height(); y++ )
+ {
+ for( int x = 0; x < pAccess->Width(); x++ )
+ {
+ BitmapColor aColor = pAccess->GetColor( y, x );
+ pCol[3*x+0] = aColor.GetRed();
+ pCol[3*x+1] = aColor.GetGreen();
+ pCol[3*x+2] = aColor.GetBlue();
+ }
+ CHECK_RETURN( writeBuffer( pCol.get(), nScanLineBytes ) );
+ }
+ }
+ endCompression();
}
- endCompression();
disableStreamEncryption();
sal_uInt64 nEndPos = 0;
@@ -9870,8 +9897,25 @@ void PDFWriterImpl::drawJPGBitmap( SvStream& rDCTData, bool bIsTrueColor, const
if( ! (rSizePixel.Width() && rSizePixel.Height()) )
return;
- SvMemoryStream* pStream = new SvMemoryStream;
rDCTData.Seek( 0 );
+ if( bIsTrueColor && m_aContext.ColorMode == PDFWriter::DrawGreyscale )
+ {
+ // need to convert to grayscale;
+ // load stream to bitmap and draw the bitmap instead
+ Graphic aGraphic;
+ GraphicConverter::Import( rDCTData, aGraphic, CVT_JPG );
+ Bitmap aBmp( aGraphic.GetBitmap() );
+ if( !!rMask && rMask.GetSizePixel() == aBmp.GetSizePixel() )
+ {
+ BitmapEx aBmpEx( aBmp, rMask );
+ drawBitmap( rTargetArea.TopLeft(), rTargetArea.GetSize(), aBmpEx );
+ }
+ else
+ drawBitmap( rTargetArea.TopLeft(), rTargetArea.GetSize(), aBmp );
+ return;
+ }
+
+ SvMemoryStream* pStream = new SvMemoryStream;
*pStream << rDCTData;
pStream->Seek( STREAM_SEEK_TO_END );
@@ -9962,18 +10006,28 @@ void PDFWriterImpl::drawBitmap( const Point& rDestPoint, const Size& rDestSize,
writeBuffer( aLine.getStr(), aLine.getLength() );
}
-const PDFWriterImpl::BitmapEmit& PDFWriterImpl::createBitmapEmit( const BitmapEx& rBitmap, bool bDrawMask )
+const PDFWriterImpl::BitmapEmit& PDFWriterImpl::createBitmapEmit( const BitmapEx& i_rBitmap, bool bDrawMask )
{
+ BitmapEx aBitmap( i_rBitmap );
+ if( m_aContext.ColorMode == PDFWriter::DrawGreyscale )
+ {
+ BmpConversion eConv = BMP_CONVERSION_8BIT_GREYS;
+ int nDepth = aBitmap.GetBitmap().GetBitCount();
+ if( nDepth <= 4 )
+ eConv = BMP_CONVERSION_4BIT_GREYS;
+ if( nDepth > 1 )
+ aBitmap.Convert( eConv );
+ }
BitmapID aID;
- aID.m_aPixelSize = rBitmap.GetSizePixel();
- aID.m_nSize = rBitmap.GetBitCount();
- aID.m_nChecksum = rBitmap.GetBitmap().GetChecksum();
+ aID.m_aPixelSize = aBitmap.GetSizePixel();
+ aID.m_nSize = aBitmap.GetBitCount();
+ aID.m_nChecksum = aBitmap.GetBitmap().GetChecksum();
aID.m_nMaskChecksum = 0;
- if( rBitmap.IsAlpha() )
- aID.m_nMaskChecksum = rBitmap.GetAlpha().GetChecksum();
+ if( aBitmap.IsAlpha() )
+ aID.m_nMaskChecksum = aBitmap.GetAlpha().GetChecksum();
else
{
- Bitmap aMask = rBitmap.GetMask();
+ Bitmap aMask = aBitmap.GetMask();
if( ! aMask.IsEmpty() )
aID.m_nMaskChecksum = aMask.GetChecksum();
}
@@ -9987,7 +10041,7 @@ const PDFWriterImpl::BitmapEmit& PDFWriterImpl::createBitmapEmit( const BitmapEx
{
m_aBitmaps.push_front( BitmapEmit() );
m_aBitmaps.front().m_aID = aID;
- m_aBitmaps.front().m_aBitmap = rBitmap;
+ m_aBitmaps.front().m_aBitmap = aBitmap;
m_aBitmaps.front().m_nObject = createObject();
m_aBitmaps.front().m_bDrawMask = bDrawMask;
it = m_aBitmaps.begin();
@@ -10050,15 +10104,16 @@ sal_Int32 PDFWriterImpl::createGradient( const Gradient& rGradient, const Size&
rSize ) );
// check if we already have this gradient
std::list<GradientEmit>::iterator it;
+ // rounding to point will generally lose some pixels
+ // round up to point boundary
+ aPtSize.Width()++;
+ aPtSize.Height()++;
for( it = m_aGradients.begin(); it != m_aGradients.end(); ++it )
{
if( it->m_aGradient == rGradient )
{
- if( it->m_aSize.Width() < aPtSize.Width() )
- it->m_aSize.Width() = aPtSize.Width();
- if( it->m_aSize.Height() <= aPtSize.Height() )
- it->m_aSize.Height() = aPtSize.Height();
- break;
+ if( it->m_aSize == aPtSize )
+ break;
}
}
if( it == m_aGradients.end() )
@@ -10133,12 +10188,12 @@ void PDFWriterImpl::drawGradient( const PolyPolygon& rPolyPoly, const Gradient&
return;
}
- sal_Int32 nGradient = createGradient( rGradient, rPolyPoly.GetBoundRect().GetSize() );
+ Rectangle aBoundRect = rPolyPoly.GetBoundRect();
+ sal_Int32 nGradient = createGradient( rGradient, aBoundRect.GetSize() );
updateGraphicsState();
- Rectangle aBoundRect = rPolyPoly.GetBoundRect();
- Point aTranslate = aBoundRect.BottomLeft() + Point( 0, 1 );
+ Point aTranslate = aBoundRect.BottomLeft();
int nPolygons = rPolyPoly.Count();
OStringBuffer aLine( 80*nPolygons );
@@ -10784,6 +10839,11 @@ sal_Int32 PDFWriterImpl::createDest( const Rectangle& rRect, sal_Int32 nPageNr,
return nRet;
}
+sal_Int32 PDFWriterImpl::registerDestReference( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType )
+{
+ return m_aDestinationIdTranslation[ nDestId ] = createDest( rRect, nPageNr, eType );
+}
+
sal_Int32 PDFWriterImpl::setLinkDest( sal_Int32 nLinkId, sal_Int32 nDestId )
{
if( nLinkId < 0 || nLinkId >= (sal_Int32)m_aLinks.size() )
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index b6612d835ca2..5cfe1be8d0f1 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -59,6 +59,7 @@ class ImplFontMetricData;
class FontSubsetInfo;
class ZCodec;
class EncHashTransporter;
+struct BitStreamState;
// the maximum password length
#define ENCRYPTED_PWD_SIZE 32
@@ -612,6 +613,9 @@ private:
dest id is always the dest's position in this vector
*/
std::vector<PDFDest> m_aDests;
+ /** contains destinations accessible via a public Id, instead of being linked to by an ordinary link
+ */
+ ::std::map< sal_Int32, sal_Int32 > m_aDestinationIdTranslation;
/* contains all links ever set during PDF creation,
link id is always the link's position in this vector
*/
@@ -831,7 +835,7 @@ i12626
// test if the encryption is active, if yes than encrypt the unicode string and add to the OStringBuffer parameter
void appendUnicodeTextStringEncrypt( const rtl::OUString& rInString, const sal_Int32 nInObjectNumber, rtl::OStringBuffer& rOutBuffer );
- void appendLiteralStringEncrypt( const rtl::OUString& rInString, const sal_Int32 nInObjectNumber, rtl::OStringBuffer& rOutBuffer );
+ void appendLiteralStringEncrypt( const rtl::OUString& rInString, const sal_Int32 nInObjectNumber, rtl::OStringBuffer& rOutBuffer, rtl_TextEncoding nEnc = RTL_TEXTENCODING_ASCII_US );
void appendLiteralStringEncrypt( const rtl::OString& rInString, const sal_Int32 nInObjectNumber, rtl::OStringBuffer& rOutBuffer );
void appendLiteralStringEncrypt( rtl::OStringBuffer& rInString, const sal_Int32 nInObjectNumber, rtl::OStringBuffer& rOutBuffer );
@@ -1057,6 +1061,14 @@ i12626
void implWriteBitmapEx( const Point& rPoint, const Size& rSize, const BitmapEx& rBitmapEx,
VirtualDevice* pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& );
+ // helpers for CCITT 1bit bitmap stream
+ void putG4Bits( sal_uInt32 i_nLength, sal_uInt32 i_nCode, BitStreamState& io_rState );
+ void putG4Span( long i_nSpan, bool i_bWhitePixel, BitStreamState& io_rState );
+ void writeG4Stream( BitmapReadAccess* i_pBitmap );
+
+ // color helper functions
+ void appendStrokingColor( const Color& rColor, rtl::OStringBuffer& rBuffer );
+ void appendNonStrokingColor( const Color& rColor, rtl::OStringBuffer& rBuffer );
public:
PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext, const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >&, PDFWriter& );
~PDFWriterImpl();
@@ -1270,6 +1282,7 @@ public:
// links
sal_Int32 createLink( const Rectangle& rRect, sal_Int32 nPageNr = -1 );
sal_Int32 createDest( const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ );
+ sal_Int32 registerDestReference( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ );
sal_Int32 setLinkDest( sal_Int32 nLinkId, sal_Int32 nDestId );
sal_Int32 setLinkURL( sal_Int32 nLinkId, const rtl::OUString& rURL );
void setLinkPropertyId( sal_Int32 nLinkId, sal_Int32 nPropertyId );
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index ea47a697cbf4..996f320357c8 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -33,6 +33,7 @@
#include "vcl/virdev.hxx"
#include "vcl/gdimtf.hxx"
#include "vcl/metaact.hxx"
+#include "vcl/bmpacc.hxx"
#include "vcl/graph.hxx"
#include "vcl/svdata.hxx"
#include "vcl/rendergraphicrasterizer.hxx"
@@ -48,6 +49,8 @@
#include <rtl/digest.h>
+#undef USE_PDFGRADIENTS
+
using namespace vcl;
using namespace rtl;
using namespace com::sun::star;
@@ -59,7 +62,7 @@ using namespace com::sun::star::beans;
void PDFWriterImpl::implWriteGradient( const PolyPolygon& i_rPolyPoly, const Gradient& i_rGradient,
VirtualDevice* i_pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& i_rContext )
{
- GDIMetaFile aTmpMtf;
+ GDIMetaFile aTmpMtf;
i_pDummyVDev->AddGradientActions( i_rPolyPoly.GetBoundRect(), i_rGradient, aTmpMtf );
@@ -141,6 +144,15 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz
const Size aSizePixel( aBitmapEx.GetSizePixel() );
if ( aSizePixel.Width() && aSizePixel.Height() )
{
+ if( m_aContext.ColorMode == PDFWriter::DrawGreyscale )
+ {
+ BmpConversion eConv = BMP_CONVERSION_8BIT_GREYS;
+ int nDepth = aBitmapEx.GetBitmap().GetBitCount();
+ if( nDepth <= 4 )
+ eConv = BMP_CONVERSION_4BIT_GREYS;
+ if( nDepth > 1 )
+ aBitmapEx.Convert( eConv );
+ }
sal_Bool bUseJPGCompression = !i_rContext.m_bOnlyLosslessCompression;
if ( ( aSizePixel.Width() < 32 ) || ( aSizePixel.Height() < 32 ) )
bUseJPGCompression = sal_False;
@@ -179,13 +191,13 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz
try
{
uno::Reference < io::XStream > xStream = new utl::OStreamWrapper( aStrm );
- Reference< io::XSeekable > xSeekable( xStream, UNO_QUERY_THROW );
- Reference< graphic::XGraphicProvider > xGraphicProvider( ImplGetSVData()->maAppData.mxMSF->createInstance(
+ uno::Reference< io::XSeekable > xSeekable( xStream, UNO_QUERY_THROW );
+ uno::Reference< graphic::XGraphicProvider > xGraphicProvider( ImplGetSVData()->maAppData.mxMSF->createInstance(
OUString::createFromAscii( "com.sun.star.graphic.GraphicProvider" ) ), UNO_QUERY );
if ( xGraphicProvider.is() )
{
- Reference< graphic::XGraphic > xGraphic( aGraphic.GetXGraphic() );
- Reference < io::XOutputStream > xOut( xStream->getOutputStream() );
+ uno::Reference< graphic::XGraphic > xGraphic( aGraphic.GetXGraphic() );
+ uno::Reference < io::XOutputStream > xOut( xStream->getOutputStream() );
rtl::OUString aMimeType( ::rtl::OUString::createFromAscii( "image/jpeg" ) );
uno::Sequence< beans::PropertyValue > aOutMediaProperties( 3 );
aOutMediaProperties[0].Name = ::rtl::OUString::createFromAscii( "OutputStream" );
@@ -208,7 +220,7 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz
Sequence< PropertyValue > aArgs( 1 );
aArgs[ 0 ].Name = ::rtl::OUString::createFromAscii( "InputStream" );
aArgs[ 0 ].Value <<= xStream;
- Reference< XPropertySet > xPropSet( xGraphicProvider->queryGraphicDescriptor( aArgs ) );
+ uno::Reference< XPropertySet > xPropSet( xGraphicProvider->queryGraphicDescriptor( aArgs ) );
if ( xPropSet.is() )
{
sal_Int16 nBitsPerPixel = 24;
@@ -355,16 +367,23 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
case( META_GRADIENT_ACTION ):
{
const MetaGradientAction* pA = (const MetaGradientAction*) pAction;
+ #ifdef USE_PDFGRADIENTS
+ m_rOuterFace.DrawGradient( pA->GetRect(), pA->GetGradient() );
+ #else
const PolyPolygon aPolyPoly( pA->GetRect() );
-
implWriteGradient( aPolyPoly, pA->GetGradient(), pDummyVDev, i_rContext );
+ #endif
}
break;
case( META_GRADIENTEX_ACTION ):
{
const MetaGradientExAction* pA = (const MetaGradientExAction*) pAction;
+ #ifdef USE_PDFGRADIENTS
+ m_rOuterFace.DrawGradient( pA->GetPolyPolygon(), pA->GetGradient() );
+ #else
implWriteGradient( pA->GetPolyPolygon(), pA->GetGradient(), pDummyVDev, i_rContext );
+ #endif
}
break;
@@ -519,7 +538,13 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
}
if( pGradAction )
+ {
+ #if USE_PDFGRADIENTS
+ m_rOuterFace.DrawGradient( pGradAction->GetPolyPolygon(), pGradAction->GetGradient() );
+ #else
implWriteGradient( pGradAction->GetPolyPolygon(), pGradAction->GetGradient(), pDummyVDev, i_rContext );
+ #endif
+ }
}
else
{
@@ -1549,3 +1574,476 @@ bool PDFWriterImpl::computeUDictionaryValue( EncHashTransporter* i_pTransporter,
}
/* end i12626 methods */
+
+static const long unsetRun[256] =
+{
+ 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, /* 0x00 - 0x0f */
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x10 - 0x1f */
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x20 - 0x2f */
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x30 - 0x3f */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x40 - 0x4f */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x50 - 0x5f */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x60 - 0x6f */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x70 - 0x7f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 - 0x8f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 - 0x9f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xa0 - 0xaf */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xb0 - 0xbf */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xc0 - 0xcf */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xd0 - 0xdf */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xe0 - 0xef */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xf0 - 0xff */
+};
+
+static const long setRun[256] =
+{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00 - 0x0f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 - 0x1f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 - 0x2f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30 - 0x3f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 - 0x4f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 - 0x5f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x6f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 - 0x7f */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x80 - 0x8f */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x90 - 0x9f */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xa0 - 0xaf */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xb0 - 0xbf */
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0xc0 - 0xcf */
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0xd0 - 0xdf */
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xe0 - 0xef */
+ 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 8, /* 0xf0 - 0xff */
+};
+
+inline bool isSet( const Scanline i_pLine, long i_nIndex )
+{
+ return (i_pLine[ i_nIndex/8 ] & (0x80 >> (i_nIndex&7))) != 0;
+}
+
+long findBitRun( const Scanline i_pLine, long i_nStartIndex, long i_nW, bool i_bSet )
+{
+ if( i_nStartIndex < 0 )
+ return i_nW;
+
+ long nIndex = i_nStartIndex;
+ if( nIndex < i_nW )
+ {
+ const sal_uInt8 * pByte = static_cast<sal_uInt8*>(i_pLine) + (nIndex/8);
+ sal_uInt8 nByte = *pByte;
+
+ // run up to byte boundary
+ long nBitInByte = (nIndex & 7);
+ if( nBitInByte )
+ {
+ sal_uInt8 nMask = 0x80 >> nBitInByte;
+ while( nBitInByte != 8 )
+ {
+ if( (nByte & nMask) != (i_bSet ? nMask : 0) )
+ return nIndex < i_nW ? nIndex : i_nW;
+ nMask = nMask >> 1;
+ nBitInByte++;
+ nIndex++;
+ }
+ if( nIndex < i_nW )
+ {
+ pByte++;
+ nByte = *pByte;
+ }
+ }
+
+ sal_uInt8 nRunByte;
+ const long* pRunTable;
+ if( i_bSet )
+ {
+ nRunByte = 0xff;
+ pRunTable = setRun;
+ }
+ else
+ {
+ nRunByte = 0;
+ pRunTable = unsetRun;
+ }
+
+ while( nByte == nRunByte && nIndex < i_nW )
+ {
+ nIndex += 8;
+ pByte++;
+ nByte = *pByte;
+ }
+ if( nIndex < i_nW )
+ {
+ nIndex += pRunTable[nByte];
+ }
+ }
+ return nIndex < i_nW ? nIndex : i_nW;
+}
+
+struct BitStreamState
+{
+ sal_uInt8 mnBuffer;
+ sal_uInt32 mnNextBitPos;
+
+ BitStreamState()
+ : mnBuffer( 0 )
+ , mnNextBitPos( 8 )
+ {
+ }
+
+ const sal_uInt8* getByte() const { return &mnBuffer; }
+ void flush() { mnNextBitPos = 8; mnBuffer = 0; }
+};
+
+void PDFWriterImpl::putG4Bits( sal_uInt32 i_nLength, sal_uInt32 i_nCode, BitStreamState& io_rState )
+{
+ while( i_nLength > io_rState.mnNextBitPos )
+ {
+ io_rState.mnBuffer |= static_cast<sal_uInt8>( i_nCode >> (i_nLength - io_rState.mnNextBitPos) );
+ i_nLength -= io_rState.mnNextBitPos;
+ writeBuffer( io_rState.getByte(), 1 );
+ io_rState.flush();
+ }
+ OSL_ASSERT( i_nLength < 9 );
+ static const unsigned int msbmask[9] = { 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff };
+ io_rState.mnBuffer |= static_cast<sal_uInt8>( (i_nCode & msbmask[i_nLength]) << (io_rState.mnNextBitPos - i_nLength) );
+ io_rState.mnNextBitPos -= i_nLength;
+ if( io_rState.mnNextBitPos == 0 )
+ {
+ writeBuffer( io_rState.getByte(), 1 );
+ io_rState.flush();
+ }
+}
+
+struct PixelCode
+{
+ sal_uInt32 mnEncodedPixels;
+ sal_uInt32 mnCodeBits;
+ sal_uInt32 mnCode;
+};
+
+static const PixelCode WhitePixelCodes[] =
+{
+ { 0, 8, 0x35 }, // 0011 0101
+ { 1, 6, 0x7 }, // 0001 11
+ { 2, 4, 0x7 }, // 0111
+ { 3, 4, 0x8 }, // 1000
+ { 4, 4, 0xB }, // 1011
+ { 5, 4, 0xC }, // 1100
+ { 6, 4, 0xE }, // 1110
+ { 7, 4, 0xF }, // 1111
+ { 8, 5, 0x13 }, // 1001 1
+ { 9, 5, 0x14 }, // 1010 0
+ { 10, 5, 0x7 }, // 0011 1
+ { 11, 5, 0x8 }, // 0100 0
+ { 12, 6, 0x8 }, // 0010 00
+ { 13, 6, 0x3 }, // 0000 11
+ { 14, 6, 0x34 }, // 1101 00
+ { 15, 6, 0x35 }, // 1101 01
+ { 16, 6, 0x2A }, // 1010 10
+ { 17, 6, 0x2B }, // 1010 11
+ { 18, 7, 0x27 }, // 0100 111
+ { 19, 7, 0xC }, // 0001 100
+ { 20, 7, 0x8 }, // 0001 000
+ { 21, 7, 0x17 }, // 0010 111
+ { 22, 7, 0x3 }, // 0000 011
+ { 23, 7, 0x4 }, // 0000 100
+ { 24, 7, 0x28 }, // 0101 000
+ { 25, 7, 0x2B }, // 0101 011
+ { 26, 7, 0x13 }, // 0010 011
+ { 27, 7, 0x24 }, // 0100 100
+ { 28, 7, 0x18 }, // 0011 000
+ { 29, 8, 0x2 }, // 0000 0010
+ { 30, 8, 0x3 }, // 0000 0011
+ { 31, 8, 0x1A }, // 0001 1010
+ { 32, 8, 0x1B }, // 0001 1011
+ { 33, 8, 0x12 }, // 0001 0010
+ { 34, 8, 0x13 }, // 0001 0011
+ { 35, 8, 0x14 }, // 0001 0100
+ { 36, 8, 0x15 }, // 0001 0101
+ { 37, 8, 0x16 }, // 0001 0110
+ { 38, 8, 0x17 }, // 0001 0111
+ { 39, 8, 0x28 }, // 0010 1000
+ { 40, 8, 0x29 }, // 0010 1001
+ { 41, 8, 0x2A }, // 0010 1010
+ { 42, 8, 0x2B }, // 0010 1011
+ { 43, 8, 0x2C }, // 0010 1100
+ { 44, 8, 0x2D }, // 0010 1101
+ { 45, 8, 0x4 }, // 0000 0100
+ { 46, 8, 0x5 }, // 0000 0101
+ { 47, 8, 0xA }, // 0000 1010
+ { 48, 8, 0xB }, // 0000 1011
+ { 49, 8, 0x52 }, // 0101 0010
+ { 50, 8, 0x53 }, // 0101 0011
+ { 51, 8, 0x54 }, // 0101 0100
+ { 52, 8, 0x55 }, // 0101 0101
+ { 53, 8, 0x24 }, // 0010 0100
+ { 54, 8, 0x25 }, // 0010 0101
+ { 55, 8, 0x58 }, // 0101 1000
+ { 56, 8, 0x59 }, // 0101 1001
+ { 57, 8, 0x5A }, // 0101 1010
+ { 58, 8, 0x5B }, // 0101 1011
+ { 59, 8, 0x4A }, // 0100 1010
+ { 60, 8, 0x4B }, // 0100 1011
+ { 61, 8, 0x32 }, // 0011 0010
+ { 62, 8, 0x33 }, // 0011 0011
+ { 63, 8, 0x34 }, // 0011 0100
+ { 64, 5, 0x1B }, // 1101 1
+ { 128, 5, 0x12 }, // 1001 0
+ { 192, 6, 0x17 }, // 0101 11
+ { 256, 7, 0x37 }, // 0110 111
+ { 320, 8, 0x36 }, // 0011 0110
+ { 384, 8, 0x37 }, // 0011 0111
+ { 448, 8, 0x64 }, // 0110 0100
+ { 512, 8, 0x65 }, // 0110 0101
+ { 576, 8, 0x68 }, // 0110 1000
+ { 640, 8, 0x67 }, // 0110 0111
+ { 704, 9, 0xCC }, // 0110 0110 0
+ { 768, 9, 0xCD }, // 0110 0110 1
+ { 832, 9, 0xD2 }, // 0110 1001 0
+ { 896, 9, 0xD3 }, // 0110 1001 1
+ { 960, 9, 0xD4 }, // 0110 1010 0
+ { 1024, 9, 0xD5 }, // 0110 1010 1
+ { 1088, 9, 0xD6 }, // 0110 1011 0
+ { 1152, 9, 0xD7 }, // 0110 1011 1
+ { 1216, 9, 0xD8 }, // 0110 1100 0
+ { 1280, 9, 0xD9 }, // 0110 1100 1
+ { 1344, 9, 0xDA }, // 0110 1101 0
+ { 1408, 9, 0xDB }, // 0110 1101 1
+ { 1472, 9, 0x98 }, // 0100 1100 0
+ { 1536, 9, 0x99 }, // 0100 1100 1
+ { 1600, 9, 0x9A }, // 0100 1101 0
+ { 1664, 6, 0x18 }, // 0110 00
+ { 1728, 9, 0x9B }, // 0100 1101 1
+ { 1792, 11, 0x8 }, // 0000 0001 000
+ { 1856, 11, 0xC }, // 0000 0001 100
+ { 1920, 11, 0xD }, // 0000 0001 101
+ { 1984, 12, 0x12 }, // 0000 0001 0010
+ { 2048, 12, 0x13 }, // 0000 0001 0011
+ { 2112, 12, 0x14 }, // 0000 0001 0100
+ { 2176, 12, 0x15 }, // 0000 0001 0101
+ { 2240, 12, 0x16 }, // 0000 0001 0110
+ { 2304, 12, 0x17 }, // 0000 0001 0111
+ { 2368, 12, 0x1C }, // 0000 0001 1100
+ { 2432, 12, 0x1D }, // 0000 0001 1101
+ { 2496, 12, 0x1E }, // 0000 0001 1110
+ { 2560, 12, 0x1F } // 0000 0001 1111
+};
+
+static const PixelCode BlackPixelCodes[] =
+{
+ { 0, 10, 0x37 }, // 0000 1101 11
+ { 1, 3, 0x2 }, // 010
+ { 2, 2, 0x3 }, // 11
+ { 3, 2, 0x2 }, // 10
+ { 4, 3, 0x3 }, // 011
+ { 5, 4, 0x3 }, // 0011
+ { 6, 4, 0x2 }, // 0010
+ { 7, 5, 0x3 }, // 0001 1
+ { 8, 6, 0x5 }, // 0001 01
+ { 9, 6, 0x4 }, // 0001 00
+ { 10, 7, 0x4 }, // 0000 100
+ { 11, 7, 0x5 }, // 0000 101
+ { 12, 7, 0x7 }, // 0000 111
+ { 13, 8, 0x4 }, // 0000 0100
+ { 14, 8, 0x7 }, // 0000 0111
+ { 15, 9, 0x18 }, // 0000 1100 0
+ { 16, 10, 0x17 }, // 0000 0101 11
+ { 17, 10, 0x18 }, // 0000 0110 00
+ { 18, 10, 0x8 }, // 0000 0010 00
+ { 19, 11, 0x67 }, // 0000 1100 111
+ { 20, 11, 0x68 }, // 0000 1101 000
+ { 21, 11, 0x6C }, // 0000 1101 100
+ { 22, 11, 0x37 }, // 0000 0110 111
+ { 23, 11, 0x28 }, // 0000 0101 000
+ { 24, 11, 0x17 }, // 0000 0010 111
+ { 25, 11, 0x18 }, // 0000 0011 000
+ { 26, 12, 0xCA }, // 0000 1100 1010
+ { 27, 12, 0xCB }, // 0000 1100 1011
+ { 28, 12, 0xCC }, // 0000 1100 1100
+ { 29, 12, 0xCD }, // 0000 1100 1101
+ { 30, 12, 0x68 }, // 0000 0110 1000
+ { 31, 12, 0x69 }, // 0000 0110 1001
+ { 32, 12, 0x6A }, // 0000 0110 1010
+ { 33, 12, 0x6B }, // 0000 0110 1011
+ { 34, 12, 0xD2 }, // 0000 1101 0010
+ { 35, 12, 0xD3 }, // 0000 1101 0011
+ { 36, 12, 0xD4 }, // 0000 1101 0100
+ { 37, 12, 0xD5 }, // 0000 1101 0101
+ { 38, 12, 0xD6 }, // 0000 1101 0110
+ { 39, 12, 0xD7 }, // 0000 1101 0111
+ { 40, 12, 0x6C }, // 0000 0110 1100
+ { 41, 12, 0x6D }, // 0000 0110 1101
+ { 42, 12, 0xDA }, // 0000 1101 1010
+ { 43, 12, 0xDB }, // 0000 1101 1011
+ { 44, 12, 0x54 }, // 0000 0101 0100
+ { 45, 12, 0x55 }, // 0000 0101 0101
+ { 46, 12, 0x56 }, // 0000 0101 0110
+ { 47, 12, 0x57 }, // 0000 0101 0111
+ { 48, 12, 0x64 }, // 0000 0110 0100
+ { 49, 12, 0x65 }, // 0000 0110 0101
+ { 50, 12, 0x52 }, // 0000 0101 0010
+ { 51, 12, 0x53 }, // 0000 0101 0011
+ { 52, 12, 0x24 }, // 0000 0010 0100
+ { 53, 12, 0x37 }, // 0000 0011 0111
+ { 54, 12, 0x38 }, // 0000 0011 1000
+ { 55, 12, 0x27 }, // 0000 0010 0111
+ { 56, 12, 0x28 }, // 0000 0010 1000
+ { 57, 12, 0x58 }, // 0000 0101 1000
+ { 58, 12, 0x59 }, // 0000 0101 1001
+ { 59, 12, 0x2B }, // 0000 0010 1011
+ { 60, 12, 0x2C }, // 0000 0010 1100
+ { 61, 12, 0x5A }, // 0000 0101 1010
+ { 62, 12, 0x66 }, // 0000 0110 0110
+ { 63, 12, 0x67 }, // 0000 0110 0111
+ { 64, 10, 0xF }, // 0000 0011 11
+ { 128, 12, 0xC8 }, // 0000 1100 1000
+ { 192, 12, 0xC9 }, // 0000 1100 1001
+ { 256, 12, 0x5B }, // 0000 0101 1011
+ { 320, 12, 0x33 }, // 0000 0011 0011
+ { 384, 12, 0x34 }, // 0000 0011 0100
+ { 448, 12, 0x35 }, // 0000 0011 0101
+ { 512, 13, 0x6C }, // 0000 0011 0110 0
+ { 576, 13, 0x6D }, // 0000 0011 0110 1
+ { 640, 13, 0x4A }, // 0000 0010 0101 0
+ { 704, 13, 0x4B }, // 0000 0010 0101 1
+ { 768, 13, 0x4C }, // 0000 0010 0110 0
+ { 832, 13, 0x4D }, // 0000 0010 0110 1
+ { 896, 13, 0x72 }, // 0000 0011 1001 0
+ { 960, 13, 0x73 }, // 0000 0011 1001 1
+ { 1024, 13, 0x74 }, // 0000 0011 1010 0
+ { 1088, 13, 0x75 }, // 0000 0011 1010 1
+ { 1152, 13, 0x76 }, // 0000 0011 1011 0
+ { 1216, 13, 0x77 }, // 0000 0011 1011 1
+ { 1280, 13, 0x52 }, // 0000 0010 1001 0
+ { 1344, 13, 0x53 }, // 0000 0010 1001 1
+ { 1408, 13, 0x54 }, // 0000 0010 1010 0
+ { 1472, 13, 0x55 }, // 0000 0010 1010 1
+ { 1536, 13, 0x5A }, // 0000 0010 1101 0
+ { 1600, 13, 0x5B }, // 0000 0010 1101 1
+ { 1664, 13, 0x64 }, // 0000 0011 0010 0
+ { 1728, 13, 0x65 }, // 0000 0011 0010 1
+ { 1792, 11, 0x8 }, // 0000 0001 000
+ { 1856, 11, 0xC }, // 0000 0001 100
+ { 1920, 11, 0xD }, // 0000 0001 101
+ { 1984, 12, 0x12 }, // 0000 0001 0010
+ { 2048, 12, 0x13 }, // 0000 0001 0011
+ { 2112, 12, 0x14 }, // 0000 0001 0100
+ { 2176, 12, 0x15 }, // 0000 0001 0101
+ { 2240, 12, 0x16 }, // 0000 0001 0110
+ { 2304, 12, 0x17 }, // 0000 0001 0111
+ { 2368, 12, 0x1C }, // 0000 0001 1100
+ { 2432, 12, 0x1D }, // 0000 0001 1101
+ { 2496, 12, 0x1E }, // 0000 0001 1110
+ { 2560, 12, 0x1F } // 0000 0001 1111
+};
+
+
+void PDFWriterImpl::putG4Span( long i_nSpan, bool i_bWhitePixel, BitStreamState& io_rState )
+{
+ const PixelCode* pTable = i_bWhitePixel ? WhitePixelCodes : BlackPixelCodes;
+ // maximum encoded span is 2560 consecutive pixels
+ while( i_nSpan > 2623 )
+ {
+ // write 2560 bits, that is entry (63 + (2560 >> 6)) == 103 in the appropriate table
+ putG4Bits( pTable[103].mnCodeBits, pTable[103].mnCode, io_rState );
+ i_nSpan -= pTable[103].mnEncodedPixels;
+ }
+ // write multiples of 64 pixels up to 2560
+ if( i_nSpan > 63 )
+ {
+ sal_uInt32 nTabIndex = 63 + (i_nSpan >> 6);
+ OSL_ASSERT( pTable[nTabIndex].mnEncodedPixels == static_cast<sal_uInt32>(64*(i_nSpan >> 6)) );
+ putG4Bits( pTable[nTabIndex].mnCodeBits, pTable[nTabIndex].mnCode, io_rState );
+ i_nSpan -= pTable[nTabIndex].mnEncodedPixels;
+ }
+ putG4Bits( pTable[i_nSpan].mnCodeBits, pTable[i_nSpan].mnCode, io_rState );
+}
+
+void PDFWriterImpl::writeG4Stream( BitmapReadAccess* i_pBitmap )
+{
+ long nW = i_pBitmap->Width();
+ long nH = i_pBitmap->Height();
+ if( nW <= 0 || nH <= 0 )
+ return;
+ if( i_pBitmap->GetBitCount() != 1 )
+ return;
+
+ BitStreamState aBitState;
+
+ // the first reference line is virtual and completely empty
+ const Scanline pFirstRefLine = (Scanline)rtl_allocateZeroMemory( nW/8 + 1 );
+ Scanline pRefLine = pFirstRefLine;
+ for( long nY = 0; nY < nH; nY++ )
+ {
+ const Scanline pCurLine = i_pBitmap->GetScanline( nY );
+ long nLineIndex = 0;
+ bool bRunSet = (*pCurLine & 0x80) ? true : false;
+ bool bRefSet = (*pRefLine & 0x80) ? true : false;
+ long nRunIndex1 = bRunSet ? 0 : findBitRun( pCurLine, 0, nW, bRunSet );
+ long nRefIndex1 = bRefSet ? 0 : findBitRun( pRefLine, 0, nW, bRefSet );
+ for( ; nLineIndex < nW; )
+ {
+ long nRefIndex2 = findBitRun( pRefLine, nRefIndex1, nW, isSet( pRefLine, nRefIndex1 ) );
+ if( nRefIndex2 >= nRunIndex1 )
+ {
+ long nDiff = nRefIndex1 - nRunIndex1;
+ if( -3 <= nDiff && nDiff <= 3 )
+ { // vertical coding
+ static const struct
+ {
+ sal_uInt32 mnCodeBits;
+ sal_uInt32 mnCode;
+ } VerticalCodes[7] = {
+ { 7, 0x03 }, // 0000 011
+ { 6, 0x03 }, // 0000 11
+ { 3, 0x03 }, // 011
+ { 1, 0x1 }, // 1
+ { 3, 0x2 }, // 010
+ { 6, 0x02 }, // 0000 10
+ { 7, 0x02 } // 0000 010
+ };
+ // convert to index
+ nDiff += 3;
+
+ // emit diff code
+ putG4Bits( VerticalCodes[nDiff].mnCodeBits, VerticalCodes[nDiff].mnCode, aBitState );
+ nLineIndex = nRunIndex1;
+ }
+ else
+ { // difference too large, horizontal coding
+ // emit horz code 001
+ putG4Bits( 3, 0x1, aBitState );
+ long nRunIndex2 = findBitRun( pCurLine, nRunIndex1, nW, isSet( pCurLine, nRunIndex1 ) );
+ bool bWhiteFirst = ( nLineIndex + nRunIndex1 == 0 || ! isSet( pCurLine, nLineIndex ) );
+ putG4Span( nRunIndex1 - nLineIndex, bWhiteFirst, aBitState );
+ putG4Span( nRunIndex2 - nRunIndex1, ! bWhiteFirst, aBitState );
+ nLineIndex = nRunIndex2;
+ }
+ }
+ else
+ { // emit pass code 0001
+ putG4Bits( 4, 0x1, aBitState );
+ nLineIndex = nRefIndex2;
+ }
+ if( nLineIndex < nW )
+ {
+ bool bSet = isSet( pCurLine, nLineIndex );
+ nRunIndex1 = findBitRun( pCurLine, nLineIndex, nW, bSet );
+ nRefIndex1 = findBitRun( pRefLine, nLineIndex, nW, ! bSet );
+ nRefIndex1 = findBitRun( pRefLine, nRefIndex1, nW, bSet );
+ }
+ }
+
+ // the current line is the reference for the next line
+ pRefLine = pCurLine;
+ }
+ // terminate strip with EOFB
+ putG4Bits( 12, 1, aBitState );
+ putG4Bits( 12, 1, aBitState );
+ if( aBitState.mnNextBitPos != 8 )
+ {
+ writeBuffer( aBitState.getByte(), 1 );
+ aBitState.flush();
+ }
+
+ rtl_freeMemory( pFirstRefLine );
+}
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index c00dfd7635ae..e5e19dff3771 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -41,6 +41,7 @@
#include <vcl/unohelp.hxx>
#include <tools/debug.hxx>
+#include <tools/resary.hxx>
#include <tools/stream.hxx>
#include <tools/vcompat.hxx>
#include <vcl/svdata.hxx>
@@ -54,6 +55,7 @@
#include <vcl/gdimtf.hxx>
#include <vcl/metaact.hxx>
#include <vcl/print.hxx>
+#include <vcl/svids.hrc>
#include <comphelper/processfactory.hxx>
@@ -1280,6 +1282,48 @@ int Printer::GetPaperInfoCount() const
// -----------------------------------------------------------------------
+rtl::OUString Printer::GetPaperName( Paper ePaper )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ if( ! pSVData->mpPaperNames )
+ {
+ pSVData->mpPaperNames = new std::hash_map< int, rtl::OUString >();
+ if( ImplGetResMgr() )
+ {
+ ResStringArray aPaperStrings( VclResId( RID_STR_PAPERNAMES ) );
+ static const int PaperIndex[] =
+ {
+ PAPER_A0, PAPER_A1, PAPER_A2, PAPER_A3, PAPER_A4, PAPER_A5,
+ PAPER_B4_ISO, PAPER_B5_ISO, PAPER_LETTER, PAPER_LEGAL, PAPER_TABLOID,
+ PAPER_USER, PAPER_B6_ISO, PAPER_ENV_C4, PAPER_ENV_C5, PAPER_ENV_C6, PAPER_ENV_C65,
+ PAPER_ENV_DL, PAPER_SLIDE_DIA, PAPER_SCREEN, PAPER_C, PAPER_D, PAPER_E,
+ PAPER_EXECUTIVE, PAPER_FANFOLD_LEGAL_DE, PAPER_ENV_MONARCH, PAPER_ENV_PERSONAL,
+ PAPER_ENV_9, PAPER_ENV_10, PAPER_ENV_11, PAPER_ENV_12, PAPER_KAI16,
+ PAPER_KAI32, PAPER_KAI32BIG, PAPER_B4_JIS, PAPER_B5_JIS, PAPER_B6_JIS
+ };
+ OSL_ENSURE( sal_uInt32(sizeof(PaperIndex)/sizeof(PaperIndex[0])) == aPaperStrings.Count(), "localized paper name count wrong" );
+ for( int i = 0; i < int(sizeof(PaperIndex)/sizeof(PaperIndex[0])); i++ )
+ (*pSVData->mpPaperNames)[PaperIndex[i]] = aPaperStrings.GetString(i);
+ }
+ }
+
+ std::hash_map<int,rtl::OUString>::const_iterator it = pSVData->mpPaperNames->find( (int)ePaper );
+ return (it != pSVData->mpPaperNames->end()) ? it->second : rtl::OUString();
+}
+
+// -----------------------------------------------------------------------
+
+rtl::OUString Printer::GetPaperName( bool i_bPaperUser ) const
+{
+ Size aPageSize = PixelToLogic( GetPaperSizePixel(), MAP_100TH_MM );
+ Paper ePaper = ImplGetPaperFormat( aPageSize.Width(), aPageSize.Height() );
+ if( ePaper == PAPER_USER )
+ ePaper = ImplGetPaperFormat( aPageSize.Height(), aPageSize.Width() );
+ return (ePaper != PAPER_USER || i_bPaperUser ) ? GetPaperName( ePaper ) : rtl::OUString();
+}
+
+// -----------------------------------------------------------------------
+
const PaperInfo& Printer::GetPaperInfo( int nPaper ) const
{
if( ! mpInfoPrinter )
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index 3aef3fff046f..28fa8670b8e8 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -883,13 +883,12 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
++nActionNum;
}
- ConnectedComponentsList aCCList; // list containing distinct sets of connected components as elements.
+ // clean up aMapModeVDev
+ sal_uInt32 nCount = aMapModeVDev.GetGCStackDepth();
+ while( nCount-- )
+ aMapModeVDev.Pop();
- // create an OutputDevice to record mapmode changes and the like
- VirtualDevice aMapModeVDev2;
- aMapModeVDev2.mnDPIX = mnDPIX;
- aMapModeVDev2.mnDPIY = mnDPIY;
- aMapModeVDev2.EnableOutput(sal_False);
+ ConnectedComponentsList aCCList; // list containing distinct sets of connected components as elements.
// fast-forward until one after the last background action
// (need to reconstruct map mode vdev state)
@@ -904,7 +903,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
pCurrAct, nActionNum) );
// execute action to get correct MapModes etc.
- pCurrAct->Execute( &aMapModeVDev2 );
+ pCurrAct->Execute( &aMapModeVDev );
pCurrAct=const_cast<GDIMetaFile&>(rInMtf).NextAction();
++nActionNum;
}
@@ -921,10 +920,10 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
pCurrAct=const_cast<GDIMetaFile&>(rInMtf).NextAction(), ++nActionNum )
{
// execute action to get correct MapModes etc.
- pCurrAct->Execute( &aMapModeVDev2 );
+ pCurrAct->Execute( &aMapModeVDev );
// cache bounds of current action
- const Rectangle aBBCurrAct( ImplCalcActionBounds(*pCurrAct, aMapModeVDev2) );
+ const Rectangle aBBCurrAct( ImplCalcActionBounds(*pCurrAct, aMapModeVDev) );
// accumulate collected bounds here, initialize with current action
Rectangle aTotalBounds( aBBCurrAct ); // thus,
@@ -953,7 +952,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
// not be considered for connected components,
// too. Just put each of them into a separate
// component.
- aTotalComponents.bIsFullyTransparent = !ImplIsNotTransparent(*pCurrAct, aMapModeVDev2);
+ aTotalComponents.bIsFullyTransparent = !ImplIsNotTransparent(*pCurrAct, aMapModeVDev);
if( !aBBCurrAct.IsEmpty() &&
!aTotalComponents.bIsFullyTransparent )
@@ -1339,18 +1338,16 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
}
}
+ // clean up aMapModeVDev
+ nCount = aMapModeVDev.GetGCStackDepth();
+ while( nCount-- )
+ aMapModeVDev.Pop();
+
//
// STAGE 4: Copy actions to output metafile
// ========================================
//
- // create an OutputDevice to record color settings, mapmode
- // changes and the like
- VirtualDevice aMapModeVDev3;
- aMapModeVDev3.mnDPIX = mnDPIX;
- aMapModeVDev3.mnDPIY = mnDPIY;
- aMapModeVDev3.EnableOutput(sal_False);
-
// iterate over all actions and duplicate the ones not in a
// special aCCList member into rOutMtf
for( pCurrAct=const_cast<GDIMetaFile&>(rInMtf).FirstAction(), nActionNum=0;
@@ -1378,7 +1375,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
// given background color
ImplConvertTransparentAction(rOutMtf,
*pCurrAct,
- aMapModeVDev3,
+ aMapModeVDev,
aBackgroundComponent.aBgColor);
}
else
@@ -1387,7 +1384,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
rOutMtf.AddAction( ( pCurrAct->Duplicate(), pCurrAct ) );
}
- pCurrAct->Execute(&aMapModeVDev3);
+ pCurrAct->Execute(&aMapModeVDev);
}
}
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index 34276fafdfe5..3873cdc6cb14 100755
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -333,26 +333,13 @@ void Printer::ImplPrintJob( const boost::shared_ptr<PrinterController>& i_pContr
// setup printer
- // if no specific printer is already set, create one
-
- // #i108686#
- // in case of a UI (platform independent or system dialog) print job, make the printer persistent over jobs
- // however if no printer was already set by the print job's originator,
- // and this is an API job, then use the system default location (because
- // this is the only sensible default available if the user has no means of changing
- // the destination
+ // #i114306# changed behavior back from persistence
+ // if no specific printer is already set, create the default printer
if( ! pController->getPrinter() )
{
rtl::OUString aPrinterName( i_rInitSetup.GetPrinterName() );
- if( ! aPrinterName.getLength() && pController->isShowDialogs() && ! pController->isDirectPrint() )
- {
- // get printer name from configuration
- SettingsConfigItem* pItem = SettingsConfigItem::get();
- aPrinterName = pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LastPrinterUsed" ) ) );
- }
-
boost::shared_ptr<Printer> pPrinter( new Printer( aPrinterName ) );
+ pPrinter->SetJobSetup( i_rInitSetup );
pController->setPrinter( pPrinter );
}
@@ -399,17 +386,25 @@ void Printer::ImplPrintJob( const boost::shared_ptr<PrinterController>& i_pContr
{
if( nContent == 0 )
{
- sal_Int32 nPages = i_pController->getPageCount();
- if( nPages > 0 )
+ // do not overwrite PageRange if it is already set
+ beans::PropertyValue* pRangeVal = i_pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ) );
+ rtl::OUString aRange;
+ if( pRangeVal )
+ pRangeVal->Value >>= aRange;
+ if( aRange.getLength() == 0 )
{
- rtl::OUStringBuffer aBuf( 32 );
- aBuf.appendAscii( "1" );
- if( nPages > 1 )
+ sal_Int32 nPages = i_pController->getPageCount();
+ if( nPages > 0 )
{
- aBuf.appendAscii( "-" );
- aBuf.append( nPages );
+ rtl::OUStringBuffer aBuf( 32 );
+ aBuf.appendAscii( "1" );
+ if( nPages > 1 )
+ {
+ aBuf.appendAscii( "-" );
+ aBuf.append( nPages );
+ }
+ i_pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ), makeAny( aBuf.makeStringAndClear() ) );
}
- i_pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ), makeAny( aBuf.makeStringAndClear() ) );
}
}
}
diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx
index cab1b6610d26..96e67aaabffa 100644..100755
--- a/vcl/source/gdi/region.cxx
+++ b/vcl/source/gdi/region.cxx
@@ -46,6 +46,8 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolygonclipper.hxx>
+#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
#include <basegfx/range/b2drange.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
@@ -1376,6 +1378,28 @@ sal_Bool Region::Union( const Rectangle& rRect )
if ( rRect.IsEmpty() )
return sal_True;
+ if( HasPolyPolygon() )
+ {
+ // get this B2DPolyPolygon
+ basegfx::B2DPolyPolygon aThisPolyPoly( ConvertToB2DPolyPolygon() );
+ aThisPolyPoly = basegfx::tools::prepareForPolygonOperation( aThisPolyPoly );
+
+ if( aThisPolyPoly.count() == 0 )
+ {
+ *this = rRect;
+ return true;
+ }
+
+ // get the other B2DPolyPolygon
+ basegfx::B2DPolygon aRectPoly( basegfx::tools::createPolygonFromRect( basegfx::B2DRectangle( rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom() ) ) );
+ basegfx::B2DPolyPolygon aOtherPolyPoly( aRectPoly );
+
+ basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationOr( aThisPolyPoly, aOtherPolyPoly );
+ *this = Region( aClip );
+
+ return sal_True;
+ }
+
ImplPolyPolyRegionToBandRegion();
// no instance data? -> create!
@@ -1446,6 +1470,22 @@ sal_Bool Region::Intersect( const Rectangle& rRect )
return sal_True;
}
+ else if( mpImplRegion->mpB2DPolyPoly )
+ {
+ // #127431# make ImplRegion unique, if not already.
+ if( mpImplRegion->mnRefCount > 1 )
+ {
+ mpImplRegion->mnRefCount--;
+ mpImplRegion = new ImplRegion( *mpImplRegion->mpB2DPolyPoly );
+ }
+
+ *mpImplRegion->mpB2DPolyPoly =
+ basegfx::tools::clipPolyPolygonOnRange( *mpImplRegion->mpB2DPolyPoly,
+ basegfx::B2DRange( rRect.Left(), rRect.Top(),
+ rRect.Right(), rRect.Bottom() ),
+ true, false );
+ return sal_True;
+ }
else
ImplPolyPolyRegionToBandRegion();
@@ -1529,6 +1569,25 @@ sal_Bool Region::Exclude( const Rectangle& rRect )
if ( rRect.IsEmpty() )
return sal_True;
+ if( HasPolyPolygon() )
+ {
+ // get this B2DPolyPolygon
+ basegfx::B2DPolyPolygon aThisPolyPoly( ConvertToB2DPolyPolygon() );
+ aThisPolyPoly = basegfx::tools::prepareForPolygonOperation( aThisPolyPoly );
+
+ if( aThisPolyPoly.count() == 0 )
+ return sal_True;
+
+ // get the other B2DPolyPolygon
+ basegfx::B2DPolygon aRectPoly( basegfx::tools::createPolygonFromRect( basegfx::B2DRectangle( rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom() ) ) );
+ basegfx::B2DPolyPolygon aOtherPolyPoly( aRectPoly );
+
+ basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationDiff( aThisPolyPoly, aOtherPolyPoly );
+ *this = Region( aClip );
+
+ return sal_True;
+ }
+
ImplPolyPolyRegionToBandRegion();
// no instance data? -> create!
@@ -1571,6 +1630,28 @@ sal_Bool Region::XOr( const Rectangle& rRect )
if ( rRect.IsEmpty() )
return sal_True;
+ if( HasPolyPolygon() )
+ {
+ // get this B2DPolyPolygon
+ basegfx::B2DPolyPolygon aThisPolyPoly( ConvertToB2DPolyPolygon() );
+ aThisPolyPoly = basegfx::tools::prepareForPolygonOperation( aThisPolyPoly );
+
+ if( aThisPolyPoly.count() == 0 )
+ {
+ *this = rRect;
+ return sal_True;
+ }
+
+ // get the other B2DPolyPolygon
+ basegfx::B2DPolygon aRectPoly( basegfx::tools::createPolygonFromRect( basegfx::B2DRectangle( rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom() ) ) );
+ basegfx::B2DPolyPolygon aOtherPolyPoly( aRectPoly );
+
+ basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationXor( aThisPolyPoly, aOtherPolyPoly );
+ *this = Region( aClip );
+
+ return sal_True;
+ }
+
ImplPolyPolyRegionToBandRegion();
// no instance data? -> create!
@@ -1604,11 +1685,38 @@ sal_Bool Region::XOr( const Rectangle& rRect )
}
// -----------------------------------------------------------------------
+void Region::ImplUnionPolyPolygon( const Region& i_rRegion )
+{
+ // get this B2DPolyPolygon
+ basegfx::B2DPolyPolygon aThisPolyPoly( ConvertToB2DPolyPolygon() );
+ aThisPolyPoly = basegfx::tools::prepareForPolygonOperation( aThisPolyPoly );
+
+ if( aThisPolyPoly.count() == 0 )
+ {
+ *this = i_rRegion;
+ return;
+ }
+
+ // get the other B2DPolyPolygon
+ basegfx::B2DPolyPolygon aOtherPolyPoly( const_cast<Region&>(i_rRegion).ConvertToB2DPolyPolygon() );
+ aOtherPolyPoly = basegfx::tools::prepareForPolygonOperation( aOtherPolyPoly );
+
+
+ basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationOr( aThisPolyPoly, aOtherPolyPoly );
+
+ *this = Region( aClip );
+}
sal_Bool Region::Union( const Region& rRegion )
{
DBG_CHKTHIS( Region, ImplDbgTestRegion );
+ if( rRegion.HasPolyPolygon() || HasPolyPolygon() )
+ {
+ ImplUnionPolyPolygon( rRegion );
+ return sal_True;
+ }
+
ImplPolyPolyRegionToBandRegion();
((Region*)&rRegion)->ImplPolyPolyRegionToBandRegion();
@@ -1654,6 +1762,22 @@ sal_Bool Region::Union( const Region& rRegion )
}
// -----------------------------------------------------------------------
+void Region::ImplIntersectWithPolyPolygon( const Region& i_rRegion )
+{
+ // get this B2DPolyPolygon
+ basegfx::B2DPolyPolygon aThisPolyPoly( ConvertToB2DPolyPolygon() );
+ if( aThisPolyPoly.count() == 0 )
+ {
+ *this = i_rRegion;
+ return;
+ }
+
+ // get the other B2DPolyPolygon
+ basegfx::B2DPolyPolygon aOtherPolyPoly( const_cast<Region&>(i_rRegion).ConvertToB2DPolyPolygon() );
+
+ basegfx::B2DPolyPolygon aClip = basegfx::tools::clipPolyPolygonOnPolyPolygon( aOtherPolyPoly, aThisPolyPoly, true, false );
+ *this = Region( aClip );
+}
sal_Bool Region::Intersect( const Region& rRegion )
{
@@ -1663,6 +1787,12 @@ sal_Bool Region::Intersect( const Region& rRegion )
if ( mpImplRegion == rRegion.mpImplRegion )
return sal_True;
+ if( rRegion.HasPolyPolygon() || HasPolyPolygon() )
+ {
+ ImplIntersectWithPolyPolygon( rRegion );
+ return sal_True;
+ }
+
ImplPolyPolyRegionToBandRegion();
((Region*)&rRegion)->ImplPolyPolyRegionToBandRegion();
@@ -1793,11 +1923,32 @@ sal_Bool Region::Intersect( const Region& rRegion )
}
// -----------------------------------------------------------------------
+void Region::ImplExcludePolyPolygon( const Region& i_rRegion )
+{
+ // get this B2DPolyPolygon
+ basegfx::B2DPolyPolygon aThisPolyPoly( ConvertToB2DPolyPolygon() );
+ if( aThisPolyPoly.count() == 0 )
+ return;
+ aThisPolyPoly = basegfx::tools::prepareForPolygonOperation( aThisPolyPoly );
+
+ // get the other B2DPolyPolygon
+ basegfx::B2DPolyPolygon aOtherPolyPoly( const_cast<Region&>(i_rRegion).ConvertToB2DPolyPolygon() );
+ aOtherPolyPoly = basegfx::tools::prepareForPolygonOperation( aOtherPolyPoly );
+
+ basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationDiff( aThisPolyPoly, aOtherPolyPoly );
+ *this = Region( aClip );
+}
sal_Bool Region::Exclude( const Region& rRegion )
{
DBG_CHKTHIS( Region, ImplDbgTestRegion );
+ if( rRegion.HasPolyPolygon() || HasPolyPolygon() )
+ {
+ ImplExcludePolyPolygon( rRegion );
+ return sal_True;
+ }
+
ImplPolyPolyRegionToBandRegion();
((Region*)&rRegion)->ImplPolyPolyRegionToBandRegion();
@@ -1846,11 +1997,35 @@ sal_Bool Region::Exclude( const Region& rRegion )
}
// -----------------------------------------------------------------------
+void Region::ImplXOrPolyPolygon( const Region& i_rRegion )
+{
+ // get this B2DPolyPolygon
+ basegfx::B2DPolyPolygon aThisPolyPoly( ConvertToB2DPolyPolygon() );
+ if( aThisPolyPoly.count() == 0 )
+ {
+ *this = i_rRegion;
+ return;
+ }
+ aThisPolyPoly = basegfx::tools::prepareForPolygonOperation( aThisPolyPoly );
+
+ // get the other B2DPolyPolygon
+ basegfx::B2DPolyPolygon aOtherPolyPoly( const_cast<Region&>(i_rRegion).ConvertToB2DPolyPolygon() );
+ aOtherPolyPoly = basegfx::tools::prepareForPolygonOperation( aOtherPolyPoly );
+
+ basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationXor( aThisPolyPoly, aOtherPolyPoly );
+ *this = Region( aClip );
+}
sal_Bool Region::XOr( const Region& rRegion )
{
DBG_CHKTHIS( Region, ImplDbgTestRegion );
+ if( rRegion.HasPolyPolygon() || HasPolyPolygon() )
+ {
+ ImplXOrPolyPolygon( rRegion );
+ return sal_True;
+ }
+
ImplPolyPolyRegionToBandRegion();
((Region*)&rRegion)->ImplPolyPolyRegionToBandRegion();
@@ -2031,7 +2206,7 @@ basegfx::B2DPolyPolygon Region::ConvertToB2DPolyPolygon()
// -----------------------------------------------------------------------
-sal_Bool Region::ImplGetFirstRect( ImplRegionInfo& rImplRegionInfo,
+bool Region::ImplGetFirstRect( ImplRegionInfo& rImplRegionInfo,
long& rX, long& rY,
long& rWidth, long& rHeight ) const
{
@@ -2041,11 +2216,11 @@ sal_Bool Region::ImplGetFirstRect( ImplRegionInfo& rImplRegionInfo,
// no internal data? -> region is empty!
if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) )
- return sal_False;
+ return false;
// no band in the list? -> region is empty!
if ( mpImplRegion->mpFirstBand == NULL )
- return sal_False;
+ return false;
// initialise pointer for first access
ImplRegionBand* pCurrRectBand = mpImplRegion->mpFirstBand;
@@ -2053,7 +2228,7 @@ sal_Bool Region::ImplGetFirstRect( ImplRegionInfo& rImplRegionInfo,
DBG_ASSERT( pCurrRectBandSep != NULL, "Erstes Band wurde nicht optimiert." );
if ( !pCurrRectBandSep )
- return sal_False;
+ return false;
// get boundaries of current rectangle
rX = pCurrRectBandSep->mnXLeft;
@@ -2065,12 +2240,12 @@ sal_Bool Region::ImplGetFirstRect( ImplRegionInfo& rImplRegionInfo,
rImplRegionInfo.mpVoidCurrRectBand = (void*)pCurrRectBand;
rImplRegionInfo.mpVoidCurrRectBandSep = (void*)pCurrRectBandSep;
- return sal_True;
+ return true;
}
// -----------------------------------------------------------------------
-sal_Bool Region::ImplGetNextRect( ImplRegionInfo& rImplRegionInfo,
+bool Region::ImplGetNextRect( ImplRegionInfo& rImplRegionInfo,
long& rX, long& rY,
long& rWidth, long& rHeight ) const
{
@@ -2078,7 +2253,7 @@ sal_Bool Region::ImplGetNextRect( ImplRegionInfo& rImplRegionInfo,
// no internal data? -> region is empty!
if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) )
- return sal_False;
+ return false;
// get last pointers
ImplRegionBand* pCurrRectBand = (ImplRegionBand*)rImplRegionInfo.mpVoidCurrRectBand;
@@ -2095,7 +2270,7 @@ sal_Bool Region::ImplGetNextRect( ImplRegionInfo& rImplRegionInfo,
// no band found? -> not further rectangles!
if( !pCurrRectBand )
- return sal_False;
+ return false;
// get first separation in current band
pCurrRectBandSep = pCurrRectBand->mpFirstSep;
@@ -2111,7 +2286,7 @@ sal_Bool Region::ImplGetNextRect( ImplRegionInfo& rImplRegionInfo,
rImplRegionInfo.mpVoidCurrRectBand = (void*)pCurrRectBand;
rImplRegionInfo.mpVoidCurrRectBandSep = (void*)pCurrRectBandSep;
- return sal_True;
+ return true;
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx
index f3c381147054..9f2ee0924555 100755
--- a/vcl/source/gdi/salgdilayout.cxx
+++ b/vcl/source/gdi/salgdilayout.cxx
@@ -253,14 +253,29 @@ sal_Bool SalGraphics::mirror( sal_uInt32 nPoints, const SalPoint *pPtAry, SalPoi
void SalGraphics::mirror( Region& rRgn, const OutputDevice *pOutDev, bool bBack ) const
{
- // mirror the bounding rect and move Region by resulting offset
- Rectangle aRect( rRgn.GetBoundRect() );
- long nWidth = aRect.GetWidth();
- long x = aRect.Left();
- long x_org = x;
+ if( rRgn.HasPolyPolygon() )
+ {
+ basegfx::B2DPolyPolygon aPolyPoly( rRgn.ConvertToB2DPolyPolygon() );
+ aPolyPoly = mirror( aPolyPoly, pOutDev, bBack );
+ rRgn = Region( aPolyPoly );
+ }
+ else
+ {
+ ImplRegionInfo aInfo;
+ bool bRegionRect;
+ Region aMirroredRegion;
+ long nX, nY, nWidth, nHeight;
- mirror( x, nWidth, pOutDev, bBack );
- rRgn.Move( x - x_org, 0 );
+ bRegionRect = rRgn.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight );
+ while ( bRegionRect )
+ {
+ Rectangle aRect( Point(nX, nY), Size(nWidth, nHeight) );
+ mirror( aRect, pOutDev, bBack );
+ aMirroredRegion.Union( aRect );
+ bRegionRect = rRgn.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight );
+ }
+ rRgn = aMirroredRegion;
+ }
}
void SalGraphics::mirror( Rectangle& rRect, const OutputDevice *pOutDev, bool bBack ) const
@@ -358,22 +373,15 @@ basegfx::B2DPolyPolygon SalGraphics::mirror( const basegfx::B2DPolyPolygon& i_rP
// ----------------------------------------------------------------------------
-sal_Bool SalGraphics::UnionClipRegion( long nX, long nY, long nWidth, long nHeight, const OutputDevice *pOutDev )
+bool SalGraphics::SetClipRegion( const Region& i_rClip, const OutputDevice *pOutDev )
{
if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) )
- mirror( nX, nWidth, pOutDev );
- return unionClipRegion( nX, nY, nWidth, nHeight );
-}
-
-bool SalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& )
-{
- return false;
-}
-
-sal_Bool SalGraphics::UnionClipRegion( const ::basegfx::B2DPolyPolygon& rPoly, const OutputDevice* pOutDev )
-{
- (void)pOutDev;// TODO: SAL_LAYOUT_BIDI_RTL
- return unionClipRegion( rPoly );
+ {
+ Region aMirror( i_rClip );
+ mirror( aMirror, pOutDev );
+ return setClipRegion( aMirror );
+ }
+ return setClipRegion( i_rClip );
}
void SalGraphics::DrawPixel( long nX, long nY, const OutputDevice *pOutDev )
@@ -465,7 +473,7 @@ void SalGraphics::DrawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints,
bool SalGraphics::DrawPolyPolygon( const ::basegfx::B2DPolyPolygon& i_rPolyPolygon, double i_fTransparency, const OutputDevice* i_pOutDev )
{
bool bRet = false;
- if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) )
+ if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (i_pOutDev && i_pOutDev->IsRTLEnabled()) )
{
basegfx::B2DPolyPolygon aMirror( mirror( i_rPolyPolygon, i_pOutDev ) );
bRet = drawPolyPolygon( aMirror, i_fTransparency );
@@ -483,7 +491,7 @@ bool SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double /*fT
sal_Bool SalGraphics::DrawPolyLineBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry, const OutputDevice* pOutDev )
{
sal_Bool bResult = sal_False;
- if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) )
+ if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) )
{
SalPoint* pPtAry2 = new SalPoint[nPoints];
sal_Bool bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev );
@@ -498,7 +506,7 @@ sal_Bool SalGraphics::DrawPolyLineBezier( sal_uLong nPoints, const SalPoint* pPt
sal_Bool SalGraphics::DrawPolygonBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry, const OutputDevice* pOutDev )
{
sal_Bool bResult = sal_False;
- if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) )
+ if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) )
{
SalPoint* pPtAry2 = new SalPoint[nPoints];
sal_Bool bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev );
@@ -514,7 +522,7 @@ sal_Bool SalGraphics::DrawPolyPolygonBezier( sal_uInt32 i_nPoly, const sal_uInt3
const SalPoint* const* i_pPtAry, const sal_uInt8* const* i_pFlgAry, const OutputDevice* i_pOutDev )
{
sal_Bool bRet = sal_False;
- if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) )
+ if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (i_pOutDev && i_pOutDev->IsRTLEnabled()) )
{
// TODO: optimize, reduce new/delete calls
SalPoint **pPtAry2 = new SalPoint*[i_nPoly];
@@ -542,7 +550,7 @@ bool SalGraphics::DrawPolyLine( const ::basegfx::B2DPolygon& i_rPolygon, double
const OutputDevice* i_pOutDev )
{
bool bRet = false;
- if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) )
+ if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (i_pOutDev && i_pOutDev->IsRTLEnabled()) )
{
basegfx::B2DPolygon aMirror( mirror( i_rPolygon, i_pOutDev ) );
bRet = drawPolyLine( aMirror, fTransparency, i_rLineWidth, i_eLineJoin );
diff --git a/vcl/source/helper/xconnection.cxx b/vcl/source/helper/xconnection.cxx
index d35e4b30caac..a0cc8c35e5e2 100644
--- a/vcl/source/helper/xconnection.cxx
+++ b/vcl/source/helper/xconnection.cxx
@@ -29,11 +29,18 @@
#include "precompiled_vcl.hxx"
#include "svsys.h"
+#include "rtl/ref.hxx"
#include "vcl/xconnection.hxx"
#include "vcl/svdata.hxx"
#include "vcl/salinst.hxx"
#include "vcl/svapp.hxx"
+namespace {
+
+namespace css = com::sun::star;
+
+}
+
namespace vcl
{
class SolarMutexReleaser
@@ -62,13 +69,9 @@ using namespace com::sun::star::awt;
DisplayConnection::DisplayConnection()
{
- ImplSVData* pSVData = ImplGetSVData();
- pSVData->mpDefInst->SetEventCallback( this, dispatchEvent );
- pSVData->mpDefInst->SetErrorEventCallback( this, dispatchErrorEvent );
-
SalInstance::ConnectionIdentifierType eType;
int nBytes;
- void* pBytes = pSVData->mpDefInst->GetConnectionIdentifier( eType, nBytes );
+ void* pBytes = ImplGetSVData()->mpDefInst->GetConnectionIdentifier( eType, nBytes );
switch( eType )
{
case SalInstance::AsciiCString:
@@ -81,39 +84,54 @@ DisplayConnection::DisplayConnection()
}
DisplayConnection::~DisplayConnection()
+{}
+
+void DisplayConnection::start()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ pSVData->mpDefInst->SetEventCallback( this );
+}
+
+void DisplayConnection::terminate()
{
ImplSVData* pSVData = ImplGetSVData();
if( pSVData )
{
- pSVData->mpDefInst->SetEventCallback( NULL, NULL );
- pSVData->mpDefInst->SetErrorEventCallback( NULL, NULL );
+ pSVData->mpDefInst->SetEventCallback( NULL );
}
-}
+ SolarMutexReleaser aRel;
+
+ MutexGuard aGuard( m_aMutex );
+ Any aEvent;
+ std::list< css::uno::Reference< XEventHandler > > aLocalList( m_aHandlers );
+ for( ::std::list< css::uno::Reference< XEventHandler > >::const_iterator it = aLocalList.begin(); it != aLocalList.end(); ++it )
+ (*it)->handleEvent( aEvent );
+}
-void SAL_CALL DisplayConnection::addEventHandler( const Any& /*window*/, const Reference< XEventHandler >& handler, sal_Int32 /*eventMask*/ ) throw()
+void SAL_CALL DisplayConnection::addEventHandler( const Any& /*window*/, const css::uno::Reference< XEventHandler >& handler, sal_Int32 /*eventMask*/ ) throw()
{
MutexGuard aGuard( m_aMutex );
m_aHandlers.push_back( handler );
}
-void SAL_CALL DisplayConnection::removeEventHandler( const Any& /*window*/, const Reference< XEventHandler >& handler ) throw()
+void SAL_CALL DisplayConnection::removeEventHandler( const Any& /*window*/, const css::uno::Reference< XEventHandler >& handler ) throw()
{
MutexGuard aGuard( m_aMutex );
m_aHandlers.remove( handler );
}
-void SAL_CALL DisplayConnection::addErrorHandler( const Reference< XEventHandler >& handler ) throw()
+void SAL_CALL DisplayConnection::addErrorHandler( const css::uno::Reference< XEventHandler >& handler ) throw()
{
MutexGuard aGuard( m_aMutex );
m_aErrorHandlers.push_back( handler );
}
-void SAL_CALL DisplayConnection::removeErrorHandler( const Reference< XEventHandler >& handler ) throw()
+void SAL_CALL DisplayConnection::removeErrorHandler( const css::uno::Reference< XEventHandler >& handler ) throw()
{
MutexGuard aGuard( m_aMutex );
@@ -125,52 +143,37 @@ Any SAL_CALL DisplayConnection::getIdentifier() throw()
return m_aAny;
}
-void DisplayConnection::dispatchDowningEvent()
-{
- SolarMutexReleaser aRel;
-
- MutexGuard aGuard( m_aMutex );
- Any aEvent;
- std::list< Reference< XEventHandler > > aLocalList( m_aHandlers );
- for( ::std::list< Reference< XEventHandler > >::const_iterator it = aLocalList.begin(); it != aLocalList.end(); ++it )
- (*it)->handleEvent( aEvent );
-}
-
-bool DisplayConnection::dispatchEvent( void* pThis, void* pData, int nBytes )
+bool DisplayConnection::dispatchEvent( void* pData, int nBytes )
{
SolarMutexReleaser aRel;
- DisplayConnection* This = (DisplayConnection*)pThis;
-
Sequence< sal_Int8 > aSeq( (sal_Int8*)pData, nBytes );
Any aEvent;
aEvent <<= aSeq;
- ::std::list< Reference< XEventHandler > > handlers;
+ ::std::list< css::uno::Reference< XEventHandler > > handlers;
{
- MutexGuard aGuard( This->m_aMutex );
- handlers = This->m_aHandlers;
+ MutexGuard aGuard( m_aMutex );
+ handlers = m_aHandlers;
}
- for( ::std::list< Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it )
+ for( ::std::list< css::uno::Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it )
if( (*it)->handleEvent( aEvent ) )
return true;
return false;
}
-bool DisplayConnection::dispatchErrorEvent( void* pThis, void* pData, int nBytes )
+bool DisplayConnection::dispatchErrorEvent( void* pData, int nBytes )
{
SolarMutexReleaser aRel;
- DisplayConnection* This = (DisplayConnection*)pThis;
-
Sequence< sal_Int8 > aSeq( (sal_Int8*)pData, nBytes );
Any aEvent;
aEvent <<= aSeq;
- ::std::list< Reference< XEventHandler > > handlers;
+ ::std::list< css::uno::Reference< XEventHandler > > handlers;
{
- MutexGuard aGuard( This->m_aMutex );
- handlers = This->m_aErrorHandlers;
+ MutexGuard aGuard( m_aMutex );
+ handlers = m_aErrorHandlers;
}
- for( ::std::list< Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it )
+ for( ::std::list< css::uno::Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it )
if( (*it)->handleEvent( aEvent ) )
return true;
diff --git a/vcl/source/src/print.src b/vcl/source/src/print.src
index 04ab77f09288..f41e65f4939f 100644
--- a/vcl/source/src/print.src
+++ b/vcl/source/src/print.src
@@ -412,6 +412,14 @@ ModalDialog SV_DLG_PRINT
{
ImageBitmap = Bitmap { File = "ncollate_h.png" ; };
};
+
+ CheckBox SV_PRINT_OPT_REVERSE
+ {
+ HelpID = ".HelpID:vcl:PrintDialog:OptPage:ToReverse";
+ Pos = MAP_APPFONT( 10, 50 );
+ Size = MAP_APPFONT( 200, 12 );
+ Text [en-US] = "Print in ~reverse page order";
+ };
};
TabPage SV_PRINT_TAB_OPT
@@ -440,13 +448,6 @@ ModalDialog SV_DLG_PRINT
Size = MAP_APPFONT( 200, 12 );
Text [en-US] = "~Create single print jobs for collated output";
};
- CheckBox SV_PRINT_OPT_REVERSE
- {
- HelpID = ".HelpID:vcl:PrintDialog:OptPage:ToReverse";
- Pos = MAP_APPFONT( 10, 50 );
- Size = MAP_APPFONT( 200, 12 );
- Text [en-US] = "Print in ~reverse page order";
- };
};
};
@@ -498,3 +499,48 @@ StringArray SV_PRINT_NATIVE_STRINGS
< "Print selection only"; >;
};
};
+
+StringArray RID_STR_PAPERNAMES
+{
+ ItemList [en-US] =
+ {
+ < "A0"; >;
+ < "A1"; >;
+ < "A2"; >;
+ < "A3"; >;
+ < "A4"; >;
+ < "A5"; >;
+ < "B4 (ISO)"; >;
+ < "B5 (ISO)"; >;
+ < "Letter"; >;
+ < "Legal"; >;
+ < "Tabloid"; >;
+ < "User Defined"; >;
+ < "B6 (ISO)"; >;
+ < "C4 Envelope"; >;
+ < "C5 Envelope"; >;
+ < "C6 Envelope"; >;
+ < "C6/5 Envelope"; >;
+ < "DL Envelope"; >;
+ < "Dia Slide"; >;
+ < "Screen"; >;
+ < "C"; >;
+ < "D"; >;
+ < "E"; >;
+ < "Executive"; >;
+ < "Long Bond"; >;
+ < "#8 (Monarch) Envelope"; >;
+ < "#6 3/4 (Personal) Envelope"; >;
+ < "#9 Envelope"; >;
+ < "#10 Envelope"; >;
+ < "#11 Envelope"; >;
+ < "#12 Envelope"; >;
+ < "16 Kai"; >;
+ < "32 Kai"; >;
+ < "Big 32 Kai"; >;
+ < "B4 (JIS)"; >;
+ < "B5 (JIS)"; >;
+ < "B6 (JIS)"; >;
+ };
+};
+
diff --git a/vcl/source/window/cursor.cxx b/vcl/source/window/cursor.cxx
index 3be6fad02366..c59978077412 100644
--- a/vcl/source/window/cursor.cxx
+++ b/vcl/source/window/cursor.cxx
@@ -171,7 +171,7 @@ void Cursor::ImplRestore()
// -----------------------------------------------------------------------
-void Cursor::ImplShow( sal_Bool bDrawDirect )
+void Cursor::ImplShow( bool bDrawDirect, bool bRestore )
{
if ( mbVisible )
{
@@ -199,10 +199,10 @@ void Cursor::ImplShow( sal_Bool bDrawDirect )
mpData->mpWindow = pWindow;
mpData->mnStyle = mnStyle;
- if ( bDrawDirect )
+ if ( bDrawDirect || bRestore )
ImplDraw();
- if ( !mpWindow )
+ if ( !mpWindow && ! ( ! bDrawDirect && mpData->maTimer.IsActive()) )
{
mpData->maTimer.SetTimeout( pWindow->GetSettings().GetStyleSettings().GetCursorBlinkTime() );
if ( mpData->maTimer.GetTimeout() != STYLE_CURSOR_NOBLINKTIME )
@@ -216,16 +216,16 @@ void Cursor::ImplShow( sal_Bool bDrawDirect )
// -----------------------------------------------------------------------
-void Cursor::ImplHide()
+bool Cursor::ImplHide()
{
+ bool bWasCurVisible = false;
if ( mpData && mpData->mpWindow )
{
+ bWasCurVisible = mpData->mbCurVisible;
if ( mpData->mbCurVisible )
ImplRestore();
-
- mpData->maTimer.Stop();
- mpData->mpWindow = NULL;
}
+ return bWasCurVisible;
}
// -----------------------------------------------------------------------
@@ -329,6 +329,12 @@ void Cursor::Hide()
{
mbVisible = sal_False;
ImplHide();
+
+ if( mpData )
+ {
+ mpData->maTimer.Stop();
+ mpData->mpWindow = NULL;
+ }
}
}
diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index bf4cc231fcc7..32fc4755a62d 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -1120,11 +1120,15 @@ static Window* ImplGetLabelFor( Window* pFrameWindow, WindowType nMyType, Window
return pWindow;
}
-Window* Window::GetLabelFor() const
+Window* Window::GetAccessibleRelationLabelFor() const
{
if ( mpWindowImpl->mbDisableAccessibleLabelForRelation )
return NULL;
+ if ( mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pLabelForWindow )
+ return mpWindowImpl->mpAccessibleInfos->pLabelForWindow;
+
+
Window* pWindow = NULL;
Window* pFrameWindow = ImplGetFrameWindow();
@@ -1205,11 +1209,14 @@ static Window* ImplGetLabeledBy( Window* pFrameWindow, WindowType nMyType, Windo
return pWindow;
}
-Window* Window::GetLabeledBy() const
+Window* Window::GetAccessibleRelationLabeledBy() const
{
if ( mpWindowImpl->mbDisableAccessibleLabeledByRelation )
return NULL;
+ if ( mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pLabeledByWindow )
+ return mpWindowImpl->mpAccessibleInfos->pLabeledByWindow;
+
Window* pWindow = NULL;
Window* pFrameWindow = ImplGetFrameWindow();
@@ -1238,6 +1245,62 @@ Window* Window::GetLabeledBy() const
return pWindow;
}
+Window* Window::GetAccessibleRelationMemberOf() const
+{
+ Window* pWindow = NULL;
+ Window* pFrameWindow = GetParent();
+ if ( !pFrameWindow )
+ {
+ pFrameWindow = ImplGetFrameWindow();
+ }
+ // if( ! ( GetType() == WINDOW_FIXEDTEXT ||
+ if( !( GetType() == WINDOW_FIXEDLINE ||
+ GetType() == WINDOW_GROUPBOX ) )
+ {
+ // search for a control that makes member of this window
+ // it is considered the last fixed line or group box
+ // that comes before this control; with the exception of push buttons
+ // which are labeled only if the fixed line or group box
+ // is directly before the control
+ // get form start and form end and index of this control
+ sal_uInt16 nIndex, nFormStart, nFormEnd;
+ Window* pSWindow = ::ImplFindDlgCtrlWindow( pFrameWindow,
+ const_cast<Window*>(this),
+ nIndex,
+ nFormStart,
+ nFormEnd );
+ if( pSWindow && nIndex != nFormStart )
+ {
+ if( GetType() == WINDOW_PUSHBUTTON ||
+ GetType() == WINDOW_HELPBUTTON ||
+ GetType() == WINDOW_OKBUTTON ||
+ GetType() == WINDOW_CANCELBUTTON )
+ {
+ nFormStart = nIndex-1;
+ }
+ for( sal_uInt16 nSearchIndex = nIndex-1; nSearchIndex >= nFormStart; nSearchIndex-- )
+ {
+ sal_uInt16 nFoundIndex = 0;
+ pSWindow = ::ImplGetChildWindow( pFrameWindow,
+ nSearchIndex,
+ nFoundIndex,
+ sal_False );
+ if( pSWindow && pSWindow->IsVisible() &&
+ ( pSWindow->GetType() == WINDOW_FIXEDLINE ||
+ pSWindow->GetType() == WINDOW_GROUPBOX ) )
+ {
+ pWindow = pSWindow;
+ break;
+ }
+ if( nFoundIndex > nSearchIndex || nSearchIndex == 0 )
+ break;
+ }
+ }
+ }
+ return pWindow;
+}
+//-----IAccessibility2 Implementation 2009
+
// -----------------------------------------------------------------------
KeyEvent Window::GetActivationKey() const
@@ -1247,7 +1310,7 @@ KeyEvent Window::GetActivationKey() const
sal_Unicode nAccel = getAccel( GetText() );
if( ! nAccel )
{
- Window* pWindow = GetLabeledBy();
+ Window* pWindow = GetAccessibleRelationLabeledBy();
if( pWindow )
nAccel = getAccel( pWindow->GetText() );
}
@@ -1260,6 +1323,10 @@ KeyEvent Window::GetActivationKey() const
nCode = KEY_A + (nAccel-'A');
else if( nAccel >= '0' && nAccel <= '9' )
nCode = KEY_0 + (nAccel-'0');
+ else if( nAccel == '.' )
+ nCode = KEY_POINT;
+ else if( nAccel == '-' )
+ nCode = KEY_SUBTRACT;
KeyCode aKeyCode( nCode, sal_False, sal_False, sal_True, sal_False );
aKeyEvent = KeyEvent( nAccel, aKeyCode );
}
diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx
index 7b3dcfaa3341..6e0c109a564d 100644
--- a/vcl/source/window/msgbox.cxx
+++ b/vcl/source/window/msgbox.cxx
@@ -422,6 +422,8 @@ void MessBox::ImplPosControls()
}
mpFixedText = new FixedText( this, nWinStyle );
+ if( mpFixedText->GetStyle() & WB_EXTRAOFFSET ) // TODO: use CalcMinimumSize() instead
+ aFixedSize.Width() += 2;
mpFixedText->SetPosSizePixel( aTextPos, aFixedSize );
mpFixedText->SetText( aMessText );
mpFixedText->Show();
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 83b1c9513a8d..d38128e04f1e 100644..100755
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -310,6 +310,7 @@ void PrintDialog::PrintPreviewWindow::Command( const CommandEvent& rEvt )
void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPreview,
const Size& i_rOrigSize,
+ const rtl::OUString& i_rPaperName,
const rtl::OUString& i_rReplacement,
sal_Int32 i_nDPIX,
sal_Int32 i_nDPIY,
@@ -344,6 +345,12 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi
String aNumText( rLocWrap.getNum( aLogicPaperSize.Width(), nDigits ) );
aBuf.append( aNumText );
aBuf.appendAscii( eUnit == MAP_MM ? "mm" : "in" );
+ if( i_rPaperName.getLength() )
+ {
+ aBuf.appendAscii( " (" );
+ aBuf.append( i_rPaperName );
+ aBuf.append( sal_Unicode(')') );
+ }
maHorzDim.SetText( aBuf.makeStringAndClear() );
aNumText = rLocWrap.getNum( aLogicPaperSize.Height(), nDigits );
@@ -613,6 +620,7 @@ PrintDialog::JobTabPage::JobTabPage( Window* i_pParent, const ResId& rResId )
, maCopyCountField( this, VclResId( SV_PRINT_COPYCOUNT_FIELD ) )
, maCollateBox( this, VclResId( SV_PRINT_COLLATE ) )
, maCollateImage( this, VclResId( SV_PRINT_COLLATE_IMAGE ) )
+ , maReverseOrderBox( this, VclResId( SV_PRINT_OPT_REVERSE ) )
, maCollateImg( VclResId( SV_PRINT_COLLATE_IMG ) )
, maCollateHCImg( VclResId( SV_PRINT_COLLATE_HC_IMG ) )
, maNoCollateImg( VclResId( SV_PRINT_NOCOLLATE_IMG ) )
@@ -741,7 +749,6 @@ PrintDialog::OutputOptPage::OutputOptPage( Window* i_pParent, const ResId& i_rRe
, maOptionsLine( this, VclResId( SV_PRINT_OPT_PRINT_FL ) )
, maToFileBox( this, VclResId( SV_PRINT_OPT_TOFILE ) )
, maCollateSingleJobsBox( this, VclResId( SV_PRINT_OPT_SINGLEJOBS ) )
- , maReverseOrderBox( this, VclResId( SV_PRINT_OPT_REVERSE ) )
{
FreeResource();
@@ -765,7 +772,6 @@ void PrintDialog::OutputOptPage::setupLayout()
mxOptGroup = xCol;
xCol->addWindow( &maToFileBox );
xCol->addWindow( &maCollateSingleJobsBox );
- xCol->addWindow( &maReverseOrderBox );
}
void PrintDialog::OutputOptPage::readFromSettings()
@@ -833,7 +839,7 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterCont
maPageStr = maNumPagesText.GetText();
// init reverse print
- maOptionsPage.maReverseOrderBox.Check( maPController->getReversePrint() );
+ maJobPage.maReverseOrderBox.Check( maPController->getReversePrint() );
// fill printer listbox
const std::vector< rtl::OUString >& rQueues( Printer::GetPrinterQueues() );
@@ -906,7 +912,7 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterCont
maJobPage.maDetailsBtn.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
maNUpPage.maBorderCB.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
maOptionsPage.maToFileBox.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
- maOptionsPage.maReverseOrderBox.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
+ maJobPage.maReverseOrderBox.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
maOptionsPage.maCollateSingleJobsBox.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
maNUpPage.maPagesBtn.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
@@ -1055,6 +1061,13 @@ void PrintDialog::readFromSettings()
}
}
maOKButton.SetText( maOptionsPage.maToFileBox.IsChecked() ? maPrintToFileText : maPrintText );
+
+ // persistent window state
+ rtl::OUString aWinState( pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "WindowState" ) ) ) );
+ if( aWinState.getLength() )
+ SetWindowState( rtl::OUStringToOString( aWinState, RTL_TEXTENCODING_UTF8 ) );
+
if( maOptionsPage.maToFileBox.IsChecked() )
{
maPController->resetPrinterOptions( true );
@@ -1077,6 +1090,10 @@ void PrintDialog::storeToSettings()
pItem->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ),
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LastPage" ) ),
maTabCtrl.GetPageText( maTabCtrl.GetCurPageId() ) );
+ pItem->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "WindowState" ) ),
+ rtl::OStringToOUString( GetWindowState(), RTL_TEXTENCODING_UTF8 )
+ );
pItem->Commit();
}
@@ -1637,6 +1654,16 @@ void PrintDialog::setupOptionalUI()
{
maJobPage.mxPrintRange->show( false, false );
maJobPage.maCopySpacer.Show( sal_False );
+ maJobPage.maReverseOrderBox.Show( sal_False );
+ }
+ else
+ {
+ // add an indent to the current column
+ vcl::Indenter* pIndent = new vcl::Indenter( maJobPage.mxPrintRange.get(), -1 );
+ maJobPage.mxPrintRange->addChild( pIndent );
+ // and create a column inside the indent
+ pIndent->setWindow( &maJobPage.maReverseOrderBox );
+ maJobPage.maReverseOrderBox.Show( sal_True );
}
#ifdef WNT
@@ -1882,7 +1909,9 @@ void PrintDialog::preparePreview( bool i_bNewPage, bool i_bMayUseCache )
}
Size aCurPageSize = aPrt->PixelToLogic( aPrt->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) );
- maPreviewWindow.setPreview( aMtf, aCurPageSize, nPages > 0 ? rtl::OUString() : maNoPageStr,
+ maPreviewWindow.setPreview( aMtf, aCurPageSize,
+ aPrt->GetPaperName( false ),
+ nPages > 0 ? rtl::OUString() : maNoPageStr,
aPrt->ImplGetDPIX(), aPrt->ImplGetDPIY(),
aPrt->GetPrinterOptions().IsConvertToGreyscales()
);
@@ -2078,6 +2107,7 @@ IMPL_LINK( PrintDialog, SelectHdl, ListBox*, pBox )
maPController->resetPrinterOptions( maOptionsPage.maToFileBox.IsChecked() );
// update text fields
updatePrinterText();
+ preparePreview( true, false );
}
else if( pBox == &maNUpPage.maNupOrientationBox || pBox == &maNUpPage.maNupOrderBox )
{
@@ -2187,9 +2217,9 @@ IMPL_LINK( PrintDialog, ClickHdl, Button*, pButton )
makeAny( sal_Bool(isCollate()) ) );
checkControlDependencies();
}
- else if( pButton == &maOptionsPage.maReverseOrderBox )
+ else if( pButton == &maJobPage.maReverseOrderBox )
{
- sal_Bool bChecked = maOptionsPage.maReverseOrderBox.IsChecked();
+ sal_Bool bChecked = maJobPage.maReverseOrderBox.IsChecked();
maPController->setReversePrint( bChecked );
maPController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintReverse" ) ),
makeAny( bChecked ) );
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 0a44486839f6..96e787928772 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -134,25 +134,21 @@ struct ImplCalcToTopData
Region* mpInvalidateRegion;
};
-struct ImplAccessibleInfos
+ImplAccessibleInfos::ImplAccessibleInfos()
{
- sal_uInt16 nAccessibleRole;
- String* pAccessibleName;
- String* pAccessibleDescription;
-
- ImplAccessibleInfos()
- {
- nAccessibleRole = 0xFFFF;
- pAccessibleName = NULL;
- pAccessibleDescription = NULL;
- }
+ nAccessibleRole = 0xFFFF;
+ pAccessibleName = NULL;
+ pAccessibleDescription = NULL;
+ pLabeledByWindow = NULL;
+ pLabelForWindow = NULL;
+ pMemberOfWindow = NULL;
+}
- ~ImplAccessibleInfos()
- {
- delete pAccessibleName;
- delete pAccessibleDescription;
- }
-};
+ImplAccessibleInfos::~ImplAccessibleInfos()
+{
+ delete pAccessibleName;
+ delete pAccessibleDescription;
+}
// -----------------------------------------------------------------------
@@ -2409,8 +2405,9 @@ void Window::ImplCallPaint( const Region* pRegion, sal_uInt16 nPaintFlags )
mpWindowImpl->mnPaintFlags = 0;
if ( !mpWindowImpl->maInvalidateRegion.IsEmpty() )
{
+ bool bRestoreCursor = false;
if ( mpWindowImpl->mpCursor )
- mpWindowImpl->mpCursor->ImplHide();
+ bRestoreCursor = mpWindowImpl->mpCursor->ImplHide();
mbInitClipRegion = sal_True;
mpWindowImpl->mbInPaint = sal_True;
@@ -2457,7 +2454,7 @@ void Window::ImplCallPaint( const Region* pRegion, sal_uInt16 nPaintFlags )
mbInitClipRegion = sal_True;
mpWindowImpl->mpPaintRegion = NULL;
if ( mpWindowImpl->mpCursor )
- mpWindowImpl->mpCursor->ImplShow( sal_False );
+ mpWindowImpl->mpCursor->ImplShow( false, bRestoreCursor );
}
}
else
@@ -3046,7 +3043,7 @@ void Window::ImplScroll( const Rectangle& rRect,
Update();
if ( mpWindowImpl->mpCursor )
- mpWindowImpl->mpCursor->ImplShow( sal_False );
+ mpWindowImpl->mpCursor->ImplShow( false );
}
// -----------------------------------------------------------------------
@@ -4380,7 +4377,7 @@ Window::~Window()
// Dispose of the canvas implementation (which, currently, has an
// own wrapper window as a child to this one.
- Reference< rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas );
+ uno::Reference< rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas );
if( xCanvas.is() )
{
uno::Reference < lang::XComponent > xCanvasComponent( xCanvas,
@@ -4425,12 +4422,12 @@ Window::~Window()
// deregister drop target listener
if( mpWindowImpl->mpFrameData->mxDropTargetListener.is() )
{
- Reference< XDragGestureRecognizer > xDragGestureRecognizer =
- Reference< XDragGestureRecognizer > (mpWindowImpl->mpFrameData->mxDragSource, UNO_QUERY);
+ uno::Reference< XDragGestureRecognizer > xDragGestureRecognizer =
+ uno::Reference< XDragGestureRecognizer > (mpWindowImpl->mpFrameData->mxDragSource, UNO_QUERY);
if( xDragGestureRecognizer.is() )
{
xDragGestureRecognizer->removeDragGestureListener(
- Reference< XDragGestureListener > (mpWindowImpl->mpFrameData->mxDropTargetListener, UNO_QUERY));
+ uno::Reference< XDragGestureListener > (mpWindowImpl->mpFrameData->mxDropTargetListener, UNO_QUERY));
}
mpWindowImpl->mpFrameData->mxDropTarget->removeDropTargetListener( mpWindowImpl->mpFrameData->mxDropTargetListener );
@@ -4438,7 +4435,7 @@ Window::~Window()
}
// shutdown drag and drop for this frame window
- Reference< XComponent > xComponent( mpWindowImpl->mpFrameData->mxDropTarget, UNO_QUERY );
+ uno::Reference< XComponent > xComponent( mpWindowImpl->mpFrameData->mxDropTarget, UNO_QUERY );
// DNDEventDispatcher does not hold a reference of the DropTarget,
// so it's ok if it does not support XComponent
@@ -8086,7 +8083,7 @@ void Window::SetText( const XubString& rStr )
// name change.
if ( IsReallyVisible() )
{
- Window* pWindow = GetLabelFor();
+ Window* pWindow = GetAccessibleRelationLabelFor();
if ( pWindow && pWindow != this )
pWindow->ImplCallEventListeners( VCLEVENT_WINDOW_FRAMETITLECHANGED, &oldTitle );
}
@@ -8482,7 +8479,7 @@ void Window::ImplStartDnd()
// -----------------------------------------------------------------------
-Reference< XDropTarget > Window::GetDropTarget()
+uno::Reference< XDropTarget > Window::GetDropTarget()
{
DBG_CHKTHIS( Window, ImplDbgCheckWindow );
@@ -8495,7 +8492,7 @@ Reference< XDropTarget > Window::GetDropTarget()
if( ! mpWindowImpl->mpFrameData->mxDropTarget.is() )
{
// initialization is done in GetDragSource
- Reference< XDragSource > xDragSource = GetDragSource();
+ uno::Reference< XDragSource > xDragSource = GetDragSource();
}
if( mpWindowImpl->mpFrameData->mxDropTarget.is() )
@@ -8511,13 +8508,13 @@ Reference< XDropTarget > Window::GetDropTarget()
mpWindowImpl->mpFrameData->mxDropTarget->addDropTargetListener( mpWindowImpl->mpFrameData->mxDropTargetListener );
// register also as drag gesture listener if directly supported by drag source
- Reference< XDragGestureRecognizer > xDragGestureRecognizer =
- Reference< XDragGestureRecognizer > (mpWindowImpl->mpFrameData->mxDragSource, UNO_QUERY);
+ uno::Reference< XDragGestureRecognizer > xDragGestureRecognizer =
+ uno::Reference< XDragGestureRecognizer > (mpWindowImpl->mpFrameData->mxDragSource, UNO_QUERY);
if( xDragGestureRecognizer.is() )
{
xDragGestureRecognizer->addDragGestureListener(
- Reference< XDragGestureListener > (mpWindowImpl->mpFrameData->mxDropTargetListener, UNO_QUERY));
+ uno::Reference< XDragGestureListener > (mpWindowImpl->mpFrameData->mxDropTargetListener, UNO_QUERY));
}
else
mpWindowImpl->mpFrameData->mbInternalDragGestureRecognizer = sal_True;
@@ -8539,12 +8536,12 @@ Reference< XDropTarget > Window::GetDropTarget()
}
// this object is located in the same process, so there will be no runtime exception
- return Reference< XDropTarget > ( mpWindowImpl->mxDNDListenerContainer, UNO_QUERY );
+ return uno::Reference< XDropTarget > ( mpWindowImpl->mxDNDListenerContainer, UNO_QUERY );
}
// -----------------------------------------------------------------------
-Reference< XDragSource > Window::GetDragSource()
+uno::Reference< XDragSource > Window::GetDragSource()
{
DBG_CHKTHIS( Window, ImplDbgCheckWindow );
@@ -8554,7 +8551,7 @@ Reference< XDragSource > Window::GetDragSource()
{
try
{
- Reference< XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory();
+ uno::Reference< XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory();
if ( xFactory.is() )
{
const SystemEnvData * pEnvData = GetSystemData();
@@ -8588,10 +8585,10 @@ Reference< XDragSource > Window::GetDragSource()
aDropTargetAL[ 2 ] = makeAny( vcl::createBmpConverter() );
#endif
if( aDragSourceSN.getLength() )
- mpWindowImpl->mpFrameData->mxDragSource = Reference< XDragSource > ( xFactory->createInstanceWithArguments( aDragSourceSN, aDragSourceAL ), UNO_QUERY );
+ mpWindowImpl->mpFrameData->mxDragSource = uno::Reference< XDragSource > ( xFactory->createInstanceWithArguments( aDragSourceSN, aDragSourceAL ), UNO_QUERY );
if( aDropTargetSN.getLength() )
- mpWindowImpl->mpFrameData->mxDropTarget = Reference< XDropTarget > ( xFactory->createInstanceWithArguments( aDropTargetSN, aDropTargetAL ), UNO_QUERY );
+ mpWindowImpl->mpFrameData->mxDropTarget = uno::Reference< XDropTarget > ( xFactory->createInstanceWithArguments( aDropTargetSN, aDropTargetAL ), UNO_QUERY );
}
}
}
@@ -8608,12 +8605,12 @@ Reference< XDragSource > Window::GetDragSource()
return mpWindowImpl->mpFrameData->mxDragSource;
}
- return Reference< XDragSource > ();
+ return uno::Reference< XDragSource > ();
}
// -----------------------------------------------------------------------
-void Window::GetDragSourceDropTarget(Reference< XDragSource >& xDragSource, Reference< XDropTarget > &xDropTarget )
+void Window::GetDragSourceDropTarget(uno::Reference< XDragSource >& xDragSource, uno::Reference< XDropTarget > &xDropTarget )
// only for RVP transmission
{
if( mpWindowImpl->mpFrameData )
@@ -8631,14 +8628,14 @@ void Window::GetDragSourceDropTarget(Reference< XDragSource >& xDragSource, Refe
// -----------------------------------------------------------------------
-Reference< XDragGestureRecognizer > Window::GetDragGestureRecognizer()
+uno::Reference< XDragGestureRecognizer > Window::GetDragGestureRecognizer()
{
- return Reference< XDragGestureRecognizer > ( GetDropTarget(), UNO_QUERY );
+ return uno::Reference< XDragGestureRecognizer > ( GetDropTarget(), UNO_QUERY );
}
// -----------------------------------------------------------------------
-Reference< XClipboard > Window::GetClipboard()
+uno::Reference< XClipboard > Window::GetClipboard()
{
DBG_CHKTHIS( Window, ImplDbgCheckWindow );
@@ -8648,19 +8645,19 @@ Reference< XClipboard > Window::GetClipboard()
{
try
{
- Reference< XMultiServiceFactory > xFactory( vcl::unohelper::GetMultiServiceFactory() );
+ uno::Reference< XMultiServiceFactory > xFactory( vcl::unohelper::GetMultiServiceFactory() );
if( xFactory.is() )
{
- mpWindowImpl->mpFrameData->mxClipboard = Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboardExt" ) ), UNO_QUERY );
+ mpWindowImpl->mpFrameData->mxClipboard = uno::Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboardExt" ) ), UNO_QUERY );
if( !mpWindowImpl->mpFrameData->mxClipboard.is() )
- mpWindowImpl->mpFrameData->mxClipboard = Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboard" ) ), UNO_QUERY );
+ mpWindowImpl->mpFrameData->mxClipboard = uno::Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboard" ) ), UNO_QUERY );
#if defined(UNX) && !defined(QUARTZ) // unix clipboard needs to be initialized
if( mpWindowImpl->mpFrameData->mxClipboard.is() )
{
- Reference< XInitialization > xInit = Reference< XInitialization >( mpWindowImpl->mpFrameData->mxClipboard, UNO_QUERY );
+ uno::Reference< XInitialization > xInit = uno::Reference< XInitialization >( mpWindowImpl->mpFrameData->mxClipboard, UNO_QUERY );
if( xInit.is() )
{
@@ -8692,7 +8689,7 @@ Reference< XClipboard > Window::GetClipboard()
// -----------------------------------------------------------------------
-Reference< XClipboard > Window::GetPrimarySelection()
+uno::Reference< XClipboard > Window::GetPrimarySelection()
{
DBG_CHKTHIS( Window, ImplDbgCheckWindow );
@@ -8702,7 +8699,7 @@ Reference< XClipboard > Window::GetPrimarySelection()
{
try
{
- Reference< XMultiServiceFactory > xFactory( vcl::unohelper::GetMultiServiceFactory() );
+ uno::Reference< XMultiServiceFactory > xFactory( vcl::unohelper::GetMultiServiceFactory() );
if( xFactory.is() )
{
@@ -8712,16 +8709,16 @@ Reference< XClipboard > Window::GetPrimarySelection()
aArgumentList[ 1 ] = makeAny( OUString::createFromAscii( "PRIMARY" ) );
aArgumentList[ 2 ] = makeAny( vcl::createBmpConverter() );
- mpWindowImpl->mpFrameData->mxSelection = Reference< XClipboard >( xFactory->createInstanceWithArguments(
+ mpWindowImpl->mpFrameData->mxSelection = uno::Reference< XClipboard >( xFactory->createInstanceWithArguments(
OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboard" ), aArgumentList ), UNO_QUERY );
# else
- static Reference< XClipboard > s_xSelection;
+ static uno::Reference< XClipboard > s_xSelection;
if ( !s_xSelection.is() )
- s_xSelection = Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.GenericClipboardExt" ) ), UNO_QUERY );
+ s_xSelection = uno::Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.GenericClipboardExt" ) ), UNO_QUERY );
if ( !s_xSelection.is() )
- s_xSelection = Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.GenericClipboard" ) ), UNO_QUERY );
+ s_xSelection = uno::Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.GenericClipboard" ) ), UNO_QUERY );
mpWindowImpl->mpFrameData->mxSelection = s_xSelection;
# endif
@@ -9134,6 +9131,7 @@ sal_uInt16 Window::GetAccessibleRole() const
case WINDOW_HELPTEXTWINDOW: nRole = accessibility::AccessibleRole::TOOL_TIP; break;
+ case WINDOW_RULER: nRole = accessibility::AccessibleRole::RULER; break;
case WINDOW_WINDOW:
case WINDOW_CONTROL:
case WINDOW_BORDERWINDOW:
@@ -9160,7 +9158,7 @@ void Window::SetAccessibleName( const String& rName )
if ( !mpWindowImpl->mpAccessibleInfos )
mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos;
- DBG_ASSERT( !mpWindowImpl->mpAccessibleInfos->pAccessibleName, "AccessibleName already set!" );
+ DBG_ASSERT( !mpWindowImpl->mpAccessibleInfos->pAccessibleName || !rName.Len(), "AccessibleName already set!" );
delete mpWindowImpl->mpAccessibleInfos->pAccessibleName;
mpWindowImpl->mpAccessibleInfos->pAccessibleName = new String( rName );
}
@@ -9201,9 +9199,9 @@ String Window::GetAccessibleName() const
case WINDOW_LISTBOX:
case WINDOW_MULTILISTBOX:
case WINDOW_TREELISTBOX:
-
+ case WINDOW_METRICBOX:
{
- Window *pLabel = GetLabeledBy();
+ Window *pLabel = GetAccessibleRelationLabeledBy();
if ( pLabel && pLabel != this )
aAccessibleName = pLabel->GetText();
}
@@ -9262,6 +9260,27 @@ String Window::GetAccessibleDescription() const
return aAccessibleDescription;
}
+void Window::SetAccessibleRelationLabeledBy( Window* pLabeledBy )
+{
+ if ( !mpWindowImpl->mpAccessibleInfos )
+ mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos;
+ mpWindowImpl->mpAccessibleInfos->pLabeledByWindow = pLabeledBy;
+}
+
+void Window::SetAccessibleRelationLabelFor( Window* pLabelFor )
+{
+ if ( !mpWindowImpl->mpAccessibleInfos )
+ mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos;
+ mpWindowImpl->mpAccessibleInfos->pLabelForWindow = pLabelFor;
+}
+
+void Window::SetAccessibleRelationMemberOf( Window* pMemberOfWin )
+{
+ if ( !mpWindowImpl->mpAccessibleInfos )
+ mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos;
+ mpWindowImpl->mpAccessibleInfos->pMemberOfWindow = pMemberOfWin;
+}
+
sal_Bool Window::IsAccessibilityEventsSuppressed( sal_Bool bTraverseParentPath )
{
if( !bTraverseParentPath )
@@ -9280,6 +9299,11 @@ sal_Bool Window::IsAccessibilityEventsSuppressed( sal_Bool bTraverseParentPath )
}
}
+void Window::SetAccessibilityEventsSuppressed(sal_Bool bSuppressed)
+{
+ mpWindowImpl->mbSuppressAccessibilityEvents = bSuppressed;
+}
+
void Window::RecordLayoutData( vcl::ControlLayoutData* pLayout, const Rectangle& rRect )
{
if( ! mpOutDevData )
@@ -9546,7 +9570,7 @@ sal_Bool Window::IsTopWindow() const
{
// #113722#, cache result of expensive queryInterface call
Window *pThisWin = (Window*)this;
- Reference< XTopWindow > xTopWindow( pThisWin->GetComponentInterface(), UNO_QUERY );
+ uno::Reference< XTopWindow > xTopWindow( pThisWin->GetComponentInterface(), UNO_QUERY );
pThisWin->mpWindowImpl->mpWinData->mnIsTopWindow = xTopWindow.is() ? 1 : 0;
}
return mpWindowImpl->mpWinData->mnIsTopWindow == 1 ? sal_True : sal_False;
@@ -9682,12 +9706,12 @@ sal_Bool Window::IsNativeWidgetEnabled() const
#include <salframe.h>
#endif
-Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscreenSize,
+uno::Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscreenSize,
bool bFullscreen,
bool bSpriteCanvas ) const
{
// try to retrieve hard reference from weak member
- Reference< rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas );
+ uno::Reference< rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas );
// canvas still valid? Then we're done.
if( xCanvas.is() )
@@ -9726,23 +9750,23 @@ Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscreenSi
aArg[ 2 ] = makeAny( ::com::sun::star::awt::Rectangle( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight ) );
aArg[ 3 ] = makeAny( mpWindowImpl->mbAlwaysOnTop ? sal_True : sal_False );
- aArg[ 4 ] = makeAny( Reference< awt::XWindow >(
+ aArg[ 4 ] = makeAny( uno::Reference< awt::XWindow >(
const_cast<Window*>(this)->GetComponentInterface(),
uno::UNO_QUERY ));
- Reference< XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory();
+ uno::Reference< XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory();
// Create canvas instance with window handle
// =========================================
if ( xFactory.is() )
{
- static ::vcl::DeleteUnoReferenceOnDeinit<XMultiServiceFactory> xStaticCanvasFactory(
- Reference<XMultiServiceFactory>(
+ static ::vcl::DeleteUnoReferenceOnDeinit<lang::XMultiServiceFactory> xStaticCanvasFactory(
+ uno::Reference<lang::XMultiServiceFactory>(
xFactory->createInstance(
OUString( RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.rendering.CanvasFactory") ) ),
UNO_QUERY ));
- uno::Reference<XMultiServiceFactory> xCanvasFactory(xStaticCanvasFactory.get());
+ uno::Reference<lang::XMultiServiceFactory> xCanvasFactory(xStaticCanvasFactory.get());
if(xCanvasFactory.is())
{
@@ -9789,21 +9813,21 @@ Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscreenSi
return xCanvas;
}
-Reference< rendering::XCanvas > Window::GetCanvas() const
+uno::Reference< rendering::XCanvas > Window::GetCanvas() const
{
return ImplGetCanvas( Size(), false, false );
}
-Reference< rendering::XSpriteCanvas > Window::GetSpriteCanvas() const
+uno::Reference< rendering::XSpriteCanvas > Window::GetSpriteCanvas() const
{
- Reference< rendering::XSpriteCanvas > xSpriteCanvas(
+ uno::Reference< rendering::XSpriteCanvas > xSpriteCanvas(
ImplGetCanvas( Size(), false, true ), uno::UNO_QUERY );
return xSpriteCanvas;
}
-Reference< ::com::sun::star::rendering::XSpriteCanvas > Window::GetFullscreenSpriteCanvas( const Size& rFullscreenSize ) const
+uno::Reference< ::com::sun::star::rendering::XSpriteCanvas > Window::GetFullscreenSpriteCanvas( const Size& rFullscreenSize ) const
{
- Reference< rendering::XSpriteCanvas > xSpriteCanvas(
+ uno::Reference< rendering::XSpriteCanvas > xSpriteCanvas(
ImplGetCanvas( rFullscreenSize, true, true ), uno::UNO_QUERY );
return xSpriteCanvas;
}
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index 9cb38756e770..795bea17a3b9 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -1646,7 +1646,13 @@ void ImplHandleResize( Window* pWindow, long nNewWidth, long nNewHeight )
// #i42750# presentation wants to be informed about resize
// as early as possible
WorkWindow* pWorkWindow = dynamic_cast<WorkWindow*>(pWindow->ImplGetWindowImpl()->mpClientWindow);
- if( pWorkWindow && pWorkWindow->IsPresentationMode() )
+ if( ! pWorkWindow || pWorkWindow->IsPresentationMode() )
+ bStartTimer = false;
+ }
+ else
+ {
+ WorkWindow* pWorkWindow = dynamic_cast<WorkWindow*>(pWindow);
+ if( ! pWorkWindow || pWorkWindow->IsPresentationMode() )
bStartTimer = false;
}
}
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index 36d475b8795b..329e6867206b 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -246,13 +246,15 @@ int GtkSalDisplay::GetDefaultMonitorNumber() const
int n = 0;
GdkScreen* pScreen = gdk_display_get_screen( m_pGdkDisplay, m_nDefaultScreen );
#if GTK_CHECK_VERSION(2,20,0)
- n = m_aXineramaScreenIndexMap[gdk_screen_get_primary_monitor(pScreen)];
+ n = gdk_screen_get_primary_monitor(pScreen);
#else
static screen_get_primary_monitor sym_gdk_screen_get_primary_monitor =
(screen_get_primary_monitor)osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gdk_screen_get_primary_monitor" );
if (sym_gdk_screen_get_primary_monitor)
- n = m_aXineramaScreenIndexMap[sym_gdk_screen_get_primary_monitor( pScreen )];
+ n = sym_gdk_screen_get_primary_monitor( pScreen );
#endif
+ if( n >= 0 && size_t(n) < m_aXineramaScreenIndexMap.size() )
+ n = m_aXineramaScreenIndexMap[n];
return n;
}
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index 34a7cfcd196b..def25a0bac9d 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -479,30 +479,13 @@ void GtkSalGraphics::ResetClipRegion()
X11SalGraphics::ResetClipRegion();
}
-void GtkSalGraphics::BeginSetClipRegion( sal_uLong nCount )
-{
- m_aClipRegion.SetNull();
- X11SalGraphics::BeginSetClipRegion( nCount );
-}
-
-sal_Bool GtkSalGraphics::unionClipRegion( long nX, long nY, long nWidth, long nHeight )
-{
- Rectangle aRect( Point( nX, nY ), Size( nWidth, nHeight ) );
- m_aClipRegion.Union( aRect );
- return X11SalGraphics::unionClipRegion( nX, nY, nWidth, nHeight );
-}
-
-bool GtkSalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& )
-{
- // TODO: implement and advertise OutDevSupport_B2DClip support
- return false;
-}
-
-void GtkSalGraphics::EndSetClipRegion()
+bool GtkSalGraphics::setClipRegion( const Region& i_rClip )
{
+ m_aClipRegion = i_rClip;
+ bool bRet = X11SalGraphics::setClipRegion( m_aClipRegion );
if( m_aClipRegion.IsEmpty() )
m_aClipRegion.SetNull();
- X11SalGraphics::EndSetClipRegion();
+ return bRet;
}
void GtkSalGraphics::copyBits( const SalTwoRect* pPosAry,
diff --git a/vcl/unx/headless/svpgdi.cxx b/vcl/unx/headless/svpgdi.cxx
index 95ce1bb45a1d..a460bb271198 100644
--- a/vcl/unx/headless/svpgdi.cxx
+++ b/vcl/unx/headless/svpgdi.cxx
@@ -29,6 +29,7 @@
#include "svpbmp.hxx"
#include <vcl/sysdata.hxx>
+#include <vcl/region.h>
#include <basegfx/range/b2drange.hxx>
#include <basegfx/range/b2irange.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
@@ -152,11 +153,16 @@ void SvpSalGraphics::ResetClipRegion()
m_aClipMap.reset();
}
-void SvpSalGraphics::BeginSetClipRegion( sal_uLong n )
+bool SvpSalGraphics::setClipRegion( const Region& i_rClip )
{
- if( n <= 1 )
+ if( i_rClip.IsEmpty() )
+ m_aClipMap.reset();
+ else if( i_rClip.GetRectCount() == 1 )
{
m_aClipMap.reset();
+ Rectangle aBoundRect( i_rClip.GetBoundRect() );
+ m_aDevice = basebmp::subsetBitmapDevice( m_aOrigDevice,
+ basegfx::B2IRange(aBoundRect.Left(),aBoundRect.Top(),aBoundRect.Right(),aBoundRect.Bottom()) );
}
else
{
@@ -164,34 +170,22 @@ void SvpSalGraphics::BeginSetClipRegion( sal_uLong n )
B2IVector aSize = m_aDevice->getSize();
m_aClipMap = createBitmapDevice( aSize, false, Format::ONE_BIT_MSB_GREY );
m_aClipMap->clear( basebmp::Color(0xFFFFFFFF) );
- }
-}
-sal_Bool SvpSalGraphics::unionClipRegion( long nX, long nY, long nWidth, long nHeight )
-{
- if( m_aClipMap )
- {
- B2DPolyPolygon aFull;
- aFull.append( tools::createPolygonFromRect( B2DRectangle( nX, nY, nX+nWidth, nY+nHeight ) ) );
- m_aClipMap->fillPolyPolygon( aFull, basebmp::Color(0), DrawMode_PAINT );
- }
- else
- {
- m_aDevice = basebmp::subsetBitmapDevice( m_aOrigDevice,
- basegfx::B2IRange(nX,nY,nX+nWidth,nY+nHeight) );
+ ImplRegionInfo aInfo;
+ long nX, nY, nW, nH;
+ bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH );
+ while( bRegionRect )
+ {
+ if ( nW && nH )
+ {
+ B2DPolyPolygon aFull;
+ aFull.append( tools::createPolygonFromRect( B2DRectangle( nX, nY, nX+nW, nY+nH ) ) );
+ m_aClipMap->fillPolyPolygon( aFull, basebmp::Color(0), DrawMode_PAINT );
+ }
+ bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH );
+ }
}
-
- return sal_True;
-}
-
-bool SvpSalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& )
-{
- // TODO: implement and advertise OutDevSupport_B2DClip support
- return false;
-}
-
-void SvpSalGraphics::EndSetClipRegion()
-{
+ return true;
}
void SvpSalGraphics::SetLineColor()
diff --git a/vcl/unx/headless/svpgdi.hxx b/vcl/unx/headless/svpgdi.hxx
index a7486a55198f..9e4971528033 100644
--- a/vcl/unx/headless/svpgdi.hxx
+++ b/vcl/unx/headless/svpgdi.hxx
@@ -68,10 +68,7 @@ public:
virtual long GetGraphicsWidth() const;
virtual void ResetClipRegion();
- virtual void BeginSetClipRegion( sal_uLong nCount );
- virtual sal_Bool unionClipRegion( long nX, long nY, long nWidth, long nHeight );
- virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& );
- virtual void EndSetClipRegion();
+ virtual bool setClipRegion( const Region& );
virtual void SetLineColor();
virtual void SetLineColor( SalColor nSalColor );
diff --git a/vcl/unx/headless/svppspgraphics.cxx b/vcl/unx/headless/svppspgraphics.cxx
index 6fdc8aac75d0..13c5469ed028 100644
--- a/vcl/unx/headless/svppspgraphics.cxx
+++ b/vcl/unx/headless/svppspgraphics.cxx
@@ -43,6 +43,7 @@
#include "vcl/svapp.hxx"
#include "vcl/salprn.hxx"
#include "vcl/sysdata.hxx"
+#include "vcl/region.h"
#include "basegfx/vector/b2ivector.hxx"
#include "basegfx/point/b2ipoint.hxx"
@@ -216,28 +217,27 @@ long PspGraphics::GetGraphicsWidth() const
void PspGraphics::ResetClipRegion()
{
- m_pPrinterGfx->ResetClipRegion ();
+ m_pPrinterGfx->ResetClipRegion();
}
-void PspGraphics::BeginSetClipRegion( sal_uLong n )
+bool PspGraphics::setClipRegion( const Region& i_rClip )
{
- m_pPrinterGfx->BeginSetClipRegion(n);
-}
-
-sal_Bool PspGraphics::unionClipRegion( long nX, long nY, long nDX, long nDY )
-{
- return (sal_Bool)m_pPrinterGfx->UnionClipRegion (nX, nY, nDX, nDY);
-}
+ // TODO: support polygonal clipregions here
+ m_pPrinterGfx->BeginSetClipRegion( i_rClip.GetRectCount() );
-bool PspGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& )
-{
- // TODO: implement and advertise OutDevSupport_B2DClip support
- return false;
-}
-
-void PspGraphics::EndSetClipRegion()
-{
- m_pPrinterGfx->EndSetClipRegion ();
+ ImplRegionInfo aInfo;
+ long nX, nY, nW, nH;
+ bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH );
+ while( bRegionRect )
+ {
+ if ( nW && nH )
+ {
+ m_pPrinterGfx->UnionClipRegion( nX, nY, nW, nH );
+ }
+ bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH );
+ }
+ m_pPrinterGfx->EndSetClipRegion();
+ return true;
}
void PspGraphics::SetLineColor()
diff --git a/vcl/unx/headless/svppspgraphics.hxx b/vcl/unx/headless/svppspgraphics.hxx
index fe9352c1fd8b..729116fcc1d2 100644
--- a/vcl/unx/headless/svppspgraphics.hxx
+++ b/vcl/unx/headless/svppspgraphics.hxx
@@ -90,10 +90,7 @@ public:
virtual long GetGraphicsWidth() const;
virtual void ResetClipRegion();
- virtual void BeginSetClipRegion( sal_uLong nCount );
- virtual sal_Bool unionClipRegion( long nX, long nY, long nWidth, long nHeight );
- virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& );
- virtual void EndSetClipRegion();
+ virtual bool setClipRegion( const Region& );
virtual void SetLineColor();
virtual void SetLineColor( SalColor nSalColor );
diff --git a/vcl/unx/inc/dtint.hxx b/vcl/unx/inc/dtint.hxx
index ebe2cae90803..6e6cf13575ed 100644
--- a/vcl/unx/inc/dtint.hxx
+++ b/vcl/unx/inc/dtint.hxx
@@ -31,12 +31,12 @@
#include <tools/string.hxx>
#include <tools/color.hxx>
#include <vcl/font.hxx>
+#include "svunx.h"
class SalBitmap;
class SalDisplay;
class AllSettings;
-
enum DtType {
DtGeneric,
DtCDE
diff --git a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx
index 0b4439e6881f..57a639f8ad5b 100644
--- a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx
+++ b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx
@@ -78,11 +78,8 @@ public:
//helper methods for frame's UpdateSettings
void updateSettings( AllSettings& rSettings );
+ virtual bool setClipRegion( const Region& );
virtual void ResetClipRegion();
- virtual void BeginSetClipRegion( sal_uLong nCount );
- virtual sal_Bool unionClipRegion( long nX, long nY, long nWidth, long nHeight );
- virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& );
- virtual void EndSetClipRegion();
// some themes set the background pixmap of our window EVERY time
// a control is painted; but presentation effects need
diff --git a/vcl/unx/inc/pspgraphics.h b/vcl/unx/inc/pspgraphics.h
index 143c628eb178..7d9a2b8a3d0e 100644
--- a/vcl/unx/inc/pspgraphics.h
+++ b/vcl/unx/inc/pspgraphics.h
@@ -87,10 +87,7 @@ public:
virtual long GetGraphicsWidth() const;
virtual void ResetClipRegion();
- virtual void BeginSetClipRegion( sal_uIntPtr nCount );
- virtual sal_Bool unionClipRegion( long nX, long nY, long nWidth, long nHeight );
- virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& );
- virtual void EndSetClipRegion();
+ virtual bool setClipRegion( const Region& );
virtual void SetLineColor();
virtual void SetLineColor( SalColor nSalColor );
diff --git a/vcl/unx/inc/saldisp.hxx b/vcl/unx/inc/saldisp.hxx
index 42d1f820acff..3333dc3faef4 100644
--- a/vcl/unx/inc/saldisp.hxx
+++ b/vcl/unx/inc/saldisp.hxx
@@ -127,7 +127,7 @@ enum SalRGB { RGB, RBG,
RGBA, RBGA,
GBRA, GRBA,
BGRA, BRGA,
- other };
+ otherSalRGB };
// -=-= SalVisual =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
class SalVisual : public XVisualInfo
diff --git a/vcl/unx/inc/salgdi.h b/vcl/unx/inc/salgdi.h
index c40a85741c5d..2cf3190590f3 100644
--- a/vcl/unx/inc/salgdi.h
+++ b/vcl/unx/inc/salgdi.h
@@ -90,7 +90,7 @@ protected:
CairoFontsCache m_aCairoFontsCache;
XLIB_Region pPaintRegion_;
- XLIB_Region pClipRegion_;
+ XLIB_Region mpClipRegion;
GC pPenGC_; // Pen attributes
SalColor nPenColor_;
@@ -133,6 +133,7 @@ protected:
bool bXORMode_ : 1; // is ROP XOR Mode set
sal_Bool bDitherBrush_ : 1; // is solid or tile
+ using SalGraphics::SetClipRegion;
void SetClipRegion( GC pGC,
XLIB_Region pXReg = NULL ) const;
@@ -228,10 +229,7 @@ public:
virtual long GetGraphicsHeight() const;
virtual void ResetClipRegion();
- virtual void BeginSetClipRegion( sal_uIntPtr nCount );
- virtual sal_Bool unionClipRegion( long nX, long nY, long nWidth, long nHeight );
- virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& );
- virtual void EndSetClipRegion();
+ virtual bool setClipRegion( const Region& );
virtual void SetLineColor();
virtual void SetLineColor( SalColor nSalColor );
diff --git a/vcl/unx/kde4/KDEData.cxx b/vcl/unx/kde4/KDEData.cxx
index 99871edadae3..dcf1db32068e 100644
--- a/vcl/unx/kde4/KDEData.cxx
+++ b/vcl/unx/kde4/KDEData.cxx
@@ -51,4 +51,4 @@ void KDEData::initNWF()
void KDEData::deInitNWF()
{
-} \ No newline at end of file
+}
diff --git a/vcl/unx/kde4/KDEData.hxx b/vcl/unx/kde4/KDEData.hxx
index 7cf5836c9688..6daa0c81a4fb 100644
--- a/vcl/unx/kde4/KDEData.hxx
+++ b/vcl/unx/kde4/KDEData.hxx
@@ -39,4 +39,4 @@ class KDEData : public X11SalData
virtual void Init();
virtual void initNWF();
virtual void deInitNWF();
-}; \ No newline at end of file
+};
diff --git a/vcl/unx/kde4/KDESalDisplay.cxx b/vcl/unx/kde4/KDESalDisplay.cxx
index d67399528a7c..41fa9fedde3f 100644
--- a/vcl/unx/kde4/KDESalDisplay.cxx
+++ b/vcl/unx/kde4/KDESalDisplay.cxx
@@ -42,4 +42,4 @@ SalKDEDisplay::~SalKDEDisplay()
doDestruct();
// prevent SalDisplay from closing KApplication's display
pDisp_ = NULL;
-} \ No newline at end of file
+}
diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx
index 0c8f04f9fe41..abd1dc993f9e 100644
--- a/vcl/unx/kde4/KDESalFrame.cxx
+++ b/vcl/unx/kde4/KDESalFrame.cxx
@@ -56,12 +56,12 @@
#include <stdio.h>
#endif
-KDESalFrame::KDESalFrame( SalFrame* pParent, ULONG nState ) :
+KDESalFrame::KDESalFrame( SalFrame* pParent, sal_uLong nState ) :
X11SalFrame( pParent, nState )
{
}
-void KDESalFrame::Show( BOOL bVisible, BOOL bNoActivate )
+void KDESalFrame::Show( sal_Bool bVisible, sal_Bool bNoActivate )
{
if ( !GetParent() && ! (GetStyle() & SAL_FRAME_STYLE_INTRO) )
{
@@ -86,12 +86,14 @@ static OUString readEntryUntranslated( KConfigGroup *pGroup, const char *pKey )
return OUString::createFromAscii( (const char *) pGroup->readEntryUntranslated( pKey ).toAscii() );
}
+#if 0
/** Helper function to read color from KConfig configuration repository.
*/
static Color readColor( KConfigGroup *pGroup, const char *pKey )
{
return toColor( pGroup->readEntry( pKey, QColor(Qt::white) ) );
}
+#endif
/** Helper function to add information to Font from QFont.
@@ -179,7 +181,7 @@ static Font toFont( const QFont &rQFont, const ::com::sun::star::lang::Locale& r
void KDESalFrame::UpdateSettings( AllSettings& rSettings )
{
StyleSettings style( rSettings.GetStyleSettings() );
- BOOL bSetTitleFont = false;
+ bool bSetTitleFont = false;
// General settings
QPalette pal = kapp->palette();
@@ -272,9 +274,9 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings )
{
Color aColor2 = style.GetLightColor();
style.
- SetCheckedColor( Color( (BYTE)(((USHORT)aBack.GetRed()+(USHORT)aColor2.GetRed())/2),
- (BYTE)(((USHORT)aBack.GetGreen()+(USHORT)aColor2.GetGreen())/2),
- (BYTE)(((USHORT)aBack.GetBlue()+(USHORT)aColor2.GetBlue())/2)
+ SetCheckedColor( Color( (sal_uInt8)(((sal_uInt16)aBack.GetRed()+(sal_uInt16)aColor2.GetRed())/2),
+ (sal_uInt8)(((sal_uInt16)aBack.GetGreen()+(sal_uInt16)aColor2.GetGreen())/2),
+ (sal_uInt8)(((sal_uInt16)aBack.GetBlue()+(sal_uInt16)aColor2.GetBlue())/2)
) );
}
@@ -402,4 +404,4 @@ SalGraphics* KDESalFrame::GetGraphics()
}
return NULL;
-} \ No newline at end of file
+}
diff --git a/vcl/unx/kde4/KDESalFrame.hxx b/vcl/unx/kde4/KDESalFrame.hxx
index 643be72c27f3..6ea6f6ef283e 100644
--- a/vcl/unx/kde4/KDESalFrame.hxx
+++ b/vcl/unx/kde4/KDESalFrame.hxx
@@ -47,12 +47,12 @@ class KDESalFrame : public X11SalFrame
GraphicsHolder m_aGraphics[ nMaxGraphics ];
public:
- KDESalFrame( SalFrame* pParent, ULONG nStyle );
+ KDESalFrame( SalFrame* pParent, sal_uLong nStyle );
virtual ~KDESalFrame();
virtual SalGraphics* GetGraphics();
virtual void ReleaseGraphics( SalGraphics *pGraphics );
virtual void updateGraphics( bool bClear );
virtual void UpdateSettings( AllSettings& rSettings );
- virtual void Show( BOOL bVisible, BOOL bNoActivate );
-}; \ No newline at end of file
+ virtual void Show( sal_Bool bVisible, sal_Bool bNoActivate );
+};
diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx
index 5a5cd11c52d9..9b37bf5e8e2a 100644
--- a/vcl/unx/kde4/KDESalGraphics.cxx
+++ b/vcl/unx/kde4/KDESalGraphics.cxx
@@ -100,7 +100,7 @@ KDESalGraphics::~KDESalGraphics()
delete m_image;
}
-BOOL KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart part )
+sal_Bool KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart part )
{
if (type == CTRL_PUSHBUTTON) return true;
@@ -154,9 +154,9 @@ BOOL KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart par
return false;
}
-BOOL KDESalGraphics::hitTestNativeControl( ControlType, ControlPart,
+sal_Bool KDESalGraphics::hitTestNativeControl( ControlType, ControlPart,
const Rectangle&, const Point&,
- BOOL& )
+ sal_Bool& )
{
return FALSE;
}
@@ -232,7 +232,7 @@ namespace
}
}
-BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
+sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
const Rectangle& rControlRegion, ControlState nControlState,
const ImplControlValue& value,
const OUString& )
@@ -243,7 +243,7 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
return false;
}
- BOOL returnVal = true;
+ sal_Bool returnVal = true;
QRect widgetRect = region2QRect(rControlRegion);
if( type == CTRL_SPINBOX && part == PART_ALL_BUTTONS )
@@ -562,8 +562,8 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
{
if( pTempClipRegion )
{
- if( pClipRegion_ )
- XIntersectRegion( pTempClipRegion, pClipRegion_, pTempClipRegion );
+ if( mpClipRegion )
+ XIntersectRegion( pTempClipRegion, mpClipRegion, pTempClipRegion );
XSetRegion( GetXDisplay(), gc, pTempClipRegion );
}
QPixmap pixmap = QPixmap::fromImage(*m_image, Qt::ColorOnly | Qt::OrderedDither | Qt::OrderedAlphaDither);
@@ -574,8 +574,8 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
if( pTempClipRegion )
{
- if( pClipRegion_ )
- XSetRegion( GetXDisplay(), gc, pClipRegion_ );
+ if( mpClipRegion )
+ XSetRegion( GetXDisplay(), gc, mpClipRegion );
else
XSetClipMask( GetXDisplay(), gc, None );
}
@@ -589,7 +589,7 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
return returnVal;
}
-BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
+sal_Bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
const Rectangle& controlRegion, ControlState controlState,
const ImplControlValue& val,
const OUString&,
@@ -769,7 +769,7 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
if( part == PART_BORDER )
{
int nFrameWidth = getFrameWidth();
- USHORT nStyle = val.getNumericVal();
+ sal_uInt16 nStyle = val.getNumericVal();
if( nStyle & FRAME_DRAW_NODRAW )
{
// in this case the question is: how thick would a frame be
diff --git a/vcl/unx/kde4/KDESalGraphics.hxx b/vcl/unx/kde4/KDESalGraphics.hxx
index 0bce1700f1fc..92b9a6b676a0 100644
--- a/vcl/unx/kde4/KDESalGraphics.hxx
+++ b/vcl/unx/kde4/KDESalGraphics.hxx
@@ -50,16 +50,16 @@ class KDESalGraphics : public X11SalGraphics
@param part Specification of the widget's part if it consists of more than one.
@return true if the platform supports native drawing of the widget type defined by part.
*/
- virtual BOOL IsNativeControlSupported( ControlType type, ControlPart part );
+ virtual sal_Bool IsNativeControlSupported( ControlType type, ControlPart part );
/** Test whether the position is in the native widget.
If the return value is TRUE, bIsInside contains information whether
aPos was or was not inside the native widget specified by the
type/part combination.
*/
- virtual BOOL hitTestNativeControl( ControlType type, ControlPart part,
+ virtual sal_Bool hitTestNativeControl( ControlType type, ControlPart part,
const Rectangle& rControlRegion, const Point& aPos,
- BOOL& rIsInside );
+ sal_Bool& rIsInside );
/** Draw the requested control described by part/nControlState.
@param rControlRegion
@@ -71,7 +71,7 @@ class KDESalGraphics : public X11SalGraphics
@param aCaption
A caption or title string (like button text etc.)
*/
- virtual BOOL drawNativeControl( ControlType type, ControlPart part,
+ virtual sal_Bool drawNativeControl( ControlType type, ControlPart part,
const Rectangle& rControlRegion, ControlState nControlState,
const ImplControlValue& aValue,
const rtl::OUString& aCaption );
@@ -84,7 +84,7 @@ class KDESalGraphics : public X11SalGraphics
@param aValue An optional value (tristate/numerical/string)
@param aCaption A caption or title string (like button text etc.)
*/
- virtual BOOL drawNativeControlText( ControlType, ControlPart,
+ virtual sal_Bool drawNativeControlText( ControlType, ControlPart,
const Rectangle&, ControlState,
const ImplControlValue&,
const rtl::OUString& ) { return false; }
@@ -105,9 +105,9 @@ class KDESalGraphics : public X11SalGraphics
@param aCaption
A caption or title string (like button text etc.)
*/
- virtual BOOL getNativeControlRegion( ControlType type, ControlPart part,
+ virtual sal_Bool getNativeControlRegion( ControlType type, ControlPart part,
const Rectangle& rControlRegion, ControlState nControlState,
const ImplControlValue& aValue,
const rtl::OUString& aCaption,
Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion );
-}; \ No newline at end of file
+};
diff --git a/vcl/unx/kde4/KDESalInstance.cxx b/vcl/unx/kde4/KDESalInstance.cxx
index 01c4723bd530..c8d0858279f3 100644
--- a/vcl/unx/kde4/KDESalInstance.cxx
+++ b/vcl/unx/kde4/KDESalInstance.cxx
@@ -29,7 +29,7 @@
#include "KDESalFrame.hxx"
-SalFrame* KDESalInstance::CreateFrame( SalFrame *pParent, ULONG nState )
+SalFrame* KDESalInstance::CreateFrame( SalFrame *pParent, sal_uLong nState )
{
return new KDESalFrame( pParent, nState );
-} \ No newline at end of file
+}
diff --git a/vcl/unx/kde4/KDESalInstance.hxx b/vcl/unx/kde4/KDESalInstance.hxx
index 7d050fe6819e..91907e586b0c 100644
--- a/vcl/unx/kde4/KDESalInstance.hxx
+++ b/vcl/unx/kde4/KDESalInstance.hxx
@@ -37,5 +37,5 @@ class KDESalInstance : public X11SalInstance
public:
KDESalInstance( SalYieldMutex* pMutex ) : X11SalInstance( pMutex ) {}
virtual ~KDESalInstance() {}
- virtual SalFrame* CreateFrame( SalFrame* pParent, ULONG nStyle );
-}; \ No newline at end of file
+ virtual SalFrame* CreateFrame( SalFrame* pParent, sal_uLong nStyle );
+};
diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx
index 6a2793b8abe3..3fb2bcaf487d 100644
--- a/vcl/unx/kde4/KDEXLib.cxx
+++ b/vcl/unx/kde4/KDEXLib.cxx
@@ -102,7 +102,7 @@ void KDEXLib::Init()
//kAboutData->setProgramIconName("OpenOffice");
m_nFakeCmdLineArgs = 1;
- USHORT nIdx;
+ int nIdx;
vos::OExtCommandLine aCommandLine;
int nParams = aCommandLine.getCommandArgCount();
rtl::OString aDisplay;
diff --git a/vcl/unx/kde4/VCLKDEApplication.cxx b/vcl/unx/kde4/VCLKDEApplication.cxx
index 2cfb071e96ae..5e3a85256313 100644
--- a/vcl/unx/kde4/VCLKDEApplication.cxx
+++ b/vcl/unx/kde4/VCLKDEApplication.cxx
@@ -49,4 +49,4 @@ bool VCLKDEApplication::x11EventFilter(XEvent* event)
}
return false;
-} \ No newline at end of file
+}
diff --git a/vcl/unx/kde4/VCLKDEApplication.hxx b/vcl/unx/kde4/VCLKDEApplication.hxx
index 2edfddd69a9c..7cbbe38b61df 100644
--- a/vcl/unx/kde4/VCLKDEApplication.hxx
+++ b/vcl/unx/kde4/VCLKDEApplication.hxx
@@ -50,4 +50,4 @@ class VCLKDEApplication : public KApplication
virtual bool x11EventFilter(XEvent* event);
SalKDEDisplay* disp;
-}; \ No newline at end of file
+};
diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx
index 91f6934f27f0..39d2803720c8 100644
--- a/vcl/unx/source/app/saldisp.cxx
+++ b/vcl/unx/source/app/saldisp.cxx
@@ -912,7 +912,7 @@ void SalDisplay::Init()
// carefully. if we are running linux (i.e. not netbsd) on an xfree
// display, fvwm is most probable the wm to choose, confusing with mwm
// doesn't harm. #57791# start maximized if possible
- if( (otherwm == eWindowManager_)
+ if( (otherwm == eWindowManager_)
|| (olwm == eWindowManager_ ))
{
eWindowManager_ = fvwm; // ???
@@ -2790,44 +2790,44 @@ SalVisual::SalVisual( const XVisualInfo* pXVI )
if( blue_mask == 0xFF )
eRGBMode_ = RGB;
else
- eRGBMode_ = other;
+ eRGBMode_ = otherSalRGB;
else if( blue_mask == 0xFF00 )
if( green_mask == 0xFF )
eRGBMode_ = RBG;
else
- eRGBMode_ = other;
+ eRGBMode_ = otherSalRGB;
else
- eRGBMode_ = other;
+ eRGBMode_ = otherSalRGB;
else if( green_mask == 0xFF0000 )
if( red_mask == 0xFF00 )
if( blue_mask == 0xFF )
eRGBMode_ = GRB;
else
- eRGBMode_ = other;
+ eRGBMode_ = otherSalRGB;
else if( blue_mask == 0xFF00 )
if( red_mask == 0xFF )
eRGBMode_ = GBR;
else
- eRGBMode_ = other;
+ eRGBMode_ = otherSalRGB;
else
- eRGBMode_ = other;
+ eRGBMode_ = otherSalRGB;
else if( blue_mask == 0xFF0000 )
if( red_mask == 0xFF00 )
if( green_mask == 0xFF )
eRGBMode_ = BRG;
else
- eRGBMode_ = other;
+ eRGBMode_ = otherSalRGB;
else if( green_mask == 0xFF00 )
if( red_mask == 0xFF )
eRGBMode_ = BGR;
else
- eRGBMode_ = other;
+ eRGBMode_ = otherSalRGB;
else
- eRGBMode_ = other;
+ eRGBMode_ = otherSalRGB;
else
- eRGBMode_ = other;
+ eRGBMode_ = otherSalRGB;
else
- eRGBMode_ = other;
+ eRGBMode_ = otherSalRGB;
}
}
@@ -2851,7 +2851,7 @@ sal_Bool SalVisual::Convert( int &n0, int &n1, int &n2, int &n3 )
switch( GetMode() )
{
- case other:
+ case otherSalRGB:
return sal_False;
case SALCOLOR:
break;
@@ -2886,7 +2886,7 @@ sal_Bool SalVisual::Convert( int &n0, int &n1, int &n2 )
switch( GetMode() )
{
- case other:
+ case otherSalRGB:
return sal_False;
case SALCOLOR:
break;
@@ -2939,7 +2939,7 @@ SalColor SalVisual::GetTCColor( Pixel nPixel ) const
Pixel g = nPixel & green_mask;
Pixel b = nPixel & blue_mask;
- if( other != eRGBMode_ ) // 8+8+8=24
+ if( otherSalRGB != eRGBMode_ ) // 8+8+8=24
return MAKE_SALCOLOR( r >> nRedShift_,
g >> nGreenShift_,
b >> nBlueShift_ );
@@ -2970,7 +2970,7 @@ Pixel SalVisual::GetTCPixel( SalColor nSalColor ) const
if( SALCOLORREVERSE == eRGBMode_ )
return (b << 16) | (g << 8) | (r);
- if( other != eRGBMode_ ) // 8+8+8=24
+ if( otherSalRGB != eRGBMode_ ) // 8+8+8=24
return (r << nRedShift_) | (g << nGreenShift_) | (b << nBlueShift_);
if( nRedShift_ > 0 ) r <<= nRedShift_; else r >>= -nRedShift_;
diff --git a/vcl/unx/source/dtrans/X11_clipboard.hxx b/vcl/unx/source/dtrans/X11_clipboard.hxx
index 21bf547a9cb7..2c0ee2d95c0d 100644
--- a/vcl/unx/source/dtrans/X11_clipboard.hxx
+++ b/vcl/unx/source/dtrans/X11_clipboard.hxx
@@ -54,12 +54,12 @@ namespace x11 {
>,
public SelectionAdaptor
{
- Reference< ::com::sun::star::datatransfer::XTransferable > m_aContents;
- Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner > m_aOwner;
+ com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > m_aContents;
+ com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner > m_aOwner;
SelectionManager& m_rSelectionManager;
- Reference< ::com::sun::star::lang::XInitialization > m_xSelectionManager;
- ::std::list< Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener > > m_aListeners;
+ com::sun::star::uno::Reference< ::com::sun::star::lang::XInitialization > m_xSelectionManager;
+ ::std::list< com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener > > m_aListeners;
Atom m_aSelection;
protected:
@@ -100,12 +100,12 @@ namespace x11 {
* XClipboard
*/
- virtual Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getContents()
+ virtual com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getContents()
throw(RuntimeException);
virtual void SAL_CALL setContents(
- const Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans,
- const Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner )
+ const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans,
+ const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner )
throw(RuntimeException);
virtual ::rtl::OUString SAL_CALL getName()
@@ -122,27 +122,27 @@ namespace x11 {
* XClipboardNotifier
*/
virtual void SAL_CALL addClipboardListener(
- const Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener )
+ const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener )
throw(RuntimeException);
virtual void SAL_CALL removeClipboardListener(
- const Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener )
+ const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener )
throw(RuntimeException);
/*
* SelectionAdaptor
*/
- virtual Reference< ::com::sun::star::datatransfer::XTransferable > getTransferable();
+ virtual com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > getTransferable();
virtual void clearTransferable();
virtual void fireContentsChanged();
- virtual Reference< XInterface > getReference() throw();
+ virtual com::sun::star::uno::Reference< XInterface > getReference() throw();
};
// ------------------------------------------------------------------------
Sequence< ::rtl::OUString > SAL_CALL X11Clipboard_getSupportedServiceNames();
- Reference< XInterface > SAL_CALL X11Clipboard_createInstance(
- const Reference< ::com::sun::star::lang::XMultiServiceFactory > & xMultiServiceFactory);
+ com::sun::star::uno::Reference< XInterface > SAL_CALL X11Clipboard_createInstance(
+ const com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xMultiServiceFactory);
// ------------------------------------------------------------------------
diff --git a/vcl/unx/source/dtrans/X11_dndcontext.hxx b/vcl/unx/source/dtrans/X11_dndcontext.hxx
index 9b48d346f03b..d8ef87444a7a 100644
--- a/vcl/unx/source/dtrans/X11_dndcontext.hxx
+++ b/vcl/unx/source/dtrans/X11_dndcontext.hxx
@@ -51,7 +51,7 @@ namespace x11 {
XLIB_Window m_aDropWindow;
XLIB_Time m_nTimestamp;
SelectionManager& m_rManager;
- Reference< XInterface > m_xManagerRef;
+ com::sun::star::uno::Reference< XInterface > m_xManagerRef;
public:
DropTargetDropContext( XLIB_Window, XLIB_Time, SelectionManager& );
virtual ~DropTargetDropContext();
@@ -70,7 +70,7 @@ namespace x11 {
XLIB_Window m_aDropWindow;
XLIB_Time m_nTimestamp;
SelectionManager& m_rManager;
- Reference< XInterface > m_xManagerRef;
+ com::sun::star::uno::Reference< XInterface > m_xManagerRef;
public:
DropTargetDragContext( XLIB_Window, XLIB_Time, SelectionManager& );
virtual ~DropTargetDragContext();
@@ -88,7 +88,7 @@ namespace x11 {
XLIB_Window m_aDropWindow;
XLIB_Time m_nTimestamp;
SelectionManager& m_rManager;
- Reference< XInterface > m_xManagerRef;
+ com::sun::star::uno::Reference< XInterface > m_xManagerRef;
public:
DragSourceContext( XLIB_Window, XLIB_Time, SelectionManager& );
virtual ~DragSourceContext();
diff --git a/vcl/unx/source/dtrans/X11_selection.cxx b/vcl/unx/source/dtrans/X11_selection.cxx
index 403ee9707a94..8188f2b1164a 100644
--- a/vcl/unx/source/dtrans/X11_selection.cxx
+++ b/vcl/unx/source/dtrans/X11_selection.cxx
@@ -80,6 +80,12 @@
EnterWindowMask |\
LeaveWindowMask
+namespace {
+
+namespace css = com::sun::star;
+
+}
+
using namespace com::sun::star::datatransfer;
using namespace com::sun::star::datatransfer::dnd;
using namespace com::sun::star::lang;
@@ -279,7 +285,8 @@ SelectionManager::SelectionManager() :
m_nXdndActionMove( None ),
m_nXdndActionLink( None ),
m_nXdndActionAsk( None ),
- m_nXdndActionPrivate( None )
+ m_nXdndActionPrivate( None ),
+ m_bShutDown( false )
{
m_aDropEnterEvent.data.l[0] = None;
m_aDragRunning.reset();
@@ -632,7 +639,7 @@ OString SelectionManager::convertToCompound( const OUString& rText )
// ------------------------------------------------------------------------
bool SelectionManager::convertData(
- const Reference< XTransferable >& xTransferable,
+ const css::uno::Reference< XTransferable >& xTransferable,
Atom nType,
Atom nSelection,
int& rFormat,
@@ -1527,7 +1534,7 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor,
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "trying bitmap conversion\n" );
#endif
- Reference<XBitmap> xBM( new BmpTransporter( aData ) );
+ css::uno::Reference<XBitmap> xBM( new BmpTransporter( aData ) );
Sequence<Any> aArgs(2), aOutArgs;
Sequence<sal_Int16> aOutIndex;
aArgs.getArray()[0] = makeAny( xBM );
@@ -1674,7 +1681,7 @@ bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest
if( pAdaptor &&
XGetSelectionOwner( m_pDisplay, rRequest.selection ) == m_aWindow )
{
- Reference< XTransferable > xTrans( pAdaptor->getTransferable() );
+ css::uno::Reference< XTransferable > xTrans( pAdaptor->getTransferable() );
if( rRequest.target == m_nTARGETSAtom )
{
// someone requests our types
@@ -1843,7 +1850,7 @@ bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest
dsde.DropAction = DNDConstants::ACTION_NONE;
dsde.DropSuccess = sal_False;
}
- Reference< XDragSourceListener > xListener( m_xDragSourceListener );
+ css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener );
m_xDragSourceListener.clear();
aGuard.clear();
if( xListener.is() )
@@ -2364,7 +2371,7 @@ void SelectionManager::dropComplete( sal_Bool bSuccess, XLIB_Window aDropWindow,
dsde.DragSource = static_cast< XDragSource* >(this);
dsde.DropAction = getUserDragAction();
dsde.DropSuccess = bSuccess;
- Reference< XDragSourceListener > xListener = m_xDragSourceListener;
+ css::uno::Reference< XDragSourceListener > xListener = m_xDragSourceListener;
m_xDragSourceListener.clear();
aGuard.clear();
@@ -2448,7 +2455,7 @@ void SelectionManager::sendDragStatus( Atom nDropAction )
dsde.DropAction = m_nSourceActions;
dsde.UserAction = getUserDragAction();
- Reference< XDragSourceListener > xListener( m_xDragSourceListener );
+ css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener );
// caution: do not change anything after this
aGuard.clear();
if( xListener.is() )
@@ -2710,7 +2717,7 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage )
dsde.DragSource = static_cast< XDragSource* >(this);
dsde.DropAction = m_nTargetAcceptAction;
dsde.DropSuccess = m_bDropSuccess;
- Reference< XDragSourceListener > xListener( m_xDragSourceListener );
+ css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener );
m_xDragSourceListener.clear();
aGuard.clear();
xListener->dragDropEnd( dsde );
@@ -2776,7 +2783,7 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage )
dsde.DragSource = static_cast< XDragSource* >(this);
dsde.DropAction = DNDConstants::ACTION_NONE;
dsde.DropSuccess = sal_False;
- Reference< XDragSourceListener > xListener( m_xDragSourceListener );
+ css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener );
m_xDragSourceListener.clear();
aGuard.clear();
xListener->dragDropEnd( dsde );
@@ -2902,7 +2909,7 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage )
m_nDropTimeout = time( NULL );
// HACK :-)
aGuard.clear();
- static_cast< X11Clipboard* >( pAdaptor )->setContents( m_xDragSourceTransferable, Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >() );
+ static_cast< X11Clipboard* >( pAdaptor )->setContents( m_xDragSourceTransferable, css::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >() );
aGuard.reset();
bCancel = false;
}
@@ -2917,7 +2924,7 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage )
dsde.DragSource = static_cast< XDragSource* >(this);
dsde.DropAction = DNDConstants::ACTION_NONE;
dsde.DropSuccess = sal_False;
- Reference< XDragSourceListener > xListener( m_xDragSourceListener );
+ css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener );
m_xDragSourceListener.clear();
aGuard.clear();
xListener->dragDropEnd( dsde );
@@ -3071,7 +3078,7 @@ void SelectionManager::updateDragWindow( int nX, int nY, XLIB_Window aRoot )
{
ResettableMutexGuard aGuard( m_aMutex );
- Reference< XDragSourceListener > xListener( m_xDragSourceListener );
+ css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener );
m_nLastDragX = nX;
m_nLastDragY = nY;
@@ -3231,8 +3238,8 @@ void SelectionManager::startDrag(
sal_Int8 sourceActions,
sal_Int32,
sal_Int32,
- const Reference< XTransferable >& transferable,
- const Reference< XDragSourceListener >& listener
+ const css::uno::Reference< XTransferable >& transferable,
+ const css::uno::Reference< XDragSourceListener >& listener
) throw()
{
#if OSL_DEBUG_LEVEL > 1
@@ -3516,8 +3523,8 @@ void SelectionManager::dragDoDispatch()
{
ClearableMutexGuard aGuard(m_aMutex);
- Reference< XDragSourceListener > xListener( m_xDragSourceListener );
- Reference< XTransferable > xTransferable( m_xDragSourceTransferable );
+ css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener );
+ css::uno::Reference< XTransferable > xTransferable( m_xDragSourceTransferable );
m_xDragSourceListener.clear();
m_xDragSourceTransferable.clear();
@@ -3787,10 +3794,10 @@ void SelectionManager::run( void* pThis )
timeval aLast;
gettimeofday( &aLast, 0 );
- Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() );
+ css::uno::Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() );
if( xFact.is() )
{
- Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ), UNO_QUERY );
+ css::uno::Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ), UNO_QUERY );
if( xDesktop.is() )
xDesktop->addTerminateListener(This);
}
@@ -3805,7 +3812,7 @@ void SelectionManager::run( void* pThis )
if( (aNow.tv_sec - aLast.tv_sec) > 0 )
{
ClearableMutexGuard aGuard(This->m_aMutex);
- std::list< std::pair< SelectionAdaptor*, Reference< XInterface > > > aChangeList;
+ std::list< std::pair< SelectionAdaptor*, css::uno::Reference< XInterface > > > aChangeList;
for( std::hash_map< Atom, Selection* >::iterator it = This->m_aSelections.begin(); it != This->m_aSelections.end(); ++it )
{
@@ -3815,7 +3822,7 @@ void SelectionManager::run( void* pThis )
if( aOwner != it->second->m_aLastOwner )
{
it->second->m_aLastOwner = aOwner;
- std::pair< SelectionAdaptor*, Reference< XInterface > >
+ std::pair< SelectionAdaptor*, css::uno::Reference< XInterface > >
aKeep( it->second->m_pAdaptor, it->second->m_pAdaptor->getReference() );
aChangeList.push_back( aKeep );
}
@@ -3838,6 +3845,11 @@ void SelectionManager::run( void* pThis )
void SelectionManager::shutdown() throw()
{
ResettableMutexGuard aGuard(m_aMutex);
+ if( m_bShutDown )
+ {
+ return;
+ }
+ m_bShutDown = true;
// stop dispatching
if( m_aThread )
{
@@ -3927,7 +3939,7 @@ void SAL_CALL SelectionManager::queryTermination( const ::com::sun::star::lang::
void SAL_CALL SelectionManager::notifyTermination( const ::com::sun::star::lang::EventObject& rEvent )
throw( ::com::sun::star::uno::RuntimeException )
{
- Reference< XDesktop > xDesktop( rEvent.Source, UNO_QUERY );
+ css::uno::Reference< XDesktop > xDesktop( rEvent.Source, UNO_QUERY );
if( xDesktop.is() == sal_True )
xDesktop->removeTerminateListener( this );
#if OSL_DEBUG_LEVEL > 1
@@ -4060,7 +4072,7 @@ void SelectionManager::deregisterDropTarget( XLIB_Window aWindow )
dsde.DragSource = static_cast< XDragSource* >(this);
dsde.DropAction = DNDConstants::ACTION_NONE;
dsde.DropSuccess = sal_False;
- Reference< XDragSourceListener > xListener( m_xDragSourceListener );
+ css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener );
m_xDragSourceListener.clear();
aGuard.clear();
xListener->dragDropEnd( dsde );
@@ -4071,7 +4083,7 @@ void SelectionManager::deregisterDropTarget( XLIB_Window aWindow )
* SelectionAdaptor
*/
-Reference< XTransferable > SelectionManager::getTransferable() throw()
+css::uno::Reference< XTransferable > SelectionManager::getTransferable() throw()
{
return m_xDragSourceTransferable;
}
@@ -4091,9 +4103,9 @@ void SelectionManager::fireContentsChanged() throw()
// ------------------------------------------------------------------------
-Reference< XInterface > SelectionManager::getReference() throw()
+css::uno::Reference< XInterface > SelectionManager::getReference() throw()
{
- return Reference< XInterface >( static_cast<OWeakObject*>(this) );
+ return css::uno::Reference< XInterface >( static_cast<OWeakObject*>(this) );
}
// ------------------------------------------------------------------------
@@ -4124,7 +4136,7 @@ void SelectionManagerHolder::initialize( const Sequence< Any >& arguments ) thro
if( arguments.getLength() > 0 )
{
- Reference< XDisplayConnection > xConn;
+ css::uno::Reference< XDisplayConnection > xConn;
arguments.getConstArray()[0] >>= xConn;
if( xConn.is() )
{
@@ -4159,8 +4171,8 @@ sal_Int32 SelectionManagerHolder::getDefaultCursor( sal_Int8 dragAction ) throw(
void SelectionManagerHolder::startDrag(
const ::com::sun::star::datatransfer::dnd::DragGestureEvent& trigger,
sal_Int8 sourceActions, sal_Int32 cursor, sal_Int32 image,
- const Reference< ::com::sun::star::datatransfer::XTransferable >& transferable,
- const Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener >& listener
+ const css::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& transferable,
+ const css::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener >& listener
) throw()
{
if( m_xRealDragSource.is() )
diff --git a/vcl/unx/source/dtrans/X11_selection.hxx b/vcl/unx/source/dtrans/X11_selection.hxx
index 47baa1776d1a..34a50819bfed 100644
--- a/vcl/unx/source/dtrans/X11_selection.hxx
+++ b/vcl/unx/source/dtrans/X11_selection.hxx
@@ -66,10 +66,10 @@ namespace x11 {
class SelectionAdaptor
{
public:
- virtual Reference< ::com::sun::star::datatransfer::XTransferable > getTransferable() = 0;
+ virtual com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > getTransferable() = 0;
virtual void clearTransferable() = 0;
virtual void fireContentsChanged() = 0;
- virtual Reference< XInterface > getReference() = 0;
+ virtual com::sun::star::uno::Reference< XInterface > getReference() = 0;
// returns a reference that will keep the SelectionAdaptor alive until the
// refernce is released
};
@@ -87,9 +87,9 @@ namespace x11 {
sal_Int8 m_nDefaultActions;
XLIB_Window m_aTargetWindow;
class SelectionManager* m_pSelectionManager;
- Reference< ::com::sun::star::datatransfer::dnd::XDragSource >
+ com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource >
m_xSelectionManager;
- ::std::list< Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener > >
+ ::std::list< com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener > >
m_aListeners;
DropTarget();
@@ -105,8 +105,8 @@ namespace x11 {
virtual void SAL_CALL initialize( const Sequence< Any >& args ) throw ( ::com::sun::star::uno::Exception );
// XDropTarget
- virtual void SAL_CALL addDropTargetListener( const Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& ) throw();
- virtual void SAL_CALL removeDropTargetListener( const Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& ) throw();
+ virtual void SAL_CALL addDropTargetListener( const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& ) throw();
+ virtual void SAL_CALL removeDropTargetListener( const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& ) throw();
virtual sal_Bool SAL_CALL isActive() throw();
virtual void SAL_CALL setActive( sal_Bool active ) throw();
virtual sal_Int8 SAL_CALL getDefaultActions() throw();
@@ -127,7 +127,7 @@ namespace x11 {
>
{
::osl::Mutex m_aMutex;
- Reference< ::com::sun::star::datatransfer::dnd::XDragSource >
+ com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource >
m_xRealDragSource;
public:
SelectionManagerHolder();
@@ -148,8 +148,8 @@ namespace x11 {
virtual void SAL_CALL startDrag(
const ::com::sun::star::datatransfer::dnd::DragGestureEvent& trigger,
sal_Int8 sourceActions, sal_Int32 cursor, sal_Int32 image,
- const Reference< ::com::sun::star::datatransfer::XTransferable >& transferable,
- const Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener >& listener
+ const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& transferable,
+ const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener >& listener
) throw();
};
@@ -260,9 +260,9 @@ namespace x11 {
oslThread m_aDragExecuteThread;
::osl::Condition m_aDragRunning;
XLIB_Window m_aWindow;
- Reference< ::com::sun::star::awt::XDisplayConnection >
+ com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayConnection >
m_xDisplayConnection;
- Reference< com::sun::star::script::XInvocation >
+ com::sun::star::uno::Reference< com::sun::star::script::XInvocation >
m_xBitmapConverter;
sal_Int32 m_nSelectionTimeout;
XLIB_Time m_nSelectionTimestamp;
@@ -285,7 +285,7 @@ namespace x11 {
XLIB_Time m_nDropTime;
sal_Int8 m_nLastDropAction;
// XTransferable for Xdnd with foreign drag source
- Reference< ::com::sun::star::datatransfer::XTransferable >
+ com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >
m_xDropTransferable;
int m_nLastX, m_nLastY;
XLIB_Time m_nDropTimestamp;
@@ -303,9 +303,9 @@ namespace x11 {
XLIB_Window m_aDropProxy;
XLIB_Window m_aDragSourceWindow;
// XTransferable for Xdnd when we are drag source
- Reference< ::com::sun::star::datatransfer::XTransferable >
+ com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >
m_xDragSourceTransferable;
- Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener >
+ com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener >
m_xDragSourceListener;
// root coordinates
int m_nLastDragX, m_nLastDragY;
@@ -383,6 +383,7 @@ namespace x11 {
// since this leads to deadlocks in different Xlib implentations
// (XFree as well as Xsun) use an own mutex instead
::osl::Mutex m_aMutex;
+ bool m_bShutDown;
SelectionManager();
~SelectionManager();
@@ -409,7 +410,7 @@ namespace x11 {
bool getPasteData( Atom selection, Atom type, Sequence< sal_Int8 >& rData );
// returns true if conversion was successful
- bool convertData( const Reference< ::com::sun::star::datatransfer::XTransferable >& xTransferable,
+ bool convertData( const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTransferable,
Atom nType,
Atom nSelection,
int & rFormat,
@@ -494,15 +495,15 @@ namespace x11 {
virtual void SAL_CALL startDrag(
const ::com::sun::star::datatransfer::dnd::DragGestureEvent& trigger,
sal_Int8 sourceActions, sal_Int32 cursor, sal_Int32 image,
- const Reference< ::com::sun::star::datatransfer::XTransferable >& transferable,
- const Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener >& listener
+ const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& transferable,
+ const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener >& listener
) throw();
// SelectionAdaptor for XdndSelection Drag (we are drag source)
- virtual Reference< ::com::sun::star::datatransfer::XTransferable > getTransferable() throw();
+ virtual com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > getTransferable() throw();
virtual void clearTransferable() throw();
virtual void fireContentsChanged() throw();
- virtual Reference< XInterface > getReference() throw();
+ virtual com::sun::star::uno::Reference< XInterface > getReference() throw();
// XEventListener
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException );
diff --git a/vcl/unx/source/dtrans/X11_service.cxx b/vcl/unx/source/dtrans/X11_service.cxx
index e14d81643553..d15518c0b9ab 100644
--- a/vcl/unx/source/dtrans/X11_service.cxx
+++ b/vcl/unx/source/dtrans/X11_service.cxx
@@ -39,6 +39,12 @@
#include <cppuhelper/factory.hxx>
#include <cppuhelper/compbase1.hxx>
+namespace {
+
+namespace css = com::sun::star;
+
+}
+
using namespace rtl;
using namespace cppu;
using namespace com::sun::star::lang;
@@ -69,9 +75,9 @@ Sequence< OUString > SAL_CALL x11::Xdnd_dropTarget_getSupportedServiceNames()
// ------------------------------------------------------------------------
-Reference< XInterface > X11SalInstance::CreateClipboard( const Sequence< Any >& arguments )
+css::uno::Reference< XInterface > X11SalInstance::CreateClipboard( const Sequence< Any >& arguments )
{
- static std::hash_map< OUString, ::std::hash_map< Atom, Reference< XClipboard > >, ::rtl::OUStringHash > m_aInstances;
+ static std::hash_map< OUString, ::std::hash_map< Atom, css::uno::Reference< XClipboard > >, ::rtl::OUStringHash > m_aInstances;
OUString aDisplayName;
Atom nSelection;
@@ -80,7 +86,7 @@ Reference< XInterface > X11SalInstance::CreateClipboard( const Sequence< Any >&
// by SelectionManager.initialize() if no display connection is given.
if( arguments.getLength() > 0 )
{
- Reference< XDisplayConnection > xConn;
+ css::uno::Reference< XDisplayConnection > xConn;
arguments.getConstArray()[0] >>= xConn;
if( xConn.is() )
@@ -107,8 +113,8 @@ Reference< XInterface > X11SalInstance::CreateClipboard( const Sequence< Any >&
nSelection = rManager.getAtom( OUString::createFromAscii( "CLIPBOARD" ) );
}
- ::std::hash_map< Atom, Reference< XClipboard > >& rMap( m_aInstances[ aDisplayName ] );
- ::std::hash_map< Atom, Reference< XClipboard > >::iterator it = rMap.find( nSelection );
+ ::std::hash_map< Atom, css::uno::Reference< XClipboard > >& rMap( m_aInstances[ aDisplayName ] );
+ ::std::hash_map< Atom, css::uno::Reference< XClipboard > >::iterator it = rMap.find( nSelection );
if( it != rMap.end() )
return it->second;
@@ -120,16 +126,16 @@ Reference< XInterface > X11SalInstance::CreateClipboard( const Sequence< Any >&
// ------------------------------------------------------------------------
-Reference< XInterface > X11SalInstance::CreateDragSource()
+css::uno::Reference< XInterface > X11SalInstance::CreateDragSource()
{
- return Reference < XInterface >( ( OWeakObject * ) new SelectionManagerHolder() );
+ return css::uno::Reference < XInterface >( ( OWeakObject * ) new SelectionManagerHolder() );
}
// ------------------------------------------------------------------------
-Reference< XInterface > X11SalInstance::CreateDropTarget()
+css::uno::Reference< XInterface > X11SalInstance::CreateDropTarget()
{
- return Reference < XInterface >( ( OWeakObject * ) new DropTarget() );
+ return css::uno::Reference < XInterface >( ( OWeakObject * ) new DropTarget() );
}
diff --git a/vcl/unx/source/dtrans/X11_transferable.hxx b/vcl/unx/source/dtrans/X11_transferable.hxx
index 57f0d6682cab..65f7d1fdc475 100644
--- a/vcl/unx/source/dtrans/X11_transferable.hxx
+++ b/vcl/unx/source/dtrans/X11_transferable.hxx
@@ -44,10 +44,10 @@ namespace x11 {
::osl::Mutex m_aMutex;
SelectionManager& m_rManager;
- Reference< XInterface > m_xCreator;
+ com::sun::star::uno::Reference< XInterface > m_xCreator;
Atom m_aSelection;
public:
- X11Transferable( SelectionManager& rManager, const Reference< XInterface >& xCreator, Atom selection = None );
+ X11Transferable( SelectionManager& rManager, const com::sun::star::uno::Reference< XInterface >& xCreator, Atom selection = None );
virtual ~X11Transferable();
/*
diff --git a/vcl/unx/source/fontmanager/fontmanager.cxx b/vcl/unx/source/fontmanager/fontmanager.cxx
index 21183dc567ec..d72692b86a65 100644
--- a/vcl/unx/source/fontmanager/fontmanager.cxx
+++ b/vcl/unx/source/fontmanager/fontmanager.cxx
@@ -87,6 +87,12 @@
#define PRINTER_METRICDIR "fontmetric"
+namespace {
+
+namespace css = com::sun::star;
+
+}
+
using namespace vcl;
using namespace utl;
using namespace psp;
@@ -3942,10 +3948,10 @@ bool PrintFontManager::readOverrideMetrics()
if( ! m_aOverrideFonts.empty() )
return false;
- Reference< XMultiServiceFactory > xFact( comphelper::getProcessServiceFactory() );
+ css::uno::Reference< XMultiServiceFactory > xFact( comphelper::getProcessServiceFactory() );
if( !xFact.is() )
return false;
- Reference< XMaterialHolder > xMat(
+ css::uno::Reference< XMaterialHolder > xMat(
xFact->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.psprint.CompatMetricOverride" ) ) ),
UNO_QUERY );
if( !xMat.is() )
diff --git a/vcl/unx/source/gdi/pspgraphics.cxx b/vcl/unx/source/gdi/pspgraphics.cxx
index 0edf2326b58d..f9a156c841fc 100644
--- a/vcl/unx/source/gdi/pspgraphics.cxx
+++ b/vcl/unx/source/gdi/pspgraphics.cxx
@@ -41,6 +41,7 @@
#include "vcl/svapp.hxx"
#include "vcl/salprn.hxx"
#include "vcl/sysdata.hxx"
+#include "vcl/region.h"
#include <stdlib.h>
#include <unistd.h>
@@ -290,28 +291,27 @@ long PspGraphics::GetGraphicsWidth() const
void PspGraphics::ResetClipRegion()
{
- m_pPrinterGfx->ResetClipRegion ();
+ m_pPrinterGfx->ResetClipRegion();
}
-void PspGraphics::BeginSetClipRegion( sal_uLong n )
+bool PspGraphics::setClipRegion( const Region& i_rClip )
{
- m_pPrinterGfx->BeginSetClipRegion(n);
-}
-
-sal_Bool PspGraphics::unionClipRegion( long nX, long nY, long nDX, long nDY )
-{
- return (sal_Bool)m_pPrinterGfx->UnionClipRegion (nX, nY, nDX, nDY);
-}
+ // TODO: support polygonal clipregions here
+ m_pPrinterGfx->BeginSetClipRegion( i_rClip.GetRectCount() );
-bool PspGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& )
-{
- // TODO: implement and advertise OutDevSupport_B2DClip support
- return false;
-}
-
-void PspGraphics::EndSetClipRegion()
-{
- m_pPrinterGfx->EndSetClipRegion ();
+ ImplRegionInfo aInfo;
+ long nX, nY, nW, nH;
+ bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH );
+ while( bRegionRect )
+ {
+ if ( nW && nH )
+ {
+ m_pPrinterGfx->UnionClipRegion( nX, nY, nW, nH );
+ }
+ bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH );
+ }
+ m_pPrinterGfx->EndSetClipRegion();
+ return true;
}
void PspGraphics::SetLineColor()
diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx
index 979e3927024a..df23220ea6d5 100644
--- a/vcl/unx/source/gdi/salgdi.cxx
+++ b/vcl/unx/source/gdi/salgdi.cxx
@@ -40,6 +40,7 @@
#include "vcl/printergfx.hxx"
#include "vcl/jobdata.hxx"
+#include "vcl/region.h"
#include "tools/debug.hxx"
@@ -104,7 +105,7 @@ X11SalGraphics::X11SalGraphics()
m_aRenderPicture = 0;
m_pRenderFormat = NULL;
- pClipRegion_ = NULL;
+ mpClipRegion = NULL;
pPaintRegion_ = NULL;
pPenGC_ = NULL;
@@ -167,7 +168,7 @@ void X11SalGraphics::freeResources()
Display *pDisplay = GetXDisplay();
DBG_ASSERT( !pPaintRegion_, "pPaintRegion_" );
- if( pClipRegion_ ) XDestroyRegion( pClipRegion_ ), pClipRegion_ = None;
+ if( mpClipRegion ) XDestroyRegion( mpClipRegion ), mpClipRegion = None;
if( hBrush_ ) XFreePixmap( pDisplay, hBrush_ ), hBrush_ = None;
if( pPenGC_ ) XFreeGC( pDisplay, pPenGC_ ), pPenGC_ = None;
@@ -257,8 +258,8 @@ void X11SalGraphics::SetClipRegion( GC pGC, XLIB_Region pXReg ) const
int n = 0;
XLIB_Region Regions[3];
- if( pClipRegion_ /* && !XEmptyRegion( pClipRegion_ ) */ )
- Regions[n++] = pClipRegion_;
+ if( mpClipRegion /* && !XEmptyRegion( mpClipRegion ) */ )
+ Regions[n++] = mpClipRegion;
// if( pPaintRegion_ /* && !XEmptyRegion( pPaintRegion_ ) */ )
// Regions[n++] = pPaintRegion_;
@@ -571,7 +572,7 @@ long X11SalGraphics::GetGraphicsHeight() const
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void X11SalGraphics::ResetClipRegion()
{
- if( pClipRegion_ )
+ if( mpClipRegion )
{
bPenGC_ = sal_False;
bFontGC_ = sal_False;
@@ -583,46 +584,36 @@ void X11SalGraphics::ResetClipRegion()
bStippleGC_ = sal_False;
bTrackingGC_ = sal_False;
- XDestroyRegion( pClipRegion_ );
- pClipRegion_ = NULL;
+ XDestroyRegion( mpClipRegion );
+ mpClipRegion = NULL;
}
}
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void X11SalGraphics::BeginSetClipRegion( sal_uLong )
+bool X11SalGraphics::setClipRegion( const Region& i_rClip )
{
- if( pClipRegion_ )
- XDestroyRegion( pClipRegion_ );
- pClipRegion_ = XCreateRegion();
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-BOOL X11SalGraphics::unionClipRegion( long nX, long nY, long nDX, long nDY )
-{
- if (!nDX || !nDY)
- return sal_True;
-
- XRectangle aRect;
- aRect.x = (short)nX;
- aRect.y = (short)nY;
- aRect.width = (unsigned short)nDX;
- aRect.height = (unsigned short)nDY;
-
- XUnionRectWithRegion( &aRect, pClipRegion_, pClipRegion_ );
-
- return sal_True;
-}
+ if( mpClipRegion )
+ XDestroyRegion( mpClipRegion );
+ mpClipRegion = XCreateRegion();
+
+ ImplRegionInfo aInfo;
+ long nX, nY, nW, nH;
+ bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH );
+ while( bRegionRect )
+ {
+ if ( nW && nH )
+ {
+ XRectangle aRect;
+ aRect.x = (short)nX;
+ aRect.y = (short)nY;
+ aRect.width = (unsigned short)nW;
+ aRect.height = (unsigned short)nH;
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-bool X11SalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& )
-{
- // TODO: implement and advertise OutDevSupport_B2DClip support
- return false;
-}
+ XUnionRectWithRegion( &aRect, mpClipRegion, mpClipRegion );
+ }
+ bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH );
+ }
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void X11SalGraphics::EndSetClipRegion()
-{
+ // done, invalidate GCs
bPenGC_ = sal_False;
bFontGC_ = sal_False;
bBrushGC_ = sal_False;
@@ -633,11 +624,12 @@ void X11SalGraphics::EndSetClipRegion()
bStippleGC_ = sal_False;
bTrackingGC_ = sal_False;
- if( XEmptyRegion( pClipRegion_ ) )
+ if( XEmptyRegion( mpClipRegion ) )
{
- XDestroyRegion( pClipRegion_ );
- pClipRegion_= NULL;
+ XDestroyRegion( mpClipRegion );
+ mpClipRegion= NULL;
}
+ return true;
}
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -1047,8 +1039,8 @@ XID X11SalGraphics::GetXRenderPicture()
#if 0
// setup clipping so the callers don't have to do it themselves
// TODO: avoid clipping if already set correctly
- if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) )
- rRenderPeer.SetPictureClipRegion( aDstPic, pClipRegion_ );
+ if( mpClipRegion && !XEmptyRegion( mpClipRegion ) )
+ rRenderPeer.SetPictureClipRegion( aDstPic, mpClipRegion );
else
#endif
{
@@ -1185,8 +1177,8 @@ bool X11SalGraphics::drawFilledTrapezoids( const ::basegfx::B2DTrapezoid* pB2DTr
// set clipping
// TODO: move into GetXRenderPicture?
- if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) )
- rRenderPeer.SetPictureClipRegion( aDstPic, pClipRegion_ );
+ if( mpClipRegion && !XEmptyRegion( mpClipRegion ) )
+ rRenderPeer.SetPictureClipRegion( aDstPic, mpClipRegion );
// render the trapezoids
const XRenderPictFormat* pMaskFormat = rRenderPeer.GetStandardFormatA8();
@@ -1225,6 +1217,7 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, double
aPolygon.transform( basegfx::tools::createTranslateB2DHomMatrix(+fHalfWidth,+fHalfWidth) );
// shortcut for hairline drawing to improve performance
+ bool bDrawnOk = true;
if( bIsHairline )
{
// hairlines can benefit from a simplified tesselation
@@ -1233,17 +1226,13 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, double
basegfx::tools::createLineTrapezoidFromB2DPolygon( aB2DTrapVector, aPolygon, rLineWidth.getX() );
// draw tesselation result
- if( ! aB2DTrapVector.empty() )
- {
- const int nTrapCount = aB2DTrapVector.size();
- const bool bDrawOk = drawFilledTrapezoids( &aB2DTrapVector[0], nTrapCount, fTransparency );
+ const int nTrapCount = aB2DTrapVector.size();
+ if( nTrapCount > 0 )
+ bDrawnOk = drawFilledTrapezoids( &aB2DTrapVector[0], nTrapCount, fTransparency );
- // restore the original brush GC
- nBrushColor_ = aKeepBrushColor;
- return bDrawOk;
- }
- else
- return true;
+ // restore the original brush GC
+ nBrushColor_ = aKeepBrushColor;
+ return bDrawnOk;
}
// get the area polygon for the line polygon
@@ -1266,19 +1255,18 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, double
// draw each area polypolygon component individually
// to emulate the polypolygon winding rule "non-zero"
- bool bDrawOk = true;
const int nPolyCount = aAreaPolyPoly.count();
for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx )
{
const ::basegfx::B2DPolyPolygon aOnePoly( aAreaPolyPoly.getB2DPolygon( nPolyIdx ) );
- bDrawOk = drawPolyPolygon( aOnePoly, fTransparency );
- if( !bDrawOk )
+ bDrawnOk = drawPolyPolygon( aOnePoly, fTransparency );
+ if( !bDrawnOk )
break;
}
// restore the original brush GC
nBrushColor_ = aKeepBrushColor;
- return bDrawOk;
+ return bDrawnOk;
}
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
diff --git a/vcl/unx/source/gdi/salgdi2.cxx b/vcl/unx/source/gdi/salgdi2.cxx
index 018f7514dfeb..624360b21d29 100644
--- a/vcl/unx/source/gdi/salgdi2.cxx
+++ b/vcl/unx/source/gdi/salgdi2.cxx
@@ -308,8 +308,8 @@ int X11SalGraphics::Clip( int &nX,
&& RectangleOut == Clip( pPaintRegion_, nX, nY, nDX, nDY, nSrcX, nSrcY ) )
return RectangleOut;
- if( pClipRegion_
- && RectangleOut == Clip( pClipRegion_, nX, nY, nDX, nDY, nSrcX, nSrcY ) )
+ if( mpClipRegion
+ && RectangleOut == Clip( mpClipRegion, nX, nY, nDX, nDY, nSrcX, nSrcY ) )
return RectangleOut;
int nPaint;
@@ -323,9 +323,9 @@ int X11SalGraphics::Clip( int &nX,
nPaint = RectangleIn;
int nClip;
- if( pClipRegion_ )
+ if( mpClipRegion )
{
- nClip = XRectInRegion( pClipRegion_, nX, nY, nDX, nDY );
+ nClip = XRectInRegion( mpClipRegion, nX, nY, nDX, nDY );
if( RectangleOut == nClip )
return RectangleOut;
}
@@ -888,8 +888,8 @@ bool X11SalGraphics::drawAlphaBitmap( const SalTwoRect& rTR,
return false;
// set clipping
- if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) )
- rPeer.SetPictureClipRegion( aDstPic, pClipRegion_ );
+ if( mpClipRegion && !XEmptyRegion( mpClipRegion ) )
+ rPeer.SetPictureClipRegion( aDstPic, mpClipRegion );
// paint source * mask over destination picture
rPeer.CompositePicture( PictOpOver, aSrcPic, aAlphaPic, aDstPic,
diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx
index c719b33a1fbf..6684b5664887 100644
--- a/vcl/unx/source/gdi/salgdi3.cxx
+++ b/vcl/unx/source/gdi/salgdi3.cxx
@@ -528,16 +528,16 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
if (const void *pOptions = Application::GetSettings().GetStyleSettings().GetCairoFontOptions())
rCairo.set_font_options( cr, pOptions);
- if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) )
- {
- for (long i = 0; i < pClipRegion_->numRects; ++i)
+ if( mpClipRegion && !XEmptyRegion( mpClipRegion ) )
{
+ for (long i = 0; i < mpClipRegion->numRects; ++i)
+ {
rCairo.rectangle(cr,
- pClipRegion_->rects[i].x1,
- pClipRegion_->rects[i].y1,
- pClipRegion_->rects[i].x2 - pClipRegion_->rects[i].x1,
- pClipRegion_->rects[i].y2 - pClipRegion_->rects[i].y1);
- }
+ mpClipRegion->rects[i].x1,
+ mpClipRegion->rects[i].y1,
+ mpClipRegion->rects[i].x2 - mpClipRegion->rects[i].x1,
+ mpClipRegion->rects[i].y2 - mpClipRegion->rects[i].y1);
+ }
rCairo.clip(cr);
}
@@ -621,8 +621,8 @@ void X11SalGraphics::DrawServerAAFontString( const ServerFontLayout& rLayout )
// set clipping
// TODO: move into GetXRenderPicture()?
- if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) )
- rRenderPeer.SetPictureClipRegion( aDstPic, pClipRegion_ );
+ if( mpClipRegion && !XEmptyRegion( mpClipRegion ) )
+ rRenderPeer.SetPictureClipRegion( aDstPic, mpClipRegion );
ServerFont& rFont = rLayout.GetServerFont();
X11GlyphPeer& rGlyphPeer = X11GlyphCache::GetInstance().GetPeer();
@@ -705,10 +705,10 @@ bool X11SalGraphics::DrawServerAAForcedString( const ServerFontLayout& rLayout )
else if( m_pVDev )
nWidth = m_pVDev->GetWidth(), nHeight = m_pVDev->GetHeight();
- if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) )
+ if( mpClipRegion && !XEmptyRegion( mpClipRegion ) )
{
// get bounding box
- XClipBox( pClipRegion_, &aXRect );
+ XClipBox( mpClipRegion, &aXRect );
// clip with window
if( aXRect.x < 0 ) aXRect.x = 0;
diff --git a/vcl/unx/source/gdi/salprnpsp.cxx b/vcl/unx/source/gdi/salprnpsp.cxx
index f3b50db6a9d9..65a0802e9fe2 100644
--- a/vcl/unx/source/gdi/salprnpsp.cxx
+++ b/vcl/unx/source/gdi/salprnpsp.cxx
@@ -1188,6 +1188,8 @@ sal_Bool PspSalPrinter::StartJob( const String* i_pFileName, const String& i_rJo
aContext.Tagged = false;
aContext.EmbedStandardFonts = true;
aContext.DocumentLocale = Application::GetSettings().GetLocale();
+ aContext.ColorMode = i_rController.getPrinter()->GetPrinterOptions().IsConvertToGreyscales()
+ ? vcl::PDFWriter::DrawGreyscale : vcl::PDFWriter::DrawColor;
// prepare doc info
aContext.DocumentInfo.Title = i_rJobName;
diff --git a/vcl/win/inc/salgdi.h b/vcl/win/inc/salgdi.h
index 94c4849bb197..70734846f445 100755
--- a/vcl/win/inc/salgdi.h
+++ b/vcl/win/inc/salgdi.h
@@ -152,8 +152,6 @@ public:
COLORREF mnTextColor; // TextColor
RGNDATA* mpClipRgnData; // ClipRegion-Data
RGNDATA* mpStdClipRgnData; // Cache Standard-ClipRegion-Data
- RECT* mpNextClipRect; // Naechstes ClipRegion-Rect
- sal_Bool mbFirstClipRect; // Flag for first cliprect to insert
LOGFONTA* mpLogFont; // LOG-Font which is currently selected (only W9x)
ImplFontAttrCache* mpFontAttrCache; // Cache font attributes from files in so/share/fonts
BYTE* mpFontCharSets; // All Charsets for the current font
@@ -183,8 +181,7 @@ public:
virtual ~WinSalGraphics();
protected:
- virtual sal_Bool unionClipRegion( long nX, long nY, long nWidth, long nHeight );
- virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& );
+ virtual bool setClipRegion( const Region& );
// draw --> LineColor and FillColor and RasterOp and ClipRegion
virtual void drawPixel( long nX, long nY );
virtual void drawPixel( long nX, long nY, SalColor nSalColor );
@@ -256,11 +253,6 @@ public:
// set the clip region to empty
virtual void ResetClipRegion();
- // begin setting the clip region, add rectangles to the
- // region with the UnionClipRegion call
- virtual void BeginSetClipRegion( sal_uIntPtr nCount );
- // all rectangles were added and the clip region should be set now
- virtual void EndSetClipRegion();
// set the line color to transparent (= don't draw lines)
virtual void SetLineColor();
diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx
index 8cb52c917b38..73d93d42dd03 100644..100755
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -37,9 +37,10 @@
#include <tools/debug.hxx>
#include <salframe.h>
#include <tools/poly.hxx>
-#ifndef _RTL_STRINGBUF_HXX
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
#include <rtl/strbuf.hxx>
-#endif
+#include <vcl/region.h>
using namespace rtl;
@@ -540,7 +541,9 @@ void ImplSalInitGraphics( WinSalGraphics* pData )
void ImplSalDeInitGraphics( WinSalGraphics* pData )
{
- // Default Objekte selektieren
+ // clear clip region
+ SelectClipRgn( pData->mhDC, 0 );
+ // select default objects
if ( pData->mhDefPen )
SelectPen( pData->mhDC, pData->mhDefPen );
if ( pData->mhDefBrush )
@@ -849,7 +852,7 @@ void WinSalGraphics::ResetClipRegion()
// -----------------------------------------------------------------------
-void WinSalGraphics::BeginSetClipRegion( sal_uLong nRectCount )
+bool WinSalGraphics::setClipRegion( const Region& i_rClip )
{
if ( mhRegion )
{
@@ -857,123 +860,143 @@ void WinSalGraphics::BeginSetClipRegion( sal_uLong nRectCount )
mhRegion = 0;
}
- sal_uLong nRectBufSize = sizeof(RECT)*nRectCount;
- if ( nRectCount < SAL_CLIPRECT_COUNT )
+ if( i_rClip.HasPolyPolygon() )
{
- if ( !mpStdClipRgnData )
- mpStdClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+(SAL_CLIPRECT_COUNT*sizeof(RECT))];
- mpClipRgnData = mpStdClipRgnData;
+ // TODO: ConvertToB2DPolyPolygon actually is kind of const, just it does not advertise it in the header
+ basegfx::B2DPolyPolygon aPolyPolygon( const_cast<Region&>(i_rClip).ConvertToB2DPolyPolygon() );
+ const sal_uInt32 nCount(aPolyPolygon.count());
+
+ if( nCount )
+ {
+ std::vector< POINT > aPolyPoints;
+ aPolyPoints.reserve( 1024 );
+ std::vector< INT > aPolyCounts( nCount, 0 );
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ basegfx::B2DPolygon aPoly( aPolyPolygon.getB2DPolygon(a) );
+ aPoly = basegfx::tools::adaptiveSubdivideByDistance( aPoly, 1 );
+ const sal_uInt32 nPoints = aPoly.count();
+ aPolyCounts[a] = nPoints;
+ for( sal_uInt32 b = 0; b < nPoints; b++ )
+ {
+ basegfx::B2DPoint aPt( aPoly.getB2DPoint( b ) );
+ POINT aPOINT;
+ aPOINT.x = (LONG)aPt.getX();
+ aPOINT.y = (LONG)aPt.getY();
+ aPolyPoints.push_back( aPOINT );
+ }
+ }
+ mhRegion = CreatePolyPolygonRgn( &aPolyPoints[0], &aPolyCounts[0], nCount, ALTERNATE );
+ }
}
else
- mpClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+nRectBufSize];
- mpClipRgnData->rdh.dwSize = sizeof( RGNDATAHEADER );
- mpClipRgnData->rdh.iType = RDH_RECTANGLES;
- mpClipRgnData->rdh.nCount = nRectCount;
- mpClipRgnData->rdh.nRgnSize = nRectBufSize;
- SetRectEmpty( &(mpClipRgnData->rdh.rcBound) );
- mpNextClipRect = (RECT*)(&(mpClipRgnData->Buffer));
- mbFirstClipRect = TRUE;
-}
-
-
-// -----------------------------------------------------------------------
-
-sal_Bool WinSalGraphics::unionClipRegion( long nX, long nY, long nWidth, long nHeight )
-{
- if ( nWidth && nHeight )
{
- RECT* pRect = mpNextClipRect;
- RECT* pBoundRect = &(mpClipRgnData->rdh.rcBound);
- long nRight = nX + nWidth;
- long nBottom = nY + nHeight;
+ ULONG nRectCount = i_rClip.GetRectCount();
- if ( mbFirstClipRect )
+ ULONG nRectBufSize = sizeof(RECT)*nRectCount;
+ if ( nRectCount < SAL_CLIPRECT_COUNT )
{
- pBoundRect->left = nX;
- pBoundRect->top = nY;
- pBoundRect->right = nRight;
- pBoundRect->bottom = nBottom;
- mbFirstClipRect = FALSE;
+ if ( !mpStdClipRgnData )
+ mpStdClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+(SAL_CLIPRECT_COUNT*sizeof(RECT))];
+ mpClipRgnData = mpStdClipRgnData;
}
else
+ mpClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+nRectBufSize];
+ mpClipRgnData->rdh.dwSize = sizeof( RGNDATAHEADER );
+ mpClipRgnData->rdh.iType = RDH_RECTANGLES;
+ mpClipRgnData->rdh.nCount = nRectCount;
+ mpClipRgnData->rdh.nRgnSize = nRectBufSize;
+ RECT* pBoundRect = &(mpClipRgnData->rdh.rcBound);
+ SetRectEmpty( pBoundRect );
+ RECT* pNextClipRect = (RECT*)(&(mpClipRgnData->Buffer));
+ bool bFirstClipRect = true;
+
+ ImplRegionInfo aInfo;
+ long nX, nY, nW, nH;
+ bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH );
+ while( bRegionRect )
{
- if ( nX < pBoundRect->left )
- pBoundRect->left = (int)nX;
-
- if ( nY < pBoundRect->top )
- pBoundRect->top = (int)nY;
-
- if ( nRight > pBoundRect->right )
- pBoundRect->right = (int)nRight;
-
- if ( nBottom > pBoundRect->bottom )
- pBoundRect->bottom = (int)nBottom;
- }
-
- pRect->left = (int)nX;
- pRect->top = (int)nY;
- pRect->right = (int)nRight;
- pRect->bottom = (int)nBottom;
- mpNextClipRect++;
- }
- else
- {
- mpClipRgnData->rdh.nCount--;
- mpClipRgnData->rdh.nRgnSize -= sizeof( RECT );
- }
-
- return TRUE;
-}
+ if ( nW && nH )
+ {
+ long nRight = nX + nW;
+ long nBottom = nY + nH;
-// -----------------------------------------------------------------------
+ if ( bFirstClipRect )
+ {
+ pBoundRect->left = nX;
+ pBoundRect->top = nY;
+ pBoundRect->right = nRight;
+ pBoundRect->bottom = nBottom;
+ bFirstClipRect = false;
+ }
+ else
+ {
+ if ( nX < pBoundRect->left )
+ pBoundRect->left = (int)nX;
-bool WinSalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& )
-{
- // TODO: implement and advertise OutDevSupport_B2DClip support
- return false;
-}
+ if ( nY < pBoundRect->top )
+ pBoundRect->top = (int)nY;
-// -----------------------------------------------------------------------
+ if ( nRight > pBoundRect->right )
+ pBoundRect->right = (int)nRight;
-void WinSalGraphics::EndSetClipRegion()
-{
- // create clip region from ClipRgnData
- if ( mpClipRgnData->rdh.nCount == 1 )
- {
- RECT* pRect = &(mpClipRgnData->rdh.rcBound);
- mhRegion = CreateRectRgn( pRect->left, pRect->top,
- pRect->right, pRect->bottom );
- }
- else
- {
- sal_uLong nSize = mpClipRgnData->rdh.nRgnSize+sizeof(RGNDATAHEADER);
- mhRegion = ExtCreateRegion( NULL, nSize, mpClipRgnData );
+ if ( nBottom > pBoundRect->bottom )
+ pBoundRect->bottom = (int)nBottom;
+ }
- // if ExtCreateRegion(...) is not supported
- if( !mhRegion )
+ pNextClipRect->left = (int)nX;
+ pNextClipRect->top = (int)nY;
+ pNextClipRect->right = (int)nRight;
+ pNextClipRect->bottom = (int)nBottom;
+ pNextClipRect++;
+ }
+ else
+ {
+ mpClipRgnData->rdh.nCount--;
+ mpClipRgnData->rdh.nRgnSize -= sizeof( RECT );
+ }
+ bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH );
+ }
+ // create clip region from ClipRgnData
+ if ( mpClipRgnData->rdh.nCount == 1 )
{
- RGNDATAHEADER* pHeader = (RGNDATAHEADER*) mpClipRgnData;
+ RECT* pRect = &(mpClipRgnData->rdh.rcBound);
+ mhRegion = CreateRectRgn( pRect->left, pRect->top,
+ pRect->right, pRect->bottom );
+ }
+ else if( mpClipRgnData->rdh.nCount > 1 )
+ {
+ ULONG nSize = mpClipRgnData->rdh.nRgnSize+sizeof(RGNDATAHEADER);
+ mhRegion = ExtCreateRegion( NULL, nSize, mpClipRgnData );
- if( pHeader->nCount )
+ // if ExtCreateRegion(...) is not supported
+ if( !mhRegion )
{
- RECT* pRect = (RECT*) mpClipRgnData->Buffer;
- mhRegion = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom );
- pRect++;
+ RGNDATAHEADER* pHeader = (RGNDATAHEADER*) mpClipRgnData;
- for( sal_uLong n = 1; n < pHeader->nCount; n++, pRect++ )
+ if( pHeader->nCount )
{
- HRGN hRgn = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom );
- CombineRgn( mhRegion, mhRegion, hRgn, RGN_OR );
- DeleteRegion( hRgn );
+ RECT* pRect = (RECT*) mpClipRgnData->Buffer;
+ mhRegion = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom );
+ pRect++;
+
+ for( ULONG n = 1; n < pHeader->nCount; n++, pRect++ )
+ {
+ HRGN hRgn = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom );
+ CombineRgn( mhRegion, mhRegion, hRgn, RGN_OR );
+ DeleteRegion( hRgn );
+ }
}
}
- }
- if ( mpClipRgnData != mpStdClipRgnData )
- delete [] mpClipRgnData;
+ if ( mpClipRgnData != mpStdClipRgnData )
+ delete [] mpClipRgnData;
+ }
}
- SelectClipRgn( mhDC, mhRegion );
+ if( mhRegion )
+ SelectClipRgn( mhDC, mhRegion );
+ return mhRegion != 0;
}
// -----------------------------------------------------------------------
diff --git a/vcl/win/source/gdi/salgdi2.cxx b/vcl/win/source/gdi/salgdi2.cxx
index f957c59f8a01..dc3368c26912 100644..100755
--- a/vcl/win/source/gdi/salgdi2.cxx
+++ b/vcl/win/source/gdi/salgdi2.cxx
@@ -51,6 +51,9 @@ bool WinSalGraphics::supportsOperation( OutDevSupportType eType ) const
case OutDevSupport_TransparentRect:
bRet = mbVirDev || mbWindow;
break;
+ case OutDevSupport_B2DClip:
+ bRet = true;
+ break;
case OutDevSupport_B2DDraw:
bRet = bAllowForTest;
default: break;
diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx
index 2c8f81bce364..a235d6785706 100644..100755
--- a/vcl/win/source/gdi/salprn.cxx
+++ b/vcl/win/source/gdi/salprn.cxx
@@ -93,6 +93,7 @@
#endif
+using namespace com::sun::star;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::ui::dialogs;
@@ -2084,16 +2085,16 @@ sal_Bool WinSalPrinter::StartJob( const XubString* pFileName,
if( mpInfoPrinter->maPortName.EqualsIgnoreCaseAscii( "FILE:" ) && !(pFileName && pFileName->Len()) )
{
- Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
if( xFactory.is() )
{
- Reference< XFilePicker > xFilePicker( xFactory->createInstance(
+ uno::Reference< XFilePicker > xFilePicker( xFactory->createInstance(
OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ) ),
UNO_QUERY );
DBG_ASSERT( xFilePicker.is(), "could not get FilePicker service" );
- Reference< XInitialization > xInit( xFilePicker, UNO_QUERY );
- Reference< XFilterManager > xFilterMgr( xFilePicker, UNO_QUERY );
+ uno::Reference< XInitialization > xInit( xFilePicker, UNO_QUERY );
+ uno::Reference< XFilterManager > xFilterMgr( xFilePicker, UNO_QUERY );
if( xInit.is() && xFilePicker.is() && xFilterMgr.is() )
{
Sequence< Any > aServiceType( 1 );
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index d2baea1a8e90..c1b3a632556e 100755
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -104,6 +104,7 @@ using ::std::max;
#include <time.h>
using ::rtl::OUString;
+using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
@@ -875,11 +876,11 @@ static void ImplSalCalcFullScreenSize( const WinSalFrame* pFrame,
try
{
- Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
- Reference< XIndexAccess > xMultiMon( xFactory->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) ) ), UNO_QUERY_THROW );
+ uno::Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
+ uno::Reference< XIndexAccess > xMultiMon( xFactory->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) ) ), UNO_QUERY_THROW );
if( (pFrame->mnDisplay >= 0) && (pFrame->mnDisplay < xMultiMon->getCount()) )
{
- Reference< XPropertySet > xMonitor( xMultiMon->getByIndex( pFrame->mnDisplay ), UNO_QUERY_THROW );
+ uno::Reference< XPropertySet > xMonitor( xMultiMon->getByIndex( pFrame->mnDisplay ), UNO_QUERY_THROW );
com::sun::star::awt::Rectangle aRect;
if( xMonitor->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "ScreenArea" ) ) ) >>= aRect )
{