summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basebmp/test/basictest.cxx15
-rw-r--r--basebmp/test/bmpmasktest.cxx6
-rw-r--r--basebmp/test/bmptest.cxx6
-rw-r--r--basebmp/test/cliptest.cxx6
-rw-r--r--basebmp/test/export.map4
-rw-r--r--basebmp/test/filltest.cxx6
-rw-r--r--basebmp/test/linetest.cxx6
-rw-r--r--basebmp/test/makefile.mk27
-rw-r--r--basebmp/test/masktest.cxx6
-rw-r--r--basebmp/test/polytest.cxx6
-rw-r--r--basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx7
-rw-r--r--basegfx/inc/basegfx/numeric/ftools.hxx2
-rw-r--r--basegfx/inc/basegfx/polygon/b2dpolygon.hxx6
-rw-r--r--basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx6
-rw-r--r--basegfx/inc/basegfx/polygon/b3dgeometry.hxx70
-rw-r--r--basegfx/inc/basegfx/range/b2dmultirange.hxx114
-rw-r--r--basegfx/inc/basegfx/range/b2dpolyrange.hxx145
-rw-r--r--basegfx/inc/basegfx/range/b2drangeclipper.hxx53
-rw-r--r--basegfx/inc/basegfx/tools/b2dclipstate.hxx119
-rw-r--r--basegfx/inc/basegfx/tools/gradienttools.hxx18
-rw-r--r--basegfx/inc/basegfx/tools/keystoplerp.hxx100
-rw-r--r--basegfx/inc/basegfx/tools/lerp.hxx60
-rw-r--r--basegfx/prj/build.lst2
-rw-r--r--basegfx/prj/d.lst5
-rw-r--r--basegfx/qa/mkpolygons.pl344
-rw-r--r--basegfx/source/color/bcolortools.cxx2
-rw-r--r--basegfx/source/matrix/b2dhommatrixtools.cxx28
-rw-r--r--basegfx/source/polygon/b2dpolygon.cxx106
-rw-r--r--basegfx/source/polygon/b2dpolygoncutandtouch.cxx6
-rw-r--r--basegfx/source/polygon/b2dpolygontools.cxx3
-rw-r--r--basegfx/source/polygon/b2dpolypolygon.cxx52
-rw-r--r--basegfx/source/polygon/b2dsvgpolypolygon.cxx51
-rw-r--r--basegfx/source/range/b2dmultirange.cxx279
-rw-r--r--basegfx/source/range/b2dpolyrange.cxx423
-rw-r--r--basegfx/source/range/b2drangeclipper.cxx950
-rw-r--r--basegfx/source/range/makefile.mk3
-rw-r--r--basegfx/source/tools/b2dclipstate.cxx662
-rw-r--r--basegfx/source/tools/gradienttools.cxx101
-rw-r--r--basegfx/source/tools/keystoplerp.cxx107
-rwxr-xr-xbasegfx/source/tools/makefile.mk4
-rw-r--r--basegfx/test/basegfx1d.cxx16
-rw-r--r--basegfx/test/basegfx2d.cxx332
-rw-r--r--basegfx/test/basegfx3d.cxx22
-rw-r--r--basegfx/test/basegfxtools.cxx110
-rw-r--r--basegfx/test/boxclipper.cxx419
-rw-r--r--basegfx/test/clipstate.cxx178
-rw-r--r--basegfx/test/export.map4
-rw-r--r--basegfx/test/genericclipper.cxx159
-rw-r--r--basegfx/test/makefile.mk45
-rw-r--r--basegfx/test/tests.txt20
-rw-r--r--canvas/inc/canvas/base/graphicdevicebase.hxx82
-rwxr-xr-x[-rw-r--r--]canvas/inc/canvas/canvastools.hxx35
-rw-r--r--canvas/inc/canvas/parametricpolypolygon.hxx40
-rw-r--r--canvas/prj/build.lst1
-rw-r--r--canvas/source/cairo/cairo_canvas.hxx3
-rw-r--r--canvas/source/cairo/cairo_canvashelper.cxx309
-rw-r--r--canvas/source/cairo/cairo_spritecanvas.hxx3
-rw-r--r--canvas/source/cairo/exports.map8
-rw-r--r--canvas/source/cairo/makefile.mk6
-rw-r--r--canvas/source/directx/dx_canvas.hxx5
-rwxr-xr-xcanvas/source/directx/dx_canvashelper_texturefill.cxx446
-rwxr-xr-xcanvas/source/directx/dx_impltools.cxx2
-rwxr-xr-xcanvas/source/directx/dx_spritecanvas.hxx17
-rw-r--r--canvas/source/factory/canvasfactory.map8
-rw-r--r--canvas/source/factory/makefile.mk2
-rw-r--r--canvas/source/java/BackBuffer.java112
-rw-r--r--canvas/source/java/BezierPolyPolygon.java151
-rw-r--r--canvas/source/java/BitmapCanvas.java136
-rw-r--r--canvas/source/java/BufferedGraphics2D.java600
-rw-r--r--canvas/source/java/CanvasBase.java341
-rw-r--r--canvas/source/java/CanvasBitmap.java252
-rw-r--r--canvas/source/java/CanvasClonedSprite.java185
-rw-r--r--canvas/source/java/CanvasCustomSprite.java204
-rw-r--r--canvas/source/java/CanvasFont.java116
-rw-r--r--canvas/source/java/CanvasGraphicDevice.java222
-rw-r--r--canvas/source/java/CanvasSprite.java308
-rw-r--r--canvas/source/java/CanvasTest_perftest.java676
-rw-r--r--canvas/source/java/CanvasUtils.java627
-rw-r--r--canvas/source/java/JavaCanvas.java675
-rw-r--r--canvas/source/java/LinePolyPolygon.java192
-rw-r--r--canvas/source/java/SpriteRep.java175
-rw-r--r--canvas/source/java/SpriteRunner.java200
-rw-r--r--canvas/source/java/TextLayout.java205
-rw-r--r--canvas/source/java/aqua/WindowAdapter.java202
-rw-r--r--canvas/source/java/java_Service.java118
-rw-r--r--canvas/source/java/makefile.mk93
-rw-r--r--canvas/source/java/manifest1
-rw-r--r--canvas/source/java/perftest/PerfTest.java314
-rw-r--r--canvas/source/java/perftest/WindowAdapter.java197
-rw-r--r--canvas/source/java/perftest/manifest1
-rw-r--r--canvas/source/java/win/WindowAdapter.java199
-rw-r--r--canvas/source/java/x11/WindowAdapter.java197
-rw-r--r--canvas/source/null/exports.map8
-rw-r--r--canvas/source/null/makefile.mk2
-rw-r--r--canvas/source/null/null_spritecanvas.hxx4
-rw-r--r--canvas/source/simplecanvas/exports.map8
-rw-r--r--canvas/source/simplecanvas/makefile.mk2
-rwxr-xr-x[-rw-r--r--]canvas/source/tools/canvastools.cxx48
-rw-r--r--canvas/source/tools/image.cxx2
-rw-r--r--canvas/source/tools/parametricpolypolygon.cxx114
-rw-r--r--canvas/source/tools/verifyinput.cxx4
-rw-r--r--canvas/source/vcl/canvas.hxx3
-rwxr-xr-x[-rw-r--r--]canvas/source/vcl/canvashelper_texturefill.cxx476
-rw-r--r--canvas/source/vcl/exports.map8
-rw-r--r--canvas/source/vcl/makefile.mk2
-rw-r--r--canvas/source/vcl/spritecanvas.hxx3
-rw-r--r--comphelper/inc/comphelper/docpasswordhelper.hxx111
-rwxr-xr-x[-rw-r--r--]comphelper/inc/comphelper/docpasswordrequest.hxx23
-rw-r--r--comphelper/inc/comphelper/mediadescriptor.hxx52
-rw-r--r--comphelper/inc/comphelper/propertycontainerhelper.hxx2
-rw-r--r--comphelper/inc/comphelper/stillreadwriteinteraction.hxx69
-rw-r--r--comphelper/inc/comphelper/storagehelper.hxx9
-rw-r--r--comphelper/qa/complex/makefile.mk14
-rw-r--r--comphelper/qa/makefile.mk2
-rw-r--r--comphelper/source/misc/comphelper_services.cxx2
-rw-r--r--comphelper/source/misc/docpasswordhelper.cxx233
-rw-r--r--comphelper/source/misc/docpasswordrequest.cxx86
-rw-r--r--comphelper/source/misc/makefile.mk2
-rw-r--r--comphelper/source/misc/mediadescriptor.cxx214
-rw-r--r--comphelper/source/misc/officerestartmanager.cxx210
-rw-r--r--comphelper/source/misc/officerestartmanager.hxx91
-rw-r--r--comphelper/source/misc/stillreadwriteinteraction.cxx144
-rw-r--r--comphelper/source/misc/storagehelper.cxx27
-rw-r--r--cppcanvas/source/mtfrenderer/implrenderer.cxx371
-rw-r--r--dtrans/source/generic/exports.map9
-rw-r--r--dtrans/source/generic/makefile.mk2
-rw-r--r--dtrans/util/exports.map10
-rw-r--r--dtrans/util/makefile.mk2
-rw-r--r--i18npool/inc/i18npool/lang.h4
-rw-r--r--i18npool/inc/transliteration_body.hxx25
-rw-r--r--i18npool/source/breakiterator/data/char_in.txt112
-rw-r--r--i18npool/source/breakiterator/data/dict.map2
-rw-r--r--i18npool/source/breakiterator/data/dict_word.txt2
-rw-r--r--i18npool/source/breakiterator/data/dict_word_prepostdash.txt4
-rw-r--r--i18npool/source/breakiterator/data/ja.dic1
-rw-r--r--i18npool/source/collator/data/collator_data.map2
-rw-r--r--i18npool/source/indexentry/data/index_data.map2
-rw-r--r--i18npool/source/isolang/isolang.cxx60
-rwxr-xr-xi18npool/source/isolang/langid.pl55
-rw-r--r--i18npool/source/isolang/mslangid.cxx10
-rw-r--r--i18npool/source/localedata/LocaleNode.cxx12
-rw-r--r--i18npool/source/localedata/data/ak_GH.xml3
-rw-r--r--i18npool/source/localedata/data/ar_DZ.xml437
-rw-r--r--i18npool/source/localedata/data/bs_BA.xml9
-rw-r--r--i18npool/source/localedata/data/ee_GH.xml3
-rw-r--r--i18npool/source/localedata/data/en_GH.xml6
-rw-r--r--i18npool/source/localedata/data/en_US.xml3
-rw-r--r--i18npool/source/localedata/data/eo.xml3
-rw-r--r--i18npool/source/localedata/data/eu.xml5
-rw-r--r--i18npool/source/localedata/data/fur_IT.xml3
-rw-r--r--i18npool/source/localedata/data/fy_NL.xml3
-rw-r--r--i18npool/source/localedata/data/gsc_FR.xml11
-rw-r--r--i18npool/source/localedata/data/gug_PY.xml3
-rw-r--r--i18npool/source/localedata/data/ha_GH.xml3
-rw-r--r--i18npool/source/localedata/data/hil_PH.xml3
-rw-r--r--i18npool/source/localedata/data/hr_HR.xml9
-rw-r--r--i18npool/source/localedata/data/hy_AM.xml3
-rw-r--r--i18npool/source/localedata/data/is_IS.xml5
-rw-r--r--i18npool/source/localedata/data/ka_GE.xml3
-rw-r--r--i18npool/source/localedata/data/kk_KZ.xml3
-rw-r--r--i18npool/source/localedata/data/km_KH.xml3
-rw-r--r--i18npool/source/localedata/data/ko_KR.xml5
-rw-r--r--i18npool/source/localedata/data/ku_TR.xml3
-rw-r--r--i18npool/source/localedata/data/lg_UG.xml7
-rw-r--r--i18npool/source/localedata/data/ln_CD.xml3
-rw-r--r--i18npool/source/localedata/data/localedata_en.map2
-rw-r--r--i18npool/source/localedata/data/localedata_es.map2
-rw-r--r--i18npool/source/localedata/data/localedata_euro.map19
-rw-r--r--i18npool/source/localedata/data/localedata_others.map36
-rw-r--r--i18npool/source/localedata/data/lt_LT.xml5
-rw-r--r--i18npool/source/localedata/data/ltg_LV.xml22
-rw-r--r--i18npool/source/localedata/data/lv_LV.xml16
-rw-r--r--i18npool/source/localedata/data/mai_IN.xml357
-rw-r--r--i18npool/source/localedata/data/makefile.mk8
-rw-r--r--i18npool/source/localedata/data/mk_MK.xml3
-rw-r--r--i18npool/source/localedata/data/mt_MT.xml3
-rw-r--r--i18npool/source/localedata/data/my_MM.xml3
-rw-r--r--i18npool/source/localedata/data/ne_NP.xml3
-rw-r--r--i18npool/source/localedata/data/oc_FR.xml3
-rw-r--r--i18npool/source/localedata/data/or_IN.xml3
-rw-r--r--i18npool/source/localedata/data/rue_SK.xml359
-rw-r--r--i18npool/source/localedata/data/sg_CF.xml3
-rw-r--r--i18npool/source/localedata/data/sh_RS.xml3
-rw-r--r--i18npool/source/localedata/data/shs_CA.xml3
-rw-r--r--i18npool/source/localedata/data/sk_SK.xml5
-rw-r--r--i18npool/source/localedata/data/sl_SI.xml3
-rw-r--r--i18npool/source/localedata/data/so_SO.xml3
-rw-r--r--i18npool/source/localedata/data/sr_RS.xml3
-rw-r--r--i18npool/source/localedata/data/sw_TZ.xml3
-rw-r--r--i18npool/source/localedata/data/tk_TM.xml3
-rw-r--r--i18npool/source/localedata/data/tpi_PG.xml3
-rw-r--r--i18npool/source/localedata/data/uk_UA.xml9
-rw-r--r--i18npool/source/localedata/data/vi_VN.xml3
-rw-r--r--i18npool/source/localedata/data/zh_CN.xml23
-rw-r--r--i18npool/source/localedata/data/zh_TW.xml25
-rw-r--r--i18npool/source/localedata/localedata.cxx3
-rw-r--r--i18npool/source/localedata/saxparser.cxx9
-rw-r--r--i18npool/source/paper/paper.cxx53
-rw-r--r--i18npool/source/registerservices/registerservices.cxx12
-rw-r--r--i18npool/source/search/i18nsearch.map10
-rw-r--r--i18npool/source/search/makefile.mk2
-rw-r--r--i18npool/source/textconversion/data/textconv_dict.map2
-rw-r--r--i18npool/source/transliteration/transliteration_body.cxx263
-rw-r--r--i18npool/util/i18npool.map10
-rw-r--r--i18npool/util/makefile.mk3
-rw-r--r--l10ntools/inc/export.hxx2
-rw-r--r--l10ntools/inc/wrdtrans.hxx87
-rwxr-xr-xl10ntools/java/jpropex/build.xml169
-rw-r--r--l10ntools/java/jpropex/java/JPropEx.java499
-rw-r--r--l10ntools/java/jpropex/java/Main.java (renamed from canvas/source/java/SpriteBase.java)12
-rw-r--r--l10ntools/java/jpropex/java/NoLocalizeFilter.java (renamed from basegfx/source/polygon/b3dgeometry.cxx)41
-rw-r--r--l10ntools/java/jpropex/java/OrderedHashMap.java96
-rw-r--r--l10ntools/java/jpropex/java/SdfData.java108
-rw-r--r--l10ntools/java/jpropex/java/SdfEntity.java254
-rwxr-xr-xl10ntools/java/jpropex/jpropex10
-rwxr-xr-xl10ntools/java/jpropex/jpropex.MF1
-rwxr-xr-xl10ntools/java/jpropex/makefile.mk36
-rw-r--r--l10ntools/java/receditor/java/transex3/model/SdfString.java25
-rw-r--r--l10ntools/prj/build.lst3
-rw-r--r--l10ntools/prj/d.lst3
-rw-r--r--l10ntools/scripts/fast_merge.pl10
-rw-r--r--[-rwxr-xr-x]l10ntools/scripts/localize.pl48
-rw-r--r--[-rwxr-xr-x]l10ntools/scripts/localize_old.pl56
-rw-r--r--l10ntools/source/export.cxx12
-rw-r--r--l10ntools/source/export2.cxx5
-rw-r--r--l10ntools/source/help/HelpIndexerTool.java30
-rw-r--r--l10ntools/source/help/HelpLinker.cxx25
-rw-r--r--l10ntools/source/help/compilehelp.hxx1
-rw-r--r--l10ntools/source/help/makefile.mk2
-rw-r--r--l10ntools/source/localize.cxx15
-rw-r--r--l10ntools/source/merge.cxx17
-rw-r--r--l10ntools/source/wrdtrans.cxx245
-rw-r--r--l10ntools/source/xrmlex.l55
-rw-r--r--l10ntools/source/xrmmerge.cxx77
-rw-r--r--o3tl/inc/o3tl/vector_pool.hxx132
-rw-r--r--o3tl/prj/build.lst2
-rw-r--r--o3tl/qa/export.map4
-rw-r--r--o3tl/qa/makefile.mk15
-rw-r--r--o3tl/qa/test-cow_wrapper.cxx18
-rw-r--r--o3tl/qa/test-heap_ptr.cxx6
-rw-r--r--o3tl/qa/test-range.cxx7
-rw-r--r--o3tl/qa/test-vector_pool.cxx69
-rw-r--r--padmin/source/padialog.cxx5
-rw-r--r--rsc/inc/rsctools.hxx1
-rw-r--r--rsc/source/parser/erscerr.cxx2
-rw-r--r--rsc/source/prj/gui.cxx11
-rw-r--r--rsc/source/prj/start.cxx9
-rw-r--r--rsc/source/tools/rscchar.cxx133
-rw-r--r--sax/inc/sax/tools/converter.hxx1
-rw-r--r--sax/prj/build.lst1
-rw-r--r--sax/qa/cppunit/makefile.mk71
-rw-r--r--sax/qa/cppunit/test_converter.cxx244
-rw-r--r--sax/qa/cppunit/version.map34
-rw-r--r--sax/source/fastparser/fastparser.cxx636
-rw-r--r--sax/source/fastparser/fastparser.hxx96
-rw-r--r--sax/source/tools/converter.cxx165
-rw-r--r--sot/source/unoolestorage/xolesimplestorage.cxx4
-rw-r--r--svl/Package_inc.mk1
-rw-r--r--svl/inc/svl/solar.hrc4
-rw-r--r--svl/inc/svl/svl.hrc160
-rw-r--r--svl/inc/svl/zforlist.hxx13
-rw-r--r--svl/inc/svl/zformat.hxx7
-rw-r--r--svl/qa/complex/ConfigItems/helper/exports.map10
-rw-r--r--svl/qa/complex/ConfigItems/helper/makefile.mk2
-rw-r--r--svl/qa/makefile.mk2
-rw-r--r--svl/source/fsstor/exports.map8
-rw-r--r--svl/source/fsstor/makefile.mk2
-rw-r--r--svl/source/items/cstitem.src2
-rw-r--r--svl/source/items/dateitem.cxx3
-rw-r--r--svl/source/items/nranges.cxx4
-rw-r--r--svl/source/items/srchitem.cxx72
-rw-r--r--svl/source/items/style.cxx22
-rw-r--r--svl/source/misc/inettype.cxx21
-rw-r--r--svl/source/misc/mediatyp.src2
-rw-r--r--svl/source/misc/urihelper.cxx3
-rw-r--r--svl/source/numbers/zforlist.cxx20
-rw-r--r--svl/source/numbers/zformat.cxx182
-rw-r--r--svl/source/numbers/zforscan.cxx2
-rw-r--r--svl/source/numbers/zforscan.hxx6
-rw-r--r--svl/source/passwordcontainer/exports.map8
-rw-r--r--svl/source/passwordcontainer/makefile.mk2
-rw-r--r--svtools/AllLangResTarget_svt.mk5
-rw-r--r--svtools/Library_svt.mk309
-rw-r--r--svtools/Package_inc.mk2
-rwxr-xr-x[-rw-r--r--]svtools/inc/svtools/accessiblefactory.hxx16
-rwxr-xr-xsvtools/inc/svtools/accessibletable.hxx11
-rw-r--r--svtools/inc/svtools/accessibletableprovider.hxx2
-rw-r--r--svtools/inc/svtools/brwbox.hxx4
-rw-r--r--svtools/inc/svtools/filter.hxx5
-rw-r--r--svtools/inc/svtools/logindlg.hxx118
-rw-r--r--svtools/inc/svtools/popupmenucontrollerbase.hxx141
-rw-r--r--svtools/inc/svtools/popupwindowcontroller.hxx85
-rw-r--r--svtools/inc/svtools/roadmapwizard.hxx15
-rw-r--r--svtools/inc/svtools/svtabbx.hxx2
-rw-r--r--svtools/inc/svtools/svtools.hrc (renamed from svl/inc/svl/svtools.hrc)138
-rw-r--r--svtools/inc/svtools/tabbar.hxx15
-rw-r--r--svtools/inc/svtools/table/abstracttablecontrol.hxx19
-rw-r--r--svtools/inc/svtools/table/defaultinputhandler.hxx1
-rw-r--r--svtools/inc/svtools/table/gridtablerenderer.hxx8
-rw-r--r--svtools/inc/svtools/table/tablecontrol.hxx156
-rw-r--r--svtools/inc/svtools/table/tabledatawindow.hxx15
-rw-r--r--svtools/inc/svtools/table/tablemodel.hxx108
-rw-r--r--svtools/inc/svtools/table/tablerenderer.hxx44
-rw-r--r--svtools/inc/svtools/table/tabletypes.hxx10
-rw-r--r--svtools/inc/svtools/toolbarmenu.hxx155
-rw-r--r--svtools/inc/svtools/toolboxcontroller.hxx35
-rwxr-xr-xsvtools/inc/svtools/toolpanel/decklayouter.hxx104
-rw-r--r--svtools/inc/svtools/toolpanel/drawerlayouter.hxx102
-rw-r--r--svtools/inc/svtools/toolpanel/paneltabbar.hxx102
-rw-r--r--svtools/inc/svtools/toolpanel/refbase.hxx80
-rw-r--r--svtools/inc/svtools/toolpanel/tabalignment.hxx47
-rw-r--r--svtools/inc/svtools/toolpanel/tabitemcontent.hxx48
-rwxr-xr-xsvtools/inc/svtools/toolpanel/tablayouter.hxx112
-rw-r--r--svtools/inc/svtools/toolpanel/toolpanel.hxx147
-rwxr-xr-xsvtools/inc/svtools/toolpanel/toolpaneldeck.hxx193
-rw-r--r--svtools/inc/svtools/valueset.hxx3
-rw-r--r--svtools/inc/svtools/wizardmachine.hxx48
-rwxr-xr-xsvtools/inc/svtools/xwindowitem.hxx70
-rw-r--r--svtools/prj/d.lst5
-rw-r--r--svtools/qa/unoapi/Test.java51
-rw-r--r--svtools/qa/unoapi/makefile.mk30
-rw-r--r--svtools/qa/unoapi/svtools.sce12
-rw-r--r--svtools/source/brwbox/brwbox1.cxx5
-rw-r--r--svtools/source/brwbox/brwbox2.cxx15
-rw-r--r--svtools/source/brwbox/brwbox3.cxx2
-rw-r--r--svtools/source/brwbox/datwin.hxx1
-rw-r--r--svtools/source/brwbox/editbrowsebox.cxx2
-rw-r--r--svtools/source/brwbox/editbrowsebox.src2
-rw-r--r--svtools/source/contnr/fileview.cxx236
-rw-r--r--svtools/source/contnr/fileview.src2
-rw-r--r--svtools/source/contnr/svcontnr.src2
-rw-r--r--svtools/source/contnr/svimpbox.cxx2
-rw-r--r--svtools/source/contnr/svlbox.cxx11
-rw-r--r--svtools/source/contnr/svtabbx.cxx4
-rw-r--r--svtools/source/contnr/svtreebx.cxx47
-rw-r--r--svtools/source/contnr/templwin.cxx2
-rw-r--r--svtools/source/contnr/templwin.src2
-rwxr-xr-x[-rw-r--r--]svtools/source/control/calendar.cxx2
-rwxr-xr-x[-rw-r--r--]svtools/source/control/calendar.src2
-rwxr-xr-x[-rw-r--r--]svtools/source/control/collatorres.cxx2
-rwxr-xr-x[-rw-r--r--]svtools/source/control/ctrlbox.cxx2
-rwxr-xr-x[-rw-r--r--]svtools/source/control/ctrlbox.src2
-rwxr-xr-x[-rw-r--r--]svtools/source/control/ctrltool.cxx2
-rwxr-xr-x[-rw-r--r--]svtools/source/control/ctrltool.src2
-rwxr-xr-x[-rw-r--r--]svtools/source/control/indexentryres.cxx2
-rwxr-xr-x[-rw-r--r--]svtools/source/control/makefile.mk4
-rwxr-xr-x[-rw-r--r--]svtools/source/control/tabbar.cxx158
-rw-r--r--svtools/source/control/toolbarmenu.cxx1806
-rw-r--r--svtools/source/control/toolbarmenuacc.cxx1003
-rw-r--r--svtools/source/control/toolbarmenuimp.hxx314
-rw-r--r--svtools/source/control/valueacc.cxx7
-rwxr-xr-x[-rw-r--r--]svtools/source/control/valueimp.hxx1
-rw-r--r--svtools/source/control/valueset.cxx51
-rw-r--r--svtools/source/dialogs/addresstemplate.cxx2
-rw-r--r--svtools/source/dialogs/addresstemplate.src2
-rw-r--r--svtools/source/dialogs/logindlg.cxx307
-rw-r--r--svtools/source/dialogs/logindlg.src200
-rwxr-xr-x[-rw-r--r--]svtools/source/dialogs/makefile.mk4
-rw-r--r--svtools/source/dialogs/printdlg.hrc2
-rw-r--r--svtools/source/dialogs/prnsetup.hrc2
-rw-r--r--svtools/source/dialogs/roadmapwizard.cxx57
-rw-r--r--svtools/source/dialogs/wizardmachine.cxx99
-rw-r--r--svtools/source/dialogs/wizardmachine.src2
-rw-r--r--svtools/source/filter.vcl/filter/dlgejpg.hrc2
-rw-r--r--svtools/source/filter.vcl/filter/dlgepng.hrc2
-rw-r--r--svtools/source/filter.vcl/filter/dlgexpor.hrc2
-rw-r--r--svtools/source/filter.vcl/filter/filter.cxx8
-rw-r--r--svtools/source/filter.vcl/filter/strings.hrc2
-rw-r--r--svtools/source/filter.vcl/jpeg/jpeg.cxx15
-rw-r--r--svtools/source/filter.vcl/wmf/winmtf.cxx12
-rw-r--r--svtools/source/filter.vcl/wmf/winmtf.hxx3
-rw-r--r--svtools/source/hatchwindow/exports.map8
-rw-r--r--svtools/source/hatchwindow/makefile.mk2
-rw-r--r--svtools/source/inc/accessibletableimp.hxx62
-rw-r--r--svtools/source/inc/iodlg.hrc2
-rw-r--r--svtools/source/inc/jpeg.hxx11
-rw-r--r--svtools/source/java/javaerror.src2
-rw-r--r--svtools/source/java/javainteractionhandler.cxx2
-rw-r--r--svtools/source/misc/ehdl.cxx2
-rw-r--r--svtools/source/misc/ehdl.src2
-rw-r--r--svtools/source/misc/embedhlp.cxx2
-rw-r--r--svtools/source/misc/helpagent.src2
-rw-r--r--svtools/source/misc/helpagentwindow.cxx2
-rw-r--r--svtools/source/misc/imagemgr.cxx2
-rw-r--r--svtools/source/misc/imagemgr.src2
-rw-r--r--svtools/source/misc/imageresourceaccess.cxx12
-rw-r--r--svtools/source/misc/langtab.cxx2
-rw-r--r--svtools/source/misc/langtab.src8
-rwxr-xr-x[-rw-r--r--]svtools/source/misc/makefile.mk3
-rwxr-xr-x[-rw-r--r--]svtools/source/misc/svtaccessiblefactory.cxx18
-rw-r--r--svtools/source/misc/transfer.cxx28
-rw-r--r--svtools/source/misc/undo.src2
-rwxr-xr-xsvtools/source/misc/xwindowitem.cxx97
-rw-r--r--svtools/source/productregistration/exports.map8
-rw-r--r--svtools/source/productregistration/makefile.mk2
-rw-r--r--svtools/source/productregistration/productregistration.cxx2
-rw-r--r--svtools/source/productregistration/registrationdlg.cxx2
-rw-r--r--svtools/source/productregistration/registrationdlg.src2
-rw-r--r--svtools/source/svhtml/parhtml.cxx4
-rw-r--r--svtools/source/table/defaultinputhandler.cxx57
-rw-r--r--svtools/source/table/gridtablerenderer.cxx285
-rw-r--r--svtools/source/table/tablecontrol.cxx182
-rw-r--r--svtools/source/table/tablecontrol_impl.cxx1442
-rw-r--r--svtools/source/table/tablecontrol_impl.hxx163
-rw-r--r--svtools/source/table/tabledatawindow.cxx106
-rw-r--r--svtools/source/table/tablegeometry.cxx8
-rw-r--r--svtools/source/toolpanel/drawerlayouter.cxx305
-rw-r--r--svtools/source/toolpanel/dummypanel.cxx107
-rw-r--r--svtools/source/toolpanel/dummypanel.hxx70
-rwxr-xr-xsvtools/source/toolpanel/makefile.mk68
-rwxr-xr-xsvtools/source/toolpanel/paneldecklisteners.cxx137
-rwxr-xr-xsvtools/source/toolpanel/paneldecklisteners.hxx72
-rwxr-xr-xsvtools/source/toolpanel/paneltabbar.cxx1356
-rw-r--r--svtools/source/toolpanel/paneltabbarpeer.cxx101
-rw-r--r--svtools/source/toolpanel/paneltabbarpeer.hxx69
-rw-r--r--svtools/source/toolpanel/refbase.cxx56
-rw-r--r--svtools/source/toolpanel/tabbargeometry.cxx328
-rw-r--r--svtools/source/toolpanel/tabbargeometry.hxx137
-rw-r--r--svtools/source/toolpanel/tabitemdescriptor.hxx90
-rwxr-xr-xsvtools/source/toolpanel/tablayouter.cxx262
-rw-r--r--svtools/source/toolpanel/toolpanel.cxx54
-rw-r--r--svtools/source/toolpanel/toolpanel.src (renamed from svtools/source/dialogs/logindlg.hrc)50
-rw-r--r--svtools/source/toolpanel/toolpanelcollection.cxx193
-rw-r--r--svtools/source/toolpanel/toolpanelcollection.hxx69
-rwxr-xr-xsvtools/source/toolpanel/toolpaneldeck.cxx560
-rwxr-xr-xsvtools/source/toolpanel/toolpaneldeckpeer.cxx99
-rwxr-xr-xsvtools/source/toolpanel/toolpaneldeckpeer.hxx69
-rw-r--r--svtools/source/toolpanel/toolpaneldrawer.cxx373
-rw-r--r--svtools/source/toolpanel/toolpaneldrawer.hxx113
-rw-r--r--svtools/source/toolpanel/toolpaneldrawerpeer.cxx142
-rw-r--r--svtools/source/toolpanel/toolpaneldrawerpeer.hxx56
-rw-r--r--svtools/source/uno/makefile.mk7
-rw-r--r--svtools/source/uno/miscservices.cxx23
-rw-r--r--svtools/source/uno/popupmenucontrollerbase.cxx420
-rw-r--r--svtools/source/uno/popupwindowcontroller.cxx258
-rwxr-xr-xsvtools/source/uno/svtxgridcontrol.cxx654
-rwxr-xr-xsvtools/source/uno/svtxgridcontrol.hxx46
-rw-r--r--svtools/source/uno/toolboxcontroller.cxx213
-rw-r--r--svtools/source/uno/treecontrolpeer.cxx20
-rw-r--r--svtools/source/uno/treecontrolpeer.hxx1
-rw-r--r--svtools/source/uno/unocontroltablemodel.cxx239
-rw-r--r--svtools/source/uno/unocontroltablemodel.hxx77
-rw-r--r--svtools/source/uno/unoifac2.src107
-rw-r--r--svtools/source/uno/unowizard.hxx117
-rw-r--r--svtools/source/uno/wizard/makefile.mk (renamed from canvas/source/java/perftest/makefile.mk)31
-rw-r--r--svtools/source/uno/wizard/unowizard.cxx452
-rw-r--r--svtools/source/uno/wizard/wizardpagecontroller.cxx190
-rw-r--r--svtools/source/uno/wizard/wizardpagecontroller.hxx75
-rw-r--r--svtools/source/uno/wizard/wizardshell.cxx279
-rw-r--r--svtools/source/uno/wizard/wizardshell.hxx147
-rw-r--r--svtools/util/makefile.mk48
-rw-r--r--svtools/workben/toolpanel/makefile.mk110
-rwxr-xr-xsvtools/workben/toolpanel/toolpaneltest.cxx880
-rw-r--r--svtools/workben/unodialog/makefile.mk2
-rw-r--r--svtools/workben/unodialog/roadmapskeleton.cxx4
-rw-r--r--svtools/workben/unodialog/roadmapskeleton.hxx2
-rw-r--r--svtools/workben/unodialog/udlg.map8
-rw-r--r--toolkit/inc/toolkit/awt/vclxsystemdependentwindow.hxx4
-rw-r--r--toolkit/inc/toolkit/awt/vclxwindow.hxx18
-rw-r--r--toolkit/inc/toolkit/awt/vclxwindows.hxx39
-rw-r--r--toolkit/inc/toolkit/controls/dialogcontrol.hxx8
-rw-r--r--toolkit/inc/toolkit/controls/roadmapcontrol.hxx6
-rw-r--r--toolkit/inc/toolkit/controls/unocontrol.hxx14
-rw-r--r--toolkit/inc/toolkit/controls/unocontrolmodel.hxx23
-rw-r--r--toolkit/inc/toolkit/controls/unocontrols.hxx125
-rw-r--r--toolkit/inc/toolkit/helper/listenermultiplexer.hxx10
-rw-r--r--toolkit/inc/toolkit/helper/property.hxx6
-rw-r--r--toolkit/inc/toolkit/helper/servicenames.hxx6
-rw-r--r--toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx3
-rw-r--r--toolkit/prj/d.lst2
-rw-r--r--toolkit/qa/unoapi/Test.java51
-rw-r--r--toolkit/qa/unoapi/knownissues.xcl22
-rw-r--r--toolkit/qa/unoapi/makefile.mk33
-rw-r--r--toolkit/qa/unoapi/toolkit.sce16
-rw-r--r--toolkit/source/awt/vclxmenu.cxx44
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx10
-rw-r--r--toolkit/source/awt/vclxwindow.cxx319
-rw-r--r--toolkit/source/awt/vclxwindows.cxx193
-rw-r--r--toolkit/source/controls/dialogcontrol.cxx40
-rw-r--r--toolkit/source/controls/grid/defaultgridcolumnmodel.cxx121
-rw-r--r--toolkit/source/controls/grid/defaultgridcolumnmodel.hxx37
-rw-r--r--toolkit/source/controls/grid/defaultgriddatamodel.cxx99
-rw-r--r--toolkit/source/controls/grid/defaultgriddatamodel.hxx23
-rw-r--r--toolkit/source/controls/grid/gridcolumn.cxx148
-rw-r--r--toolkit/source/controls/grid/gridcolumn.hxx29
-rw-r--r--toolkit/source/controls/grid/gridcontrol.cxx112
-rw-r--r--toolkit/source/controls/grid/gridcontrol.hxx18
-rw-r--r--toolkit/source/controls/tksimpleanimation.cxx5
-rw-r--r--toolkit/source/controls/tkthrobber.cxx19
-rw-r--r--toolkit/source/controls/tree/treecontrol.cxx8
-rw-r--r--toolkit/source/controls/tree/treecontrol.hxx1
-rw-r--r--toolkit/source/controls/unocontrol.cxx52
-rw-r--r--toolkit/source/controls/unocontrolmodel.cxx23
-rw-r--r--toolkit/source/controls/unocontrols.cxx610
-rw-r--r--toolkit/source/helper/listenermultiplexer.cxx5
-rw-r--r--toolkit/source/helper/property.cxx12
-rw-r--r--toolkit/source/helper/registerservices.cxx16
-rw-r--r--toolkit/source/helper/servicenames.cxx8
-rw-r--r--toolkit/source/layout/core/box-base.cxx5
-rw-r--r--toolkit/source/layout/core/box-base.hxx2
-rw-r--r--toolkit/src2xml/include.lst1
-rw-r--r--tools/Library_tl.mk1
-rw-r--r--tools/bootstrp/makefile.mk9
-rw-r--r--tools/bootstrp/rscdep.cxx67
-rw-r--r--tools/inc/tools/color.hxx2
-rw-r--r--tools/inc/tools/debug.hxx31
-rw-r--r--tools/inc/tools/diagnose_ex.h29
-rw-r--r--tools/inc/tools/gen.hxx15
-rw-r--r--tools/inc/tools/postextstl.h36
-rw-r--r--tools/inc/tools/preextstl.h71
-rw-r--r--tools/inc/tools/solar.h26
-rw-r--r--tools/inc/tools/svborder.hxx8
-rw-r--r--tools/inc/tools/svlibrary.hxx (renamed from svtools/source/uno/unoifac2.hrc)30
-rw-r--r--tools/inc/tools/urlobj.hxx31
-rw-r--r--tools/inc/tools/wintypes.hxx1
-rw-r--r--tools/qa/makefile.mk1
-rw-r--r--tools/source/debug/debug.cxx32
-rw-r--r--tools/source/fsys/tdir.cxx2
-rw-r--r--tools/source/fsys/urlobj.cxx64
-rw-r--r--tools/source/generic/makefile.mk3
-rw-r--r--tools/source/generic/svlibrary.cxx129
-rw-r--r--tools/source/stream/strmunx.cxx10
-rw-r--r--tools/test/export.map2
-rw-r--r--tools/test/makefile.mk2
-rw-r--r--tools/workben/urltest.cxx14
-rwxr-xr-xtransex3/java/jpropex/build.xml169
-rw-r--r--transex3/java/jpropex/java/JPropEx.java400
-rw-r--r--transex3/java/jpropex/java/Main.java38
-rw-r--r--transex3/java/jpropex/java/NoLocalizeFilter.java55
-rw-r--r--transex3/java/jpropex/java/OrderedHashMap.java96
-rw-r--r--transex3/java/jpropex/java/SdfData.java108
-rw-r--r--transex3/java/jpropex/java/SdfEntity.java254
-rwxr-xr-xtransex3/java/jpropex/jpropex10
-rwxr-xr-xtransex3/java/jpropex/jpropex.MF1
-rwxr-xr-xtransex3/java/jpropex/makefile.mk36
-rw-r--r--ucbhelper/inc/ucbhelper/configureucb.hxx201
-rw-r--r--ucbhelper/inc/ucbhelper/contentbroker.hxx2
-rw-r--r--ucbhelper/inc/ucbhelper/propertyvalueset.hxx370
-rw-r--r--ucbhelper/inc/ucbhelper/registerucb.hxx129
-rw-r--r--ucbhelper/prj/build.lst13
-rw-r--r--ucbhelper/prj/d.lst2
-rw-r--r--ucbhelper/source/client/contentbroker.cxx16
-rw-r--r--ucbhelper/source/provider/makefile.mk2
-rw-r--r--ucbhelper/source/provider/propertyvalueset.cxx89
-rw-r--r--ucbhelper/source/provider/registerucb.cxx40
-rw-r--r--ucbhelper/source/provider/registerucb.hxx96
-rw-r--r--ucbhelper/source/provider/simpleauthenticationrequest.cxx23
-rw-r--r--ucbhelper/workben/myucp/exports.map8
-rw-r--r--ucbhelper/workben/myucp/makefile.mk3
-rw-r--r--unotools/inc/unotools/configmgr.hxx3
-rw-r--r--unotools/inc/unotools/confignode.hxx67
-rw-r--r--unotools/inc/unotools/lingucfg.hxx4
-rw-r--r--unotools/source/config/configmgr.cxx15
-rw-r--r--unotools/source/config/confignode.cxx262
-rw-r--r--unotools/source/config/configvaluecontainer.cxx2
-rw-r--r--unotools/source/config/lingucfg.cxx71
-rw-r--r--unotools/source/i18n/transliterationwrapper.cxx40
-rw-r--r--unotools/source/misc/desktopterminationobserver.cxx6
-rw-r--r--unotools/source/misc/fontcvt.cxx16
-rw-r--r--unotools/source/misc/fontdefs.cxx8
-rw-r--r--vcl/aqua/inc/salframe.h2
-rwxr-xr-xvcl/aqua/inc/salframeview.h1
-rw-r--r--vcl/aqua/inc/salgdi.h10
-rw-r--r--vcl/aqua/inc/salinst.h2
-rw-r--r--vcl/aqua/source/a11y/aqua11yfactory.mm3
-rw-r--r--vcl/aqua/source/a11y/aqua11ytablewrapper.h10
-rw-r--r--vcl/aqua/source/a11y/aqua11ytablewrapper.mm182
-rw-r--r--vcl/aqua/source/a11y/aqua11ywrapper.mm31
-rw-r--r--vcl/aqua/source/app/salinst.cxx15
-rw-r--r--vcl/aqua/source/dtrans/aqua_clipboard.cxx13
-rw-r--r--vcl/aqua/source/gdi/aquaprintaccessoryview.mm9
-rw-r--r--vcl/aqua/source/gdi/salgdi.cxx32
-rw-r--r--vcl/aqua/source/gdi/salnativewidgets.cxx10
-rw-r--r--vcl/aqua/source/gdi/salprn.cxx202
-rw-r--r--vcl/aqua/source/window/salframe.cxx112
-rwxr-xr-xvcl/aqua/source/window/salframeview.mm83
-rw-r--r--vcl/aqua/source/window/salmenu.cxx4
-rw-r--r--vcl/inc/postgraphitestl.h9
-rw-r--r--vcl/inc/pregraphitestl.h30
-rwxr-xr-x[-rw-r--r--]vcl/inc/vcl/abstdlg.hxx13
-rw-r--r--vcl/inc/vcl/button.hxx2
-rw-r--r--vcl/inc/vcl/cmdevt.hxx8
-rw-r--r--vcl/inc/vcl/dockwin.hxx5
-rw-r--r--vcl/inc/vcl/glyphcache.hxx5
-rw-r--r--vcl/inc/vcl/graphite_adaptors.hxx6
-rw-r--r--vcl/inc/vcl/graphite_cache.hxx19
-rw-r--r--vcl/inc/vcl/graphite_features.hxx4
-rw-r--r--vcl/inc/vcl/graphite_layout.hxx13
-rw-r--r--vcl/inc/vcl/help.hxx1
-rw-r--r--vcl/inc/vcl/impfont.hxx4
-rw-r--r--vcl/inc/vcl/lstbox.hxx1
-rw-r--r--vcl/inc/vcl/menu.hxx18
-rw-r--r--vcl/inc/vcl/outdev.hxx44
-rw-r--r--vcl/inc/vcl/outfont.hxx6
-rw-r--r--vcl/inc/vcl/ppdparser.hxx30
-rw-r--r--vcl/inc/vcl/prndlg.hxx5
-rw-r--r--vcl/inc/vcl/salgdi.hxx16
-rw-r--r--vcl/inc/vcl/salwtype.hxx5
-rw-r--r--vcl/inc/vcl/syswin.hxx2
-rw-r--r--vcl/inc/vcl/vclevent.hxx5
-rw-r--r--vcl/inc/vcl/window.h2
-rw-r--r--vcl/inc/vcl/window.hxx50
-rw-r--r--vcl/os2/inc/salgdi.h10
-rw-r--r--vcl/os2/source/gdi/salgdi.cxx1
-rw-r--r--vcl/os2/source/window/salframe.cxx7
-rw-r--r--vcl/source/app/dbggui.cxx25
-rw-r--r--vcl/source/app/help.cxx30
-rwxr-xr-xvcl/source/app/settings.cxx2
-rw-r--r--vcl/source/app/svapp.cxx5
-rw-r--r--vcl/source/control/button.cxx34
-rw-r--r--vcl/source/control/ilstbox.cxx7
-rw-r--r--vcl/source/control/lstbox.cxx11
-rw-r--r--vcl/source/control/tabctrl.cxx7
-rw-r--r--vcl/source/fontsubset/cff.cxx91
-rw-r--r--vcl/source/gdi/bitmap.cxx18
-rw-r--r--vcl/source/gdi/image.cxx22
-rw-r--r--vcl/source/gdi/makefile.mk1
-rw-r--r--vcl/source/gdi/metric.cxx7
-rw-r--r--vcl/source/gdi/outdev.cxx26
-rw-r--r--vcl/source/gdi/outdev3.cxx18
-rw-r--r--vcl/source/gdi/outdev6.cxx38
-rw-r--r--vcl/source/gdi/outdevnative.cxx290
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx18
-rw-r--r--vcl/source/gdi/pngread.cxx2
-rw-r--r--vcl/source/gdi/print3.cxx204
-rw-r--r--vcl/source/gdi/salgdilayout.cxx31
-rwxr-xr-xvcl/source/gdi/sallayout.cxx13
-rw-r--r--vcl/source/gdi/salnativewidgets-none.cxx7
-rw-r--r--vcl/source/glyphs/glyphcache.cxx6
-rw-r--r--vcl/source/glyphs/graphite_adaptors.cxx2
-rw-r--r--vcl/source/glyphs/graphite_cache.cxx4
-rw-r--r--vcl/source/glyphs/graphite_features.cxx6
-rw-r--r--vcl/source/glyphs/graphite_layout.cxx239
-rw-r--r--vcl/source/glyphs/graphite_textsrc.cxx10
-rw-r--r--vcl/source/glyphs/graphite_textsrc.hxx6
-rw-r--r--vcl/source/helper/xconnection.cxx16
-rw-r--r--vcl/source/src/print.src2
-rw-r--r--vcl/source/window/dockmgr.cxx88
-rw-r--r--vcl/source/window/menu.cxx195
-rw-r--r--vcl/source/window/printdlg.cxx149
-rw-r--r--vcl/source/window/seleng.cxx6
-rw-r--r--vcl/source/window/syswin.cxx61
-rw-r--r--vcl/source/window/window.cxx61
-rw-r--r--vcl/source/window/window3.cxx259
-rw-r--r--vcl/source/window/winproc.cxx3
-rw-r--r--vcl/unx/gtk/a11y/atkbridge.cxx3
-rw-r--r--vcl/unx/gtk/a11y/atktext.cxx136
-rw-r--r--vcl/unx/gtk/a11y/atktextattributes.cxx63
-rw-r--r--vcl/unx/gtk/a11y/atktextattributes.hxx5
-rw-r--r--vcl/unx/gtk/a11y/atkwindow.cxx26
-rw-r--r--vcl/unx/gtk/a11y/atkwrapper.cxx4
-rw-r--r--vcl/unx/gtk/app/gtkdata.cxx24
-rw-r--r--vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx143
-rw-r--r--vcl/unx/gtk/window/gtkframe.cxx131
-rw-r--r--vcl/unx/headless/svpgdi.cxx2
-rw-r--r--vcl/unx/headless/svpgdi.hxx2
-rw-r--r--vcl/unx/headless/svpinst.cxx26
-rw-r--r--vcl/unx/headless/svpinst.hxx3
-rw-r--r--vcl/unx/headless/svppspgraphics.cxx2
-rw-r--r--vcl/unx/headless/svppspgraphics.hxx2
-rw-r--r--vcl/unx/inc/plugins/gtk/gtkframe.hxx2
-rw-r--r--vcl/unx/inc/plugins/gtk/gtkgdi.hxx42
-rw-r--r--vcl/unx/inc/pspgraphics.h2
-rw-r--r--vcl/unx/inc/saldata.hxx4
-rw-r--r--vcl/unx/inc/saldisp.hxx1
-rw-r--r--vcl/unx/inc/salgdi.h13
-rw-r--r--vcl/unx/inc/wmadaptor.hxx24
-rw-r--r--vcl/unx/kde/kdedata.cxx3
-rw-r--r--vcl/unx/kde/salnativewidgets-kde.cxx25
-rw-r--r--vcl/unx/kde4/KDESalGraphics.cxx8
-rw-r--r--vcl/unx/kde4/KDESalGraphics.hxx15
-rw-r--r--vcl/unx/kde4/KDEXLib.cxx5
-rw-r--r--vcl/unx/source/app/keysymnames.cxx1
-rw-r--r--vcl/unx/source/app/saldata.cxx7
-rw-r--r--vcl/unx/source/app/saldisp.cxx6
-rw-r--r--vcl/unx/source/app/sm.cxx25
-rw-r--r--vcl/unx/source/app/wmadaptor.cxx188
-rw-r--r--vcl/unx/source/dtrans/X11_selection.cxx4
-rw-r--r--vcl/unx/source/fontmanager/fontconfig.cxx30
-rw-r--r--vcl/unx/source/fontmanager/fontmanager.cxx30
-rw-r--r--vcl/unx/source/gdi/pspgraphics.cxx2
-rw-r--r--vcl/unx/source/gdi/salgdi.cxx791
-rw-r--r--vcl/unx/source/gdi/salgdi3.cxx40
-rw-r--r--vcl/unx/source/gdi/salprnpsp.cxx12
-rw-r--r--vcl/unx/source/plugadapt/salplug.cxx8
-rw-r--r--vcl/unx/source/printer/ppdparser.cxx87
-rw-r--r--vcl/unx/source/printergfx/printerjob.cxx3
-rw-r--r--vcl/unx/source/window/salframe.cxx142
-rw-r--r--vcl/util/makefile.mk1
-rw-r--r--vcl/util/makefile2.pmk2
-rw-r--r--vcl/win/inc/salgdi.h10
-rw-r--r--vcl/win/source/app/salinfo.cxx3
-rw-r--r--vcl/win/source/gdi/salgdi3.cxx330
-rw-r--r--vcl/win/source/gdi/salgdi_gdiplus.cxx5
-rw-r--r--vcl/win/source/gdi/salnativewidgets-luna.cxx75
-rw-r--r--[-rwxr-xr-x]vcl/win/source/window/salframe.cxx4
696 files changed, 34648 insertions, 16983 deletions
diff --git a/basebmp/test/basictest.cxx b/basebmp/test/basictest.cxx
index 4129cebdbd3d..6f96cf56f492 100644
--- a/basebmp/test/basictest.cxx
+++ b/basebmp/test/basictest.cxx
@@ -27,7 +27,10 @@
// autogenerated file with codegen.pl
-#include <testshl/simpleheader.hxx>
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
+#include "cppunit/plugin/TestPlugIn.h"
#include <basegfx/vector/b2isize.hxx>
#include <basegfx/point/b2ipoint.hxx>
@@ -291,13 +294,7 @@ public:
};
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(BasicTest, "BasicTest");
+CPPUNIT_TEST_SUITE_REGISTRATION(BasicTest);
}
-
-// -----------------------------------------------------------------------------
-
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-NOADDITIONAL;
-
+CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/basebmp/test/bmpmasktest.cxx b/basebmp/test/bmpmasktest.cxx
index e65c5e569d3c..9be504819fe8 100644
--- a/basebmp/test/bmpmasktest.cxx
+++ b/basebmp/test/bmpmasktest.cxx
@@ -27,7 +27,9 @@
// autogenerated file with codegen.pl
-#include <testshl/simpleheader.hxx>
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
#include <basegfx/vector/b2isize.hxx>
#include <basegfx/range/b2irange.hxx>
@@ -177,7 +179,7 @@ public:
};
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(BmpMaskTest, "BmpMaskTest");
+CPPUNIT_TEST_SUITE_REGISTRATION(BmpMaskTest);
}
diff --git a/basebmp/test/bmptest.cxx b/basebmp/test/bmptest.cxx
index ce2e2440dcd1..9e33f0a8d713 100644
--- a/basebmp/test/bmptest.cxx
+++ b/basebmp/test/bmptest.cxx
@@ -27,7 +27,9 @@
// autogenerated file with codegen.pl
-#include <testshl/simpleheader.hxx>
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
#include <basegfx/vector/b2isize.hxx>
#include <basegfx/range/b2irange.hxx>
@@ -204,7 +206,7 @@ public:
};
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(BmpTest, "BmpTest");
+CPPUNIT_TEST_SUITE_REGISTRATION(BmpTest);
}
diff --git a/basebmp/test/cliptest.cxx b/basebmp/test/cliptest.cxx
index 1c4a20bc0d86..875016d878cc 100644
--- a/basebmp/test/cliptest.cxx
+++ b/basebmp/test/cliptest.cxx
@@ -27,7 +27,9 @@
// autogenerated file with codegen.pl
-#include <testshl/simpleheader.hxx>
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
#include <basegfx/vector/b2isize.hxx>
#include <basegfx/point/b2ipoint.hxx>
@@ -271,7 +273,7 @@ public:
};
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(ClipTest, "ClipTest");
+CPPUNIT_TEST_SUITE_REGISTRATION(ClipTest);
}
diff --git a/basebmp/test/export.map b/basebmp/test/export.map
index 709047ae63e5..3308588ef6f8 100644
--- a/basebmp/test/export.map
+++ b/basebmp/test/export.map
@@ -25,9 +25,9 @@
#
#*************************************************************************
-UDK_3.1 {
+UDK_3_0_0 {
global:
- registerAllTestFunction;
+ cppunitTestPlugIn;
local:
*;
diff --git a/basebmp/test/filltest.cxx b/basebmp/test/filltest.cxx
index ea801de8111f..150fa11b3a72 100644
--- a/basebmp/test/filltest.cxx
+++ b/basebmp/test/filltest.cxx
@@ -27,7 +27,9 @@
// autogenerated file with codegen.pl
-#include <testshl/simpleheader.hxx>
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
#include <basegfx/vector/b2isize.hxx>
#include <basegfx/range/b2drange.hxx>
@@ -265,7 +267,7 @@ public:
};
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(FillTest, "FillTest");
+CPPUNIT_TEST_SUITE_REGISTRATION(FillTest);
}
diff --git a/basebmp/test/linetest.cxx b/basebmp/test/linetest.cxx
index 3c30ed718b70..fcd383fccdb0 100644
--- a/basebmp/test/linetest.cxx
+++ b/basebmp/test/linetest.cxx
@@ -27,7 +27,9 @@
// autogenerated file with codegen.pl
-#include <testshl/simpleheader.hxx>
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
#include <basegfx/vector/b2isize.hxx>
#include <basegfx/point/b2ipoint.hxx>
@@ -213,7 +215,7 @@ public:
};
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(LineTest, "LineTest");
+CPPUNIT_TEST_SUITE_REGISTRATION(LineTest);
}
diff --git a/basebmp/test/makefile.mk b/basebmp/test/makefile.mk
index a11dacc1125d..ca77721716f7 100644
--- a/basebmp/test/makefile.mk
+++ b/basebmp/test/makefile.mk
@@ -60,6 +60,8 @@ CDEFS+=-xalias_level=compatible
.ENDIF
.ENDIF
+CFLAGSCXX += $(CPPUNIT_CFLAGS)
+
# --- Common ----------------------------------------------------------
.IF "$(L10N_framework)"==""
@@ -74,17 +76,10 @@ SHL1OBJS= \
$(SLO)$/linetest.obj \
$(SLO)$/masktest.obj \
$(SLO)$/polytest.obj \
- $(SLO)$/tools.obj \
- $(SLO)$/bitmapdevice.obj \
- $(SLO)$/debug.obj \
- $(SLO)$/polypolygonrenderer.obj
-# last three objs are a bit of a hack: cannot link against LIBBASEBMP
-# here, because not yet delivered. Need the functionality to test, so
-# we're linking it in statically. Need to keep this in sync with
-# source/makefile.mk
+ $(SLO)$/tools.obj
SHL1TARGET= tests
-SHL1STDLIBS= $(SALLIB) \
- $(TESTSHL2LIB)\
+SHL1STDLIBS= $(BASEBMPLIB) \
+ $(SALLIB) \
$(CPPUNITLIB) \
$(BASEGFXLIB)
@@ -92,6 +87,8 @@ SHL1IMPLIB= i$(SHL1TARGET)
DEF1NAME =$(SHL1TARGET)
SHL1VERSIONMAP = export.map
+SHL1RPATH = NONE
+
.ENDIF
# END ------------------------------------------------------------------
@@ -121,16 +118,8 @@ SLOFILES=$(SHL1OBJS)
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
# --- Enable test execution in normal build ------------------------
.IF "$(L10N_framework)"==""
-
-unittest : $(SHL1TARGETN)
- @echo ----------------------------------------------------------
- @echo - start unit test on library $(SHL1TARGETN)
- @echo ----------------------------------------------------------
- $(TESTSHL2) -sf $(mktmp ) $(SHL1TARGETN)
-
-ALLTAR : unittest
+.INCLUDE : _cppunit.mk
.ENDIF
diff --git a/basebmp/test/masktest.cxx b/basebmp/test/masktest.cxx
index e3843eba389a..77cd05588d5a 100644
--- a/basebmp/test/masktest.cxx
+++ b/basebmp/test/masktest.cxx
@@ -27,7 +27,9 @@
// autogenerated file with codegen.pl
-#include <testshl/simpleheader.hxx>
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
#include <basegfx/vector/b2isize.hxx>
#include <basegfx/range/b2irange.hxx>
@@ -165,7 +167,7 @@ public:
};
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(MaskTest, "MaskTest");
+CPPUNIT_TEST_SUITE_REGISTRATION(MaskTest);
}
diff --git a/basebmp/test/polytest.cxx b/basebmp/test/polytest.cxx
index c8290668d1f8..f3b1f0018e17 100644
--- a/basebmp/test/polytest.cxx
+++ b/basebmp/test/polytest.cxx
@@ -27,7 +27,9 @@
// autogenerated file with codegen.pl
-#include <testshl/simpleheader.hxx>
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
#include <basegfx/vector/b2isize.hxx>
#include <basegfx/range/b2irange.hxx>
@@ -285,7 +287,7 @@ public:
};
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(PolyTest, "PolyTest");
+CPPUNIT_TEST_SUITE_REGISTRATION(PolyTest);
}
diff --git a/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx b/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx
index 3941ee19cb42..7ce9e75c3058 100644
--- a/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx
+++ b/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx
@@ -32,6 +32,8 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/vector/b2dvector.hxx>
+namespace rtl { class OUString; }
+
///////////////////////////////////////////////////////////////////////////////
namespace basegfx
@@ -132,6 +134,7 @@ namespace basegfx
rPoint.getX(), rPoint.getY(),
fRadiant);
}
+
} // end of namespace tools
} // end of namespace basegfx
@@ -220,6 +223,10 @@ namespace basegfx
double getShearX() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return mfShearX; }
};
} // end of namespace tools
+
+ /// Returns a string with svg's "matrix(m00,m10,m01,m11,m02,m12)" representation
+ ::rtl::OUString exportToSvg( const B2DHomMatrix& rMatrix );
+
} // end of namespace basegfx
///////////////////////////////////////////////////////////////////////////////
diff --git a/basegfx/inc/basegfx/numeric/ftools.hxx b/basegfx/inc/basegfx/numeric/ftools.hxx
index 0a4cdfcffdaa..65a6566dae25 100644
--- a/basegfx/inc/basegfx/numeric/ftools.hxx
+++ b/basegfx/inc/basegfx/numeric/ftools.hxx
@@ -109,7 +109,7 @@ namespace basegfx
/** clamp given value against given minimum and maximum values
*/
- template <class T> const T& clamp(const T& value, const T& minimum, const T& maximum)
+ template <class T> inline const T& clamp(const T& value, const T& minimum, const T& maximum)
{
if(value < minimum)
{
diff --git a/basegfx/inc/basegfx/polygon/b2dpolygon.hxx b/basegfx/inc/basegfx/polygon/b2dpolygon.hxx
index 30f7786a6981..a12120b5f441 100644
--- a/basegfx/inc/basegfx/polygon/b2dpolygon.hxx
+++ b/basegfx/inc/basegfx/polygon/b2dpolygon.hxx
@@ -260,6 +260,12 @@ namespace basegfx
/// apply transformation given in matrix form
void transform(const basegfx::B2DHomMatrix& rMatrix);
+
+ // point iterators (same iterator validity conditions as for vector)
+ const B2DPoint* begin() const;
+ const B2DPoint* end() const;
+ B2DPoint* begin();
+ B2DPoint* end();
};
} // end of namespace basegfx
diff --git a/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx b/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx
index 1ccaaa8330ec..0032cc47ce4e 100644
--- a/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx
+++ b/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx
@@ -125,6 +125,12 @@ namespace basegfx
// apply transformation given in matrix form to the polygon
void transform(const basegfx::B2DHomMatrix& rMatrix);
+
+ // polygon iterators (same iterator validity conditions as for vector)
+ const B2DPolygon* begin() const;
+ const B2DPolygon* end() const;
+ B2DPolygon* begin();
+ B2DPolygon* end();
};
} // end of namespace basegfx
diff --git a/basegfx/inc/basegfx/polygon/b3dgeometry.hxx b/basegfx/inc/basegfx/polygon/b3dgeometry.hxx
deleted file mode 100644
index ec66f3e3a570..000000000000
--- a/basegfx/inc/basegfx/polygon/b3dgeometry.hxx
+++ /dev/null
@@ -1,70 +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 _BGFX_POLYGON_B3DGEOMETRY_HXX
-#define _BGFX_POLYGON_B3DGEOMETRY_HXX
-
-//////////////////////////////////////////////////////////////////////////////
-// predeclarations
-
-namespace basegfx
-{
-} // end of namespace basegfx
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace basegfx
-{
- class B3DGeometry
- {
- private:
- B2DPolyPolygon maPolyPolygon; // the PolyPolygon geometry data, defines point number
- B3DHomMatrix maPolygonTo3D; // transformation to create 3D PolyPolygon
- B3DPolyPolygon maPolyNormal; // normal for each point or empty -> unified normal
- B2DPolyPolygon maPolyTexture; // texture coordinate for each point or empty -> unified coordinate
- B3DVector maUnifiedVector; // used when maNormal is empty
-
- // bitfield
- unsigned mbUnifiedVectorValid : 1; // flag to know if uvec is calculated yet
-
- public:
- B3DGeometry();
- ~B3DGeometry();
-
- // compare operators
- bool operator==(const B3DGeometry& rGeometry) const;
- bool operator!=(const B3DGeometry& rGeometry) const { return (!operator==(rGeometry)); }
-
- // member count
- sal_uInt32 count() const { return maPolyPolygon.count(); }
- };
-} // end of namespace basegfx
-
-//////////////////////////////////////////////////////////////////////////////
-
-
-#endif /* _BGFX_POLYGON_B3DPOLYGON_HXX */
diff --git a/basegfx/inc/basegfx/range/b2dmultirange.hxx b/basegfx/inc/basegfx/range/b2dmultirange.hxx
deleted file mode 100644
index 4c1eb37be036..000000000000
--- a/basegfx/inc/basegfx/range/b2dmultirange.hxx
+++ /dev/null
@@ -1,114 +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 _BGFX_RANGE_B2DMULTIRANGE_HXX
-#define _BGFX_RANGE_B2DMULTIRANGE_HXX
-
-#include <o3tl/cow_wrapper.hxx>
-#include <memory>
-
-
-namespace basegfx
-{
- class B2DTuple;
- class B2DRange;
- class B2DPolyPolygon;
- class ImplB2DMultiRange;
-
- /** Multiple ranges in one object.
-
- This class combines multiple ranges in one object, providing a
- total, enclosing range for it.
-
- You can use this class e.g. when updating views containing
- rectangular objects. Add each modified object to a
- B2DMultiRange, then test each viewable object against
- intersection with the multi range.
- */
- class B2DMultiRange
- {
- public:
- B2DMultiRange();
- ~B2DMultiRange();
-
- /** Create a multi range with exactly one containing range
- */
- explicit B2DMultiRange( const B2DRange& rRange );
-
- B2DMultiRange( const B2DMultiRange& );
- B2DMultiRange& operator=( const B2DMultiRange& );
-
- /** Check whether range is empty.
-
- @return true, if this object either contains no ranges at
- all, or all contained ranges are empty.
- */
- bool isEmpty() const;
-
- /** Reset to empty.
-
- After this call, the object will not contain any ranges,
- and isEmpty() will return true.
- */
- void reset();
-
- /** Test whether given tuple is inside one or more of the
- included ranges.
- */
- bool isInside( const B2DTuple& rTuple ) const;
-
- /** Test whether given range is inside one or more of the
- included ranges.
- */
- bool isInside( const B2DRange& rRange ) const;
-
- /** Test whether given range overlaps one or more of the
- included ranges.
- */
- bool overlaps( const B2DRange& rRange ) const;
-
- /** Add given range to the number of contained ranges.
- */
- void addRange( const B2DRange& rRange );
-
- /** Get overall bound rect for all included ranges.
- */
- B2DRange getBounds() const;
-
- /** Request poly-polygon representing the added ranges.
-
- This method creates a poly-polygon, consisting exactly out
- of the contained ranges.
- */
- B2DPolyPolygon getPolyPolygon() const;
-
- private:
- o3tl::cow_wrapper< ImplB2DMultiRange > mpImpl;
- };
-}
-
-#endif /* _BGFX_RANGE_B2DMULTIRANGE_HXX */
diff --git a/basegfx/inc/basegfx/range/b2dpolyrange.hxx b/basegfx/inc/basegfx/range/b2dpolyrange.hxx
new file mode 100644
index 000000000000..2202869dc921
--- /dev/null
+++ b/basegfx/inc/basegfx/range/b2dpolyrange.hxx
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: b2dmultirange.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * 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 _BGFX_RANGE_B2DPOLYRANGE_HXX
+#define _BGFX_RANGE_B2DPOLYRANGE_HXX
+
+#include <o3tl/cow_wrapper.hxx>
+#include <boost/tuple/tuple.hpp>
+#include <basegfx/vector/b2enums.hxx>
+
+namespace basegfx
+{
+ class B2DTuple;
+ class B2DRange;
+ class B2DPolyPolygon;
+ class ImplB2DPolyRange;
+
+ /** Multiple ranges in one object.
+
+ This class combines multiple ranges in one object, providing a
+ total, enclosing range for it.
+
+ You can use this class e.g. when updating views containing
+ rectangular objects. Add each modified object to a
+ B2DMultiRange, then test each viewable object against
+ intersection with the multi range.
+
+ Similar in spirit to the poly-polygon vs. polygon relationship.
+
+ Note that comparable to polygons, a poly-range can also
+ contain 'holes' - this is encoded via polygon orientation at
+ the poly-polygon, and via explicit flags for the poly-range.
+ */
+ class B2DPolyRange
+ {
+ public:
+ typedef boost::tuple<B2DRange,B2VectorOrientation> ElementType ;
+
+ B2DPolyRange();
+ ~B2DPolyRange();
+
+ /** Create a multi range with exactly one containing range
+ */
+ explicit B2DPolyRange( const ElementType& rElement );
+ B2DPolyRange( const B2DRange& rRange, B2VectorOrientation eOrient );
+ B2DPolyRange( const B2DPolyRange& );
+ B2DPolyRange& operator=( const B2DPolyRange& );
+
+ /// unshare this poly-range with all internally shared instances
+ void makeUnique();
+
+ bool operator==(const B2DPolyRange&) const;
+ bool operator!=(const B2DPolyRange&) const;
+
+ /// Number of included ranges
+ sal_uInt32 count() const;
+
+ ElementType getElement(sal_uInt32 nIndex) const;
+ void setElement(sal_uInt32 nIndex, const ElementType& rElement );
+ void setElement(sal_uInt32 nIndex, const B2DRange& rRange, B2VectorOrientation eOrient );
+
+ // insert/append a single range
+ void insertElement(sal_uInt32 nIndex, const ElementType& rElement, sal_uInt32 nCount = 1);
+ void insertElement(sal_uInt32 nIndex, const B2DRange& rRange, B2VectorOrientation eOrient, sal_uInt32 nCount = 1);
+ void appendElement(const ElementType& rElement, sal_uInt32 nCount = 1);
+ void appendElement(const B2DRange& rRange, B2VectorOrientation eOrient, sal_uInt32 nCount = 1);
+
+ // insert/append multiple ranges
+ void insertPolyRange(sal_uInt32 nIndex, const B2DPolyRange&);
+ void appendPolyRange(const B2DPolyRange&);
+
+ void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
+ void clear();
+
+ // flip range orientations - converts holes to solids, and vice versa
+ void flip();
+
+ /** Get overall range
+
+ @return
+ The union range of all contained ranges
+ */
+ B2DRange getBounds() const;
+
+ /** Test whether given tuple is inside one or more of the
+ included ranges. Does *not* use overall range, but checks
+ individually.
+ */
+ bool isInside( const B2DTuple& rTuple ) const;
+
+ /** Test whether given range is inside one or more of the
+ included ranges. Does *not* use overall range, but checks
+ individually.
+ */
+ bool isInside( const B2DRange& rRange ) const;
+
+ /** Test whether given range overlaps one or more of the
+ included ranges. Does *not* use overall range, but checks
+ individually.
+ */
+ bool overlaps( const B2DRange& rRange ) const;
+
+ /** Request a poly-polygon with solved cross-overs
+ */
+ B2DPolyPolygon solveCrossovers() const;
+
+ // element iterators (same iterator validity conditions as for vector)
+ const B2DRange* begin() const;
+ const B2DRange* end() const;
+ B2DRange* begin();
+ B2DRange* end();
+
+ private:
+ o3tl::cow_wrapper< ImplB2DPolyRange > mpImpl;
+ };
+}
+
+#endif /* _BGFX_RANGE_B2DPOLYRANGE_HXX */
diff --git a/basegfx/inc/basegfx/range/b2drangeclipper.hxx b/basegfx/inc/basegfx/range/b2drangeclipper.hxx
new file mode 100644
index 000000000000..3285ffeaffe1
--- /dev/null
+++ b/basegfx/inc/basegfx/range/b2drangeclipper.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: b2dmultirange.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * 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 _BGFX_RANGE_B2DRANGECLIPPER_HXX
+#define _BGFX_RANGE_B2DRANGECLIPPER_HXX
+
+#include <basegfx/range/b2dpolyrange.hxx>
+#include <vector>
+
+namespace basegfx
+{
+ namespace tools
+ {
+ /** Extract poly-polygon w/o self-intersections from poly-range
+
+ Similar to the solveCrossovers(const B2DPolyPolygon&)
+ method, this one calculates a self-intersection-free
+ poly-polygon with the same topology, and encoding
+ inside/outsidedness via polygon orientation and layering.
+ */
+ B2DPolyPolygon solveCrossovers(const std::vector<B2DRange>& rRanges,
+ const std::vector<B2VectorOrientation>& rOrientations);
+ }
+}
+
+#endif /* _BGFX_RANGE_B2DRANGECLIPPER_HXX */
diff --git a/basegfx/inc/basegfx/tools/b2dclipstate.hxx b/basegfx/inc/basegfx/tools/b2dclipstate.hxx
new file mode 100644
index 000000000000..7d336d8cb48e
--- /dev/null
+++ b/basegfx/inc/basegfx/tools/b2dclipstate.hxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: rectcliptools.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * 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 _BGFX_TOOLS_CLIPSTATE_HXX
+#define _BGFX_TOOLS_CLIPSTATE_HXX
+
+#include <sal/types.h>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ class B2DRange;
+ class B2DPolyRange;
+ class B2DPolygon;
+ class B2DPolyPolygon;
+
+ namespace tools
+ {
+ class ImplB2DClipState;
+
+ /** This class provides an optimized, symbolic clip state for graphical output
+
+ Having a current 'clip' state is a common attribute of
+ almost all graphic output APIs, most of which internally
+ represent it via a list of rectangular bands. In contrast,
+ this implementation purely uses symbolic clips, but in a
+ quite efficient manner, deferring actual evaluation until
+ a clip representation is requested, and using faster code
+ paths for common special cases (like all-rectangle clips)
+ */
+ class B2DClipState
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImplB2DClipState > ImplType;
+
+ private:
+ ImplType mpImpl;
+
+ public:
+ /// Init clip, in 'cleared' state - everything is visible
+ B2DClipState();
+ ~B2DClipState();
+ B2DClipState( const B2DClipState& );
+ explicit B2DClipState( const B2DRange& );
+ explicit B2DClipState( const B2DPolygon& );
+ explicit B2DClipState( const B2DPolyPolygon& );
+ B2DClipState& operator=( const B2DClipState& );
+
+ /// unshare this poly-range with all internally shared instances
+ void makeUnique();
+
+ /// Set clip to 'null' - nothing is visible
+ void makeNull();
+ /// returns true when clip is 'null' - nothing is visible
+ bool isNull() const;
+
+ /// Set clip 'cleared' - everything is visible
+ void makeClear();
+ /// returns true when clip is 'cleared' - everything is visible
+ bool isCleared() const;
+
+ bool operator==(const B2DClipState&) const;
+ bool operator!=(const B2DClipState&) const;
+
+ void unionRange(const B2DRange& );
+ void unionPolygon(const B2DPolygon& );
+ void unionPolyPolygon(const B2DPolyPolygon& );
+ void unionClipState(const B2DClipState& );
+
+ void intersectRange(const B2DRange& );
+ void intersectPolygon(const B2DPolygon& );
+ void intersectPolyPolygon(const B2DPolyPolygon& );
+ void intersectClipState(const B2DClipState& );
+
+ void subtractRange(const B2DRange& );
+ void subtractPolygon(const B2DPolygon& );
+ void subtractPolyPolygon(const B2DPolyPolygon& );
+ void subtractClipState(const B2DClipState& );
+
+ void xorRange(const B2DRange& );
+ void xorPolygon(const B2DPolygon& );
+ void xorPolyPolygon(const B2DPolyPolygon& );
+ void xorClipState(const B2DClipState& );
+
+ B2DPolyPolygon getClipPoly() const;
+ };
+ }
+}
+
+#endif // _BGFX_TOOLS_CLIPSTATE_HXX
diff --git a/basegfx/inc/basegfx/tools/gradienttools.hxx b/basegfx/inc/basegfx/tools/gradienttools.hxx
index 0dab1a5117ff..2f436fa1d717 100644
--- a/basegfx/inc/basegfx/tools/gradienttools.hxx
+++ b/basegfx/inc/basegfx/tools/gradienttools.hxx
@@ -34,6 +34,9 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/numeric/ftools.hxx>
+#include <vector>
+#include <algorithm>
+
namespace basegfx
{
/** Gradient definition as used in ODF 1.2
@@ -75,6 +78,8 @@ namespace basegfx
{
/** Create matrix for ODF's linear gradient definition
+ Note that odf linear gradients are varying in y direction.
+
@param o_rGradientInfo
Receives the calculated texture transformation matrix (for
use with standard [0,1]x[0,1] texture coordinates)
@@ -106,7 +111,7 @@ namespace basegfx
@param rUV
Current uv coordinate. Values outside [0,1] will be
- clamped.
+ clamped. Assumes gradient color varies along the y axis.
@param rGradInfo
Gradient info, for transformation and number of steps
@@ -126,6 +131,14 @@ namespace basegfx
/** Create matrix for ODF's axial gradient definition
+ Note that odf axial gradients are varying in y
+ direction. Note further that you can map the axial
+ gradient to a linear gradient (in case you want or need to
+ avoid an extra gradient renderer), by using
+ createLinearODFGradientInfo() instead, shifting the
+ resulting texture transformation by 0.5 to the top and
+ appending the same stop colors again, but mirrored.
+
@param o_rGradientInfo
Receives the calculated texture transformation matrix (for
use with standard [0,1]x[0,1] texture coordinates)
@@ -157,7 +170,7 @@ namespace basegfx
@param rUV
Current uv coordinate. Values outside [0,1] will be
- clamped.
+ clamped. Assumes gradient color varies along the y axis.
@param rGradInfo
Gradient info, for transformation and number of steps
@@ -391,7 +404,6 @@ namespace basegfx
{
return getSquareGradientAlpha(rUV, rGradInfo); // only matrix setup differs
}
-
}
}
diff --git a/basegfx/inc/basegfx/tools/keystoplerp.hxx b/basegfx/inc/basegfx/tools/keystoplerp.hxx
new file mode 100644
index 000000000000..a54b3485b1a1
--- /dev/null
+++ b/basegfx/inc/basegfx/tools/keystoplerp.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: canvastools.hxx,v $
+ * $Revision: 1.10 $
+ *
+ * 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 _BGFX_TOOLS_KEYSTOPLERP_HXX
+#define _BGFX_TOOLS_KEYSTOPLERP_HXX
+
+#include <basegfx/numeric/ftools.hxx>
+#include <vector>
+
+namespace com{ namespace sun{ namespace star{ namespace uno {
+ template<typename T> class Sequence;
+}}}}
+
+namespace basegfx
+{
+ namespace tools
+ {
+ /** Lerp in a vector of key stops
+
+ This class holds a key stop vector and provides the
+ functionality to lerp inside it. Useful e.g. for
+ multi-stop gradients, or the SMIL key time activity.
+
+ For those, given a global [0,1] lerp alpha, one need to
+ find the suitable bucket index from key stop vector, and
+ then calculate the relative alpha between the two buckets
+ found.
+ */
+ class KeyStopLerp
+ {
+ public:
+ typedef std::pair<std::ptrdiff_t,double> ResultType;
+
+ /** Create lerper with given vector of stops
+
+ @param rKeyStops
+
+ Vector of stops, must contain at least two elements
+ (though preferrably more, otherwise you probably don't
+ need key stop lerping in the first place). All
+ elements must be of monotonically increasing value.
+ */
+ explicit KeyStopLerp( const std::vector<double>& rKeyStops );
+
+ /** Create lerper with given sequence of stops
+
+ @param rKeyStops
+
+ Sequence of stops, must contain at least two elements
+ (though preferrably more, otherwise you probably don't
+ need key stop lerping in the first place). All
+ elements must be of monotonically increasing value.
+ */
+ explicit KeyStopLerp( const ::com::sun::star::uno::Sequence<double>& rKeyStops );
+
+ /** Find two nearest bucket index & interpolate
+
+ @param fAlpha
+ Find bucket index i, with keyStops[i] < fAlpha <=
+ keyStops[i+1]. Return new alpha value in [0,1),
+ proportional to fAlpha's position between keyStops[i]
+ and keyStops[i+1]
+ */
+ ResultType lerp(double fAlpha) const;
+
+ private:
+ std::vector<double> maKeyStops;
+ mutable std::ptrdiff_t mnLastIndex;
+ };
+ }
+}
+
+#endif
diff --git a/basegfx/inc/basegfx/tools/lerp.hxx b/basegfx/inc/basegfx/tools/lerp.hxx
new file mode 100644
index 000000000000..590ef34c2009
--- /dev/null
+++ b/basegfx/inc/basegfx/tools/lerp.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: lerp.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * 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 _BGFX_TOOLS_LERP_HXX
+#define _BGFX_TOOLS_LERP_HXX
+
+#include <sal/types.h>
+
+namespace basegfx
+{
+ namespace tools
+ {
+ /** Generic linear interpolator
+
+ @tpl ValueType
+ Must have operator+ and operator* defined, and should
+ have value semantics.
+
+ @param t
+ As usual, t must be in the [0,1] range
+ */
+ template< typename ValueType > ValueType lerp( const ValueType& rFrom,
+ const ValueType& rTo,
+ double t )
+ {
+ // This is only to suppress a double->int warning. All other
+ // types should be okay here.
+ return static_cast<ValueType>( (1.0-t)*rFrom + t*rTo );
+ }
+ }
+}
+
+#endif /* _BGFX_TOOLS_LERP_HXX */
diff --git a/basegfx/prj/build.lst b/basegfx/prj/build.lst
index 418b3822a7ee..fe3354b3f256 100644
--- a/basegfx/prj/build.lst
+++ b/basegfx/prj/build.lst
@@ -1,4 +1,4 @@
-fx basegfx : o3tl sal offuh cppuhelper cppu testshl2 NULL
+fx basegfx : o3tl sal offuh cppuhelper cppu CPPUNIT:cppunit NULL
fx basegfx usr1 - all fx_mkout NULL
fx basegfx\inc nmake - all fx_inc NULL
fx basegfx\prj get - all fx_prj NULL
diff --git a/basegfx/prj/d.lst b/basegfx/prj/d.lst
index 68ab880eef62..3d4d985f3ae6 100644
--- a/basegfx/prj/d.lst
+++ b/basegfx/prj/d.lst
@@ -27,7 +27,7 @@ mkdir: %_DEST%\inc%_EXT%\basegfx\range
..\inc\basegfx\range\basicrange.hxx %_DEST%\inc%_EXT%\basegfx\range\basicrange.hxx
..\inc\basegfx\range\basicbox.hxx %_DEST%\inc%_EXT%\basegfx\range\basicbox.hxx
..\inc\basegfx\range\b1drange.hxx %_DEST%\inc%_EXT%\basegfx\range\b1drange.hxx
-..\inc\basegfx\range\b2dmultirange.hxx %_DEST%\inc%_EXT%\basegfx\range\b2dmultirange.hxx
+..\inc\basegfx\range\b2dpolyrange.hxx %_DEST%\inc%_EXT%\basegfx\range\b2dpolyrange.hxx
..\inc\basegfx\range\b2drange.hxx %_DEST%\inc%_EXT%\basegfx\range\b2drange.hxx
..\inc\basegfx\range\b2drectangle.hxx %_DEST%\inc%_EXT%\basegfx\range\b2drectangle.hxx
..\inc\basegfx\range\b2dconnectedranges.hxx %_DEST%\inc%_EXT%\basegfx\range\b2dconnectedranges.hxx
@@ -90,7 +90,10 @@ mkdir: %_DEST%\inc%_EXT%\basegfx\tuple
mkdir: %_DEST%\inc%_EXT%\basegfx\tools
..\inc\basegfx\tools\canvastools.hxx %_DEST%\inc%_EXT%\basegfx\tools\canvastools.hxx
+..\inc\basegfx\tools\keystoplerp.hxx %_DEST%\inc%_EXT%\basegfx\tools\keystoplerp.hxx
+..\inc\basegfx\tools\lerp.hxx %_DEST%\inc%_EXT%\basegfx\tools\lerp.hxx
..\inc\basegfx\tools\unopolypolygon.hxx %_DEST%\inc%_EXT%\basegfx\tools\unopolypolygon.hxx
+..\inc\basegfx\tools\b2dclipstate.hxx %_DEST%\inc%_EXT%\basegfx\tools\b2dclipstate.hxx
..\inc\basegfx\tools\rectcliptools.hxx %_DEST%\inc%_EXT%\basegfx\tools\rectcliptools.hxx
..\inc\basegfx\tools\tools.hxx %_DEST%\inc%_EXT%\basegfx\tools\tools.hxx
..\inc\basegfx\tools\gradienttools.hxx %_DEST%\inc%_EXT%\basegfx\tools\gradienttools.hxx
diff --git a/basegfx/qa/mkpolygons.pl b/basegfx/qa/mkpolygons.pl
new file mode 100644
index 000000000000..b465a4f845ab
--- /dev/null
+++ b/basegfx/qa/mkpolygons.pl
@@ -0,0 +1,344 @@
+:
+eval 'exec perl -wS $0 ${1+"$@"}'
+ if 0;
+
+#
+# 2009 Copyright Novell, Inc. & Sun Microsystems, Inc.
+#
+# 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.
+#
+
+use IO::File;
+use Cwd;
+use File::Spec;
+use File::Spec::Functions;
+use File::Temp;
+use File::Path;
+
+$TempDir = "";
+
+
+# all the XML package generation is a blatant rip from AF's
+# write-calc-doc.pl
+
+
+###############################################################################
+# Open a file with the given name.
+# First it is checked if the temporary directory, in which all files for
+# the document are gathered, is already present and create it if it is not.
+# Then create the path to the file inside the temporary directory.
+# Finally open the file and return a file handle to it.
+#
+sub open_file
+{
+ my $filename = pop @_;
+
+ # Create base directory of temporary directory tree if not alreay
+ # present.
+ if ($TempDir eq "")
+ {
+ $TempDir = File::Temp::tempdir (CLEANUP => 1);
+ }
+
+ # Create the path to the file.
+ my $fullname = File::Spec->catfile ($TempDir, $filename);
+ my ($volume,$directories,$file) = File::Spec->splitpath ($fullname);
+ mkpath (File::Spec->catpath ($volume,$directories,""));
+
+ # Open the file and return a file handle to it.
+ return new IO::File ($fullname, "w");
+}
+
+
+###############################################################################
+# Zip the files in the directory tree into the given file.
+#
+sub zip_dirtree
+{
+ my $filename = pop @_;
+
+ my $cwd = getcwd;
+ my $zip_name = $filename;
+
+ # We are about to change the directory.
+ # Therefore create an absolute pathname for the zip archive.
+
+ # First transfer the drive from $cwd to $zip_name. This is a
+ # workaround for a bug in file_name_is_absolute which thinks
+ # the the path \bla is an absolute path under DOS.
+ my ($volume,$directories,$file) = File::Spec->splitpath ($zip_name);
+ my ($volume_cwd,$directories_cwd,$file_cwd) = File::Spec->splitpath ($cwd);
+ $volume = $volume_cwd if ($volume eq "");
+ $zip_name = File::Spec->catpath ($volume,$directories,$file);
+
+ # Add the current working directory to a relative path.
+ if ( ! file_name_is_absolute ($zip_name))
+ {
+ $zip_name = File::Spec->catfile ($cwd, $zip_name);
+
+ # Try everything to clean up the name.
+ $zip_name = File::Spec->rel2abs ($filename);
+ $zip_name = File::Spec->canonpath ($zip_name);
+
+ # Remove .. directories from the middle of the path.
+ while ($zip_name =~ /\/[^\/][^\.\/][^\/]*\/\.\.\//)
+ {
+ $zip_name = $` . "/" . $';
+ }
+ }
+
+ # Just in case the zip program gets confused by an existing file with the
+ # same name as the one to be written that file is removed first.
+ if ( -e $filename)
+ {
+ if (unlink ($filename) == 0)
+ {
+ print "Existing file $filename could not be deleted.\n";
+ print "Please close the application that uses it, then try again.\n";
+ return;
+ }
+ }
+
+ # Finally create the zip file. First change into the temporary directory
+ # so that the resulting zip file contains only paths relative to it.
+ print "zipping [$ZipCmd $ZipFlags $zip_name *]\n";
+ chdir ($TempDir);
+ system ("$ZipCmd $ZipFlags $zip_name *");
+ chdir ($cwd);
+}
+
+
+sub writeHeader
+{
+ print $OUT qq~<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0">
+ <office:scripts/>
+ <office:automatic-styles>
+ <style:style style:name="dp1" style:family="drawing-page">
+ <style:drawing-page-properties presentation:background-visible="true" presentation:background-objects-visible="true" presentation:display-footer="true" presentation:display-page-number="false" presentation:display-date-time="true"/>
+ </style:style>
+ <style:style style:name="gr1" style:family="graphic" style:parent-style-name="standard">
+ <style:graphic-properties draw:textarea-horizontal-align="center" draw:fill="none" draw:stroke="none" draw:textarea-vertical-align="middle"/>
+ </style:style>
+ <style:style style:name="gr2" style:family="graphic" style:parent-style-name="standard">
+ <style:graphic-properties draw:textarea-horizontal-align="center" draw:textarea-vertical-align="middle"/>
+ </style:style>
+ <style:style style:name="pr1" style:family="presentation" style:parent-style-name="Default-title">
+ <style:graphic-properties draw:fill-color="#ffffff" draw:auto-grow-height="true" fo:min-height="3.508cm"/>
+ </style:style>
+ <style:style style:name="pr2" style:family="presentation" style:parent-style-name="Default-notes">
+ <style:graphic-properties draw:fill-color="#ffffff" draw:auto-grow-height="true" fo:min-height="13.367cm"/>
+ </style:style>
+ <style:style style:name="P1" style:family="paragraph">
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="0cm"/>
+ </style:style>
+ <style:style style:name="P2" style:family="paragraph">
+ <style:paragraph-properties fo:margin-left="0.6cm" fo:margin-right="0cm" fo:text-indent="-0.6cm"/>
+ </style:style>
+ <text:list-style style:name="L1">
+ <text:list-level-style-bullet text:level="1" text:bullet-char="â—">
+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="2" text:bullet-char="â—">
+ <style:list-level-properties text:space-before="0.6cm" text:min-label-width="0.6cm"/>
+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="3" text:bullet-char="â—">
+ <style:list-level-properties text:space-before="1.2cm" text:min-label-width="0.6cm"/>
+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="4" text:bullet-char="â—">
+ <style:list-level-properties text:space-before="1.8cm" text:min-label-width="0.6cm"/>
+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="5" text:bullet-char="â—">
+ <style:list-level-properties text:space-before="2.4cm" text:min-label-width="0.6cm"/>
+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="6" text:bullet-char="â—">
+ <style:list-level-properties text:space-before="3cm" text:min-label-width="0.6cm"/>
+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="7" text:bullet-char="â—">
+ <style:list-level-properties text:space-before="3.6cm" text:min-label-width="0.6cm"/>
+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="8" text:bullet-char="â—">
+ <style:list-level-properties text:space-before="4.2cm" text:min-label-width="0.6cm"/>
+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="9" text:bullet-char="â—">
+ <style:list-level-properties text:space-before="4.8cm" text:min-label-width="0.6cm"/>
+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+ </text:list-level-style-bullet>
+ </text:list-style>
+ </office:automatic-styles>
+ <office:body>
+ <office:presentation>
+~;
+
+}
+
+sub writeSlideHeader
+{
+ my $titleText = pop @_;
+ my $slideNum = pop @_;
+
+ print $OUT " <draw:page draw:name=\"page1\" draw:style-name=\"dp1\" draw:master-page-name=\"Default\">\n";
+ print $OUT " <office:forms form:automatic-focus=\"false\" form:apply-design-mode=\"false\"/>\n";
+ print $OUT " <draw:rect draw:style-name=\"gr1\" draw:text-style-name=\"P1\" draw:id=\"id$slideNum\" draw:layer=\"layout\" svg:width=\"17.5cm\" svg:height=\"6cm\" svg:x=\"5cm\" svg:y=\"4cm\">\n";
+ print $OUT " <text:p text:style-name=\"P2\">Slide: $slideNum</text:p>\n";
+ print $OUT " <text:p text:style-name=\"P2\">Path: $titleText</text:p>\n";
+ print $OUT " </draw:rect>\n";
+}
+
+
+sub writeSlideFooter
+{
+ print $OUT " <presentation:notes draw:style-name=\"dp1\">\n";
+ print $OUT " <draw:page-thumbnail draw:style-name=\"gr1\" draw:layer=\"layout\" svg:width=\"14.851cm\" svg:height=\"11.138cm\" svg:x=\"3.068cm\" svg:y=\"2.257cm\" draw:page-number=\"1\" presentation:class=\"page\"/>\n";
+ print $OUT " <draw:frame presentation:style-name=\"pr3\" draw:layer=\"layout\" svg:width=\"16.79cm\" svg:height=\"13.116cm\" svg:x=\"2.098cm\" svg:y=\"14.109cm\" presentation:class=\"notes\" presentation:placeholder=\"true\">\n";
+ print $OUT " <draw:text-box/>\n";
+ print $OUT " </draw:frame>\n";
+ print $OUT " </presentation:notes>\n";
+ print $OUT " </draw:page>\n";
+}
+
+sub writeFooter
+{
+ print $OUT qq~ <presentation:settings presentation:full-screen="false"/>
+ </office:presentation>
+ </office:body>
+</office:document-content>
+~;
+
+}
+
+sub writePath
+{
+ my $pathAry = pop @_;
+ my $path = $pathAry->[1];
+ my $viewBox = $pathAry->[0];
+
+ print $OUT " <draw:path draw:style-name=\"gr2\" draw:text-style-name=\"P1\" draw:layer=\"layout\" svg:width=\"10cm\" svg:height=\"10cm\" svg:x=\"5cm\" svg:y=\"5cm\" svg:viewBox=\"";
+ print $OUT $viewBox;
+ print $OUT "\" svg:d=\"";
+ print $OUT $path;
+ print $OUT "\">\n";
+ print $OUT " <text:p/>\n";
+ print $OUT " </draw:path>\n";
+}
+
+sub writeManifest
+{
+ my $outFile = open_file("META-INF/manifest.xml");
+
+ print $outFile qq~<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE manifest:manifest PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd">
+<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0">
+ <manifest:file-entry manifest:media-type="application/vnd.oasis.opendocument.presentation" manifest:full-path="/"/>
+ <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="content.xml"/>
+</manifest:manifest>
+~;
+
+ $outFile->close;
+}
+
+
+###############################################################################
+# Print usage information.
+#
+sub usage ()
+{
+ print <<END_OF_USAGE;
+usage: $0 <option>* [<SvgD-values>]
+
+output-file-name defaults to polygons.odp.
+
+ -h Print this usage information.
+ -o output-file-name
+END_OF_USAGE
+}
+
+###############################################################################
+# Process the command line.
+#
+sub process_command_line
+{
+ foreach (@ARGV)
+ {
+ if (/^-h/)
+ {
+ usage;
+ exit 0;
+ }
+ }
+
+ $global_output_name = "polygons.odp";
+ my $j = 0, $noMoreOptions = 0;
+ for (my $i=0; $i<$#ARGV; $i++)
+ {
+ if ( !$noMoreOptions and $ARGV[$i] eq "-o")
+ {
+ $i++;
+ $global_output_name = $ARGV[$i];
+ }
+ elsif ( !$noMoreOptions and $ARGV[$i] eq "--")
+ {
+ $noMoreOptions = 1;
+ }
+ elsif ( !$noMoreOptions and $ARGV[$i] =~ /^-/)
+ {
+ print "Unknown option $ARGV[$i]\n";
+ usage;
+ exit 1;
+ }
+ else
+ {
+ push(@paths, [$ARGV[$i],$ARGV[$i+1]]);
+ $i++;
+ }
+ }
+
+ print "output to $global_output_name\n";
+}
+
+###############################################################################
+# Main
+###############################################################################
+
+$ZipCmd = $ENV{LOG_FILE_ZIP_CMD};
+$ZipFlags = $ENV{LOG_FILE_ZIP_FLAGS};
+# Provide default values for the zip command and it's flags.
+if ( ! defined $ZipCmd)
+{
+ $ZipCmd = "zip" unless defined $ZipCmd;
+ $ZipFlags = "-r -q" unless defined $ZipFlags;
+}
+
+process_command_line();
+
+writeManifest();
+
+$OUT = open_file( "content.xml" );
+
+writeHeader();
+
+$pathNum=0;
+foreach $path (@paths)
+{
+ writeSlideHeader($pathNum, $path->[1]);
+ writePath($path);
+ writeSlideFooter();
+ $pathNum++;
+}
+
+writeFooter();
+
+$OUT->close;
+
+zip_dirtree ($global_output_name);
+
diff --git a/basegfx/source/color/bcolortools.cxx b/basegfx/source/color/bcolortools.cxx
index f7f26c6dd843..543097de3d77 100644
--- a/basegfx/source/color/bcolortools.cxx
+++ b/basegfx/source/color/bcolortools.cxx
@@ -61,7 +61,7 @@ namespace basegfx { namespace tools
else if( g == maxVal )
h = 2.0 + (b - r)/d;
else
- h = 4.0 + (r - h)/d;
+ h = 4.0 + (r - g)/d;
h *= 60.0;
diff --git a/basegfx/source/matrix/b2dhommatrixtools.cxx b/basegfx/source/matrix/b2dhommatrixtools.cxx
index 0f294d6a262f..0b85ee229ecc 100644
--- a/basegfx/source/matrix/b2dhommatrixtools.cxx
+++ b/basegfx/source/matrix/b2dhommatrixtools.cxx
@@ -29,11 +29,39 @@
#include "precompiled_basegfx.hxx"
#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
///////////////////////////////////////////////////////////////////////////////
namespace basegfx
{
+ ::rtl::OUString exportToSvg( const B2DHomMatrix& rMatrix )
+ {
+ rtl::OUStringBuffer aStrBuf;
+ aStrBuf.appendAscii("matrix(");
+
+ aStrBuf.append(rMatrix.get(0,0));
+ aStrBuf.appendAscii(", ");
+
+ aStrBuf.append(rMatrix.get(1,0));
+ aStrBuf.appendAscii(", ");
+
+ aStrBuf.append(rMatrix.get(0,1));
+ aStrBuf.appendAscii(", ");
+
+ aStrBuf.append(rMatrix.get(1,1));
+ aStrBuf.appendAscii(", ");
+
+ aStrBuf.append(rMatrix.get(0,2));
+ aStrBuf.appendAscii(", ");
+
+ aStrBuf.append(rMatrix.get(1,2));
+ aStrBuf.appendAscii(")");
+
+ return aStrBuf.makeStringAndClear();
+ }
+
namespace tools
{
void createSinCosOrthogonal(double& o_rSin, double& o_rCos, double fRadiant)
diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx
index dc16938a3f99..d8255dc7ec10 100644
--- a/basegfx/source/polygon/b2dpolygon.cxx
+++ b/basegfx/source/polygon/b2dpolygon.cxx
@@ -41,38 +41,24 @@
//////////////////////////////////////////////////////////////////////////////
-class CoordinateData2D
+struct CoordinateData2D : public basegfx::B2DPoint
{
- basegfx::B2DPoint maPoint;
-
public:
- CoordinateData2D()
- : maPoint()
- {}
+ CoordinateData2D() {}
explicit CoordinateData2D(const basegfx::B2DPoint& rData)
- : maPoint(rData)
+ : B2DPoint(rData)
{}
- const basegfx::B2DPoint& getCoordinate() const
+ CoordinateData2D& operator=(const basegfx::B2DPoint& rData)
{
- return maPoint;
- }
-
- void setCoordinate(const basegfx::B2DPoint& rValue)
- {
- if(rValue != maPoint)
- maPoint = rValue;
- }
-
- bool operator==(const CoordinateData2D& rData ) const
- {
- return (maPoint == rData.getCoordinate());
+ B2DPoint::operator=(rData);
+ return *this;
}
void transform(const basegfx::B2DHomMatrix& rMatrix)
{
- maPoint *= rMatrix;
+ *this *= rMatrix;
}
};
@@ -112,12 +98,12 @@ public:
const basegfx::B2DPoint& getCoordinate(sal_uInt32 nIndex) const
{
- return maVector[nIndex].getCoordinate();
+ return maVector[nIndex];
}
void setCoordinate(sal_uInt32 nIndex, const basegfx::B2DPoint& rValue)
{
- maVector[nIndex].setCoordinate(rValue);
+ maVector[nIndex] = rValue;
}
void reserve(sal_uInt32 nCount)
@@ -228,6 +214,38 @@ public:
aStart->transform(rMatrix);
}
}
+
+ const basegfx::B2DPoint* begin() const
+ {
+ if(maVector.empty())
+ return 0;
+ else
+ return &maVector.front();
+ }
+
+ const basegfx::B2DPoint* end() const
+ {
+ if(maVector.empty())
+ return 0;
+ else
+ return (&maVector.back())+1;
+ }
+
+ basegfx::B2DPoint* begin()
+ {
+ if(maVector.empty())
+ return 0;
+ else
+ return &maVector.front();
+ }
+
+ basegfx::B2DPoint* end()
+ {
+ if(maVector.empty())
+ return 0;
+ else
+ return (&maVector.back())+1;
+ }
};
//////////////////////////////////////////////////////////////////////////////
@@ -1149,6 +1167,28 @@ public:
maPoints.transform(rMatrix);
}
}
+
+ const basegfx::B2DPoint* begin() const
+ {
+ return maPoints.begin();
+ }
+
+ const basegfx::B2DPoint* end() const
+ {
+ return maPoints.end();
+ }
+
+ basegfx::B2DPoint* begin()
+ {
+ mpBufferedData.reset();
+ return maPoints.begin();
+ }
+
+ basegfx::B2DPoint* end()
+ {
+ mpBufferedData.reset();
+ return maPoints.end();
+ }
};
//////////////////////////////////////////////////////////////////////////////
@@ -1586,6 +1626,26 @@ namespace basegfx
mpPolygon->transform(rMatrix);
}
}
+
+ const B2DPoint* B2DPolygon::begin() const
+ {
+ return mpPolygon->begin();
+ }
+
+ const B2DPoint* B2DPolygon::end() const
+ {
+ return mpPolygon->end();
+ }
+
+ B2DPoint* B2DPolygon::begin()
+ {
+ return mpPolygon->begin();
+ }
+
+ B2DPoint* B2DPolygon::end()
+ {
+ return mpPolygon->end();
+ }
} // end of namespace basegfx
//////////////////////////////////////////////////////////////////////////////
diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
index 11955ceb22f9..e03aadfe1577 100644
--- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
+++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
@@ -364,7 +364,8 @@ namespace basegfx
if(fTools::moreOrEqual(fCutB, fZero) && fTools::less(fCutB, fOne))
{
// cut is in both ranges. Add points for A and B
- if(fTools::equalZero(fCutA))
+ // #i111715# use fTools::equal instead of fTools::equalZero for better accuracy
+ if(fTools::equal(fCutA, fZero))
{
// ignore for start point in first edge; this is handled
// by outer methods and would just produce a double point
@@ -379,7 +380,8 @@ namespace basegfx
rTempPointsA.push_back(temporaryPoint(aCutPoint, a, fCutA));
}
- if(fTools::equalZero(fCutB))
+ // #i111715# use fTools::equal instead of fTools::equalZero for better accuracy
+ if(fTools::equal(fCutB, fZero))
{
// ignore for start point in first edge; this is handled
// by outer methods and would just produce a double point
diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx
index e54a5e2707c9..e9db491ecd48 100644
--- a/basegfx/source/polygon/b2dpolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolygontools.cxx
@@ -2346,7 +2346,8 @@ namespace basegfx
// polygon must be closed to resemble a rect, and contain
// at least four points.
if( !rPoly.isClosed() ||
- rPoly.count() < 4 )
+ rPoly.count() < 4 ||
+ rPoly.areControlPointsUsed() )
{
return false;
}
diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx
index 767d2b25ced5..9b28dffd19af 100644
--- a/basegfx/source/polygon/b2dpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dpolypolygon.cxx
@@ -163,6 +163,38 @@ public:
maPolygons.end(),
std::mem_fun_ref( &basegfx::B2DPolygon::makeUnique ));
}
+
+ const basegfx::B2DPolygon* begin() const
+ {
+ if(maPolygons.empty())
+ return 0;
+ else
+ return &maPolygons.front();
+ }
+
+ const basegfx::B2DPolygon* end() const
+ {
+ if(maPolygons.empty())
+ return 0;
+ else
+ return (&maPolygons.back())+1;
+ }
+
+ basegfx::B2DPolygon* begin()
+ {
+ if(maPolygons.empty())
+ return 0;
+ else
+ return &maPolygons.front();
+ }
+
+ basegfx::B2DPolygon* end()
+ {
+ if(maPolygons.empty())
+ return 0;
+ else
+ return &(maPolygons.back())+1;
+ }
};
//////////////////////////////////////////////////////////////////////////////
@@ -375,6 +407,26 @@ namespace basegfx
mpPolyPolygon->transform(rMatrix);
}
}
+
+ const B2DPolygon* B2DPolyPolygon::begin() const
+ {
+ return mpPolyPolygon->begin();
+ }
+
+ const B2DPolygon* B2DPolyPolygon::end() const
+ {
+ return mpPolyPolygon->end();
+ }
+
+ B2DPolygon* B2DPolyPolygon::begin()
+ {
+ return mpPolyPolygon->begin();
+ }
+
+ B2DPolygon* B2DPolyPolygon::end()
+ {
+ return mpPolyPolygon->end();
+ }
} // end of namespace basegfx
// eof
diff --git a/basegfx/source/polygon/b2dsvgpolypolygon.cxx b/basegfx/source/polygon/b2dsvgpolypolygon.cxx
index bbb6db4c064a..d2815337edaf 100644
--- a/basegfx/source/polygon/b2dsvgpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dsvgpolypolygon.cxx
@@ -65,10 +65,8 @@ namespace basegfx
}
}
- inline bool lcl_isOnNumberChar(const ::rtl::OUString& rStr, const sal_Int32 nPos, bool bSignAllowed = true)
+ inline bool lcl_isOnNumberChar(const sal_Unicode aChar, bool bSignAllowed = true)
{
- const sal_Unicode aChar(rStr[nPos]);
-
const bool bPredicate( (sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar)
|| (bSignAllowed && sal_Unicode('+') == aChar)
|| (bSignAllowed && sal_Unicode('-') == aChar) );
@@ -76,6 +74,12 @@ namespace basegfx
return bPredicate;
}
+ inline bool lcl_isOnNumberChar(const ::rtl::OUString& rStr, const sal_Int32 nPos, bool bSignAllowed = true)
+ {
+ return lcl_isOnNumberChar(rStr[nPos],
+ bSignAllowed);
+ }
+
bool lcl_getDoubleChar(double& o_fRetval,
sal_Int32& io_rPos,
const ::rtl::OUString& rStr,
@@ -231,16 +235,16 @@ namespace basegfx
lcl_skipSpacesAndCommas(io_rPos, rStr, nLen);
}
- void lcl_putNumberChar( ::rtl::OUString& rStr,
- double fValue )
+ void lcl_putNumberChar( ::rtl::OUStringBuffer& rStr,
+ double fValue )
{
- rStr += ::rtl::OUString::valueOf( fValue );
+ rStr.append( fValue );
}
- void lcl_putNumberCharWithSpace( ::rtl::OUString& rStr,
- double fValue,
- double fOldValue,
- bool bUseRelativeCoordinates )
+ void lcl_putNumberCharWithSpace( ::rtl::OUStringBuffer& rStr,
+ double fValue,
+ double fOldValue,
+ bool bUseRelativeCoordinates )
{
if( bUseRelativeCoordinates )
fValue -= fOldValue;
@@ -248,11 +252,10 @@ namespace basegfx
const sal_Int32 aLen( rStr.getLength() );
if(aLen)
{
- if( lcl_isOnNumberChar(rStr, aLen - 1, false) &&
+ if( lcl_isOnNumberChar(rStr.charAt(aLen - 1), false) &&
fValue >= 0.0 )
{
- rStr += ::rtl::OUString::valueOf(
- sal_Unicode(' ') );
+ rStr.append( sal_Unicode(' ') );
}
}
@@ -876,7 +879,7 @@ namespace basegfx
bool bDetectQuadraticBeziers)
{
const sal_uInt32 nCount(rPolyPolygon.count());
- ::rtl::OUString aResult;
+ ::rtl::OUStringBuffer aResult;
B2DPoint aCurrentSVGPosition(0.0, 0.0); // SVG assumes (0,0) as the initial current point
for(sal_uInt32 i(0); i < nCount; i++)
@@ -893,7 +896,7 @@ namespace basegfx
// handle polygon start point
B2DPoint aEdgeStart(aPolygon.getB2DPoint(0));
- aResult += ::rtl::OUString::valueOf(lcl_getCommand('M', 'm', bUseRelativeCoordinates));
+ aResult.append(lcl_getCommand('M', 'm', bUseRelativeCoordinates));
lcl_putNumberCharWithSpace(aResult, aEdgeStart.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
lcl_putNumberCharWithSpace(aResult, aEdgeStart.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
aLastSVGCommand = lcl_getCommand('L', 'l', bUseRelativeCoordinates);
@@ -954,7 +957,7 @@ namespace basegfx
if(aLastSVGCommand != aCommand)
{
- aResult += ::rtl::OUString::valueOf(aCommand);
+ aResult.append(aCommand);
aLastSVGCommand = aCommand;
}
@@ -969,7 +972,7 @@ namespace basegfx
if(aLastSVGCommand != aCommand)
{
- aResult += ::rtl::OUString::valueOf(aCommand);
+ aResult.append(aCommand);
aLastSVGCommand = aCommand;
}
@@ -990,7 +993,7 @@ namespace basegfx
if(aLastSVGCommand != aCommand)
{
- aResult += ::rtl::OUString::valueOf(aCommand);
+ aResult.append(aCommand);
aLastSVGCommand = aCommand;
}
@@ -1007,7 +1010,7 @@ namespace basegfx
if(aLastSVGCommand != aCommand)
{
- aResult += ::rtl::OUString::valueOf(aCommand);
+ aResult.append(aCommand);
aLastSVGCommand = aCommand;
}
@@ -1046,7 +1049,7 @@ namespace basegfx
if(aLastSVGCommand != aCommand)
{
- aResult += ::rtl::OUString::valueOf(aCommand);
+ aResult.append(aCommand);
aLastSVGCommand = aCommand;
}
@@ -1060,7 +1063,7 @@ namespace basegfx
if(aLastSVGCommand != aCommand)
{
- aResult += ::rtl::OUString::valueOf(aCommand);
+ aResult.append(aCommand);
aLastSVGCommand = aCommand;
}
@@ -1074,7 +1077,7 @@ namespace basegfx
if(aLastSVGCommand != aCommand)
{
- aResult += ::rtl::OUString::valueOf(aCommand);
+ aResult.append(aCommand);
aLastSVGCommand = aCommand;
}
@@ -1092,12 +1095,12 @@ namespace basegfx
// close path if closed poly (Z and z are equivalent here, but looks nicer when case is matched)
if(aPolygon.isClosed())
{
- aResult += ::rtl::OUString::valueOf(lcl_getCommand('Z', 'z', bUseRelativeCoordinates));
+ aResult.append(lcl_getCommand('Z', 'z', bUseRelativeCoordinates));
}
}
}
- return aResult;
+ return aResult.makeStringAndClear();
}
}
}
diff --git a/basegfx/source/range/b2dmultirange.cxx b/basegfx/source/range/b2dmultirange.cxx
deleted file mode 100644
index 3a47be3b7dc9..000000000000
--- a/basegfx/source/range/b2dmultirange.cxx
+++ /dev/null
@@ -1,279 +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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basegfx.hxx"
-#include <basegfx/range/b2drange.hxx>
-#include <basegfx/tuple/b2dtuple.hxx>
-#include <basegfx/polygon/b2dpolypolygon.hxx>
-#include <basegfx/range/b2dmultirange.hxx>
-#include <basegfx/polygon/b2dpolygontools.hxx>
-#include <basegfx/polygon/b2dpolypolygontools.hxx>
-#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
-#include <boost/bind.hpp>
-#include <boost/mem_fn.hpp>
-#include <algorithm>
-#include <vector>
-
-
-namespace basegfx
-{
- class ImplB2DMultiRange
- {
- public:
- ImplB2DMultiRange() :
- maBounds(),
- maRanges()
- {
- }
-
- explicit ImplB2DMultiRange( const B2DRange& rRange ) :
- maBounds(),
- maRanges( 1, rRange )
- {
- }
-
- bool isEmpty() const
- {
- // no ranges at all, or all ranges empty
- return maRanges.empty() ||
- ::std::count_if( maRanges.begin(),
- maRanges.end(),
- ::boost::mem_fn( &B2DRange::isEmpty ) )
- == static_cast<VectorOfRanges::difference_type>(maRanges.size());
- }
-
- void reset()
- {
- // swap in empty vector
- VectorOfRanges aTmp;
- maRanges.swap( aTmp );
-
- maBounds.reset();
- }
-
- template< typename ValueType > bool isInside( const ValueType& rValue ) const
- {
- if( !maBounds.isInside( rValue ) )
- return false;
-
- // cannot use ::boost::bind here, since isInside is overloaded.
- // It is currently not possible to resolve the overload
- // by considering one of the other template arguments.
- VectorOfRanges::const_iterator aCurr( maRanges.begin() );
- const VectorOfRanges::const_iterator aEnd ( maRanges.end() );
- while( aCurr != aEnd )
- if( aCurr->isInside( rValue ) )
- return true;
-
- return false;
- }
-
- bool overlaps( const B2DRange& rRange ) const
- {
- if( !maBounds.overlaps( rRange ) )
- return false;
-
- const VectorOfRanges::const_iterator aEnd( maRanges.end() );
- return ::std::find_if( maRanges.begin(),
- aEnd,
- ::boost::bind<bool>( ::boost::mem_fn( &B2DRange::overlaps ),
- _1,
- rRange ) ) != aEnd;
- }
-
- void addRange( const B2DRange& rRange )
- {
- maRanges.push_back( rRange );
- maBounds.expand( rRange );
- }
-
- B2DRange getBounds() const
- {
- return maBounds;
- }
-
- B2DPolyPolygon getPolyPolygon() const
- {
- B2DPolyPolygon aRes;
-
- // Make range vector unique ( have to avoid duplicate
- // rectangles. The polygon clipper will return an empty
- // result in this case).
- VectorOfRanges aUniqueRanges;
- aUniqueRanges.reserve( maRanges.size() );
-
- VectorOfRanges::const_iterator aCurr( maRanges.begin() );
- const VectorOfRanges::const_iterator aEnd ( maRanges.end() );
- while( aCurr != aEnd )
- {
- // TODO(F3): It's plain wasted resources to apply a
- // general clipping algorithm to the problem at
- // hand. Go for a dedicated, scan-line-based approach.
- VectorOfRanges::const_iterator aCurrScan( aCurr+1 );
- VectorOfRanges::const_iterator aFound( aEnd );
- while( aCurrScan != aEnd )
- {
- if( aCurrScan->equal( *aCurr ) ||
- aCurrScan->isInside( *aCurr ) )
- {
- // current probe is equal to aCurr, or
- // completely contains aCurr. Thus, stop
- // searching, because aCurr is definitely not
- // a member of the unique rect list
- aFound = aCurrScan;
- break;
- }
-
- ++aCurrScan;
- }
-
- if( aFound == aEnd )
- {
- // check whether aCurr is fully contained in one
- // of the already added rects. If yes, we can skip
- // it.
- bool bUnique( true );
- VectorOfRanges::const_iterator aCurrUnique( aUniqueRanges.begin() );
- VectorOfRanges::const_iterator aEndUnique ( aUniqueRanges.end() );
- while( aCurrUnique != aEndUnique )
- {
- if( aCurrUnique->isInside( *aCurr ) )
- {
- // fully contained, no need to add
- bUnique = false;
- break;
- }
-
- ++aCurrUnique;
- }
-
- if( bUnique )
- aUniqueRanges.push_back( *aCurr );
- }
-
- ++aCurr;
- }
-
- VectorOfRanges::const_iterator aCurrUnique( aUniqueRanges.begin() );
- const VectorOfRanges::const_iterator aEndUnique ( aUniqueRanges.end() );
- while( aCurrUnique != aEndUnique )
- {
- // simply merge all unique parts (OR)
- aRes.append( tools::createPolygonFromRect( *aCurrUnique++ ) );
- }
-
- // remove redundant intersections. Note: since all added
- // rectangles are positively oriented, this method cannot
- // generate any holes.
- aRes = basegfx::tools::solveCrossovers(aRes);
- aRes = basegfx::tools::stripNeutralPolygons(aRes);
- aRes = basegfx::tools::stripDispensablePolygons(aRes, false);
-
- return aRes;
- }
-
- private:
- typedef ::std::vector< B2DRange > VectorOfRanges;
-
- B2DRange maBounds;
- VectorOfRanges maRanges;
- };
-
-
- // ====================================================================
-
-
- B2DMultiRange::B2DMultiRange() :
- mpImpl()
- {
- }
-
- B2DMultiRange::B2DMultiRange( const B2DRange& rRange ) :
- mpImpl( ImplB2DMultiRange( rRange ) )
- {
- }
-
- B2DMultiRange::~B2DMultiRange()
- {
- // otherwise, ImplB2DMultiRange would be an incomplete type
- }
-
- B2DMultiRange::B2DMultiRange( const B2DMultiRange& rSrc ) :
- mpImpl( rSrc.mpImpl )
- {
- }
-
- B2DMultiRange& B2DMultiRange::operator=( const B2DMultiRange& rSrc )
- {
- mpImpl = rSrc.mpImpl;
- return *this;
- }
-
- bool B2DMultiRange::isEmpty() const
- {
- return mpImpl->isEmpty();
- }
-
- void B2DMultiRange::reset()
- {
- mpImpl->reset();
- }
-
- bool B2DMultiRange::isInside( const B2DTuple& rTuple ) const
- {
- return mpImpl->isInside( rTuple );
- }
-
- bool B2DMultiRange::isInside( const B2DRange& rRange ) const
- {
- return mpImpl->isInside( rRange );
- }
-
- bool B2DMultiRange::overlaps( const B2DRange& rRange ) const
- {
- return mpImpl->overlaps( rRange );
- }
-
- void B2DMultiRange::addRange( const B2DRange& rRange )
- {
- mpImpl->addRange( rRange );
- }
-
- B2DRange B2DMultiRange::getBounds() const
- {
- return mpImpl->getBounds();
- }
-
- B2DPolyPolygon B2DMultiRange::getPolyPolygon() const
- {
- return mpImpl->getPolyPolygon();
- }
-
-} // end of namespace basegfx
-
-// eof
diff --git a/basegfx/source/range/b2dpolyrange.cxx b/basegfx/source/range/b2dpolyrange.cxx
new file mode 100644
index 000000000000..e212e083ef55
--- /dev/null
+++ b/basegfx/source/range/b2dpolyrange.cxx
@@ -0,0 +1,423 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: b2dmultirange.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * 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_basegfx.hxx"
+#include <basegfx/range/b2dpolyrange.hxx>
+
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/range/b2drangeclipper.hxx>
+#include <basegfx/tuple/b2dtuple.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+#include <boost/bind.hpp>
+#include <boost/tuple/tuple.hpp>
+#include <algorithm>
+#include <vector>
+
+static basegfx::B2VectorOrientation flipOrientation(
+ basegfx::B2VectorOrientation eOrient)
+{
+ return eOrient == basegfx::ORIENTATION_POSITIVE ?
+ basegfx::ORIENTATION_NEGATIVE : basegfx::ORIENTATION_POSITIVE;
+}
+
+namespace basegfx
+{
+ class ImplB2DPolyRange
+ {
+ void updateBounds()
+ {
+ maBounds.reset();
+ std::for_each(maRanges.begin(),
+ maRanges.end(),
+ boost::bind(
+ (void (B2DRange::*)(const B2DRange&))(
+ &B2DRange::expand),
+ boost::ref(maBounds),
+ _1));
+ }
+
+ public:
+ ImplB2DPolyRange() :
+ maBounds(),
+ maRanges(),
+ maOrient()
+ {}
+
+ explicit ImplB2DPolyRange( const B2DPolyRange::ElementType& rElem ) :
+ maBounds( boost::get<0>(rElem) ),
+ maRanges( 1, boost::get<0>(rElem) ),
+ maOrient( 1, boost::get<1>(rElem) )
+ {}
+
+ explicit ImplB2DPolyRange( const B2DRange& rRange, B2VectorOrientation eOrient ) :
+ maBounds( rRange ),
+ maRanges( 1, rRange ),
+ maOrient( 1, eOrient )
+ {}
+
+ bool operator==(const ImplB2DPolyRange& rRHS) const
+ {
+ return maRanges == rRHS.maRanges && maOrient == rRHS.maOrient;
+ }
+
+ sal_uInt32 count() const
+ {
+ return maRanges.size();
+ }
+
+ B2DPolyRange::ElementType getElement(sal_uInt32 nIndex) const
+ {
+ return boost::make_tuple(maRanges[nIndex],
+ maOrient[nIndex]);
+ }
+
+ void setElement(sal_uInt32 nIndex, const B2DPolyRange::ElementType& rElement )
+ {
+ maRanges[nIndex] = boost::get<0>(rElement);
+ maOrient[nIndex] = boost::get<1>(rElement);
+ updateBounds();
+ }
+
+ void setElement(sal_uInt32 nIndex, const B2DRange& rRange, B2VectorOrientation eOrient )
+ {
+ maRanges[nIndex] = rRange;
+ maOrient[nIndex] = eOrient;
+ updateBounds();
+ }
+
+ void insertElement(sal_uInt32 nIndex, const B2DPolyRange::ElementType& rElement, sal_uInt32 nCount)
+ {
+ maRanges.insert(maRanges.begin()+nIndex, nCount, boost::get<0>(rElement));
+ maOrient.insert(maOrient.begin()+nIndex, nCount, boost::get<1>(rElement));
+ maBounds.expand(boost::get<0>(rElement));
+ }
+
+ void insertElement(sal_uInt32 nIndex, const B2DRange& rRange, B2VectorOrientation eOrient, sal_uInt32 nCount)
+ {
+ maRanges.insert(maRanges.begin()+nIndex, nCount, rRange);
+ maOrient.insert(maOrient.begin()+nIndex, nCount, eOrient);
+ maBounds.expand(rRange);
+ }
+
+ void appendElement(const B2DPolyRange::ElementType& rElement, sal_uInt32 nCount)
+ {
+ maRanges.insert(maRanges.end(), nCount, boost::get<0>(rElement));
+ maOrient.insert(maOrient.end(), nCount, boost::get<1>(rElement));
+ maBounds.expand(boost::get<0>(rElement));
+ }
+
+ void appendElement(const B2DRange& rRange, B2VectorOrientation eOrient, sal_uInt32 nCount)
+ {
+ maRanges.insert(maRanges.end(), nCount, rRange);
+ maOrient.insert(maOrient.end(), nCount, eOrient);
+ maBounds.expand(rRange);
+ }
+
+ void insertPolyRange(sal_uInt32 nIndex, const ImplB2DPolyRange& rPolyRange)
+ {
+ maRanges.insert(maRanges.begin()+nIndex, rPolyRange.maRanges.begin(), rPolyRange.maRanges.end());
+ maOrient.insert(maOrient.begin()+nIndex, rPolyRange.maOrient.begin(), rPolyRange.maOrient.end());
+ updateBounds();
+ }
+
+ void appendPolyRange(const ImplB2DPolyRange& rPolyRange)
+ {
+ maRanges.insert(maRanges.end(),
+ rPolyRange.maRanges.begin(),
+ rPolyRange.maRanges.end());
+ maOrient.insert(maOrient.end(),
+ rPolyRange.maOrient.begin(),
+ rPolyRange.maOrient.end());
+ updateBounds();
+ }
+
+ void remove(sal_uInt32 nIndex, sal_uInt32 nCount)
+ {
+ maRanges.erase(maRanges.begin()+nIndex,maRanges.begin()+nIndex+nCount);
+ maOrient.erase(maOrient.begin()+nIndex,maOrient.begin()+nIndex+nCount);
+ updateBounds();
+ }
+
+ void clear()
+ {
+ std::vector<B2DRange> aTmpRanges;
+ std::vector<B2VectorOrientation> aTmpOrient;
+
+ maRanges.swap(aTmpRanges);
+ maOrient.swap(aTmpOrient);
+
+ maBounds.reset();
+ }
+
+ void flip()
+ {
+ std::for_each(maOrient.begin(),
+ maOrient.end(),
+ boost::bind(
+ &flipOrientation,
+ _1));
+ }
+
+ B2DRange getBounds() const
+ {
+ return maBounds;
+ }
+
+ template< typename ValueType > bool isInside( const ValueType& rValue ) const
+ {
+ if( !maBounds.isInside( rValue ) )
+ return false;
+
+ // cannot use boost::bind here, since isInside is overloaded.
+ // It is currently not possible to resolve the overload
+ // by considering one of the other template arguments.
+ std::vector<B2DRange>::const_iterator aCurr( maRanges.begin() );
+ const std::vector<B2DRange>::const_iterator aEnd ( maRanges.end() );
+ while( aCurr != aEnd )
+ if( aCurr->isInside( rValue ) )
+ return true;
+
+ return false;
+ }
+
+ bool overlaps( const B2DRange& rRange ) const
+ {
+ if( !maBounds.overlaps( rRange ) )
+ return false;
+
+ const std::vector<B2DRange>::const_iterator aEnd( maRanges.end() );
+ return std::find_if( maRanges.begin(),
+ aEnd,
+ boost::bind<bool>( boost::mem_fn( &B2DRange::overlaps ),
+ _1,
+ boost::cref(rRange) ) ) != aEnd;
+ }
+
+ B2DPolyPolygon solveCrossovers() const
+ {
+ return tools::solveCrossovers(maRanges,maOrient);
+ }
+
+ const B2DRange* begin() const
+ {
+ if(maRanges.empty())
+ return 0;
+ else
+ return &maRanges.front();
+ }
+
+ const B2DRange* end() const
+ {
+ if(maRanges.empty())
+ return 0;
+ else
+ return (&maRanges.back())+1;
+ }
+
+ B2DRange* begin()
+ {
+ if(maRanges.empty())
+ return 0;
+ else
+ return &maRanges.front();
+ }
+
+ B2DRange* end()
+ {
+ if(maRanges.empty())
+ return 0;
+ else
+ return (&maRanges.back())+1;
+ }
+
+ private:
+ B2DRange maBounds;
+ std::vector<B2DRange> maRanges;
+ std::vector<B2VectorOrientation> maOrient;
+ };
+
+ B2DPolyRange::B2DPolyRange() :
+ mpImpl()
+ {}
+
+ B2DPolyRange::~B2DPolyRange()
+ {}
+
+ B2DPolyRange::B2DPolyRange( const ElementType& rElem ) :
+ mpImpl( ImplB2DPolyRange( rElem ) )
+ {}
+
+ B2DPolyRange::B2DPolyRange( const B2DRange& rRange, B2VectorOrientation eOrient ) :
+ mpImpl( ImplB2DPolyRange( rRange, eOrient ) )
+ {}
+
+ B2DPolyRange::B2DPolyRange( const B2DPolyRange& rRange ) :
+ mpImpl( rRange.mpImpl )
+ {}
+
+ B2DPolyRange& B2DPolyRange::operator=( const B2DPolyRange& rRange )
+ {
+ mpImpl = rRange.mpImpl;
+ return *this;
+ }
+
+ void B2DPolyRange::makeUnique()
+ {
+ mpImpl.make_unique();
+ }
+
+ bool B2DPolyRange::operator==(const B2DPolyRange& rRange) const
+ {
+ if(mpImpl.same_object(rRange.mpImpl))
+ return true;
+
+ return ((*mpImpl) == (*rRange.mpImpl));
+ }
+
+ bool B2DPolyRange::operator!=(const B2DPolyRange& rRange) const
+ {
+ return !(*this == rRange);
+ }
+
+ sal_uInt32 B2DPolyRange::count() const
+ {
+ return mpImpl->count();
+ }
+
+ B2DPolyRange::ElementType B2DPolyRange::getElement(sal_uInt32 nIndex) const
+ {
+ return mpImpl->getElement(nIndex);
+ }
+
+ void B2DPolyRange::setElement(sal_uInt32 nIndex, const ElementType& rElement )
+ {
+ mpImpl->setElement(nIndex, rElement);
+ }
+
+ void B2DPolyRange::setElement(sal_uInt32 nIndex, const B2DRange& rRange, B2VectorOrientation eOrient )
+ {
+ mpImpl->setElement(nIndex, rRange, eOrient );
+ }
+
+ void B2DPolyRange::insertElement(sal_uInt32 nIndex, const ElementType& rElement, sal_uInt32 nCount)
+ {
+ mpImpl->insertElement(nIndex, rElement, nCount );
+ }
+
+ void B2DPolyRange::insertElement(sal_uInt32 nIndex, const B2DRange& rRange, B2VectorOrientation eOrient, sal_uInt32 nCount)
+ {
+ mpImpl->insertElement(nIndex, rRange, eOrient, nCount );
+ }
+
+ void B2DPolyRange::appendElement(const ElementType& rElement, sal_uInt32 nCount)
+ {
+ mpImpl->appendElement(rElement, nCount);
+ }
+
+ void B2DPolyRange::appendElement(const B2DRange& rRange, B2VectorOrientation eOrient, sal_uInt32 nCount)
+ {
+ mpImpl->appendElement(rRange, eOrient, nCount );
+ }
+
+ void B2DPolyRange::insertPolyRange(sal_uInt32 nIndex, const B2DPolyRange& rRange)
+ {
+ mpImpl->insertPolyRange(nIndex, *rRange.mpImpl);
+ }
+
+ void B2DPolyRange::appendPolyRange(const B2DPolyRange& rRange)
+ {
+ mpImpl->appendPolyRange(*rRange.mpImpl);
+ }
+
+ void B2DPolyRange::remove(sal_uInt32 nIndex, sal_uInt32 nCount)
+ {
+ mpImpl->remove(nIndex, nCount);
+ }
+
+ void B2DPolyRange::clear()
+ {
+ mpImpl->clear();
+ }
+
+ void B2DPolyRange::flip()
+ {
+ mpImpl->flip();
+ }
+
+ B2DRange B2DPolyRange::getBounds() const
+ {
+ return mpImpl->getBounds();
+ }
+
+ bool B2DPolyRange::isInside( const B2DTuple& rTuple ) const
+ {
+ return mpImpl->isInside(rTuple);
+ }
+
+ bool B2DPolyRange::isInside( const B2DRange& rRange ) const
+ {
+ return mpImpl->isInside(rRange);
+ }
+
+ bool B2DPolyRange::overlaps( const B2DRange& rRange ) const
+ {
+ return mpImpl->overlaps(rRange);
+ }
+
+ B2DPolyPolygon B2DPolyRange::solveCrossovers() const
+ {
+ return mpImpl->solveCrossovers();
+ }
+
+ const B2DRange* B2DPolyRange::begin() const
+ {
+ return mpImpl->begin();
+ }
+
+ const B2DRange* B2DPolyRange::end() const
+ {
+ return mpImpl->end();
+ }
+
+ B2DRange* B2DPolyRange::begin()
+ {
+ return mpImpl->begin();
+ }
+
+ B2DRange* B2DPolyRange::end()
+ {
+ return mpImpl->end();
+ }
+
+} // end of namespace basegfx
+
+// eof
diff --git a/basegfx/source/range/b2drangeclipper.cxx b/basegfx/source/range/b2drangeclipper.cxx
new file mode 100644
index 000000000000..524479b4fde0
--- /dev/null
+++ b/basegfx/source/range/b2drangeclipper.cxx
@@ -0,0 +1,950 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: b2dmultirange.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * 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_basegfx.hxx"
+
+#include <rtl/math.hxx>
+
+#include <basegfx/tuple/b2dtuple.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/range/b2dpolyrange.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+
+#include <o3tl/vector_pool.hxx>
+#include <boost/bind.hpp>
+#include <boost/utility.hpp>
+
+#include <algorithm>
+#include <deque>
+#include <list>
+
+
+namespace basegfx
+{
+ namespace
+ {
+ // Generating a poly-polygon from a bunch of rectangles
+ //
+ // Helper functionality for sweep-line algorithm
+ // ====================================================
+
+ typedef std::vector<B2DRange> VectorOfRanges;
+
+ class ImplPolygon;
+ typedef o3tl::vector_pool<ImplPolygon> VectorOfPolygons;
+
+
+ /** This class represents an active edge
+
+ As the sweep line traverses across the overall area,
+ rectangle edges parallel to it generate events, and
+ rectangle edges orthogonal to it generate active
+ edges. This class represents the latter.
+ */
+ class ActiveEdge
+ {
+ public:
+ /** The two possible active rectangle edges differ by one
+ coordinate value - the upper edge has the lower, the
+ lower edge the higher value.
+ */
+ enum EdgeType {
+ /// edge with lower coordinate value
+ UPPER=0,
+ /// edge with higher coordinate value
+ LOWER=1
+ };
+
+ enum EdgeDirection {
+ /// edge proceeds to the left
+ PROCEED_LEFT=0,
+ /// edge proceeds to the right
+ PROCEED_RIGHT=1
+ };
+
+ /** Create active edge
+
+ @param rRect
+ Rectangle this edge is part of
+
+ @param fInvariantCoord
+ The invariant ccordinate value of this edge
+
+ @param eEdgeType
+ Is fInvariantCoord the lower or the higher value, for
+ this rect?
+ */
+ ActiveEdge( const B2DRectangle& rRect,
+ const double& fInvariantCoord,
+ std::ptrdiff_t nPolyIdx,
+ EdgeType eEdgeType,
+ EdgeDirection eEdgeDirection ) :
+ mfInvariantCoord(fInvariantCoord),
+ mpAssociatedRect( &rRect ),
+ mnPolygonIdx( nPolyIdx ),
+ meEdgeType( eEdgeType ),
+ meEdgeDirection( eEdgeDirection )
+ {}
+
+ double getInvariantCoord() const { return mfInvariantCoord; }
+ const B2DRectangle& getRect() const { return *mpAssociatedRect; }
+ std::ptrdiff_t getTargetPolygonIndex() const { return mnPolygonIdx; }
+ void setTargetPolygonIndex( std::ptrdiff_t nIdx ) { mnPolygonIdx = nIdx; }
+ EdgeType getEdgeType() const { return meEdgeType; }
+ EdgeDirection getEdgeDirection() const { return meEdgeDirection; }
+
+ /// For STL sort
+ bool operator<( const ActiveEdge& rRHS ) const { return mfInvariantCoord < rRHS.mfInvariantCoord; }
+
+ private:
+ /** The invariant coordinate value of this edge (e.g. the
+ common y value, for a horizontal edge)
+ */
+ double mfInvariantCoord;
+
+ /** Associated rectangle
+
+ This on the one hand saves some storage space (the
+ vector of rectangles is persistent, anyway), and on
+ the other hand provides an identifier to match active
+ edges and x events (see below)
+
+ Ptr because class needs to be assignable
+ */
+ const B2DRectangle* mpAssociatedRect;
+
+ /** Index of the polygon this edge is currently involved
+ with.
+
+ Note that this can change for some kinds of edge
+ intersection, as the algorithm tends to swap
+ associated polygons there.
+
+ -1 denotes no assigned polygon
+ */
+ std::ptrdiff_t mnPolygonIdx;
+
+ /// 'upper' or 'lower' edge of original rectangle.
+ EdgeType meEdgeType;
+
+ /// 'left' or 'right'
+ EdgeDirection meEdgeDirection;
+ };
+
+ // Needs to be list - various places hold ptrs to elements
+ typedef std::list< ActiveEdge > ListOfEdges;
+
+
+ /** Element of the sweep line event list
+
+ As the sweep line traverses across the overall area,
+ rectangle edges parallel to it generate events, and
+ rectangle edges orthogonal to it generate active
+ edges. This class represents the former.
+
+ The class defines an element of the sweep line list. The
+ sweep line's position jumps in steps defined by the
+ coordinates of the sorted SweepLineEvent entries.
+ */
+ class SweepLineEvent
+ {
+ public:
+ /** The two possible sweep line rectangle edges differ by
+ one coordinate value - the starting edge has the
+ lower, the finishing edge the higher value.
+ */
+ enum EdgeType {
+ /// edge with lower coordinate value
+ STARTING_EDGE=0,
+ /// edge with higher coordinate value
+ FINISHING_EDGE=1
+ };
+
+ /** The two possible sweep line directions
+ */
+ enum EdgeDirection {
+ PROCEED_UP=0,
+ PROCEED_DOWN=1
+ };
+
+ /** Create sweep line event
+
+ @param fPos
+ Coordinate position of the event
+
+ @param rRect
+ Rectangle this event is generated for.
+
+ @param eEdgeType
+ Is fPos the lower or the higher value, for the
+ rectangle this event is generated for?
+ */
+ SweepLineEvent( double fPos,
+ const B2DRectangle& rRect,
+ EdgeType eEdgeType,
+ EdgeDirection eDirection) :
+ mfPos( fPos ),
+ mpAssociatedRect( &rRect ),
+ meEdgeType( eEdgeType ),
+ meEdgeDirection( eDirection )
+ {}
+
+ double getPos() const { return mfPos; }
+ const B2DRectangle& getRect() const { return *mpAssociatedRect; }
+ EdgeType getEdgeType() const { return meEdgeType; }
+ EdgeDirection getEdgeDirection() const { return meEdgeDirection; }
+
+ /// For STL sort
+ bool operator<( const SweepLineEvent& rRHS ) const { return mfPos < rRHS.mfPos; }
+
+ private:
+ /// position of the event, in the direction of the line sweep
+ double mfPos;
+
+ /** Rectangle this event is generated for
+
+ This on the one hand saves some storage space (the
+ vector of rectangles is persistent, anyway), and on
+ the other hand provides an identifier to match active
+ edges and events (see below)
+
+ Ptr because class needs to be assignable
+ */
+ const B2DRectangle* mpAssociatedRect;
+
+ /// 'upper' or 'lower' edge of original rectangle.
+ EdgeType meEdgeType;
+
+ /// 'up' or 'down'
+ EdgeDirection meEdgeDirection;
+ };
+
+ typedef std::vector< SweepLineEvent > VectorOfEvents;
+
+
+ /** Smart point container for B2DMultiRange::getPolyPolygon()
+
+ This class provides methods needed only here, and is used
+ as a place to store some additional information per
+ polygon. Also, most of the intersection logic is
+ implemented here.
+ */
+ class ImplPolygon
+ {
+ public:
+ /** Create polygon
+ */
+ ImplPolygon() :
+ mpLeadingRightEdge(NULL),
+ mnIdx(-1),
+ maPoints(),
+ mbIsFinished(false)
+ {
+ // completely ad-hoc. but what the hell.
+ maPoints.reserve(11);
+ }
+
+ void setPolygonPoolIndex( std::ptrdiff_t nIdx ) { mnIdx = nIdx; }
+ bool isFinished() const { return mbIsFinished; }
+
+ /// Add point to the end of the existing points
+ void append( const B2DPoint& rPoint )
+ {
+ OSL_PRECOND( maPoints.empty() ||
+ maPoints.back().getX() == rPoint.getX() ||
+ maPoints.back().getY() == rPoint.getY(),
+ "ImplPolygon::append(): added point violates 90 degree line angle constraint!" );
+
+ if( maPoints.empty() ||
+ maPoints.back() != rPoint )
+ {
+ // avoid duplicate points
+ maPoints.push_back( rPoint );
+ }
+ }
+
+ /** Perform the intersection of this polygon with an
+ active edge.
+
+ @param rEvent
+ The vertical line event that generated the
+ intersection
+
+ @param rActiveEdge
+ The active edge that generated the intersection
+
+ @param rPolygonPool
+ Polygon pool, we sometimes need to allocate a new one
+
+ @param bIsFinishingEdge
+ True, when this is hitting the last edge of the
+ vertical sweep - every vertical sweep starts and ends
+ with upper and lower edge of the _same_ rectangle.
+
+ @return the new current polygon (that's the one
+ processing must proceed with, when going through the
+ list of upcoming active edges).
+ */
+ std::ptrdiff_t intersect( SweepLineEvent& rEvent,
+ ActiveEdge& rActiveEdge,
+ VectorOfPolygons& rPolygonPool,
+ B2DPolyPolygon& rRes,
+ bool isFinishingEdge )
+ {
+ OSL_PRECOND( !isFinished(),
+ "ImplPolygon::intersect(): called on already finished polygon!" );
+ OSL_PRECOND( !isFinishingEdge
+ || (isFinishingEdge && &rEvent.getRect() == &rActiveEdge.getRect()),
+ "ImplPolygon::intersect(): inconsistent ending!" );
+
+ const B2DPoint aIntersectionPoint( rEvent.getPos(),
+ rActiveEdge.getInvariantCoord() );
+
+ // intersection point, goes to our polygon
+ // unconditionally
+ append(aIntersectionPoint);
+
+ const bool isSweepLineEnteringRect(
+ rEvent.getEdgeType() == SweepLineEvent::STARTING_EDGE);
+ if( isFinishingEdge )
+ {
+ if( isSweepLineEnteringRect )
+ handleFinalOwnRightEdge(rActiveEdge);
+ else
+ handleFinalOwnLeftEdge(rActiveEdge,
+ rPolygonPool,
+ rRes);
+
+ // we're done with this rect & sweep line
+ return -1;
+ }
+ else if( metOwnEdge(rEvent,rActiveEdge) )
+ {
+ handleInitialOwnEdge(rEvent, rActiveEdge);
+
+ // point already added, all init done, continue
+ // with same poly
+ return mnIdx;
+ }
+ else
+ {
+ OSL_ENSURE( rActiveEdge.getTargetPolygonIndex() != -1,
+ "ImplPolygon::intersect(): non-trivial intersection hit empty polygon!" );
+
+ const bool isHittingLeftEdge(
+ rActiveEdge.getEdgeDirection() == ActiveEdge::PROCEED_LEFT);
+
+ if( isHittingLeftEdge )
+ return handleComplexLeftEdge(rActiveEdge,
+ aIntersectionPoint,
+ rPolygonPool,
+ rRes);
+ else
+ return handleComplexRightEdge(rActiveEdge,
+ aIntersectionPoint,
+ rPolygonPool);
+ }
+ }
+
+ private:
+ std::ptrdiff_t getPolygonPoolIndex() const { return mnIdx; }
+
+ void handleInitialOwnEdge(SweepLineEvent& rEvent,
+ ActiveEdge& rActiveEdge)
+ {
+ const bool isActiveEdgeProceedLeft(
+ rActiveEdge.getEdgeDirection() == ActiveEdge::PROCEED_LEFT);
+ const bool isSweepLineEnteringRect(
+ rEvent.getEdgeType() == SweepLineEvent::STARTING_EDGE);
+ (void)isActiveEdgeProceedLeft;
+ (void)isSweepLineEnteringRect;
+
+ OSL_ENSURE( isSweepLineEnteringRect == isActiveEdgeProceedLeft,
+ "ImplPolygon::intersect(): sweep initial own edge hit: wrong polygon order" );
+
+ OSL_ENSURE( isSweepLineEnteringRect ||
+ mpLeadingRightEdge == &rActiveEdge,
+ "ImplPolygon::intersect(): sweep initial own edge hit: wrong leading edge" );
+ }
+
+ void handleFinalOwnRightEdge(ActiveEdge& rActiveEdge)
+ {
+ OSL_ENSURE( rActiveEdge.getEdgeDirection() == ActiveEdge::PROCEED_RIGHT,
+ "ImplPolygon::handleInitialOwnRightEdge(): start edge wrong polygon order" );
+
+ rActiveEdge.setTargetPolygonIndex(mnIdx);
+ mpLeadingRightEdge = &rActiveEdge;
+ }
+
+ void handleFinalOwnLeftEdge(ActiveEdge& rActiveEdge,
+ VectorOfPolygons& rPolygonPool,
+ B2DPolyPolygon& rRes)
+ {
+ OSL_ENSURE( rActiveEdge.getEdgeDirection() == ActiveEdge::PROCEED_LEFT,
+ "ImplPolygon::handleFinalOwnLeftEdge(): end edge wrong polygon order" );
+
+ const bool isHittingOurTail(
+ rActiveEdge.getTargetPolygonIndex() == mnIdx);
+
+ if( isHittingOurTail )
+ finish(rRes); // just finish. no fuss.
+ else
+ {
+ // temp poly hits final left edge
+ const std::ptrdiff_t nTmpIdx=rActiveEdge.getTargetPolygonIndex();
+ ImplPolygon& rTmp=rPolygonPool.get(nTmpIdx);
+
+ // active edge's polygon has points
+ // already. ours need to go in front of them.
+ maPoints.insert(maPoints.end(),
+ rTmp.maPoints.begin(),
+ rTmp.maPoints.end());
+
+ // adjust leading edges, we're switching the polygon
+ ActiveEdge* const pFarEdge=rTmp.mpLeadingRightEdge;
+
+ mpLeadingRightEdge = pFarEdge;
+ pFarEdge->setTargetPolygonIndex(mnIdx);
+
+ // nTmpIdx is an empty shell, get rid of it
+ rPolygonPool.free(nTmpIdx);
+ }
+ }
+
+ std::ptrdiff_t handleComplexLeftEdge(ActiveEdge& rActiveEdge,
+ const B2DPoint& rIntersectionPoint,
+ VectorOfPolygons& rPolygonPool,
+ B2DPolyPolygon& rRes)
+ {
+ const bool isHittingOurTail(
+ rActiveEdge.getTargetPolygonIndex() == mnIdx);
+ if( isHittingOurTail )
+ {
+ finish(rRes);
+
+ // so "this" is done - need new polygon to collect
+ // further points
+ const std::ptrdiff_t nIdxNewPolygon=rPolygonPool.alloc();
+ rPolygonPool.get(nIdxNewPolygon).setPolygonPoolIndex(nIdxNewPolygon);
+ rPolygonPool.get(nIdxNewPolygon).append(rIntersectionPoint);
+
+ rActiveEdge.setTargetPolygonIndex(nIdxNewPolygon);
+
+ return nIdxNewPolygon;
+ }
+ else
+ {
+ const std::ptrdiff_t nTmpIdx=rActiveEdge.getTargetPolygonIndex();
+ ImplPolygon& rTmp=rPolygonPool.get(nTmpIdx);
+
+ // active edge's polygon has points
+ // already. ours need to go in front of them.
+ maPoints.insert(maPoints.end(),
+ rTmp.maPoints.begin(),
+ rTmp.maPoints.end());
+
+ rTmp.maPoints.clear();
+ rTmp.append(rIntersectionPoint);
+
+ // adjust leading edges, we're switching the polygon
+ ActiveEdge* const pFarEdge=rTmp.mpLeadingRightEdge;
+ ActiveEdge* const pNearEdge=&rActiveEdge;
+
+ rTmp.mpLeadingRightEdge = NULL;
+ pNearEdge->setTargetPolygonIndex(nTmpIdx);
+
+ mpLeadingRightEdge = pFarEdge;
+ pFarEdge->setTargetPolygonIndex(mnIdx);
+
+ return nTmpIdx;
+ }
+ }
+
+ std::ptrdiff_t handleComplexRightEdge(ActiveEdge& rActiveEdge,
+ const B2DPoint& rIntersectionPoint,
+ VectorOfPolygons& rPolygonPool)
+ {
+ const std::ptrdiff_t nTmpIdx=rActiveEdge.getTargetPolygonIndex();
+ ImplPolygon& rTmp=rPolygonPool.get(nTmpIdx);
+
+ rTmp.append(rIntersectionPoint);
+
+ rActiveEdge.setTargetPolygonIndex(mnIdx);
+ mpLeadingRightEdge = &rActiveEdge;
+
+ rTmp.mpLeadingRightEdge = NULL;
+
+ return nTmpIdx;
+ }
+
+ /// True when sweep line hits our own active edge
+ bool metOwnEdge(const SweepLineEvent& rEvent,
+ ActiveEdge& rActiveEdge)
+ {
+ const bool bHitOwnEdge=&rEvent.getRect() == &rActiveEdge.getRect();
+ return bHitOwnEdge;
+ }
+
+ /// Retrieve B2DPolygon from this object
+ B2DPolygon getPolygon() const
+ {
+ B2DPolygon aRes;
+ std::for_each( maPoints.begin(),
+ maPoints.end(),
+ boost::bind(
+ &B2DPolygon::append,
+ boost::ref(aRes),
+ _1,
+ 1 ) );
+ aRes.setClosed( true );
+ return aRes;
+ }
+
+ /** Finish this polygon, push to result set.
+ */
+ void finish(B2DPolyPolygon& rRes)
+ {
+ OSL_PRECOND( maPoints.empty() ||
+ maPoints.front().getX() == maPoints.back().getX() ||
+ maPoints.front().getY() == maPoints.back().getY(),
+ "ImplPolygon::finish(): first and last point violate 90 degree line angle constraint!" );
+
+ mbIsFinished = true;
+ mpLeadingRightEdge = NULL;
+
+ rRes.append(getPolygon());
+ }
+
+ /** Refers to the current leading edge element of this
+ polygon, or NULL. The leading edge denotes the 'front'
+ of the polygon vertex sequence, i.e. the coordinates
+ at the polygon's leading edge are returned from
+ maPoints.front()
+ */
+ ActiveEdge* mpLeadingRightEdge;
+
+ /// current index into vector pool
+ std::ptrdiff_t mnIdx;
+
+ /// Container for the actual polygon points
+ std::vector<B2DPoint> maPoints;
+
+ /// When true, this polygon is 'done', i.e. nothing must be added anymore.
+ bool mbIsFinished;
+ };
+
+ /** Init sweep line event list
+
+ This method fills the event list with the sweep line
+ events generated from the input rectangles, and sorts them
+ with increasing x.
+ */
+ void setupSweepLineEventListFromRanges( VectorOfEvents& o_rEventVector,
+ const std::vector<B2DRange>& rRanges,
+ const std::vector<B2VectorOrientation>& rOrientations )
+ {
+ // we need exactly 2*rectVec.size() events: one for the
+ // left, and one for the right edge of each rectangle
+ o_rEventVector.clear();
+ o_rEventVector.reserve( 2*rRanges.size() );
+
+ // generate events
+ // ===============
+
+ // first pass: add all left edges in increasing order
+ std::vector<B2DRange>::const_iterator aCurrRect=rRanges.begin();
+ std::vector<B2VectorOrientation>::const_iterator aCurrOrientation=rOrientations.begin();
+ const std::vector<B2DRange>::const_iterator aEnd=rRanges.end();
+ const std::vector<B2VectorOrientation>::const_iterator aEndOrientation=rOrientations.end();
+ while( aCurrRect != aEnd && aCurrOrientation != aEndOrientation )
+ {
+ const B2DRectangle& rCurrRect( *aCurrRect++ );
+
+ o_rEventVector.push_back(
+ SweepLineEvent( rCurrRect.getMinX(),
+ rCurrRect,
+ SweepLineEvent::STARTING_EDGE,
+ (*aCurrOrientation++) == ORIENTATION_POSITIVE ?
+ SweepLineEvent::PROCEED_UP : SweepLineEvent::PROCEED_DOWN) );
+ }
+
+ // second pass: add all right edges in reversed order
+ std::vector<B2DRange>::const_reverse_iterator aCurrRectR=rRanges.rbegin();
+ std::vector<B2VectorOrientation>::const_reverse_iterator aCurrOrientationR=rOrientations.rbegin();
+ const std::vector<B2DRange>::const_reverse_iterator aEndR=rRanges.rend();
+ const std::vector<B2VectorOrientation>::const_reverse_iterator aEndOrientationR=rOrientations.rend();
+ while( aCurrRectR != aEndR )
+ {
+ const B2DRectangle& rCurrRect( *aCurrRectR++ );
+
+ o_rEventVector.push_back(
+ SweepLineEvent( rCurrRect.getMaxX(),
+ rCurrRect,
+ SweepLineEvent::FINISHING_EDGE,
+ (*aCurrOrientationR++) == ORIENTATION_POSITIVE ?
+ SweepLineEvent::PROCEED_DOWN : SweepLineEvent::PROCEED_UP ) );
+ }
+
+ // sort events
+ // ===========
+
+ // since we use stable_sort, the order of events with the
+ // same x value will not change. The elaborate two-pass
+ // add above thus ensures, that for each two rectangles
+ // with similar left and right x coordinates, the
+ // rectangle whose left event comes first will have its
+ // right event come last. This is advantageous for the
+ // clip algorithm below, see handleRightEdgeCrossing().
+
+ // TODO(P3): Use radix sort (from
+ // b2dpolypolygonrasterconverter, or have your own
+ // templatized version).
+ std::stable_sort( o_rEventVector.begin(),
+ o_rEventVector.end() );
+ }
+
+ /** Insert two active edge segments for the given rectangle.
+
+ This method creates two active edge segments from the
+ given rect, and inserts them into the active edge list,
+ such that this stays sorted (if it was before).
+
+ @param io_rEdgeList
+ Active edge list to insert into
+
+ @param io_rPolygons
+ Vector of polygons. Each rectangle added creates one
+ tentative result polygon in this vector, and the edge list
+ entries holds a reference to that polygon (this _requires_
+ that the polygon vector does not reallocate, i.e. it must
+ have at least the maximal number of rectangles reserved)
+
+ @param o_CurrentPolygon
+ The then-current polygon when processing this sweep line
+ event
+
+ @param rCurrEvent
+ The actual event that caused this call
+ */
+ void createActiveEdgesFromStartEvent( ListOfEdges& io_rEdgeList,
+ VectorOfPolygons& io_rPolygonPool,
+ SweepLineEvent& rCurrEvent )
+ {
+ ListOfEdges aNewEdges;
+ const B2DRectangle& rRect=rCurrEvent.getRect();
+ const bool bGoesDown=rCurrEvent.getEdgeDirection() == SweepLineEvent::PROCEED_DOWN;
+
+ // start event - new rect starts here, needs polygon to
+ // collect points into
+ const std::ptrdiff_t nIdxPolygon=io_rPolygonPool.alloc();
+ io_rPolygonPool.get(nIdxPolygon).setPolygonPoolIndex(nIdxPolygon);
+
+ // upper edge
+ aNewEdges.push_back(
+ ActiveEdge(
+ rRect,
+ rRect.getMinY(),
+ bGoesDown ? nIdxPolygon : -1,
+ ActiveEdge::UPPER,
+ bGoesDown ? ActiveEdge::PROCEED_LEFT : ActiveEdge::PROCEED_RIGHT) );
+ // lower edge
+ aNewEdges.push_back(
+ ActiveEdge(
+ rRect,
+ rRect.getMaxY(),
+ bGoesDown ? -1 : nIdxPolygon,
+ ActiveEdge::LOWER,
+ bGoesDown ? ActiveEdge::PROCEED_RIGHT : ActiveEdge::PROCEED_LEFT ) );
+
+ // furthermore, have to respect a special tie-breaking
+ // rule here, for edges which share the same y value:
+ // newly added upper edges must be inserted _before_ any
+ // other edge with the same y value, and newly added lower
+ // edges must be _after_ all other edges with the same
+ // y. This ensures that the left vertical edge processing
+ // below encounters the upper edge of the current rect
+ // first, and the lower edge last, which automatically
+ // starts and finishes this rect correctly (as only then,
+ // the polygon will have their associated active edges
+ // set).
+ const double nMinY( rRect.getMinY() );
+ const double nMaxY( rRect.getMaxY() );
+ ListOfEdges::iterator aCurr( io_rEdgeList.begin() );
+ const ListOfEdges::iterator aEnd ( io_rEdgeList.end() );
+ while( aCurr != aEnd )
+ {
+ const double nCurrY( aCurr->getInvariantCoord() );
+
+ if( nCurrY >= nMinY &&
+ aNewEdges.size() == 2 ) // only add, if not yet done.
+ {
+ // insert upper edge _before_ aCurr. Thus, it will
+ // be the first entry for a range of equal y
+ // values. Using splice here, since we hold
+ // references to the moved list element!
+ io_rEdgeList.splice( aCurr,
+ aNewEdges,
+ aNewEdges.begin() );
+ }
+
+ if( nCurrY > nMaxY )
+ {
+ // insert lower edge _before_ aCurr. Thus, it will
+ // be the last entry for a range of equal y values
+ // (aCurr is the first entry strictly larger than
+ // nMaxY). Using splice here, since we hold
+ // references to the moved list element!
+ io_rEdgeList.splice( aCurr,
+ aNewEdges,
+ aNewEdges.begin() );
+ // done with insertion, can early-exit here.
+ return;
+ }
+
+ ++aCurr;
+ }
+
+ // append remainder of aNewList (might still contain 2 or
+ // 1 elements, depending of the contents of io_rEdgeList).
+ io_rEdgeList.splice( aCurr,
+ aNewEdges );
+ }
+
+ inline bool isSameRect(ActiveEdge& rEdge,
+ const basegfx::B2DRange& rRect)
+ {
+ return &rEdge.getRect() == &rRect;
+ }
+
+ // wow what a hack. necessary because stl's list::erase does
+ // not eat reverse_iterator
+ template<typename Cont, typename Iter> Iter eraseFromList(Cont&, Iter);
+ template<> inline ListOfEdges::iterator eraseFromList(
+ ListOfEdges& rList, ListOfEdges::iterator aIter)
+ {
+ return rList.erase(aIter);
+ }
+ template<> inline ListOfEdges::reverse_iterator eraseFromList(
+ ListOfEdges& rList, ListOfEdges::reverse_iterator aIter)
+ {
+ return ListOfEdges::reverse_iterator(
+ rList.erase(boost::prior(aIter.base())));
+ }
+
+ template<int bPerformErase,
+ typename Iterator> inline void processActiveEdges(
+ Iterator first,
+ Iterator last,
+ ListOfEdges& rActiveEdgeList,
+ SweepLineEvent& rCurrEvent,
+ VectorOfPolygons& rPolygonPool,
+ B2DPolyPolygon& rRes )
+ {
+ const basegfx::B2DRange& rCurrRect=rCurrEvent.getRect();
+
+ // fast-forward to rCurrEvent's first active edge (holds
+ // for both starting and finishing sweep line events, a
+ // rect is regarded _outside_ any rects whose events have
+ // started earlier
+ first = std::find_if(first, last,
+ boost::bind(
+ &isSameRect,
+ _1,
+ boost::cref(rCurrRect)));
+
+ if(first == last)
+ return;
+
+ int nCount=0;
+ std::ptrdiff_t nCurrPolyIdx=-1;
+ while(first != last)
+ {
+ if( nCurrPolyIdx == -1 )
+ nCurrPolyIdx=first->getTargetPolygonIndex();
+
+ OSL_ASSERT(nCurrPolyIdx != -1);
+
+ // second encounter of my rect -> second edge
+ // encountered, done
+ const bool bExit=
+ nCount &&
+ isSameRect(*first,
+ rCurrRect);
+
+ // deal with current active edge
+ nCurrPolyIdx =
+ rPolygonPool.get(nCurrPolyIdx).intersect(
+ rCurrEvent,
+ *first,
+ rPolygonPool,
+ rRes,
+ bExit);
+
+ // prune upper & lower active edges, if requested
+ if( bPerformErase && (bExit || !nCount) )
+ first = eraseFromList(rActiveEdgeList,first);
+ else
+ ++first;
+
+ // delayed exit, had to prune first
+ if( bExit )
+ return;
+
+ ++nCount;
+ }
+ }
+
+ template<int bPerformErase> inline void processActiveEdgesTopDown(
+ SweepLineEvent& rCurrEvent,
+ ListOfEdges& rActiveEdgeList,
+ VectorOfPolygons& rPolygonPool,
+ B2DPolyPolygon& rRes )
+ {
+ processActiveEdges<bPerformErase>(
+ rActiveEdgeList. begin(),
+ rActiveEdgeList. end(),
+ rActiveEdgeList,
+ rCurrEvent,
+ rPolygonPool,
+ rRes);
+ }
+
+ template<int bPerformErase> inline void processActiveEdgesBottomUp(
+ SweepLineEvent& rCurrEvent,
+ ListOfEdges& rActiveEdgeList,
+ VectorOfPolygons& rPolygonPool,
+ B2DPolyPolygon& rRes )
+ {
+ processActiveEdges<bPerformErase>(
+ rActiveEdgeList. rbegin(),
+ rActiveEdgeList. rend(),
+ rActiveEdgeList,
+ rCurrEvent,
+ rPolygonPool,
+ rRes);
+ }
+
+ enum{ NoErase=0, PerformErase=1 };
+
+ void handleStartingEdge( SweepLineEvent& rCurrEvent,
+ ListOfEdges& rActiveEdgeList,
+ VectorOfPolygons& rPolygonPool,
+ B2DPolyPolygon& rRes)
+ {
+ // inject two new active edges for rect
+ createActiveEdgesFromStartEvent( rActiveEdgeList,
+ rPolygonPool,
+ rCurrEvent );
+
+ if( SweepLineEvent::PROCEED_DOWN == rCurrEvent.getEdgeDirection() )
+ processActiveEdgesTopDown<NoErase>(
+ rCurrEvent, rActiveEdgeList, rPolygonPool, rRes);
+ else
+ processActiveEdgesBottomUp<NoErase>(
+ rCurrEvent, rActiveEdgeList, rPolygonPool, rRes);
+ }
+
+ void handleFinishingEdge( SweepLineEvent& rCurrEvent,
+ ListOfEdges& rActiveEdgeList,
+ VectorOfPolygons& rPolygonPool,
+ B2DPolyPolygon& rRes)
+ {
+ if( SweepLineEvent::PROCEED_DOWN == rCurrEvent.getEdgeDirection() )
+ processActiveEdgesTopDown<PerformErase>(
+ rCurrEvent, rActiveEdgeList, rPolygonPool, rRes);
+ else
+ processActiveEdgesBottomUp<PerformErase>(
+ rCurrEvent, rActiveEdgeList, rPolygonPool, rRes);
+ }
+
+ inline void handleSweepLineEvent( SweepLineEvent& rCurrEvent,
+ ListOfEdges& rActiveEdgeList,
+ VectorOfPolygons& rPolygonPool,
+ B2DPolyPolygon& rRes)
+ {
+ if( SweepLineEvent::STARTING_EDGE == rCurrEvent.getEdgeType() )
+ handleStartingEdge(rCurrEvent,rActiveEdgeList,rPolygonPool,rRes);
+ else
+ handleFinishingEdge(rCurrEvent,rActiveEdgeList,rPolygonPool,rRes);
+ }
+ }
+
+ namespace tools
+ {
+ B2DPolyPolygon solveCrossovers(const std::vector<B2DRange>& rRanges,
+ const std::vector<B2VectorOrientation>& rOrientations)
+ {
+ // sweep-line algorithm to generate a poly-polygon
+ // from a bunch of rectangles
+ // ===============================================
+ //
+ // This algorithm uses the well-known sweep line
+ // concept, explained in every good text book about
+ // computational geometry.
+ //
+ // We start with creating two structures for every
+ // rectangle, one representing the left x coordinate,
+ // one representing the right x coordinate (and both
+ // referencing the original rect). These structs are
+ // sorted with increasing x coordinates.
+ //
+ // Then, we start processing the resulting list from
+ // the beginning. Every entry in the list defines a
+ // point in time of the line sweeping from left to
+ // right across all rectangles.
+ VectorOfEvents aSweepLineEvents;
+ setupSweepLineEventListFromRanges( aSweepLineEvents,
+ rRanges,
+ rOrientations );
+
+ B2DPolyPolygon aRes;
+ VectorOfPolygons aPolygonPool;
+ ListOfEdges aActiveEdgeList;
+
+ // sometimes not enough, but a usable compromise
+ aPolygonPool.reserve( rRanges.size() );
+
+ std::for_each( aSweepLineEvents.begin(),
+ aSweepLineEvents.end(),
+ boost::bind(
+ &handleSweepLineEvent,
+ _1,
+ boost::ref(aActiveEdgeList),
+ boost::ref(aPolygonPool),
+ boost::ref(aRes)) );
+
+ return aRes;
+ }
+ }
+}
+
diff --git a/basegfx/source/range/makefile.mk b/basegfx/source/range/makefile.mk
index 04d8e8e66fa2..5e05eeda94d9 100644
--- a/basegfx/source/range/makefile.mk
+++ b/basegfx/source/range/makefile.mk
@@ -43,7 +43,8 @@ SLOFILES= \
$(SLO)$/b1drange.obj \
$(SLO)$/b2drange.obj \
$(SLO)$/b2xrange.obj \
- $(SLO)$/b2dmultirange.obj \
+ $(SLO)$/b2dpolyrange.obj \
+ $(SLO)$/b2drangeclipper.obj \
$(SLO)$/b3drange.obj
# --- Targets ----------------------------------
diff --git a/basegfx/source/tools/b2dclipstate.cxx b/basegfx/source/tools/b2dclipstate.cxx
new file mode 100644
index 000000000000..005dca1aa66a
--- /dev/null
+++ b/basegfx/source/tools/b2dclipstate.cxx
@@ -0,0 +1,662 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: b2dmultirange.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * 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_basegfx.hxx"
+#include <basegfx/tools/b2dclipstate.hxx>
+
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/range/b2dpolyrange.hxx>
+#include <basegfx/range/b2drangeclipper.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
+
+namespace basegfx
+{
+namespace tools
+{
+ struct ImplB2DClipState
+ {
+ public:
+ enum Operation {UNION, INTERSECT, XOR, SUBTRACT};
+
+ ImplB2DClipState() :
+ maPendingPolygons(),
+ maPendingRanges(),
+ maClipPoly(),
+ mePendingOps(UNION)
+ {}
+
+ explicit ImplB2DClipState( const B2DRange& rRange ) :
+ maPendingPolygons(),
+ maPendingRanges(),
+ maClipPoly(
+ tools::createPolygonFromRect(rRange)),
+ mePendingOps(UNION)
+ {}
+
+ explicit ImplB2DClipState( const B2DPolygon& rPoly ) :
+ maPendingPolygons(),
+ maPendingRanges(),
+ maClipPoly(rPoly),
+ mePendingOps(UNION)
+ {}
+
+ explicit ImplB2DClipState( const B2DPolyPolygon& rPoly ) :
+ maPendingPolygons(),
+ maPendingRanges(),
+ maClipPoly(rPoly),
+ mePendingOps(UNION)
+ {}
+
+ bool isCleared() const
+ {
+ return !maClipPoly.count()
+ && !maPendingPolygons.count()
+ && !maPendingRanges.count();
+ }
+
+ void makeClear()
+ {
+ maPendingPolygons.clear();
+ maPendingRanges.clear();
+ maClipPoly.clear();
+ mePendingOps = UNION;
+ }
+
+ bool isNullClipPoly() const
+ {
+ return maClipPoly.count() == 1
+ && !maClipPoly.getB2DPolygon(0).count();
+ }
+
+ bool isNull() const
+ {
+ return !maPendingPolygons.count()
+ && !maPendingRanges.count()
+ && isNullClipPoly();
+ }
+
+ void makeNull()
+ {
+ maPendingPolygons.clear();
+ maPendingRanges.clear();
+ maClipPoly.clear();
+ maClipPoly.append(B2DPolygon());
+ mePendingOps = UNION;
+ }
+
+ bool operator==(const ImplB2DClipState& rRHS) const
+ {
+ return maPendingPolygons == rRHS.maPendingPolygons
+ && maPendingRanges == rRHS.maPendingRanges
+ && maClipPoly == rRHS.maClipPoly
+ && mePendingOps == rRHS.mePendingOps;
+ }
+
+ void addRange(const B2DRange& rRange, Operation eOp)
+ {
+ if( rRange.isEmpty() )
+ return;
+
+ commitPendingPolygons();
+ if( mePendingOps != eOp )
+ commitPendingRanges();
+
+ mePendingOps = eOp;
+ maPendingRanges.appendElement(
+ rRange,
+ ORIENTATION_POSITIVE);
+ }
+
+ void addPolygon(B2DPolygon aPoly, Operation eOp)
+ {
+ commitPendingRanges();
+ if( mePendingOps != eOp )
+ commitPendingPolygons();
+
+ mePendingOps = eOp;
+ maPendingPolygons.append(aPoly);
+ }
+
+ void addPolyPolygon(B2DPolyPolygon aPoly, Operation eOp)
+ {
+ commitPendingRanges();
+ if( mePendingOps != eOp )
+ commitPendingPolygons();
+
+ mePendingOps = eOp;
+ maPendingPolygons.append(aPoly);
+ }
+
+ void addClipState(const ImplB2DClipState& rOther, Operation eOp)
+ {
+ if( rOther.mePendingOps == mePendingOps
+ && !rOther.maClipPoly.count()
+ && !rOther.maPendingPolygons.count() )
+ {
+ maPendingRanges.appendPolyRange( rOther.maPendingRanges );
+ }
+ else
+ {
+ commitPendingRanges();
+ commitPendingPolygons();
+ rOther.commitPendingRanges();
+ rOther.commitPendingPolygons();
+
+ maPendingPolygons = rOther.maClipPoly;
+ mePendingOps = eOp;
+ }
+ }
+
+ void unionRange(const B2DRange& rRange)
+ {
+ if( isCleared() )
+ return;
+
+ addRange(rRange,UNION);
+ }
+
+ void unionPolygon(const B2DPolygon& rPoly)
+ {
+ if( isCleared() )
+ return;
+
+ addPolygon(rPoly,UNION);
+ }
+
+ void unionPolyPolygon(const B2DPolyPolygon& rPolyPoly)
+ {
+ if( isCleared() )
+ return;
+
+ addPolyPolygon(rPolyPoly,UNION);
+ }
+
+ void unionClipState(const ImplB2DClipState& rOther)
+ {
+ if( isCleared() )
+ return;
+
+ addClipState(rOther, UNION);
+ }
+
+ void intersectRange(const B2DRange& rRange)
+ {
+ if( isNull() )
+ return;
+
+ addRange(rRange,INTERSECT);
+ }
+
+ void intersectPolygon(const B2DPolygon& rPoly)
+ {
+ if( isNull() )
+ return;
+
+ addPolygon(rPoly,INTERSECT);
+ }
+
+ void intersectPolyPolygon(const B2DPolyPolygon& rPolyPoly)
+ {
+ if( isNull() )
+ return;
+
+ addPolyPolygon(rPolyPoly,INTERSECT);
+ }
+
+ void intersectClipState(const ImplB2DClipState& rOther)
+ {
+ if( isNull() )
+ return;
+
+ addClipState(rOther, INTERSECT);
+ }
+
+ void subtractRange(const B2DRange& rRange )
+ {
+ if( isNull() )
+ return;
+
+ addRange(rRange,SUBTRACT);
+ }
+
+ void subtractPolygon(const B2DPolygon& rPoly)
+ {
+ if( isNull() )
+ return;
+
+ addPolygon(rPoly,SUBTRACT);
+ }
+
+ void subtractPolyPolygon(const B2DPolyPolygon& rPolyPoly)
+ {
+ if( isNull() )
+ return;
+
+ addPolyPolygon(rPolyPoly,SUBTRACT);
+ }
+
+ void subtractClipState(const ImplB2DClipState& rOther)
+ {
+ if( isNull() )
+ return;
+
+ addClipState(rOther, SUBTRACT);
+ }
+
+ void xorRange(const B2DRange& rRange)
+ {
+ addRange(rRange,XOR);
+ }
+
+ void xorPolygon(const B2DPolygon& rPoly)
+ {
+ addPolygon(rPoly,XOR);
+ }
+
+ void xorPolyPolygon(const B2DPolyPolygon& rPolyPoly)
+ {
+ addPolyPolygon(rPolyPoly,XOR);
+ }
+
+ void xorClipState(const ImplB2DClipState& rOther)
+ {
+ addClipState(rOther, XOR);
+ }
+
+ B2DPolyPolygon getClipPoly() const
+ {
+ commitPendingRanges();
+ commitPendingPolygons();
+
+ return maClipPoly;
+ }
+
+ private:
+ void commitPendingPolygons() const
+ {
+ if( !maPendingPolygons.count() )
+ return;
+
+ // assumption: maClipPoly has kept polygons prepared for
+ // clipping; i.e. no neutral polygons & correct
+ // orientation
+ maPendingPolygons = tools::prepareForPolygonOperation(maPendingPolygons);
+ const bool bIsEmpty=isNullClipPoly();
+ const bool bIsCleared=!maClipPoly.count();
+ switch(mePendingOps)
+ {
+ case UNION:
+ OSL_ASSERT( !bIsCleared );
+
+ if( bIsEmpty )
+ maClipPoly = maPendingPolygons;
+ else
+ maClipPoly = tools::solvePolygonOperationOr(
+ maClipPoly,
+ maPendingPolygons);
+ break;
+ case INTERSECT:
+ OSL_ASSERT( !bIsEmpty );
+
+ if( bIsCleared )
+ maClipPoly = maPendingPolygons;
+ else
+ maClipPoly = tools::solvePolygonOperationAnd(
+ maClipPoly,
+ maPendingPolygons);
+ break;
+ case XOR:
+ if( bIsEmpty )
+ maClipPoly = maPendingPolygons;
+ else if( bIsCleared )
+ {
+ // not representable, strictly speaking,
+ // using polygons with the common even/odd
+ // or nonzero winding number fill rule. If
+ // we'd want to represent it, fill rule
+ // would need to be "non-negative winding
+ // number" (and we then would return
+ // 'holes' here)
+
+ // going for an ugly hack meanwhile
+ maClipPoly = tools::solvePolygonOperationXor(
+ B2DPolyPolygon(
+ tools::createPolygonFromRect(B2DRange(-1E20,-1E20,1E20,1E20))),
+ maPendingPolygons);
+ }
+ else
+ maClipPoly = tools::solvePolygonOperationXor(
+ maClipPoly,
+ maPendingPolygons);
+ break;
+ case SUBTRACT:
+ OSL_ASSERT( !bIsEmpty );
+
+ // first union all pending ones, subtract en bloc then
+ maPendingPolygons = solveCrossovers(maPendingPolygons);
+ maPendingPolygons = stripNeutralPolygons(maPendingPolygons);
+ maPendingPolygons = stripDispensablePolygons(maPendingPolygons, false);
+
+ if( bIsCleared )
+ {
+ // not representable, strictly speaking,
+ // using polygons with the common even/odd
+ // or nonzero winding number fill rule. If
+ // we'd want to represent it, fill rule
+ // would need to be "non-negative winding
+ // number" (and we then would return
+ // 'holes' here)
+
+ // going for an ugly hack meanwhile
+ maClipPoly = tools::solvePolygonOperationDiff(
+ B2DPolyPolygon(
+ tools::createPolygonFromRect(B2DRange(-1E20,-1E20,1E20,1E20))),
+ maPendingPolygons);
+ }
+ else
+ maClipPoly = tools::solvePolygonOperationDiff(
+ maClipPoly,
+ maPendingPolygons);
+ break;
+ }
+
+ maPendingPolygons.clear();
+ mePendingOps = UNION;
+ }
+
+ void commitPendingRanges() const
+ {
+ if( !maPendingRanges.count() )
+ return;
+
+ // use the specialized range clipper for the win
+ B2DPolyPolygon aCollectedRanges;
+ const bool bIsEmpty=isNullClipPoly();
+ const bool bIsCleared=!maClipPoly.count();
+ switch(mePendingOps)
+ {
+ case UNION:
+ OSL_ASSERT( !bIsCleared );
+
+ aCollectedRanges = maPendingRanges.solveCrossovers();
+ aCollectedRanges = stripNeutralPolygons(aCollectedRanges);
+ aCollectedRanges = stripDispensablePolygons(aCollectedRanges, false);
+ if( bIsEmpty )
+ maClipPoly = aCollectedRanges;
+ else
+ maClipPoly = tools::solvePolygonOperationOr(
+ maClipPoly,
+ aCollectedRanges);
+ break;
+ case INTERSECT:
+ OSL_ASSERT( !bIsEmpty );
+
+ aCollectedRanges = maPendingRanges.solveCrossovers();
+ aCollectedRanges = stripNeutralPolygons(aCollectedRanges);
+ if( maPendingRanges.count() > 1 )
+ aCollectedRanges = stripDispensablePolygons(aCollectedRanges, true);
+
+ if( bIsCleared )
+ maClipPoly = aCollectedRanges;
+ else
+ maClipPoly = tools::solvePolygonOperationAnd(
+ maClipPoly,
+ aCollectedRanges);
+ break;
+ case XOR:
+ aCollectedRanges = maPendingRanges.solveCrossovers();
+ aCollectedRanges = stripNeutralPolygons(aCollectedRanges);
+ aCollectedRanges = correctOrientations(aCollectedRanges);
+
+ if( bIsEmpty )
+ maClipPoly = aCollectedRanges;
+ else if( bIsCleared )
+ {
+ // not representable, strictly speaking,
+ // using polygons with the common even/odd
+ // or nonzero winding number fill rule. If
+ // we'd want to represent it, fill rule
+ // would need to be "non-negative winding
+ // number" (and we then would return
+ // 'holes' here)
+
+ // going for an ugly hack meanwhile
+ maClipPoly = tools::solvePolygonOperationXor(
+ B2DPolyPolygon(
+ tools::createPolygonFromRect(B2DRange(-1E20,-1E20,1E20,1E20))),
+ aCollectedRanges);
+ }
+ else
+ maClipPoly = tools::solvePolygonOperationXor(
+ maClipPoly,
+ aCollectedRanges);
+ break;
+ case SUBTRACT:
+ OSL_ASSERT( !bIsEmpty );
+
+ // first union all pending ranges, subtract en bloc then
+ aCollectedRanges = maPendingRanges.solveCrossovers();
+ aCollectedRanges = stripNeutralPolygons(aCollectedRanges);
+ aCollectedRanges = stripDispensablePolygons(aCollectedRanges, false);
+
+ if( bIsCleared )
+ {
+ // not representable, strictly speaking,
+ // using polygons with the common even/odd
+ // or nonzero winding number fill rule. If
+ // we'd want to represent it, fill rule
+ // would need to be "non-negative winding
+ // number" (and we then would return
+ // 'holes' here)
+
+ // going for an ugly hack meanwhile
+ maClipPoly = tools::solvePolygonOperationDiff(
+ B2DPolyPolygon(
+ tools::createPolygonFromRect(B2DRange(-1E20,-1E20,1E20,1E20))),
+ aCollectedRanges);
+ }
+ else
+ maClipPoly = tools::solvePolygonOperationDiff(
+ maClipPoly,
+ aCollectedRanges);
+ break;
+ }
+
+ maPendingRanges.clear();
+ mePendingOps = UNION;
+ }
+
+ mutable B2DPolyPolygon maPendingPolygons;
+ mutable B2DPolyRange maPendingRanges;
+ mutable B2DPolyPolygon maClipPoly;
+ mutable Operation mePendingOps;
+ };
+
+ B2DClipState::B2DClipState() :
+ mpImpl()
+ {}
+
+ B2DClipState::~B2DClipState()
+ {}
+
+ B2DClipState::B2DClipState( const B2DClipState& rOrig ) :
+ mpImpl(rOrig.mpImpl)
+ {}
+
+ B2DClipState::B2DClipState( const B2DRange& rRange ) :
+ mpImpl( ImplB2DClipState(rRange) )
+ {}
+
+ B2DClipState::B2DClipState( const B2DPolygon& rPoly ) :
+ mpImpl( ImplB2DClipState(rPoly) )
+ {}
+
+ B2DClipState::B2DClipState( const B2DPolyPolygon& rPolyPoly ) :
+ mpImpl( ImplB2DClipState(rPolyPoly) )
+ {}
+
+ B2DClipState& B2DClipState::operator=( const B2DClipState& rRHS )
+ {
+ mpImpl = rRHS.mpImpl;
+ return *this;
+ }
+
+ void B2DClipState::makeUnique()
+ {
+ mpImpl.make_unique();
+ }
+
+ void B2DClipState::makeNull()
+ {
+ mpImpl->makeNull();
+ }
+
+ bool B2DClipState::isNull() const
+ {
+ return mpImpl->isNull();
+ }
+
+ void B2DClipState::makeClear()
+ {
+ mpImpl->makeClear();
+ }
+
+ bool B2DClipState::isCleared() const
+ {
+ return mpImpl->isCleared();
+ }
+
+ bool B2DClipState::operator==(const B2DClipState& rRHS) const
+ {
+ if(mpImpl.same_object(rRHS.mpImpl))
+ return true;
+
+ return ((*mpImpl) == (*rRHS.mpImpl));
+ }
+
+ bool B2DClipState::operator!=(const B2DClipState& rRHS) const
+ {
+ return !(*this == rRHS);
+ }
+
+ void B2DClipState::unionRange(const B2DRange& rRange)
+ {
+ mpImpl->unionRange(rRange);
+ }
+
+ void B2DClipState::unionPolygon(const B2DPolygon& rPoly)
+ {
+ mpImpl->unionPolygon(rPoly);
+ }
+
+ void B2DClipState::unionPolyPolygon(const B2DPolyPolygon& rPolyPoly)
+ {
+ mpImpl->unionPolyPolygon(rPolyPoly);
+ }
+
+ void B2DClipState::unionClipState(const B2DClipState& rState)
+ {
+ mpImpl->unionClipState(*rState.mpImpl);
+ }
+
+ void B2DClipState::intersectRange(const B2DRange& rRange)
+ {
+ mpImpl->intersectRange(rRange);
+ }
+
+ void B2DClipState::intersectPolygon(const B2DPolygon& rPoly)
+ {
+ mpImpl->intersectPolygon(rPoly);
+ }
+
+ void B2DClipState::intersectPolyPolygon(const B2DPolyPolygon& rPolyPoly)
+ {
+ mpImpl->intersectPolyPolygon(rPolyPoly);
+ }
+
+ void B2DClipState::intersectClipState(const B2DClipState& rState)
+ {
+ mpImpl->intersectClipState(*rState.mpImpl);
+ }
+
+ void B2DClipState::subtractRange(const B2DRange& rRange)
+ {
+ mpImpl->subtractRange(rRange);
+ }
+
+ void B2DClipState::subtractPolygon(const B2DPolygon& rPoly)
+ {
+ mpImpl->subtractPolygon(rPoly);
+ }
+
+ void B2DClipState::subtractPolyPolygon(const B2DPolyPolygon& rPolyPoly)
+ {
+ mpImpl->subtractPolyPolygon(rPolyPoly);
+ }
+
+ void B2DClipState::subtractClipState(const B2DClipState& rState)
+ {
+ mpImpl->subtractClipState(*rState.mpImpl);
+ }
+
+ void B2DClipState::xorRange(const B2DRange& rRange)
+ {
+ mpImpl->xorRange(rRange);
+ }
+
+ void B2DClipState::xorPolygon(const B2DPolygon& rPoly)
+ {
+ mpImpl->xorPolygon(rPoly);
+ }
+
+ void B2DClipState::xorPolyPolygon(const B2DPolyPolygon& rPolyPoly)
+ {
+ mpImpl->xorPolyPolygon(rPolyPoly);
+ }
+
+ void B2DClipState::xorClipState(const B2DClipState& rState)
+ {
+ mpImpl->xorClipState(*rState.mpImpl);
+ }
+
+ B2DPolyPolygon B2DClipState::getClipPoly() const
+ {
+ return mpImpl->getClipPoly();
+ }
+
+} // end of namespace tools
+} // end of namespace basegfx
+
+// eof
diff --git a/basegfx/source/tools/gradienttools.cxx b/basegfx/source/tools/gradienttools.cxx
index 89293cfcb61c..857b668da68e 100644
--- a/basegfx/source/tools/gradienttools.cxx
+++ b/basegfx/source/tools/gradienttools.cxx
@@ -49,6 +49,8 @@ namespace basegfx
o_rGradientInfo.maBackTextureTransform.identity();
o_rGradientInfo.mnSteps = nSteps;
+ fAngle = -fAngle;
+
double fTargetSizeX(rTargetRange.getWidth());
double fTargetSizeY(rTargetRange.getHeight());
double fTargetOffsetX(rTargetRange.getMinX());
@@ -67,17 +69,30 @@ namespace basegfx
fTargetSizeY = fNewY;
}
- // add object scale before rotate
+ const double fSizeWithoutBorder=1.0 - fBorder;
+ if( bAxial )
+ {
+ o_rGradientInfo.maTextureTransform.scale(1.0, fSizeWithoutBorder * .5);
+ o_rGradientInfo.maTextureTransform.translate(0.0, 0.5);
+ }
+ else
+ {
+ if(!fTools::equal(fSizeWithoutBorder, 1.0))
+ {
+ o_rGradientInfo.maTextureTransform.scale(1.0, fSizeWithoutBorder);
+ o_rGradientInfo.maTextureTransform.translate(0.0, fBorder);
+ }
+ }
+
o_rGradientInfo.maTextureTransform.scale(fTargetSizeX, fTargetSizeY);
// add texture rotate after scale to keep perpendicular angles
if(0.0 != fAngle)
{
- B2DPoint aCenter(0.5, 0.5);
- aCenter *= o_rGradientInfo.maTextureTransform;
-
- o_rGradientInfo.maTextureTransform = basegfx::tools::createRotateAroundPoint(aCenter, fAngle)
- * o_rGradientInfo.maTextureTransform;
+ const B2DPoint aCenter(0.5*fTargetSizeX,
+ 0.5*fTargetSizeY);
+ o_rGradientInfo.maTextureTransform *=
+ basegfx::tools::createRotateAroundPoint(aCenter, fAngle);
}
// add object translate
@@ -86,24 +101,9 @@ namespace basegfx
// prepare aspect for texture
o_rGradientInfo.mfAspectRatio = (0.0 != fTargetSizeY) ? fTargetSizeX / fTargetSizeY : 1.0;
- // build transform from u,v to [0.0 .. 1.0]. As base, use inverse texture transform
+ // build transform from u,v to [0.0 .. 1.0].
o_rGradientInfo.maBackTextureTransform = o_rGradientInfo.maTextureTransform;
o_rGradientInfo.maBackTextureTransform.invert();
-
- double fSizeWithoutBorder=0;
- if( bAxial )
- {
- fSizeWithoutBorder = (1.0 - fBorder) * 0.5;
- o_rGradientInfo.maBackTextureTransform.translate(0.0, -0.5);
- }
- else
- {
- fSizeWithoutBorder = 1.0 - fBorder;
- o_rGradientInfo.maBackTextureTransform.translate(0.0, -fBorder);
- }
-
- if(!fTools::equal(fSizeWithoutBorder, 0.0))
- o_rGradientInfo.maBackTextureTransform.scale(1.0, 1.0 / fSizeWithoutBorder);
}
/** Most of the setup for radial & ellipsoidal gradient is the same,
@@ -121,6 +121,8 @@ namespace basegfx
o_rGradientInfo.maBackTextureTransform.identity();
o_rGradientInfo.mnSteps = nSteps;
+ fAngle = -fAngle;
+
double fTargetSizeX(rTargetRange.getWidth());
double fTargetSizeY(rTargetRange.getHeight());
double fTargetOffsetX(rTargetRange.getMinX());
@@ -143,20 +145,19 @@ namespace basegfx
fTargetSizeY = 1.4142 * fTargetSizeY;
}
- // add object scale before rotate
+ const double fHalfBorder((1.0 - fBorder) * 0.5);
+ o_rGradientInfo.maTextureTransform.scale(fHalfBorder, fHalfBorder);
+
+ o_rGradientInfo.maTextureTransform.translate(0.5, 0.5);
o_rGradientInfo.maTextureTransform.scale(fTargetSizeX, fTargetSizeY);
- if( !bCircular )
+ // add texture rotate after scale to keep perpendicular angles
+ if( !bCircular && 0.0 != fAngle)
{
- // add texture rotate after scale to keep perpendicular angles
- if(0.0 != fAngle)
- {
- B2DPoint aCenter(0.5, 0.5);
- aCenter *= o_rGradientInfo.maTextureTransform;
-
- o_rGradientInfo.maTextureTransform = basegfx::tools::createRotateAroundPoint(aCenter, fAngle)
- * o_rGradientInfo.maTextureTransform;
- }
+ const B2DPoint aCenter(0.5*fTargetSizeX,
+ 0.5*fTargetSizeY);
+ o_rGradientInfo.maTextureTransform *=
+ basegfx::tools::createRotateAroundPoint(aCenter, fAngle);
}
// add defined offsets after rotation
@@ -173,17 +174,9 @@ namespace basegfx
// prepare aspect for texture
o_rGradientInfo.mfAspectRatio = (0.0 != fTargetSizeY) ? fTargetSizeX / fTargetSizeY : 1.0;
- // build transform from u,v to [0.0 .. 1.0]. As base, use inverse texture transform
+ // build transform from u,v to [0.0 .. 1.0].
o_rGradientInfo.maBackTextureTransform = o_rGradientInfo.maTextureTransform;
o_rGradientInfo.maBackTextureTransform.invert();
- o_rGradientInfo.maBackTextureTransform.translate(-0.5, -0.5);
- const double fHalfBorder((1.0 - fBorder) * 0.5);
-
- if(!fTools::equal(fHalfBorder, 0.0))
- {
- const double fFactor(1.0 / fHalfBorder);
- o_rGradientInfo.maBackTextureTransform.scale(fFactor, fFactor);
- }
}
/** Setup for rect & square gradient is exactly the same. Factored out
@@ -200,6 +193,8 @@ namespace basegfx
o_rGradientInfo.maBackTextureTransform.identity();
o_rGradientInfo.mnSteps = nSteps;
+ fAngle = -fAngle;
+
double fTargetSizeX(rTargetRange.getWidth());
double fTargetSizeY(rTargetRange.getHeight());
double fTargetOffsetX(rTargetRange.getMinX());
@@ -218,17 +213,19 @@ namespace basegfx
fTargetSizeY = fNewY;
}
- // add object scale before rotate
+ const double fHalfBorder((1.0 - fBorder) * 0.5);
+ o_rGradientInfo.maTextureTransform.scale(fHalfBorder, fHalfBorder);
+
+ o_rGradientInfo.maTextureTransform.translate(0.5, 0.5);
o_rGradientInfo.maTextureTransform.scale(fTargetSizeX, fTargetSizeY);
// add texture rotate after scale to keep perpendicular angles
if(0.0 != fAngle)
{
- B2DPoint aCenter(0.5, 0.5);
- aCenter *= o_rGradientInfo.maTextureTransform;
-
- o_rGradientInfo.maTextureTransform = basegfx::tools::createRotateAroundPoint(aCenter, fAngle)
- * o_rGradientInfo.maTextureTransform;
+ const B2DPoint aCenter(0.5*fTargetSizeX,
+ 0.5*fTargetSizeY);
+ o_rGradientInfo.maTextureTransform *=
+ basegfx::tools::createRotateAroundPoint(aCenter, fAngle);
}
// add defined offsets after rotation
@@ -248,14 +245,6 @@ namespace basegfx
// build transform from u,v to [0.0 .. 1.0]. As base, use inverse texture transform
o_rGradientInfo.maBackTextureTransform = o_rGradientInfo.maTextureTransform;
o_rGradientInfo.maBackTextureTransform.invert();
- o_rGradientInfo.maBackTextureTransform.translate(-0.5, -0.5);
- const double fHalfBorder((1.0 - fBorder) * 0.5);
-
- if(!fTools::equal(fHalfBorder, 0.0))
- {
- const double fFactor(1.0 / fHalfBorder);
- o_rGradientInfo.maBackTextureTransform.scale(fFactor, fFactor);
- }
}
namespace tools
diff --git a/basegfx/source/tools/keystoplerp.cxx b/basegfx/source/tools/keystoplerp.cxx
new file mode 100644
index 000000000000..883bfec6bc96
--- /dev/null
+++ b/basegfx/source/tools/keystoplerp.cxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: canvastools.hxx,v $
+ * $Revision: 1.10 $
+ *
+ * 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_basegfx.hxx"
+
+#include "basegfx/tools/keystoplerp.hxx"
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <algorithm>
+
+static void validateInput(const std::vector<double>& rKeyStops)
+{
+ (void)rKeyStops;
+#ifdef DBG_UTIL
+ OSL_ENSURE( rKeyStops.size() > 1,
+ "KeyStopLerp::KeyStopLerp(): key stop vector must have two entries or more" );
+
+ // rKeyStops must be sorted in ascending order
+ for( ::std::size_t i=1, len=rKeyStops.size(); i<len; ++i )
+ {
+ if( rKeyStops[i-1] > rKeyStops[i] )
+ OSL_ENSURE( false,
+ "KeyStopLerp::KeyStopLerp(): time vector is not sorted in ascending order!" );
+ }
+#endif
+}
+
+namespace basegfx
+{
+ namespace tools
+ {
+ KeyStopLerp::KeyStopLerp( const std::vector<double>& rKeyStops ) :
+ maKeyStops(rKeyStops),
+ mnLastIndex(0)
+ {
+ validateInput(maKeyStops);
+ }
+
+ KeyStopLerp::KeyStopLerp( const ::com::sun::star::uno::Sequence<double>& rKeyStops ) :
+ maKeyStops(rKeyStops.getLength()),
+ mnLastIndex(0)
+ {
+ std::copy( rKeyStops.getConstArray(),
+ rKeyStops.getConstArray()+rKeyStops.getLength(),
+ maKeyStops.begin() );
+ validateInput(maKeyStops);
+ }
+
+ KeyStopLerp::ResultType KeyStopLerp::lerp(double fAlpha) const
+ {
+ // cached value still okay?
+ if( maKeyStops.at(mnLastIndex) < fAlpha ||
+ maKeyStops.at(mnLastIndex+1) >= fAlpha )
+ {
+ // nope, find new index
+ mnLastIndex = std::min<std::ptrdiff_t>(
+ maKeyStops.size()-2,
+ // range is ensured by max below
+ std::max<std::ptrdiff_t>(
+ 0,
+ std::distance( maKeyStops.begin(),
+ std::lower_bound( maKeyStops.begin(),
+ maKeyStops.end(),
+ fAlpha )) - 1 ));
+ }
+
+ // lerp between stop and stop+1
+ const double fRawLerp=
+ (fAlpha-maKeyStops.at(mnLastIndex)) /
+ (maKeyStops.at(mnLastIndex+1) - maKeyStops.at(mnLastIndex));
+
+ // clamp to permissible range (input fAlpha might be
+ // everything)
+ return ResultType(
+ mnLastIndex,
+ clamp(fRawLerp,0.0,1.0));
+ }
+ }
+}
diff --git a/basegfx/source/tools/makefile.mk b/basegfx/source/tools/makefile.mk
index c70b78be5d4b..0a0977f7305d 100755
--- a/basegfx/source/tools/makefile.mk
+++ b/basegfx/source/tools/makefile.mk
@@ -37,9 +37,11 @@ ENABLE_EXCEPTIONS=TRUE
# --- Files -------------------------------------
-SLOFILES= $(SLO)$/canvastools.obj \
+SLOFILES= $(SLO)$/b2dclipstate.obj \
+ $(SLO)$/canvastools.obj \
$(SLO)$/gradienttools.obj \
$(SLO)$/debugplotter.obj \
+ $(SLO)$/keystoplerp.obj \
$(SLO)$/liangbarsky.obj \
$(SLO)$/tools.obj \
$(SLO)$/unopolypolygon.obj
diff --git a/basegfx/test/basegfx1d.cxx b/basegfx/test/basegfx1d.cxx
index 5cc823d3daca..41ac65da56e3 100644
--- a/basegfx/test/basegfx1d.cxx
+++ b/basegfx/test/basegfx1d.cxx
@@ -30,7 +30,10 @@
#include "precompiled_basegfx.hxx"
// autogenerated file with codegen.pl
-#include <testshl/simpleheader.hxx>
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
+#include "cppunit/plugin/TestPlugIn.h"
namespace basegfx1d
{
@@ -52,7 +55,6 @@ public:
void EmptyMethod()
{
// CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
- CPPUNIT_ASSERT_STUB();
}
// Change the following lines only, if you add, remove or rename
@@ -65,13 +67,7 @@ public:
}; // class b1drange
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx1d::b1drange, "basegfx1d");
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfx1d::b1drange);
} // namespace basegfx1d
-
-// -----------------------------------------------------------------------------
-
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-NOADDITIONAL;
-
+CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx
index b169d35ed96a..31005a158982 100644
--- a/basegfx/test/basegfx2d.cxx
+++ b/basegfx/test/basegfx2d.cxx
@@ -30,7 +30,9 @@
#include "precompiled_basegfx.hxx"
// autogenerated file with codegen.pl
-#include <testshl/simpleheader.hxx>
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
@@ -38,7 +40,9 @@
#include <basegfx/curve/b2dcubicbezier.hxx>
#include <basegfx/curve/b2dbeziertools.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
-#include <basegfx/range/b2dmultirange.hxx>
+#include <basegfx/polygon/b2dpolygonclipper.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/range/b2dpolyrange.hxx>
#include <basegfx/numeric/ftools.hxx>
#include <basegfx/color/bcolor.hxx>
#include <basegfx/color/bcolortools.hxx>
@@ -53,214 +57,6 @@ using namespace ::basegfx;
namespace basegfx2d
{
-/// Gets a random ordinal [0,n)
-inline double getRandomOrdinal( const ::std::size_t n )
-{
- return double(n) * rand() / (RAND_MAX + 1.0);
-}
-
-class b2dmultirange : public CppUnit::TestFixture
-{
-private:
- B2DMultiRange aDisjunctRanges;
- B2DMultiRange aEqualRanges;
- B2DMultiRange aIntersectionN;
- B2DMultiRange aIntersectionE;
- B2DMultiRange aIntersectionS;
- B2DMultiRange aIntersectionW;
- B2DMultiRange aIntersectionNE;
- B2DMultiRange aIntersectionSE;
- B2DMultiRange aIntersectionSW;
- B2DMultiRange aIntersectionNW;
- B2DMultiRange aRingIntersection;
- B2DMultiRange aComplexIntersections;
- B2DMultiRange aRandomIntersections;
-
-public:
- // initialise your test code values here.
- void setUp()
- {
- B2DRange aCenter(1.0, 1.0, -1.0, -1.0);
- B2DRange aOffside(9.0, 9.0, 11.0, 11.0);
- B2DRange aNorth(1.0, 0.0, -1.0, -2.0);
- B2DRange aSouth(1.0, 2.0, -1.0, 0.0);
- B2DRange aEast(0.0, 1.0, 2.0, -1.0);
- B2DRange aWest(-2.0, 1.0, 0.0, -1.0);
- B2DRange aNorthEast(0.0, 0.0, 2.0, -2.0);
- B2DRange aSouthEast(0.0, 0.0, 2.0, 2.0);
- B2DRange aSouthWest(0.0, 0.0, -2.0, 2.0);
- B2DRange aNorthWest(0.0, 0.0, -2.0, -2.0);
-
- B2DRange aNorth2(-1.5, 0.5, 1.5, 3.5);
- B2DRange aSouth2(-1.5, -0.5, 1.5, -3.5);
- B2DRange aEast2 (0.5, -1.5, 3.5, 1.5);
- B2DRange aWest2 (-0.5, -1.5,-3.5, 1.5);
-
- ::std::ofstream output("multirange_testcases.gnuplot");
- DebugPlotter aPlotter( "multirange testcases",
- output );
-
- aPlotter.plot( aCenter, "center" );
- aPlotter.plot( aOffside, "offside" );
- aPlotter.plot( aNorth, "north" );
- aPlotter.plot( aSouth, "south" );
- aPlotter.plot( aEast, "east" );
- aPlotter.plot( aWest, "west" );
- aPlotter.plot( aNorthEast, "northeast" );
- aPlotter.plot( aSouthEast, "southeast" );
- aPlotter.plot( aSouthWest, "southwest" );
- aPlotter.plot( aNorthWest, "northwest" );
-
- aDisjunctRanges.addRange( aCenter );
- aDisjunctRanges.addRange( aOffside );
-
- aEqualRanges.addRange( aCenter );
- aEqualRanges.addRange( aCenter );
-
- aIntersectionN.addRange( aCenter );
- aIntersectionN.addRange( aNorth );
-
- aIntersectionE.addRange( aCenter );
- aIntersectionE.addRange( aEast );
-
- aIntersectionS.addRange( aCenter );
- aIntersectionS.addRange( aSouth );
-
- aIntersectionW.addRange( aCenter );
- aIntersectionW.addRange( aWest );
-
- aIntersectionNE.addRange( aCenter );
- aIntersectionNE.addRange( aNorthEast );
-
- aIntersectionSE.addRange( aCenter );
- aIntersectionSE.addRange( aSouthEast );
-
- aIntersectionSW.addRange( aCenter );
- aIntersectionSW.addRange( aSouthWest );
-
- aIntersectionNW.addRange( aCenter );
- aIntersectionNW.addRange( aNorthWest );
-
- aRingIntersection.addRange( aNorth2 );
- aRingIntersection.addRange( aEast2 );
- aRingIntersection.addRange( aSouth2 );
- aRingIntersection.addRange( aWest2 );
-
- aComplexIntersections.addRange( aCenter );
- aComplexIntersections.addRange( aOffside );
- aComplexIntersections.addRange( aCenter );
- aComplexIntersections.addRange( aNorth );
- aComplexIntersections.addRange( aEast );
- aComplexIntersections.addRange( aSouth );
- aComplexIntersections.addRange( aWest );
- aComplexIntersections.addRange( aNorthEast );
- aComplexIntersections.addRange( aSouthEast );
- aComplexIntersections.addRange( aSouthWest );
- aComplexIntersections.addRange( aNorthWest );
-
-/*
- for( int i=0; i<10; ++i )
- {
- B2DRange aRandomRange(
- getRandomOrdinal( 10 ),
- getRandomOrdinal( 10 ),
- getRandomOrdinal( 10 ),
- getRandomOrdinal( 10 ) );
-
- aRandomIntersections.addRange( aRandomRange );
- }
-*/
- }
-
- void tearDown()
- {
- }
-
- ::basegfx::B2DPolyPolygon shiftPoly( int nCount,
- const ::basegfx::B2DPolyPolygon& rPoly )
- {
- B2DHomMatrix aMatrix;
- aMatrix.translate( nCount*4.0,
- 10.0-nCount*2.0 );
-
- ::basegfx::B2DPolyPolygon aRes( rPoly );
- aRes.transform( aMatrix );
-
- return aRes;
- }
-
- void getPolyPolygon()
- {
- ::std::ofstream output("multirange_getpolypolygon.gnuplot");
- DebugPlotter aPlotter( "multirange getPolyPolygon",
- output );
-
- B2DPolyPolygon result;
-
- aPlotter.plot( shiftPoly(
- 0,
- aDisjunctRanges.getPolyPolygon() ),
- "disjunct" );
- aPlotter.plot( shiftPoly(
- 1,
- aEqualRanges.getPolyPolygon() ),
- "equal" );
- aPlotter.plot( shiftPoly(
- 2,
- aIntersectionN.getPolyPolygon() ),
- "intersectionN" );
- aPlotter.plot( shiftPoly(
- 3,
- aIntersectionE.getPolyPolygon() ),
- "intersectionE" );
- aPlotter.plot( shiftPoly(
- 4,
- aIntersectionS.getPolyPolygon() ),
- "intersectionS" );
- aPlotter.plot( shiftPoly(
- 5,
- aIntersectionW.getPolyPolygon() ),
- "intersectionW" );
- aPlotter.plot( shiftPoly(
- 6,
- aIntersectionNE.getPolyPolygon() ),
- "intersectionNE" );
- aPlotter.plot( shiftPoly(
- 7,
- aIntersectionSE.getPolyPolygon() ),
- "intersectionSE" );
- aPlotter.plot( shiftPoly(
- 8,
- aIntersectionSW.getPolyPolygon() ),
- "intersectionSW" );
- aPlotter.plot( shiftPoly(
- 9,
- aIntersectionNW.getPolyPolygon() ),
- "intersectionNW" );
- aPlotter.plot( shiftPoly(
- 10,
- aRingIntersection.getPolyPolygon() ),
- "intersection ring" );
- aPlotter.plot( shiftPoly(
- 11,
- aComplexIntersections.getPolyPolygon() ),
- "intersection complex" );
- aPlotter.plot( shiftPoly(
- 12,
- aRandomIntersections.getPolyPolygon() ),
- "intersection random" );
-
- CPPUNIT_ASSERT_MESSAGE("getPolyPolygon", true );
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(b2dmultirange);
- CPPUNIT_TEST(getPolyPolygon);
- CPPUNIT_TEST_SUITE_END();
-}; // class b2dmultirange
class b2dsvgdimpex : public CppUnit::TestFixture
{
@@ -465,33 +261,6 @@ public:
CPPUNIT_ASSERT_MESSAGE("exporting complex polygon to SVG-D (round-trip)",
!aExport.compareToAscii(sExportString2));
- const B2DPolygon aCircle(
- tools::createPolygonFromEllipse( B2DPoint(4000,4000),
- 1000.0, 2000.0 ));
- aExport = tools::exportToSvgD( B2DPolyPolygon(aCircle), false, false);
-
- // count number of spaces, in lieu of a better way - no real
- // point in comparing with a gold standard, as fractional
- // parts of the coordinates will differ between systems.
- sal_Int32 nIndex=0, nCount=0;
- do
- {
- rtl::OUString aToken = aExport.getToken( 0, ' ', nIndex );
- ++nCount;
- }
- while ( nIndex >= 0 );
-
- // Adapted number of spaces to 50 and 67 because of the new circle construction
- // methods which produce more points and thus more spaces, too. Use both since
- // depending on float precision and the getContinuity() implemetation using
- // fTools::equal, linux and mac produce more 'C' than 'S' statements, while WIN32
- // uses more 'S' statements (as it should be for circles)
-#ifdef S390X
- CPPUNIT_ASSERT_MESSAGE("exporting to circle does not produce the expected number of coordinates", nCount==61 );
-#else
- CPPUNIT_ASSERT_MESSAGE("exporting to circle does not produce the expected number of coordinates", nCount==67 || nCount==50 );
-#endif
-
const B2DPolygon aRect(
tools::createPolygonFromRect( B2DRange(0.0,0.0,4000.0,4000.0) ));
aExport = tools::exportToSvgD( B2DPolyPolygon(aRect), false, false);
@@ -510,6 +279,45 @@ public:
CPPUNIT_TEST_SUITE_END();
}; // class b2dsvgdimpex
+class b2dpolyrange : public CppUnit::TestFixture
+{
+private:
+public:
+ void setUp()
+ {}
+
+ void tearDown()
+ {}
+
+ void check()
+ {
+ B2DPolyRange aRange;
+ aRange.appendElement(B2DRange(0,0,1,1),ORIENTATION_POSITIVE);
+ aRange.appendElement(B2DRange(2,2,3,3),ORIENTATION_POSITIVE);
+
+ CPPUNIT_ASSERT_MESSAGE("simple poly range - count",
+ aRange.count() == 2);
+ CPPUNIT_ASSERT_MESSAGE("simple poly range - first element",
+ aRange.getElement(0).head == B2DRange(0,0,1,1));
+ CPPUNIT_ASSERT_MESSAGE("simple poly range - second element",
+ aRange.getElement(1).head == B2DRange(2,2,3,3));
+
+ // B2DPolyRange relies on correctly orientated rects
+ const B2DRange aRect(0,0,1,1);
+ CPPUNIT_ASSERT_MESSAGE("createPolygonFromRect - correct orientation",
+ tools::getOrientation(
+ tools::createPolygonFromRect(aRect)) == ORIENTATION_POSITIVE );
+ }
+
+ // Change the following lines only, if you add, remove or rename
+ // member functions of the current class,
+ // because these macros are need by auto register mechanism.
+
+ CPPUNIT_TEST_SUITE(b2dpolyrange);
+ CPPUNIT_TEST(check);
+ CPPUNIT_TEST_SUITE_END();
+};
+
class b2dbeziertools : public CppUnit::TestFixture
{
private:
@@ -758,7 +566,6 @@ public:
{
// this is demonstration code
// CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
- CPPUNIT_ASSERT_STUB();
}
// Change the following lines only, if you add, remove or rename
@@ -1110,7 +917,6 @@ public:
// insert your test code here.
void EmptyMethod()
{
- CPPUNIT_ASSERT_STUB();
}
// Change the following lines only, if you add, remove or rename
@@ -1140,7 +946,6 @@ public:
void EmptyMethod()
{
// CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
- CPPUNIT_ASSERT_STUB();
}
// Change the following lines only, if you add, remove or rename
@@ -1283,6 +1088,14 @@ public:
aNonRect4.append( B2DPoint(1,1) );
aNonRect4.append( B2DPoint(0,1) );
+ B2DPolygon aNonRect5;
+ aNonRect5.append( B2DPoint(0,0) );
+ aNonRect5.append( B2DPoint(1,0) );
+ aNonRect5.append( B2DPoint(1,1) );
+ aNonRect5.append( B2DPoint(0,1) );
+ aNonRect5.setControlPoints(1,B2DPoint(1,0),B2DPoint(-11,0));
+ aNonRect5.setClosed(true);
+
CPPUNIT_ASSERT_MESSAGE("checking rectangle-ness of rectangle 1",
tools::isRectangle( aRect1 ));
CPPUNIT_ASSERT_MESSAGE("checking rectangle-ness of rectangle 2",
@@ -1295,6 +1108,8 @@ public:
!tools::isRectangle( aNonRect3 ));
CPPUNIT_ASSERT_MESSAGE("checking non-rectangle-ness of polygon 4",
!tools::isRectangle( aNonRect4 ));
+ CPPUNIT_ASSERT_MESSAGE("checking non-rectangle-ness of polygon 5",
+ !tools::isRectangle( aNonRect5 ));
}
// Change the following lines only, if you add, remove or rename
@@ -1322,7 +1137,6 @@ public:
// insert your test code here.
void EmptyMethod()
{
- CPPUNIT_ASSERT_STUB();
}
// Change the following lines only, if you add, remove or rename
@@ -1352,7 +1166,6 @@ public:
void EmptyMethod()
{
// CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
- CPPUNIT_ASSERT_STUB();
}
// Change the following lines only, if you add, remove or rename
@@ -1380,7 +1193,6 @@ public:
// insert your test code here.
void EmptyMethod()
{
- CPPUNIT_ASSERT_STUB();
}
// Change the following lines only, if you add, remove or rename
@@ -1410,7 +1222,6 @@ public:
void EmptyMethod()
{
// CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
- CPPUNIT_ASSERT_STUB();
}
// Change the following lines only, if you add, remove or rename
@@ -1438,7 +1249,6 @@ public:
// insert your test code here.
void EmptyMethod()
{
- CPPUNIT_ASSERT_STUB();
}
// Change the following lines only, if you add, remove or rename
@@ -1502,6 +1312,8 @@ public:
tools::rgb2hsl(maMagenta) == BColor(300,1,0.5));
CPPUNIT_ASSERT_MESSAGE("cyan",
tools::rgb2hsl(maCyan) == BColor(180,1,0.5));
+ CPPUNIT_ASSERT_MESSAGE("third hue case",
+ tools::rgb2hsl(BColor(0,0.5,1)) == BColor(210,1,0.5));
CPPUNIT_ASSERT_MESSAGE("roundtrip white",
tools::hsl2rgb(tools::rgb2hsl(maWhite)) == maWhite);
@@ -1623,21 +1435,21 @@ public:
}; // class b2dvector
// -----------------------------------------------------------------------------
-//CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dmultirange, "basegfx2d");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dsvgdimpex, "basegfx2d");
-//CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dbeziertools, "basegfx2d");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dcubicbezier, "basegfx2d");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dhommatrix, "basegfx2d");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dhompoint, "basegfx2d");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dpoint, "basegfx2d");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dpolygon, "basegfx2d");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dpolygontools, "basegfx2d");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dpolypolygon, "basegfx2d");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dquadraticbezier, "basegfx2d");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2drange, "basegfx2d");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dtuple, "basegfx2d");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dvector, "basegfx2d");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::bcolor, "basegfx2d");
+
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dsvgdimpex);
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dpolyrange);
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dcubicbezier);
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dhommatrix);
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dhompoint);
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dpoint);
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dpolygon);
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dpolygontools);
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dpolypolygon);
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dquadraticbezier);
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2drange);
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dtuple);
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dvector);
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::bcolor);
} // namespace basegfx2d
diff --git a/basegfx/test/basegfx3d.cxx b/basegfx/test/basegfx3d.cxx
index 23d3542e2d4a..a16132e0810f 100644
--- a/basegfx/test/basegfx3d.cxx
+++ b/basegfx/test/basegfx3d.cxx
@@ -30,7 +30,9 @@
#include "precompiled_basegfx.hxx"
// autogenerated file with codegen.pl
-#include <testshl/simpleheader.hxx>
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
namespace basegfx3d
{
@@ -52,7 +54,6 @@ public:
void EmptyMethod()
{
// CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
- CPPUNIT_ASSERT_STUB();
}
// Change the following lines only, if you add, remove or rename
@@ -80,7 +81,6 @@ public:
// insert your test code here.
void EmptyMethod()
{
- CPPUNIT_ASSERT_STUB();
}
// Change the following lines only, if you add, remove or rename
@@ -110,7 +110,6 @@ public:
void EmptyMethod()
{
// CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
- CPPUNIT_ASSERT_STUB();
}
// Change the following lines only, if you add, remove or rename
@@ -138,7 +137,6 @@ public:
// insert your test code here.
void EmptyMethod()
{
- CPPUNIT_ASSERT_STUB();
}
// Change the following lines only, if you add, remove or rename
@@ -168,7 +166,6 @@ public:
void EmptyMethod()
{
// CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
- CPPUNIT_ASSERT_STUB();
}
// Change the following lines only, if you add, remove or rename
@@ -196,7 +193,6 @@ public:
// insert your test code here.
void EmptyMethod()
{
- CPPUNIT_ASSERT_STUB();
}
// Change the following lines only, if you add, remove or rename
@@ -209,12 +205,12 @@ public:
}; // class b3dvector
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx3d::b3dhommatrix, "basegfx3d");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx3d::b3dhompoint, "basegfx3d");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx3d::b3dpoint, "basegfx3d");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx3d::b3drange, "basegfx3d");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx3d::b3dtuple, "basegfx3d");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx3d::b3dvector, "basegfx3d");
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfx3d::b3dhommatrix);
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfx3d::b3dhompoint);
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfx3d::b3dpoint);
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfx3d::b3drange);
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfx3d::b3dtuple);
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfx3d::b3dvector);
} // namespace basegfx3d
diff --git a/basegfx/test/basegfxtools.cxx b/basegfx/test/basegfxtools.cxx
new file mode 100644
index 000000000000..1a8b97a559b2
--- /dev/null
+++ b/basegfx/test/basegfxtools.cxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * 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_basegfx.hxx"
+// autogenerated file with codegen.pl
+
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
+
+#include <basegfx/tools/keystoplerp.hxx>
+#include <basegfx/numeric/ftools.hxx>
+
+#include <boost/tuple/tuple.hpp>
+
+using namespace ::basegfx;
+using namespace ::boost::tuples;
+
+namespace basegfxtools
+{
+
+class KeyStopLerpTest : public CppUnit::TestFixture
+{
+ tools::KeyStopLerp maKeyStops;
+
+ static std::vector<double> getTestVector()
+ {
+ std::vector<double> aStops(3);
+ aStops[0] = 0.1;
+ aStops[1] = 0.5;
+ aStops[2] = 0.9;
+ return aStops;
+ }
+
+public:
+ KeyStopLerpTest() :
+ maKeyStops(getTestVector())
+ {}
+
+ void setUp()
+ {}
+
+ void tearDown()
+ {}
+
+ void test()
+ {
+ double fAlpha;
+ std::ptrdiff_t nIndex;
+
+ tie(nIndex,fAlpha) = maKeyStops.lerp(-1.0);
+ CPPUNIT_ASSERT_MESSAGE("-1.0", nIndex==0 && fAlpha==0.0);
+
+ tie(nIndex,fAlpha) = maKeyStops.lerp(0.1);
+ CPPUNIT_ASSERT_MESSAGE("0.1", nIndex==0 && fAlpha==0.0);
+
+ tie(nIndex,fAlpha) = maKeyStops.lerp(0.3);
+ CPPUNIT_ASSERT_MESSAGE("0.3", nIndex==0 && fTools::equal(fAlpha,0.5));
+
+ tie(nIndex,fAlpha) = maKeyStops.lerp(0.5);
+ CPPUNIT_ASSERT_MESSAGE("0.5", nIndex==0 && fTools::equal(fAlpha,1.0));
+
+ tie(nIndex,fAlpha) = maKeyStops.lerp(0.51);
+ CPPUNIT_ASSERT_MESSAGE("0.51", nIndex==1 && fTools::equal(fAlpha,0.025));
+
+ tie(nIndex,fAlpha) = maKeyStops.lerp(0.9);
+ CPPUNIT_ASSERT_MESSAGE("0.51", nIndex==1 && fTools::equal(fAlpha,1.0));
+
+ tie(nIndex,fAlpha) = maKeyStops.lerp(1.0);
+ CPPUNIT_ASSERT_MESSAGE("0.51", nIndex==1 && fAlpha==1.0);
+ }
+
+ // Change the following lines only, if you add, remove or rename
+ // member functions of the current class,
+ // because these macros are need by auto register mechanism.
+
+ CPPUNIT_TEST_SUITE(KeyStopLerpTest);
+ CPPUNIT_TEST(test);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+// -----------------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfxtools::KeyStopLerpTest);
+} // namespace basegfxtools
diff --git a/basegfx/test/boxclipper.cxx b/basegfx/test/boxclipper.cxx
new file mode 100644
index 000000000000..d52218a51ee0
--- /dev/null
+++ b/basegfx/test/boxclipper.cxx
@@ -0,0 +1,419 @@
+/*************************************************************************
+ *
+ * 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_basegfx.hxx"
+// autogenerated file with codegen.pl
+
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
+
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/curve/b2dcubicbezier.hxx>
+#include <basegfx/curve/b2dbeziertools.hxx>
+#include <basegfx/range/b2dpolyrange.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
+#include <basegfx/polygon/b2dpolygonclipper.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/numeric/ftools.hxx>
+
+#include <boost/bind.hpp>
+
+using namespace ::basegfx;
+
+
+namespace basegfx2d
+{
+/// Gets a random ordinal [0,n)
+inline double getRandomOrdinal( const ::std::size_t n )
+{
+ // use this one when displaying polygons in OOo, which still sucks
+ // great rocks when trying to import non-integer svg:d attributes
+ // return sal_Int64(double(n) * rand() / (RAND_MAX + 1.0));
+ return double(n) * rand() / (RAND_MAX + 1.0);
+}
+
+inline bool compare(const B2DPoint& left, const B2DPoint& right)
+{
+ return left.getX()<right.getX()
+ || (left.getX()==right.getX() && left.getY()<right.getY());
+}
+
+
+class boxclipper : public CppUnit::TestFixture
+{
+private:
+ B2DPolyRange aDisjunctRanges;
+ B2DPolyRange aEqualRanges;
+ B2DPolyRange aIntersectionN;
+ B2DPolyRange aIntersectionE;
+ B2DPolyRange aIntersectionS;
+ B2DPolyRange aIntersectionW;
+ B2DPolyRange aIntersectionNE;
+ B2DPolyRange aIntersectionSE;
+ B2DPolyRange aIntersectionSW;
+ B2DPolyRange aIntersectionNW;
+ B2DPolyRange aRingIntersection;
+ B2DPolyRange aRingIntersection2;
+ B2DPolyRange aRingIntersectExtraStrip;
+ B2DPolyRange aComplexIntersections;
+ B2DPolyRange aRandomIntersections;
+
+public:
+ // initialise your test code values here.
+ void setUp()
+ {
+ B2DRange aCenter(100, 100, -100, -100);
+ B2DRange aOffside(800, 800, 1000, 1000);
+ B2DRange aNorth(100, 0, -100, -200);
+ B2DRange aSouth(100, 200, -100, 0);
+ B2DRange aEast(0, 100, 200, -100);
+ B2DRange aWest(-200, 100, 0, -100);
+ B2DRange aNorthEast(0, 0, 200, -200);
+ B2DRange aSouthEast(0, 0, 200, 200);
+ B2DRange aSouthWest(0, 0, -200, 200);
+ B2DRange aNorthWest(0, 0, -200, -200);
+
+ B2DRange aNorth2(-150, 50, 150, 350);
+ B2DRange aSouth2(-150, -50, 150, -350);
+ B2DRange aEast2 (50, -150, 350, 150);
+ B2DRange aWest2 (-50, -150,-350, 150);
+
+ aDisjunctRanges.appendElement( aCenter, ORIENTATION_NEGATIVE );
+ aDisjunctRanges.appendElement( aOffside, ORIENTATION_NEGATIVE );
+
+ aEqualRanges.appendElement( aCenter, ORIENTATION_NEGATIVE );
+ aEqualRanges.appendElement( aCenter, ORIENTATION_NEGATIVE );
+
+ aIntersectionN.appendElement( aCenter, ORIENTATION_NEGATIVE );
+ aIntersectionN.appendElement( aNorth, ORIENTATION_NEGATIVE );
+
+ aIntersectionE.appendElement( aCenter, ORIENTATION_NEGATIVE );
+ aIntersectionE.appendElement( aEast, ORIENTATION_NEGATIVE );
+
+ aIntersectionS.appendElement( aCenter, ORIENTATION_NEGATIVE );
+ aIntersectionS.appendElement( aSouth, ORIENTATION_NEGATIVE );
+
+ aIntersectionW.appendElement( aCenter, ORIENTATION_NEGATIVE );
+ aIntersectionW.appendElement( aWest, ORIENTATION_NEGATIVE );
+
+ aIntersectionNE.appendElement( aCenter, ORIENTATION_NEGATIVE );
+ aIntersectionNE.appendElement( aNorthEast, ORIENTATION_NEGATIVE );
+
+ aIntersectionSE.appendElement( aCenter, ORIENTATION_NEGATIVE );
+ aIntersectionSE.appendElement( aSouthEast, ORIENTATION_NEGATIVE );
+
+ aIntersectionSW.appendElement( aCenter, ORIENTATION_NEGATIVE );
+ aIntersectionSW.appendElement( aSouthWest, ORIENTATION_NEGATIVE );
+
+ aIntersectionNW.appendElement( aCenter, ORIENTATION_NEGATIVE );
+ aIntersectionNW.appendElement( aNorthWest, ORIENTATION_NEGATIVE );
+
+ aRingIntersection.appendElement( aNorth2, ORIENTATION_NEGATIVE );
+ aRingIntersection.appendElement( aEast2, ORIENTATION_NEGATIVE );
+ aRingIntersection.appendElement( aSouth2, ORIENTATION_NEGATIVE );
+
+ aRingIntersection2 = aRingIntersection;
+ aRingIntersection2.appendElement( aWest2, ORIENTATION_NEGATIVE );
+
+ aRingIntersectExtraStrip = aRingIntersection2;
+ aRingIntersectExtraStrip.appendElement( B2DRange(0, -25, 200, 25),
+ ORIENTATION_NEGATIVE );
+
+ aComplexIntersections.appendElement( aCenter, ORIENTATION_NEGATIVE );
+ aComplexIntersections.appendElement( aOffside, ORIENTATION_NEGATIVE );
+ aComplexIntersections.appendElement( aCenter, ORIENTATION_NEGATIVE );
+ aComplexIntersections.appendElement( aNorth, ORIENTATION_NEGATIVE );
+ aComplexIntersections.appendElement( aEast, ORIENTATION_NEGATIVE );
+ aComplexIntersections.appendElement( aSouth, ORIENTATION_NEGATIVE );
+ aComplexIntersections.appendElement( aWest, ORIENTATION_NEGATIVE );
+ aComplexIntersections.appendElement( aNorthEast, ORIENTATION_NEGATIVE );
+ aComplexIntersections.appendElement( aSouthEast, ORIENTATION_NEGATIVE );
+ aComplexIntersections.appendElement( aSouthWest, ORIENTATION_NEGATIVE );
+ aComplexIntersections.appendElement( aNorthWest, ORIENTATION_NEGATIVE );
+
+#ifdef GENERATE_RANDOM
+ for( int i=0; i<800; ++i )
+ {
+ B2DRange aRandomRange(
+ getRandomOrdinal( 1000 ),
+ getRandomOrdinal( 1000 ),
+ getRandomOrdinal( 1000 ),
+ getRandomOrdinal( 1000 ) );
+
+ aRandomIntersections.appendElement( aRandomRange, ORIENTATION_NEGATIVE );
+ }
+#else
+ const char* randomSvg="m394 783h404v57h-404zm-197-505h571v576h-571zm356-634h75v200h-75zm-40-113h403v588h-403zm93-811h111v494h-111zm-364-619h562v121h-562zm-134-8h292v27h-292zm110 356h621v486h-621zm78-386h228v25h-228zm475-345h201v201h-201zm-2-93h122v126h-122zm-417-243h567v524h-567zm-266-738h863v456h-863zm262-333h315v698h-315zm-328-826h43v393h-43zm830-219h120v664h-120zm-311-636h221v109h-221zm-500 137h628v19h-628zm681-94h211v493h-211zm-366-646h384v355h-384zm-189-199h715v247h-715zm165-459h563v601h-563zm258-479h98v606h-98zm270-517h65v218h-65zm-44-259h96v286h-96zm-599-202h705v468h-705zm216-803h450v494h-450zm-150-22h26v167h-26zm-55-599h50v260h-50zm190-278h490v387h-490zm-290-453h634v392h-634zm257 189h552v300h-552zm-151-690h136v455h-136zm12-597h488v432h-488zm501-459h48v39h-48zm-224-112h429v22h-429zm-281 102h492v621h-492zm519-158h208v17h-208zm-681-563h56v427h-56zm126-451h615v392h-615zm-47-410h598v522h-598zm-32 316h79v110h-79zm-71-129h18v127h-18zm126-993h743v589h-743zm211-430h428v750h-428zm61-554h100v220h-100zm-353-49h658v157h-658zm778-383h115v272h-115zm-249-541h119v712h-119zm203 86h94v40h-94z";
+ B2DPolyPolygon randomPoly;
+ tools::importFromSvgD(
+ randomPoly,
+ rtl::OUString::createFromAscii(randomSvg));
+ std::for_each(randomPoly.begin(),
+ randomPoly.end(),
+ boost::bind(
+ &B2DPolyRange::appendElement,
+ boost::ref(aRandomIntersections),
+ boost::bind(
+ &B2DPolygon::getB2DRange,
+ _1),
+ ORIENTATION_NEGATIVE,
+ 1));
+#endif
+ }
+
+ void tearDown()
+ {
+ }
+
+ B2DPolyPolygon normalizePoly( const B2DPolyPolygon& rPoly )
+ {
+ B2DPolyPolygon aRes;
+ for( sal_uInt32 i=0; i<rPoly.count(); ++i )
+ {
+ B2DPolygon aTmp=rPoly.getB2DPolygon(i);
+ if( ORIENTATION_NEGATIVE == tools::getOrientation(aTmp) )
+ aTmp.flip();
+
+ aTmp=tools::removeNeutralPoints(aTmp);
+
+ B2DPoint* pSmallest=0;
+ for(B2DPoint* pCurr=aTmp.begin(); pCurr!=aTmp.end(); ++pCurr)
+ {
+ if( ! pSmallest || compare(*pCurr, *pSmallest) )
+ {
+ pSmallest=pCurr;
+ }
+ }
+
+ if( pSmallest )
+ std::rotate(aTmp.begin(),pSmallest,aTmp.end());
+
+ aRes.append(aTmp);
+ }
+
+ // boxclipper & generic clipper disagree slightly on area-less
+ // polygons (one or two points only)
+ aRes = tools::stripNeutralPolygons(aRes);
+
+ // now, sort all polygons with increasing 0th point
+ std::sort(aRes.begin(),
+ aRes.end(),
+ boost::bind(
+ &compare,
+ boost::bind(
+ &B2DPolygon::getB2DPoint,
+ _1,0),
+ boost::bind(
+ &B2DPolygon::getB2DPoint,
+ _2,0)));
+
+ return aRes;
+ }
+
+ void verifyPoly(const char* sName, const char* sSvg, const B2DPolyRange& toTest)
+ {
+ B2DPolyPolygon aTmp1;
+ CPPUNIT_ASSERT_MESSAGE(sName,
+ tools::importFromSvgD(
+ aTmp1,
+ rtl::OUString::createFromAscii(sSvg)));
+
+ const rtl::OUString aSvg=
+ tools::exportToSvgD(toTest.solveCrossovers());
+ B2DPolyPolygon aTmp2;
+ CPPUNIT_ASSERT_MESSAGE(sName,
+ tools::importFromSvgD(
+ aTmp2,
+ aSvg));
+
+ CPPUNIT_ASSERT_MESSAGE(
+ sName,
+ normalizePoly(aTmp2) == normalizePoly(aTmp1));
+ }
+
+ void verifyPoly()
+ {
+ const char* disjunct="m100 100v-200h-200v200zm1100 900v-200h-200v200z";
+ const char* equal="m100 100v-200h-200v200zm200 0v-200h-200v200h200z";
+ const char* intersectionN="m100 0v-100h-200v100zm200 100v-200-100h-200v100 200z";
+ const char* intersectionE="m100 100v-200h-100v200zm200 0v-200h-200-100v200h100z";
+ const char* intersectionS="m100 100v-200h-200v200 100h200v-100zm0 0v-100h-200v100z";
+ const char* intersectionW="m0 100v-200h-100v200zm200 0v-200h-200-100v200h100z";
+ const char* intersectionNE="m100 0v-100h-100v100zm200 0v-200h-200v100h-100v200h200v-100z";
+ const char* intersectionSE="m200 200v-200h-100v-100h-200v200h100v100zm100-100v-100h-100v100z";
+ const char* intersectionSW="m0 100v-100h-100v100zm200 0v-200h-200v100h-100v200h200v-100z";
+ const char* intersectionNW="m100 100v-200h-100v-100h-200v200h100v100zm100-100v-100h-100v100z";
+ const char* ringIntersection="m150 150v-100h-100v100zm300 0v-300h-200v-200h-300v300h200v100h-200v300h300v-200zm0-200v-100h-100v100z";
+ const char* ringIntersection2="m-50-50v-100h-100v100zm100 200v-100h-100v100zm500 0v-300h-200v-200h-300v200h-200v300h200v200h300v-200zm-200-100v-100h100v100zm100-100v-100h-100v100zm100 200v-100h-100v100z";
+ const char* ringIntersectExtraStrip="m-50-50v-100h-100v100zm100 200v-100h-100v100zm500 0v-300h-200v-200h-300v200h-200v300h200v200h300v-200zm-200-100v-100h100v25h-50v50h50v25zm150-25v-50h-150v50zm100-75v-100h-100v100zm100 200v-100h-100v100z";
+ // TODO: old clipper impl. debug difference
+ //const char* complexIntersections="m100 0h-100v-100 100h-100 100v100-100zm0 0zm200 0h-100v-100h-100v-100 100h-100v100h-100 100v100h100v100-100h100v-100zm0 0h-100v-100 100h-100 100v100-100h100zm0 0v-100h-100-100v100 100h100 100v-100zm100 0v-100h-100v-100h-100-100v100h-100v100 100h100v100h100 100v-100h100v-100zm-200 0zm100 0v-100h-100-100v100 100h100 100v-100zm100 100v-200-100h-200-100-100v100 200 100h100 100 200v-100zm-200-100zm1000 1000v-200h-200v200z";
+ const char* complexIntersections="m0 0zm0 0zm0 0zm0 0v-100 100h-100 100v100-100h100zm-100 0v-100 100h-100 100v100-100h100zm0 0v-100h-100-100v100 100h100 100v-100zm0 0v-100h-100-100v100 100h100 100v-100zm0 0v-100h-100v-100 100h-100v100h-100 100v100h100v100-100h100v-100h100zm-100-100v-100h-100-100v100h-100v100 100h100v100h100 100v-100h100v-100-100zm0 0v-100h-200-100-100v100 200 100h100 100 200v-100-200zm600 900v200h200v-200z";
+ const char* randomIntersections="m63 457v-393h-43v393zm114 63v-8h-48v8zm-14 477v-127h-18v127zm693-923v-5h-119v5zm-260 457v-1h-14v1zm-220-375v-27h-8v27zm78 755v-22h-7v22zm203-774v-8h-158v8zm-108 375v-17h23v17zm813-19v-189h-21v-12h-26v-54h-17v-69h-25v-22h-62v-73h104v-5h-104-15v-17h-49v-1h-8v-16h-119v16h-386v18h-38-24v34h-23v26h-23v-26h-8v26h-18v27h18v339h8v-339h23v339h8v17h-8v13h8v5h-8v1h8v42h15v20h17v94h18 3v224h165v39h130v2h75v4h98v-4h153v-2h77v-20h4v-28h11v-218h-11v-27h3v-1h8v-17h-8v-63h8v-51h18v-32zm-581 32v-13h-14v13zm-78-78v-7h-32v7zm124 14v-21h-14v21zm595 32v-189h-26v-12h-4v-9h-13v-45h-13v-10h-12v-59h-62v-22h-26v-10h11v-63h15v-5h-15-49v-17h-8v-1h-119v1h-107v17h-279-38v34h-24v26h-23v27h23v284h-15v55h15v17h-15v13h15v5h-15v1h15v42h17v20h18v94h3 14v62h8v48h90v32h18v61h35v21h8v2h122v37h75v2h98v-2h153v-20h77v-28h4v-29h5v-40h-5v-149h-1v-27h1v-1h3v-17h-3v-46h3v-17-51h8v-32zm-563 2v-13h-14v13zm198 30v-13h-39v13zm204-43v-21h3v21zm-168-21v-21h-39v21zm306 0v-21h-5v21zm178 115v-272h-20v-12h-2v-54h-21v-164h1v-22h-27v-48h-743v47h-23v18h-71v24h-8v419h-39v19h60v156h66 32v202h-72v110h79v-88h11v39h3v48h621v-14h96v-82h35v-326zm-570-420v-4h-156v4zm63 481v-18h-11v18zm72 0v-25h-14v25zm465-112v-13h-5v13zm-46-43v-21h1v21zm-37-21v-21h-12v21zm-352 21v-21h23v21zm-23 30v-17h23v17zm-23 18v-5h23v5zm-23 82v-19h23v19zm272 75v-3h-35v3zm-76-192v-13h-39v13zm150 30v-13h-35v13zm-76 6v-1h-39v1zm11 106v-25h-11v25zm150 160v-14h-75v14zm318-304v-11h-13v-43h-2v-2h-10v-37h-4v37h-27v3h-31v-3-37h-5v37h-43v3h-2v21h2v21h-2v30h-1v-30h-8v-21h8v-21h-8v-3h-5v-62h5v-11h-5v-29h-8v-52h-15v-17-38h-15v-52h-89v16h-22v36h-175v55h-15v1h-25v51h-23v-41h-14v41h-2v105h-4v21h4v21h-4v13h4v17h-4-18v13h18v5h-18v1h18v42h4v11h2v9h14v-9h23v9h40v19h-40v25h40v2h82v2h75v43h-75v3h75 40v60h35v-60h23 34 12 15v-3h-15v-43h15v-48h10v-37h11v-31h1v1h45v30h5v-30h20v-1h11v1h8v30h19v20h3v-20h1v-30h10v-1h2v-32zm-146-329v-1h-2v1zm-117 211v-11 11zm-76 0v-11h-13v11zm13 65v-65h1v65zm-1 42v-21h1v16h35v5zm-36 30v-17h36v17zm-36 18v-5h36v5zm180-5v-13h-13v-17h5v-13h-5v-21h5v-21h-5v-3h-8v-62h8v-11h-8v-29h-9v-51h-6v-1-17h-15v-38h-54v-36h-35v36h-22v38h-67v17h-108v1h-15v51h-25v105h-23v-105h-14v105h-2v21h2v21h-2v13h2v17h-2-4v13h4v5h-4v1h4v42h2v11h14v-11h23v11h40v9h82v19h-82v25h82v2h75v2h40v43h-40v3h40 35 23v-3h-23v-43h23v-2h34v2h12v-2h6v-46h9v-20h8v-17h2v-26h-2v-5zm-127-64v-21 21zm89 51v-17h3v17zm-57-17v-13h-35v13zm58 61v-26h-19v-5h19v-13h-23v-17h23v-13h-23v-21h23v-21h-23v-65h23v-11h-23v-14h-35v-15 15h-22v14h-18v11h18v65h-18v21h18v16h22v5h-22v13h22v17h-22-18v13h18v5h-18v1h18v25h22v17h35v-17zm0-25v-1h-35v1zm-22-390v6h-175v5h-31v-15h228v4zm344 352v-189h-2v-12h-21v-54h-26v-164h26v-5h-26v-17h-119v-36h-562v35h-62v18h-23v34h-23v-10h-48v419h-8v8h8v5h71v5h-58v1h58v42h8v114h32 18v224h3v39h165v34h456v-32h77v-2h4v-20h11v-28h4v-218h-4v-28h36v-17h-36v-63h39v-83zm-50 0v-11h-1v-43h-3v-2h-6v-39h-4v-34h-13v-60h-12v-12h-31v72h-31v-72-9h-59v-17-38h-5v-59h-8v-5h8v-1h-8v-16h-2v16h-13v-11h-15v-5h-89v5h-22v11h-175v6h-15v7h-25v16h-43v36h-18v66h-54v-107h-32v107h-4v41h-8v105h-6v7h6v14h8v21h-8v13h8v17h-8-14v13h14v5h-14v1h14v42h8v20h90v19h-34v7h-15v68h26v-50h23v50h18 4v62h16v-62h15v110h8v10h3v22h119v11h75v50h75v-50h23v-11h34v11h48v-11h30v-22h21v-120h20v-3h11v3h30v-3h13-13v-27h13v-1h17v-17h-17v-46h17v-17h6v-51h3v-32zm-256-32v-21h-35v-65h35v-11h-35v-14 14h-22v11h22v65h-22v21h22v16-16zm89 69v-5h3v5zm-3 26v-26h-31v-5h31v-13h-31v-17h31v-13h-31v-21h31v-21h-31v-65h31v-11h-31v-14h-23v-15h-35v-51 51h-22v15h-18v14h-35v11h35v65h-35v21h35v16h18v5h-18v13h18v17h-18-36-39-61v13h61v5h-61v1h61v25h39v-25h36v25h18v17h22v11h35v-11h23v-17zm-19-25v-1h-4v-5h4v-13h-4-35-22v13h22v5h-22v1h22v25h35v-25zm23 252v-36h34v36zm-34-99v-43h34v43zm35-128v-26h-8v-5h8v-13h-8v-17h8v-13h-8v-21h8v-21h-8v-3h-9v-62h9v-11h-9v-29h-6v-51-1h-15v-17h-54v-38h-35v38h-22v11h-53v6h-14v1h-108v51h-15v105h-25v21h25v21h-25v13h25v17h-25-23-14-2v13h2v5h-2v1h2v42h14v-42h23v42h40v11h82v9h75v46h40v2h35v-2h23v-4h31v-42h3v46h12v-46h6v-20h9v-17zm-15-61v-13h-12v13zm12 30v-13h-12v13zm12 31v-26h-12v26zm12 131v-3h-12v3zm12 110v-14h-12v14zm27-241v-26h-9v-5h9v-13h-9v-17h9v-13h-9v-21h9v-21h-9v-3h-6v-62h6v-11h-6v-29-51h-15v-1h-54v-17h-35v11h-22v6h-53v1h-14v51h-108v105h-15v21h15v21h-15v13h15v17h-15-25v13h25v5h-25v1h25v25h15v17h21v6h61v5h75v9h18v42h22v4h35v-4h23v-42h31v-9h3v9h12v-9-11h6v-17zm0 0v-26h-6v-5h6v-13h-6v-17h6v-13h-6v-21h6v-21h-6v-3-62-11-29h-15v-51h-54v-1h-35v-6 6h-22v1h-53v51h-14v24h-87v81h-21v21h21v21h-21v13h21v17h-21-15v13h15v5h-15v1h15v25h21v17h61v6h39v-6h36v11h18v9h22v42h35v-42h23v-9h31v-11h3v11h12v-11-17zm0 0v-26-5-13-17-13-21-21-3h-12v3h-3v-65h15v-11h-15v-29h-54v-51h-35v-1 1h-22v51h-53v29h-1v-5h-13v5h-26v76h-61v21h61v21h-61v13h61v17h-61-21v13h21v5h-21v1h21v25h61v17h39v-17h36v17h18v11h22v9h35v-9h23v-11h31v-17h3v17h12v-17zm15-419v-12h-2v12zm186 356v-56h-8v-133h-4v-12h-13v-9h-13v-45h-12v-10h-62v-59-6h-26v-16h-33v-10h33v-12h-33v-22h-5v-29h49v-5h-49-8v-17h-119v17h-107-279v34h-38v26h-24v27h24v179h-7v105h-17v55h17v17h-17v13h17v5h-17v1h17v42h18v20h3v94h14 8v62h41v37h26v-37h23v48h18v32h35v61h8v21h122v2h75v37h98v-37h34v17h119v-57h11v29h66v-29h4v-40h-4v-26h3v-123h-3v-27h3v-1h1v-17h-1v-46h1v-17h3v-51-32zm0 0v-54h-4v-2h-3v-73h-10v-60h-13v-12h-12v-9h-31v9h-31v-9-55h-59v-59h-5v-5h5v-1h-5v-16h-8v-10h8v-12h-8v-22h-119v34h117v10h-28v-6h-89v6h-22v5h-175v11h-40v13h-147v11h-4v107h-8v41h-6v105h-22v21h28v21h-17v13h17v17h-14-3v13h3v5h-3v1h3v42h14v20h8v94h41 26 23 18v62h4v48h31v10h8v22h3v11h119v50h75v21h98v-71h34v71h48v-71h30v-11h21v-22h20v-120h11v120h43v-123h17-17v-27h17v-1h6v-17h-6v-46h6v-17h3v-51h1v-32zm-4 0v-11h-6v-43h-4v-2h-13v-39h-12v-34h-4v34h-27v2h-31v-2-34h-48v36h-2v37h-1v-73h-8v-29-52h-5v-17h-8v-38h-15v-59h-15v-6h-89v6h-22v7h-175v16h-15v36h-25v55h-39v11h-4v41h-18v105h-54v-105h-32v105h-4v7h4v14h86v21h-86v13h86v17h-86-4v13h4v5h-4v1h4v42h86v11h18v9h4v19h-4v25h4v50h16v-48h23v45h-8v3h8 122v96h-119v14h119v10h75v22h75v-22h23v-10h34v10h48v-24h-36v-36h15v-60h21v-3h-11v-43h2v15h9v-15h46v15h5v-15h20v-2h-20v-46h20v-37h11v37h8v46h-8v2h8v15h22v-15h1v-2h-1v-46h1v-17h12v-20h13v-31h4v-32zm-142 148v-2h-9v2zm9-2v-46h46v46zm-46 45v-28h46v28zm67-191v-11h-1v-42h-3v42h-19v11h19v32h3v-32zm-61 0v-11h-5v11zm96 0v-11h-4v-43h-13v-2h-2v-37h-10v-2h-4v2h-27v37h-31v-37-2h-5v2h-43v37h-2v3h-1v-3h-8v-62-11-29h-5v-52h-8v-17h-15v-38-52h-15v-7h-89v7h-22v16h-175v36h-15v55h-25v1h-37v10h-2v41h-4v105h-18v21h18v21h-18v13h18v17h-18-86v13h86v5h-86v1h86v42h18v11h4v9h2v19h-2v25h2v2h14v-2h23v2h40v2h82v43h-122v3h122 75v96h-75v14h75v10h75v-10h23v-14h-23v-36h23v-60h34v60h12v-60h15 10v-3h-10v-43h10v-48h11v-37h46v37h5v-37h20v-30h11v30h8v37h22v-17h1v-20h12v-31h13v-32zm-13 0v-11h-2v-43h-10v-2h-4v2h-19v1h-8v42h-31v-21-21-3h-5v3h-43v21h43v21h-43v11h43v19h-45v13h45v1h5v-1h20v-13h-20v-19h31v32h8v1h19v30h3v-30h1v-1h10v-32zm-72 148v-2h-5v2zm5 43h-5zm66-191v-11h-3v11zm-38 146v-46h11v46zm-11 45v-28h11v28zm-11 149v-4h11v4zm-11 40v-40h-8v40zm92-380v-54-2h-4v-133h-13v-12h-13v-9h-12v-45h-31v45h-31v-55-59h-59v-5h33v-1h-33v-16h-5v-10h5v-12h-5v-22h-8v-29h8v-5h-8-119-107v5h107v29h-386v26h-38v27h40v20h-4v11h-14v148h-22v105h-7v55h18v17h-18v13h18v5h-18v1h18v42h3v20h14v94h8 41v62h26v-62h23v62h18v48h4v10h31v22h8v61h122v21h75v2h98v-2h34v2h99v-84h20v-22h11v22h43v-22h23v-123h-6v-27h6v-1h3v-17h-3v-46h3v-17h1v-51h3v-32zm-43 148v-2h-22v2zm22 43h-30zm66 189v-40h-66v40zm41-380v-11h-10v-43h-4v1h-19v42h-8v11h8v32h19v1h3v-1h1v-32zm38 0v-11h-3v-43h-6v-2h-4v-39h-13v-34h-12v-60h-4v60h-27v34h-31v-34-72h-48v72h-3v-29h-8v-52-17h-5v-38h-8v-59h-15v-6h-15v-11h-89v11h-22v6h-175v7h-15v16h-25v36h-43v66h-18v41h-54v-41h-32v41h-4v105h-8v7h8v14h4v21h-4v13h4v17h-4-8v13h8v5h-8v1h8v42h4v11h86v9h18v19h-18v25h18v50h4 16 15 8v110h3v10h119v22h75v11h75v-11h23v-22h34v22h48v-22h30v-24h-30v-96h51v-3h20-20v-28h20v-15h11v15h8v1h22v-1h13v-17h-12v-46h12v-17h17v-51h6v-32z";
+
+ verifyPoly("disjunct", disjunct, aDisjunctRanges);
+ verifyPoly("equal", equal, aEqualRanges);
+ verifyPoly("intersectionN", intersectionN, aIntersectionN);
+ verifyPoly("intersectionE", intersectionE, aIntersectionE);
+ verifyPoly("intersectionS", intersectionS, aIntersectionS);
+ verifyPoly("intersectionW", intersectionW, aIntersectionW);
+ verifyPoly("intersectionNE", intersectionNE, aIntersectionNE);
+ verifyPoly("intersectionSE", intersectionSE, aIntersectionSE);
+ verifyPoly("intersectionSW", intersectionSW, aIntersectionSW);
+ verifyPoly("intersectionNW", intersectionNW, aIntersectionNW);
+ verifyPoly("ringIntersection", ringIntersection, aRingIntersection);
+ verifyPoly("ringIntersection2", ringIntersection2, aRingIntersection2);
+ verifyPoly("ringIntersectExtraStrip", ringIntersectExtraStrip, aRingIntersectExtraStrip);
+ verifyPoly("complexIntersections", complexIntersections, aComplexIntersections);
+ verifyPoly("randomIntersections", randomIntersections, aRandomIntersections);
+ }
+
+ void dumpSvg(const char* pName,
+ const ::basegfx::B2DPolyPolygon& rPoly)
+ {
+ (void)pName; (void)rPoly;
+#if defined(VERBOSE)
+ fprintf(stderr, "%s - svg:d=\"%s\"\n",
+ pName, rtl::OUStringToOString(
+ basegfx::tools::exportToSvgD(rPoly),
+ RTL_TEXTENCODING_UTF8).getStr() );
+#endif
+ }
+
+ void getPolyPolygon()
+ {
+ dumpSvg("disjunct",aDisjunctRanges.solveCrossovers());
+ dumpSvg("equal",aEqualRanges.solveCrossovers());
+ dumpSvg("intersectionN",aIntersectionN.solveCrossovers());
+ dumpSvg("intersectionE",aIntersectionE.solveCrossovers());
+ dumpSvg("intersectionS",aIntersectionS.solveCrossovers());
+ dumpSvg("intersectionW",aIntersectionW.solveCrossovers());
+ dumpSvg("intersectionNE",aIntersectionNE.solveCrossovers());
+ dumpSvg("intersectionSE",aIntersectionSE.solveCrossovers());
+ dumpSvg("intersectionSW",aIntersectionSW.solveCrossovers());
+ dumpSvg("intersectionNW",aIntersectionNW.solveCrossovers());
+ dumpSvg("ringIntersection",aRingIntersection.solveCrossovers());
+ dumpSvg("ringIntersection2",aRingIntersection2.solveCrossovers());
+ dumpSvg("aRingIntersectExtraStrip",aRingIntersectExtraStrip.solveCrossovers());
+ dumpSvg("complexIntersections",aComplexIntersections.solveCrossovers());
+ dumpSvg("randomIntersections",aRandomIntersections.solveCrossovers());
+
+ CPPUNIT_ASSERT_MESSAGE("getPolyPolygon", true );
+ }
+
+ void validatePoly( const char* pName, const B2DPolyRange& rRange )
+ {
+ B2DPolyPolygon genericClip;
+ const sal_uInt32 nCount=rRange.count();
+ for( sal_uInt32 i=0; i<nCount; ++i )
+ {
+ B2DPolygon aRect=tools::createPolygonFromRect(
+ rRange.getElement(i).head);
+ if( rRange.getElement(i).tail.head == ORIENTATION_NEGATIVE )
+ aRect.flip();
+
+ genericClip.append(aRect);
+ }
+
+#if defined(VERBOSE)
+ fprintf(stderr, "%s input - svg:d=\"%s\"\n",
+ pName, rtl::OUStringToOString(
+ basegfx::tools::exportToSvgD(
+ genericClip),
+ RTL_TEXTENCODING_UTF8).getStr() );
+#endif
+
+ const B2DPolyPolygon boxClipResult=rRange.solveCrossovers();
+ const rtl::OUString boxClipSvg(
+ basegfx::tools::exportToSvgD(
+ normalizePoly(
+ boxClipResult)));
+#if defined(VERBOSE)
+ fprintf(stderr, "%s boxclipper - svg:d=\"%s\"\n",
+ pName, rtl::OUStringToOString(
+ boxClipSvg,
+ RTL_TEXTENCODING_UTF8).getStr() );
+#endif
+
+ genericClip = tools::solveCrossovers(genericClip);
+ const rtl::OUString genericClipSvg(
+ basegfx::tools::exportToSvgD(
+ normalizePoly(
+ genericClip)));
+#if defined(VERBOSE)
+ fprintf(stderr, "%s genclipper - svg:d=\"%s\"\n",
+ pName, rtl::OUStringToOString(
+ genericClipSvg,
+ RTL_TEXTENCODING_UTF8).getStr() );
+#endif
+
+ CPPUNIT_ASSERT_MESSAGE(pName,
+ genericClipSvg == boxClipSvg);
+ }
+
+ void validatePoly()
+ {
+ validatePoly("disjunct", aDisjunctRanges);
+ validatePoly("equal", aEqualRanges);
+ validatePoly("intersectionN", aIntersectionN);
+ validatePoly("intersectionE", aIntersectionE);
+ validatePoly("intersectionS", aIntersectionS);
+ validatePoly("intersectionW", aIntersectionW);
+ validatePoly("intersectionNE", aIntersectionNE);
+ validatePoly("intersectionSE", aIntersectionSE);
+ validatePoly("intersectionSW", aIntersectionSW);
+ validatePoly("intersectionNW", aIntersectionNW);
+ // subtle differences on Solaris Intel, comparison not smart enough
+ // (due to floating point inaccuracies)
+ //validatePoly("ringIntersection", aRingIntersection);
+ //validatePoly("ringIntersection2", aRingIntersection2);
+ //validatePoly("ringIntersectExtraStrip", aRingIntersectExtraStrip);
+ // generic clipper buggy here, likely
+ //validatePoly("complexIntersections", aComplexIntersections);
+ //validatePoly("randomIntersections", aRandomIntersections);
+ }
+
+ // Change the following lines only, if you add, remove or rename
+ // member functions of the current class,
+ // because these macros are need by auto register mechanism.
+
+ CPPUNIT_TEST_SUITE(boxclipper);
+ CPPUNIT_TEST(validatePoly);
+ CPPUNIT_TEST(verifyPoly);
+ CPPUNIT_TEST(getPolyPolygon);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+// -----------------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::boxclipper);
+} // namespace basegfx2d
diff --git a/basegfx/test/clipstate.cxx b/basegfx/test/clipstate.cxx
new file mode 100644
index 000000000000..3d9f59979aa7
--- /dev/null
+++ b/basegfx/test/clipstate.cxx
@@ -0,0 +1,178 @@
+/*************************************************************************
+ *
+ * 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_basegfx.hxx"
+// autogenerated file with codegen.pl
+
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
+
+#include <basegfx/tools/b2dclipstate.hxx>
+#include <basegfx/range/b2dpolyrange.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/numeric/ftools.hxx>
+
+#include <boost/bind.hpp>
+
+using namespace ::basegfx;
+
+
+namespace basegfx2d
+{
+
+class clipstate : public CppUnit::TestFixture
+{
+private:
+ tools::B2DClipState aUnion1;
+ tools::B2DClipState aUnion2;
+ tools::B2DClipState aIntersect;
+ tools::B2DClipState aXor;
+ tools::B2DClipState aSubtract;
+
+public:
+ void setUp()
+ {
+ B2DRange aCenter(100, 100, -100, -100);
+ B2DRange aNorth(-10, -110, 10, -90);
+ B2DRange aWest(-110, -10, -90, 10);
+ B2DRange aSouth(-10, 110, 10, 90);
+ B2DRange aEast(110, -10, 90, 10);
+
+ aUnion1.unionRange(aCenter);
+ aUnion1.unionRange(aNorth);
+ aUnion1.unionRange(aWest);
+ aUnion1.unionRange(aSouth);
+ aUnion1.unionRange(aEast);
+
+ aUnion2.makeNull();
+ aUnion2.unionRange(aCenter);
+ aUnion2.unionRange(aNorth);
+ aUnion2.unionRange(aWest);
+ aUnion2.unionRange(aSouth);
+ aUnion2.unionRange(aEast);
+
+ aIntersect.intersectRange(aCenter);
+ aIntersect.intersectRange(aNorth);
+ aIntersect.intersectRange(aWest);
+ aIntersect.intersectRange(aSouth);
+ aIntersect.intersectRange(aEast);
+
+ aXor.makeNull();
+ aXor.xorRange(aCenter);
+ aXor.xorRange(aNorth);
+ aXor.xorRange(aWest);
+ aXor.xorRange(aSouth);
+ aXor.xorRange(aEast);
+
+ aSubtract.intersectRange(aCenter);
+ aSubtract.subtractRange(aNorth);
+ aSubtract.subtractRange(aWest);
+ aSubtract.subtractRange(aSouth);
+ aSubtract.subtractRange(aEast);
+ }
+
+ void tearDown()
+ {}
+
+ void verifyPoly(const char* sName, const char* sSvg, const tools::B2DClipState& toTest)
+ {
+#if defined(VERBOSE)
+ fprintf(stderr, "%s - svg:d=\"%s\"\n",
+ sName, rtl::OUStringToOString(
+ basegfx::tools::exportToSvgD(toTest.getClipPoly()),
+ RTL_TEXTENCODING_UTF8).getStr() );
+#endif
+
+ B2DPolyPolygon aTmp1;
+ CPPUNIT_ASSERT_MESSAGE(sName,
+ tools::importFromSvgD(
+ aTmp1,
+ rtl::OUString::createFromAscii(sSvg)));
+
+ const rtl::OUString aSvg=
+ tools::exportToSvgD(toTest.getClipPoly());
+ B2DPolyPolygon aTmp2;
+ CPPUNIT_ASSERT_MESSAGE(sName,
+ tools::importFromSvgD(
+ aTmp2,
+ aSvg));
+
+ CPPUNIT_ASSERT_MESSAGE(
+ sName,
+ aTmp2 == aTmp1);
+ }
+
+ void verifySimpleRange()
+ {
+ const char* unionSvg="m100 10v90h-90v10h-20v-10h-90v-90h-10v-20h10v-90h90v-10h20v10h90v90h10v20z";
+ const char* intersectSvg="m-100 10v-20h10v20zm80 90v-10h20v10zm-20-190v-10h20v10zm80 100v-20h10v20z";
+ const char* xorSvg="m-100 10h10v-20h-10zm90 110h20v-10h-20zm0-180h20v-10h-20zm100 110h10v-20h-10zm10 20v90h-90v10h-20v-10h-90v-90h-10v-20h10v-90h90v-10h20v10h90v90h10v20z";
+ const char* subtractSvg="m-90 10v-20h-10v-90h90v10h20v-10h90v90h-10v20h10v90h-90v-10h-20v10h-90v-90z";
+
+ CPPUNIT_ASSERT_MESSAGE("cleared clip stays empty under union operation",
+ aUnion1.isCleared());
+ verifyPoly("union", unionSvg, aUnion2);
+ verifyPoly("intersect", intersectSvg, aIntersect);
+ verifyPoly("xor", xorSvg, aXor);
+ verifyPoly("subtract", subtractSvg, aSubtract);
+ }
+
+ void verifyMixedClips()
+ {
+ tools::B2DClipState aMixedClip;
+
+ const char* unionSvg="m100 10v90h-90v10h-20v-10h-90v-90h-10v-20h10v-90h90v-10h20v10h90v90h10v20z";
+
+ B2DPolyPolygon aTmp1;
+ tools::importFromSvgD(
+ aTmp1,
+ rtl::OUString::createFromAscii(unionSvg));
+
+ aMixedClip.intersectPolyPolygon(aTmp1);
+ aMixedClip.subtractRange(B2DRange(-20,-150,20,0));
+ aMixedClip.subtractRange(B2DRange(-150,-20,0,20));
+ aMixedClip.xorRange(B2DRange(-150,-150,150,150));
+
+ const char* mixedClipSvg="m0 0v20h-100v80h90v10h20v-10h90v-90h10v-20h-10v-90h-80v100zm-40-20v-80h-80v80zm-50 170v-300h300v300z";
+ verifyPoly("mixed clip", mixedClipSvg, aMixedClip);
+ }
+
+ CPPUNIT_TEST_SUITE(clipstate);
+ CPPUNIT_TEST(verifySimpleRange);
+ CPPUNIT_TEST(verifyMixedClips);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+// -----------------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::clipstate);
+} // namespace basegfx2d
diff --git a/basegfx/test/export.map b/basegfx/test/export.map
index 709047ae63e5..3308588ef6f8 100644
--- a/basegfx/test/export.map
+++ b/basegfx/test/export.map
@@ -25,9 +25,9 @@
#
#*************************************************************************
-UDK_3.1 {
+UDK_3_0_0 {
global:
- registerAllTestFunction;
+ cppunitTestPlugIn;
local:
*;
diff --git a/basegfx/test/genericclipper.cxx b/basegfx/test/genericclipper.cxx
new file mode 100644
index 000000000000..84230a084493
--- /dev/null
+++ b/basegfx/test/genericclipper.cxx
@@ -0,0 +1,159 @@
+/*************************************************************************
+ *
+ * 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_basegfx.hxx"
+// autogenerated file with codegen.pl
+
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
+
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/curve/b2dcubicbezier.hxx>
+#include <basegfx/curve/b2dbeziertools.hxx>
+#include <basegfx/range/b2dpolyrange.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
+#include <basegfx/polygon/b2dpolygonclipper.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/numeric/ftools.hxx>
+
+#include <boost/bind.hpp>
+
+using namespace ::basegfx;
+
+
+namespace basegfx2d
+{
+
+class genericclipper : public CppUnit::TestFixture
+{
+private:
+ B2DPolygon aSelfIntersecting;
+ B2DPolygon aShiftedRectangle;
+
+public:
+ // initialise your test code values here.
+ void setUp()
+ {
+ aSelfIntersecting.append(B2DPoint(0, 0));
+ aSelfIntersecting.append(B2DPoint(0, 100));
+ aSelfIntersecting.append(B2DPoint(75, 100));
+ aSelfIntersecting.append(B2DPoint(75, 50));
+ aSelfIntersecting.append(B2DPoint(25, 50));
+ aSelfIntersecting.append(B2DPoint(25, 150));
+ aSelfIntersecting.append(B2DPoint(100,150));
+ aSelfIntersecting.append(B2DPoint(100,0));
+ aSelfIntersecting.setClosed(true);
+
+ aShiftedRectangle = tools::createPolygonFromRect(
+ B2DRange(0,90,20,150));
+ }
+
+ void tearDown()
+ {}
+
+ void validate(const char* pName,
+ const char* pValidSvgD,
+ B2DPolyPolygon (*pFunc)(const B2DPolyPolygon&, const B2DPolyPolygon&))
+ {
+ const B2DPolyPolygon aSelfIntersect(
+ tools::prepareForPolygonOperation(aSelfIntersecting));
+ const B2DPolyPolygon aRect(
+ tools::prepareForPolygonOperation(aShiftedRectangle));
+#if defined(VERBOSE)
+ fprintf(stderr, "%s input LHS - svg:d=\"%s\"\n",
+ pName, rtl::OUStringToOString(
+ basegfx::tools::exportToSvgD(
+ aSelfIntersect),
+ RTL_TEXTENCODING_UTF8).getStr() );
+ fprintf(stderr, "%s input RHS - svg:d=\"%s\"\n",
+ pName, rtl::OUStringToOString(
+ basegfx::tools::exportToSvgD(
+ aRect),
+ RTL_TEXTENCODING_UTF8).getStr() );
+#endif
+
+ const B2DPolyPolygon aRes=
+ pFunc(aSelfIntersect, aRect);
+
+#if defined(VERBOSE)
+ fprintf(stderr, "%s - svg:d=\"%s\"\n",
+ pName, rtl::OUStringToOString(
+ basegfx::tools::exportToSvgD(aRes),
+ RTL_TEXTENCODING_UTF8).getStr() );
+#endif
+
+ rtl::OUString aValid=rtl::OUString::createFromAscii(pValidSvgD);
+
+ CPPUNIT_ASSERT_MESSAGE(pName,
+ basegfx::tools::exportToSvgD(aRes) == aValid);
+ }
+
+ void validateOr()
+ {
+ const char* pValid="m0 0h100v150h-75v-50h-5v50h-20v-50-10zm75 10v-50h-50v50z";
+ validate("validateOr", pValid, &tools::solvePolygonOperationOr);
+ }
+
+ void validateXor()
+ {
+ const char* pValid="m0 0h100v150h-75v-50h-5v50h-20v-50-10zm0 10h20v-10h-20zm75 10v-50h-50v50z";
+ validate("validateXor", pValid, &tools::solvePolygonOperationXor);
+ }
+
+ void validateAnd()
+ {
+ const char* pValid="m0 100v-10h20v10z";
+ validate("validateAnd", pValid, &tools::solvePolygonOperationAnd);
+ }
+
+ void validateDiff()
+ {
+ const char* pValid="m0 90v-90h100v150h-75v-50h-5v-10zm55 10v-50h-50v50z";
+ validate("validateDiff", pValid, &tools::solvePolygonOperationDiff);
+ }
+
+ // Change the following lines only, if you add, remove or rename
+ // member functions of the current class,
+ // because these macros are need by auto register mechanism.
+
+ CPPUNIT_TEST_SUITE(genericclipper);
+ CPPUNIT_TEST(validateOr);
+ CPPUNIT_TEST(validateXor);
+ CPPUNIT_TEST(validateAnd);
+ CPPUNIT_TEST(validateDiff);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+// -----------------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::genericclipper);
+} // namespace basegfx2d
diff --git a/basegfx/test/makefile.mk b/basegfx/test/makefile.mk
index dd92dfedaa0c..2c0f30c291a9 100644
--- a/basegfx/test/makefile.mk
+++ b/basegfx/test/makefile.mk
@@ -36,39 +36,33 @@ ENABLE_EXCEPTIONS=TRUE
.INCLUDE : settings.mk
+CFLAGSCXX += $(CPPUNIT_CFLAGS)
+
# --- Common ----------------------------------------------------------
SHL1OBJS= \
- $(SLO)$/basegfx1d.obj \
- $(SLO)$/basegfx2d.obj \
- $(SLO)$/basegfx3d.obj \
- $(SLO)$/testtools.obj
-
-# linking statically against basegfx parts
-SHL1LIBS=\
- $(SLB)$/curve.lib \
- $(SLB)$/matrix.lib \
- $(SLB)$/numeric.lib \
- $(SLB)$/point.lib \
- $(SLB)$/polygon.lib \
- $(SLB)$/range.lib \
- $(SLB)$/tuple.lib \
- $(SLB)$/tools.lib \
- $(SLB)$/color.lib \
- $(SLB)$/vector.lib
+ $(SLO)$/basegfx1d.obj \
+ $(SLO)$/basegfx2d.obj \
+ $(SLO)$/basegfx3d.obj \
+ $(SLO)$/boxclipper.obj \
+ $(SLO)$/basegfxtools.obj \
+ $(SLO)$/clipstate.obj \
+ $(SLO)$/genericclipper.obj \
+ $(SLO)$/testtools.obj
SHL1TARGET= basegfx_tests
SHL1STDLIBS= \
+ $(BASEGFXLIB) \
$(SALLIB) \
$(CPPUHELPERLIB) \
- $(CPPULIB) \
- $(TESTSHL2LIB) \
+ $(CPPULIB) \
$(CPPUNITLIB)
SHL1IMPLIB= i$(SHL1TARGET)
DEF1NAME =$(SHL1TARGET)
SHL1VERSIONMAP = export.map
+SHL1RPATH = NONE
# END ------------------------------------------------------------------
@@ -81,13 +75,6 @@ SLOFILES=$(SHL1OBJS)
.INCLUDE : target.mk
.INCLUDE : _cppunit.mk
-# --- Enable testshl2 execution in normal build ------------------------
-
-$(MISC)$/unittest_succeeded : $(SHL1TARGETN)
- @echo ----------------------------------------------------------
- @echo - start unit test on library $(SHL1TARGETN)
- @echo ----------------------------------------------------------
- $(TESTSHL2) -sf $(mktmp ) -forward $(BIN)$/ $(SHL1TARGETN)
- $(TOUCH) $@
-
-ALLTAR : $(MISC)$/unittest_succeeded
+.IF "$(verbose)"!="" || "$(VERBOSE)"!=""
+CDEFS+= -DVERBOSE
+.ENDIF
diff --git a/basegfx/test/tests.txt b/basegfx/test/tests.txt
deleted file mode 100644
index fc2d33ab51d5..000000000000
--- a/basegfx/test/tests.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-# Jobfile
-basegfx1d.b1drange
-basegfx2d.b2dcubicbezier
-basegfx2d.b2dhommatrix
-basegfx2d.b2dhompoint
-basegfx2d.b2dpoint
-basegfx2d.b2dpolygon
-basegfx2d.b2dpolygontools
-basegfx2d.b2dpolypolygon
-basegfx2d.b2dquadraticbezier
-basegfx2d.b2drange
-basegfx2d.b2dtuple
-basegfx2d.b2dvector
-basegfx3d.b3dhommatrix
-basegfx3d.b3dhompoint
-basegfx3d.b3dhompoint
-basegfx3d.b3dpoint
-basegfx3d.b3drange
-basegfx3d.b3dtuple
-basegfx3d.b3dvector
diff --git a/canvas/inc/canvas/base/graphicdevicebase.hxx b/canvas/inc/canvas/base/graphicdevicebase.hxx
index 20de68094028..6750c28e22c8 100644
--- a/canvas/inc/canvas/base/graphicdevicebase.hxx
+++ b/canvas/inc/canvas/base/graphicdevicebase.hxx
@@ -30,11 +30,11 @@
#include <rtl/ref.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/util/XUpdatable.hpp>
#include <com/sun/star/rendering/XGraphicDevice.hpp>
#include <com/sun/star/rendering/XColorSpace.hpp>
-#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
#include <canvas/parametricpolypolygon.hxx>
#include <canvas/propertysethelper.hxx>
@@ -47,8 +47,7 @@ namespace canvas
/** Helper template base class for XGraphicDevice implementations.
This base class provides partial implementations of the
- XGraphicDevice-related interface, such as
- XParametricPolyPolygon2DFactory and XColorSpace.
+ XGraphicDevice-related interface, such as XColorSpace.
This template basically interposes itself between the full
interface you implement (i.e. not restricted to XGraphicDevice
@@ -246,7 +245,7 @@ namespace canvas
return maDeviceHelper.createVolatileAlphaBitmap( this, size );
}
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2DFactory > SAL_CALL getParametricPolyPolygonFactory( ) throw (::com::sun::star::uno::RuntimeException)
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > SAL_CALL getParametricPolyPolygonFactory( ) throw (::com::sun::star::uno::RuntimeException)
{
return this;
}
@@ -265,79 +264,26 @@ namespace canvas
return maDeviceHelper.enterFullScreenMode( bEnter );
}
- // XParametricPolyPolygon2DFactory
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createLinearHorizontalGradient( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, const ::com::sun::star::uno::Sequence< double >& stops ) throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException)
+ // XMultiServiceFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >(
- ParametricPolyPolygon::createLinearHorizontalGradient( this,
- colors,
- stops ) );
+ ParametricPolyPolygon::create(this,
+ aServiceSpecifier,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >()));
}
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createAxialHorizontalGradient( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, const ::com::sun::star::uno::Sequence< double >& stops ) throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException)
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& aServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >(
- ParametricPolyPolygon::createAxialHorizontalGradient( this,
- colors,
- stops ) );
+ ParametricPolyPolygon::create(this,
+ aServiceSpecifier,
+ Arguments));
}
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createEllipticalGradient( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, const ::com::sun::star::uno::Sequence< double >& stops, const ::com::sun::star::geometry::RealRectangle2D& boundRect ) throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException)
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw (::com::sun::star::uno::RuntimeException)
{
- return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >(
- ParametricPolyPolygon::createEllipticalGradient( this,
- colors,
- stops,
- boundRect ) );
- }
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createRectangularGradient( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, const ::com::sun::star::uno::Sequence< double >& stops, const ::com::sun::star::geometry::RealRectangle2D& boundRect ) throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException)
- {
- return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >(
- ParametricPolyPolygon::createRectangularGradient( this,
- colors,
- stops,
- boundRect ) );
- }
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createVerticalLinesHatch( const ::com::sun::star::uno::Sequence< double >& /*leftColor*/,
- const ::com::sun::star::uno::Sequence< double >& /*rightColor*/ ) throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException)
- {
- // TODO(F1): hatch factory NYI
- return ::com::sun::star::uno::Reference<
- ::com::sun::star::rendering::XParametricPolyPolygon2D >();
- }
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createOrthogonalLinesHatch( const ::com::sun::star::uno::Sequence< double >& /*leftTopColor*/,
- const ::com::sun::star::uno::Sequence< double >& /*rightBottomColor*/ ) throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException)
- {
- // TODO(F1): hatch factory NYI
- return ::com::sun::star::uno::Reference<
- ::com::sun::star::rendering::XParametricPolyPolygon2D >();
- }
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createThreeCrossingLinesHatch( const ::com::sun::star::uno::Sequence< double >& /*startColor*/,
- const ::com::sun::star::uno::Sequence< double >& /*endColor*/ ) throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException)
- {
- // TODO(F1): hatch factory NYI
- return ::com::sun::star::uno::Reference<
- ::com::sun::star::rendering::XParametricPolyPolygon2D >();
- }
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createFourCrossingLinesHatch( const ::com::sun::star::uno::Sequence< double >& /*startColor*/,
- const ::com::sun::star::uno::Sequence< double >& /*endColor*/ ) throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException)
- {
- // TODO(F1): hatch factory NYI
- return ::com::sun::star::uno::Reference<
- ::com::sun::star::rendering::XParametricPolyPolygon2D >();
+ return ParametricPolyPolygon::getAvailableServiceNames();
}
diff --git a/canvas/inc/canvas/canvastools.hxx b/canvas/inc/canvas/canvastools.hxx
index de4785346909..6c9fdfee484a 100644..100755
--- a/canvas/inc/canvas/canvastools.hxx
+++ b/canvas/inc/canvas/canvastools.hxx
@@ -66,6 +66,7 @@ namespace com { namespace sun { namespace star { namespace rendering
struct ViewState;
struct IntegerBitmapLayout;
class XCanvas;
+ struct Texture;
class XIntegerBitmapColorSpace;
class XPolyPolygon2D;
@@ -414,28 +415,6 @@ namespace canvas
*/
::basegfx::B2IRange spritePixelAreaFromB2DRange( const ::basegfx::B2DRange& rRange );
- /** This method clamps the given value to the specified range
-
- @param val
- The value to clamp
-
- @param minVal
- The minimal value val is allowed to attain
-
- @param maxVal
- The maximal value val is allowed to attain
-
- @return the clamped value
- */
- template< typename T > T clamp( T val,
- T minVal,
- T maxVal )
- {
- return ::std::max( minVal,
- ::std::min( maxVal,
- val ) );
- }
-
/** Retrieve various internal properties of the actual canvas implementation.
This method retrieves a bunch of internal, implementation-
@@ -518,6 +497,18 @@ namespace canvas
*/
::basegfx::B2DPolyPolygon getBoundMarksPolyPolygon( const ::basegfx::B2DRange& rRange );
+ /** Calculate number of gradient "strips" to generate (takes
+ into account device resolution)
+
+ @param nColorSteps
+ Maximal integer difference between all color stops, needed
+ for smooth gradient color differences
+ */
+ int calcGradientStepCount( ::basegfx::B2DHomMatrix& rTotalTransform,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::rendering::Texture& texture,
+ int nColorSteps );
/** A very simplistic map for ASCII strings and arbitrary value
types.
diff --git a/canvas/inc/canvas/parametricpolypolygon.hxx b/canvas/inc/canvas/parametricpolypolygon.hxx
index 4bd7e14b0229..aac98a67a713 100644
--- a/canvas/inc/canvas/parametricpolypolygon.hxx
+++ b/canvas/inc/canvas/parametricpolypolygon.hxx
@@ -30,7 +30,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/rendering/XGraphicDevice.hpp>
-#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
+#include <com/sun/star/rendering/XParametricPolyPolygon2D.hpp>
#include <cppuhelper/compbase2.hxx>
#include <comphelper/broadcasthelper.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
@@ -59,7 +59,6 @@ namespace canvas
enum GradientType
{
GRADIENT_LINEAR,
- GRADIENT_AXIAL,
GRADIENT_ELLIPTICAL,
GRADIENT_RECTANGULAR
};
@@ -100,24 +99,11 @@ namespace canvas
const GradientType meType;
};
- static ParametricPolyPolygon* createLinearHorizontalGradient( const ::com::sun::star::uno::Reference<
- ::com::sun::star::rendering::XGraphicDevice >& rDevice,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors,
- const ::com::sun::star::uno::Sequence< double >& stops );
- static ParametricPolyPolygon* createAxialHorizontalGradient( const ::com::sun::star::uno::Reference<
- ::com::sun::star::rendering::XGraphicDevice >& rDevice,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors,
- const ::com::sun::star::uno::Sequence< double >& stops );
- static ParametricPolyPolygon* createEllipticalGradient( const ::com::sun::star::uno::Reference<
- ::com::sun::star::rendering::XGraphicDevice >& rDevice,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors,
- const ::com::sun::star::uno::Sequence< double >& stops,
- const ::com::sun::star::geometry::RealRectangle2D& boundRect );
- static ParametricPolyPolygon* createRectangularGradient( const ::com::sun::star::uno::Reference<
- ::com::sun::star::rendering::XGraphicDevice >& rDevice,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors,
- const ::com::sun::star::uno::Sequence< double >& stops,
- const ::com::sun::star::geometry::RealRectangle2D& boundRect );
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getAvailableServiceNames();
+ static ParametricPolyPolygon* create(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice,
+ const ::rtl::OUString& rServiceName,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rArgs );
/// Dispose all internal references
virtual void SAL_CALL disposing();
@@ -140,6 +126,20 @@ namespace canvas
~ParametricPolyPolygon(); // we're a ref-counted UNO class. _We_ destroy ourselves.
private:
+ static ParametricPolyPolygon* createLinearHorizontalGradient( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XGraphicDevice >& rDevice,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors,
+ const ::com::sun::star::uno::Sequence< double >& stops );
+ static ParametricPolyPolygon* createEllipticalGradient( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XGraphicDevice >& rDevice,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors,
+ const ::com::sun::star::uno::Sequence< double >& stops,
+ double fAspect );
+ static ParametricPolyPolygon* createRectangularGradient( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XGraphicDevice >& rDevice,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors,
+ const ::com::sun::star::uno::Sequence< double >& stops,
+ double fAspect );
/// Private, because objects can only be created from the static factories
ParametricPolyPolygon( const ::com::sun::star::uno::Reference<
diff --git a/canvas/prj/build.lst b/canvas/prj/build.lst
index 28e8524a9b38..cacbdb5bb894 100644
--- a/canvas/prj/build.lst
+++ b/canvas/prj/build.lst
@@ -7,5 +7,4 @@ cv canvas\source\simplecanvas nmake - all cv_simplecanvas cv_tools cv_inc
cv canvas\source\cairo nmake - all cv_cairo cv_tools cv_inc NULL
cv canvas\source\directx nmake - w cv_directx cv_tools cv_inc NULL
cv canvas\source\null nmake - all cv_null cv_tools cv_inc NULL
-cv canvas\source\java nmake - all cv_java cv_inc NULL
cv canvas\source\factory nmake - all cv_factory cv_inc NULL
diff --git a/canvas/source/cairo/cairo_canvas.hxx b/canvas/source/cairo/cairo_canvas.hxx
index 26e2904cf71f..bbcb89c54c7d 100644
--- a/canvas/source/cairo/cairo_canvas.hxx
+++ b/canvas/source/cairo/cairo_canvas.hxx
@@ -41,7 +41,6 @@
#include <com/sun/star/rendering/XIntegerBitmap.hpp>
#include <com/sun/star/rendering/XGraphicDevice.hpp>
#include <com/sun/star/rendering/XBufferController.hpp>
-#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
#include <cppuhelper/compbase7.hxx>
#include <comphelper/uno3.hxx>
@@ -65,7 +64,7 @@ namespace cairocanvas
typedef ::cppu::WeakComponentImplHelper7< ::com::sun::star::rendering::XBitmapCanvas,
::com::sun::star::rendering::XIntegerBitmap,
::com::sun::star::rendering::XGraphicDevice,
- ::com::sun::star::rendering::XParametricPolyPolygon2DFactory,
+ ::com::sun::star::lang::XMultiServiceFactory,
::com::sun::star::util::XUpdatable,
::com::sun::star::beans::XPropertySet,
::com::sun::star::lang::XServiceName > GraphicDeviceBase_Base;
diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx
index 17d187d46b27..eec6a09fb215 100644
--- a/canvas/source/cairo/cairo_canvashelper.cxx
+++ b/canvas/source/cairo/cairo_canvashelper.cxx
@@ -53,6 +53,8 @@
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/tools/canvastools.hxx>
+#include <basegfx/tools/keystoplerp.hxx>
+#include <basegfx/tools/lerp.hxx>
#include <comphelper/sequence.hxx>
#include <cppuhelper/compbase1.hxx>
@@ -70,6 +72,7 @@
#include "cairo_canvashelper.hxx"
#include "cairo_canvasbitmap.hxx"
+#include <boost/tuple/tuple.hpp>
#include <algorithm>
using namespace ::cairo;
@@ -119,9 +122,29 @@ namespace cairocanvas
mpCairo = pSurface->getCairo();
}
+ static void setColor( Cairo* pCairo,
+ const uno::Sequence<double>& rColor )
+ {
+ if( rColor.getLength() > 3 )
+ {
+ const double alpha = rColor[3];
+
+ cairo_set_source_rgba( pCairo,
+ alpha*rColor[0],
+ alpha*rColor[1],
+ alpha*rColor[2],
+ alpha );
+ }
+ else if( rColor.getLength() == 3 )
+ cairo_set_source_rgb( pCairo,
+ rColor[0],
+ rColor[1],
+ rColor[2] );
+ }
+
void CanvasHelper::useStates( const rendering::ViewState& viewState,
const rendering::RenderState& renderState,
- bool setColor )
+ bool bSetColor )
{
Matrix aViewMatrix;
Matrix aRenderMatrix;
@@ -155,19 +178,8 @@ namespace cairocanvas
OSL_TRACE ("render clip END");
}
- if( setColor ) {
- if( renderState.DeviceColor.getLength() > 3 )
- cairo_set_source_rgba( mpCairo.get(),
- renderState.DeviceColor [0],
- renderState.DeviceColor [1],
- renderState.DeviceColor [2],
- renderState.DeviceColor [3] );
- else if (renderState.DeviceColor.getLength() == 3)
- cairo_set_source_rgb( mpCairo.get(),
- renderState.DeviceColor [0],
- renderState.DeviceColor [1],
- renderState.DeviceColor [2] );
- }
+ if( bSetColor )
+ setColor(mpCairo.get(),renderState.DeviceColor);
cairo_operator_t compositingMode( CAIRO_OPERATOR_OVER );
switch( renderState.CompositeOperation )
@@ -662,11 +674,33 @@ namespace cairocanvas
double alpha = rColor[3];
// cairo expects premultiplied alpha
cairo_pattern_add_color_stop_rgba( pPattern, stop, rColor[0]*alpha, rColor[1]*alpha, rColor[2]*alpha, alpha );
- //cairo_pattern_add_color_stop_rgba( pPattern, stop, rColor[0], rColor[1], rColor[2], alpha );
}
}
}
+ static uno::Sequence<double> lerp(const uno::Sequence<double>& rLeft, const uno::Sequence<double>& rRight, double fAlpha)
+ {
+ if( rLeft.getLength() == 3 )
+ {
+ uno::Sequence<double> aRes(3);
+ aRes[0] = basegfx::tools::lerp(rLeft[0],rRight[0],fAlpha);
+ aRes[1] = basegfx::tools::lerp(rLeft[1],rRight[1],fAlpha);
+ aRes[2] = basegfx::tools::lerp(rLeft[2],rRight[2],fAlpha);
+ return aRes;
+ }
+ else if( rLeft.getLength() == 4 )
+ {
+ uno::Sequence<double> aRes(4);
+ aRes[0] = basegfx::tools::lerp(rLeft[0],rRight[0],fAlpha);
+ aRes[1] = basegfx::tools::lerp(rLeft[1],rRight[1],fAlpha);
+ aRes[2] = basegfx::tools::lerp(rLeft[2],rRight[2],fAlpha);
+ aRes[3] = basegfx::tools::lerp(rLeft[3],rRight[3],fAlpha);
+ return aRes;
+ }
+
+ return uno::Sequence<double>();
+ }
+
static Pattern* patternFromParametricPolyPolygon( ::canvas::ParametricPolyPolygon& rPolygon )
{
Pattern* pPattern = NULL;
@@ -675,7 +709,6 @@ namespace cairocanvas
// undef macros from vclenum.hxx which conflicts with GradientType enum values
#undef GRADIENT_LINEAR
-#undef GRADIENT_AXIAL
#undef GRADIENT_ELLIPTICAL
switch( aValues.meType ) {
@@ -688,26 +721,17 @@ namespace cairocanvas
addColorStops( pPattern, aValues.maColors, aValues.maStops );
break;
- // FIXME: NYI
- case ::canvas::ParametricPolyPolygon::GRADIENT_RECTANGULAR:
- case ::canvas::ParametricPolyPolygon::GRADIENT_AXIAL:
- x0 = 0;
- y0 = 0;
- x1 = 1;
- y1 = 0;
- pPattern = cairo_pattern_create_linear( x0, y0, x1, y1 );
- addColorStops( pPattern, aValues.maColors, aValues.maStops );
- break;
-
case ::canvas::ParametricPolyPolygon::GRADIENT_ELLIPTICAL:
- cx = 0.5;
- cy = 0.5;
+ cx = 0;
+ cy = 0;
r0 = 0;
- r1 = 0.5;
+ r1 = 1;
- pPattern = cairo_pattern_create_radial( cx, cy, r0, cx, cy, r1 );
+ pPattern = cairo_pattern_create_radial( cx, cy, r0, cy, cy, r1 );
addColorStops( pPattern, aValues.maColors, aValues.maStops, true );
break;
+ default:
+ break;
}
return pPattern;
@@ -716,7 +740,8 @@ namespace cairocanvas
static void doOperation( Operation aOperation,
Cairo* pCairo,
const uno::Sequence< rendering::Texture >* pTextures,
- const SurfaceProviderRef& pDevice )
+ const SurfaceProviderRef& pDevice,
+ const basegfx::B2DRange& rBounds )
{
switch( aOperation ) {
case Fill:
@@ -751,7 +776,20 @@ namespace cairocanvas
if( aTexture.RepeatModeX == rendering::TexturingMode::REPEAT &&
aTexture.RepeatModeY == rendering::TexturingMode::REPEAT )
+ {
cairo_pattern_set_extend( pPattern, CAIRO_EXTEND_REPEAT );
+ }
+ else if ( aTexture.RepeatModeX == rendering::TexturingMode::NONE &&
+ aTexture.RepeatModeY == rendering::TexturingMode::NONE )
+ {
+ cairo_pattern_set_extend( pPattern, CAIRO_EXTEND_NONE );
+ }
+ else if ( aTexture.RepeatModeX == rendering::TexturingMode::CLAMP &&
+ aTexture.RepeatModeY == rendering::TexturingMode::CLAMP )
+ {
+ cairo_pattern_set_extend( pPattern, CAIRO_EXTEND_PAD );
+ }
+
aScaledTextureMatrix.x0 = basegfx::fround( aScaledTextureMatrix.x0 );
aScaledTextureMatrix.y0 = basegfx::fround( aScaledTextureMatrix.y0 );
cairo_pattern_set_matrix( pPattern, &aScaledTextureMatrix );
@@ -787,19 +825,70 @@ namespace cairocanvas
cairo_matrix_init( &aTextureMatrix,
aTransform.m00, aTransform.m10, aTransform.m01,
aTransform.m11, aTransform.m02, aTransform.m12);
- Pattern* pPattern = patternFromParametricPolyPolygon( *pPolyImpl );
+ if( pPolyImpl->getValues().meType == canvas::ParametricPolyPolygon::GRADIENT_RECTANGULAR )
+ {
+ // no general path gradient yet in cairo; emulate then
+ cairo_save( pCairo );
+ cairo_clip( pCairo );
+
+ // fill bound rect with start color
+ cairo_rectangle( pCairo, rBounds.getMinX(), rBounds.getMinY(),
+ rBounds.getWidth(), rBounds.getHeight() );
+ setColor(pCairo,pPolyImpl->getValues().maColors[0]);
+ cairo_fill(pCairo);
+
+ cairo_transform( pCairo, &aTextureMatrix );
+
+ // longest line in gradient bound rect
+ const unsigned int nGradientSize(
+ static_cast<unsigned int>(
+ ::basegfx::B2DVector(rBounds.getMinimum() - rBounds.getMaximum()).getLength() + 1.0 ) );
+
+ // typical number for pixel of the same color (strip size)
+ const unsigned int nStripSize( nGradientSize < 50 ? 2 : 4 );
+
+ // use at least three steps, and at utmost the number of color
+ // steps
+ const unsigned int nStepCount(
+ ::std::max(
+ 3U,
+ ::std::min(
+ nGradientSize / nStripSize,
+ 128U )) + 1 );
+
+ const uno::Sequence<double>* pColors=&pPolyImpl->getValues().maColors[0];
+ basegfx::tools::KeyStopLerp aLerper(pPolyImpl->getValues().maStops);
+ for( unsigned int i=1; i<nStepCount; ++i )
+ {
+ const double fT( i/double(nStepCount) );
- if( pPattern ) {
- OSL_TRACE( "filling with pattern" );
+ std::ptrdiff_t nIndex;
+ double fAlpha;
+ boost::tuples::tie(nIndex,fAlpha)=aLerper.lerp(fT);
- cairo_save( pCairo );
+ setColor(pCairo, lerp(pColors[nIndex], pColors[nIndex+1], fAlpha));
+ cairo_rectangle( pCairo, -1+fT, -1+fT, 2-2*fT, 2-2*fT );
+ cairo_fill(pCairo);
+ }
- cairo_transform( pCairo, &aTextureMatrix );
- cairo_set_source( pCairo, pPattern );
- cairo_fill( pCairo );
cairo_restore( pCairo );
+ }
+ else
+ {
+ Pattern* pPattern = patternFromParametricPolyPolygon( *pPolyImpl );
+
+ if( pPattern ) {
+ OSL_TRACE( "filling with pattern" );
- cairo_pattern_destroy( pPattern );
+ cairo_save( pCairo );
+
+ cairo_transform( pCairo, &aTextureMatrix );
+ cairo_set_source( pCairo, pPattern );
+ cairo_fill( pCairo );
+ cairo_restore( pCairo );
+
+ cairo_pattern_destroy( pPattern );
+ }
}
}
}
@@ -932,7 +1021,7 @@ namespace cairocanvas
if( aOperation == Fill && pTextures ) {
cairo_set_matrix( pCairo, &aOrigMatrix );
- doOperation( aOperation, pCairo, pTextures, pDevice );
+ doOperation( aOperation, pCairo, pTextures, pDevice, aPolyPolygon.getB2DRange() );
cairo_set_matrix( pCairo, &aIdentityMatrix );
}
} else {
@@ -945,7 +1034,7 @@ namespace cairocanvas
}
}
if( bOpToDo && ( aOperation != Fill || !pTextures ) )
- doOperation( aOperation, pCairo, pTextures, pDevice );
+ doOperation( aOperation, pCairo, pTextures, pDevice, aPolyPolygon.getB2DRange() );
cairo_set_matrix( pCairo, &aOrigMatrix );
@@ -980,11 +1069,11 @@ namespace cairocanvas
aEdge.append(aCandidate.getB2DPoint(0));
aEdge.append(basegfx::B2DPoint(0.0, 0.0));
- for(sal_uInt32 a(0); a < nEdgeCount; a++)
+ for(sal_uInt32 b(0); b < nEdgeCount; b++)
{
- const sal_uInt32 nNextIndex((a + 1) % nPointCount);
+ const sal_uInt32 nNextIndex((b + 1) % nPointCount);
aEdge.setB2DPoint(1, aCandidate.getB2DPoint(nNextIndex));
- aEdge.setNextControlPoint(0, aCandidate.getNextControlPoint(a));
+ aEdge.setNextControlPoint(0, aCandidate.getNextControlPoint(b));
aEdge.setPrevControlPoint(1, aCandidate.getPrevControlPoint(nNextIndex));
doPolyPolygonImplementation( basegfx::B2DPolyPolygon(aEdge),
@@ -1209,12 +1298,12 @@ namespace cairocanvas
const rendering::ViewState& viewState,
const rendering::RenderState& renderState,
const geometry::IntegerSize2D& rSize,
- bool /*bModulateColors*/,
+ bool bModulateColors,
bool bHasAlpha )
{
SurfaceSharedPtr pSurface=pInputSurface;
uno::Reference< rendering::XCachedPrimitive > rv = uno::Reference< rendering::XCachedPrimitive >(NULL);
- geometry::IntegerSize2D aBitmapSize = rSize;
+ geometry::IntegerSize2D aBitmapSize = rSize;
if( mpCairo ) {
cairo_save( mpCairo.get() );
@@ -1236,38 +1325,38 @@ namespace cairocanvas
::rtl::math::approxEqual( aMatrix.y0, 0 ) &&
basegfx::fround( rSize.Width * aMatrix.xx ) > 8 &&
basegfx::fround( rSize.Height* aMatrix.yy ) > 8 )
- {
- double dWidth, dHeight;
-
- dWidth = basegfx::fround( rSize.Width * aMatrix.xx );
- dHeight = basegfx::fround( rSize.Height* aMatrix.yy );
- aBitmapSize.Width = static_cast<sal_Int32>( dWidth );
- aBitmapSize.Height = static_cast<sal_Int32>( dHeight );
-
- SurfaceSharedPtr pScaledSurface = mpSurfaceProvider->createSurface(
- ::basegfx::B2ISize( aBitmapSize.Width, aBitmapSize.Height ),
- bHasAlpha ? CAIRO_CONTENT_COLOR_ALPHA : CAIRO_CONTENT_COLOR );
- CairoSharedPtr pCairo = pScaledSurface->getCairo();
-
- cairo_set_operator( pCairo.get(), CAIRO_OPERATOR_SOURCE );
- // add 0.5px to size to avoid rounding errors in cairo, leading sometimes to random data on the image right/bottom borders
- cairo_scale( pCairo.get(), (dWidth+0.5)/rSize.Width, (dHeight+0.5)/rSize.Height );
- cairo_set_source_surface( pCairo.get(), pSurface->getCairoSurface().get(), 0, 0 );
- cairo_paint( pCairo.get() );
-
- pSurface = pScaledSurface;
-
- aMatrix.xx = aMatrix.yy = 1;
- cairo_set_matrix( mpCairo.get(), &aMatrix );
-
- rv = uno::Reference< rendering::XCachedPrimitive >(
- new CachedBitmap( pSurface, viewState, renderState,
- // cast away const, need to
- // change refcount (as this is
- // ~invisible to client code,
- // still logically const)
- const_cast< rendering::XCanvas* >(pCanvas)) );
- }
+ {
+ double dWidth, dHeight;
+
+ dWidth = basegfx::fround( rSize.Width * aMatrix.xx );
+ dHeight = basegfx::fround( rSize.Height* aMatrix.yy );
+ aBitmapSize.Width = static_cast<sal_Int32>( dWidth );
+ aBitmapSize.Height = static_cast<sal_Int32>( dHeight );
+
+ SurfaceSharedPtr pScaledSurface = mpSurfaceProvider->createSurface(
+ ::basegfx::B2ISize( aBitmapSize.Width, aBitmapSize.Height ),
+ bHasAlpha ? CAIRO_CONTENT_COLOR_ALPHA : CAIRO_CONTENT_COLOR );
+ CairoSharedPtr pCairo = pScaledSurface->getCairo();
+
+ cairo_set_operator( pCairo.get(), CAIRO_OPERATOR_SOURCE );
+ // add 0.5px to size to avoid rounding errors in cairo, leading sometimes to random data on the image right/bottom borders
+ cairo_scale( pCairo.get(), (dWidth+0.5)/rSize.Width, (dHeight+0.5)/rSize.Height );
+ cairo_set_source_surface( pCairo.get(), pSurface->getCairoSurface().get(), 0, 0 );
+ cairo_paint( pCairo.get() );
+
+ pSurface = pScaledSurface;
+
+ aMatrix.xx = aMatrix.yy = 1;
+ cairo_set_matrix( mpCairo.get(), &aMatrix );
+
+ rv = uno::Reference< rendering::XCachedPrimitive >(
+ new CachedBitmap( pSurface, viewState, renderState,
+ // cast away const, need to
+ // change refcount (as this is
+ // ~invisible to client code,
+ // still logically const)
+ const_cast< rendering::XCanvas* >(pCanvas)) );
+ }
if( !bHasAlpha && mbHaveAlpha )
{
@@ -1308,7 +1397,11 @@ namespace cairocanvas
cairo_set_operator( mpCairo.get(), CAIRO_OPERATOR_SOURCE );
cairo_rectangle( mpCairo.get(), 0, 0, aBitmapSize.Width, aBitmapSize.Height );
cairo_clip( mpCairo.get() );
- cairo_paint( mpCairo.get() );
+
+ if( bModulateColors )
+ cairo_paint_with_alpha( mpCairo.get(), renderState.DeviceColor[3] );
+ else
+ cairo_paint( mpCairo.get() );
cairo_restore( mpCairo.get() );
} else
OSL_TRACE ("CanvasHelper called after it was disposed");
@@ -1347,15 +1440,35 @@ namespace cairocanvas
return rv;
}
- uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawBitmapModulated( const rendering::XCanvas* ,
- const uno::Reference< rendering::XBitmap >& /*xBitmap*/,
- const rendering::ViewState& /*viewState*/,
- const rendering::RenderState& /*renderState*/ )
+ uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawBitmapModulated( const rendering::XCanvas* pCanvas,
+ const uno::Reference< rendering::XBitmap >& xBitmap,
+ const rendering::ViewState& viewState,
+ const rendering::RenderState& renderState )
{
- // TODO(F3): Implement modulated bitmap!
+#ifdef CAIRO_CANVAS_PERF_TRACE
+ struct timespec aTimer;
+ mxDevice->startPerfTrace( &aTimer );
+#endif
- // TODO(P1): Provide caching here.
- return uno::Reference< rendering::XCachedPrimitive >(NULL);
+ uno::Reference< rendering::XCachedPrimitive > rv;
+ unsigned char* data = NULL;
+ bool bHasAlpha = false;
+ SurfaceSharedPtr pSurface = surfaceFromXBitmap( xBitmap, mpSurfaceProvider, data, bHasAlpha );
+ geometry::IntegerSize2D aSize = xBitmap->getSize();
+
+ if( pSurface ) {
+ rv = implDrawBitmapSurface( pCanvas, pSurface, viewState, renderState, aSize, true, bHasAlpha );
+
+ if( data )
+ free( data );
+ } else
+ rv = uno::Reference< rendering::XCachedPrimitive >(NULL);
+
+#ifdef CAIRO_CANVAS_PERF_TRACE
+ mxDevice->stopPerfTrace( &aTimer, "drawBitmap" );
+#endif
+
+ return rv;
}
uno::Reference< rendering::XGraphicDevice > CanvasHelper::getDevice()
@@ -1678,12 +1791,12 @@ namespace cairocanvas
rendering::RGBColor* pOut( aRes.getArray() );
for( sal_Size i=0; i<nLen; i+=4 )
{
- const sal_Int8 nAlpha(pIn[3]);
- if( nAlpha )
+ const double fAlpha((sal_uInt8)pIn[3]);
+ if( fAlpha )
*pOut++ = rendering::RGBColor(
- vcl::unotools::toDoubleColor(pIn[2]/nAlpha),
- vcl::unotools::toDoubleColor(pIn[1]/nAlpha),
- vcl::unotools::toDoubleColor(pIn[0]/nAlpha));
+ pIn[2]/fAlpha,
+ pIn[1]/fAlpha,
+ pIn[0]/fAlpha);
else
*pOut++ = rendering::RGBColor(0,0,0);
pIn += 4;
@@ -1703,13 +1816,13 @@ namespace cairocanvas
rendering::ARGBColor* pOut( aRes.getArray() );
for( sal_Size i=0; i<nLen; i+=4 )
{
- const sal_Int8 nAlpha(pIn[3]);
- if( nAlpha )
+ const double fAlpha((sal_uInt8)pIn[3]);
+ if( fAlpha )
*pOut++ = rendering::ARGBColor(
- vcl::unotools::toDoubleColor(nAlpha),
- vcl::unotools::toDoubleColor(pIn[2]/nAlpha),
- vcl::unotools::toDoubleColor(pIn[1]/nAlpha),
- vcl::unotools::toDoubleColor(pIn[0]/nAlpha));
+ fAlpha/255.0,
+ pIn[2]/fAlpha,
+ pIn[1]/fAlpha,
+ pIn[0]/fAlpha);
else
*pOut++ = rendering::ARGBColor(0,0,0,0);
pIn += 4;
diff --git a/canvas/source/cairo/cairo_spritecanvas.hxx b/canvas/source/cairo/cairo_spritecanvas.hxx
index 0c942cac1ed3..fcc0ae76839b 100644
--- a/canvas/source/cairo/cairo_spritecanvas.hxx
+++ b/canvas/source/cairo/cairo_spritecanvas.hxx
@@ -39,7 +39,6 @@
#include <com/sun/star/rendering/XIntegerBitmap.hpp>
#include <com/sun/star/rendering/XGraphicDevice.hpp>
#include <com/sun/star/rendering/XBufferController.hpp>
-#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
#include <cppuhelper/compbase9.hxx>
#include <comphelper/uno3.hxx>
@@ -63,7 +62,7 @@ namespace cairocanvas
typedef ::cppu::WeakComponentImplHelper9< ::com::sun::star::rendering::XSpriteCanvas,
::com::sun::star::rendering::XIntegerBitmap,
::com::sun::star::rendering::XGraphicDevice,
- ::com::sun::star::rendering::XParametricPolyPolygon2DFactory,
+ ::com::sun::star::lang::XMultiServiceFactory,
::com::sun::star::rendering::XBufferController,
::com::sun::star::awt::XWindowListener,
::com::sun::star::util::XUpdatable,
diff --git a/canvas/source/cairo/exports.map b/canvas/source/cairo/exports.map
deleted file mode 100644
index 4101b0d761a9..000000000000
--- a/canvas/source/cairo/exports.map
+++ /dev/null
@@ -1,8 +0,0 @@
-CAN_1_0 {
- global:
- component_getImplementationEnvironment;
- component_writeInfo;
- component_getFactory;
- local:
- *;
-};
diff --git a/canvas/source/cairo/makefile.mk b/canvas/source/cairo/makefile.mk
index 2c568a4efdbd..b0ff10fe96b0 100644
--- a/canvas/source/cairo/makefile.mk
+++ b/canvas/source/cairo/makefile.mk
@@ -87,7 +87,7 @@ SHL1STDLIBS= $(CPPULIB) $(TKLIB) $(SALLIB) $(VCLLIB) $(COMPHELPERLIB) $(CPPUHELP
.IF "$(SYSTEM_CAIRO)" == "YES"
SHL1STDLIBS+= $(CAIRO_LIBS)
.ELSE
-SHL1STDLIBS+= -lcairo
+SHL1STDLIBS+= -lcairo -lpixman-1
.ENDIF
.IF "$(GUIBASE)"=="aqua"
@@ -98,7 +98,7 @@ CFLAGSCXX+=$(OBJCXXFLAGS)
# Xlib
SLOFILES+= $(SLO)$/cairo_xlib_cairo.obj
-SHL1STDLIBS+= -lfontconfig -lX11 -lXrender -lpixman-1 $(FREETYPE_LIBS)
+SHL1STDLIBS+= -lfontconfig -lX11 -lXrender $(FREETYPE_LIBS)
CFLAGS+=$(FREETYPE_CFLAGS)
.ENDIF # "$(GUIBASE)"=="aqua"
@@ -121,7 +121,7 @@ SHL1IMPLIB=i$(TARGET)
SHL1LIBS=$(SLB)$/$(TARGET).lib
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
-SHL1VERSIONMAP=exports.map
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
DEF1NAME=$(SHL1TARGET)
DEF1EXPORTFILE=exports.dxp
diff --git a/canvas/source/directx/dx_canvas.hxx b/canvas/source/directx/dx_canvas.hxx
index aca9873387dc..be15b875c4b6 100644
--- a/canvas/source/directx/dx_canvas.hxx
+++ b/canvas/source/directx/dx_canvas.hxx
@@ -38,7 +38,6 @@
#include <com/sun/star/rendering/XIntegerBitmap.hpp>
#include <com/sun/star/rendering/XGraphicDevice.hpp>
#include <com/sun/star/rendering/XBufferController.hpp>
-#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
#include <cppuhelper/compbase7.hxx>
#include <cppuhelper/compbase6.hxx>
@@ -59,7 +58,7 @@ namespace dxcanvas
{
typedef ::cppu::WeakComponentImplHelper6< ::com::sun::star::rendering::XCanvas,
::com::sun::star::rendering::XGraphicDevice,
- ::com::sun::star::rendering::XParametricPolyPolygon2DFactory,
+ ::com::sun::star::lang::XMultiServiceFactory,
::com::sun::star::util::XUpdatable,
::com::sun::star::beans::XPropertySet,
::com::sun::star::lang::XServiceName > GraphicDeviceBase1_Base;
@@ -116,7 +115,7 @@ namespace dxcanvas
typedef ::cppu::WeakComponentImplHelper7< ::com::sun::star::rendering::XBitmapCanvas,
::com::sun::star::rendering::XIntegerBitmap,
::com::sun::star::rendering::XGraphicDevice,
- ::com::sun::star::rendering::XParametricPolyPolygon2DFactory,
+ ::com::sun::star::lang::XMultiServiceFactory,
::com::sun::star::util::XUpdatable,
::com::sun::star::beans::XPropertySet,
::com::sun::star::lang::XServiceName > GraphicDeviceBase2_Base;
diff --git a/canvas/source/directx/dx_canvashelper_texturefill.cxx b/canvas/source/directx/dx_canvashelper_texturefill.cxx
index 026545d6c339..60d62dad338a 100755
--- a/canvas/source/directx/dx_canvashelper_texturefill.cxx
+++ b/canvas/source/directx/dx_canvashelper_texturefill.cxx
@@ -38,7 +38,10 @@
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/range/b2drectangle.hxx>
#include <basegfx/numeric/ftools.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/tools/tools.hxx>
+#include <basegfx/tools/lerp.hxx>
+#include <basegfx/tools/keystoplerp.hxx>
#include <basegfx/tools/canvastools.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
@@ -49,6 +52,8 @@
#include "dx_impltools.hxx"
#include <boost/scoped_ptr.hpp>
+#include <boost/bind.hpp>
+#include <boost/tuple/tuple.hpp>
using namespace ::com::sun::star;
@@ -59,26 +64,31 @@ namespace dxcanvas
{
typedef ::boost::shared_ptr< Gdiplus::PathGradientBrush > PathGradientBrushSharedPtr;
- bool fillLinearGradient( GraphicsSharedPtr& rGraphics,
- const Gdiplus::Color& rColor1,
- const Gdiplus::Color& rColor2,
- const GraphicsPathSharedPtr& rFillPath,
- const rendering::Texture& texture )
+ bool fillLinearGradient( GraphicsSharedPtr& rGraphics,
+ const ::canvas::ParametricPolyPolygon::Values& /*rValues*/,
+ const std::vector< Gdiplus::Color >& rColors,
+ const std::vector< Gdiplus::REAL >& rStops,
+ const GraphicsPathSharedPtr& rFillPath,
+ const rendering::Texture& texture )
{
- // setup a linear gradient with two colors
- // ---------------------------------------
+ // setup a linear gradient with given colors
+ // -----------------------------------------
Gdiplus::LinearGradientBrush aBrush(
Gdiplus::PointF(0.0f,
0.5f),
Gdiplus::PointF(1.0f,
0.5f),
- rColor1,
- rColor2 );
+ rColors[0],
+ rColors[1] );
+
+ aBrush.SetInterpolationColors(&rColors[0],
+ &rStops[0],
+ rColors.size());
// render background color, as LinearGradientBrush does not
// properly support the WrapModeClamp repeat mode
- Gdiplus::SolidBrush aBackgroundBrush( rColor1 );
+ Gdiplus::SolidBrush aBackgroundBrush( rColors[0] );
rGraphics->FillPath( &aBackgroundBrush, rFillPath.get() );
// TODO(F2): This does not yet support other repeat modes
@@ -152,7 +162,7 @@ namespace dxcanvas
return false;
}
- Gdiplus::SolidBrush aBackgroundBrush2( rColor2 );
+ Gdiplus::SolidBrush aBackgroundBrush2( rColors.back() );
rGraphics->FillPath( &aBackgroundBrush2, &aSolidFillPath );
// generate clip polygon from the extended parallelogram
@@ -188,167 +198,33 @@ namespace dxcanvas
return true;
}
- bool fillAxialGradient( GraphicsSharedPtr& rGraphics,
- const Gdiplus::Color& rColor1,
- const Gdiplus::Color& rColor2,
- const GraphicsPathSharedPtr& rFillPath,
- const rendering::Texture& texture )
+ int numColorSteps( const Gdiplus::Color& rColor1, const Gdiplus::Color& rColor2 )
{
- // setup a linear gradient with three colors
- // -----------------------------------------
-
- Gdiplus::LinearGradientBrush aBrush(
- Gdiplus::PointF(0.0f,
- 0.5f),
- Gdiplus::PointF(1.0f,
- 0.5f),
- rColor1,
- rColor1 );
-
- Gdiplus::Color aColors[] =
- {
- rColor1, // at 0.0
- rColor2, // at 0.5
- rColor1 // at 1.0
- };
-
- Gdiplus::REAL aPositions[] =
- {
- 0.0,
- 0.5,
- 1.0
- };
-
- if( Gdiplus::Ok != aBrush.SetInterpolationColors( aColors,
- aPositions,
- sizeof( aPositions ) / sizeof(Gdiplus::REAL) ) )
- {
- return false;
- }
-
- // render background color, as LinearGradientBrush does not
- // properly support the WrapModeClamp repeat mode
- Gdiplus::SolidBrush aBackgroundBrush( rColor1 );
- rGraphics->FillPath( &aBackgroundBrush, rFillPath.get() );
-
- // TODO(F2): This does not yet support other repeat modes
- // except clamp, and probably also no multi-texturing
-
- // calculate parallelogram of gradient in object space, extend
- // top and bottom of it such that they cover the whole fill
- // path bound area
- ::basegfx::B2DHomMatrix aTextureTransform;
- ::basegfx::unotools::homMatrixFromAffineMatrix( aTextureTransform,
- texture.AffineTransform );
-
- ::basegfx::B2DPoint aLeftTop( 0.0, 0.0 );
- ::basegfx::B2DPoint aLeftBottom( 0.0, 1.0 );
- ::basegfx::B2DPoint aRightTop( 1.0, 0.0 );
- ::basegfx::B2DPoint aRightBottom( 1.0, 1.0 );
-
- aLeftTop *= aTextureTransform;
- aLeftBottom *= aTextureTransform;
- aRightTop *= aTextureTransform;
- aRightBottom*= aTextureTransform;
-
- Gdiplus::RectF aBounds;
- rFillPath->GetBounds( &aBounds, NULL, NULL );
-
- // now, we potentially have to enlarge our gradient area
- // atop and below the transformed [0,1]x[0,1] unit rect,
- // for the gradient to fill the complete bound rect.
- ::basegfx::tools::infiniteLineFromParallelogram( aLeftTop,
- aLeftBottom,
- aRightTop,
- aRightBottom,
- tools::b2dRangeFromGdiPlusRectF( aBounds ) );
-
- // generate clip polygon from the extended parallelogram
- // (exploit the feature that distinct lines in a figure are
- // automatically closed by a straight line)
- Gdiplus::GraphicsPath aClipPath;
- aClipPath.AddLine( static_cast<Gdiplus::REAL>(aLeftTop.getX()),
- static_cast<Gdiplus::REAL>(aLeftTop.getY()),
- static_cast<Gdiplus::REAL>(aRightTop.getX()),
- static_cast<Gdiplus::REAL>(aRightTop.getY()) );
- aClipPath.AddLine( static_cast<Gdiplus::REAL>(aRightBottom.getX()),
- static_cast<Gdiplus::REAL>(aRightBottom.getY()),
- static_cast<Gdiplus::REAL>(aLeftBottom.getX()),
- static_cast<Gdiplus::REAL>(aLeftBottom.getY()) );
- aClipPath.CloseFigure();
-
- // limit output to a _single_ strip of the gradient (have to
- // clip here, since GDI+ wrapmode clamp does not work here)
- if( Gdiplus::Ok != rGraphics->SetClip( rFillPath.get(),
- Gdiplus::CombineModeIntersect ) )
- {
- return false;
- }
- if( Gdiplus::Ok != rGraphics->SetClip( &aClipPath,
- Gdiplus::CombineModeIntersect ) )
- {
- return false;
- }
-
- // now, finally, output the gradient
- Gdiplus::Matrix aMatrix;
- tools::gdiPlusMatrixFromAffineMatrix2D( aMatrix,
- texture.AffineTransform );
- aBrush.SetTransform( &aMatrix );
-
- rGraphics->FillRectangle( &aBrush, aBounds );
-
- return true;
- }
-
- PathGradientBrushSharedPtr createPathGradientBrush( const GraphicsPathSharedPtr& rGradientPath,
- const Gdiplus::Color& rColor1,
- const Gdiplus::Color& rColor2 )
- {
- PathGradientBrushSharedPtr pGradientBrush(
- new Gdiplus::PathGradientBrush( rGradientPath.get() ) );
-
- Gdiplus::Color aColors[] =
- {
- rColor1
- };
-
- INT nCount(1);
-
- pGradientBrush->SetSurroundColors( aColors,
- &nCount );
- pGradientBrush->SetCenterColor( rColor2 );
-
- return pGradientBrush;
+ return ::std::max(
+ labs( rColor1.GetRed() - rColor2.GetRed() ),
+ ::std::max(
+ labs( rColor1.GetGreen() - rColor2.GetGreen() ),
+ labs( rColor1.GetBlue() - rColor2.GetBlue() ) ) );
}
bool fillPolygonalGradient( const ::canvas::ParametricPolyPolygon::Values& rValues,
+ const std::vector< Gdiplus::Color >& rColors,
+ const std::vector< Gdiplus::REAL >& rStops,
GraphicsSharedPtr& rGraphics,
- const Gdiplus::Color& rColor1,
- const Gdiplus::Color& rColor2,
const GraphicsPathSharedPtr& rPath,
+ const rendering::ViewState& viewState,
+ const rendering::RenderState& renderState,
const rendering::Texture& texture )
{
- Gdiplus::Matrix aMatrix;
- tools::gdiPlusMatrixFromAffineMatrix2D( aMatrix,
- texture.AffineTransform );
-
// copy original fill path object, might have to change it
// below
GraphicsPathSharedPtr pFillPath( rPath );
-
- // clone original gradient path object, we need to change it
- // below
- GraphicsPathSharedPtr pGradientPath(
- tools::graphicsPathFromB2DPolygon( rValues.maGradientPoly ) );
-
- ENSURE_OR_RETURN_FALSE( pGradientPath.get(),
- "ParametricPolyPolygon::fillPolygonalGradient(): Could not clone path" );
+ const ::basegfx::B2DPolygon& rGradientPoly( rValues.maGradientPoly );
PathGradientBrushSharedPtr pGradientBrush;
// fill background uniformly with end color
- Gdiplus::SolidBrush aBackgroundBrush( rColor1 );
+ Gdiplus::SolidBrush aBackgroundBrush( rColors[0] );
rGraphics->FillPath( &aBackgroundBrush, pFillPath.get() );
// scale focus according to aspect ratio: for wider-than-tall
@@ -377,8 +253,6 @@ namespace dxcanvas
return false;
}
- rGraphics->MultiplyTransform( &aMatrix );
-
// disable anti-aliasing, if any
const Gdiplus::SmoothingMode eOldAAMode( rGraphics->GetSmoothingMode() );
rGraphics->SetSmoothingMode( Gdiplus::SmoothingModeHighSpeed );
@@ -388,105 +262,107 @@ namespace dxcanvas
// --------------------------------
// TODO(Q2): Unify step calculations with VCL canvas
- const int nColorSteps(
- ::std::max(
- labs( rColor1.GetRed() - rColor2.GetRed() ),
- ::std::max(
- labs( rColor1.GetGreen() - rColor2.GetGreen() ),
- labs( rColor1.GetBlue() - rColor2.GetBlue() ) ) ) );
-
- Gdiplus::Matrix aWorldTransformMatrix;
- rGraphics->GetTransform( &aWorldTransformMatrix );
-
- Gdiplus::RectF aBounds;
- pGradientPath->GetBounds( &aBounds, &aWorldTransformMatrix, NULL );
-
- // longest line in gradient bound rect
- const int nGradientSize(
- static_cast<int>( hypot( aBounds.Width, aBounds.Height ) + 1.0 ) );
-
- // typical number for pixel of the same color (strip size)
- const int nStripSize( 2 );
-
- // use at least three steps, and at utmost the number of
- // color steps.
- const int nStepCount(
- ::std::max(
- 3,
- ::std::min(
- nGradientSize / nStripSize,
- nColorSteps ) ) + 1 );
-
-
- Gdiplus::SolidBrush aFillBrush( rColor1 );
- Gdiplus::Matrix aGDIScaleMatrix;
- ::basegfx::B2DHomMatrix aScaleMatrix;
-
- // calc relative size for anisotrophic polygon scaling:
- // when the aspect ratio is e.g. 2.0, that denotes a
- // gradient which is twice as wide as high. Then, to
- // generate a symmetric gradient, the x direction is only
- // scaled to 0.5 times the gradient width. Similarly, when
- // the aspect ratio is 4.0, the focus has 3/4 the width of
- // the overall gradient.
- const double nRelativeFocusSize( rValues.mnAspectRatio > 1.0 ?
- 1.0 - 1.0/rValues.mnAspectRatio :
- 1.0 - rValues.mnAspectRatio );
+ int nColorSteps = 0;
+ for( size_t i=0; i<rColors.size()-1; ++i )
+ nColorSteps += numColorSteps(rColors[i],rColors[i+1]);
+ ::basegfx::B2DHomMatrix aTotalTransform;
+ const int nStepCount=
+ ::canvas::tools::calcGradientStepCount(aTotalTransform,
+ viewState,
+ renderState,
+ texture,
+ nColorSteps);
+
+ ::basegfx::B2DHomMatrix aTextureTransform;
+ ::basegfx::unotools::homMatrixFromAffineMatrix( aTextureTransform,
+ texture.AffineTransform );
+ // determine overall transformation for inner polygon (might
+ // have to be prefixed by anisotrophic scaling)
+ ::basegfx::B2DHomMatrix aInnerPolygonTransformMatrix;
+
+ // For performance reasons, we create a temporary VCL polygon
+ // here, keep it all the way and only change the vertex values
+ // in the loop below (as ::Polygon is a pimpl class, creating
+ // one every loop turn would really stress the mem allocator)
+ ::basegfx::B2DPolygon aOuterPoly( rGradientPoly );
+ ::basegfx::B2DPolygon aInnerPoly;
+
+ // subdivide polygon _before_ rendering, would otherwise have
+ // to be performed on every loop turn.
+ if( aOuterPoly.areControlPointsUsed() )
+ aOuterPoly = ::basegfx::tools::adaptiveSubdivideByAngle(aOuterPoly);
+
+ aInnerPoly = aOuterPoly;
+ aOuterPoly.transform(aTextureTransform);
+
+
+ // apply scaling (possibly anisotrophic) to inner polygon
+ // ------------------------------------------------------
+
+ // scale inner polygon according to aspect ratio: for
+ // wider-than-tall bounds (nAspectRatio > 1.0), the inner
+ // polygon, representing the gradient focus, must have
+ // non-zero width. Specifically, a bound rect twice as wide as
+ // tall has a focus polygon of half it's width.
+ const double nAspectRatio( rValues.mnAspectRatio );
+ if( nAspectRatio > 1.0 )
+ {
+ // width > height case
+ aInnerPolygonTransformMatrix.scale( 1.0 - 1.0/nAspectRatio,
+ 0.0 );
+ }
+ else if( nAspectRatio < 1.0 )
+ {
+ // width < height case
+ aInnerPolygonTransformMatrix.scale( 0.0,
+ 1.0 - nAspectRatio );
+ }
+ else
+ {
+ // isotrophic case
+ aInnerPolygonTransformMatrix.scale( 0.0, 0.0 );
+ }
+
+ // and finally, add texture transform to it.
+ aInnerPolygonTransformMatrix *= aTextureTransform;
+ // apply final matrix to polygon
+ aInnerPoly.transform( aInnerPolygonTransformMatrix );
+
+ Gdiplus::GraphicsPath aCurrPath;
+ Gdiplus::SolidBrush aFillBrush( rColors[0] );
+ const sal_uInt32 nNumPoints( aOuterPoly.count() );
+ basegfx::tools::KeyStopLerp aLerper(rValues.maStops);
for( int i=1; i<nStepCount; ++i )
{
- // lerp color. Funnily, the straight-forward integer
- // lerp ((nStepCount - i)*val + i*val)/nStepCount gets
- // fully botched by MSVC, at least for anything that
- // really inlines inlines (i.e. every compile without
- // debug=t)
- const double nFrac( (double)i/nStepCount );
+ std::ptrdiff_t nIndex;
+ double fAlpha;
+ const double fT( i/double(nStepCount) );
+ boost::tuples::tie(nIndex,fAlpha)=aLerper.lerp(fT);
const Gdiplus::Color aFillColor(
- static_cast<BYTE>( (1.0 - nFrac)*rColor1.GetRed() + nFrac*rColor2.GetRed() ),
- static_cast<BYTE>( (1.0 - nFrac)*rColor1.GetGreen() + nFrac*rColor2.GetGreen() ),
- static_cast<BYTE>( (1.0 - nFrac)*rColor1.GetBlue() + nFrac*rColor2.GetBlue() ) );
+ static_cast<BYTE>( basegfx::tools::lerp(rColors[nIndex].GetRed(),rColors[nIndex+1].GetRed(),fAlpha) ),
+ static_cast<BYTE>( basegfx::tools::lerp(rColors[nIndex].GetGreen(),rColors[nIndex+1].GetGreen(),fAlpha) ),
+ static_cast<BYTE>( basegfx::tools::lerp(rColors[nIndex].GetBlue(),rColors[nIndex+1].GetBlue(),fAlpha) ) );
aFillBrush.SetColor( aFillColor );
-
- const double nCurrScale( (nStepCount-i)/(double)nStepCount );
- aScaleMatrix = basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5);
-
- // handle anisotrophic polygon scaling
- if( rValues.mnAspectRatio < 1.0 )
- {
- // height > width case
- aScaleMatrix.scale( nCurrScale,
- // lerp with nCurrScale
- // between 1.0 and
- // relative focus height
- nCurrScale + (1.0-nCurrScale)*nRelativeFocusSize );
- }
- else if( rValues.mnAspectRatio > 1.0 )
- {
- // width > height case
- aScaleMatrix.scale( nCurrScale + (1.0-nCurrScale)*nRelativeFocusSize,
- // lerp with nCurrScale
- // between 1.0 and
- // relative focus width
- nCurrScale );
- }
- else
+ aCurrPath.Reset(); aCurrPath.StartFigure();
+ for( unsigned int p=1; p<nNumPoints; ++p )
{
- aScaleMatrix.scale( nCurrScale,
- nCurrScale );
+ const ::basegfx::B2DPoint& rOuterPoint1( aOuterPoly.getB2DPoint(p-1) );
+ const ::basegfx::B2DPoint& rInnerPoint1( aInnerPoly.getB2DPoint(p-1) );
+ const ::basegfx::B2DPoint& rOuterPoint2( aOuterPoly.getB2DPoint(p) );
+ const ::basegfx::B2DPoint& rInnerPoint2( aInnerPoly.getB2DPoint(p) );
+
+ aCurrPath.AddLine(
+ Gdiplus::REAL(fT*rInnerPoint1.getX() + (1-fT)*rOuterPoint1.getX()),
+ Gdiplus::REAL(fT*rInnerPoint1.getY() + (1-fT)*rOuterPoint1.getY()),
+ Gdiplus::REAL(fT*rInnerPoint2.getX() + (1-fT)*rOuterPoint2.getX()),
+ Gdiplus::REAL(fT*rInnerPoint2.getY() + (1-fT)*rOuterPoint2.getY()));
}
+ aCurrPath.CloseFigure();
- aScaleMatrix.translate( 0.5, 0.5 );
-
- tools::gdiPlusMatrixFromB2DHomMatrix( aGDIScaleMatrix,
- aScaleMatrix );
-
- GraphicsPathSharedPtr pScaledGradientPath(
- tools::graphicsPathFromB2DPolygon( rValues.maGradientPoly ) );
- pScaledGradientPath->Transform( &aGDIScaleMatrix );
-
- rGraphics->FillPath( &aFillBrush, pScaledGradientPath.get() );
+ rGraphics->FillPath( &aFillBrush, &aCurrPath );
}
// reset to old anti-alias mode
@@ -507,18 +383,24 @@ namespace dxcanvas
// one sets both, only the translational components of the
// texture is respected.
+ Gdiplus::Matrix aMatrix;
+ tools::gdiPlusMatrixFromAffineMatrix2D( aMatrix,
+ texture.AffineTransform );
+ GraphicsPathSharedPtr pGradientPath(
+ tools::graphicsPathFromB2DPolygon( rValues.maGradientPoly ));
pGradientPath->Transform( &aMatrix );
- pGradientBrush = createPathGradientBrush(
- pGradientPath,
- rColor1,
- rColor2 );
+ pGradientBrush.reset(
+ new Gdiplus::PathGradientBrush( pGradientPath.get() ) );
+ pGradientBrush->SetInterpolationColors( &rColors[0],
+ &rStops[0],
+ rStops.size() );
// explicitely setup center point. Since the center of GDI+
// gradients are by default the _centroid_ of the path
// (i.e. the weighted sum of edge points), it will not
// necessarily coincide with our notion of center.
- Gdiplus::PointF aCenterPoint(0.5, 0.5);
+ Gdiplus::PointF aCenterPoint(0, 0);
aMatrix.TransformPoints( &aCenterPoint );
pGradientBrush->SetCenterPoint( aCenterPoint );
@@ -554,38 +436,35 @@ namespace dxcanvas
}
bool fillGradient( const ::canvas::ParametricPolyPolygon::Values& rValues,
- const Gdiplus::Color& rColor1,
- const Gdiplus::Color& rColor2,
+ const std::vector< Gdiplus::Color >& rColors,
+ const std::vector< Gdiplus::REAL >& rStops,
GraphicsSharedPtr& rGraphics,
const GraphicsPathSharedPtr& rPath,
+ const rendering::ViewState& viewState,
+ const rendering::RenderState& renderState,
const rendering::Texture& texture )
{
switch( rValues.meType )
{
case ::canvas::ParametricPolyPolygon::GRADIENT_LINEAR:
fillLinearGradient( rGraphics,
- rColor1,
- rColor2,
+ rValues,
+ rColors,
+ rStops,
rPath,
texture );
break;
- case ::canvas::ParametricPolyPolygon::GRADIENT_AXIAL:
- fillAxialGradient( rGraphics,
- rColor1,
- rColor2,
- rPath,
- texture );
- break;
-
case ::canvas::ParametricPolyPolygon::GRADIENT_ELLIPTICAL:
// FALLTHROUGH intended
case ::canvas::ParametricPolyPolygon::GRADIENT_RECTANGULAR:
fillPolygonalGradient( rValues,
+ rColors,
+ rStops,
rGraphics,
- rColor1,
- rColor2,
rPath,
+ viewState,
+ renderState,
texture );
break;
@@ -606,13 +485,13 @@ namespace dxcanvas
rTexture.RepeatModeY,
"CanvasHelper::fillBitmap(): GDI+ cannot handle differing X/Y repeat mode." );
- const bool bClamp( rTexture.RepeatModeX == rendering::TexturingMode::CLAMP &&
- rTexture.RepeatModeY == rendering::TexturingMode::CLAMP );
+ const bool bClamp( rTexture.RepeatModeX == rendering::TexturingMode::NONE &&
+ rTexture.RepeatModeY == rendering::TexturingMode::NONE );
const geometry::IntegerSize2D aBmpSize( xBitmap->getSize() );
ENSURE_ARG_OR_THROW( aBmpSize.Width != 0 &&
- aBmpSize.Height != 0,
- "CanvasHelper::fillBitmap(): zero-sized texture bitmap" );
+ aBmpSize.Height != 0,
+ "CanvasHelper::fillBitmap(): zero-sized texture bitmap" );
// TODO(P3): Detect case that path is rectangle and
// bitmap is just scaled into that. Then, we can
@@ -624,7 +503,6 @@ namespace dxcanvas
tools::bitmapFromXBitmap( xBitmap ) );
TextureBrushSharedPtr pBrush;
-
if( ::rtl::math::approxEqual( rTexture.Alpha,
1.0 ) )
{
@@ -662,9 +540,9 @@ namespace dxcanvas
// scale down bitmap to [0,1]x[0,1] rect, as required
// from the XCanvas interface.
+ pBrush->MultiplyTransform( &aTextureTransform );
pBrush->ScaleTransform( static_cast< Gdiplus::REAL >(1.0/aBmpSize.Width),
static_cast< Gdiplus::REAL >(1.0/aBmpSize.Height) );
- pBrush->MultiplyTransform( &aTextureTransform );
// TODO(F1): FillRule
ENSURE_OR_THROW(
@@ -706,17 +584,29 @@ namespace dxcanvas
const ::canvas::ParametricPolyPolygon::Values& rValues(
pGradient->getValues() );
- // TODO: use all the colors and place them on given positions/stops
- const Gdiplus::Color aColor1(tools::sequenceToArgb(rValues.maColors[0]));
- const Gdiplus::Color aColor2(tools::sequenceToArgb(rValues.maColors[rValues.maColors.getLength () - 1] ));
+ OSL_ASSERT(rValues.maColors.getLength() == rValues.maStops.getLength()
+ && rValues.maColors.getLength() > 1);
+
+ std::vector< Gdiplus::Color > aColors(rValues.maColors.getLength());
+ std::transform(&rValues.maColors[0],
+ &rValues.maColors[0]+rValues.maColors.getLength(),
+ aColors.begin(),
+ boost::bind(
+ (Gdiplus::ARGB (*)( const uno::Sequence< double >& ))(
+ &tools::sequenceToArgb),
+ _1));
+ std::vector< Gdiplus::REAL > aStops;
+ comphelper::sequenceToContainer(aStops,rValues.maStops);
// TODO(E1): Return value
// TODO(F1): FillRule
fillGradient( rValues,
- aColor1,
- aColor2,
+ aColors,
+ aStops,
pGraphics,
tools::graphicsPathFromXPolyPolygon2D( xPolyPolygon ),
+ viewState,
+ renderState,
textures[0] );
}
}
diff --git a/canvas/source/directx/dx_impltools.cxx b/canvas/source/directx/dx_impltools.cxx
index 30bd11a2271a..c298fb9238f9 100755
--- a/canvas/source/directx/dx_impltools.cxx
+++ b/canvas/source/directx/dx_impltools.cxx
@@ -196,7 +196,7 @@ namespace dxcanvas
{
const sal_uInt32 nPoints( rPoly.count() );
- if( !nPoints )
+ if( nPoints < 2 )
return;
rOutput->StartFigure();
diff --git a/canvas/source/directx/dx_spritecanvas.hxx b/canvas/source/directx/dx_spritecanvas.hxx
index 5d5e65c23230..b14d79050ccf 100755
--- a/canvas/source/directx/dx_spritecanvas.hxx
+++ b/canvas/source/directx/dx_spritecanvas.hxx
@@ -39,7 +39,6 @@
#include <com/sun/star/rendering/XIntegerBitmap.hpp>
#include <com/sun/star/rendering/XGraphicDevice.hpp>
#include <com/sun/star/rendering/XBufferController.hpp>
-#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
#include <cppuhelper/compbase9.hxx>
#include <comphelper/uno3.hxx>
@@ -58,14 +57,14 @@
namespace dxcanvas
{
typedef ::cppu::WeakComponentImplHelper9< ::com::sun::star::rendering::XSpriteCanvas,
- ::com::sun::star::rendering::XIntegerBitmap,
- ::com::sun::star::rendering::XGraphicDevice,
- ::com::sun::star::rendering::XParametricPolyPolygon2DFactory,
- ::com::sun::star::rendering::XBufferController,
- ::com::sun::star::awt::XWindowListener,
- ::com::sun::star::util::XUpdatable,
- ::com::sun::star::beans::XPropertySet,
- ::com::sun::star::lang::XServiceName > WindowGraphicDeviceBase_Base;
+ ::com::sun::star::rendering::XIntegerBitmap,
+ ::com::sun::star::rendering::XGraphicDevice,
+ ::com::sun::star::lang::XMultiServiceFactory,
+ ::com::sun::star::rendering::XBufferController,
+ ::com::sun::star::awt::XWindowListener,
+ ::com::sun::star::util::XUpdatable,
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::lang::XServiceName > WindowGraphicDeviceBase_Base;
typedef ::canvas::BufferedGraphicDeviceBase< ::canvas::BaseMutexHelper< WindowGraphicDeviceBase_Base >,
SpriteDeviceHelper,
::osl::MutexGuard,
diff --git a/canvas/source/factory/canvasfactory.map b/canvas/source/factory/canvasfactory.map
deleted file mode 100644
index 44fb01f37126..000000000000
--- a/canvas/source/factory/canvasfactory.map
+++ /dev/null
@@ -1,8 +0,0 @@
-CAN_1_0 {
- global:
- component_getImplementationEnvironment;
- component_writeInfo;
- component_getFactory;
- local:
- *;
-};
diff --git a/canvas/source/factory/makefile.mk b/canvas/source/factory/makefile.mk
index 94e3f0d04255..fc6d423192d6 100644
--- a/canvas/source/factory/makefile.mk
+++ b/canvas/source/factory/makefile.mk
@@ -43,7 +43,7 @@ SHL1STDLIBS = \
$(CPPULIB) \
$(CPPUHELPERLIB) \
$(SALLIB)
-SHL1VERSIONMAP = canvasfactory.map
+SHL1VERSIONMAP = $(SOLARENV)/src/component.map
SHL1DEPN =
SHL1IMPLIB = i$(TARGET)
diff --git a/canvas/source/java/BackBuffer.java b/canvas/source/java/BackBuffer.java
deleted file mode 100644
index 472f6603c33c..000000000000
--- a/canvas/source/java/BackBuffer.java
+++ /dev/null
@@ -1,112 +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.
- *
- ************************************************************************/
-
-// Java AWT
-import java.awt.*;
-import java.awt.image.*;
-
-public class BackBuffer
-{
- private BufferedImage backBuffer;
- //private VolatileImage backBuffer;
- private Graphics2D backBufferGraphics;
- private Graphics2D referenceDevice;
-
- public BackBuffer( Graphics2D _referenceDevice,
- int width,
- int height )
- {
- referenceDevice = _referenceDevice;
- setSize( width, height );
- }
-
- public Graphics2D getGraphics()
- {
- return backBufferGraphics;
- }
-
- public void setSize( int width,
- int height )
- {
- if( backBuffer != null &&
- width == backBuffer.getWidth() &&
- height == backBuffer.getHeight() )
- {
- return;
- }
-
- if( backBufferGraphics != null )
- backBufferGraphics.dispose();
-
- if( backBuffer != null )
- backBuffer.flush();
-
- // TODO: Maybe VolatileImage with another BufferedImage as a backup is
- // a tad faster here.
- backBuffer = referenceDevice.getDeviceConfiguration().createCompatibleImage(width,
- height);
-// backBuffer = referenceDevice.getDeviceConfiguration().createCompatibleVolatileImage(width,
-// height);
-
- backBufferGraphics = backBuffer.createGraphics();
- CanvasUtils.initGraphics( backBufferGraphics );
-
- // clear the buffer to white (to have a defined state here)
- backBufferGraphics.setColor( java.awt.Color.white );
- backBufferGraphics.fillRect( 0,0,width,height );
- }
-
- public void redraw( Graphics2D graph )
- {
- if( graph != null &&
- backBuffer != null )
- {
- CanvasUtils.printLog("BackBuffer.redraw(): using buffer of size (" +
- backBuffer.getWidth() + "," + backBuffer.getHeight() + ")" );
-
- graph.drawImage(backBuffer, 0, 0, null);
-
- // TODO: this is just twiddled to work. I cannot be sure
- // that this volatile backbuffer will survive in the first
- // place, nor that it wise to leave it in VRAM.
-
- // only flush non-volatile images
- // CanvasUtils.postRenderImageTreatment( backBuffer );
- }
- }
-
- public java.awt.Image getBackBuffer()
- {
- return backBuffer;
- }
-
- public void dispose()
- {
- backBufferGraphics.dispose();
- backBuffer.flush();
- }
-}
diff --git a/canvas/source/java/BezierPolyPolygon.java b/canvas/source/java/BezierPolyPolygon.java
deleted file mode 100644
index ed6c08a21abc..000000000000
--- a/canvas/source/java/BezierPolyPolygon.java
+++ /dev/null
@@ -1,151 +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.
- *
- ************************************************************************/
-
-// Canvas
-import com.sun.star.rendering.*;
-import com.sun.star.geometry.*;
-
-public class BezierPolyPolygon
- extends com.sun.star.lib.uno.helper.ComponentBase
- implements com.sun.star.lang.XServiceInfo,
- com.sun.star.rendering.XBezierPolyPolygon2D
-{
- private java.awt.geom.GeneralPath path;
-
- //----------------------------------------------------------------------------------
-
- public BezierPolyPolygon( RealBezierSegment2D[][] points )
- {
- setBezierSegments( points, 0 );
- }
-
- public java.awt.geom.GeneralPath getJavaPath()
- {
- return path;
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XPolyPolygon implementation
- // ===========================
- //
- public void addPolyPolygon( RealPoint2D position, XPolyPolygon2D polyPolygon )
- {
- }
-
- public int getNumberOfPolygons( )
- {
- return 0;
- }
-
- public int getNumberOfPolygonPoints( int polygon )
- {
- return 0;
- }
-
- public FillRule getFillRule( )
- {
- if( path.getWindingRule() == java.awt.geom.GeneralPath.WIND_EVEN_ODD )
- return FillRule.EVEN_ODD;
- else
- return FillRule.NON_ZERO;
- }
-
- public void setFillRule( FillRule fillRule )
- {
- if( fillRule == FillRule.EVEN_ODD )
- path.setWindingRule( java.awt.geom.GeneralPath.WIND_EVEN_ODD );
- else
- path.setWindingRule( java.awt.geom.GeneralPath.WIND_NON_ZERO );
- }
-
- public boolean isClosed( int index )
- {
- // TODO
- return false;
- }
-
- public void setClosed( int index, boolean closedState )
- {
- // TODO
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XBezierPolyPolygon implementation
- // =================================
- //
- public RealBezierSegment2D[][] getBezierSegments( int nPolygonIndex, int nNumberOfPolygons, int nPointIndex, int nNumberOfPoints )
- {
- return null;
- }
-
- public void setBezierSegments( RealBezierSegment2D[][] points, int nPolygonIndex )
- {
- if( nPolygonIndex != 0 )
- CanvasUtils.printLog( "LinePolyPolygon.setPoints: subset not yet implemented!" );
-
- path = CanvasUtils.makeGenPathFromBezierPoints( points );
- }
-
- public RealBezierSegment2D getBezierSegment( int nPolygonIndex, int nPointIndex )
- {
- return null;
- }
-
- public void setBezierSegment( RealBezierSegment2D point, int nPolygonIndex, int nPointIndex )
- {
- CanvasUtils.printLog( "LinePolyPolygon.setPoint: not yet implemented!" );
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XServiceInfo impl
- // =================
- //
-
- private static final String s_implName = "XBezierPolyPolygon2D.java.impl";
- private static final String s_serviceName = "com.sun.star.rendering.BezierPolyPolygon2D";
-
- public String getImplementationName()
- {
- return s_implName;
- }
-
- public String [] getSupportedServiceNames()
- {
- return new String [] { s_serviceName };
- }
-
- public boolean supportsService( String serviceName )
- {
- return serviceName.equals( s_serviceName );
- }
-}
diff --git a/canvas/source/java/BitmapCanvas.java b/canvas/source/java/BitmapCanvas.java
deleted file mode 100644
index f40c9bf34c3a..000000000000
--- a/canvas/source/java/BitmapCanvas.java
+++ /dev/null
@@ -1,136 +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.
- *
- ************************************************************************/
-
-// UNO
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.XComponentContext;
-import com.sun.star.uno.AnyConverter;
-import com.sun.star.uno.IQueryInterface;
-import com.sun.star.lang.XInitialization;
-import com.sun.star.lib.uno.helper.WeakBase;
-
-// OOo AWT
-import com.sun.star.awt.*;
-
-// Canvas
-import com.sun.star.rendering.*;
-import com.sun.star.geometry.*;
-
-// Java AWT
-import java.awt.*;
-import java.awt.image.*;
-import java.awt.geom.*;
-
-public class BitmapCanvas
- extends CanvasBase
- implements com.sun.star.rendering.XBitmapCanvas,
- com.sun.star.lang.XServiceInfo
-{
- private Graphics2D graphics;
-
- public Graphics2D getGraphics()
- {
- return graphics;
- }
-
- //----------------------------------------------------------------------------------
-
- public BitmapCanvas( Graphics2D _graphics )
- {
- graphics = _graphics;
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XBitmapCanvas impl
- // ==================
- //
-
- public synchronized void copyRect( com.sun.star.rendering.XBitmapCanvas sourceCanvas,
- com.sun.star.geometry.RealRectangle2D sourceRect,
- com.sun.star.rendering.ViewState sourceViewState,
- com.sun.star.rendering.RenderState sourceRenderState,
- com.sun.star.geometry.RealRectangle2D destRect,
- com.sun.star.rendering.ViewState destViewState,
- com.sun.star.rendering.RenderState destRenderState )
- {
- // TODO: create temp image when transform is non-trivial
-
- if( sourceCanvas == this )
- {
- // copy rectangle within the canvas
- graphics.copyArea((int)sourceRect.X1,
- (int)sourceRect.Y1,
- (int)(sourceRect.X2 - sourceRect.X1),
- (int)(sourceRect.Y2 - sourceRect.Y1),
- (int)(destRect.X1 - sourceRect.X1),
- (int)(destRect.Y1 - sourceRect.Y1) );
- }
- else
- {
- if( sourceCanvas instanceof JavaCanvas )
- {
- // cache
- CanvasUtils.setupGraphicsState( graphics, destViewState, destRenderState, CanvasUtils.alsoSetupPaint );
-
- // TODO: really extract correct source rect here
- BufferedImage backBuffer = ((BufferedGraphics2D)((JavaCanvas)sourceCanvas).getGraphics()).getBackBuffer();
- graphics.drawImage( backBuffer, 0, 0, null );
- CanvasUtils.postRenderImageTreatment( backBuffer );
-
- }
- // TODO: foreign canvas
- }
- }
-
- //----------------------------------------------------------------------------------
-
- private static final String s_implName = "XBitmapCanvas.java.impl";
- private static final String s_serviceName = "com.sun.star.rendering.BitmapCanvas";
-
- //----------------------------------------------------------------------------------
-
- //
- // XServiceInfo impl
- // =================
- //
- public String getImplementationName()
- {
- return s_implName;
- }
-
- public String [] getSupportedServiceNames()
- {
- return new String [] { s_serviceName };
- }
-
- public boolean supportsService( String serviceName )
- {
- return serviceName.equals( s_serviceName );
- }
-}
diff --git a/canvas/source/java/BufferedGraphics2D.java b/canvas/source/java/BufferedGraphics2D.java
deleted file mode 100644
index 88691351809e..000000000000
--- a/canvas/source/java/BufferedGraphics2D.java
+++ /dev/null
@@ -1,600 +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.
- *
- ************************************************************************/
-
-// Java AWT
-import java.awt.*;
-import java.awt.geom.*;
-import java.awt.image.*;
-import java.awt.image.renderable.*;
-import java.awt.font.*;
-import java.text.*;
-import java.util.*;
-
-
-public class BufferedGraphics2D
- extends java.awt.Graphics2D
-{
- // TODO: Somehow, get rid of this duplicate graphics (the graphics member,
- // and this object itself, extending a Graphics2D)
- private Graphics2D graphics;
- private BufferedImage backBuffer;
- private Graphics2D backBufferGraphics;
-
- //----------------------------------------------------------------------------------
-
- public BufferedGraphics2D( java.awt.Graphics2D _graphics, int width, int height )
- {
- setGraphics( _graphics, Math.max(1,width), Math.max(1,height) );
- }
-
- public void redraw( Graphics2D graph )
- {
- if( graph != null &&
- backBuffer != null )
- {
- CanvasUtils.printLog("BufferedGraphics2D.redraw: using buffer of size (" +
- backBuffer.getWidth() + "," + backBuffer.getHeight() + ")" );
-
- // set transform to identity
- graph.setTransform( new AffineTransform() );
- graph.drawImage(backBuffer, 0, 0, null);
- CanvasUtils.postRenderImageTreatment( backBuffer );
- }
- }
-
- public BufferedImage getBackBuffer()
- {
- return backBuffer;
- }
-
- public void setSize( int width, int height )
- {
- if( backBuffer != null &&
- width == backBuffer.getWidth() &&
- height == backBuffer.getHeight() )
- {
- return;
- }
-
- if( backBufferGraphics != null )
- backBufferGraphics.dispose();
-
- if( backBuffer != null )
- backBuffer.flush();
-
- // TODO: Maybe VolatileImage with another BufferedImage as a backup is
- // a tad faster here.
- backBuffer = graphics.getDeviceConfiguration().createCompatibleImage(width,
- height);
-
- backBufferGraphics = backBuffer.createGraphics();
- CanvasUtils.initGraphics( backBufferGraphics );
-
- // clear the buffer to white (to have a defined state here)
- backBufferGraphics.setColor( java.awt.Color.white );
- backBufferGraphics.fillRect( 0,0,width,height );
- }
-
- public void setGraphics( Graphics2D _graphics, int width, int height )
- {
- if( graphics != null )
- graphics.dispose();
-
- graphics = _graphics;
-
- setSize(width,height);
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // Graphics
- // ========
- //
- public void clearRect(int x, int y, int width, int height)
- {
- graphics.clearRect(x,y,width,height);
- backBufferGraphics.clearRect(x,y,width,height);
- }
-
- public void clipRect(int x, int y, int width, int height)
- {
- graphics.clipRect(x,y,width,height);
- backBufferGraphics.clipRect(x,y,width,height);
- }
-
- public void copyArea(int x, int y, int width, int height, int dx, int dy)
- {
- graphics.copyArea(x,y,width,height,dx,dy);
- backBufferGraphics.copyArea(x,y,width,height,dx,dy);
- }
-
- public Graphics create()
- {
- return null;
- }
-
- public Graphics create(int x, int y, int width, int height)
- {
- return null;
- }
-
- public void dispose()
- {
- graphics.dispose();
- backBufferGraphics.dispose();
- backBuffer.flush();
- }
-
- public void draw3DRect(int x, int y, int width, int height, boolean raised)
- {
- graphics.draw3DRect(x,y,width,height,raised);
- backBufferGraphics.draw3DRect(x,y,width,height,raised);
- }
-
- public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
- {
- graphics.drawArc(x,y,width,height,startAngle,arcAngle);
- backBufferGraphics.drawArc(x,y,width,height,startAngle,arcAngle);
- }
-
- public void drawBytes(byte[] data, int offset, int length, int x, int y)
- {
- graphics.drawBytes(data,offset,length,x,y);
- backBufferGraphics.drawBytes(data,offset,length,x,y);
- }
-
- public void drawChars(char[] data, int offset, int length, int x, int y)
- {
- graphics.drawChars(data,offset,length,x,y);
- backBufferGraphics.drawChars(data,offset,length,x,y);
- }
-
- public boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer)
- {
- backBufferGraphics.drawImage(img,x,y,bgcolor,observer);
- return graphics.drawImage(img,x,y,bgcolor,observer);
- }
-
- public boolean drawImage(Image img, int x, int y, ImageObserver observer)
- {
- backBufferGraphics.drawImage(img,x,y,observer);
- return graphics.drawImage(img,x,y,observer);
- }
-
- public boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer)
- {
- backBufferGraphics.drawImage(img,x,y,width,height,bgcolor,observer);
- return graphics.drawImage(img,x,y,width,height,bgcolor,observer);
- }
-
- public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer)
- {
- backBufferGraphics.drawImage(img,x,y,width,height,observer);
- return graphics.drawImage(img,x,y,width,height,observer);
- }
-
- public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer)
- {
- backBufferGraphics.drawImage(img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2,bgcolor,observer);
- return graphics.drawImage(img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2,bgcolor,observer);
- }
-
- public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer)
- {
- backBufferGraphics.drawImage(img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2,observer);
- return graphics.drawImage(img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2,observer);
- }
-
- public void drawLine(int x1, int y1, int x2, int y2)
- {
- graphics.drawLine(x1,y1,x2,y2);
- backBufferGraphics.drawLine(x1,y1,x2,y2);
- }
-
- public void drawOval(int x, int y, int width, int height)
- {
- graphics.drawOval(x,y,width,height);
- backBufferGraphics.drawOval(x,y,width,height);
- }
-
- public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
- {
- graphics.drawPolygon(xPoints,yPoints,nPoints);
- backBufferGraphics.drawPolygon(xPoints,yPoints,nPoints);
- }
-
- public void drawPolygon(Polygon p)
- {
- graphics.drawPolygon(p);
- backBufferGraphics.drawPolygon(p);
- }
-
- public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
- {
- graphics.drawPolyline(xPoints,yPoints,nPoints);
- backBufferGraphics.drawPolyline(xPoints,yPoints,nPoints);
- }
-
- public void drawRect(int x, int y, int width, int height)
- {
- graphics.drawRect(x,y,width,height);
- backBufferGraphics.drawRect(x,y,width,height);
- }
-
- public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
- {
- graphics.drawRoundRect(x,y,width,height,arcWidth,arcHeight);
- backBufferGraphics.drawRoundRect(x,y,width,height,arcWidth,arcHeight);
- }
-
- public void drawString(AttributedCharacterIterator iterator, int x, int y)
- {
- graphics.drawString(iterator,x,y);
- backBufferGraphics.drawString(iterator,x,y);
- }
-
- public void drawString(String str, int x, int y)
- {
- graphics.drawString(str,x,y);
- backBufferGraphics.drawString(str,x,y);
- }
-
- public void fill3DRect(int x, int y, int width, int height, boolean raised)
- {
- graphics.fill3DRect(x,y,width,height,raised);
- backBufferGraphics.fill3DRect(x,y,width,height,raised);
- }
-
- public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
- {
- graphics.fillArc(x,y,width,height,startAngle,arcAngle);
- backBufferGraphics.fillArc(x,y,width,height,startAngle,arcAngle);
- }
-
- public void fillOval(int x, int y, int width, int height)
- {
- graphics.fillOval(x,y,width,height);
- backBufferGraphics.fillOval(x,y,width,height);
- }
-
- public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
- {
- graphics.fillPolygon(xPoints,yPoints,nPoints);
- backBufferGraphics.fillPolygon(xPoints,yPoints,nPoints);
- }
-
- public void fillPolygon(Polygon p)
- {
- graphics.fillPolygon(p);
- backBufferGraphics.fillPolygon(p);
- }
-
- public void fillRect(int x, int y, int width, int height)
- {
- graphics.fillRect(x,y,width,height);
- backBufferGraphics.fillRect(x,y,width,height);
- }
-
- public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
- {
- graphics.fillRoundRect(x,y,width,height,arcWidth,arcHeight);
- backBufferGraphics.fillRoundRect(x,y,width,height,arcWidth,arcHeight);
- }
-
- public Shape getClip()
- {
- return graphics.getClip();
- }
-
- public Rectangle getClipBounds()
- {
- return graphics.getClipBounds();
- }
-
- public Rectangle getClipBounds(Rectangle r)
- {
- return graphics.getClipBounds(r);
- }
-
- public Rectangle getClipRect()
- {
- return graphics.getClipRect();
- }
-
- public Color getColor()
- {
- return getColor();
- }
-
- public Font getFont()
- {
- return getFont();
- }
-
- public FontMetrics getFontMetrics()
- {
- return getFontMetrics();
- }
-
- public FontMetrics getFontMetrics(Font f)
- {
- return getFontMetrics(f);
- }
-
- public boolean hitClip(int x, int y, int width, int height)
- {
- return graphics.hitClip(x,y,width,height);
- }
-
- public void setClip(int x, int y, int width, int height)
- {
- graphics.setClip(x,y,width,height);
- backBufferGraphics.setClip(x,y,width,height);
- }
-
- public void setClip(Shape clip)
- {
- graphics.setClip(clip);
- backBufferGraphics.setClip(clip);
- }
-
- public void setColor(Color c)
- {
- graphics.setColor(c);
- backBufferGraphics.setColor(c);
- }
-
- public void setFont(Font font)
- {
- graphics.setFont(font);
- backBufferGraphics.setFont(font);
- }
-
- public void setPaintMode()
- {
- graphics.setPaintMode();
- backBufferGraphics.setPaintMode();
- }
-
- public void setXORMode(Color c1)
- {
- graphics.setXORMode(c1);
- backBufferGraphics.setXORMode(c1);
- }
-
- public String toString()
- {
- return graphics.toString();
- }
-
- public void translate(int x, int y)
- {
- graphics.translate(x,y);
- backBufferGraphics.translate(x,y);
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // Graphics2D
- // ==========
- //
- public void addRenderingHints(Map hints)
- {
- graphics.addRenderingHints(hints);
- backBufferGraphics.addRenderingHints(hints);
- }
-
- public void clip(Shape s)
- {
- graphics.clip(s);
- backBufferGraphics.clip(s);
- }
-
- public void draw(Shape s)
- {
- graphics.draw(s);
- backBufferGraphics.draw(s);
- }
-
- public void drawGlyphVector(GlyphVector g, float x, float y)
- {
- graphics.drawGlyphVector(g,x,y);
- backBufferGraphics.drawGlyphVector(g,x,y);
- }
-
- public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y)
- {
- graphics.drawImage(img,op,x,y);
- backBufferGraphics.drawImage(img,op,x,y);
- }
-
- public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs)
- {
- backBufferGraphics.drawImage(img,xform,obs);
- return graphics.drawImage(img,xform,obs);
- }
-
- public void drawRenderableImage(RenderableImage img, AffineTransform xform)
- {
- graphics.drawRenderableImage(img,xform);
- backBufferGraphics.drawRenderableImage(img,xform);
- }
-
- public void drawRenderedImage(RenderedImage img, AffineTransform xform)
- {
- graphics.drawRenderedImage(img,xform);
- backBufferGraphics.drawRenderedImage(img,xform);
- }
-
- public void drawString(AttributedCharacterIterator iterator, float x, float y)
- {
- graphics.drawString(iterator,x,y);
- backBufferGraphics.drawString(iterator,x,y);
- }
-
- public void drawString(String s, float x, float y)
- {
- graphics.drawString(s,x,y);
- backBufferGraphics.drawString(s,x,y);
- }
-
- public void fill(Shape s)
- {
- graphics.fill(s);
- backBufferGraphics.fill(s);
- }
-
- public Color getBackground()
- {
- return graphics.getBackground();
- }
-
- public Composite getComposite()
- {
- return graphics.getComposite();
- }
-
- public GraphicsConfiguration getDeviceConfiguration()
- {
- return graphics.getDeviceConfiguration();
- }
-
- public FontRenderContext getFontRenderContext()
- {
- return graphics.getFontRenderContext();
- }
-
- public Paint getPaint()
- {
- return graphics.getPaint();
- }
-
- public Object getRenderingHint(RenderingHints.Key hintKey)
- {
- return graphics.getRenderingHint(hintKey);
- }
-
- public RenderingHints getRenderingHints()
- {
- return graphics.getRenderingHints();
- }
-
- public Stroke getStroke()
- {
- return graphics.getStroke();
- }
-
- public AffineTransform getTransform()
- {
- return graphics.getTransform();
- }
-
- public boolean hit(Rectangle rect, Shape s, boolean onStroke)
- {
- return graphics.hit(rect,s,onStroke);
- }
-
- public void rotate(double theta)
- {
- graphics.rotate(theta);
- backBufferGraphics.rotate(theta);
- }
-
- public void rotate(double theta, double x, double y)
- {
- graphics.rotate(theta,x,y);
- backBufferGraphics.rotate(theta,x,y);
- }
-
- public void scale(double sx, double sy)
- {
- graphics.scale(sx,sy);
- backBufferGraphics.scale(sx,sy);
- }
-
- public void setBackground(Color color)
- {
- graphics.setBackground(color);
- backBufferGraphics.setBackground(color);
- }
-
- public void setComposite(Composite comp)
- {
- graphics.setComposite(comp);
- backBufferGraphics.setComposite(comp);
- }
-
- public void setPaint(Paint paint)
- {
- graphics.setPaint(paint);
- backBufferGraphics.setPaint(paint);
- }
-
- public void setRenderingHint(RenderingHints.Key hintKey, Object hintValue)
- {
- graphics.setRenderingHint(hintKey,hintValue);
- backBufferGraphics.setRenderingHint(hintKey,hintValue);
- }
-
- public void setRenderingHints(Map hints)
- {
- graphics.setRenderingHints(hints);
- backBufferGraphics.setRenderingHints(hints);
- }
-
- public void setStroke(Stroke s)
- {
- graphics.setStroke(s);
- backBufferGraphics.setStroke(s);
- }
-
- public void setTransform(AffineTransform Tx)
- {
- graphics.setTransform(Tx);
- backBufferGraphics.setTransform(Tx);
- }
-
- public void shear(double shx, double shy)
- {
- graphics.shear(shx,shy);
- backBufferGraphics.shear(shx,shy);
- }
-
- public void transform(AffineTransform Tx)
- {
- graphics.transform(Tx);
- backBufferGraphics.transform(Tx);
- }
-
- public void translate(double tx, double ty)
- {
- graphics.translate(tx,ty);
- backBufferGraphics.translate(tx,ty);
- }
-}
diff --git a/canvas/source/java/CanvasBase.java b/canvas/source/java/CanvasBase.java
deleted file mode 100644
index 2df796d06f84..000000000000
--- a/canvas/source/java/CanvasBase.java
+++ /dev/null
@@ -1,341 +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.
- *
- ************************************************************************/
-
-// Canvas
-import com.sun.star.rendering.*;
-import com.sun.star.geometry.*;
-
-// Java AWT
-import java.awt.*;
-import java.awt.geom.*;
-
-public abstract class CanvasBase
- extends com.sun.star.lib.uno.helper.ComponentBase
- implements com.sun.star.rendering.XCanvas
-{
- // to be overridden
- public abstract Graphics2D getGraphics();
-
- //----------------------------------------------------------------------------------
-
- //
- // XCanvas interface
- // =================
- //
- public synchronized void clear()
- {
- Graphics2D graphics = getGraphics();
- // TODO(F3): retrieve true dimensions of the Graphics
- graphics.clearRect(0,0,1000,1000);
- }
-
- public synchronized void drawPoint( RealPoint2D aPoint,
- ViewState viewState,
- RenderState renderState ) throws com.sun.star.lang.IllegalArgumentException
- {
- // cache
- Graphics2D graphics = getGraphics();
-
- // initialize the Graphics2D
- CanvasUtils.setupGraphicsState( graphics, viewState, renderState, CanvasUtils.alsoSetupPaint );
-
- // calculate the domain value for a single device pixel. we're
- // using delta mapping here, to avoid later subtraction of two
- // mapped values (as we really only need a transformed size,
- // not a transformed point).
- AffineTransform transform = graphics.getTransform();
- AffineTransform inverse;
- try
- {
- inverse = transform.createInverse();
- }
- catch( NoninvertibleTransformException e )
- {
- // transformation not invertible. Nothing to render then.
- return;
- }
-
- java.awt.geom.Point2D.Double pointSize = new java.awt.geom.Point2D.Double(1.0,1.0);
- java.awt.geom.Point2D.Double domainPointSize = new java.awt.geom.Point2D.Double();
- inverse.deltaTransform( pointSize, domainPointSize );
-
- // render a circle one device pixel wide
- Ellipse2D.Double ellipse = new Ellipse2D.Double(aPoint.X, aPoint.Y, domainPointSize.x, domainPointSize.y);
-
- // render, at last
- graphics.fill( ellipse );
-
- CanvasUtils.printLog( "XCanvas: drawPoint called" );
- }
-
- public synchronized void drawLine( RealPoint2D aStartPoint,
- RealPoint2D aEndPoint,
- ViewState viewState,
- RenderState renderState ) throws com.sun.star.lang.IllegalArgumentException
- {
- // cache
- Graphics2D graphics = getGraphics();
-
- // initialize the Graphics2D
- CanvasUtils.setupGraphicsState( graphics, viewState, renderState, CanvasUtils.alsoSetupPaint );
- graphics.setStroke( new BasicStroke() );
-
- // setup line object
- Line2D.Double line = new Line2D.Double(aStartPoint.X, aStartPoint.Y, aEndPoint.X, aEndPoint.Y);
-
- // render, at last
- graphics.draw( line );
-
- CanvasUtils.printLog( "XCanvas: drawLine called" );
- }
-
- public synchronized void drawBezier( RealBezierSegment2D aBezierSegment,
- RealPoint2D aEndPoint,
- ViewState viewState,
- RenderState renderState ) throws com.sun.star.lang.IllegalArgumentException
- {
- // cache
- Graphics2D graphics = getGraphics();
-
- // initialize the Graphics2D
- CanvasUtils.setupGraphicsState( graphics, viewState, renderState, CanvasUtils.alsoSetupPaint );
- graphics.setStroke( new BasicStroke() );
-
- // setup bezier object
- CubicCurve2D.Double curve = new CubicCurve2D.Double(aBezierSegment.Px, aBezierSegment.Py,
- aBezierSegment.C1x, aBezierSegment.C1y,
- aBezierSegment.C2x, aBezierSegment.C2y,
- aEndPoint.X, aEndPoint.Y);
-
- // render, at last
- graphics.draw( curve );
-
- CanvasUtils.printLog( "XCanvas: drawbezier called" );
- }
-
- public synchronized XCachedPrimitive drawPolyPolygon( XPolyPolygon2D xPolyPolygon,
- ViewState viewState,
- RenderState renderState ) throws com.sun.star.lang.IllegalArgumentException
- {
- CanvasUtils.printLog( "CanvasBase.drawPolyPolygon() called" );
-
- // cache
- Graphics2D graphics = getGraphics();
-
- // initialize the Graphics2D
- CanvasUtils.setupGraphicsState( graphics, viewState, renderState, CanvasUtils.alsoSetupPaint );
- graphics.setStroke( new BasicStroke() );
-
- // render the polygon
- // TODO: maybe use Graphics.drawPolyline here!
- graphics.draw( CanvasUtils.makeGeneralPath(xPolyPolygon) );
-
- CanvasUtils.printLog( "XCanvas: drawPolyPolygon called" );
-
- return null;
- }
-
- public synchronized XCachedPrimitive strokePolyPolygon( XPolyPolygon2D xPolyPolygon,
- ViewState viewState,
- RenderState renderState,
- StrokeAttributes strokeAttributes ) throws com.sun.star.lang.IllegalArgumentException
- {
- // cache
- Graphics2D graphics = getGraphics();
-
- // initialize the Graphics2D
- CanvasUtils.setupGraphicsState( graphics, viewState, renderState, CanvasUtils.alsoSetupPaint );
- CanvasUtils.applyStrokeAttributes( graphics, strokeAttributes );
-
- // stroke the polygon
- graphics.draw( CanvasUtils.makeGeneralPath(xPolyPolygon) );
-
- CanvasUtils.printLog( "XCanvas: strokePolyPolygon called" );
-
- return null;
- }
-
- public synchronized XCachedPrimitive strokeTexturedPolyPolygon( XPolyPolygon2D xPolyPolygon,
- ViewState viewState,
- RenderState renderState,
- Texture[] textures,
- StrokeAttributes strokeAttributes ) throws com.sun.star.lang.IllegalArgumentException, VolatileContentDestroyedException
- {
- return null;
- }
-
- public synchronized XCachedPrimitive strokeTextureMappedPolyPolygon( XPolyPolygon2D xPolyPolygon,
- ViewState viewState,
- RenderState renderState,
- Texture[] textures,
- com.sun.star.geometry.XMapping2D xMapping,
- StrokeAttributes strokeAttributes ) throws com.sun.star.lang.IllegalArgumentException, VolatileContentDestroyedException
- {
- return null;
- }
-
- public synchronized XPolyPolygon2D queryStrokeShapes( com.sun.star.rendering.XPolyPolygon2D xPolyPolygon,
- com.sun.star.rendering.ViewState viewState,
- com.sun.star.rendering.RenderState renderState,
- com.sun.star.rendering.StrokeAttributes strokeAttributes ) throws com.sun.star.lang.IllegalArgumentException
- {
- return null;
- }
-
- public synchronized XCachedPrimitive fillPolyPolygon( com.sun.star.rendering.XPolyPolygon2D xPolyPolygon,
- com.sun.star.rendering.ViewState viewState,
- com.sun.star.rendering.RenderState renderState ) throws com.sun.star.lang.IllegalArgumentException
- {
- CanvasUtils.printLog( "CanvasBase.fillPolyPolygon() called" );
-
- // cache
- Graphics2D graphics = getGraphics();
-
- // initialize the Graphics2D
- CanvasUtils.setupGraphicsState( graphics, viewState, renderState, CanvasUtils.alsoSetupPaint );
-
- // fill the polygon
- graphics.fill( CanvasUtils.makeGeneralPath(xPolyPolygon) );
-
- CanvasUtils.printLog( "XCanvas: fillPolyPolygon called" );
-
- return null;
- }
-
- public synchronized XCachedPrimitive fillTexturedPolyPolygon( com.sun.star.rendering.XPolyPolygon2D xPolyPolygon,
- com.sun.star.rendering.ViewState viewState,
- com.sun.star.rendering.RenderState renderState,
- com.sun.star.rendering.Texture [] textures ) throws com.sun.star.lang.IllegalArgumentException
- {
- return null;
- }
-
- public synchronized XCachedPrimitive fillTextureMappedPolyPolygon( XPolyPolygon2D xPolyPolygon,
- ViewState viewState,
- RenderState renderState,
- Texture[] textures,
- com.sun.star.geometry.XMapping2D xMapping ) throws com.sun.star.lang.IllegalArgumentException, VolatileContentDestroyedException
- {
- return null;
- }
-
- public synchronized XCanvasFont createFont( FontRequest fontRequest, com.sun.star.beans.PropertyValue[] extraFontProperties, com.sun.star.geometry.Matrix2D fontMatrix ) throws com.sun.star.lang.IllegalArgumentException
- {
- // TODO: support extra arguments
- return new CanvasFont( fontRequest, this );
- }
-
- public FontInfo[] queryAvailableFonts( FontInfo aFilter, com.sun.star.beans.PropertyValue[] aFontProperties ) throws com.sun.star.lang.IllegalArgumentException
- {
- // TODO
- return null;
- }
-
- public XCachedPrimitive drawText( StringContext text, XCanvasFont xFont, ViewState viewState, RenderState renderState, byte textDirection ) throws com.sun.star.lang.IllegalArgumentException
- {
- CanvasUtils.printLog( "CanvasBase.drawText() called" );
-
- // cache
- Graphics2D graphics = getGraphics();
-
- CanvasUtils.printLog( "XCanvas: drawText called" );
-
- CanvasUtils.setupGraphicsState( graphics, viewState, renderState, CanvasUtils.alsoSetupPaint );
- CanvasUtils.setupGraphicsFont( graphics, viewState, renderState, xFont );
-
- CanvasUtils.printLog( "XCanvas: drawText rendering \""+ text.Text.substring(text.StartPosition, text.StartPosition+text.Length) + "\"" );
-
- graphics.drawString( text.Text.substring(text.StartPosition, text.StartPosition+text.Length), (float)0.0, (float)0.0 );
- return null;
- }
-
- public XCachedPrimitive drawTextLayout( XTextLayout layoutetText, ViewState viewState, RenderState renderState ) throws com.sun.star.lang.IllegalArgumentException
- {
- CanvasUtils.printLog( "CanvasBase.drawOffsettedText() called" );
-
- // cache
- Graphics2D graphics = getGraphics();
-
- CanvasUtils.printLog( "XCanvas: drawOffsettedText called" );
-
- CanvasUtils.setupGraphicsState( graphics, viewState, renderState, CanvasUtils.alsoSetupPaint );
- CanvasUtils.setupGraphicsFont( graphics, viewState, renderState, layoutetText.getFont() );
-
- CanvasUtils.printLog( "XCanvas: drawOffsettedText canvas setup done" );
-
- if( layoutetText instanceof TextLayout )
- {
- ((TextLayout)layoutetText).draw( graphics );
- }
- else
- {
- CanvasUtils.printLog( "drawTextLayout: mismatching TextLayout object." );
- throw new com.sun.star.lang.IllegalArgumentException();
- }
-
- return null;
- }
-
- public synchronized XCachedPrimitive drawBitmap( com.sun.star.rendering.XBitmap xBitmap,
- com.sun.star.rendering.ViewState viewState,
- com.sun.star.rendering.RenderState renderState ) throws com.sun.star.lang.IllegalArgumentException
- {
- CanvasUtils.printLog( "CanvasBase.drawBitmap() called" );
-
- // cache
- Graphics2D graphics = getGraphics();
-
- CanvasUtils.setupGraphicsState( graphics, viewState, renderState, CanvasUtils.alsoSetupPaint );
-
- java.awt.image.BufferedImage bitmap = CanvasUtils.getBufferedImage( xBitmap );
-
- if( !graphics.drawImage(bitmap, 0, 0, null) )
- CanvasUtils.printLog( "CanvasBase.drawBitmap: image paint incomplete" );
-
- CanvasUtils.postRenderImageTreatment( bitmap );
-
- return null;
- }
-
- public synchronized XCachedPrimitive drawBitmapModulated( com.sun.star.rendering.XBitmap xBitmap,
- com.sun.star.rendering.ViewState viewState,
- com.sun.star.rendering.RenderState renderState ) throws com.sun.star.lang.IllegalArgumentException
- {
- CanvasUtils.printLog( "CanvasBase.drawBitmapModulated() called" );
-
- // TODO(F3): Implement channel modulation
- return drawBitmap(xBitmap,
- viewState,
- renderState);
- }
-
- public synchronized XGraphicDevice getDevice()
- {
- CanvasUtils.printLog( "CanvasBase.getDevice() called" );
- return new CanvasGraphicDevice( getGraphics() );
- }
-}
diff --git a/canvas/source/java/CanvasBitmap.java b/canvas/source/java/CanvasBitmap.java
deleted file mode 100644
index cfb7617dc094..000000000000
--- a/canvas/source/java/CanvasBitmap.java
+++ /dev/null
@@ -1,252 +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.
- *
- ************************************************************************/
-
-// Canvas
-import com.sun.star.rendering.*;
-import com.sun.star.geometry.*;
-
-public class CanvasBitmap
- extends CanvasBase
- implements com.sun.star.lang.XServiceInfo,
- com.sun.star.rendering.XBitmapCanvas,
- com.sun.star.rendering.XIntegerBitmap
-{
- private java.awt.image.BufferedImage bitmap;
- private java.awt.Graphics2D graphics;
-
- public CanvasBitmap( java.awt.image.BufferedImage _bitmap )
- {
- bitmap = _bitmap;
- graphics = bitmap.createGraphics();
- }
-
- public CanvasBitmap( IntegerSize2D mySize )
- {
- bitmap = new java.awt.image.BufferedImage(mySize.Width, mySize.Height,
- java.awt.image.BufferedImage.TYPE_4BYTE_ABGR);
- graphics = bitmap.createGraphics();
- }
-
- public CanvasBitmap( RealSize2D newSize, boolean beFast, CanvasBitmap source )
- {
-// java.awt.geom.AffineTransform transform = new java.awt.geom.AffineTransform();
-// transform.scale( newSize.width/size.Width, newSize.height/size.Height );
-
-// // TODO: Maybe keep the image returned via
-// // bitmap.getScaledInstance, and do scaling lazy.
-// bitmap = new java.awt.image.BufferedImage((int)(newSize.width+.5),
-// (int)(newSize.height+.5),
-// java.awt.image.BufferedImage.TYPE_4BYTE_ABGR);
-
-// java.awt.image.AffineTransformOp transformer =
-// new java.awt.image.AffineTransformOp( transform,
-// java.awt.image.AffineTransformOp.TYPE_BILINEAR);
-
-// transformer.filter(source.getBufferedImage(), bitmap);
- }
-
- public synchronized java.awt.image.BufferedImage getBufferedImage()
- {
- return bitmap;
- }
-
- public java.awt.Graphics2D getGraphics()
- {
- return graphics;
- }
-
- //
- // XBitmap implementation
- // ======================
- //
-
- public synchronized IntegerSize2D getSize()
- {
- return new IntegerSize2D( bitmap.getWidth(),
- bitmap.getHeight() );
- }
-
- //----------------------------------------------------------------------------------
-
- public synchronized XBitmapCanvas queryBitmapCanvas()
- {
- return this;
- }
-
- //----------------------------------------------------------------------------------
-
- public synchronized com.sun.star.rendering.XBitmap getScaledBitmap( RealSize2D newSize, boolean beFast ) throws com.sun.star.lang.IllegalArgumentException, VolatileContentDestroyedException
- {
- return new CanvasBitmap( newSize, beFast, this );
- }
-
- //----------------------------------------------------------------------------------
-
- public synchronized boolean hasAlpha()
- {
- // TODO
- return false;
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XBitmapCanvas impl
- // ==================
- //
-
- public synchronized void copyRect( com.sun.star.rendering.XBitmapCanvas sourceCanvas,
- com.sun.star.geometry.RealRectangle2D sourceRect,
- com.sun.star.rendering.ViewState sourceViewState,
- com.sun.star.rendering.RenderState sourceRenderState,
- com.sun.star.geometry.RealRectangle2D destRect,
- com.sun.star.rendering.ViewState destViewState,
- com.sun.star.rendering.RenderState destRenderState )
- {
- CanvasUtils.printLog( "JavaCanvas.copyRect() called" );
-
- // TODO: create temp image when transform is non-trivial
-
- if( sourceCanvas == this )
- {
- // copy rectangle within the canvas
- getGraphics().copyArea((int)sourceRect.X1,
- (int)sourceRect.Y1,
- (int)(sourceRect.X2 - sourceRect.X1),
- (int)(sourceRect.Y2 - sourceRect.Y1),
- (int)(destRect.X1 - sourceRect.X1),
- (int)(destRect.Y1 - sourceRect.Y1) );
- }
- else
- {
- if( sourceCanvas instanceof JavaCanvas )
- {
- // cache
- CanvasUtils.setupGraphicsState( getGraphics(), destViewState, destRenderState, CanvasUtils.alsoSetupPaint );
-
- java.awt.Image backBuffer = ((JavaCanvas)sourceCanvas).backBuffer.getBackBuffer();
-
- // TODO: really extract correct source rect here
- getGraphics().drawImage( backBuffer, 0, 0, null);
- CanvasUtils.postRenderImageTreatment( backBuffer );
- }
- // TODO: foreign canvas
- }
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XIntegerBitmap implementation
- // =============================
- //
-
- public synchronized byte[] getData( IntegerBitmapLayout[] bitmapLayout,
- IntegerRectangle2D rect )
- {
- int [] pixelData = bitmap.getRGB( rect.X1, rect.Y1, rect.X2 - rect.X1, rect.Y1 - rect.Y2, null, 0, 0 );
-
- return CanvasUtils.int2byte( pixelData );
- }
-
- //----------------------------------------------------------------------------------
-
- public synchronized void setData( byte[] data, IntegerBitmapLayout bitmapLayout, com.sun.star.geometry.IntegerRectangle2D rect )
- {
- int [] pixelData = CanvasUtils.byte2int( data );
- bitmap.setRGB( rect.X1, rect.Y1, rect.X2 - rect.X1, rect.Y2 - rect.Y1, pixelData, 0, bitmap.getWidth() );
- }
-
- //----------------------------------------------------------------------------------
-
- public synchronized void setPixel( byte[] color, IntegerBitmapLayout bitmapLayout, com.sun.star.geometry.IntegerPoint2D pos )
- {
- if( color.length != 4 )
- CanvasUtils.printLog( "CanvasBitmap.setPixel: Wrong color format" );
-
- int pixel = color[0] + (color[1] + (color[2] + color[3]*256)*256)*256;
- bitmap.setRGB( pos.X, pos.Y, pixel );
- }
-
- //----------------------------------------------------------------------------------
-
- public synchronized byte[] getPixel( IntegerBitmapLayout[] bitmapLayout,
- IntegerPoint2D pos )
- {
- int pixel = bitmap.getRGB( pos.X, pos.Y );
-
- byte[] res = new byte[4];
- res[0] = (byte)(pixel & 255);
- res[1] = (byte)((pixel/256) & 255);
- res[2] = (byte)((pixel/256/256) & 255);
- res[3] = (byte)((pixel/256/256/256) & 255);
-
- return res;
- }
-
- //----------------------------------------------------------------------------------
-
- public synchronized XBitmapPalette getPalette()
- {
- return null;
- }
-
- //----------------------------------------------------------------------------------
-
- public synchronized IntegerBitmapLayout getMemoryLayout()
- {
- // TODO: finish that one
- IntegerBitmapLayout layout = new IntegerBitmapLayout();
-
- return layout;
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XServiceInfo impl
- // =================
- //
-
- private static final String s_implName = "XIntegerBitmap.java.impl";
- private static final String s_serviceName = "com.sun.star.rendering.IntegerBitmap";
-
- public String getImplementationName()
- {
- return s_implName;
- }
-
- public String [] getSupportedServiceNames()
- {
- return new String [] { s_serviceName };
- }
-
- public boolean supportsService( String serviceName )
- {
- return serviceName.equals( s_serviceName );
- }
-}
diff --git a/canvas/source/java/CanvasClonedSprite.java b/canvas/source/java/CanvasClonedSprite.java
deleted file mode 100644
index d5f85678db4f..000000000000
--- a/canvas/source/java/CanvasClonedSprite.java
+++ /dev/null
@@ -1,185 +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.
- *
- ************************************************************************/
-
-// Canvas
-import com.sun.star.rendering.*;
-import com.sun.star.geometry.*;
-
-// Java AWT
-import java.awt.geom.*;
-
-public class CanvasClonedSprite
- extends com.sun.star.lib.uno.helper.ComponentBase
- implements com.sun.star.rendering.XSprite,
- com.sun.star.lang.XServiceInfo,
- SpriteBase
-{
- private JavaCanvas canvas;
- private double alpha;
- private java.awt.geom.Point2D.Double outputPosition;
- private SpriteRep spriteRep;
- private SpriteBase original;
-
- //----------------------------------------------------------------------------------
-
- public CanvasClonedSprite( JavaCanvas _canvas,
- XSprite _original )
- {
- CanvasUtils.printLog( "CanvasClonesSprite constructor called!" );
-
- canvas = _canvas;
-
- if( _original instanceof SpriteBase )
- {
- original = (SpriteBase)_original;
- }
-
- alpha = 0.0;
- outputPosition = new java.awt.geom.Point2D.Double(0.0,0.0);
-
- // TODO: throw on error here!
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // SpriteBase
- // ==========
- //
- public SpriteRep getSpriteRep()
- {
- if( spriteRep == null )
- {
- spriteRep = new SpriteRep( original.getSpriteRep() );
-
- spriteRep.moveSprite( outputPosition );
- spriteRep.setSpriteAlpha( alpha );
-
- // TODO: Check for spriteRep.buffer != null here, throw otherwise
- }
- return spriteRep;
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XComponent
- // ==========
- //
- public void dispose()
- {
- canvas = null;
- spriteRep = null;
- original = null;
-
- super.dispose();
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XSprite impl
- // ==================
- //
-
- public synchronized void setPriority( double nPriority )
- {
- // TODO
- }
-
- public synchronized void setAlpha( double _alpha )
- {
- alpha = _alpha;
-
- if( spriteRep != null )
- {
- spriteRep.setSpriteAlpha( alpha );
- }
- }
-
- public synchronized void move( RealPoint2D _aNewPos,
- ViewState _viewState,
- RenderState _renderState )
- {
- // transform given point with concatenated transformation
- AffineTransform transform = CanvasUtils.ViewConcatRenderTransform( _viewState, _renderState );
- transform.transform( new java.awt.geom.Point2D.Double(_aNewPos.X,
- _aNewPos.Y),
- outputPosition );
-
- if( spriteRep != null )
- {
- spriteRep.moveSprite( outputPosition );
- }
- }
-
- public synchronized void transform( AffineMatrix2D aTransformation ) throws com.sun.star.lang.IllegalArgumentException
- {
- // TODO
- }
-
- public synchronized void clip( XPolyPolygon2D aClip )
- {
- // TODO
- }
-
- public synchronized void show()
- {
- canvas.showSprite( this );
- canvas.updateScreen( false );
- }
-
- public synchronized void hide()
- {
- canvas.hideSprite( this );
- }
- //----------------------------------------------------------------------------------
-
- private static final String s_implName = "XSprite.java.impl";
- private static final String s_serviceName = "com.sun.star.rendering.Sprite";
-
- //----------------------------------------------------------------------------------
-
- //
- // XServiceInfo impl
- // =================
- //
- public String getImplementationName()
- {
- return s_implName;
- }
-
- public String [] getSupportedServiceNames()
- {
- return new String [] { s_serviceName };
- }
-
- public boolean supportsService( String serviceName )
- {
- return serviceName.equals( s_serviceName );
- }
-}
diff --git a/canvas/source/java/CanvasCustomSprite.java b/canvas/source/java/CanvasCustomSprite.java
deleted file mode 100644
index c3165fa68e80..000000000000
--- a/canvas/source/java/CanvasCustomSprite.java
+++ /dev/null
@@ -1,204 +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.
- *
- ************************************************************************/
-
-// Canvas
-import com.sun.star.rendering.*;
-import com.sun.star.geometry.*;
-
-// Java AWT
-import java.awt.*;
-import java.awt.geom.*;
-
-public class CanvasCustomSprite
- extends com.sun.star.lib.uno.helper.ComponentBase
- implements com.sun.star.rendering.XCustomSprite,
- com.sun.star.lang.XServiceInfo,
- SpriteBase
-{
- private JavaCanvas canvas;
- private RealSize2D spriteSize;
- private Graphics2D referenceGraphics;
- private double alpha;
- private java.awt.geom.Point2D.Double outputPosition;
- private SpriteRep spriteRep;
-
- //----------------------------------------------------------------------------------
-
- public CanvasCustomSprite( RealSize2D _spriteSize,
- JavaCanvas _canvas,
- Graphics2D _referenceGraphics )
- {
- CanvasUtils.printLog( "CanvasCustomSprite constructor called, size is (" + _spriteSize.Width + ", " + _spriteSize.Height + ")" );
-
- canvas = _canvas;
- spriteSize = _spriteSize;
- referenceGraphics = _referenceGraphics;
- alpha = 0.0;
- outputPosition = new java.awt.geom.Point2D.Double(0.0,0.0);
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // SpriteBase
- // ==========
- //
- public synchronized SpriteRep getSpriteRep()
- {
- if( spriteRep == null )
- {
- spriteRep = new SpriteRep();
-
- spriteRep.setupBuffer(referenceGraphics, (int)(spriteSize.Width+.5), (int)(spriteSize.Height+.5) );
-
- spriteRep.moveSprite( outputPosition );
- spriteRep.setSpriteAlpha( alpha );
- }
- return spriteRep;
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XComponent
- // ==========
- //
- public void dispose()
- {
- if( spriteRep != null )
- spriteRep.dispose();
-
- canvas = null;
- referenceGraphics = null;
- spriteRep = null;
-
- super.dispose();
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XCustomSprite impl
- // ==================
- //
-
- public synchronized void setPriority( double nPriority )
- {
- // TODO
- }
-
- public synchronized void setAlpha( double _alpha )
- {
- CanvasUtils.printLog( "CanvasCustomSprite.setAlpha() called" );
-
- alpha = _alpha;
-
- if( spriteRep != null )
- {
- spriteRep.setSpriteAlpha( alpha );
- }
- }
-
- public synchronized void move( RealPoint2D _aNewPos,
- ViewState _viewState,
- RenderState _renderState )
- {
- CanvasUtils.printLog( "CanvasCustomSprite.move() called" );
-
- // transform given point with concatenated transformation
- AffineTransform transform = CanvasUtils.ViewConcatRenderTransform( _viewState, _renderState );
- transform.transform( new java.awt.geom.Point2D.Double(_aNewPos.X,
- _aNewPos.Y),
- outputPosition );
-
- if( spriteRep != null )
- {
- spriteRep.moveSprite( outputPosition );
- }
- }
-
- public synchronized void transform( AffineMatrix2D aTransformation ) throws com.sun.star.lang.IllegalArgumentException
- {
- // TODO
- }
-
- public synchronized void clip( XPolyPolygon2D aClip )
- {
- // TODO
- }
-
- public synchronized void show()
- {
- CanvasUtils.printLog( "CanvasCustomSprite.show() called" );
-
- canvas.showSprite( this );
- canvas.updateScreen( false );
- }
-
- public synchronized void hide()
- {
- CanvasUtils.printLog( "CanvasCustomSprite.hide() called" );
-
- canvas.hideSprite( this );
-
- // do _not_ dispose clear SpriteRep, since we cannot actively
- // repaint ourselves
- }
-
- public synchronized com.sun.star.rendering.XCanvas getContentCanvas()
- {
- CanvasUtils.printLog( "CanvasCustomSprite.getContentCanvas() called" );
-
- return getSpriteRep().getContentCanvas();
- }
-
- //----------------------------------------------------------------------------------
-
- private static final String s_implName = "XCustomSprite.java.impl";
- private static final String s_serviceName = "com.sun.star.rendering.CustomSprite";
-
- //----------------------------------------------------------------------------------
-
- //
- // XServiceInfo impl
- // =================
- //
- public String getImplementationName()
- {
- return s_implName;
- }
-
- public String [] getSupportedServiceNames()
- {
- return new String [] { s_serviceName };
- }
-
- public boolean supportsService( String serviceName )
- {
- return serviceName.equals( s_serviceName );
- }
-}
diff --git a/canvas/source/java/CanvasFont.java b/canvas/source/java/CanvasFont.java
deleted file mode 100644
index 1ca2cc1aa3ec..000000000000
--- a/canvas/source/java/CanvasFont.java
+++ /dev/null
@@ -1,116 +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.
- *
- ************************************************************************/
-
-// Canvas
-import com.sun.star.rendering.*;
-
-public class CanvasFont
- extends com.sun.star.lib.uno.helper.ComponentBase
- implements com.sun.star.lang.XServiceInfo,
- com.sun.star.rendering.XCanvasFont
-{
- private CanvasBase associatedCanvas;
- private com.sun.star.rendering.FontRequest fontRequest;
- private java.awt.Font font;
-
- //----------------------------------------------------------------------------------
-
- public CanvasFont( com.sun.star.rendering.FontRequest _fontRequest,
- CanvasBase _canvas )
- {
- associatedCanvas = _canvas;
- fontRequest = _fontRequest;
-
- // TODO: Use proper attributes here, first of all, use fractional point font size
- font = new java.awt.Font( fontRequest.FontDescription.FamilyName, java.awt.Font.PLAIN, (int)(fontRequest.CellSize + .5) );
- }
-
- public java.awt.Font getFont()
- {
- return font;
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XCanvasFont implementation
- // ===========================
- //
-
- public XTextLayout createTextLayout( StringContext aText, byte nDirection, long nRandomSeed )
- {
- return new TextLayout( aText, nDirection, nRandomSeed, this, associatedCanvas );
- }
-
- public FontRequest getFontRequest( )
- {
- return fontRequest;
- }
-
- public FontMetrics getFontMetrics( )
- {
- // TODO
- return null;
- }
-
- public double[] getAvailableSizes( )
- {
- // TODO
- return null;
- }
-
- public com.sun.star.beans.PropertyValue[] getExtraFontProperties( )
- {
- // TODO
- return null;
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XServiceInfo impl
- // =================
- //
-
- private static final String s_implName = "CanvasFont.java.impl";
- private static final String s_serviceName = "com.sun.star.rendering.XCanvasFont";
-
- public String getImplementationName()
- {
- return s_implName;
- }
-
- public String [] getSupportedServiceNames()
- {
- return new String [] { s_serviceName };
- }
-
- public boolean supportsService( String serviceName )
- {
- return serviceName.equals( s_serviceName );
- }
-}
diff --git a/canvas/source/java/CanvasGraphicDevice.java b/canvas/source/java/CanvasGraphicDevice.java
deleted file mode 100644
index c521d627f1a9..000000000000
--- a/canvas/source/java/CanvasGraphicDevice.java
+++ /dev/null
@@ -1,222 +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.
- *
- ************************************************************************/
-
-// Canvas
-import com.sun.star.rendering.*;
-import com.sun.star.geometry.*;
-
-// Java AWT
-import java.awt.*;
-
-public class CanvasGraphicDevice
- extends com.sun.star.lib.uno.helper.ComponentBase
- implements com.sun.star.lang.XServiceInfo,
- com.sun.star.beans.XPropertySet,
- com.sun.star.rendering.XGraphicDevice
-{
- private java.awt.Graphics2D graphics;
- private java.awt.GraphicsConfiguration graphicsConfig;
-
- //----------------------------------------------------------------------------------
-
- public CanvasGraphicDevice( java.awt.Graphics2D _graphics )
- {
- graphics = _graphics;
- graphicsConfig = graphics.getDeviceConfiguration();
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // GraphicsDevice implementation
- // =============================
- //
- public synchronized XBufferController getBufferController()
- {
- // Use java.awt.image.BufferStrategy to implement XBufferController
- CanvasUtils.printLog( "CanvasGraphicDevice.getBufferController!" );
- return null;
- }
-
- public synchronized XColorSpace getDeviceColorSpace()
- {
- CanvasUtils.printLog( "CanvasGraphicDevice.getDeviceColorSpace!" );
- return null;
- }
-
- public synchronized com.sun.star.geometry.RealSize2D getPhysicalResolution()
- {
- CanvasUtils.printLog( "CanvasGraphicDevice.getPhysicalResolution!" );
- // TODO: getDefaultTransform + getNormalizingTransform
- return new com.sun.star.geometry.RealSize2D(100,100);
- }
-
- public synchronized com.sun.star.geometry.RealSize2D getPhysicalSize()
- {
- CanvasUtils.printLog( "CanvasGraphicDevice.getSize!" );
- java.awt.Rectangle bounds = graphicsConfig.getBounds();
-
- return new com.sun.star.geometry.RealSize2D(bounds.width, bounds.height);
- }
-
- public synchronized XLinePolyPolygon2D createCompatibleLinePolyPolygon( RealPoint2D[][] points )
- {
- CanvasUtils.printLog( "createCompatibleLinePolyPolygon" );
- return new LinePolyPolygon( points );
- }
-
- public synchronized XBezierPolyPolygon2D createCompatibleBezierPolyPolygon( RealBezierSegment2D[][] points )
- {
- CanvasUtils.printLog( "createCompatibleBezierPolyPolygon" );
- return new BezierPolyPolygon( points );
- }
-
- public synchronized com.sun.star.rendering.XBitmap createCompatibleBitmap( IntegerSize2D size )
- {
- CanvasUtils.printLog( "createCompatibleBitmap called with size (" + size.Width + ", " + size.Height + ")" );
- return new CanvasBitmap( graphicsConfig.createCompatibleImage( size.Width,
- size.Height,
- Transparency.OPAQUE ) );
- }
-
- public synchronized com.sun.star.rendering.XVolatileBitmap createVolatileBitmap( IntegerSize2D size )
- {
- CanvasUtils.printLog( "createVolatileBitmap called with size (" + size.Width + ", " + size.Height + ")" );
- //return new CanvasBitmap( graphicsConfig.createCompatibleVolatileImage( size.Width, size.Height ) );
- return null;
- }
-
- public synchronized com.sun.star.rendering.XBitmap createCompatibleAlphaBitmap( IntegerSize2D size )
- {
- CanvasUtils.printLog( "createCompatibleBitmap called with size (" + size.Width + ", " + size.Height + ")" );
- return new CanvasBitmap( graphicsConfig.createCompatibleImage( size.Width,
- size.Height,
- Transparency.TRANSLUCENT ) );
- }
-
- public synchronized com.sun.star.rendering.XVolatileBitmap createVolatileAlphaBitmap( IntegerSize2D size )
- {
- CanvasUtils.printLog( "createVolatileBitmap called with size (" + size.Width + ", " + size.Height + ")" );
- //return new CanvasBitmap( graphicsConfig.createCompatibleVolatileImage( size.Width, size.Height ) );
- return null;
- }
-
- public synchronized com.sun.star.rendering.XParametricPolyPolygon2DFactory getParametricPolyPolygonFactory()
- {
- // TODO
- return null;
- }
-
- public synchronized com.sun.star.beans.XPropertySetInfo getPropertySetInfo()
- {
- // This is a stealth property set
- return null;
- }
-
- public synchronized void setPropertyValue( String aPropertyName, java.lang.Object aValue ) throws com.sun.star.beans.PropertyVetoException
- {
- // all our properties are read-only
- throw new com.sun.star.beans.PropertyVetoException();
- }
-
- public synchronized java.lang.Object getPropertyValue( String PropertyName ) throws com.sun.star.beans.UnknownPropertyException
- {
- if( PropertyName == "DeviceHandle" )
- return graphics;
-
- throw new com.sun.star.beans.UnknownPropertyException();
- }
-
- public synchronized void addPropertyChangeListener( String aPropertyName, com.sun.star.beans.XPropertyChangeListener xListener ) throws com.sun.star.beans.UnknownPropertyException
- {
- if( aPropertyName == "DeviceHandle" )
- return;
-
- throw new com.sun.star.beans.UnknownPropertyException();
- }
-
- public synchronized void removePropertyChangeListener( String aPropertyName, com.sun.star.beans.XPropertyChangeListener aListener ) throws com.sun.star.beans.UnknownPropertyException
- {
- if( aPropertyName == "DeviceHandle" )
- return;
-
- throw new com.sun.star.beans.UnknownPropertyException();
- }
-
- public synchronized void addVetoableChangeListener( String PropertyName, com.sun.star.beans.XVetoableChangeListener aListener ) throws com.sun.star.beans.UnknownPropertyException
- {
- if( PropertyName == "DeviceHandle" )
- return;
-
- throw new com.sun.star.beans.UnknownPropertyException();
- }
-
- public synchronized void removeVetoableChangeListener( String PropertyName, com.sun.star.beans.XVetoableChangeListener aListener ) throws com.sun.star.beans.UnknownPropertyException
- {
- if( PropertyName == "DeviceHandle" )
- return;
-
- throw new com.sun.star.beans.UnknownPropertyException();
- }
-
-
- public synchronized boolean hasFullScreenMode()
- {
- return graphicsConfig.getDevice().isFullScreenSupported();
- }
-
- public synchronized boolean enterFullScreenMode( boolean bEnter )
- {
- return false;
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XServiceInfo impl
- // =================
- //
-
- private static final String s_implName = "XGraphicsDevice.java.impl";
- private static final String s_serviceName = "com.sun.star.rendering.GraphicsDevice";
-
- public String getImplementationName()
- {
- return s_implName;
- }
-
- public String [] getSupportedServiceNames()
- {
- return new String [] { s_serviceName };
- }
-
- public boolean supportsService( String serviceName )
- {
- return serviceName.equals( s_serviceName );
- }
-
-}
diff --git a/canvas/source/java/CanvasSprite.java b/canvas/source/java/CanvasSprite.java
deleted file mode 100644
index 9b2cfc0debad..000000000000
--- a/canvas/source/java/CanvasSprite.java
+++ /dev/null
@@ -1,308 +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.
- *
- ************************************************************************/
-
-// Canvas
-import com.sun.star.rendering.*;
-import com.sun.star.geometry.*;
-
-// Java AWT
-import java.awt.*;
-import java.awt.geom.*;
-
-public class CanvasSprite
- extends com.sun.star.lib.uno.helper.ComponentBase
- implements com.sun.star.rendering.XAnimatedSprite,
- com.sun.star.lang.XServiceInfo,
- SpriteBase
-{
- private XAnimation spriteAnimation;
- private JavaCanvas canvas;
- private Graphics2D referenceGraphics;
- private SpriteRunner runner;
- private ViewState viewState;
- private double alpha;
- private java.awt.geom.Point2D.Double outputPosition;
- private SpriteRep spriteRep;
-
- //----------------------------------------------------------------------------------
-
- public CanvasSprite( XAnimation _animation, JavaCanvas _canvas, Graphics2D _referenceGraphics )
- {
- CanvasUtils.printLog( "CanvasSprite constructor called!" );
-
- spriteAnimation = _animation;
- canvas = _canvas;
- referenceGraphics = _referenceGraphics;
- alpha = 0.0;
- outputPosition = new java.awt.geom.Point2D.Double(0.0,0.0);
-
- runner = new SpriteRunner( this, spriteAnimation, canvas );
- }
-
- public synchronized ViewState getViewState()
- {
- return viewState;
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // SpriteBase
- // ==========
- //
- public synchronized SpriteRep getSpriteRep()
- {
- if( spriteRep == null )
- {
- spriteRep = new SpriteRep();
-
- setupSpriteBuffering( CanvasUtils.makeTransform( getViewState().AffineTransform ) );
-
- spriteRep.moveSprite( outputPosition );
- spriteRep.setSpriteAlpha( alpha );
-
- // render initial sprite content
- updateAnimation();
- }
- return spriteRep;
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XComponent
- // ==========
- //
- public void dispose()
- {
- // end the animation thread
- if( runner != null )
- {
- runner.quit();
- try
- {
- runner.join(0); // and wait until it's really over
- }
- catch( java.lang.InterruptedException e ) {}
- }
-
- if( spriteRep != null )
- spriteRep.dispose();
-
- canvas = null;
- spriteAnimation = null;
- runner = null;
- referenceGraphics = null;
- spriteRep = null;
-
- super.dispose();
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XSprite impl
- // ============
- //
-
- public synchronized void startAnimation( double speed )
- {
- runner.startAnimation( speed );
- }
-
- public synchronized void stopAnimation()
- {
- runner.stopAnimation();
- }
-
- public synchronized void resetAnimation()
- {
- runner.resetAnimation();
- }
-
- public synchronized void updateAnimation()
- {
- // only call render explicitely, if animation not
- // running. Otherwise, next animation render will update
- // anyway.
- if( spriteRep != null &&
- !runner.isAnimationActive() )
- {
- spriteRep.renderAnimation( spriteAnimation, getViewState(), runner.getCurrentT() );
- }
- }
-
- public synchronized void setPriority( double nPriority )
- {
- // TODO
- }
-
- public synchronized void setAlpha( double _alpha )
- {
- alpha = _alpha;
-
- if( spriteRep != null )
- {
- spriteRep.setSpriteAlpha( alpha );
- }
- }
-
- public synchronized void move( com.sun.star.geometry.RealPoint2D _aNewPos,
- com.sun.star.rendering.ViewState _viewState,
- com.sun.star.rendering.RenderState _renderState )
- {
- // transform given point with concatenated transformation
- AffineTransform transform = CanvasUtils.ViewConcatRenderTransform( _viewState, _renderState );
- transform.transform( new java.awt.geom.Point2D.Double(_aNewPos.X,
- _aNewPos.Y),
- outputPosition );
-
- if( spriteRep != null )
- {
- spriteRep.moveSprite( outputPosition );
- }
- }
-
- public synchronized void transform( AffineMatrix2D aTransformation ) throws com.sun.star.lang.IllegalArgumentException
- {
- // TODO
- }
-
- public synchronized void clip( XPolyPolygon2D aClip )
- {
- // TODO
- }
-
- public synchronized void show()
- {
- canvas.showSprite( this );
- canvas.updateScreen( false );
- }
-
- public synchronized void hide()
- {
- canvas.hideSprite( this );
-
- // dispose and clear SpriteRep, animation content can be
- // regenerated at any time
- if( spriteRep != null )
- spriteRep.dispose();
-
- spriteRep = null;
- }
-
- public synchronized void setViewState( ViewState _viewState )
- {
- viewState = CanvasUtils.createAnimationViewState(_viewState,
- getAnimationAttributes());
-
- CanvasUtils.printTransform( CanvasUtils.makeTransform( viewState.AffineTransform ),
- "CanvasSprite.setViewState" );
-
- if( spriteRep != null )
- {
- // calculate bounds of view-transformed animation output rectangle
- setupSpriteBuffering( CanvasUtils.makeTransform(getViewState().AffineTransform) );
- updateAnimation();
- }
- }
-
- public synchronized AnimationAttributes getAnimationAttributes()
- {
- return spriteAnimation.getAnimationAttributes();
- }
-
- public synchronized void setAll( RealPoint2D _aNewPos,
- ViewState _viewState,
- RenderState _renderState,
- double _alpha,
- boolean bUpdateAnimation )
- {
- alpha = _alpha;
-
- // transform given point with concatenated transformation
- AffineTransform transform = CanvasUtils.ViewConcatRenderTransform( _viewState, _renderState );
- transform.transform( new java.awt.geom.Point2D.Double(_aNewPos.X,
- _aNewPos.Y),
- outputPosition );
-
- if( spriteRep != null )
- {
- spriteRep.setSpriteAlpha( alpha );
- spriteRep.moveSprite( outputPosition );
-
- if( bUpdateAnimation )
- updateAnimation();
- }
- }
-
- //----------------------------------------------------------------------------------
-
- private void setupSpriteBuffering( AffineTransform _viewTransform )
- {
- // determine bounds of view-transformed animation output rectangle
- com.sun.star.geometry.RealSize2D animSize = getAnimationAttributes().UntransformedSize;
-
- java.awt.geom.Rectangle2D.Double aTransformedBounds =
- CanvasUtils.calcTransformedRectBounds( new java.awt.geom.Rectangle2D.Double(0.0,0.0,
- animSize.Width,
- animSize.Height),
- _viewTransform );
- CanvasUtils.printTransform( _viewTransform, "setupSpriteBuffering" );
- CanvasUtils.printLog( "setupSpriteBuffering: bounds are (" + aTransformedBounds.width + ", " + aTransformedBounds.height + ")" );
-
- // create a buffer of the appropriate size
- spriteRep.setupBuffer(referenceGraphics, (int)(aTransformedBounds.width+.5),
- (int)(aTransformedBounds.height+.5) );
- }
-
- //----------------------------------------------------------------------------------
-
- private static final String s_implName = "XSprite.java.impl";
- private static final String s_serviceName = "com.sun.star.rendering.Sprite";
-
- //----------------------------------------------------------------------------------
-
- //
- // XServiceInfo impl
- // =================
- //
- public String getImplementationName()
- {
- return s_implName;
- }
-
- public String [] getSupportedServiceNames()
- {
- return new String [] { s_serviceName };
- }
-
- public boolean supportsService( String serviceName )
- {
- return serviceName.equals( s_serviceName );
- }
-}
diff --git a/canvas/source/java/CanvasTest_perftest.java b/canvas/source/java/CanvasTest_perftest.java
deleted file mode 100644
index 047c9de3b16b..000000000000
--- a/canvas/source/java/CanvasTest_perftest.java
+++ /dev/null
@@ -1,676 +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.
- *
- ************************************************************************/
-
-// UNO
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.XComponentContext;
-import com.sun.star.uno.AnyConverter;
-import com.sun.star.uno.IQueryInterface;
-import com.sun.star.lang.XInitialization;
-import com.sun.star.lib.uno.helper.WeakBase;
-
-// OOo AWT
-import com.sun.star.awt.*;
-
-// Canvas
-import com.sun.star.rendering.*;
-
-// Java AWT
-import java.awt.*;
-import java.awt.image.*;
-import java.awt.geom.*;
-
-public class CanvasTest
- extends CanvasBase
- implements com.sun.star.awt.XWindow,
- com.sun.star.rendering.XSpriteCanvas,
- com.sun.star.lang.XServiceInfo,
- com.sun.star.lang.XInitialization
-{
- private WindowAdapter dummyFrame;
- private BackBuffer backBuffer;
- private java.awt.image.BufferStrategy bufferStrategy;
-
- private java.awt.Font fpsFont;
- private long lastTime;
-
-
- // TEST ONLY {
- private static int testWidth = 1600;
- private static int testHeight = 1200;
- private BufferedImage backgroundBuffer;
- private BufferedImage buffer;
- private BufferedImage buffer2;
- private Graphics2D backBufGraphics;
- private Graphics2D bufferGraphics;
- private Graphics2D buffer2Graphics;
- private float currAlpha;
- // TEST ONLY }
-
-
-
- public Graphics2D getGraphics()
- {
- return backBuffer.getGraphics();
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XInitialization
- // ===============
- //
- public void initialize( java.lang.Object[] arguments )
- {
- CanvasUtils.printLog( "CanvasTest.initialize called!" );
-
- // Do that as the very first thing. The Java2D internal
- // classes choose their render path at initialization time,
- // thus this must happen before doing _any_ GUI.
-
- // TODO: Put those flags into javarc/java.ini, we're maybe
- // coming late into a running JVM!
-
- // now, we're getting slightly system dependent here.
- String os = (String) System.getProperty("os.name");
-
- CanvasUtils.printLog( "System detected: " + os );
-
- // tweak some speed knobs...
- if( os.startsWith("Windows") )
- {
- System.setProperty("sun.java2d.translaccel", "true");
- System.setProperty("sun.java2d.ddforcevram", "true");
- //System.setProperty("sun.java2d.accthreshold", "0");
-
- CanvasUtils.printLog( "Optimizing for Windows" );
- }
- else
- {
- System.setProperty("sun.java2d.opengl", "true");
-
- CanvasUtils.printLog( "Optimizing for Unix" );
- }
-
- /* we're initialized with the following array of anys:
-
- arguments[0] = pointer to VCL window
- arguments[1] = Integer (operating system window handle)
- arguments[2] = com.sun.star.awt.Rectangle (position and size within that OS window)
- arguments[3] = boolean (fullsize window or not)
-
- We then generate a dummy Java frame with that window as the
- parent, to fake a root window for the Java implementation.
- */
- try
- {
- com.sun.star.awt.Rectangle boundRect = (com.sun.star.awt.Rectangle) arguments[2];
-
- //boolean isFullScreen = arguments[1];
- boolean isFullScreen = true;
- //AnyConverter.toBoolean( arguments[3] ) );
-
- // fake a root for Java in VCL window. Pass the flag
- // whether we shall run fullscreen, too.
- dummyFrame = new WindowAdapter( AnyConverter.toInt( arguments[1] ), isFullScreen );
-
- if( isFullScreen )
- {
- // blow window up to fullscreen. Otherwise, we cannot clear the whole screen,
- // which results in ugly flickering
- Dimension screenSize = dummyFrame.frame.getToolkit().getScreenSize();
- boundRect.X = 0;
- boundRect.Y = 0;
- boundRect.Width = screenSize.width-1;
- boundRect.Height = screenSize.height-1;
- }
-
- dummyFrame.setPosSize( boundRect.X, boundRect.Y, boundRect.Width, boundRect.Height, (short)0 );
- CanvasUtils.printLog( "Window size: " + boundRect.Width + ", " + boundRect.Height );
-
- // TEST
- if( true )
- {
- backBuffer = new BackBuffer( (Graphics2D) dummyFrame.frame.getGraphics(),
- Math.max(1,boundRect.Width),
- Math.max(1,boundRect.Height) );
- }
- else
- {
- backBuffer = new BackBuffer( (Graphics2D) dummyFrame.frame.getGraphics(),
- 10, 10 );
- }
-
- // TODO: Maybe delay double buffer init until first sprite creation
- dummyFrame.frame.createBufferStrategy(2);
- bufferStrategy = dummyFrame.frame.getBufferStrategy();
-
- if( bufferStrategy.getCapabilities().isPageFlipping() )
- CanvasUtils.printLog( "CanvasTest.initialize double buffering is using page flipping!" );
- else
- CanvasUtils.printLog( "CanvasTest.initialize double buffering is using blitting!" );
-
- lastTime = System.currentTimeMillis();
- fpsFont = new java.awt.Font( "Times", Font.PLAIN, 20 );
-
-
- if( false )
- {
- // TEST ONLY {
- Graphics2D frameGraphics= (Graphics2D) dummyFrame.frame.getGraphics();
- backgroundBuffer = frameGraphics.getDeviceConfiguration().createCompatibleImage(testWidth,testHeight); // TODO: size dynamic
- buffer = frameGraphics.getDeviceConfiguration().createCompatibleImage(testWidth,testHeight,
- Transparency.TRANSLUCENT);
- buffer2 = frameGraphics.getDeviceConfiguration().createCompatibleImage(testWidth,testHeight,
- Transparency.TRANSLUCENT);
- bufferGraphics = (Graphics2D)buffer.getGraphics();
- buffer2Graphics = (Graphics2D)buffer2.getGraphics();
- backBufGraphics = (Graphics2D)backgroundBuffer.getGraphics();
- currAlpha = 0.1f;
-
- // init content
- Font font = new Font( "Times", Font.PLAIN, 100 );
-
- bufferGraphics.setComposite( AlphaComposite.getInstance(AlphaComposite.CLEAR));
- bufferGraphics.fillRect( 0,0,testWidth,testHeight );
-
- bufferGraphics.setComposite( AlphaComposite.getInstance(AlphaComposite.SRC_OVER));
- bufferGraphics.setColor( Color.red );
- bufferGraphics.fillRect( 0,0,testWidth/2,testHeight/2 );
- bufferGraphics.setColor( Color.green );
- bufferGraphics.fillRect( testWidth/2,0,testWidth,testHeight/2 );
- bufferGraphics.setColor( Color.blue );
- bufferGraphics.fillRect( 0,testHeight/2,testWidth/2,testHeight );
-
- buffer2Graphics.setColor( Color.red );
- buffer2Graphics.fillRect( 0,0,testWidth/2,testHeight/2 );
- buffer2Graphics.setColor( Color.green );
- buffer2Graphics.fillRect( testWidth/2,0,testWidth,testHeight/2 );
- buffer2Graphics.setColor( Color.blue );
- buffer2Graphics.fillRect( 0,testHeight/2,testWidth/2,testHeight );
-
- backBufGraphics.setColor( Color.white );
- backBufGraphics.fillRect(0,0,testWidth,testHeight);
- backBufGraphics.setColor( Color.red );
- backBufGraphics.setFont( font );
- int i, turns=15;
- for(i=0; i<turns; ++i)
- {
- backBufGraphics.drawString( "Crossfade test", testWidth*i/turns, testHeight*i/turns );
- }
- // TEST ONLY }
- }
-
- CanvasUtils.printLog( "CanvasTest.initialize finished!" );
- }
- catch( com.sun.star.lang.IllegalArgumentException e )
- {
- CanvasUtils.printLog( "Cannot create EmbeddedFrame within VCL window hierarchy!" );
- }
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XComponent
- // ==========
- //
- public void dispose()
- {
- CanvasUtils.printLog( "CanvasTest: disposed!" );
-
- // destroy all active sprites
- java.util.Set entries = activeSprites.entrySet();
- java.util.Iterator iter = entries.iterator();
-
- while( iter.hasNext() )
- {
- java.util.Map.Entry entry = (java.util.Map.Entry)iter.next();
- if( entry.getValue() != null )
- ((SpriteRep)entry.getValue()).dispose();
- }
-
- if( bufferStrategy != null )
- bufferStrategy.getDrawGraphics().dispose(); // really necessary?
-
- if( dummyFrame != null )
- dummyFrame.dispose();
-
- if( backBuffer != null)
- backBuffer.dispose();
-
- bufferStrategy = null;
- dummyFrame = null;
- backBuffer = null;
-
- super.dispose();
- }
-
- //----------------------------------------------------------------------------------
-
- public CanvasTest( XComponentContext xContext )
- {
- CanvasUtils.printLog( "CanvasTest constructor called!" );
- activeSprites = new java.util.HashMap( 33 );
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XWindow interface
- // =================
- //
- // This is delegated to WindowAdapter!
- //
- public synchronized void setPosSize( int X, int Y, int Width, int Height, short Flags )
- {
- if( dummyFrame != null )
- {
- dummyFrame.setPosSize( X, Y, Width, Height, Flags );
-
- Width = Math.max(1,Width);
- Height= Math.max(1,Height);
-
- CanvasUtils.printLog( "CanvasTest graphics set to " + Width + "," + Height );
- backBuffer.setSize(Width,Height);
- }
- }
-
- public synchronized com.sun.star.awt.Rectangle getPosSize( )
- {
- if( dummyFrame != null )
- return dummyFrame.getPosSize();
-
- return new com.sun.star.awt.Rectangle();
- }
-
- public synchronized void setVisible( boolean visible )
- {
- if( dummyFrame != null )
- dummyFrame.setVisible( visible );
- }
-
- public synchronized void setEnable( boolean enable )
- {
- if( dummyFrame != null )
- dummyFrame.setEnable( enable );
- }
-
- public synchronized void setFocus()
- {
- if( dummyFrame != null )
- dummyFrame.setFocus();
- }
-
- public synchronized void addWindowListener( XWindowListener xListener )
- {
- if( dummyFrame != null )
- dummyFrame.addWindowListener( xListener );
- }
-
- public synchronized void removeWindowListener( XWindowListener xListener )
- {
- if( dummyFrame != null )
- dummyFrame.removeWindowListener( xListener );
- }
-
- public synchronized void addFocusListener( XFocusListener xListener )
- {
- if( dummyFrame != null )
- dummyFrame.addFocusListener( xListener );
- }
-
- public synchronized void removeFocusListener( XFocusListener xListener )
- {
- if( dummyFrame != null )
- dummyFrame.removeFocusListener( xListener );
- }
-
- public synchronized void addKeyListener( XKeyListener xListener )
- {
- if( dummyFrame != null )
- dummyFrame.addKeyListener( xListener );
- }
-
- public synchronized void removeKeyListener( XKeyListener xListener )
- {
- if( dummyFrame != null )
- dummyFrame.removeKeyListener( xListener );
- }
-
- public synchronized void addMouseListener( XMouseListener xListener )
- {
- if( dummyFrame != null )
- dummyFrame.addMouseListener( xListener );
- }
-
- public synchronized void removeMouseListener( XMouseListener xListener )
- {
- if( dummyFrame != null )
- dummyFrame.removeMouseListener( xListener );
- }
-
- public synchronized void addMouseMotionListener( XMouseMotionListener xListener )
- {
- if( dummyFrame != null )
- dummyFrame.addMouseMotionListener( xListener );
- }
-
- public synchronized void removeMouseMotionListener( XMouseMotionListener xListener )
- {
- if( dummyFrame != null )
- dummyFrame.removeMouseMotionListener( xListener );
- }
-
- public synchronized void addPaintListener( XPaintListener xListener )
- {
- if( dummyFrame != null )
- dummyFrame.addPaintListener( xListener );
- }
-
- public synchronized void removePaintListener( XPaintListener xListener )
- {
- if( dummyFrame != null )
- dummyFrame.removePaintListener( xListener );
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XBitmapCanvas impl
- // ==================
- //
-
- public synchronized void copyRect( com.sun.star.rendering.XBitmapCanvas sourceCanvas,
- com.sun.star.rendering.Rectangle2D sourceRect,
- com.sun.star.rendering.ViewState sourceViewState,
- com.sun.star.rendering.RenderState sourceRenderState,
- com.sun.star.rendering.Rectangle2D destRect,
- com.sun.star.rendering.ViewState destViewState,
- com.sun.star.rendering.RenderState destRenderState )
- {
- CanvasUtils.printLog( "CanvasTest.copyRect() called" );
-
- // TODO: create temp image when transform is non-trivial
-
- if( sourceCanvas == this )
- {
- // copy rectangle within the canvas
- getGraphics().copyArea((int)sourceRect.x1,
- (int)sourceRect.y1,
- (int)(sourceRect.x2 - sourceRect.x1),
- (int)(sourceRect.y2 - sourceRect.y1),
- (int)(destRect.x1 - sourceRect.x1),
- (int)(destRect.y1 - sourceRect.y1) );
- }
- else
- {
- if( sourceCanvas instanceof CanvasTest )
- {
- // cache
- CanvasUtils.setupGraphicsState( getGraphics(), destViewState, destRenderState, CanvasUtils.alsoSetupPaint );
-
- java.awt.Image backBuffer = ((CanvasTest)sourceCanvas).backBuffer.getBackBuffer();
-
- // TODO: really extract correct source rect here
- getGraphics().drawImage( backBuffer, 0, 0, null);
- CanvasUtils.postRenderImageTreatment( backBuffer );
- }
- // TODO: foreign canvas
- }
- }
-
- //----------------------------------------------------------------------------------
-
- // a map of SpriteReps, with Sprite object as keys. Contains all
- // active (i.e. visible) sprites, the SpriteReps are used to
- // repaint the sprite content at any time.
- private java.util.HashMap activeSprites;
-
- //
- // XSpriteCanvas impl
- // ==================
- //
-
- public synchronized com.sun.star.rendering.XAnimatedSprite createSpriteFromAnimation( XAnimation animation )
- {
- CanvasUtils.printLog( "CanvasTest.createSpriteFromAnimation called" );
-
- return new CanvasSprite( animation, this, (Graphics2D)dummyFrame.frame.getGraphics() );
- }
-
- public synchronized XAnimatedSprite createSpriteFromBitmaps( com.sun.star.rendering.XBitmap[] animationBitmaps,
- short interpolationMode )
- {
- return null;
- }
-
- public synchronized XCustomSprite createCustomSprite( Size2D spriteSize )
- {
- CanvasUtils.printLog( "CanvasTest.createCustomSprite called" );
-
- return new CanvasCustomSprite( spriteSize, this, (Graphics2D)dummyFrame.frame.getGraphics() );
- }
-
- public synchronized XSprite createClonedSprite( XSprite original )
- {
- return new CanvasClonedSprite( this, original );
- }
-
- public synchronized void updateScreen()
- {
- redrawAllLayers();
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XSpriteCanvas helper
- // ====================
- //
- public synchronized void renderAnimation( CanvasSprite sprite, XAnimation animation, double t )
- {
- SpriteRep spriteRep = (SpriteRep)activeSprites.get( sprite );
- if( spriteRep != null )
- {
- //Graphics2D graph = getWindowGraphics();
-
- // TODO: ensure update of graphics object externally, e.g. when
- // VCL moves the toplevel window.
- //java.awt.Rectangle bounds = dummyFrame.frame.getBounds();
- //graphics.setGraphics(graph, bounds.width, bounds.height);
-
- spriteRep.renderAnimation( animation, sprite.getViewState(), t );
- }
- else
- {
- CanvasUtils.printLog( "CanvasTest.renderAnimation sprite not active!" );
- }
- }
-
- public synchronized void showSprite( SpriteBase sprite )
- {
- CanvasUtils.printLog( "CanvasTest.showSprite() called" );
-
- SpriteRep spriteRep = (SpriteRep)activeSprites.get( sprite );
- if( spriteRep != null )
- {
- CanvasUtils.printLog( "CanvasTest.showSprite sprite already active!" );
- }
- else
- {
- spriteRep = sprite.getSpriteRep();
-
- // a valid SpriteRep for a given Sprite in the
- // activeSprites hash denotes 'sprite active'
- activeSprites.put( sprite, spriteRep );
-
- // TODO: TEMP! Just for testing! Set empty cursor for presentation
-// dummyFrame.frame.setCursor( dummyFrame.frame.getToolkit().createCustomCursor(new java.awt.image.BufferedImage(0,0,
-// java.awt.image.BufferedImage.TYPE_INT_RGB),
-// new java.awt.Point(0,0),
-// "") );
- }
- }
-
- public synchronized void hideSprite( SpriteBase sprite )
- {
- CanvasUtils.printLog( "CanvasTest.hideSprite() called" );
-
- SpriteRep spriteRep = (SpriteRep)activeSprites.get( sprite );
- if( spriteRep != null )
- {
- activeSprites.put( sprite, null );
- redrawAllLayers();
- }
- else
- {
- CanvasUtils.printLog( "CanvasTest.hideSprite sprite not active!" );
- }
- }
-
- private void redrawAllLayers()
- {
- // fetch the Graphics object to draw into (we're doing double
- // buffering here, the content is later shown via
- // bufferStrategy.show().
- Graphics2D graph = null;
-
- try
- {
- graph = (Graphics2D)bufferStrategy.getDrawGraphics();
-
- GraphicsDevice device = graph.getDeviceConfiguration().getDevice();
- CanvasUtils.printLog( "Available vram: " + device.getAvailableAcceleratedMemory() );
-
- if( false )
- {
- // TEST ONLY {
- // repaint background
- graph.setComposite( AlphaComposite.getInstance(AlphaComposite.SRC_OVER) );
- graph.drawImage(backgroundBuffer, 0, 0, null);
- //backgroundBuffer.flush();
-
- // alpha-composite foreground on top of that
- graph.setComposite( AlphaComposite.getInstance(AlphaComposite.SRC_OVER, currAlpha) );
-
- graph.drawImage(buffer, 0, 0, null);
- //buffer.flush();
-
- currAlpha += 0.1f; if( currAlpha > 1.0 ) currAlpha = 0.1f;
- // TEST ONLY }
- }
-
- if( true )
- {
- // repaint background
- backBuffer.redraw( graph );
-
- // repaint all active sprites
- java.util.Set entries = activeSprites.entrySet();
- java.util.Iterator iter = entries.iterator();
- while( iter.hasNext() )
- {
- java.util.Map.Entry entry = (java.util.Map.Entry)iter.next();
- if( entry.getValue() != null )
- ((SpriteRep)entry.getValue()).redraw(graph);
- }
- }
-
- long currTime = System.currentTimeMillis();
- graph.setComposite( AlphaComposite.getInstance(AlphaComposite.SRC_OVER) );
- graph.setFont( fpsFont );
- graph.setColor( java.awt.Color.black );
-
- try
- {
- String fps = new String( String.valueOf(1000.0/(currTime-lastTime)) );
- graph.drawString( fps.substring(0,5) + " fps", 0, 20);
- CanvasUtils.printLog( fps.substring(0,5) + " fps" );
- }
- catch( Exception e )
- {
- graph.drawString( "0 fps", 0, 20);
- }
-
- lastTime = currTime;
- }
- finally
- {
- if( graph != null )
- graph.dispose();
- }
-
- bufferStrategy.show();
- }
-
- //----------------------------------------------------------------------------------
-
- private static final String s_implName = "XCanvas.java.impl";
- private static final String s_serviceName = "com.sun.star.rendering.Canvas";
-
- //----------------------------------------------------------------------------------
-
- //
- // XServiceInfo impl
- // =================
- //
- public synchronized String getImplementationName()
- {
- return s_implName;
- }
-
- public synchronized String [] getSupportedServiceNames()
- {
- return new String [] { s_serviceName };
- }
-
- public synchronized boolean supportsService( String serviceName )
- {
- return serviceName.equals( s_serviceName );
- }
-
- public static com.sun.star.lang.XSingleServiceFactory __getServiceFactory(
- String implName,
- com.sun.star.lang.XMultiServiceFactory multiFactory,
- com.sun.star.registry.XRegistryKey regKey )
- {
- if (implName.equals( s_implName ))
- {
- return com.sun.star.comp.loader.FactoryHelper.getServiceFactory(
- CanvasTest.class, s_serviceName, multiFactory, regKey );
- }
- return null;
- }
-
- public static boolean __writeRegistryServiceInfo(
- com.sun.star.registry.XRegistryKey regKey )
- {
- return com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo(
- s_implName, s_serviceName, regKey );
- }
-}
diff --git a/canvas/source/java/CanvasUtils.java b/canvas/source/java/CanvasUtils.java
deleted file mode 100644
index 8b2245176e03..000000000000
--- a/canvas/source/java/CanvasUtils.java
+++ /dev/null
@@ -1,627 +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.
- *
- ************************************************************************/
-
-// UNO
-import com.sun.star.uno.UnoRuntime;
-
-// Canvas
-import com.sun.star.rendering.*;
-import com.sun.star.geometry.*;
-
-// Java AWT
-import java.awt.*;
-import java.awt.geom.*;
-
-public class CanvasUtils
-{
- //
- // Canvas utilities
- // ================
- //
- public static java.awt.geom.AffineTransform makeTransform( AffineMatrix2D ooTransform )
- {
- return new AffineTransform( ooTransform.m00,
- ooTransform.m10,
- ooTransform.m01,
- ooTransform.m11,
- ooTransform.m02,
- ooTransform.m12 );
- }
-
- public static AffineMatrix2D makeAffineMatrix2D( java.awt.geom.AffineTransform transform )
- {
- double[] matrix = new double[6];
- transform.getMatrix( matrix );
-
- return new AffineMatrix2D( matrix[0], matrix[2], matrix[4],
- matrix[1], matrix[3], matrix[5] );
- }
-
- public static void initGraphics( Graphics2D graphics )
- {
- if( graphics != null )
- {
- java.awt.RenderingHints hints = new java.awt.RenderingHints(null);
- boolean hq = true;
-
- if( hq )
- {
- hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_FRACTIONALMETRICS,
- java.awt.RenderingHints.VALUE_FRACTIONALMETRICS_ON ) );
-// hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_ALPHA_INTERPOLATION,
-// java.awt.RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY) );
- hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_ALPHA_INTERPOLATION,
- java.awt.RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED) );
-// hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_INTERPOLATION,
-// java.awt.RenderingHints.VALUE_INTERPOLATION_BICUBIC) );
- hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_INTERPOLATION,
- java.awt.RenderingHints.VALUE_INTERPOLATION_BILINEAR) );
-// hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_RENDERING,
-// java.awt.RenderingHints.VALUE_RENDER_QUALITY) );
- hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_RENDERING,
- java.awt.RenderingHints.VALUE_RENDER_SPEED) );
-// hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_STROKE_CONTROL,
-// java.awt.RenderingHints.VALUE_STROKE_NORMALIZE) );
- hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_STROKE_CONTROL,
- java.awt.RenderingHints.VALUE_STROKE_DEFAULT) );
- hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_ANTIALIASING,
- java.awt.RenderingHints.VALUE_ANTIALIAS_ON) );
- }
- else
- {
- hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_ALPHA_INTERPOLATION,
- java.awt.RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED) );
- hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_INTERPOLATION,
- java.awt.RenderingHints.VALUE_INTERPOLATION_BILINEAR) );
- hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_RENDERING,
- java.awt.RenderingHints.VALUE_RENDER_SPEED) );
- hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_STROKE_CONTROL,
- java.awt.RenderingHints.VALUE_STROKE_DEFAULT) );
- hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_ANTIALIASING,
- java.awt.RenderingHints.VALUE_ANTIALIAS_OFF) );
- }
-
- // the least common denominator standard
- hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_FRACTIONALMETRICS,
- java.awt.RenderingHints.VALUE_FRACTIONALMETRICS_ON) );
- hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_TEXT_ANTIALIASING,
- java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON) );
-
- graphics.setRenderingHints( hints );
- }
- }
-
- //----------------------------------------------------------------------------------
-
- public static java.awt.geom.GeneralPath makeGenPathFromBezierPoints( RealBezierSegment2D [][] points )
- {
- java.awt.geom.GeneralPath path = new java.awt.geom.GeneralPath();
-
- // extract every polygon into GeneralPath object
- for( int i=0; i<points.length; ++i )
- {
- if( points[i].length > 0 )
- path.moveTo((float) points[i][0].Px, (float) points[i][0].Py);
-
- for( int j=1; j<points[i].length; ++j )
- {
- CanvasUtils.printLog( "makeGenPathFromBezierPoints: point added." );
- path.curveTo((float)(points[i][j-1].C1x), (float)(points[i][j-1].C1y),
- (float)(points[i][j-1].C2x), (float)(points[i][j-1].C2y),
- (float) points[i][j].Px, (float) points[i][j].Py );
- }
-
- // TODO: closePath?
- }
-
- return path;
- }
-
- public static java.awt.geom.GeneralPath makeGenPathFromBezierPoly( com.sun.star.rendering.XBezierPolyPolygon2D poly )
- {
- try
- {
- com.sun.star.geometry.RealBezierSegment2D [][] points = poly.getBezierSegments(0,-1,0,-1);
-
- return makeGenPathFromBezierPoints( points );
- }
- catch( com.sun.star.lang.IndexOutOfBoundsException e )
- {
- }
-
- return new java.awt.geom.GeneralPath();
- }
-
- public static java.awt.geom.GeneralPath makeGenPathFromLinePoints( RealPoint2D [][] points )
- {
- java.awt.geom.GeneralPath path = new java.awt.geom.GeneralPath();
-
- // extract every polygon into GeneralPath object
- for( int i=0; i<points.length; ++i )
- {
- if( points[i].length > 0 )
- path.moveTo((float) points[i][0].X, (float) points[i][0].Y);
-
- for( int j=1; j<points[i].length; ++j )
- {
- CanvasUtils.printLog( "makeGenPathFromLinePoints: point (" +
- points[i][j].X + "," + points[i][j].Y + ") added." );
- path.lineTo((float) points[i][j].X, (float) points[i][j].Y );
- }
-
- // TODO: closePath?
- }
-
- return path;
- }
-
- public static java.awt.geom.GeneralPath makeGenPathFromLinePoly( com.sun.star.rendering.XLinePolyPolygon2D poly )
- {
- try
- {
- com.sun.star.geometry.RealPoint2D [][] points = poly.getPoints(0,-1,0,-1);
-
- return makeGenPathFromLinePoints( points );
- }
- catch( com.sun.star.lang.IndexOutOfBoundsException e )
- {
- }
-
- return new java.awt.geom.GeneralPath();
- }
-
- public static java.awt.geom.GeneralPath makeGeneralPath( com.sun.star.rendering.XPolyPolygon2D poly )
- {
- if( poly instanceof BezierPolyPolygon )
- {
- CanvasUtils.printLog( "makeGeneralPath: bezier impl used." );
- return ((BezierPolyPolygon)poly).getJavaPath();
- }
-
- if( poly instanceof LinePolyPolygon )
- {
- CanvasUtils.printLog( "makeGeneralPath: line impl used." );
- return ((LinePolyPolygon)poly).getJavaPath();
- }
-
- XBezierPolyPolygon2D bezierPoly = (XBezierPolyPolygon2D) UnoRuntime.queryInterface(XBezierPolyPolygon2D.class, poly);
-
- if( bezierPoly != null )
- {
- // extract polygon data. Prefer bezier interface, because
- // that's the more high-level data.
- return makeGenPathFromBezierPoly( bezierPoly );
- }
-
- XLinePolyPolygon2D linePoly = (XLinePolyPolygon2D) UnoRuntime.queryInterface(XLinePolyPolygon2D.class, poly);
-
- if( linePoly != null )
- {
- // extract polygon data. Fallback to line polygon, if no
- // curves are available.
- return makeGenPathFromLinePoly( linePoly );
- }
-
- // Only opaque general interface. No chance to get to the
- // data. Empty path, then
- CanvasUtils.printLog( "makeGeneralPath: Cannot access polygon data, given interface has class" + poly.getClass().getName() );
- return new GeneralPath();
- }
-
- public static java.awt.image.BufferedImage getBufferedImage( com.sun.star.rendering.XBitmap bitmap )
- {
- if( bitmap instanceof CanvasBitmap )
- {
- CanvasUtils.printLog( "getBufferedImage: CanvasBitmap impl used." );
- return ((CanvasBitmap)bitmap).getBufferedImage();
- }
-
- XIntegerBitmap integerBitmap = (XIntegerBitmap) UnoRuntime.queryInterface(XIntegerBitmap.class, bitmap);
-
- if( integerBitmap != null )
- {
- // extract bitmap data. TODO.
- return null;
- }
-
- // check other types. TODO.
- return null;
- }
-
- public static byte [] int2byte( int [] input )
- {
- byte [] output = new byte[4*input.length];
-
- int i, j;
- for( i=0, j=0; i<input.length; ++i )
- {
- output[j] = (byte)(input[i] & 255);
- output[j+1] = (byte)((input[i]/256) & 255);
- output[j+2] = (byte)((input[i]/256/256) & 255);
- output[j+3] = (byte)((input[i]/256/256/256) & 255);
- j += 4;
- }
-
- return output;
- }
-
- public static int [] byte2int( byte [] input )
- {
- int [] output = new int[(input.length+3)/4];
-
- int i, j;
- for( i=0,j=0; j<output.length; ++j )
- {
- output[j] = input[i] + (input[i+1] + (input[i+2] + input[i+3]*256)*256)*256;
- i += 4;
- }
-
- return output;
- }
-
- public static int javaRuleFromCompositeOp( byte compositeOp )
- {
- // TODO: Finish mapping of Canvas and Java compositing magics
- int rule = java.awt.AlphaComposite.SRC_OVER;
- switch( compositeOp )
- {
- case com.sun.star.rendering.CompositeOperation.CLEAR:
- CanvasUtils.printLog( "javaRuleFromCompositeOp: clear selected" );
- rule = java.awt.AlphaComposite.CLEAR;
- break;
-
- case com.sun.star.rendering.CompositeOperation.SOURCE:
- CanvasUtils.printLog( "javaRuleFromCompositeOp: src selected" );
- rule = java.awt.AlphaComposite.SRC;
- break;
-
- case com.sun.star.rendering.CompositeOperation.DESTINATION:
- CanvasUtils.printLog( "javaRuleFromCompositeOp: dst selected" );
- rule = java.awt.AlphaComposite.DST;
- break;
-
- case com.sun.star.rendering.CompositeOperation.OVER:
- CanvasUtils.printLog( "javaRuleFromCompositeOp: over selected" );
- rule = java.awt.AlphaComposite.SRC_OVER;
- break;
-
- case com.sun.star.rendering.CompositeOperation.UNDER:
- CanvasUtils.printLog( "javaRuleFromCompositeOp: under selected" );
- rule = java.awt.AlphaComposite.DST_OVER;
- break;
-
- case com.sun.star.rendering.CompositeOperation.INSIDE:
- CanvasUtils.printLog( "javaRuleFromCompositeOp: inside selected" );
- rule = java.awt.AlphaComposite.CLEAR;
- break;
-
- case com.sun.star.rendering.CompositeOperation.INSIDE_REVERSE:
- CanvasUtils.printLog( "javaRuleFromCompositeOp: inReverse selected" );
- rule = java.awt.AlphaComposite.CLEAR;
- break;
-
- case com.sun.star.rendering.CompositeOperation.OUTSIDE:
- CanvasUtils.printLog( "javaRuleFromCompositeOp: outside selected" );
- rule = java.awt.AlphaComposite.CLEAR;
- break;
-
- case com.sun.star.rendering.CompositeOperation.OUTSIDE_REVERSE:
- CanvasUtils.printLog( "javaRuleFromCompositeOp: outReverse selected" );
- rule = java.awt.AlphaComposite.CLEAR;
- break;
-
- case com.sun.star.rendering.CompositeOperation.XOR:
- CanvasUtils.printLog( "javaRuleFromCompositeOp: xor selected" );
- rule = java.awt.AlphaComposite.CLEAR;
- break;
-
- case com.sun.star.rendering.CompositeOperation.ADD:
- CanvasUtils.printLog( "javaRuleFromCompositeOp: add selected" );
- rule = java.awt.AlphaComposite.CLEAR;
- break;
-
- case com.sun.star.rendering.CompositeOperation.SATURATE:
- CanvasUtils.printLog( "javaRuleFromCompositeOp: saturate selected" );
- rule = java.awt.AlphaComposite.CLEAR;
- break;
-
- default:
- CanvasUtils.printLog( "javaRuleFromCompositeOp: Unexpected compositing rule" );
- break;
- }
-
- return rule;
- }
-
- public static java.awt.AlphaComposite makeAlphaComposite( byte compositeOp )
- {
- return java.awt.AlphaComposite.getInstance( javaRuleFromCompositeOp( compositeOp ) );
- }
-
- public static java.awt.AlphaComposite makeAlphaCompositeAlpha( byte compositeOp, double alpha )
- {
- return java.awt.AlphaComposite.getInstance( javaRuleFromCompositeOp( compositeOp ), (float)alpha );
- }
-
- // when given to setupGraphicsState, makes that method to also
- // setup the Paint with the color specified in the render state.
- public static final byte alsoSetupPaint=0;
-
- // when given to setupGraphicsState, makes that method to _not_
- // setup the Paint with the color specified in the render state.
- public static final byte dontSetupPaint=1;
-
- public static java.awt.geom.AffineTransform ViewConcatRenderTransform( ViewState viewState,
- RenderState renderState )
- {
- // calculate overall affine transform
- AffineTransform transform = makeTransform( viewState.AffineTransform );
- transform.concatenate( makeTransform( renderState.AffineTransform ) );
-
- printTransform( transform, "ViewConcatRenderTransform" );
-
- return transform;
- }
-
- public static void setupGraphicsState( java.awt.Graphics2D graphics,
- ViewState viewState,
- RenderState renderState,
- byte paintTouchMode )
- {
- // calculate overall affine transform
- graphics.setTransform( ViewConcatRenderTransform(viewState, renderState ) );
-
- // setup overall clip polyPolygon
- if( viewState.Clip != null )
- {
- Area clipArea = new Area( makeGeneralPath( viewState.Clip ) );
-
- if( renderState.Clip != null )
- clipArea.intersect( new Area( makeGeneralPath( renderState.Clip ) ) );
-
- graphics.setClip( clipArea );
- }
- else if( renderState.Clip != null )
- {
- Area clipArea = new Area( makeGeneralPath( renderState.Clip ) );
- graphics.setClip( clipArea );
- }
- else
- {
- // TODO: HACK! Use true visible area here!
- graphics.setClip( new java.awt.Rectangle(-1000000,-1000000,2000000,2000000) );
- }
-
- // setup current output color
- // TODO: Complete color handling here
- if( paintTouchMode == alsoSetupPaint )
- {
- switch( renderState.DeviceColor.length )
- {
- case 3:
- CanvasUtils.printLog( "setupGraphicsState: Color(" +
- renderState.DeviceColor[0] + "," +
- renderState.DeviceColor[1] + "," +
- renderState.DeviceColor[2] + ") set." );
- graphics.setColor( new Color( (float)renderState.DeviceColor[0],
- (float)renderState.DeviceColor[1],
- (float)renderState.DeviceColor[2] ) );
- break;
-
- case 4:
- CanvasUtils.printLog( "setupGraphicsState: Color(" +
- renderState.DeviceColor[0] + "," +
- renderState.DeviceColor[1] + "," +
- renderState.DeviceColor[2] + "," +
- renderState.DeviceColor[3] + ") set." );
- graphics.setColor( new Color( (float)renderState.DeviceColor[0],
- (float)renderState.DeviceColor[1],
- (float)renderState.DeviceColor[2],
- (float)renderState.DeviceColor[3] ) );
- break;
-
- default:
- CanvasUtils.printLog( "setupGraphicsState: unexpected number of " +
- renderState.DeviceColor.length + " color components!" );
- break;
- }
- }
-
- // setup current composite mode
- graphics.setComposite( makeAlphaComposite( renderState.CompositeOperation ) );
- }
-
- public static void applyStrokeAttributes( java.awt.Graphics2D graphics,
- StrokeAttributes attributes )
- {
- int cap = java.awt.BasicStroke.CAP_BUTT;
-
- if( attributes.StartCapType != attributes.EndCapType )
- CanvasUtils.printLog( "applyStrokeAttributes: different start and end caps are not yet supported!" );
-
- if( attributes.LineArray.length != 0 )
- CanvasUtils.printLog( "applyStrokeAttributes: multi-strokes are not yet supported!" );
-
- if( attributes.StartCapType == PathCapType.BUTT )
- cap = java.awt.BasicStroke.CAP_BUTT;
- else if( attributes.StartCapType == PathCapType.ROUND )
- cap = java.awt.BasicStroke.CAP_ROUND;
- else if( attributes.StartCapType == PathCapType.SQUARE )
- cap = java.awt.BasicStroke.CAP_SQUARE;
-
- int join = java.awt.BasicStroke.JOIN_MITER;
-
- if( attributes.JoinType == PathJoinType.MITER )
- cap = java.awt.BasicStroke.JOIN_MITER;
- else if( attributes.JoinType == PathJoinType.ROUND )
- cap = java.awt.BasicStroke.JOIN_ROUND;
- else if( attributes.JoinType == PathJoinType.BEVEL )
- cap = java.awt.BasicStroke.JOIN_BEVEL;
- else
- CanvasUtils.printLog( "applyStrokeAttributes: current join type not yet supported!" );
-
- float [] dashArray = null;
-
- if( attributes.DashArray.length != 0 )
- {
- dashArray = new float [attributes.DashArray.length];
-
- for( int i=0; i<attributes.DashArray.length; ++i )
- dashArray[i] = (float)attributes.DashArray[i];
- }
-
- graphics.setStroke( new java.awt.BasicStroke( (float)attributes.StrokeWidth,
- cap,
- join,
- (float)attributes.MiterLimit,
- dashArray,
- 0) );
- }
-
- public static void setupGraphicsFont( java.awt.Graphics2D graphics,
- ViewState viewState,
- RenderState renderState,
- com.sun.star.rendering.XCanvasFont xFont )
- {
- if( xFont instanceof CanvasFont )
- {
- CanvasUtils.printLog( "setupGraphicsFont: font impl used." );
- graphics.setFont( ((CanvasFont)xFont).getFont() );
- }
- else
- {
- CanvasUtils.printLog( "setupGraphicsFont: creating Java font anew." );
- CanvasFont canvasFont;
- canvasFont = new CanvasFont( xFont.getFontRequest(), null );
- graphics.setFont( canvasFont.getFont() );
- }
- }
-
- static java.awt.geom.Rectangle2D.Double calcTransformedRectBounds( java.awt.geom.Rectangle2D.Double aRect,
- AffineTransform aTransform )
- {
- // transform rect by given transformation
- java.awt.geom.Point2D.Double aPointTopLeft = new java.awt.geom.Point2D.Double(aRect.x, aRect.y);
- aTransform.transform(aPointTopLeft, aPointTopLeft);
-
- java.awt.geom.Point2D.Double aPointTopRight = new java.awt.geom.Point2D.Double(aRect.x + aRect.width,
- aRect.y);
- aTransform.transform(aPointTopRight, aPointTopRight);
-
- java.awt.geom.Point2D.Double aPointBottomLeft = new java.awt.geom.Point2D.Double(aRect.x,
- aRect.y + aRect.height);
- aTransform.transform(aPointBottomLeft, aPointBottomLeft);
-
- java.awt.geom.Point2D.Double aPointBottomRight = new java.awt.geom.Point2D.Double(aRect.x + aRect.width,
- aRect.y + aRect.height);
- aTransform.transform(aPointBottomRight, aPointBottomRight);
-
- // calc bounding rect of those four points
- java.awt.geom.Point2D.Double aResTopLeft = new java.awt.geom.Point2D.Double( Math.min(aPointTopLeft.x,
- Math.min(aPointTopRight.x,
- Math.min(aPointBottomLeft.x,aPointBottomRight.x))),
- Math.min(aPointTopLeft.y,
- Math.min(aPointTopRight.y,
- Math.min(aPointBottomLeft.y,aPointBottomRight.y))) );
-
- java.awt.geom.Point2D.Double aResBottomRight = new java.awt.geom.Point2D.Double( Math.max(aPointTopLeft.x,
- Math.max(aPointTopRight.x,
- Math.max(aPointBottomLeft.x,aPointBottomRight.x))),
- Math.max(aPointTopLeft.y,
- Math.max(aPointTopRight.y,
- Math.max(aPointBottomLeft.y,aPointBottomRight.y))) );
- return new java.awt.geom.Rectangle2D.Double( aResTopLeft.x, aResTopLeft.y,
- aResBottomRight.x - aResTopLeft.x,
- aResBottomRight.y - aResTopLeft.y );
- }
-
- // Create a corrected view transformation out of the give one,
- // which ensures that the rectangle given by (0,0) and
- // attributes.untransformedSize is mapped with its left,top corner
- // to (0,0) again. This is required to properly render sprite
- // animations to buffer bitmaps.
- public static ViewState createAnimationViewState( ViewState inputViewState,
- AnimationAttributes attributes )
- {
- // TODO: Properly respect clip here. Might have to be transformed, too.
-
- AffineTransform aViewTransform = makeTransform( inputViewState.AffineTransform );
-
- // transform Rect(0,0,attributes.untransformedSize) by
- // viewTransform
- java.awt.geom.Rectangle2D.Double aTransformedRect =
- calcTransformedRectBounds( new java.awt.geom.Rectangle2D.Double(0.0, 0.0,
- attributes.UntransformedSize.Width,
- attributes.UntransformedSize.Height),
- aViewTransform );
-
- printTransform( aViewTransform, "createAnimationViewState" );
-
- CanvasUtils.printLog( "createAnimationViewState: transformed origin is: (" + aTransformedRect.x + ", " + aTransformedRect.y + ")" );
-
- // now move resulting left,top point of bounds to (0,0)
- AffineTransform animationViewTransform = new AffineTransform();
- animationViewTransform.translate( -aTransformedRect.x, -aTransformedRect.y );
- animationViewTransform.concatenate( aViewTransform );
-
- printTransform( animationViewTransform, "createAnimationViewState" );
-
- return new ViewState( makeAffineMatrix2D( animationViewTransform ), inputViewState.Clip );
- }
-
- public static void postRenderImageTreatment( Image buffer )
- {
- // TODO: This is specific to Sun's JREs 1.4 and upwards. Make this more portable
- buffer.flush(); // as long as we force images to VRAM,
- // we need to flush them afterwards, to
- // avoid eating up all VRAM.
- }
-
- public static void printTransform( AffineTransform transform,
- String stringPrefix )
- {
- CanvasUtils.printLog( stringPrefix + ": Transform is" );
- double [] matrix = new double[6];
- transform.getMatrix(matrix);
- int i;
- for( i=0; i<6; ++i )
- System.err.print( matrix[i] + ", " );
- CanvasUtils.printLog( "" );
- }
-
- public static void preCondition( boolean bCondition,
- String methodName )
- {
- if( !bCondition )
- printLog("Precondition violated: " + methodName);
- }
-
- public static void printLog( String s )
- {
- System.err.println( s );
- }
-}
diff --git a/canvas/source/java/JavaCanvas.java b/canvas/source/java/JavaCanvas.java
deleted file mode 100644
index fbee763fc272..000000000000
--- a/canvas/source/java/JavaCanvas.java
+++ /dev/null
@@ -1,675 +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.
- *
- ************************************************************************/
-
-// UNO
-import com.sun.star.uno.XComponentContext;
-import com.sun.star.uno.AnyConverter;
-
-// OOo AWT
-import com.sun.star.awt.*;
-
-// Canvas
-import com.sun.star.rendering.*;
-import com.sun.star.geometry.*;
-
-// Java AWT
-import java.awt.*;
-
-public class JavaCanvas
- extends CanvasBase
- implements com.sun.star.awt.XWindow,
- com.sun.star.rendering.XSpriteCanvas,
- com.sun.star.rendering.XIntegerBitmap,
- com.sun.star.lang.XServiceInfo,
- com.sun.star.lang.XInitialization
-{
- private WindowAdapter dummyFrame;
- public BackBuffer backBuffer;
- private java.awt.image.BufferStrategy bufferStrategy;
-
- private java.awt.Font fpsFont;
- private long lastTime;
- private com.sun.star.awt.Rectangle boundRect;
-
- public Graphics2D getGraphics()
- {
- return backBuffer.getGraphics();
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XInitialization
- // ===============
- //
- public void initialize( java.lang.Object[] arguments )
- {
- CanvasUtils.printLog( "JavaCanvas.initialize called!" );
-
- // Do that as the very first thing. The Java2D internal
- // classes choose their render path at initialization time,
- // thus this must happen before doing _any_ GUI.
-
- // TODO: Put those flags into javarc/java.ini, we're maybe
- // coming late into a running JVM!
-
- // now, we're getting slightly system dependent here.
- String os = (String) System.getProperty("os.name");
-
- CanvasUtils.printLog( "System detected: " + os );
-
- // tweak some speed knobs...
-// if( os.startsWith("Windows") )
-// {
-// System.setProperty("sun.java2d.translaccel", "true");
-// System.setProperty("sun.java2d.ddforcevram", "true");
-// //System.setProperty("sun.java2d.accthreshold", "0");
-
-// CanvasUtils.printLog( "Optimizing for Windows" );
-// }
-// else
-// {
-// System.setProperty("sun.java2d.opengl", "true");
-
-// CanvasUtils.printLog( "Optimizing for Unix" );
-// }
-
- /* we're initialized with the following array of anys:
-
- arguments[0] = pointer to VCL window
- arguments[1] = Integer (operating system window handle)
- arguments[2] = com.sun.star.awt.Rectangle (position and size within that OS window)
- arguments[3] = boolean (fullsize window or not)
-
- We then generate a dummy Java frame with that window as the
- parent, to fake a root window for the Java implementation.
- */
- try
- {
- boundRect = (com.sun.star.awt.Rectangle) arguments[2];
-
- //boolean isFullScreen = arguments[1];
- boolean isFullScreen = true;
- //AnyConverter.toBoolean( arguments[3] ) );
-
- // fake a root for Java in VCL window. Pass the flag
- // whether we shall run fullscreen, too.
- dummyFrame = new WindowAdapter( AnyConverter.toInt( arguments[1] ), isFullScreen );
-
- if( isFullScreen )
- {
- // blow window up to fullscreen. Otherwise, we cannot clear the whole screen,
- // which results in ugly flickering
- Dimension screenSize = dummyFrame.frame.getToolkit().getScreenSize();
- boundRect.X = 0;
- boundRect.Y = 0;
- boundRect.Width = screenSize.width-1;
- boundRect.Height = screenSize.height-1;
- }
-
- dummyFrame.setPosSize( boundRect.X, boundRect.Y, boundRect.Width, boundRect.Height, (short)0 );
- CanvasUtils.printLog( "Window size: " + boundRect.Width + ", " + boundRect.Height );
-
- backBuffer = new BackBuffer( (Graphics2D) dummyFrame.frame.getGraphics(),
- Math.max(1,boundRect.Width),
- Math.max(1,boundRect.Height) );
-
- // TODO: Maybe delay double buffer init until first sprite creation
- dummyFrame.frame.createBufferStrategy(2);
- bufferStrategy = dummyFrame.frame.getBufferStrategy();
-
- if( bufferStrategy.getCapabilities().isPageFlipping() )
- CanvasUtils.printLog( "JavaCanvas.initialize double buffering is using page flipping!" );
- else
- CanvasUtils.printLog( "JavaCanvas.initialize double buffering is using blitting!" );
-
- lastTime = System.currentTimeMillis();
- fpsFont = new java.awt.Font( "Times", Font.PLAIN, 20 );
-
- CanvasUtils.printLog( "JavaCanvas.initialize finished!" );
- }
- catch( com.sun.star.lang.IllegalArgumentException e )
- {
- CanvasUtils.printLog( "Cannot create EmbeddedFrame within VCL window hierarchy!" );
- }
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XComponent
- // ==========
- //
- public void dispose()
- {
- CanvasUtils.printLog( "JavaCanvas: disposed!" );
-
- // destroy all active sprites
- java.util.Set entries = activeSprites.entrySet();
- java.util.Iterator iter = entries.iterator();
-
- while( iter.hasNext() )
- {
- java.util.Map.Entry entry = (java.util.Map.Entry)iter.next();
- if( entry.getValue() != null )
- ((SpriteRep)entry.getValue()).dispose();
- }
-
- if( bufferStrategy != null )
- bufferStrategy.getDrawGraphics().dispose(); // really necessary?
-
- if( dummyFrame != null )
- dummyFrame.dispose();
-
- if( backBuffer != null)
- backBuffer.dispose();
-
- bufferStrategy = null;
- dummyFrame = null;
- backBuffer = null;
-
- super.dispose();
- }
-
- //----------------------------------------------------------------------------------
-
- public JavaCanvas( XComponentContext xContext )
- {
- CanvasUtils.printLog( "JavaCanvas constructor called!" );
- activeSprites = new java.util.HashMap( 33 );
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XWindow interface
- // =================
- //
- // This is delegated to WindowAdapter!
- //
- public synchronized void setPosSize( int X, int Y, int Width, int Height, short Flags )
- {
- if( dummyFrame != null )
- {
- dummyFrame.setPosSize( X, Y, Width, Height, Flags );
-
- Width = Math.max(1,Width);
- Height= Math.max(1,Height);
-
- CanvasUtils.printLog( "JavaCanvas graphics set to " + Width + "," + Height );
- backBuffer.setSize(Width,Height);
- }
- }
-
- public synchronized com.sun.star.awt.Rectangle getPosSize( )
- {
- if( dummyFrame != null )
- return dummyFrame.getPosSize();
-
- return new com.sun.star.awt.Rectangle();
- }
-
- public synchronized void setVisible( boolean visible )
- {
- if( dummyFrame != null )
- dummyFrame.setVisible( visible );
- }
-
- public synchronized void setEnable( boolean enable )
- {
- if( dummyFrame != null )
- dummyFrame.setEnable( enable );
- }
-
- public synchronized void setFocus()
- {
- if( dummyFrame != null )
- dummyFrame.setFocus();
- }
-
- public synchronized void addWindowListener( XWindowListener xListener )
- {
- if( dummyFrame != null )
- dummyFrame.addWindowListener( xListener );
- }
-
- public synchronized void removeWindowListener( XWindowListener xListener )
- {
- if( dummyFrame != null )
- dummyFrame.removeWindowListener( xListener );
- }
-
- public synchronized void addFocusListener( XFocusListener xListener )
- {
- if( dummyFrame != null )
- dummyFrame.addFocusListener( xListener );
- }
-
- public synchronized void removeFocusListener( XFocusListener xListener )
- {
- if( dummyFrame != null )
- dummyFrame.removeFocusListener( xListener );
- }
-
- public synchronized void addKeyListener( XKeyListener xListener )
- {
- if( dummyFrame != null )
- dummyFrame.addKeyListener( xListener );
- }
-
- public synchronized void removeKeyListener( XKeyListener xListener )
- {
- if( dummyFrame != null )
- dummyFrame.removeKeyListener( xListener );
- }
-
- public synchronized void addMouseListener( XMouseListener xListener )
- {
- if( dummyFrame != null )
- dummyFrame.addMouseListener( xListener );
- }
-
- public synchronized void removeMouseListener( XMouseListener xListener )
- {
- if( dummyFrame != null )
- dummyFrame.removeMouseListener( xListener );
- }
-
- public synchronized void addMouseMotionListener( XMouseMotionListener xListener )
- {
- if( dummyFrame != null )
- dummyFrame.addMouseMotionListener( xListener );
- }
-
- public synchronized void removeMouseMotionListener( XMouseMotionListener xListener )
- {
- if( dummyFrame != null )
- dummyFrame.removeMouseMotionListener( xListener );
- }
-
- public synchronized void addPaintListener( XPaintListener xListener )
- {
- if( dummyFrame != null )
- dummyFrame.addPaintListener( xListener );
- }
-
- public synchronized void removePaintListener( XPaintListener xListener )
- {
- if( dummyFrame != null )
- dummyFrame.removePaintListener( xListener );
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XBitmapCanvas impl
- // ==================
- //
-
- public synchronized void copyRect( com.sun.star.rendering.XBitmapCanvas sourceCanvas,
- com.sun.star.geometry.RealRectangle2D sourceRect,
- com.sun.star.rendering.ViewState sourceViewState,
- com.sun.star.rendering.RenderState sourceRenderState,
- com.sun.star.geometry.RealRectangle2D destRect,
- com.sun.star.rendering.ViewState destViewState,
- com.sun.star.rendering.RenderState destRenderState )
- {
- CanvasUtils.printLog( "JavaCanvas.copyRect() called" );
-
- // TODO: create temp image when transform is non-trivial
-
- if( sourceCanvas == this )
- {
- // copy rectangle within the canvas
- getGraphics().copyArea((int)sourceRect.X1,
- (int)sourceRect.Y1,
- (int)(sourceRect.X2 - sourceRect.X1),
- (int)(sourceRect.Y2 - sourceRect.Y1),
- (int)(destRect.X1 - sourceRect.X1),
- (int)(destRect.Y1 - sourceRect.Y1) );
- }
- else
- {
- if( sourceCanvas instanceof JavaCanvas )
- {
- // cache
- CanvasUtils.setupGraphicsState( getGraphics(), destViewState, destRenderState, CanvasUtils.alsoSetupPaint );
-
- java.awt.Image backBuffer = ((JavaCanvas)sourceCanvas).backBuffer.getBackBuffer();
-
- // TODO: really extract correct source rect here
- getGraphics().drawImage( backBuffer, 0, 0, null);
- CanvasUtils.postRenderImageTreatment( backBuffer );
- }
- // TODO: foreign canvas
- }
- }
-
- //----------------------------------------------------------------------------------
-
- // a map of SpriteReps, with Sprite object as keys. Contains all
- // active (i.e. visible) sprites, the SpriteReps are used to
- // repaint the sprite content at any time.
- private java.util.HashMap activeSprites;
-
- //
- // XSpriteCanvas impl
- // ==================
- //
-
- public synchronized com.sun.star.rendering.XAnimatedSprite createSpriteFromAnimation( XAnimation animation )
- {
- CanvasUtils.printLog( "JavaCanvas.createSpriteFromAnimation called" );
-
- return new CanvasSprite( animation, this, (Graphics2D)dummyFrame.frame.getGraphics() );
- }
-
- public synchronized XAnimatedSprite createSpriteFromBitmaps( com.sun.star.rendering.XBitmap[] animationBitmaps,
- byte interpolationMode )
- {
- return null;
- }
-
- public synchronized XCustomSprite createCustomSprite( RealSize2D spriteSize )
- {
- CanvasUtils.printLog( "JavaCanvas.createCustomSprite called" );
-
- return new CanvasCustomSprite( spriteSize, this, (Graphics2D)dummyFrame.frame.getGraphics() );
- }
-
- public synchronized XSprite createClonedSprite( XSprite original )
- {
- return new CanvasClonedSprite( this, original );
- }
-
- public synchronized boolean updateScreen( boolean bUpdateAll )
- {
- redrawAllLayers();
-
- return true;
- }
-
- //
- // XBitmap implementation
- // ======================
- //
-
- public synchronized IntegerSize2D getSize()
- {
- return new IntegerSize2D( boundRect.Width,
- boundRect.Height );
- }
-
- //----------------------------------------------------------------------------------
-
- public synchronized XBitmapCanvas queryBitmapCanvas()
- {
- return this;
- }
-
- //----------------------------------------------------------------------------------
-
- public synchronized com.sun.star.rendering.XBitmap getScaledBitmap( RealSize2D newSize, boolean beFast ) throws com.sun.star.lang.IllegalArgumentException, VolatileContentDestroyedException
- {
- // TODO
- return null;
- }
-
- //----------------------------------------------------------------------------------
-
- public synchronized boolean hasAlpha()
- {
- // TODO
- return false;
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XIntegerBitmap implementation
- // =============================
- //
-
- public synchronized byte[] getData( IntegerBitmapLayout[] bitmapLayout,
- IntegerRectangle2D rect )
- {
- // TODO
- return null;
- }
-
- //----------------------------------------------------------------------------------
-
- public synchronized void setData( byte[] data, IntegerBitmapLayout bitmapLayout, com.sun.star.geometry.IntegerRectangle2D rect )
- {
- // TODO
- }
-
- //----------------------------------------------------------------------------------
-
- public synchronized void setPixel( byte[] color, IntegerBitmapLayout bitmapLayout, com.sun.star.geometry.IntegerPoint2D pos )
- {
- // TODO
- }
-
- //----------------------------------------------------------------------------------
-
- public synchronized byte[] getPixel( IntegerBitmapLayout[] bitmapLayout,
- IntegerPoint2D pos )
- {
- // TODO
- return null;
- }
-
- //----------------------------------------------------------------------------------
-
- public synchronized XBitmapPalette getPalette()
- {
- // TODO
- return null;
- }
-
- //----------------------------------------------------------------------------------
-
- public synchronized IntegerBitmapLayout getMemoryLayout()
- {
- // TODO: finish that one
- IntegerBitmapLayout layout = new IntegerBitmapLayout();
-
- return layout;
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XSpriteCanvas helper
- // ====================
- //
- public synchronized void renderAnimation( CanvasSprite sprite, XAnimation animation, double t )
- {
- SpriteRep spriteRep = (SpriteRep)activeSprites.get( sprite );
- if( spriteRep != null )
- {
- //Graphics2D graph = getWindowGraphics();
-
- // TODO: ensure update of graphics object externally, e.g. when
- // VCL moves the toplevel window.
- //java.awt.Rectangle bounds = dummyFrame.frame.getBounds();
- //graphics.setGraphics(graph, bounds.width, bounds.height);
-
- spriteRep.renderAnimation( animation, sprite.getViewState(), t );
- }
- else
- {
- CanvasUtils.printLog( "JavaCanvas.renderAnimation sprite not active!" );
- }
- }
-
- public synchronized void showSprite( SpriteBase sprite )
- {
- CanvasUtils.printLog( "JavaCanvas.showSprite() called" );
-
- SpriteRep spriteRep = (SpriteRep)activeSprites.get( sprite );
- if( spriteRep != null )
- {
- CanvasUtils.printLog( "JavaCanvas.showSprite sprite already active!" );
- }
- else
- {
- spriteRep = sprite.getSpriteRep();
-
- // a valid SpriteRep for a given Sprite in the
- // activeSprites hash denotes 'sprite active'
- activeSprites.put( sprite, spriteRep );
-
- // TODO: TEMP! Just for testing! Set empty cursor for presentation
-// dummyFrame.frame.setCursor( dummyFrame.frame.getToolkit().createCustomCursor(new java.awt.image.BufferedImage(0,0,
-// java.awt.image.BufferedImage.TYPE_INT_RGB),
-// new java.awt.Point(0,0),
-// "") );
- }
- }
-
- public synchronized void hideSprite( SpriteBase sprite )
- {
- CanvasUtils.printLog( "JavaCanvas.hideSprite() called" );
-
- SpriteRep spriteRep = (SpriteRep)activeSprites.get( sprite );
- if( spriteRep != null )
- {
- activeSprites.put( sprite, null );
- redrawAllLayers();
- }
- else
- {
- CanvasUtils.printLog( "JavaCanvas.hideSprite sprite not active!" );
- }
- }
-
- private void redrawAllLayers()
- {
- // fetch the Graphics object to draw into (we're doing double
- // buffering here, the content is later shown via
- // bufferStrategy.show().
- Graphics2D graph = null;
-
- try
- {
- graph = (Graphics2D)bufferStrategy.getDrawGraphics();
-
- GraphicsDevice device = graph.getDeviceConfiguration().getDevice();
- CanvasUtils.printLog( "Available vram: " + device.getAvailableAcceleratedMemory() );
-
- // repaint background
- backBuffer.redraw( graph );
-
- // repaint all active sprites
- java.util.Set entries = activeSprites.entrySet();
- java.util.Iterator iter = entries.iterator();
- while( iter.hasNext() )
- {
- java.util.Map.Entry entry = (java.util.Map.Entry)iter.next();
- if( entry.getValue() != null )
- ((SpriteRep)entry.getValue()).redraw(graph);
- }
-
- long currTime = System.currentTimeMillis();
- graph.setComposite( AlphaComposite.getInstance(AlphaComposite.SRC_OVER) );
- graph.setFont( fpsFont );
- graph.setColor( java.awt.Color.black );
-
- try
- {
- String fps = new String( String.valueOf(1000.0/(currTime-lastTime)) );
- graph.drawString( fps.substring(0,5) + " fps", 0, 20);
- CanvasUtils.printLog( fps.substring(0,5) + " fps" );
- }
- catch( Exception e )
- {
- graph.drawString( "0 fps", 0, 20);
- }
-
- lastTime = currTime;
- }
- catch( Exception e )
- {
- CanvasUtils.printLog( "Exception thrown in redrawAllLayers" );
- }
- finally
- {
- if( graph != null )
- graph.dispose();
- }
-
- bufferStrategy.show();
- }
-
- //----------------------------------------------------------------------------------
-
- private static final String s_implName = "XCanvas.java.impl";
- private static final String s_serviceName = "com.sun.star.rendering.JavaCanvas";
-
- //----------------------------------------------------------------------------------
-
- //
- // XServiceInfo impl
- // =================
- //
- public synchronized String getImplementationName()
- {
- return s_implName;
- }
-
- public synchronized String [] getSupportedServiceNames()
- {
- return new String [] { s_serviceName };
- }
-
- public synchronized boolean supportsService( String serviceName )
- {
- return serviceName.equals( s_serviceName );
- }
-
- public static com.sun.star.lang.XSingleServiceFactory __getServiceFactory(
- String implName,
- com.sun.star.lang.XMultiServiceFactory multiFactory,
- com.sun.star.registry.XRegistryKey regKey )
- {
- if (implName.equals( s_implName ))
- {
- return com.sun.star.comp.loader.FactoryHelper.getServiceFactory(
- JavaCanvas.class, s_serviceName, multiFactory, regKey );
- }
- return null;
- }
-
- public static boolean __writeRegistryServiceInfo(
- com.sun.star.registry.XRegistryKey regKey )
- {
- return com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo(
- s_implName, s_serviceName, regKey );
- }
-}
diff --git a/canvas/source/java/LinePolyPolygon.java b/canvas/source/java/LinePolyPolygon.java
deleted file mode 100644
index 3ab19d97ba19..000000000000
--- a/canvas/source/java/LinePolyPolygon.java
+++ /dev/null
@@ -1,192 +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.
- *
- ************************************************************************/
-
-// Canvas
-import com.sun.star.rendering.*;
-import com.sun.star.geometry.*;
-
-public class LinePolyPolygon
- extends com.sun.star.lib.uno.helper.ComponentBase
- implements com.sun.star.lang.XServiceInfo,
- com.sun.star.rendering.XLinePolyPolygon2D
-{
- private java.awt.geom.GeneralPath path;
-
- //----------------------------------------------------------------------------------
-
- public LinePolyPolygon( RealPoint2D[][] points )
- {
- setPoints( points, 0 );
- }
-
- public java.awt.geom.GeneralPath getJavaPath()
- {
- return path;
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XPolyPolygon implementation
- // ===========================
- //
- public synchronized void addPolyPolygon( RealPoint2D position, XPolyPolygon2D polyPolygon )
- {
- }
-
- public synchronized int getNumberOfPolygons( )
- {
- return 0;
- }
-
- public synchronized int getNumberOfPolygonPoints( int polygon )
- {
- return 0;
- }
-
- public synchronized FillRule getFillRule( )
- {
- if( path.getWindingRule() == java.awt.geom.GeneralPath.WIND_EVEN_ODD )
- return FillRule.EVEN_ODD;
- else
- return FillRule.NON_ZERO;
- }
-
- public synchronized void setFillRule( FillRule fillRule )
- {
- if( fillRule == FillRule.EVEN_ODD )
- path.setWindingRule( java.awt.geom.GeneralPath.WIND_EVEN_ODD );
- else
- path.setWindingRule( java.awt.geom.GeneralPath.WIND_NON_ZERO );
- }
-
- public synchronized boolean isClosed( int index )
- {
- // TODO
- return false;
- }
-
- public synchronized void setClosed( int index, boolean closedState )
- {
- // TODO
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XLinePolyPolygon implementation
- // ===============================
- //
- public synchronized RealPoint2D[][] getPoints( int nPolygonIndex, int nNumberOfPolygons, int nPointIndex, int nNumberOfPoints )
- {
- // TODO: Implement subsetting
-
-// double [] points = new double[6];
-
-// // BAH! Use util.Vector here!
-
-// // find number of subpaths
-// PathIterator aIter = path.getPathIterator( new AffineTransform() );
-// int nNumSubPaths = 0;
-// while( !aIter.isDone() )
-// {
-// if( aIter.currentSegment(points) == SEG_MOVETO )
-// ++nNumSubPaths;
-
-// aIter.next();
-// }
-
-// Point2D [][] aRes = new Point2D[nNumSubPaths][];
-// aIter = path.getPathIterator( new AffineTransform() );
-// while( !aIter.isDone() )
-// {
-// switch( aIter.currentSegment(points) )
-// {
-// case SEG_MOVETO:
-// break;
-
-// case SEG_LINETO:
-// break;
-
-// case SEG_CLOSE:
-// break;
-
-// default:
-// CanvasUtils.printLog( "LinePolyPolygon.getPoints(): unexpected path type" );
-// break;
-// }
-
-// aIter.next();
-// }
-// double [] points = new double[6];
-
- return null;
- }
-
- public synchronized void setPoints( RealPoint2D[][] points, int nPolygonIndex )
- {
- if( nPolygonIndex != 0 )
- CanvasUtils.printLog( "LinePolyPolygon.setPoints: subset not yet implemented!" );
-
- path = CanvasUtils.makeGenPathFromLinePoints( points );
- }
-
- public synchronized RealPoint2D getPoint( int nPolygonIndex, int nPointIndex )
- {
- return null;
- }
-
- public synchronized void setPoint( RealPoint2D point, int nPolygonIndex, int nPointIndex )
- {
- CanvasUtils.printLog( "LinePolyPolygon.setPoint: not yet implemented!" );
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XServiceInfo impl
- // =================
- //
-
- private static final String s_implName = "XLinePolyPolygon2D.java.impl";
- private static final String s_serviceName = "com.sun.star.rendering.LinePolyPolygon2D";
-
- public String getImplementationName()
- {
- return s_implName;
- }
-
- public String [] getSupportedServiceNames()
- {
- return new String [] { s_serviceName };
- }
-
- public boolean supportsService( String serviceName )
- {
- return serviceName.equals( s_serviceName );
- }
-}
diff --git a/canvas/source/java/SpriteRep.java b/canvas/source/java/SpriteRep.java
deleted file mode 100644
index 046a45f2d9bb..000000000000
--- a/canvas/source/java/SpriteRep.java
+++ /dev/null
@@ -1,175 +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.
- *
- ************************************************************************/
-
-// Canvas
-import com.sun.star.rendering.*;
-
-// Java AWT
-import java.awt.*;
-import java.awt.geom.*;
-
-public class SpriteRep
-{
- private java.awt.image.BufferedImage buffer;
- private CanvasBitmap canvasBitmap;
- private double alpha;
- private java.awt.geom.Point2D.Double outputPosition;
- private boolean bufferOwned;
-
- //----------------------------------------------------------------------------------
-
- // TODO: Everything in this class
- // TODO: Implement lifetime control for buffer object, which is shared between SpriteReps
- public SpriteRep()
- {
- CanvasUtils.printLog( "SpriteRep constructor called!" );
-
- alpha = 0.0;
- outputPosition = new java.awt.geom.Point2D.Double(0.0,0.0);
- bufferOwned = true; // the buffer member is our own, and has to be disposed
- }
-
- public SpriteRep( SpriteRep original )
- {
- CanvasUtils.printLog( "SpriteRep clone constructor called!" );
-
- alpha = 0.0;
- outputPosition = new java.awt.geom.Point2D.Double(0.0,0.0);
- cloneBuffer( original );
- bufferOwned = false; // the buffer member is not our own, and must not be disposed
- }
-
- //----------------------------------------------------------------------------------
-
- public synchronized void renderAnimation( XAnimation animation, ViewState viewState, double t )
- {
- if( canvasBitmap != null )
- {
- // clear buffer with all transparent
- Graphics2D bitmapGraphics = canvasBitmap.getGraphics();
-
- // before that, setup _everything_ we might have changed in CanvasUtils.setupGraphicsState
- bitmapGraphics.setColor( new Color( 0.0f, 0.0f, 0.0f, 1.0f ) );
- bitmapGraphics.setComposite(
- java.awt.AlphaComposite.getInstance(java.awt.AlphaComposite.CLEAR));
- bitmapGraphics.setTransform( new AffineTransform() );
- bitmapGraphics.setClip( new java.awt.Rectangle(0,0,buffer.getWidth(),buffer.getHeight()) );
- bitmapGraphics.fillRect(0,0,buffer.getWidth(),buffer.getHeight());
-
- try
- {
- // now push the animation at time instance t into the
- // virginal graphics
- animation.render(canvasBitmap, viewState, t);
- }
- catch( com.sun.star.lang.IllegalArgumentException e )
- {
- CanvasUtils.printLog( "Cannot create EmbeddedFrame within VCL window hierarchy!" );
- }
- }
- }
-
- public synchronized void setSpriteAlpha( double _alpha )
- {
- CanvasUtils.printLog("SpriteRep.setSpriteAlpha called with alpha=" + alpha);
- alpha = _alpha;
- }
-
- public synchronized void moveSprite( java.awt.geom.Point2D.Double aNewPos )
- {
- outputPosition = aNewPos;
- CanvasUtils.printLog( "SpriteRep.moveSprite: moving to (" + outputPosition.x + ", " + outputPosition.y + ")" );
- }
-
- public synchronized void redraw( Graphics2D output )
- {
- if( buffer != null )
- {
- CanvasUtils.printLog( "SpriteRep.redraw: compositing with alpha=" + alpha );
- output.setComposite( java.awt.AlphaComposite.getInstance(java.awt.AlphaComposite.SRC_OVER, (float)alpha) );
-
- output.drawImage( buffer,
- (int)(outputPosition.getX() + .5),
- (int)(outputPosition.getY() + .5),
- null );
-
- //CanvasUtils.postRenderImageTreatment( buffer );
-
- CanvasUtils.printLog( "SpriteRep.redraw called, output rect is (" +
- outputPosition.getX() + ", " +
- outputPosition.getY() + ", " +
- buffer.getWidth() + ", " +
- buffer.getHeight() + ")" );
- }
- }
-
- public synchronized void setupBuffer( java.awt.Graphics2D graphics, int width, int height )
- {
- if( canvasBitmap != null )
- canvasBitmap.dispose();
-
- if( buffer != null )
- buffer.flush();
-
- buffer = graphics.getDeviceConfiguration().createCompatibleImage(Math.max(1,width),
- Math.max(1,height),
- Transparency.TRANSLUCENT);
- canvasBitmap = new CanvasBitmap( buffer );
- CanvasUtils.initGraphics( canvasBitmap.getGraphics() );
-
- CanvasUtils.printLog( "SpriteRep.setupBuffer called, with dimensions (" + width + ", " + height + ")" );
- }
-
- public synchronized void cloneBuffer( SpriteRep original )
- {
- buffer = original.buffer;
- }
-
- public synchronized com.sun.star.rendering.XCanvas getContentCanvas()
- {
- CanvasUtils.printLog( "SpriteRep.getContentCanvas() called" );
-
- Graphics2D graphics = canvasBitmap.getGraphics();
- graphics.setTransform( new AffineTransform() );
- graphics.setComposite( AlphaComposite.getInstance(AlphaComposite.CLEAR));
- graphics.fillRect( 0,0,buffer.getWidth(),buffer.getHeight() );
-
- return canvasBitmap;
- }
-
- public void dispose()
- {
- if( canvasBitmap != null )
- canvasBitmap.dispose();
-
- if( buffer != null && bufferOwned )
- buffer.flush();
-
- canvasBitmap = null;
- buffer = null;
- }
-}
diff --git a/canvas/source/java/SpriteRunner.java b/canvas/source/java/SpriteRunner.java
deleted file mode 100644
index 17e472e7e5c7..000000000000
--- a/canvas/source/java/SpriteRunner.java
+++ /dev/null
@@ -1,200 +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.
- *
- ************************************************************************/
-
-// Canvas
-import com.sun.star.rendering.*;
-
-//
-// HOWTO get a Graphics2D from a window
-//
-
-// import javax.swing.*;
-// import java.awt.*;
-// import java.awt.geom.*;
-
-// public class Stroke1 extends JFrame {
-// Stroke drawingStroke = new BasicStroke(5);
-// Rectangle2D rect =
-// new Rectangle2D.Double(20, 40, 100, 40);
-
-// public void paint(Graphics g) {
-// Graphics2D g2d = (Graphics2D)g;
-// g2d.setStroke(drawingStroke);
-// g2d.draw(rect);
-// }
-
-// public static void main(String args[]) {
-// JFrame frame = new Stroke1();
-// frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
-// frame.setSize(200, 100);
-// frame.show();
-// }
-// }
-
-
-public class SpriteRunner
- extends Thread
-{
- private CanvasSprite sprite;
- private XAnimation spriteAnimation;
- private JavaCanvas canvas;
- private double startTime;
- private double currentSpeed;
- private double currentT;
- private boolean animationActive;
- private boolean stayAlive;
-
- //----------------------------------------------------------------------------------
-
- public SpriteRunner( CanvasSprite _sprite, XAnimation _animation, JavaCanvas _canvas )
- {
- CanvasUtils.printLog( "SpriteRunner constructor called!" );
-
- sprite = _sprite;
- spriteAnimation = _animation;
- canvas = _canvas;
- startTime = 0.0;
- currentSpeed = 0.0;
- currentT = 0.0;
- animationActive = false;
- stayAlive = true;
-
- // Set priority to lower-than-normal, as this thread runs the
- // animation in a busy loop.
- setPriority( MIN_PRIORITY );
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // Thread
- // ======
- //
- // Overriding
- //
- public void run()
- {
- // perform the animation rendering (as fast as possible, for now)
-
- while( stayAlive )
- {
- while( animationActive )
- {
- // to determine the current animation step to render, calc the
- // elapsed time since this animation was started
- double elapsedTime = getCurrentTime() - startTime;
-
- // the frame to render is determined by mapping the cycle
- // duration (currentSpeed) to the [0,1] range of the animation.
- currentT = (elapsedTime % currentSpeed) / currentSpeed;
-
- // delegate animation rendering to SpriteCanvas, as
- // only this instance can enforce consistency (on-time
- // saving of background etc.)
- canvas.renderAnimation( sprite, spriteAnimation, currentT );
-
- // TODO: Consolidate _all_ sprites per canvas into one
- // thread, call updateScreen() only after all sprites
- // have been processed.
-
- //Make changes visible
- canvas.updateScreen( false );
-
- // TODO: Evaluate vs. setPriority and other means
-// try
-// {
-// // give other tasks some time to breathe (10ms - this is only meant symbolically)
-// sleep(10);
-// } catch( InterruptedException e ) { }
- }
-
- // wait until animation is activated again
- try
- {
- wait();
- }
- catch( InterruptedException e ) { }
- catch( IllegalMonitorStateException e ) { }
- }
- }
-
- public synchronized void startAnimation( double speed )
- {
- resetAnimation();
- currentSpeed = speed;
-
- // start us, if not done already
- if( !isAlive() )
- start();
-
- // enable animation thread
- animationActive = true;
-
- try
- {
- notify();
- } catch( IllegalMonitorStateException e ) { }
- }
-
- public synchronized void stopAnimation()
- {
- // stop animation after the current frame has been completely
- // rendered
- animationActive = false;
- }
-
- public synchronized void resetAnimation()
- {
- startTime = getCurrentTime();
- }
-
- public synchronized boolean isAnimationActive()
- {
- return animationActive;
- }
-
- public synchronized void quit()
- {
- stayAlive = false;
- stopAnimation();
- }
-
- public synchronized double getCurrentT()
- {
- return currentT;
- }
-
- //----------------------------------------------------------------------------------
-
- // helper
- static double getCurrentTime()
- {
- // determine current time in seconds
- java.util.Calendar cal = new java.util.GregorianCalendar();
- return cal.getTimeInMillis() / 1000.0;
- }
-}
diff --git a/canvas/source/java/TextLayout.java b/canvas/source/java/TextLayout.java
deleted file mode 100644
index 1a443fcbeeac..000000000000
--- a/canvas/source/java/TextLayout.java
+++ /dev/null
@@ -1,205 +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.
- *
- ************************************************************************/
-
-// Canvas
-import com.sun.star.rendering.*;
-
-public class TextLayout
- extends com.sun.star.lib.uno.helper.ComponentBase
- implements com.sun.star.lang.XServiceInfo,
- com.sun.star.rendering.XTextLayout
-{
- private double[] advancements;
- private StringContext text;
- private byte direction;
- private CanvasBase associatedCanvas;
- private CanvasFont font;
-
- //----------------------------------------------------------------------------------
-
- public TextLayout( StringContext aText,
- byte nDirection,
- long nRandomSeed,
- CanvasFont _font,
- CanvasBase _canvas )
- {
- text = aText;
- direction = nDirection;
- associatedCanvas = _canvas;
- font = _font;
- }
-
- //
- // XTextLayout implementation
- // ==========================
- //
-
- public XPolyPolygon2D[] queryTextShapes( )
- {
- // TODO
- return null;
- }
-
- public com.sun.star.geometry.RealRectangle2D[] queryInkMeasures( )
- {
- // TODO
- return null;
- }
-
- public com.sun.star.geometry.RealRectangle2D[] queryMeasures( )
- {
- // TODO
- return null;
- }
-
- public double[] queryLogicalAdvancements( )
- {
- // TODO
- return null;
- }
-
- public void applyLogicalAdvancements( double[] aAdvancements ) throws com.sun.star.lang.IllegalArgumentException
- {
- if( aAdvancements.length != text.Length )
- throw new com.sun.star.lang.IllegalArgumentException();
-
- advancements = aAdvancements;
- }
-
- public com.sun.star.geometry.RealRectangle2D queryTextBounds( )
- {
- // TODO
- return null;
- }
-
- public double justify( double nSize ) throws com.sun.star.lang.IllegalArgumentException
- {
- // TODO
- return 0;
- }
-
- public double combinedJustify( XTextLayout[] aNextLayouts, double nSize ) throws com.sun.star.lang.IllegalArgumentException
- {
- // TODO
- return 0;
- }
-
- public TextHit getTextHit( /*IN*/com.sun.star.geometry.RealPoint2D aHitPoint )
- {
- // TODO
- return null;
- }
-
- public Caret getCaret( int nInsertionIndex, boolean bExcludeLigatures ) throws com.sun.star.lang.IndexOutOfBoundsException
- {
- // TODO
- return null;
- }
-
- public int getNextInsertionIndex( int nStartIndex, int nCaretAdvancement, boolean bExcludeLigatures ) throws com.sun.star.lang.IndexOutOfBoundsException
- {
- // TODO
- return 0;
- }
-
- public XPolyPolygon2D queryVisualHighlighting( int nStartIndex, int nEndIndex ) throws com.sun.star.lang.IndexOutOfBoundsException
- {
- // TODO
- return null;
- }
-
- public XPolyPolygon2D queryLogicalHighlighting( int nStartIndex, int nEndIndex ) throws com.sun.star.lang.IndexOutOfBoundsException
- {
- // TODO
- return null;
- }
-
- public double getBaselineOffset( )
- {
- // TODO
- return 0.0;
- }
-
- public byte getMainTextDirection( )
- {
- return direction;
- }
-
- public XCanvasFont getFont( )
- {
- return font;
- }
-
- public StringContext getText( )
- {
- return text;
- }
-
- public boolean draw( java.awt.Graphics2D graphics )
- {
- // TODO: use proper advancement. Text direction need not be horizontal!
- // TODO: given text string need not have a one-to-one relationship between code point and glyph (offset)!
- graphics.drawString( text.Text.substring(text.StartPosition, text.StartPosition + 1), (float)0.0, (float)0.0 );
- for( int i=1; i<advancements.length && i<text.Length; ++i )
- {
- CanvasUtils.printLog( "XCanvas: drawOffsettedText rendering a \"" +
- text.Text.substring(text.StartPosition + i,
- text.StartPosition + i + 1) +
- "\" (position " + (text.StartPosition + i) +
- " of " + text.Text + ", offset " + advancements[i] + ")" );
-
- graphics.drawString( text.Text.substring(text.StartPosition + i, text.StartPosition + i + 1), (float)advancements[i-1], (float)0.0 );
- }
-
- return true;
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XServiceInfo impl
- // =================
- //
-
- private static final String s_implName = "CanvasFont.java.impl";
- private static final String s_serviceName = "com.sun.star.rendering.XCanvasFont";
-
- public String getImplementationName()
- {
- return s_implName;
- }
-
- public String [] getSupportedServiceNames()
- {
- return new String [] { s_serviceName };
- }
-
- public boolean supportsService( String serviceName )
- {
- return serviceName.equals( s_serviceName );
- }
-}
diff --git a/canvas/source/java/aqua/WindowAdapter.java b/canvas/source/java/aqua/WindowAdapter.java
deleted file mode 100644
index 2529bb56e55c..000000000000
--- a/canvas/source/java/aqua/WindowAdapter.java
+++ /dev/null
@@ -1,202 +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.
- *
- ************************************************************************/
-
-// UNO
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.XComponentContext;
-import com.sun.star.uno.AnyConverter;
-import com.sun.star.lang.XInitialization;
-import com.sun.star.lib.uno.helper.WeakBase;
-
-// OOo AWT
-import com.sun.star.awt.*;
-
-// system-dependent stuff
-import sun.awt.*;
-
-//Apple specifics
-import apple.awt.*;
-
-
-public class WindowAdapter
-// defacto implementing the interface, but not deriving from it, since
-// we're no real XInterface here
-// implements com.sun.star.awt.XWindow
-{
- public java.awt.Frame frame;
- private boolean fullscreen;
-
- public WindowAdapter( int windowHandle,
- boolean _fullscreen )
- {
- fullscreen = false;
-
- if( _fullscreen )
- {
- // create a normal Java frame, and set it into fullscreen mode
- frame = new javax.swing.JFrame( "Presentation" );
- frame.setUndecorated( true );
- frame.setVisible( true );
-
- java.awt.Graphics2D graphics = (java.awt.Graphics2D)frame.getGraphics();
- if( graphics.getDeviceConfiguration().getDevice().isFullScreenSupported() )
- {
- CanvasUtils.printLog( "WindowAdapter(Aqua): entering fullscreen mode" );
- graphics.getDeviceConfiguration().getDevice().setFullScreenWindow( frame );
- fullscreen = true;
- }
- else
- {
- CanvasUtils.printLog( "WindowAdapter(Aqua): fullscreen not supported" );
- }
-
- graphics.dispose();
- }
- else
- {
- // we're initialized with the operating system window handle
- // as the parameter. We then generate a dummy Java frame with
- // that window as the parent, to fake a root window for the
- // Java implementation.
-
- // now, we're getting slightly system dependent here.
- String os = (String) System.getProperty("os.name");
-
- // create the embedded frame
- if( os.startsWith("Mac OS X") )
- frame = new apple.awt.CEmbeddedFrame( windowHandle );
- else
- throw new com.sun.star.uno.RuntimeException();
-
-
-// frame = new javax.swing.JFrame( "Test window" );
-
-// // resize it according to the given bounds
-// frame.setBounds( boundRect );
-// frame.setVisible( true );
- }
- }
-
- //----------------------------------------------------------------------------------
-
- public void dispose()
- {
- if( fullscreen )
- {
- java.awt.Graphics2D graphics = (java.awt.Graphics2D)frame.getGraphics();
- if( graphics.getDeviceConfiguration().getDevice().isFullScreenSupported() )
- {
- CanvasUtils.printLog( "WindowAdapter(Aqua): leaving fullscreen mode" );
- graphics.getDeviceConfiguration().getDevice().setFullScreenWindow( null );
- }
- graphics.dispose();
- }
-
- if( frame != null )
- frame.dispose();
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XWindow interface
- // =================
- //
- public void setPosSize( int X, int Y, int Width, int Height, short Flags )
- {
- frame.setBounds( new java.awt.Rectangle( X, Y, Width, Height ) );
- }
-
- public com.sun.star.awt.Rectangle getPosSize( )
- {
- java.awt.Rectangle bounds = frame.getBounds();
-
- return new com.sun.star.awt.Rectangle( bounds.x, bounds.y, bounds.width, bounds.height );
- }
-
- public void setVisible( boolean visible )
- {
- frame.setVisible( visible );
- }
-
- public void setEnable( boolean enable )
- {
- frame.setEnabled( enable );
- }
-
- public void setFocus()
- {
- }
-
- public void addWindowListener( XWindowListener xListener )
- {
- }
-
- public void removeWindowListener( XWindowListener xListener )
- {
- }
-
- public void addFocusListener( XFocusListener xListener )
- {
- }
-
- public void removeFocusListener( XFocusListener xListener )
- {
- }
-
- public void addKeyListener( XKeyListener xListener )
- {
- }
-
- public void removeKeyListener( XKeyListener xListener )
- {
- }
-
- public void addMouseListener( XMouseListener xListener )
- {
- }
-
- public void removeMouseListener( XMouseListener xListener )
- {
- }
-
- public void addMouseMotionListener( XMouseMotionListener xListener )
- {
- }
-
- public void removeMouseMotionListener( XMouseMotionListener xListener )
- {
- }
-
- public void addPaintListener( XPaintListener xListener )
- {
- }
-
- public void removePaintListener( XPaintListener xListener )
- {
- }
-}
diff --git a/canvas/source/java/java_Service.java b/canvas/source/java/java_Service.java
deleted file mode 100644
index 6fcaa1581ca8..000000000000
--- a/canvas/source/java/java_Service.java
+++ /dev/null
@@ -1,118 +0,0 @@
-
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.XComponentContext;
-import com.sun.star.awt.*;
-
-public class java_Service
- extends com.sun.star.lib.uno.helper.WeakBase
- implements com.sun.star.lang.XServiceInfo, foo.XBar
-{
- private XToolkit m_xToolkit;
- private XVclWindowPeer m_xPeer;
- private javax.swing.JFrame m_frame;
-
- public java_Service( XComponentContext xContext )
- {
- try
- {
- m_xToolkit =
- (XToolkit) UnoRuntime.queryInterface(
- XToolkit.class,
- xContext.getServiceManager().createInstanceWithContext(
- "com.sun.star.awt.Toolkit", xContext ) );
- }
- catch (com.sun.star.uno.Exception exc)
- {
- throw new com.sun.star.uno.RuntimeException(
- "exception occured gettin toolkit: " + exc, this );
- }
- }
-
- // XBar impl
- public void raiseAndCloseWindows( foo.XBar [] seq )
- throws com.sun.star.uno.Exception
- {
- for ( int nPos = 0; nPos < seq.length; ++nPos )
- seq[ nPos ].raiseWindows( "called by Java code" );
-
- // modal dialog before closing
- javax.swing.JOptionPane.showMessageDialog(
- null, "[Java] all windows created." );
-
- for ( int nPos = 0; nPos < seq.length; ++nPos )
- seq[ nPos ].closeWindows();
- }
-
- public void raiseWindows( String msg )
- throws com.sun.star.uno.Exception
- {
- // create java frame
- m_frame = new javax.swing.JFrame(
- "[java frame created by Java code] " + msg );
- m_frame.setSize( 500, 50 );
- m_frame.setLocation( 200, 500 );
- m_frame.setVisible( true );
-
- // create office workwindow
- m_xPeer = (XVclWindowPeer) UnoRuntime.queryInterface(
- XVclWindowPeer.class,
- m_xToolkit.createWindow(
- new WindowDescriptor(
- WindowClass.TOP, "workwindow", null, (short) -1,
- new Rectangle( 800, 500, 500, 50 ),
- WindowAttribute.SHOW |
- WindowAttribute.BORDER |
- WindowAttribute.SIZEABLE |
- WindowAttribute.MOVEABLE |
- WindowAttribute.CLOSEABLE ) ) );
- m_xPeer.setProperty(
- "Title", "[office window created by Java code] " + msg );
- }
-
- public void closeWindows()
- throws com.sun.star.uno.Exception
- {
- m_frame.dispose();
- m_xPeer.dispose();
- }
-
-
- private static final String s_implName = "foo.java.impl";
- private static final String s_serviceName = "foo.java";
-
- // XServiceInfo impl
- public String getImplementationName()
- {
- return s_implName;
- }
-
- public String [] getSupportedServiceNames()
- {
- return new String [] { s_serviceName };
- }
-
- public boolean supportsService( String serviceName )
- {
- return serviceName.equals( s_serviceName );
- }
-
- public static com.sun.star.lang.XSingleServiceFactory __getServiceFactory(
- String implName,
- com.sun.star.lang.XMultiServiceFactory multiFactory,
- com.sun.star.registry.XRegistryKey regKey )
- {
- if (implName.equals( s_implName ))
- {
- return com.sun.star.comp.loader.FactoryHelper.getServiceFactory(
- java_Service.class, s_serviceName, multiFactory, regKey );
- }
- return null;
- }
-
- public static boolean __writeRegistryServiceInfo(
- com.sun.star.registry.XRegistryKey regKey )
- {
- return com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo(
- s_implName, s_serviceName, regKey );
- }
-}
diff --git a/canvas/source/java/makefile.mk b/canvas/source/java/makefile.mk
deleted file mode 100644
index 86f329e4fe3b..000000000000
--- a/canvas/source/java/makefile.mk
+++ /dev/null
@@ -1,93 +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.
-#
-#*************************************************************************
-
-# Builds the Java Canvas implementation.
-
-PRJNAME = canvas
-PRJ = ..$/..
-TARGET = javacanvas
-PACKAGE = canvas
-
-USE_JAVAVER:=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE: settings.mk
-
-.IF "$(SOLAR_JAVA)"=="TRUE"
-# Since Canvas needs newer features like
-# e.g. java.awt.image.BufferStrategy,
-# disabled for now for everything <1.4
-.IF "$(JAVANUMVER:s/.//)" >= "000100040000"
-
-JAVAFILES = \
- SpriteBase.java \
- JavaCanvas.java \
- CanvasGraphicDevice.java \
- CanvasUtils.java \
- CanvasFont.java \
- CanvasBitmap.java \
- CanvasSprite.java \
- CanvasCustomSprite.java \
- CanvasClonedSprite.java \
- TextLayout.java \
- BackBuffer.java \
- LinePolyPolygon.java \
- BezierPolyPolygon.java \
- SpriteRunner.java
-
-.IF "$(GUIBASE)"=="unx"
-
-JAVAFILES += x11/WindowAdapter.java
-
-.ELIF "$(GUIBASE)"=="aqua"
-
-JAVAFILES += aqua/WindowAdapter.java
-
-.ELSE
-
-JAVAFILES += win/WindowAdapter.java
-
-.ENDIF # "$(GUIBASE)"=="unx"
-
-JARFILES = jurt.jar unoil.jar ridl.jar juh.jar java_uno.jar
-#JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
-
-JARTARGET = $(TARGET).uno.jar
-JARCOMPRESS = TRUE
-#JARCLASSDIRS = $(PACKAGE)
-CUSTOMMANIFESTFILE = manifest
-
-.ENDIF # "$(JAVANUMVER:s/.//)" >= "000100040000"
-.ENDIF # "$(SOLAR_JAVA)"=="TRUE"
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE: target.mk
-
-#dist: $(JAVA_FILES:b:+".class")
-# +jar -cvfm $(CLASSDIR)/JavaCanvas.jar $(JARMANIFEST) $(JAVACLASSFILES)
diff --git a/canvas/source/java/manifest b/canvas/source/java/manifest
deleted file mode 100644
index 6ddc3ab0ae51..000000000000
--- a/canvas/source/java/manifest
+++ /dev/null
@@ -1 +0,0 @@
-RegistrationClassName: JavaCanvas
diff --git a/canvas/source/java/perftest/PerfTest.java b/canvas/source/java/perftest/PerfTest.java
deleted file mode 100644
index 98e3cc5c3de5..000000000000
--- a/canvas/source/java/perftest/PerfTest.java
+++ /dev/null
@@ -1,314 +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.
- *
- ************************************************************************/
-
-import java.awt.*;
-import java.awt.image.*;
-import java.awt.geom.*;
-
-
-public class PerfTest
-{
- // the frame object we're generating. TODO: Remove public access.
- private Frame frame;
- private boolean fullscreen;
-
- public PerfTest()
- {
- fullscreen = false;
-
- // create a normal Java frame, and set it into fullscreen mode
- frame = new javax.swing.JFrame( "PerformanceTest" );
- frame.setBounds( new Rectangle(0,0,1600,1200) );
- frame.setUndecorated( true );
- frame.setVisible( true );
-
- Graphics2D graphics = (Graphics2D)frame.getGraphics();
- if( graphics.getDeviceConfiguration().getDevice().isFullScreenSupported() )
- {
- System.err.println( "entering fullscreen mode" );
- graphics.getDeviceConfiguration().getDevice().setFullScreenWindow( frame );
- fullscreen = true;
- }
- else
- {
- System.err.println( "fullscreen not supported" );
- }
-
- graphics.dispose();
- }
-
- //----------------------------------------------------------------------------------
-
- public void dispose()
- {
- if( fullscreen )
- {
- Graphics2D graphics = (Graphics2D)frame.getGraphics();
- if( graphics.getDeviceConfiguration().getDevice().isFullScreenSupported() )
- {
- System.err.println( "leaving fullscreen mode" );
- graphics.getDeviceConfiguration().getDevice().setFullScreenWindow( null );
- }
- graphics.dispose();
- }
-
- if( frame != null )
- frame.dispose();
- }
-
- //----------------------------------------------------------------------------------
-
- public static void initGraphics( Graphics2D graphics )
- {
- if( graphics != null )
- {
- RenderingHints hints = new RenderingHints(null);
- boolean hq = true;
-
- if( hq )
- {
- hints.add( new RenderingHints( RenderingHints.KEY_FRACTIONALMETRICS,
- RenderingHints.VALUE_FRACTIONALMETRICS_ON ) );
-// hints.add( new RenderingHints( RenderingHints.KEY_ALPHA_INTERPOLATION,
-// RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY) );
- hints.add( new RenderingHints( RenderingHints.KEY_ALPHA_INTERPOLATION,
- RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED) );
-// hints.add( new RenderingHints( RenderingHints.KEY_INTERPOLATION,
-// RenderingHints.VALUE_INTERPOLATION_BICUBIC) );
- hints.add( new RenderingHints( RenderingHints.KEY_INTERPOLATION,
- RenderingHints.VALUE_INTERPOLATION_BILINEAR) );
-// hints.add( new RenderingHints( RenderingHints.KEY_RENDERING,
-// RenderingHints.VALUE_RENDER_QUALITY) );
- hints.add( new RenderingHints( RenderingHints.KEY_RENDERING,
- RenderingHints.VALUE_RENDER_SPEED) );
-// hints.add( new RenderingHints( RenderingHints.KEY_STROKE_CONTROL,
-// RenderingHints.VALUE_STROKE_NORMALIZE) );
- hints.add( new RenderingHints( RenderingHints.KEY_STROKE_CONTROL,
- RenderingHints.VALUE_STROKE_DEFAULT) );
- hints.add( new RenderingHints( RenderingHints.KEY_ANTIALIASING,
- RenderingHints.VALUE_ANTIALIAS_ON) );
- }
- else
- {
- hints.add( new RenderingHints( RenderingHints.KEY_ALPHA_INTERPOLATION,
- RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED) );
- hints.add( new RenderingHints( RenderingHints.KEY_INTERPOLATION,
- RenderingHints.VALUE_INTERPOLATION_BILINEAR) );
- hints.add( new RenderingHints( RenderingHints.KEY_RENDERING,
- RenderingHints.VALUE_RENDER_SPEED) );
- hints.add( new RenderingHints( RenderingHints.KEY_STROKE_CONTROL,
- RenderingHints.VALUE_STROKE_DEFAULT) );
- hints.add( new RenderingHints( RenderingHints.KEY_ANTIALIASING,
- RenderingHints.VALUE_ANTIALIAS_OFF) );
- }
-
- // the least common denominator standard
- hints.add( new RenderingHints( RenderingHints.KEY_FRACTIONALMETRICS,
- RenderingHints.VALUE_FRACTIONALMETRICS_ON) );
- hints.add( new RenderingHints( RenderingHints.KEY_TEXT_ANTIALIASING,
- RenderingHints.VALUE_TEXT_ANTIALIAS_ON) );
-
- graphics.setRenderingHints( hints );
- }
- }
-
- public void run()
- {
- frame.createBufferStrategy(2);
- BufferStrategy bufferStrategy = frame.getBufferStrategy();
-
- if( bufferStrategy.getCapabilities().isPageFlipping() )
- System.err.println( "double buffering is using page flipping" );
- else
- System.err.println( "double buffering is using blitting" );
-
- int width = 1600;
- int height = 1200;
- Graphics2D graphics = (Graphics2D)frame.getGraphics();
- VolatileImage backBuffer = graphics.getDeviceConfiguration().createCompatibleVolatileImage(width,height); // TODO: size dynamic
- BufferedImage buffer = graphics.getDeviceConfiguration().createCompatibleImage(width,height,
- Transparency.TRANSLUCENT);
- BufferedImage buffer2 = graphics.getDeviceConfiguration().createCompatibleImage(width,height,
- Transparency.TRANSLUCENT);
- BufferedImage buffer3 = graphics.getDeviceConfiguration().createCompatibleImage(width,height,
- Transparency.TRANSLUCENT);
-
- GraphicsDevice device = graphics.getDeviceConfiguration().getDevice();
- System.err.println( "Images generated. Available vram: " + device.getAvailableAcceleratedMemory() );
-
- Graphics2D bufferGraphics = (Graphics2D)buffer.getGraphics();
- Graphics2D buffer2Graphics = (Graphics2D)buffer2.getGraphics();
- Graphics2D buffer3Graphics = (Graphics2D)buffer3.getGraphics();
- Graphics2D backBufGraphics = (Graphics2D)backBuffer.getGraphics();
-
- System.err.println( "Image graphics generated. Available vram: " + device.getAvailableAcceleratedMemory() );
-
- // init Graphics
- initGraphics( graphics );
- initGraphics( bufferGraphics );
- initGraphics( buffer2Graphics );
- initGraphics( backBufGraphics );
-
- // init content
- Font font = new Font( "Times", Font.PLAIN, 100 );
- Font fpsFont = new Font( "Times", Font.PLAIN, 20 );
-
- bufferGraphics.setComposite( AlphaComposite.getInstance(AlphaComposite.CLEAR));
- bufferGraphics.fillRect( 0,0,width,height );
-
- bufferGraphics.setComposite( AlphaComposite.getInstance(AlphaComposite.SRC_OVER));
- bufferGraphics.setColor( Color.red );
- bufferGraphics.fillRect( 0,0,width/2,height/2 );
- bufferGraphics.setColor( Color.green );
- bufferGraphics.fillRect( width/2,0,width,height/2 );
- bufferGraphics.setColor( Color.blue );
- bufferGraphics.fillRect( 0,height/2,width/2,height );
-
- buffer2Graphics.setColor( Color.red );
- buffer2Graphics.fillRect( 0,0,width/2,height/2 );
- buffer2Graphics.setColor( Color.green );
- buffer2Graphics.fillRect( width/2,0,width,height/2 );
- buffer2Graphics.setColor( Color.blue );
- buffer2Graphics.fillRect( 0,height/2,width/2,height );
-
- buffer3Graphics.setColor( Color.blue );
- buffer3Graphics.fillRect( 0,0,width/2,height/2 );
- buffer3Graphics.setColor( Color.white );
- buffer3Graphics.fillRect( width/2,0,width,height/2 );
- buffer3Graphics.setColor( Color.gray );
- buffer3Graphics.fillRect( 0,height/2,width/2,height );
-
- backBufGraphics.setColor( Color.white );
- backBufGraphics.fillRect(0,0,width,height);
- backBufGraphics.setColor( Color.red );
- backBufGraphics.setFont( font );
- int i, turns=15;
- for(i=0; i<turns; ++i)
- {
- backBufGraphics.drawString( "Crossfade test", width*i/turns, height*i/turns );
- }
-
- System.err.println( "Images filled with content. Available vram: " + device.getAvailableAcceleratedMemory() );
-
- long lastTime = System.currentTimeMillis();
- int turn, numTurns = 100;
- for(turn=0; turn<numTurns; ++turn)
- {
- // fetch the Graphics object to draw into (we're doing double
- // buffering here, the content is later shown via
- // bufferStrategy.show().
- Graphics2D graph = null;
-
- try
- {
- graph = (Graphics2D)bufferStrategy.getDrawGraphics();
-
- try
- {
- // repaint background
- graph.setComposite( AlphaComposite.getInstance(AlphaComposite.SRC_OVER) );
- graph.drawImage(backBuffer, 0, 0, null);
-
- // alpha-composite foreground on top of that
- float alpha = turn/(float)numTurns;
- graph.setComposite( AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha) );
-
- graph.drawImage(buffer, 0, 0, null);
- buffer.flush();
- graph.drawImage(buffer2, 100, 100, null);
- buffer2.flush();
-
- long currTime = System.currentTimeMillis();
- graph.setComposite( AlphaComposite.getInstance(AlphaComposite.SRC_OVER) );
- graph.setFont( fpsFont );
- graph.setColor( Color.black );
- String fps = new String( String.valueOf(1000.0/(currTime-lastTime)) );
- System.err.println( "Images composited. Framerate: " + fps + " fps" );
- graph.drawString( fps.substring(0,5) + " fps", 0, 20);
- lastTime = currTime;
-
- System.err.println( "Available vram: " + device.getAvailableAcceleratedMemory() );
- }
- catch( Exception e )
- {
- }
-
- System.err.println( "Turn: " + turn );
- }
- finally
- {
- if( graph != null )
- graph.dispose();
- }
-
- bufferStrategy.show();
- }
-
- try
- {
- Thread.sleep(2000);
- }
- catch( Exception e )
- {
- }
- }
-
- //----------------------------------------------------------------------------------
-
- public static void main(String[] args)
- {
- // now, we're getting slightly system dependent here.
- String os = (String) System.getProperty("os.name");
-
- System.err.println( "System detected: " + os );
-
- // tweak some speed knobs...
- if( os.startsWith("Windows") )
- {
- System.setProperty("sun.java2d.translaccel", "true");
- System.setProperty("sun.java2d.ddforcevram", "true");
- //System.setProperty("sun.java2d.accthreshold", "0");
-
- System.err.println( "Optimizing for Windows" );
- }
- else
- {
- System.setProperty("sun.java2d.opengl", "true");
-
- System.err.println( "Optimizing for Unix" );
- }
-
- PerfTest test = new PerfTest();
-
- test.run();
-
- test.dispose();
- }
-
- //----------------------------------------------------------------------------------
-
-}
diff --git a/canvas/source/java/perftest/WindowAdapter.java b/canvas/source/java/perftest/WindowAdapter.java
deleted file mode 100644
index fa34e6720fc7..000000000000
--- a/canvas/source/java/perftest/WindowAdapter.java
+++ /dev/null
@@ -1,197 +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.
- *
- ************************************************************************/
-
-import sun.awt.*;
-import com.sun.star.awt.*;
-
-
-public class WindowAdapter
-// defacto implementing the interface, but not deriving from it, since
-// we're no real XInterface here
-// implements com.sun.star.awt.XWindow
-{
- // the frame object we're generating. TODO: Remove public access.
- public java.awt.Frame frame;
- private boolean fullscreen;
-
- public WindowAdapter( int windowHandle,
- boolean _fullscreen )
- {
- CanvasUtils.printLog( "WindowAdapter(X11): constructor called" );
- fullscreen = false;
-
- if( _fullscreen )
- {
- // create a normal Java frame, and set it into fullscreen mode
- frame = new javax.swing.JFrame( "Presentation" );
- frame.setUndecorated( true );
- frame.setVisible( true );
-
- java.awt.Graphics2D graphics = (java.awt.Graphics2D)frame.getGraphics();
- if( graphics.getDeviceConfiguration().getDevice().isFullScreenSupported() )
- {
- CanvasUtils.printLog( "WindowAdapter(X11): entering fullscreen mode" );
- graphics.getDeviceConfiguration().getDevice().setFullScreenWindow( frame );
- fullscreen = true;
- }
- else
- {
- CanvasUtils.printLog( "WindowAdapter(X11): fullscreen not supported" );
- }
-
- graphics.dispose();
- }
- else
- {
- // we're initialized with the operating system window handle
- // as the parameter. We then generate a dummy Java frame with
- // that window as the parent, to fake a root window for the
- // Java implementation.
-
- // now, we're getting slightly system dependent here.
- String os = (String) System.getProperty("os.name");
-
- System.err.println("WindowAdapter created");
-
- // create the embedded frame
- if( os.startsWith("Linux") )
- {
- // create a java frame from that
- // TODO: Maybe that's the reason why we crash on Linux 1.5beta
- // immediately: Try XAWT here, or naked X: sun.awt.X11.XEmbeddedFrame
-
- //frame = new sun.awt.motif.MEmbeddedFrame( windowHandle );
- //frame = new sun.awt.X11.XEmbeddedFrame( windowHandle ); // cannot currently compile
- CanvasUtils.printLog( "WindowAdapter(X11): no frame created for now" );
- frame = null;
- }
- else
- {
- throw new com.sun.star.uno.RuntimeException();
- }
- }
- }
-
- //----------------------------------------------------------------------------------
-
- public void dispose()
- {
- if( fullscreen )
- {
- java.awt.Graphics2D graphics = (java.awt.Graphics2D)frame.getGraphics();
- if( graphics.getDeviceConfiguration().getDevice().isFullScreenSupported() )
- {
- CanvasUtils.printLog( "WindowAdapter(X11): leaving fullscreen mode" );
- graphics.getDeviceConfiguration().getDevice().setFullScreenWindow( null );
- }
- graphics.dispose();
- }
-
- if( frame != null )
- frame.dispose();
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XWindow interface
- // =================
- //
- public void setPosSize( int X, int Y, int Width, int Height, short Flags )
- {
- frame.setBounds( new java.awt.Rectangle( X, Y, Width, Height ) );
- }
-
- public com.sun.star.awt.Rectangle getPosSize( )
- {
- java.awt.Rectangle bounds = frame.getBounds();
-
- return new com.sun.star.awt.Rectangle( bounds.x, bounds.y, bounds.width, bounds.height );
- }
-
- public void setVisible( boolean visible )
- {
- frame.setVisible( visible );
- }
-
- public void setEnable( boolean enable )
- {
- frame.setEnabled( enable );
- }
-
- public void setFocus()
- {
- }
-
- public void addWindowListener( XWindowListener xListener )
- {
- }
-
- public void removeWindowListener( XWindowListener xListener )
- {
- }
-
- public void addFocusListener( XFocusListener xListener )
- {
- }
-
- public void removeFocusListener( XFocusListener xListener )
- {
- }
-
- public void addKeyListener( XKeyListener xListener )
- {
- }
-
- public void removeKeyListener( XKeyListener xListener )
- {
- }
-
- public void addMouseListener( XMouseListener xListener )
- {
- }
-
- public void removeMouseListener( XMouseListener xListener )
- {
- }
-
- public void addMouseMotionListener( XMouseMotionListener xListener )
- {
- }
-
- public void removeMouseMotionListener( XMouseMotionListener xListener )
- {
- }
-
- public void addPaintListener( XPaintListener xListener )
- {
- }
-
- public void removePaintListener( XPaintListener xListener )
- {
- }
-}
diff --git a/canvas/source/java/perftest/manifest b/canvas/source/java/perftest/manifest
deleted file mode 100644
index 805a87d47b57..000000000000
--- a/canvas/source/java/perftest/manifest
+++ /dev/null
@@ -1 +0,0 @@
-RegistrationClassName: PerfTest
diff --git a/canvas/source/java/win/WindowAdapter.java b/canvas/source/java/win/WindowAdapter.java
deleted file mode 100644
index 6cfe54db5991..000000000000
--- a/canvas/source/java/win/WindowAdapter.java
+++ /dev/null
@@ -1,199 +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.
- *
- ************************************************************************/
-
-// UNO
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.XComponentContext;
-import com.sun.star.uno.AnyConverter;
-import com.sun.star.lang.XInitialization;
-import com.sun.star.lib.uno.helper.WeakBase;
-
-// OOo AWT
-import com.sun.star.awt.*;
-
-// system-dependent stuff
-import sun.awt.*;
-
-
-public class WindowAdapter
-// defacto implementing the interface, but not deriving from it, since
-// we're no real XInterface here
-// implements com.sun.star.awt.XWindow
-{
- public java.awt.Frame frame;
- private boolean fullscreen;
-
- public WindowAdapter( int windowHandle,
- boolean _fullscreen )
- {
- fullscreen = false;
-
- if( _fullscreen )
- {
- // create a normal Java frame, and set it into fullscreen mode
- frame = new javax.swing.JFrame( "Presentation" );
- frame.setUndecorated( true );
- frame.setVisible( true );
-
- java.awt.Graphics2D graphics = (java.awt.Graphics2D)frame.getGraphics();
- if( graphics.getDeviceConfiguration().getDevice().isFullScreenSupported() )
- {
- CanvasUtils.printLog( "WindowAdapter(Win32): entering fullscreen mode" );
- graphics.getDeviceConfiguration().getDevice().setFullScreenWindow( frame );
- fullscreen = true;
- }
- else
- {
- CanvasUtils.printLog( "WindowAdapter(Win32): fullscreen not supported" );
- }
-
- graphics.dispose();
- }
- else
- {
- // we're initialized with the operating system window handle
- // as the parameter. We then generate a dummy Java frame with
- // that window as the parent, to fake a root window for the
- // Java implementation.
-
- // now, we're getting slightly system dependent here.
- String os = (String) System.getProperty("os.name");
-
- // create the embedded frame
- if( os.startsWith("Windows") )
- frame = new sun.awt.windows.WEmbeddedFrame( windowHandle );
- else
- throw new com.sun.star.uno.RuntimeException();
-
-
-// frame = new javax.swing.JFrame( "Test window" );
-
-// // resize it according to the given bounds
-// frame.setBounds( boundRect );
-// frame.setVisible( true );
- }
- }
-
- //----------------------------------------------------------------------------------
-
- public void dispose()
- {
- if( fullscreen )
- {
- java.awt.Graphics2D graphics = (java.awt.Graphics2D)frame.getGraphics();
- if( graphics.getDeviceConfiguration().getDevice().isFullScreenSupported() )
- {
- CanvasUtils.printLog( "WindowAdapter(Win32): leaving fullscreen mode" );
- graphics.getDeviceConfiguration().getDevice().setFullScreenWindow( null );
- }
- graphics.dispose();
- }
-
- if( frame != null )
- frame.dispose();
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XWindow interface
- // =================
- //
- public void setPosSize( int X, int Y, int Width, int Height, short Flags )
- {
- frame.setBounds( new java.awt.Rectangle( X, Y, Width, Height ) );
- }
-
- public com.sun.star.awt.Rectangle getPosSize( )
- {
- java.awt.Rectangle bounds = frame.getBounds();
-
- return new com.sun.star.awt.Rectangle( bounds.x, bounds.y, bounds.width, bounds.height );
- }
-
- public void setVisible( boolean visible )
- {
- frame.setVisible( visible );
- }
-
- public void setEnable( boolean enable )
- {
- frame.setEnabled( enable );
- }
-
- public void setFocus()
- {
- }
-
- public void addWindowListener( XWindowListener xListener )
- {
- }
-
- public void removeWindowListener( XWindowListener xListener )
- {
- }
-
- public void addFocusListener( XFocusListener xListener )
- {
- }
-
- public void removeFocusListener( XFocusListener xListener )
- {
- }
-
- public void addKeyListener( XKeyListener xListener )
- {
- }
-
- public void removeKeyListener( XKeyListener xListener )
- {
- }
-
- public void addMouseListener( XMouseListener xListener )
- {
- }
-
- public void removeMouseListener( XMouseListener xListener )
- {
- }
-
- public void addMouseMotionListener( XMouseMotionListener xListener )
- {
- }
-
- public void removeMouseMotionListener( XMouseMotionListener xListener )
- {
- }
-
- public void addPaintListener( XPaintListener xListener )
- {
- }
-
- public void removePaintListener( XPaintListener xListener )
- {
- }
-}
diff --git a/canvas/source/java/x11/WindowAdapter.java b/canvas/source/java/x11/WindowAdapter.java
deleted file mode 100644
index 555f6c8ca1b8..000000000000
--- a/canvas/source/java/x11/WindowAdapter.java
+++ /dev/null
@@ -1,197 +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.
- *
- ************************************************************************/
-
-import com.sun.star.awt.*;
-
-
-public class WindowAdapter
-// defacto implementing the interface, but not deriving from it, since
-// we're no real XInterface here
-// implements com.sun.star.awt.XWindow
-{
- // the frame object we're generating. TODO: Remove public access.
- public java.awt.Frame frame;
- private boolean fullscreen;
-
- public WindowAdapter( int windowHandle,
- boolean _fullscreen )
- {
- CanvasUtils.printLog( "WindowAdapter(X11): constructor called" );
- fullscreen = false;
-
- if( _fullscreen )
- {
- // create a normal Java frame, and set it into fullscreen mode
- frame = new javax.swing.JFrame( "Presentation" );
- frame.setUndecorated( true );
- frame.setVisible( true );
-
- java.awt.Graphics2D graphics = (java.awt.Graphics2D)frame.getGraphics();
- if( graphics.getDeviceConfiguration().getDevice().isFullScreenSupported() )
- {
- CanvasUtils.printLog( "WindowAdapter(X11): entering fullscreen mode" );
- graphics.getDeviceConfiguration().getDevice().setFullScreenWindow( frame );
- fullscreen = true;
- }
- else
- {
- CanvasUtils.printLog( "WindowAdapter(X11): fullscreen not supported" );
- }
-
- graphics.dispose();
- }
- else
- {
- // we're initialized with the operating system window handle
- // as the parameter. We then generate a dummy Java frame with
- // that window as the parent, to fake a root window for the
- // Java implementation.
-
- // now, we're getting slightly system dependent here.
- String os = (String) System.getProperty("os.name");
-
- System.err.println("WindowAdapter created");
-
- // create the embedded frame
- if( os.startsWith("Linux") )
- {
- // create a java frame from that
- // TODO: Maybe that's the reason why we crash on Linux 1.5beta
- // immediately: Try XAWT here, or naked X: sun.awt.X11.XEmbeddedFrame
-
- // TODO
- //frame = new sun.awt.motif.MEmbeddedFrame( windowHandle ); // Crashes 1.5, because class is unknown
- //frame = new sun.awt.X11.XEmbeddedFrame( windowHandle ); // cannot currently compile, because class is not in 1.4.
- CanvasUtils.printLog( "WindowAdapter(X11): no frame created for now" );
- frame = null; // disabled for now
- }
- else
- {
- throw new com.sun.star.uno.RuntimeException();
- }
- }
- }
-
- //----------------------------------------------------------------------------------
-
- public void dispose()
- {
- if( fullscreen )
- {
- java.awt.Graphics2D graphics = (java.awt.Graphics2D)frame.getGraphics();
- if( graphics.getDeviceConfiguration().getDevice().isFullScreenSupported() )
- {
- CanvasUtils.printLog( "WindowAdapter(X11): leaving fullscreen mode" );
- graphics.getDeviceConfiguration().getDevice().setFullScreenWindow( null );
- }
- graphics.dispose();
- }
-
- if( frame != null )
- frame.dispose();
- }
-
- //----------------------------------------------------------------------------------
-
- //
- // XWindow interface
- // =================
- //
- public void setPosSize( int X, int Y, int Width, int Height, short Flags )
- {
- frame.setBounds( new java.awt.Rectangle( X, Y, Width, Height ) );
- }
-
- public com.sun.star.awt.Rectangle getPosSize( )
- {
- java.awt.Rectangle bounds = frame.getBounds();
-
- return new com.sun.star.awt.Rectangle( bounds.x, bounds.y, bounds.width, bounds.height );
- }
-
- public void setVisible( boolean visible )
- {
- frame.setVisible( visible );
- }
-
- public void setEnable( boolean enable )
- {
- frame.setEnabled( enable );
- }
-
- public void setFocus()
- {
- }
-
- public void addWindowListener( XWindowListener xListener )
- {
- }
-
- public void removeWindowListener( XWindowListener xListener )
- {
- }
-
- public void addFocusListener( XFocusListener xListener )
- {
- }
-
- public void removeFocusListener( XFocusListener xListener )
- {
- }
-
- public void addKeyListener( XKeyListener xListener )
- {
- }
-
- public void removeKeyListener( XKeyListener xListener )
- {
- }
-
- public void addMouseListener( XMouseListener xListener )
- {
- }
-
- public void removeMouseListener( XMouseListener xListener )
- {
- }
-
- public void addMouseMotionListener( XMouseMotionListener xListener )
- {
- }
-
- public void removeMouseMotionListener( XMouseMotionListener xListener )
- {
- }
-
- public void addPaintListener( XPaintListener xListener )
- {
- }
-
- public void removePaintListener( XPaintListener xListener )
- {
- }
-}
diff --git a/canvas/source/null/exports.map b/canvas/source/null/exports.map
deleted file mode 100644
index 4101b0d761a9..000000000000
--- a/canvas/source/null/exports.map
+++ /dev/null
@@ -1,8 +0,0 @@
-CAN_1_0 {
- global:
- component_getImplementationEnvironment;
- component_writeInfo;
- component_getFactory;
- local:
- *;
-};
diff --git a/canvas/source/null/makefile.mk b/canvas/source/null/makefile.mk
index 98bf2c5c9b71..07971ef8153e 100644
--- a/canvas/source/null/makefile.mk
+++ b/canvas/source/null/makefile.mk
@@ -60,7 +60,7 @@ SHL1IMPLIB=i$(TARGET)
SHL1LIBS=$(SLB)$/$(TARGET).lib
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
-SHL1VERSIONMAP=exports.map
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
DEF1NAME=$(SHL1TARGET)
DEF1EXPORTFILE=exports.dxp
diff --git a/canvas/source/null/null_spritecanvas.hxx b/canvas/source/null/null_spritecanvas.hxx
index 662897a3df10..136e09a291db 100644
--- a/canvas/source/null/null_spritecanvas.hxx
+++ b/canvas/source/null/null_spritecanvas.hxx
@@ -38,7 +38,7 @@
#include <com/sun/star/rendering/XIntegerBitmap.hpp>
#include <com/sun/star/rendering/XGraphicDevice.hpp>
#include <com/sun/star/rendering/XBufferController.hpp>
-#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <cppuhelper/compbase8.hxx>
#include <comphelper/uno3.hxx>
@@ -57,7 +57,7 @@ namespace nullcanvas
typedef ::cppu::WeakComponentImplHelper8< ::com::sun::star::rendering::XSpriteCanvas,
::com::sun::star::rendering::XIntegerBitmap,
::com::sun::star::rendering::XGraphicDevice,
- ::com::sun::star::rendering::XParametricPolyPolygon2DFactory,
+ ::com::sun::star::lang::XMultiServiceFactory,
::com::sun::star::rendering::XBufferController,
::com::sun::star::awt::XWindowListener,
::com::sun::star::beans::XPropertySet,
diff --git a/canvas/source/simplecanvas/exports.map b/canvas/source/simplecanvas/exports.map
deleted file mode 100644
index 4101b0d761a9..000000000000
--- a/canvas/source/simplecanvas/exports.map
+++ /dev/null
@@ -1,8 +0,0 @@
-CAN_1_0 {
- global:
- component_getImplementationEnvironment;
- component_writeInfo;
- component_getFactory;
- local:
- *;
-};
diff --git a/canvas/source/simplecanvas/makefile.mk b/canvas/source/simplecanvas/makefile.mk
index dc99c0a9bbc9..4d5a7e7bb3a1 100644
--- a/canvas/source/simplecanvas/makefile.mk
+++ b/canvas/source/simplecanvas/makefile.mk
@@ -52,7 +52,7 @@ SHL1IMPLIB=i$(TARGET)
SHL1LIBS=$(SLB)$/$(TARGET).lib
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
-SHL1VERSIONMAP=exports.map
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
DEF1NAME=$(SHL1TARGET)
DEF1EXPORTFILE=exports.dxp
diff --git a/canvas/source/tools/canvastools.cxx b/canvas/source/tools/canvastools.cxx
index 7ce8d02038b9..ad833cc3ca40 100644..100755
--- a/canvas/source/tools/canvastools.cxx
+++ b/canvas/source/tools/canvastools.cxx
@@ -991,6 +991,54 @@ namespace canvas
return aPolyPoly;
}
+ int calcGradientStepCount( ::basegfx::B2DHomMatrix& rTotalTransform,
+ const rendering::ViewState& viewState,
+ const rendering::RenderState& renderState,
+ const rendering::Texture& texture,
+ int nColorSteps )
+ {
+ // calculate overall texture transformation (directly from
+ // texture to device space).
+ ::basegfx::B2DHomMatrix aMatrix;
+
+ rTotalTransform.identity();
+ ::basegfx::unotools::homMatrixFromAffineMatrix( rTotalTransform,
+ texture.AffineTransform );
+ ::canvas::tools::mergeViewAndRenderTransform(aMatrix,
+ viewState,
+ renderState);
+ rTotalTransform *= aMatrix; // prepend total view/render transformation
+
+ // determine size of gradient in device coordinate system
+ // (to e.g. determine sensible number of gradient steps)
+ ::basegfx::B2DPoint aLeftTop( 0.0, 0.0 );
+ ::basegfx::B2DPoint aLeftBottom( 0.0, 1.0 );
+ ::basegfx::B2DPoint aRightTop( 1.0, 0.0 );
+ ::basegfx::B2DPoint aRightBottom( 1.0, 1.0 );
+
+ aLeftTop *= rTotalTransform;
+ aLeftBottom *= rTotalTransform;
+ aRightTop *= rTotalTransform;
+ aRightBottom*= rTotalTransform;
+
+ // longest line in gradient bound rect
+ const int nGradientSize(
+ static_cast<int>(
+ ::std::max(
+ ::basegfx::B2DVector(aRightBottom-aLeftTop).getLength(),
+ ::basegfx::B2DVector(aRightTop-aLeftBottom).getLength() ) + 1.0 ) );
+
+ // typical number for pixel of the same color (strip size)
+ const int nStripSize( nGradientSize < 50 ? 2 : 4 );
+
+ // use at least three steps, and at utmost the number of color
+ // steps
+ return ::std::max( 3,
+ ::std::min(
+ nGradientSize / nStripSize,
+ nColorSteps ) );
+ }
+
} // namespace tools
} // namespace canvas
diff --git a/canvas/source/tools/image.cxx b/canvas/source/tools/image.cxx
index 2b7d38abc8ea..b6183e463e99 100644
--- a/canvas/source/tools/image.cxx
+++ b/canvas/source/tools/image.cxx
@@ -1512,7 +1512,7 @@ void Image::fillGradientImpl( const ParametricPolyPolygon::Values& rValues,
typedef color_generator_adaptor<color_type> color_generator_type;
unsigned int dwNumSteps = static_cast<unsigned int>(rBounds.getWidth());
color_generator_type colors(color1,color2,dwNumSteps);
- colors.set_linear(rValues.meType != ParametricPolyPolygon::GRADIENT_AXIAL);
+ colors.set_linear(true);
// color = f(x,y)
gradient_polymorphic_wrapper<agg::gradient_x> gf_x;
diff --git a/canvas/source/tools/parametricpolypolygon.cxx b/canvas/source/tools/parametricpolypolygon.cxx
index db449f6c15f8..368f04a572e3 100644
--- a/canvas/source/tools/parametricpolypolygon.cxx
+++ b/canvas/source/tools/parametricpolypolygon.cxx
@@ -50,68 +50,126 @@ using namespace ::com::sun::star;
namespace canvas
{
- ParametricPolyPolygon* ParametricPolyPolygon::createLinearHorizontalGradient(
- const uno::Reference< rendering::XGraphicDevice >& rDevice,
- const uno::Sequence< uno::Sequence< double > >& colors,
- const uno::Sequence< double >& stops )
+ uno::Sequence<rtl::OUString> ParametricPolyPolygon::getAvailableServiceNames()
{
- // TODO(P2): hold gradient brush statically, and only setup
- // the colors
- return new ParametricPolyPolygon( rDevice, GRADIENT_LINEAR, colors, stops );
+ uno::Sequence<rtl::OUString> aRet(3);
+ aRet[0] = rtl::OUString::createFromAscii("LinearGradient");
+ aRet[1] = rtl::OUString::createFromAscii("EllipticalGradient");
+ aRet[2] = rtl::OUString::createFromAscii("RectangularGradient");
+
+ return aRet;
+ }
+
+ ParametricPolyPolygon* ParametricPolyPolygon::create(
+ const uno::Reference< rendering::XGraphicDevice >& rDevice,
+ const ::rtl::OUString& rServiceName,
+ const uno::Sequence< uno::Any >& rArgs )
+ {
+ uno::Sequence< uno::Sequence< double > > colorSequence(2);
+ uno::Sequence< double > colorStops(2);
+ double fAspectRatio=1.0;
+
+ // defaults
+ uno::Sequence< rendering::RGBColor > rgbColors(1);
+ rgbColors[0] = rendering::RGBColor(0,0,0);
+ colorSequence[0] = rDevice->getDeviceColorSpace()->convertFromRGB(rgbColors);
+ rgbColors[0] = rendering::RGBColor(1,1,1);
+ colorSequence[1] = rDevice->getDeviceColorSpace()->convertFromRGB(rgbColors);
+ colorStops[0] = 0;
+ colorStops[1] = 1;
+
+ // extract args
+ for( sal_Int32 i=0; i<rArgs.getLength(); ++i )
+ {
+ beans::PropertyValue aProp;
+ if( (rArgs[i] >>= aProp) )
+ {
+ if( aProp.Name.equalsAscii("Colors") )
+ {
+ aProp.Value >>= colorSequence;
+ }
+ else if( aProp.Name.equalsAscii("Stops") )
+ {
+ aProp.Value >>= colorStops;
+ }
+ else if( aProp.Name.equalsAscii("AspectRatio") )
+ {
+ aProp.Value >>= fAspectRatio;
+ }
+ }
+ }
+
+ if( rServiceName.equalsAscii("LinearGradient") )
+ {
+ return createLinearHorizontalGradient(rDevice, colorSequence, colorStops);
+ }
+ else if( rServiceName.equalsAscii("EllipticalGradient") )
+ {
+ return createEllipticalGradient(rDevice, colorSequence, colorStops, fAspectRatio);
+ }
+ else if( rServiceName.equalsAscii("RectangularGradient") )
+ {
+ return createRectangularGradient(rDevice, colorSequence, colorStops, fAspectRatio);
+ }
+ else if( rServiceName.equalsAscii("VerticalLineHatch") )
+ {
+ // TODO: NYI
+ }
+ else if( rServiceName.equalsAscii("OrthogonalLinesHatch") )
+ {
+ // TODO: NYI
+ }
+ else if( rServiceName.equalsAscii("ThreeCrossingLinesHatch") )
+ {
+ // TODO: NYI
+ }
+ else if( rServiceName.equalsAscii("FourCrossingLinesHatch") )
+ {
+ // TODO: NYI
+ }
+
+ return NULL;
}
- ParametricPolyPolygon* ParametricPolyPolygon::createAxialHorizontalGradient(
+ ParametricPolyPolygon* ParametricPolyPolygon::createLinearHorizontalGradient(
const uno::Reference< rendering::XGraphicDevice >& rDevice,
const uno::Sequence< uno::Sequence< double > >& colors,
const uno::Sequence< double >& stops )
{
// TODO(P2): hold gradient brush statically, and only setup
// the colors
- return new ParametricPolyPolygon( rDevice, GRADIENT_AXIAL, colors, stops );
- }
-
- namespace
- {
- double calcAspectRatio( const geometry::RealRectangle2D& rBoundRect )
- {
- const double nWidth( rBoundRect.X2 - rBoundRect.X1 );
- const double nHeight( rBoundRect.Y2 - rBoundRect.Y1 );
-
- return ::basegfx::fTools::equalZero( nHeight ) ? 1.0 : fabs( nWidth / nHeight );
- }
+ return new ParametricPolyPolygon( rDevice, GRADIENT_LINEAR, colors, stops );
}
ParametricPolyPolygon* ParametricPolyPolygon::createEllipticalGradient(
const uno::Reference< rendering::XGraphicDevice >& rDevice,
const uno::Sequence< uno::Sequence< double > >& colors,
const uno::Sequence< double >& stops,
- const geometry::RealRectangle2D& boundRect )
+ double fAspectRatio )
{
// TODO(P2): hold gradient polygon statically, and only setup
// the colors
return new ParametricPolyPolygon(
rDevice,
::basegfx::tools::createPolygonFromCircle(
- ::basegfx::B2DPoint( 0.5, 0.5), 0.5 ),
+ ::basegfx::B2DPoint(0,0), 1 ),
GRADIENT_ELLIPTICAL,
- colors, stops,
- calcAspectRatio( boundRect ) );
+ colors, stops, fAspectRatio );
}
ParametricPolyPolygon* ParametricPolyPolygon::createRectangularGradient( const uno::Reference< rendering::XGraphicDevice >& rDevice,
const uno::Sequence< uno::Sequence< double > >& colors,
const uno::Sequence< double >& stops,
- const geometry::RealRectangle2D& boundRect )
+ double fAspectRatio )
{
// TODO(P2): hold gradient polygon statically, and only setup
// the colors
return new ParametricPolyPolygon(
rDevice,
::basegfx::tools::createPolygonFromRect(
- ::basegfx::B2DRectangle( 0.0, 0.0, 1.0, 1.0 ) ),
+ ::basegfx::B2DRectangle( -1, -1, 1, 1 ) ),
GRADIENT_RECTANGULAR,
- colors, stops,
- calcAspectRatio( boundRect ) );
+ colors, stops, fAspectRatio );
}
void SAL_CALL ParametricPolyPolygon::disposing()
diff --git a/canvas/source/tools/verifyinput.cxx b/canvas/source/tools/verifyinput.cxx
index c2ee4ed968a0..42ab1c7aee19 100644
--- a/canvas/source/tools/verifyinput.cxx
+++ b/canvas/source/tools/verifyinput.cxx
@@ -426,7 +426,7 @@ namespace canvas
#endif
}
- if( texture.RepeatModeX < rendering::TexturingMode::CLAMP ||
+ if( texture.RepeatModeX < rendering::TexturingMode::NONE ||
texture.RepeatModeX > rendering::TexturingMode::REPEAT )
{
#if OSL_DEBUG_LEVEL > 0
@@ -442,7 +442,7 @@ namespace canvas
#endif
}
- if( texture.RepeatModeY < rendering::TexturingMode::CLAMP ||
+ if( texture.RepeatModeY < rendering::TexturingMode::NONE ||
texture.RepeatModeY > rendering::TexturingMode::REPEAT )
{
#if OSL_DEBUG_LEVEL > 0
diff --git a/canvas/source/vcl/canvas.hxx b/canvas/source/vcl/canvas.hxx
index f7667d8f2c19..adda8d8eea40 100644
--- a/canvas/source/vcl/canvas.hxx
+++ b/canvas/source/vcl/canvas.hxx
@@ -38,7 +38,6 @@
#include <com/sun/star/rendering/XIntegerBitmap.hpp>
#include <com/sun/star/rendering/XGraphicDevice.hpp>
#include <com/sun/star/rendering/XBufferController.hpp>
-#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
#include <cppuhelper/compbase7.hxx>
#include <comphelper/uno3.hxx>
@@ -60,7 +59,7 @@ namespace vclcanvas
typedef ::cppu::WeakComponentImplHelper7< ::com::sun::star::rendering::XBitmapCanvas,
::com::sun::star::rendering::XIntegerBitmap,
::com::sun::star::rendering::XGraphicDevice,
- ::com::sun::star::rendering::XParametricPolyPolygon2DFactory,
+ ::com::sun::star::lang::XMultiServiceFactory,
::com::sun::star::util::XUpdatable,
::com::sun::star::beans::XPropertySet,
::com::sun::star::lang::XServiceName > GraphicDeviceBase_Base;
diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx
index 11350c0b4f9f..023ceb2b5005 100644..100755
--- a/canvas/source/vcl/canvashelper_texturefill.cxx
+++ b/canvas/source/vcl/canvashelper_texturefill.cxx
@@ -54,6 +54,8 @@
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/polygon/b2dlinegeometry.hxx>
#include <basegfx/tools/tools.hxx>
+#include <basegfx/tools/lerp.hxx>
+#include <basegfx/tools/keystoplerp.hxx>
#include <basegfx/tools/canvastools.hxx>
#include <basegfx/numeric/ftools.hxx>
@@ -62,6 +64,9 @@
#include <canvas/canvastools.hxx>
#include <canvas/parametricpolypolygon.hxx>
+#include <boost/bind.hpp>
+#include <boost/tuple/tuple.hpp>
+
#include "spritecanvas.hxx"
#include "canvashelper.hxx"
#include "impltools.hxx"
@@ -115,17 +120,13 @@ namespace vclcanvas
Since most of the code for linear and axial gradients are
the same, we've a unified method here
*/
- void fillGeneralLinearGradient( OutputDevice& rOutDev,
- const ::basegfx::B2DHomMatrix& rTextureTransform,
- const ::Rectangle& rBounds,
- int nStepCount,
- const ::Color& rColor1,
- const ::Color& rColor2,
- bool bFillNonOverlapping,
- bool bAxialGradient )
+ void fillLinearGradient( OutputDevice& rOutDev,
+ const ::basegfx::B2DHomMatrix& rTextureTransform,
+ const ::Rectangle& rBounds,
+ unsigned int nStepCount,
+ const ::canvas::ParametricPolyPolygon::Values& rValues,
+ const std::vector< ::Color >& rColors )
{
- (void)bFillNonOverlapping;
-
// determine general position of gradient in relation to
// the bound rect
// =====================================================
@@ -204,36 +205,26 @@ namespace vclcanvas
// iteratively render all other strips
// -----------------------------------
- // ensure that nStepCount is odd, to have a well-defined
- // middle index for axial gradients.
- if( bAxialGradient && !(nStepCount % 2) )
+ // ensure that nStepCount matches color stop parity, to
+ // have a well-defined middle color e.g. for axial
+ // gradients.
+ if( (rColors.size() % 2) != (nStepCount % 2) )
++nStepCount;
- const int nStepCountHalved( nStepCount / 2 );
+ basegfx::tools::KeyStopLerp aLerper(rValues.maStops);
// only iterate nStepCount-1 steps, as the last strip is
// explicitely painted below
- for( int i=0; i<nStepCount-1; ++i )
+ for( unsigned int i=0; i<nStepCount-1; ++i )
{
- // lerp color
- if( bAxialGradient )
- {
- // axial gradient has a triangle-like interpolation function
- const int iPrime( i<=nStepCountHalved ? i : nStepCount-i-1);
+ std::ptrdiff_t nIndex;
+ double fAlpha;
+ boost::tuples::tie(nIndex,fAlpha)=aLerper.lerp(double(i)/nStepCount);
- rOutDev.SetFillColor(
- Color( (UINT8)(((nStepCountHalved - iPrime)*rColor1.GetRed() + iPrime*rColor2.GetRed())/nStepCountHalved),
- (UINT8)(((nStepCountHalved - iPrime)*rColor1.GetGreen() + iPrime*rColor2.GetGreen())/nStepCountHalved),
- (UINT8)(((nStepCountHalved - iPrime)*rColor1.GetBlue() + iPrime*rColor2.GetBlue())/nStepCountHalved) ) );
- }
- else
- {
- // linear gradient has a plain lerp between start and end color
- rOutDev.SetFillColor(
- Color( (UINT8)(((nStepCount - i)*rColor1.GetRed() + i*rColor2.GetRed())/nStepCount),
- (UINT8)(((nStepCount - i)*rColor1.GetGreen() + i*rColor2.GetGreen())/nStepCount),
- (UINT8)(((nStepCount - i)*rColor1.GetBlue() + i*rColor2.GetBlue())/nStepCount) ) );
- }
+ rOutDev.SetFillColor(
+ Color( (UINT8)(basegfx::tools::lerp(rColors[nIndex].GetRed(),rColors[nIndex+1].GetRed(),fAlpha)),
+ (UINT8)(basegfx::tools::lerp(rColors[nIndex].GetGreen(),rColors[nIndex+1].GetGreen(),fAlpha)),
+ (UINT8)(basegfx::tools::lerp(rColors[nIndex].GetBlue(),rColors[nIndex+1].GetBlue(),fAlpha)) ));
// copy right egde of polygon to left edge (and also
// copy the closing point)
@@ -280,59 +271,18 @@ namespace vclcanvas
aTempPoly[3] = ::Point( ::basegfx::fround( rPoint4.getX() ),
::basegfx::fround( rPoint4.getY() ) );
- if( bAxialGradient )
- rOutDev.SetFillColor( rColor1 );
- else
- rOutDev.SetFillColor( rColor2 );
+ rOutDev.SetFillColor( rColors.back() );
rOutDev.DrawPolygon( aTempPoly );
}
-
- inline void fillLinearGradient( OutputDevice& rOutDev,
- const ::Color& rColor1,
- const ::Color& rColor2,
- const ::basegfx::B2DHomMatrix& rTextureTransform,
- const ::Rectangle& rBounds,
- int nStepCount,
- bool bFillNonOverlapping )
- {
- fillGeneralLinearGradient( rOutDev,
- rTextureTransform,
- rBounds,
- nStepCount,
- rColor1,
- rColor2,
- bFillNonOverlapping,
- false );
- }
-
- inline void fillAxialGradient( OutputDevice& rOutDev,
- const ::Color& rColor1,
- const ::Color& rColor2,
- const ::basegfx::B2DHomMatrix& rTextureTransform,
- const ::Rectangle& rBounds,
- int nStepCount,
- bool bFillNonOverlapping )
- {
- fillGeneralLinearGradient( rOutDev,
- rTextureTransform,
- rBounds,
- nStepCount,
- rColor1,
- rColor2,
- bFillNonOverlapping,
- true );
- }
-
void fillPolygonalGradient( OutputDevice& rOutDev,
- const ::canvas::ParametricPolyPolygon::Values& rValues,
- const ::Color& rColor1,
- const ::Color& rColor2,
const ::basegfx::B2DHomMatrix& rTextureTransform,
const ::Rectangle& rBounds,
- int nStepCount,
- bool bFillNonOverlapping )
+ unsigned int nStepCount,
+ bool bFillNonOverlapping,
+ const ::canvas::ParametricPolyPolygon::Values& rValues,
+ const std::vector< ::Color >& rColors )
{
const ::basegfx::B2DPolygon& rGradientPoly( rValues.maGradientPoly );
@@ -366,9 +316,6 @@ namespace vclcanvas
// apply scaling (possibly anisotrophic) to inner polygon
// ------------------------------------------------------
- // move center of scaling to origin
- aInnerPolygonTransformMatrix.translate( -0.5, -0.5 );
-
// scale inner polygon according to aspect ratio: for
// wider-than-tall bounds (nAspectRatio > 1.0), the inner
// polygon, representing the gradient focus, must have
@@ -393,9 +340,6 @@ namespace vclcanvas
aInnerPolygonTransformMatrix.scale( 0.0, 0.0 );
}
- // move origin back to former center of polygon
- aInnerPolygonTransformMatrix.translate( 0.5, 0.5 );
-
// and finally, add texture transform to it.
aInnerPolygonTransformMatrix *= rTextureTransform;
@@ -403,8 +347,8 @@ namespace vclcanvas
aInnerPoly.transform( aInnerPolygonTransformMatrix );
- const sal_Int32 nNumPoints( aOuterPoly.count() );
- ::Polygon aTempPoly( static_cast<USHORT>(nNumPoints+1) );
+ const sal_uInt32 nNumPoints( aOuterPoly.count() );
+ ::Polygon aTempPoly( static_cast<USHORT>(nNumPoints+1) );
// increase number of steps by one: polygonal gradients have
// the outermost polygon rendered in rColor2, and the
@@ -422,37 +366,42 @@ namespace vclcanvas
// color).
++nStepCount;
+ basegfx::tools::KeyStopLerp aLerper(rValues.maStops);
+
if( !bFillNonOverlapping )
{
// fill background
- rOutDev.SetFillColor( rColor1 );
+ rOutDev.SetFillColor( rColors.front() );
rOutDev.DrawRect( rBounds );
// render polygon
// ==============
- for( int i=1,p; i<nStepCount; ++i )
+ for( unsigned int i=1,p; i<nStepCount; ++i )
{
+ const double fT( i/double(nStepCount) );
+
+ std::ptrdiff_t nIndex;
+ double fAlpha;
+ boost::tuples::tie(nIndex,fAlpha)=aLerper.lerp(fT);
+
// lerp color
rOutDev.SetFillColor(
- Color( (UINT8)(((nStepCount - i)*rColor1.GetRed() + i*rColor2.GetRed())/nStepCount),
- (UINT8)(((nStepCount - i)*rColor1.GetGreen() + i*rColor2.GetGreen())/nStepCount),
- (UINT8)(((nStepCount - i)*rColor1.GetBlue() + i*rColor2.GetBlue())/nStepCount) ) );
+ Color( (UINT8)(basegfx::tools::lerp(rColors[nIndex].GetRed(),rColors[nIndex+1].GetRed(),fAlpha)),
+ (UINT8)(basegfx::tools::lerp(rColors[nIndex].GetGreen(),rColors[nIndex+1].GetGreen(),fAlpha)),
+ (UINT8)(basegfx::tools::lerp(rColors[nIndex].GetBlue(),rColors[nIndex+1].GetBlue(),fAlpha)) ));
// scale and render polygon, by interpolating between
// outer and inner polygon.
- // calc interpolation parameter in [0,1] range
- const double nT( (nStepCount-i)/double(nStepCount) );
-
for( p=0; p<nNumPoints; ++p )
{
const ::basegfx::B2DPoint& rOuterPoint( aOuterPoly.getB2DPoint(p) );
const ::basegfx::B2DPoint& rInnerPoint( aInnerPoly.getB2DPoint(p) );
aTempPoly[(USHORT)p] = ::Point(
- basegfx::fround( (1.0-nT)*rInnerPoint.getX() + nT*rOuterPoint.getX() ),
- basegfx::fround( (1.0-nT)*rInnerPoint.getY() + nT*rOuterPoint.getY() ) );
+ basegfx::fround( fT*rInnerPoint.getX() + (1-fT)*rOuterPoint.getX() ),
+ basegfx::fround( fT*rInnerPoint.getY() + (1-fT)*rOuterPoint.getY() ) );
}
// close polygon explicitely
@@ -486,13 +435,19 @@ namespace vclcanvas
aTempPolyPoly.Insert( aTempPoly );
aTempPolyPoly.Insert( aTempPoly2 );
- for( int i=0,p; i<nStepCount; ++i )
+ for( unsigned int i=0,p; i<nStepCount; ++i )
{
+ const double fT( (i+1)/double(nStepCount) );
+
+ std::ptrdiff_t nIndex;
+ double fAlpha;
+ boost::tuples::tie(nIndex,fAlpha)=aLerper.lerp(fT);
+
// lerp color
rOutDev.SetFillColor(
- Color( (UINT8)(((nStepCount - i)*rColor1.GetRed() + i*rColor2.GetRed())/nStepCount),
- (UINT8)(((nStepCount - i)*rColor1.GetGreen() + i*rColor2.GetGreen())/nStepCount),
- (UINT8)(((nStepCount - i)*rColor1.GetBlue() + i*rColor2.GetBlue())/nStepCount) ) );
+ Color( (UINT8)(basegfx::tools::lerp(rColors[nIndex].GetRed(),rColors[nIndex+1].GetRed(),fAlpha)),
+ (UINT8)(basegfx::tools::lerp(rColors[nIndex].GetGreen(),rColors[nIndex+1].GetGreen(),fAlpha)),
+ (UINT8)(basegfx::tools::lerp(rColors[nIndex].GetBlue(),rColors[nIndex+1].GetBlue(),fAlpha)) ));
#if defined(VERBOSE) && OSL_DEBUG_LEVEL > 0
if( i && !(i % 10) )
@@ -503,17 +458,14 @@ namespace vclcanvas
// calculate the inner polygon, which is actually the
// start of the _next_ color strip. Thus, i+1
- // calc interpolation parameter in [0,1] range
- const double nT( (nStepCount-i-1)/double(nStepCount) );
-
for( p=0; p<nNumPoints; ++p )
{
const ::basegfx::B2DPoint& rOuterPoint( aOuterPoly.getB2DPoint(p) );
const ::basegfx::B2DPoint& rInnerPoint( aInnerPoly.getB2DPoint(p) );
aTempPoly[(USHORT)p] = ::Point(
- basegfx::fround( (1.0-nT)*rInnerPoint.getX() + nT*rOuterPoint.getX() ),
- basegfx::fround( (1.0-nT)*rInnerPoint.getY() + nT*rOuterPoint.getY() ) );
+ basegfx::fround( fT*rInnerPoint.getX() + (1-fT)*rOuterPoint.getX() ),
+ basegfx::fround( fT*rInnerPoint.getY() + (1-fT)*rOuterPoint.getY() ) );
}
// close polygon explicitely
@@ -546,46 +498,33 @@ namespace vclcanvas
void doGradientFill( OutputDevice& rOutDev,
const ::canvas::ParametricPolyPolygon::Values& rValues,
- const ::Color& rColor1,
- const ::Color& rColor2,
+ const std::vector< ::Color >& rColors,
const ::basegfx::B2DHomMatrix& rTextureTransform,
const ::Rectangle& rBounds,
- int nStepCount,
+ unsigned int nStepCount,
bool bFillNonOverlapping )
{
switch( rValues.meType )
{
case ::canvas::ParametricPolyPolygon::GRADIENT_LINEAR:
fillLinearGradient( rOutDev,
- rColor1,
- rColor2,
rTextureTransform,
rBounds,
nStepCount,
- bFillNonOverlapping );
- break;
-
- case ::canvas::ParametricPolyPolygon::GRADIENT_AXIAL:
- fillAxialGradient( rOutDev,
- rColor1,
- rColor2,
- rTextureTransform,
- rBounds,
- nStepCount,
- bFillNonOverlapping );
+ rValues,
+ rColors );
break;
case ::canvas::ParametricPolyPolygon::GRADIENT_ELLIPTICAL:
// FALLTHROUGH intended
case ::canvas::ParametricPolyPolygon::GRADIENT_RECTANGULAR:
fillPolygonalGradient( rOutDev,
- rValues,
- rColor1,
- rColor2,
rTextureTransform,
rBounds,
nStepCount,
- bFillNonOverlapping );
+ bFillNonOverlapping,
+ rValues,
+ rColors );
break;
default:
@@ -594,11 +533,19 @@ namespace vclcanvas
}
}
+ int numColorSteps( const ::Color& rColor1, const ::Color& rColor2 )
+ {
+ return ::std::max(
+ labs( rColor1.GetRed() - rColor2.GetRed() ),
+ ::std::max(
+ labs( rColor1.GetGreen() - rColor2.GetGreen() ),
+ labs( rColor1.GetBlue() - rColor2.GetBlue() ) ) );
+ }
+
bool gradientFill( OutputDevice& rOutDev,
OutputDevice* p2ndOutDev,
const ::canvas::ParametricPolyPolygon::Values& rValues,
- const ::Color& rColor1,
- const ::Color& rColor2,
+ const std::vector< ::Color >& rColors,
const PolyPolygon& rPoly,
const rendering::ViewState& viewState,
const rendering::RenderState& renderState,
@@ -612,65 +559,27 @@ namespace vclcanvas
// deadlocks, canvashelper calls this method with locked own
// mutex.
- // calculate overall texture transformation (directly from
- // texture to device space).
- ::basegfx::B2DHomMatrix aMatrix;
- ::basegfx::B2DHomMatrix aTextureTransform;
-
- ::basegfx::unotools::homMatrixFromAffineMatrix( aTextureTransform,
- texture.AffineTransform );
- ::canvas::tools::mergeViewAndRenderTransform(aMatrix,
- viewState,
- renderState);
- aTextureTransform *= aMatrix; // prepend total view/render transformation
-
- // determine maximal bound rect of gradient-filled polygon
- const ::Rectangle aPolygonDeviceRectOrig(
- rPoly.GetBoundRect() );
-
- // determine size of gradient in device coordinate system
- // (to e.g. determine sensible number of gradient steps)
- ::basegfx::B2DPoint aLeftTop( 0.0, 0.0 );
- ::basegfx::B2DPoint aLeftBottom( 0.0, 1.0 );
- ::basegfx::B2DPoint aRightTop( 1.0, 0.0 );
- ::basegfx::B2DPoint aRightBottom( 1.0, 1.0 );
-
- aLeftTop *= aTextureTransform;
- aLeftBottom *= aTextureTransform;
- aRightTop *= aTextureTransform;
- aRightBottom*= aTextureTransform;
-
-
// calc step size
// --------------
- const int nColorSteps(
- ::std::max(
- labs( rColor1.GetRed() - rColor2.GetRed() ),
- ::std::max(
- labs( rColor1.GetGreen() - rColor2.GetGreen() ),
- labs( rColor1.GetBlue() - rColor2.GetBlue() ) ) ) );
-
- // longest line in gradient bound rect
- const int nGradientSize(
- static_cast<int>(
- ::std::max(
- ::basegfx::B2DVector(aRightBottom-aLeftTop).getLength(),
- ::basegfx::B2DVector(aRightTop-aLeftBottom).getLength() ) + 1.0 ) );
-
- // typical number for pixel of the same color (strip size)
- const int nStripSize( nGradientSize < 50 ? 2 : 4 );
-
- // use at least three steps, and at utmost the number of color
- // steps
- const int nStepCount(
- ::std::max(
- 3,
- ::std::min(
- nGradientSize / nStripSize,
- nColorSteps ) ) );
+ int nColorSteps = 0;
+ for( size_t i=0; i<rColors.size()-1; ++i )
+ nColorSteps += numColorSteps(rColors[i],rColors[i+1]);
+
+ ::basegfx::B2DHomMatrix aTotalTransform;
+ const int nStepCount=
+ ::canvas::tools::calcGradientStepCount(aTotalTransform,
+ viewState,
+ renderState,
+ texture,
+ nColorSteps);
rOutDev.SetLineColor();
+ // determine maximal bound rect of texture-filled
+ // polygon
+ const ::Rectangle aPolygonDeviceRectOrig(
+ rPoly.GetBoundRect() );
+
if( tools::isRectangle( rPoly ) )
{
// use optimized output path
@@ -687,9 +596,8 @@ namespace vclcanvas
rOutDev.IntersectClipRegion( aPolygonDeviceRectOrig );
doGradientFill( rOutDev,
rValues,
- rColor1,
- rColor2,
- aTextureTransform,
+ rColors,
+ aTotalTransform,
aPolygonDeviceRectOrig,
nStepCount,
false );
@@ -701,9 +609,8 @@ namespace vclcanvas
p2ndOutDev->IntersectClipRegion( aPolygonDeviceRectOrig );
doGradientFill( *p2ndOutDev,
rValues,
- rColor1,
- rColor2,
- aTextureTransform,
+ rColors,
+ aTotalTransform,
aPolygonDeviceRectOrig,
nStepCount,
false );
@@ -720,9 +627,8 @@ namespace vclcanvas
doGradientFill( rOutDev,
rValues,
- rColor1,
- rColor2,
- aTextureTransform,
+ rColors,
+ aTotalTransform,
aPolygonDeviceRectOrig,
nStepCount,
false );
@@ -734,9 +640,8 @@ namespace vclcanvas
p2ndOutDev->SetClipRegion( aPolyClipRegion );
doGradientFill( *p2ndOutDev,
rValues,
- rColor1,
- rColor2,
- aTextureTransform,
+ rColors,
+ aTotalTransform,
aPolygonDeviceRectOrig,
nStepCount,
false );
@@ -750,9 +655,8 @@ namespace vclcanvas
rOutDev.SetRasterOp( ROP_XOR );
doGradientFill( rOutDev,
rValues,
- rColor1,
- rColor2,
- aTextureTransform,
+ rColors,
+ aTotalTransform,
aPolygonDeviceRectOrig,
nStepCount,
true );
@@ -762,9 +666,8 @@ namespace vclcanvas
rOutDev.SetRasterOp( ROP_XOR );
doGradientFill( rOutDev,
rValues,
- rColor1,
- rColor2,
- aTextureTransform,
+ rColors,
+ aTotalTransform,
aPolygonDeviceRectOrig,
nStepCount,
true );
@@ -776,9 +679,8 @@ namespace vclcanvas
p2ndOutDev->SetRasterOp( ROP_XOR );
doGradientFill( *p2ndOutDev,
rValues,
- rColor1,
- rColor2,
- aTextureTransform,
+ rColors,
+ aTotalTransform,
aPolygonDeviceRectOrig,
nStepCount,
true );
@@ -788,9 +690,8 @@ namespace vclcanvas
p2ndOutDev->SetRasterOp( ROP_XOR );
doGradientFill( *p2ndOutDev,
rValues,
- rColor1,
- rColor2,
- aTextureTransform,
+ rColors,
+ aTotalTransform,
aPolygonDeviceRectOrig,
nStepCount,
true );
@@ -852,33 +753,41 @@ namespace vclcanvas
::canvas::ParametricPolyPolygon* pGradient =
dynamic_cast< ::canvas::ParametricPolyPolygon* >( textures[0].Gradient.get() );
- if( pGradient )
+ if( pGradient && pGradient->getValues().maColors.getLength() )
{
// copy state from Gradient polypoly locally
// (given object might change!)
const ::canvas::ParametricPolyPolygon::Values& rValues(
pGradient->getValues() );
- // TODO: use all the colors and place them on given positions/stops
- const ::Color aColor1(
- ::vcl::unotools::stdColorSpaceSequenceToColor(
- rValues.maColors [0] ) );
- const ::Color aColor2(
- ::vcl::unotools::stdColorSpaceSequenceToColor(
- rValues.maColors [rValues.maColors.getLength () - 1] ) );
-
- // TODO(E1): Return value
- // TODO(F1): FillRule
- gradientFill( mpOutDev->getOutDev(),
- mp2ndOutDev.get() ? &mp2ndOutDev->getOutDev() : (OutputDevice*)NULL,
- rValues,
- aColor1,
- aColor2,
- aPolyPoly,
- viewState,
- renderState,
- textures[0],
- nTransparency );
+ if( rValues.maColors.getLength() < 2 )
+ {
+ rendering::RenderState aTempState=renderState;
+ aTempState.DeviceColor = rValues.maColors[0];
+ fillPolyPolygon(pCanvas, xPolyPolygon, viewState, aTempState);
+ }
+ else
+ {
+ std::vector< ::Color > aColors(rValues.maColors.getLength());
+ std::transform(&rValues.maColors[0],
+ &rValues.maColors[0]+rValues.maColors.getLength(),
+ aColors.begin(),
+ boost::bind(
+ &vcl::unotools::stdColorSpaceSequenceToColor,
+ _1));
+
+ // TODO(E1): Return value
+ // TODO(F1): FillRule
+ gradientFill( mpOutDev->getOutDev(),
+ mp2ndOutDev.get() ? &mp2ndOutDev->getOutDev() : (OutputDevice*)NULL,
+ rValues,
+ aColors,
+ aPolyPoly,
+ viewState,
+ renderState,
+ textures[0],
+ nTransparency );
+ }
}
else
{
@@ -889,10 +798,6 @@ namespace vclcanvas
}
else if( textures[0].Bitmap.is() )
{
-// OSL_ENSURE( textures[0].RepeatModeX == rendering::TexturingMode::REPEAT &&
-// textures[0].RepeatModeY == rendering::TexturingMode::REPEAT,
-// "CanvasHelper::fillTexturedPolyPolygon(): VCL canvas cannot currently clamp textures." );
-
const geometry::IntegerSize2D aBmpSize( textures[0].Bitmap->getSize() );
ENSURE_ARG_OR_THROW( aBmpSize.Width != 0 &&
@@ -967,23 +872,6 @@ namespace vclcanvas
aLocalState );
}
}
- else if ( textures[0].RepeatModeX == rendering::TexturingMode::CLAMP &&
- textures[0].RepeatModeY == rendering::TexturingMode::CLAMP )
- {
- rendering::RenderState aLocalState( renderState );
- ::canvas::tools::appendToRenderState(aLocalState,
- aTextureTransform);
- ::basegfx::B2DHomMatrix aScaleCorrection;
- aScaleCorrection.scale( 1.0/aBmpSize.Width,
- 1.0/aBmpSize.Height );
- ::canvas::tools::appendToRenderState(aLocalState,
- aScaleCorrection);
-
- return drawBitmap( pCanvas,
- textures[0].Bitmap,
- viewState,
- aLocalState );
- }
else
{
// No easy mapping to drawBitmap() - calculate
@@ -1117,15 +1005,21 @@ namespace vclcanvas
aSingleTextureRect,
aPureTotalTransform );
- const ::Point aPt( ::vcl::unotools::pointFromB2DPoint(
- aSingleDeviceTextureRect.getMinimum() ) );
+ const ::Point aPtRepeat( ::vcl::unotools::pointFromB2DPoint(
+ aSingleDeviceTextureRect.getMinimum() ) );
const ::Size aSz( ::basegfx::fround( aScale.getX() * aBmpSize.Width ),
::basegfx::fround( aScale.getY() * aBmpSize.Height ) );
const ::Size aIntegerNextTileX( ::vcl::unotools::sizeFromB2DSize(aNextTileX) );
const ::Size aIntegerNextTileY( ::vcl::unotools::sizeFromB2DSize(aNextTileY) );
- const sal_Int32 nTilesX( nX2 - nX1 );
- const sal_Int32 nTilesY( nY2 - nY1 );
+ const ::Point aPt( textures[0].RepeatModeX == rendering::TexturingMode::NONE ?
+ ::basegfx::fround( aOutputPos.getX() ) : aPtRepeat.X(),
+ textures[0].RepeatModeY == rendering::TexturingMode::NONE ?
+ ::basegfx::fround( aOutputPos.getY() ) : aPtRepeat.Y() );
+ const sal_Int32 nTilesX( textures[0].RepeatModeX == rendering::TexturingMode::NONE ?
+ 1 : nX2 - nX1 );
+ const sal_Int32 nTilesY( textures[0].RepeatModeX == rendering::TexturingMode::NONE ?
+ 1 : nY2 - nY1 );
OutputDevice& rOutDev( mpOutDev->getOutDev() );
@@ -1206,20 +1100,9 @@ namespace vclcanvas
aPolyPoly.Translate( ::Point( -aPolygonDeviceRect.Left(),
-aPolygonDeviceRect.Top() ) );
- aVDev.SetRasterOp( ROP_XOR );
- textureFill( aVDev,
- *pGrfObj,
- aOutPos,
- aIntegerNextTileX,
- aIntegerNextTileY,
- nTilesX,
- nTilesY,
- aSz,
- aGrfAttr );
- aVDev.SetFillColor( COL_BLACK );
- aVDev.SetRasterOp( ROP_0 );
- aVDev.DrawPolyPolygon( aPolyPoly );
- aVDev.SetRasterOp( ROP_XOR );
+ const Region aPolyClipRegion( aPolyPoly );
+
+ aVDev.SetClipRegion( aPolyClipRegion );
textureFill( aVDev,
*pGrfObj,
aOutPos,
@@ -1251,7 +1134,6 @@ namespace vclcanvas
aOutputBmpEx );
}
else
-#if defined(QUARTZ) // TODO: other ports should avoid the XOR-trick too (implementation vs. interface!)
{
const Region aPolyClipRegion( aPolyPoly );
@@ -1287,66 +1169,6 @@ namespace vclcanvas
r2ndOutDev.Pop();
}
}
-#else // TODO: remove once doing the XOR-trick in the canvas-layer becomes redundant
- {
- // output via repeated XORing
- rOutDev.Push( PUSH_RASTEROP );
- rOutDev.SetRasterOp( ROP_XOR );
- textureFill( rOutDev,
- *pGrfObj,
- aPt,
- aIntegerNextTileX,
- aIntegerNextTileY,
- nTilesX,
- nTilesY,
- aSz,
- aGrfAttr );
- rOutDev.SetFillColor( COL_BLACK );
- rOutDev.SetRasterOp( ROP_0 );
- rOutDev.DrawPolyPolygon( aPolyPoly );
- rOutDev.SetRasterOp( ROP_XOR );
- textureFill( rOutDev,
- *pGrfObj,
- aPt,
- aIntegerNextTileX,
- aIntegerNextTileY,
- nTilesX,
- nTilesY,
- aSz,
- aGrfAttr );
- rOutDev.Pop();
-
- if( mp2ndOutDev )
- {
- OutputDevice& r2ndOutDev( mp2ndOutDev->getOutDev() );
- r2ndOutDev.Push( PUSH_RASTEROP );
- r2ndOutDev.SetRasterOp( ROP_XOR );
- textureFill( r2ndOutDev,
- *pGrfObj,
- aPt,
- aIntegerNextTileX,
- aIntegerNextTileY,
- nTilesX,
- nTilesY,
- aSz,
- aGrfAttr );
- r2ndOutDev.SetFillColor( COL_BLACK );
- r2ndOutDev.SetRasterOp( ROP_0 );
- r2ndOutDev.DrawPolyPolygon( aPolyPoly );
- r2ndOutDev.SetRasterOp( ROP_XOR );
- textureFill( r2ndOutDev,
- *pGrfObj,
- aPt,
- aIntegerNextTileX,
- aIntegerNextTileY,
- nTilesX,
- nTilesY,
- aSz,
- aGrfAttr );
- r2ndOutDev.Pop();
- }
- }
-#endif // complex-clipping vs. XOR-trick
}
}
}
diff --git a/canvas/source/vcl/exports.map b/canvas/source/vcl/exports.map
deleted file mode 100644
index 4101b0d761a9..000000000000
--- a/canvas/source/vcl/exports.map
+++ /dev/null
@@ -1,8 +0,0 @@
-CAN_1_0 {
- global:
- component_getImplementationEnvironment;
- component_writeInfo;
- component_getFactory;
- local:
- *;
-};
diff --git a/canvas/source/vcl/makefile.mk b/canvas/source/vcl/makefile.mk
index 21eed478123a..be2fc69894a4 100644
--- a/canvas/source/vcl/makefile.mk
+++ b/canvas/source/vcl/makefile.mk
@@ -75,7 +75,7 @@ SHL1IMPLIB=i$(TARGET)
SHL1LIBS=$(SLB)$/$(TARGET).lib
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
-SHL1VERSIONMAP=exports.map
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
DEF1NAME=$(SHL1TARGET)
DEF1EXPORTFILE=exports.dxp
diff --git a/canvas/source/vcl/spritecanvas.hxx b/canvas/source/vcl/spritecanvas.hxx
index a5d4a6fe1e10..db4b05ddb9b2 100644
--- a/canvas/source/vcl/spritecanvas.hxx
+++ b/canvas/source/vcl/spritecanvas.hxx
@@ -39,7 +39,6 @@
#include <com/sun/star/rendering/XIntegerBitmap.hpp>
#include <com/sun/star/rendering/XGraphicDevice.hpp>
#include <com/sun/star/rendering/XBufferController.hpp>
-#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
#include <cppuhelper/compbase9.hxx>
#include <comphelper/uno3.hxx>
@@ -62,7 +61,7 @@ namespace vclcanvas
typedef ::cppu::WeakComponentImplHelper9< ::com::sun::star::rendering::XSpriteCanvas,
::com::sun::star::rendering::XIntegerBitmap,
::com::sun::star::rendering::XGraphicDevice,
- ::com::sun::star::rendering::XParametricPolyPolygon2DFactory,
+ ::com::sun::star::lang::XMultiServiceFactory,
::com::sun::star::rendering::XBufferController,
::com::sun::star::awt::XWindowListener,
::com::sun::star::util::XUpdatable,
diff --git a/comphelper/inc/comphelper/docpasswordhelper.hxx b/comphelper/inc/comphelper/docpasswordhelper.hxx
index 0a60c4b53ce9..dbbb68372a07 100644
--- a/comphelper/inc/comphelper/docpasswordhelper.hxx
+++ b/comphelper/inc/comphelper/docpasswordhelper.hxx
@@ -33,6 +33,7 @@
#include "comphelper/docpasswordrequest.hxx"
namespace com { namespace sun { namespace star { namespace task { class XInteractionHandler; } } } }
+namespace com { namespace sun { namespace star { namespace beans { struct PropertyValue; } } } }
namespace comphelper {
@@ -84,6 +85,116 @@ class COMPHELPER_DLLPUBLIC DocPasswordHelper
public:
// ------------------------------------------------------------------------
+ /** This helper function generates the information related
+ to "Password to modify" provided by user. The result
+ sequence contains the hash and the algorithm-related
+ info.
+
+ @param aString
+ The string for which the info should be generated
+
+ @return
+ The sequence containing the hash and the algorithm-related info
+ */
+
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
+ GenerateNewModifyPasswordInfo( const ::rtl::OUString& aPassword );
+
+ // ------------------------------------------------------------------------
+
+ /** This helper function allows to check whether
+ the "Password to modify" provided by user is the correct one.
+
+ @param aString
+ The string containing the provided password
+
+ @param aInfo
+ The sequence containing the hash and the algorithm-info
+
+ @return
+ <TRUE/> if the password is correct one
+ <FALSE/> otherwise
+ */
+
+ static sal_Bool IsModifyPasswordCorrect(
+ const ::rtl::OUString& aPassword,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aInfo );
+
+
+ // ------------------------------------------------------------------------
+
+ /** This helper function generates the hash code based on the algorithm
+ specified by MS for "Password to modify" feature of Word.
+
+ @param aString
+ The string for which the hash should be calculated
+
+ @return
+ The hash represented by sal_uInt32
+ */
+
+ static sal_uInt32 GetWordHashAsUINT32(
+ const ::rtl::OUString& aString );
+
+ // ------------------------------------------------------------------------
+
+ /** This helper function generates the hash code based on the algorithm
+ specified by MS for "Password to modify" feature of Word.
+
+ @param aString
+ The string for which the hash should be calculated
+
+ @return
+ The hash represented by sequence of bytes in BigEndian form
+ */
+
+ static ::com::sun::star::uno::Sequence< sal_Int8 > GetWordHashAsSequence(
+ const ::rtl::OUString& aString );
+
+ // ------------------------------------------------------------------------
+
+ /** This helper function generates the hash code based on the algorithm
+ specified by MS for "Password to modify" and passwords related to
+ table protection of Excel.
+
+ @param aString
+ The string for which the hash should be calculated
+
+ @param nEnc
+ The encoding that should be used to generate the 8-bit string
+ before the hash is generated
+
+ @return
+ The hash represented by sal_uInt16
+ */
+
+ static sal_uInt16 GetXLHashAsUINT16(
+ const ::rtl::OUString& aString,
+ rtl_TextEncoding nEnc = RTL_TEXTENCODING_UTF8 );
+
+ // ------------------------------------------------------------------------
+
+ /** This helper function generates the hash code based on the algorithm
+ specified by MS for "Password to modify" and passwords related to
+ table protection.
+
+ @param aString
+ The string for which the hash should be calculated
+
+ @param nEnc
+ The encoding that should be used to generate the 8-bit string
+ before the hash is generated
+
+ @return
+ The hash represented by sequence of bytes in BigEndian form
+ */
+
+ static ::com::sun::star::uno::Sequence< sal_Int8 > GetXLHashAsSequence(
+ const ::rtl::OUString& aString,
+ rtl_TextEncoding nEnc = RTL_TEXTENCODING_UTF8 );
+
+ // ------------------------------------------------------------------------
+
/** This helper function tries to request and verify a password to load a
protected document.
diff --git a/comphelper/inc/comphelper/docpasswordrequest.hxx b/comphelper/inc/comphelper/docpasswordrequest.hxx
index 7b186b3a261a..cf04d22c7a6d 100644..100755
--- a/comphelper/inc/comphelper/docpasswordrequest.hxx
+++ b/comphelper/inc/comphelper/docpasswordrequest.hxx
@@ -32,6 +32,7 @@
#include <com/sun/star/task/PasswordRequestMode.hpp>
#include <com/sun/star/task/XInteractionRequest.hpp>
#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/weak.hxx>
namespace comphelper {
@@ -52,19 +53,31 @@ class PasswordContinuation;
/** Implements the task.XInteractionRequest interface for requesting a password
string for a document.
*/
-class COMPHELPER_DLLPUBLIC DocPasswordRequest : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest >
+class COMPHELPER_DLLPUBLIC DocPasswordRequest :
+ public ::com::sun::star::task::XInteractionRequest,
+ public ::cppu::OWeakObject
{
public:
explicit DocPasswordRequest(
DocPasswordRequestType eType,
::com::sun::star::task::PasswordRequestMode eMode,
- const ::rtl::OUString& rDocumentName );
+ const ::rtl::OUString& rDocumentName,
+ sal_Bool bPasswordToModify = sal_False );
virtual ~DocPasswordRequest();
- bool isAbort() const;
- bool isPassword() const;
+ // XInterface / OWeakObject
+ 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 ();
+
+ sal_Bool isAbort() const;
+ sal_Bool isPassword() const;
+
::rtl::OUString getPassword() const;
+ ::rtl::OUString getPasswordToModify() const;
+ sal_Bool getRecommendReadOnly() const;
+
private:
virtual ::com::sun::star::uno::Any SAL_CALL
getRequest() throw( ::com::sun::star::uno::RuntimeException );
@@ -78,6 +91,8 @@ private:
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > maContinuations;
AbortContinuation* mpAbort;
PasswordContinuation* mpPassword;
+
+ sal_Bool mbPasswordToModify;
};
// ============================================================================
diff --git a/comphelper/inc/comphelper/mediadescriptor.hxx b/comphelper/inc/comphelper/mediadescriptor.hxx
index ac9661c76ebc..7d2333045390 100644
--- a/comphelper/inc/comphelper/mediadescriptor.hxx
+++ b/comphelper/inc/comphelper/mediadescriptor.hxx
@@ -83,6 +83,7 @@ class COMPHELPER_DLLPUBLIC MediaDescriptor : public SequenceAsHashMap
static const ::rtl::OUString& PROP_FILTERNAME();
static const ::rtl::OUString& PROP_FILTEROPTIONS();
static const ::rtl::OUString& PROP_FORMAT();
+ static const ::rtl::OUString& PROP_FRAME();
static const ::rtl::OUString& PROP_FRAMENAME();
static const ::rtl::OUString& PROP_HIDDEN();
static const ::rtl::OUString& PROP_INPUTSTREAM();
@@ -126,6 +127,9 @@ class COMPHELPER_DLLPUBLIC MediaDescriptor : public SequenceAsHashMap
//-------------------------------------------
// interface
public:
+ /** Value type of the 'ComponentData' property.
+ */
+ typedef ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > ComponentDataSequence;
//---------------------------------------
/** @short these ctors do nothing - excepting that they forward
@@ -196,6 +200,54 @@ class COMPHELPER_DLLPUBLIC MediaDescriptor : public SequenceAsHashMap
*/
sal_Bool isStreamReadOnly() const;
+ //---------------------------------------
+ /** Returns a value from the sequence contained in the property
+ 'ComponentData' of this media descriptor.
+
+ @descr The property 'ComponentData' should be empty or should
+ contain a value of type ComponentDataSequence (see above).
+
+ @return The value with the specified name, if existing in the
+ sequence of the 'ComponentData' property, otherwise an empty
+ Any.
+ */
+ ::com::sun::star::uno::Any getComponentDataEntry(
+ const ::rtl::OUString& rName ) const;
+
+ //---------------------------------------
+ /** Inserts a value into the sequence contained in the property
+ 'ComponentData' of the media descriptor.
+
+ @descr The property 'ComponentData' should be empty or should
+ contain a value of type ComponentDataSequence (see above). The
+ passed value will be inserted into the sequence, or, if already
+ existing, will be overwritten.
+
+ @param rName The name of the value to be inserted into the
+ sequence of the 'ComponentData' property.
+
+ @param rValue The value to be inserted into the sequence of the
+ 'ComponentData' property.
+ */
+ void setComponentDataEntry(
+ const ::rtl::OUString& rName,
+ const ::com::sun::star::uno::Any& rValue );
+
+ //---------------------------------------
+ /** Removes a value from the sequence contained in the property
+ 'ComponentData' of the media descriptor.
+
+ @descr The property 'ComponentData' should be empty or should
+ contain a value of type ComponentDataSequence (see above). The
+ value with the passed name will be removed from the sequence,
+ if existing.
+
+ @param rName The name of the value to be removed from the sequence
+ of the 'ComponentData' property.
+ */
+ void clearComponentDataEntry(
+ const ::rtl::OUString& rName );
+
//-------------------------------------------
// helper
private:
diff --git a/comphelper/inc/comphelper/propertycontainerhelper.hxx b/comphelper/inc/comphelper/propertycontainerhelper.hxx
index 247e1a678e02..82848203699c 100644
--- a/comphelper/inc/comphelper/propertycontainerhelper.hxx
+++ b/comphelper/inc/comphelper/propertycontainerhelper.hxx
@@ -42,7 +42,7 @@ namespace comphelper
//.........................................................................
// infos about one single property
-struct COMPHELPER_DLLPRIVATE PropertyDescription
+struct COMPHELPER_DLLPUBLIC PropertyDescription
{
// the possibilities where a property holding object may be located
enum LocationType
diff --git a/comphelper/inc/comphelper/stillreadwriteinteraction.hxx b/comphelper/inc/comphelper/stillreadwriteinteraction.hxx
new file mode 100644
index 000000000000..1ade47220c6f
--- /dev/null
+++ b/comphelper/inc/comphelper/stillreadwriteinteraction.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+*
+* 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_STILLREADWRITEINTERACTION_HXX_
+#define _COMPHELPER_STRILLREADWRITEINTERACTION_HXX_
+
+//_______________________________________________
+// includes
+#include <ucbhelper/interceptedinteraction.hxx>
+
+#ifndef __COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP__
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#endif
+
+#include <ucbhelper/interceptedinteraction.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//_______________________________________________
+// namespace
+
+namespace comphelper{
+class COMPHELPER_DLLPUBLIC StillReadWriteInteraction : public ::ucbhelper::InterceptedInteraction
+{
+private:
+ static const sal_Int32 HANDLE_INTERACTIVEIOEXCEPTION = 0;
+ static const sal_Int32 HANDLE_UNSUPPORTEDDATASINKEXCEPTION = 1;
+
+ sal_Bool m_bUsed;
+ sal_Bool m_bHandledByMySelf;
+ sal_Bool m_bHandledByInternalHandler;
+
+public:
+ StillReadWriteInteraction(const com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler >& xHandler);
+
+ void resetInterceptions();
+ void resetErrorStates();
+ sal_Bool wasWriteError();
+
+private:
+ virtual ucbhelper::InterceptedInteraction::EInterceptionState intercepted(const ::ucbhelper::InterceptedInteraction::InterceptedRequest& aRequest,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest);
+
+};
+}
+#endif
diff --git a/comphelper/inc/comphelper/storagehelper.hxx b/comphelper/inc/comphelper/storagehelper.hxx
index 796c0ad47142..b613ddd2c5f1 100644
--- a/comphelper/inc/comphelper/storagehelper.hxx
+++ b/comphelper/inc/comphelper/storagehelper.hxx
@@ -136,7 +136,8 @@ public:
const ::rtl::OUString& aURL,
sal_Int32 nStorageMode,
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory
- = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() )
+ = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >(),
+ sal_Bool bRepairStorage = sal_False )
throw ( ::com::sun::star::uno::Exception );
static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
@@ -144,7 +145,8 @@ public:
const ::rtl::OUString& aFormat,
const ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream >& xStream,
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory
- = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() )
+ = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >(),
+ sal_Bool bRepairStorage = sal_False )
throw ( ::com::sun::star::uno::Exception );
static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
@@ -153,7 +155,8 @@ public:
const ::com::sun::star::uno::Reference < ::com::sun::star::io::XStream >& xStream,
sal_Int32 nStorageMode = ::com::sun::star::embed::ElementModes::READWRITE,
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory
- = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() )
+ = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >(),
+ sal_Bool bRepairStorage = sal_False )
throw ( ::com::sun::star::uno::Exception );
static sal_Bool IsValidZipEntryFileName( const ::rtl::OUString& aName, sal_Bool bSlashAllowed );
diff --git a/comphelper/qa/complex/makefile.mk b/comphelper/qa/complex/makefile.mk
index 341b6868e1ec..ec0efdd1188c 100644
--- a/comphelper/qa/complex/makefile.mk
+++ b/comphelper/qa/complex/makefile.mk
@@ -32,9 +32,6 @@ PRJNAME = comphelper
# --- Settings -----------------------------------------------------
.INCLUDE: settings.mk
-
-.IF "$(BUILD_QADEVOOO)" == "YES"
-
#----- compile .java files -----------------------------------------
JARFILES := ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
@@ -63,8 +60,6 @@ RUNNER_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,
RUNNER_ARGS = org.openoffice.Runner -TestBase java_complex $(RUNNER_APPEXECCOMMAND)
-.END # "$(BUILD_QADEVOOO)" == "YES"
-
# --- Targets ------------------------------------------------------
.IF "$(depend)" == ""
@@ -78,7 +73,6 @@ ALL: ALLDEP
.INCLUDE : target.mk
-.IF "$(BUILD_QADEVOOO)" == "YES"
show_targets:
+@java $(RUNNER_CLASSPATH) complexlib.ShowTargets $(foreach,i,$(JAVAFILES) $(i:s#.java##:s#./#complex.#))
@@ -87,11 +81,3 @@ run:
run_%:
+java $(RUNNER_CLASSPATH) $(RUNNER_ARGS) -o complex.$(PRJNAME).$(@:s/run_//)
-
-.ELSE
-run: show_targets
-
-show_targets:
- +@echo "Built without qadevOOo, no QA tests"
-
-.ENDIF
diff --git a/comphelper/qa/makefile.mk b/comphelper/qa/makefile.mk
index 6e715675bb03..0360d308529e 100644
--- a/comphelper/qa/makefile.mk
+++ b/comphelper/qa/makefile.mk
@@ -33,6 +33,8 @@ ENABLE_EXCEPTIONS := TRUE
.INCLUDE: settings.mk
+CFLAGSCXX += $(CPPUNIT_CFLAGS)
+
DLLPRE = # no leading "lib" on .so files
INCPRE += $(MISC)$/$(TARGET)$/inc
diff --git a/comphelper/source/misc/comphelper_services.cxx b/comphelper/source/misc/comphelper_services.cxx
index a2d4dd8fc0de..b46dcea68ba7 100644
--- a/comphelper/source/misc/comphelper_services.cxx
+++ b/comphelper/source/misc/comphelper_services.cxx
@@ -41,6 +41,7 @@ extern void createRegistryInfo_OfficeInstallationDirectories();
extern void createRegistryInfo_OInstanceLocker();
extern void createRegistryInfo_Map();
extern void createRegistryInfo_OSimpleLogRing();
+extern void createRegistryInfo_OOfficeRestartManager();
//........................................................................
namespace comphelper { namespace module
@@ -66,6 +67,7 @@ namespace comphelper { namespace module
createRegistryInfo_OInstanceLocker();
createRegistryInfo_Map();
createRegistryInfo_OSimpleLogRing();
+ createRegistryInfo_OOfficeRestartManager();
}
}
}
diff --git a/comphelper/source/misc/docpasswordhelper.cxx b/comphelper/source/misc/docpasswordhelper.cxx
index ea25cb795a53..37941352ae28 100644
--- a/comphelper/source/misc/docpasswordhelper.cxx
+++ b/comphelper/source/misc/docpasswordhelper.cxx
@@ -1,4 +1,4 @@
-/*************************************************************************
+/***********************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -32,7 +32,12 @@
#include <com/sun/star/task/XInteractionHandler.hpp>
#include "comphelper/mediadescriptor.hxx"
+#include <osl/time.h>
+#include <rtl/digest.h>
+#include <rtl/random.h>
+
using ::rtl::OUString;
+using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::UNO_SET_THROW;
@@ -42,15 +47,241 @@ using ::com::sun::star::task::PasswordRequestMode_PASSWORD_REENTER;
using ::com::sun::star::task::XInteractionHandler;
using ::com::sun::star::task::XInteractionRequest;
+using namespace ::com::sun::star;
+
namespace comphelper {
// ============================================================================
+static uno::Sequence< sal_Int8 > GeneratePBKDF2Hash( const ::rtl::OUString& aPassword, const uno::Sequence< sal_Int8 >& aSalt, sal_Int32 nCount, sal_Int32 nHashLength )
+{
+ uno::Sequence< sal_Int8 > aResult;
+
+ if ( aPassword.getLength() && aSalt.getLength() && nCount && nHashLength )
+ {
+ ::rtl::OString aBytePass = ::rtl::OUStringToOString( aPassword, RTL_TEXTENCODING_UTF8 );
+ aResult.realloc( 16 );
+ rtl_digest_PBKDF2( reinterpret_cast < sal_uInt8 * > ( aResult.getArray() ),
+ aResult.getLength(),
+ reinterpret_cast < const sal_uInt8 * > ( aBytePass.getStr() ),
+ aBytePass.getLength(),
+ reinterpret_cast < const sal_uInt8 * > ( aSalt.getConstArray() ),
+ aSalt.getLength(),
+ nCount );
+ }
+
+ return aResult;
+}
+
+// ============================================================================
+
IDocPasswordVerifier::~IDocPasswordVerifier()
{
}
// ============================================================================
+uno::Sequence< beans::PropertyValue > DocPasswordHelper::GenerateNewModifyPasswordInfo( const ::rtl::OUString& aPassword )
+{
+ uno::Sequence< beans::PropertyValue > aResult;
+
+ uno::Sequence< sal_Int8 > aSalt( 16 );
+ sal_Int32 nCount = 1024;
+
+ TimeValue aTime;
+ osl_getSystemTime( &aTime );
+ rtlRandomPool aRandomPool = rtl_random_createPool ();
+ rtl_random_addBytes ( aRandomPool, &aTime, 8 );
+
+ rtl_random_getBytes ( aRandomPool, aSalt.getArray(), 16 );
+
+ uno::Sequence< sal_Int8 > aNewHash = GeneratePBKDF2Hash( aPassword, aSalt, nCount, 16 );
+ if ( aNewHash.getLength() )
+ {
+ aResult.realloc( 4 );
+ aResult[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "algorithm-name" ) );
+ aResult[0].Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PBKDF2" ) );
+ aResult[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "salt" ) );
+ aResult[1].Value <<= aSalt;
+ aResult[2].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "iteration-count" ) );
+ aResult[2].Value <<= nCount;
+ aResult[3].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "hash" ) );
+ aResult[3].Value <<= aNewHash;
+ }
+
+ // Clean up random pool memory
+ rtl_random_destroyPool ( aRandomPool );
+
+ return aResult;
+}
+
+// ============================================================================
+sal_Bool DocPasswordHelper::IsModifyPasswordCorrect( const ::rtl::OUString& aPassword, const uno::Sequence< beans::PropertyValue >& aInfo )
+{
+ sal_Bool bResult = sal_False;
+ if ( aPassword.getLength() && aInfo.getLength() )
+ {
+ ::rtl::OUString sAlgorithm;
+ uno::Sequence< sal_Int8 > aSalt;
+ uno::Sequence< sal_Int8 > aHash;
+ sal_Int32 nCount = 0;
+
+ for ( sal_Int32 nInd = 0; nInd < aInfo.getLength(); nInd++ )
+ {
+ if ( aInfo[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "algorithm-name" ) ) ) )
+ aInfo[nInd].Value >>= sAlgorithm;
+ else if ( aInfo[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "salt" ) ) ) )
+ aInfo[nInd].Value >>= aSalt;
+ else if ( aInfo[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "iteration-count" ) ) ) )
+ aInfo[nInd].Value >>= nCount;
+ else if ( aInfo[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "hash" ) ) ) )
+ aInfo[nInd].Value >>= aHash;
+ }
+
+ if ( sAlgorithm.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PBKDF2" ) ) )
+ && aSalt.getLength() && nCount > 0 && aHash.getLength() )
+ {
+ uno::Sequence< sal_Int8 > aNewHash = GeneratePBKDF2Hash( aPassword, aSalt, nCount, aHash.getLength() );
+ for ( sal_Int32 nInd = 0; nInd < aNewHash.getLength() && nInd < aHash.getLength() && aNewHash[nInd] == aHash[nInd]; nInd ++ )
+ {
+ if ( nInd == aNewHash.getLength() - 1 && nInd == aHash.getLength() - 1 )
+ bResult = sal_True;
+ }
+ }
+ }
+
+ return bResult;
+}
+
+// ============================================================================
+sal_uInt32 DocPasswordHelper::GetWordHashAsUINT32(
+ const ::rtl::OUString& aUString )
+{
+ static sal_uInt16 pInitialCode[] = {
+ 0xE1F0, // 1
+ 0x1D0F, // 2
+ 0xCC9C, // 3
+ 0x84C0, // 4
+ 0x110C, // 5
+ 0x0E10, // 6
+ 0xF1CE, // 7
+ 0x313E, // 8
+ 0x1872, // 9
+ 0xE139, // 10
+ 0xD40F, // 11
+ 0x84F9, // 12
+ 0x280C, // 13
+ 0xA96A, // 14
+ 0x4EC3 // 15
+ };
+
+ static sal_uInt16 pEncryptionMatrix[15][7] = {
+ { 0xAEFC, 0x4DD9, 0x9BB2, 0x2745, 0x4E8A, 0x9D14, 0x2A09}, // last-14
+ { 0x7B61, 0xF6C2, 0xFDA5, 0xEB6B, 0xC6F7, 0x9DCF, 0x2BBF}, // last-13
+ { 0x4563, 0x8AC6, 0x05AD, 0x0B5A, 0x16B4, 0x2D68, 0x5AD0}, // last-12
+ { 0x0375, 0x06EA, 0x0DD4, 0x1BA8, 0x3750, 0x6EA0, 0xDD40}, // last-11
+ { 0xD849, 0xA0B3, 0x5147, 0xA28E, 0x553D, 0xAA7A, 0x44D5}, // last-10
+ { 0x6F45, 0xDE8A, 0xAD35, 0x4A4B, 0x9496, 0x390D, 0x721A}, // last-9
+ { 0xEB23, 0xC667, 0x9CEF, 0x29FF, 0x53FE, 0xA7FC, 0x5FD9}, // last-8
+ { 0x47D3, 0x8FA6, 0x8FA6, 0x1EDA, 0x3DB4, 0x7B68, 0xF6D0}, // last-7
+ { 0xB861, 0x60E3, 0xC1C6, 0x93AD, 0x377B, 0x6EF6, 0xDDEC}, // last-6
+ { 0x45A0, 0x8B40, 0x06A1, 0x0D42, 0x1A84, 0x3508, 0x6A10}, // last-5
+ { 0xAA51, 0x4483, 0x8906, 0x022D, 0x045A, 0x08B4, 0x1168}, // last-4
+ { 0x76B4, 0xED68, 0xCAF1, 0x85C3, 0x1BA7, 0x374E, 0x6E9C}, // last-3
+ { 0x3730, 0x6E60, 0xDCC0, 0xA9A1, 0x4363, 0x86C6, 0x1DAD}, // last-2
+ { 0x3331, 0x6662, 0xCCC4, 0x89A9, 0x0373, 0x06E6, 0x0DCC}, // last-1
+ { 0x1021, 0x2042, 0x4084, 0x8108, 0x1231, 0x2462, 0x48C4} // last
+ };
+
+ sal_uInt32 nResult = 0;
+ sal_uInt32 nLen = aUString.getLength();
+
+ if ( nLen )
+ {
+ if ( nLen > 15 )
+ nLen = 15;
+
+ sal_uInt16 nHighResult = pInitialCode[nLen - 1];
+ sal_uInt16 nLowResult = 0;
+
+ const sal_Unicode* pStr = aUString.getStr();
+ for ( sal_uInt32 nInd = 0; nInd < nLen; nInd++ )
+ {
+ // NO Encoding during conversion!
+ // The specification says that the low byte should be used in case it is not NULL
+ char nHighChar = (char)( pStr[nInd] >> 8 );
+ char nLowChar = (char)( pStr[nInd] & 0xFF );
+ char nChar = nLowChar ? nLowChar : nHighChar;
+
+ for ( int nMatrixInd = 0; nMatrixInd < 7; ++nMatrixInd )
+ {
+ if ( ( nChar & ( 1 << nMatrixInd ) ) != 0 )
+ nHighResult = nHighResult ^ pEncryptionMatrix[15 - nLen + nInd][nMatrixInd];
+ }
+
+ nLowResult = ( ( ( nLowResult >> 14 ) & 0x0001 ) | ( ( nLowResult << 1 ) & 0x7FFF ) ) ^ nChar;
+ }
+
+ nLowResult = (sal_uInt16)( ( ( ( nLowResult >> 14 ) & 0x001 ) | ( ( nLowResult << 1 ) & 0x7FF ) ) ^ nLen ^ 0xCE4B );
+
+ nResult = ( nHighResult << 16 ) | nLowResult;
+ }
+
+ return nResult;
+}
+
+// ============================================================================
+Sequence< sal_Int8 > DocPasswordHelper::GetWordHashAsSequence(
+ const ::rtl::OUString& aUString )
+{
+ sal_uInt32 nHash = GetWordHashAsUINT32( aUString );
+ Sequence< sal_Int8 > aResult( 4 );
+ aResult[0] = ( nHash >> 24 );
+ aResult[1] = ( ( nHash >> 16 ) & 0xFF );
+ aResult[2] = ( ( nHash >> 8 ) & 0xFF );
+ aResult[3] = ( nHash & 0xFF );
+
+ return aResult;
+}
+
+// ============================================================================
+sal_uInt16 DocPasswordHelper::GetXLHashAsUINT16(
+ const ::rtl::OUString& aUString,
+ rtl_TextEncoding nEnc )
+{
+ sal_uInt16 nResult = 0;
+
+ ::rtl::OString aString = ::rtl::OUStringToOString( aUString, nEnc );
+
+ if ( aString.getLength() && aString.getLength() <= SAL_MAX_UINT16 )
+ {
+ for ( sal_Int32 nInd = aString.getLength() - 1; nInd >= 0; nInd-- )
+ {
+ nResult = ( ( nResult >> 14 ) & 0x01 ) | ( ( nResult << 1 ) & 0x7FFF );
+ nResult ^= aString.getStr()[nInd];
+ }
+
+ nResult = ( ( nResult >> 14 ) & 0x01 ) | ( ( nResult << 1 ) & 0x7FFF );
+ nResult ^= ( 0x8000 | ( 'N' << 8 ) | 'K' );
+ nResult ^= aString.getLength();
+ }
+
+ return nResult;
+}
+
+// ============================================================================
+Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence(
+ const ::rtl::OUString& aUString,
+ rtl_TextEncoding nEnc )
+{
+ sal_uInt16 nHash = GetXLHashAsUINT16( aUString, nEnc );
+ Sequence< sal_Int8 > aResult( 2 );
+ aResult[0] = ( nHash >> 8 );
+ aResult[1] = ( nHash & 0xFF );
+
+ return aResult;
+}
+
+// ============================================================================
/*static*/ OUString DocPasswordHelper::requestAndVerifyDocPassword(
IDocPasswordVerifier& rVerifier,
diff --git a/comphelper/source/misc/docpasswordrequest.cxx b/comphelper/source/misc/docpasswordrequest.cxx
index 9377d6c7c473..17cdb0ae2d92 100644
--- a/comphelper/source/misc/docpasswordrequest.cxx
+++ b/comphelper/source/misc/docpasswordrequest.cxx
@@ -29,24 +29,26 @@
#include "precompiled_comphelper.hxx"
#include "comphelper/docpasswordrequest.hxx"
-#include <com/sun/star/task/DocumentMSPasswordRequest.hpp>
-#include <com/sun/star/task/DocumentPasswordRequest.hpp>
+#include <com/sun/star/task/DocumentMSPasswordRequest2.hpp>
+#include <com/sun/star/task/DocumentPasswordRequest2.hpp>
#include <com/sun/star/task/XInteractionAbort.hpp>
-#include <com/sun/star/task/XInteractionPassword.hpp>
+#include <com/sun/star/task/XInteractionPassword2.hpp>
using ::rtl::OUString;
using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Type;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::RuntimeException;
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::XInterface;
using ::com::sun::star::task::InteractionClassification_QUERY;
-using ::com::sun::star::task::DocumentMSPasswordRequest;
-using ::com::sun::star::task::DocumentPasswordRequest;
+using ::com::sun::star::task::DocumentMSPasswordRequest2;
+using ::com::sun::star::task::DocumentPasswordRequest2;
using ::com::sun::star::task::PasswordRequestMode;
using ::com::sun::star::task::XInteractionAbort;
using ::com::sun::star::task::XInteractionContinuation;
-using ::com::sun::star::task::XInteractionPassword;
+using ::com::sun::star::task::XInteractionPassword2;
+using ::com::sun::star::task::XInteractionRequest;
namespace comphelper {
@@ -57,52 +59,64 @@ class AbortContinuation : public ::cppu::WeakImplHelper1< XInteractionAbort >
public:
inline explicit AbortContinuation() : mbSelected( false ) {}
- inline bool isSelected() const { return mbSelected; }
+ inline sal_Bool isSelected() const { return mbSelected; }
inline void reset() { mbSelected = false; }
virtual void SAL_CALL select() throw( RuntimeException ) { mbSelected = true; }
private:
- bool mbSelected;
+ sal_Bool mbSelected;
};
// ============================================================================
-class PasswordContinuation : public ::cppu::WeakImplHelper1< XInteractionPassword >
+class PasswordContinuation : public ::cppu::WeakImplHelper1< XInteractionPassword2 >
{
public:
- inline explicit PasswordContinuation() : mbSelected( false ) {}
+ inline explicit PasswordContinuation() : mbReadOnly( sal_False ), mbSelected( sal_False ) {}
- inline bool isSelected() const { return mbSelected; }
- inline void reset() { mbSelected = false; }
+ inline sal_Bool isSelected() const { return mbSelected; }
+ inline void reset() { mbSelected = sal_False; }
+
+ virtual void SAL_CALL select() throw( RuntimeException ) { mbSelected = sal_True; }
- virtual void SAL_CALL select() throw( RuntimeException ) { mbSelected = true; }
virtual void SAL_CALL setPassword( const OUString& rPass ) throw( RuntimeException ) { maPassword = rPass; }
virtual OUString SAL_CALL getPassword() throw( RuntimeException ) { return maPassword; }
+ virtual void SAL_CALL setPasswordToModify( const OUString& rPass ) throw( RuntimeException ) { maModifyPassword = rPass; }
+ virtual OUString SAL_CALL getPasswordToModify() throw( RuntimeException ) { return maModifyPassword; }
+
+ virtual void SAL_CALL setRecommendReadOnly( sal_Bool bReadOnly ) throw( RuntimeException ) { mbReadOnly = bReadOnly; }
+ virtual sal_Bool SAL_CALL getRecommendReadOnly() throw( RuntimeException ) { return mbReadOnly; }
+
private:
OUString maPassword;
- bool mbSelected;
+ OUString maModifyPassword;
+ sal_Bool mbReadOnly;
+ sal_Bool mbSelected;
};
// ============================================================================
DocPasswordRequest::DocPasswordRequest( DocPasswordRequestType eType,
- PasswordRequestMode eMode, const OUString& rDocumentName )
+ PasswordRequestMode eMode, const OUString& rDocumentName, sal_Bool bPasswordToModify )
+: mpAbort( NULL )
+, mpPassword( NULL )
+, mbPasswordToModify( bPasswordToModify )
{
switch( eType )
{
case DocPasswordRequestType_STANDARD:
{
- DocumentPasswordRequest aRequest( OUString(), Reference< XInterface >(),
- InteractionClassification_QUERY, eMode, rDocumentName );
+ DocumentPasswordRequest2 aRequest( OUString(), Reference< XInterface >(),
+ InteractionClassification_QUERY, eMode, rDocumentName, bPasswordToModify );
maRequest <<= aRequest;
}
break;
case DocPasswordRequestType_MS:
{
- DocumentMSPasswordRequest aRequest( OUString(), Reference< XInterface >(),
- InteractionClassification_QUERY, eMode, rDocumentName );
+ DocumentMSPasswordRequest2 aRequest( OUString(), Reference< XInterface >(),
+ InteractionClassification_QUERY, eMode, rDocumentName, bPasswordToModify );
maRequest <<= aRequest;
}
break;
@@ -119,12 +133,32 @@ DocPasswordRequest::~DocPasswordRequest()
{
}
-bool DocPasswordRequest::isAbort() const
+/*uno::*/Any SAL_CALL DocPasswordRequest::queryInterface( const /*uno::*/Type& rType ) throw (RuntimeException)
+{
+ return ::cppu::queryInterface ( rType,
+ // OWeakObject interfaces
+ dynamic_cast< XInterface* > ( (XInteractionRequest *) this ),
+ static_cast< XWeak* > ( this ),
+ // my own interfaces
+ static_cast< XInteractionRequest* > ( this ) );
+}
+
+void SAL_CALL DocPasswordRequest::acquire( ) throw ()
+{
+ OWeakObject::acquire();
+}
+
+void SAL_CALL DocPasswordRequest::release( ) throw ()
+{
+ OWeakObject::release();
+}
+
+sal_Bool DocPasswordRequest::isAbort() const
{
return mpAbort->isSelected();
}
-bool DocPasswordRequest::isPassword() const
+sal_Bool DocPasswordRequest::isPassword() const
{
return mpPassword->isSelected();
}
@@ -134,6 +168,16 @@ OUString DocPasswordRequest::getPassword() const
return mpPassword->getPassword();
}
+OUString DocPasswordRequest::getPasswordToModify() const
+{
+ return mpPassword->getPasswordToModify();
+}
+
+sal_Bool DocPasswordRequest::getRecommendReadOnly() const
+{
+ return mpPassword->getRecommendReadOnly();
+}
+
Any SAL_CALL DocPasswordRequest::getRequest() throw( RuntimeException )
{
return maRequest;
diff --git a/comphelper/source/misc/makefile.mk b/comphelper/source/misc/makefile.mk
index 94837ce49df9..cecba554b332 100644
--- a/comphelper/source/misc/makefile.mk
+++ b/comphelper/source/misc/makefile.mk
@@ -72,6 +72,7 @@ SLOFILES= \
$(SLO)$/numberedcollection.obj \
$(SLO)$/numbers.obj \
$(SLO)$/officeresourcebundle.obj \
+ $(SLO)$/officerestartmanager.obj \
$(SLO)$/proxyaggregation.obj \
$(SLO)$/querydeep.obj \
$(SLO)$/regpathhelper.obj \
@@ -92,6 +93,7 @@ SLOFILES= \
$(SLO)$/comphelper_module.obj \
$(SLO)$/comphelper_services.obj \
$(SLO)$/componentbase.obj \
+ $(SLO)$/stillreadwriteinteraction.obj \
# --- Targets ----------------------------------
diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx
index 7e3be338992b..9e02afe8c56c 100644
--- a/comphelper/source/misc/mediadescriptor.cxx
+++ b/comphelper/source/misc/mediadescriptor.cxx
@@ -28,60 +28,23 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_comphelper.hxx"
#include <comphelper/mediadescriptor.hxx>
+#include <comphelper/stillreadwriteinteraction.hxx>
-//_______________________________________________
-// includes
-
-#ifndef __COM_SUN_STAR_UCB_XCONTENT_HPP__
#include <com/sun/star/ucb/XContent.hpp>
-#endif
-
-#ifndef __COM_SUN_STAR_UCB_XCOMMANDENVIRONMENT_HPP__
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
-#endif
-
-#ifndef __COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP__
#include <com/sun/star/task/XInteractionHandler.hpp>
-#endif
-
-#ifndef __COM_SUN_STAR_IO_XSTREAM_HPP__
#include <com/sun/star/io/XStream.hpp>
-#endif
#include <com/sun/star/io/XActiveDataSink.hpp>
#include <com/sun/star/io/XSeekable.hpp>
-
-#ifndef __COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP__
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#endif
#include <com/sun/star/lang/IllegalArgumentException.hpp>
-
-#ifndef __COM_SUN_STAR_UTIL_XURLTRANSFORMER_HPP__
#include <com/sun/star/util/XURLTransformer.hpp>
-#endif
-
-#ifndef __COM_SUN_STAR_UCB_INTERACTIVEIOEXCEPTION_HPP__
#include <com/sun/star/ucb/InteractiveIOException.hpp>
-#endif
-
-#ifndef __COM_SUN_STAR_UCB_UNSUPPORTEDDATASINKEXCEPTION_HPP__
#include <com/sun/star/ucb/UnsupportedDataSinkException.hpp>
-#endif
-
-#ifndef __COM_SUN_STAR_UCB_COMMANDFAILEDEXCEPTION_HPP__
#include <com/sun/star/ucb/CommandFailedException.hpp>
-#endif
-
-#ifndef __COM_SUN_STAR_TASK_XINTERACTIONABORT_HPP__
#include <com/sun/star/task/XInteractionAbort.hpp>
-#endif
-
-#ifndef __COM_SUN_STAR_URI_XURIREFERENCEFACTORY_HPP__
#include <com/sun/star/uri/XUriReferenceFactory.hpp>
-#endif
-
-#ifndef __COM_SUN_STAR_URI_XURIREFERENCE_HPP__
#include <com/sun/star/uri/XUriReference.hpp>
-#endif
#include <com/sun/star/ucb/PostCommandArgument2.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -92,11 +55,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/configurationhelper.hxx>
-#if OSL_DEBUG_LEVEL>0
- #ifndef _RTL_USTRBUF_HXX_
- #include <rtl/ustrbuf.hxx>
- #endif
-#endif
+#include <rtl/ustrbuf.hxx>
//_______________________________________________
// namespace
@@ -183,6 +142,12 @@ const ::rtl::OUString& MediaDescriptor::PROP_FORMAT()
return sProp;
}
+const ::rtl::OUString& MediaDescriptor::PROP_FRAME()
+{
+ static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Frame"));
+ return sProp;
+}
+
const ::rtl::OUString& MediaDescriptor::PROP_FRAMENAME()
{
static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("FrameName"));
@@ -508,6 +473,61 @@ sal_Bool MediaDescriptor::isStreamReadOnly() const
return bReadOnly;
}
+// ----------------------------------------------------------------------------
+
+css::uno::Any MediaDescriptor::getComponentDataEntry( const ::rtl::OUString& rName ) const
+{
+ SequenceAsHashMap aCompDataMap( getUnpackedValueOrDefault( PROP_COMPONENTDATA(), ComponentDataSequence() ) );
+ SequenceAsHashMap::iterator aIt = aCompDataMap.find( rName );
+ return (aIt == aCompDataMap.end()) ? css::uno::Any() : aIt->second;
+}
+
+void MediaDescriptor::setComponentDataEntry( const ::rtl::OUString& rName, const css::uno::Any& rValue )
+{
+ if( rValue.hasValue() )
+ {
+ // get or craete the 'ComponentData' property entry
+ css::uno::Any& rCompDataAny = operator[]( PROP_COMPONENTDATA() );
+ // check type, insert the value
+ OSL_ENSURE( !rCompDataAny.hasValue() || rCompDataAny.has< ComponentDataSequence >(),
+ "MediaDescriptor::setComponentDataEntry - incompatible 'ComponentData' property in media descriptor" );
+ if( !rCompDataAny.hasValue() || rCompDataAny.has< ComponentDataSequence >() )
+ {
+ // insert or overwrite the passed value
+ SequenceAsHashMap aCompDataMap( rCompDataAny );
+ aCompDataMap[ rName ] = rValue;
+ // write back the sequence (sal_False = use NamedValue instead of PropertyValue)
+ rCompDataAny = aCompDataMap.getAsConstAny( sal_False );
+ }
+ }
+ else
+ {
+ // if an empty Any is passed, clear the entry
+ clearComponentDataEntry( rName );
+ }
+}
+
+void MediaDescriptor::clearComponentDataEntry( const ::rtl::OUString& rName )
+{
+ SequenceAsHashMap::iterator aPropertyIter = find( PROP_COMPONENTDATA() );
+ if( aPropertyIter != end() )
+ {
+ OSL_ENSURE( aPropertyIter->second.has< ComponentDataSequence >(),
+ "MediaDescriptor::clearComponentDataEntry - incompatible 'ComponentData' property in media descriptor" );
+ if( aPropertyIter->second.has< ComponentDataSequence >() )
+ {
+ // remove the value with the passed name
+ SequenceAsHashMap aCompDataMap( aPropertyIter->second );
+ aCompDataMap.erase( rName );
+ // write back the sequence, or remove it completely if it is empty
+ if( aCompDataMap.empty() )
+ erase( aPropertyIter );
+ else
+ aPropertyIter->second = aCompDataMap.getAsConstAny( sal_False );
+ }
+ }
+}
+
/*-----------------------------------------------
10.03.2004 09:02
-----------------------------------------------*/
@@ -667,114 +687,6 @@ sal_Bool MediaDescriptor::impl_openStreamWithPostData( const css::uno::Reference
}
/*-----------------------------------------------*/
-class StillReadWriteInteraction : public ::ucbhelper::InterceptedInteraction
-{
- private:
- static const sal_Int32 HANDLE_INTERACTIVEIOEXCEPTION = 0;
- static const sal_Int32 HANDLE_UNSUPPORTEDDATASINKEXCEPTION = 1;
-
- sal_Bool m_bUsed;
- sal_Bool m_bHandledByMySelf;
- sal_Bool m_bHandledByInternalHandler;
-
- public:
- StillReadWriteInteraction(const css::uno::Reference< css::task::XInteractionHandler >& xHandler)
- : m_bUsed (sal_False)
- , m_bHandledByMySelf (sal_False)
- , m_bHandledByInternalHandler(sal_False)
- {
- ::std::vector< ::ucbhelper::InterceptedInteraction::InterceptedRequest > lInterceptions;
- ::ucbhelper::InterceptedInteraction::InterceptedRequest aInterceptedRequest;
-
- aInterceptedRequest.Handle = HANDLE_INTERACTIVEIOEXCEPTION;
- aInterceptedRequest.Request <<= css::ucb::InteractiveIOException();
- aInterceptedRequest.Continuation = ::getCppuType(static_cast< css::uno::Reference< css::task::XInteractionAbort >* >(0));
- aInterceptedRequest.MatchExact = sal_False;
- lInterceptions.push_back(aInterceptedRequest);
-
- aInterceptedRequest.Handle = HANDLE_UNSUPPORTEDDATASINKEXCEPTION;
- aInterceptedRequest.Request <<= css::ucb::UnsupportedDataSinkException();
- aInterceptedRequest.Continuation = ::getCppuType(static_cast< css::uno::Reference< css::task::XInteractionAbort >* >(0));
- aInterceptedRequest.MatchExact = sal_False;
- lInterceptions.push_back(aInterceptedRequest);
-
- setInterceptedHandler(xHandler);
- setInterceptions(lInterceptions);
- }
-
- void resetInterceptions()
- {
- setInterceptions(::std::vector< ::ucbhelper::InterceptedInteraction::InterceptedRequest >());
- }
-
- void resetErrorStates()
- {
- m_bUsed = sal_False;
- m_bHandledByMySelf = sal_False;
- m_bHandledByInternalHandler = sal_False;
- }
-
- sal_Bool wasWriteError()
- {
- return (m_bUsed && m_bHandledByMySelf);
- }
-
- private:
- virtual ucbhelper::InterceptedInteraction::EInterceptionState intercepted(const ::ucbhelper::InterceptedInteraction::InterceptedRequest& aRequest,
- const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest)
- {
- // we are used!
- m_bUsed = sal_True;
-
- // check if its a real interception - might some parameters are not the right ones ...
- sal_Bool bAbort = sal_False;
- switch(aRequest.Handle)
- {
- case HANDLE_INTERACTIVEIOEXCEPTION:
- {
- css::ucb::InteractiveIOException exIO;
- xRequest->getRequest() >>= exIO;
- bAbort = (
- (exIO.Code == css::ucb::IOErrorCode_ACCESS_DENIED )
- || (exIO.Code == css::ucb::IOErrorCode_LOCKING_VIOLATION )
-#ifdef MACOSX
- // this is a workaround for MAC, on this platform if the file is locked
- // the returned error code looks to be wrong
- || (exIO.Code == css::ucb::IOErrorCode_GENERAL )
-#endif
- );
- }
- break;
-
- case HANDLE_UNSUPPORTEDDATASINKEXCEPTION:
- {
- bAbort = sal_True;
- }
- break;
- }
-
- // handle interaction by ourself
- if (bAbort)
- {
- m_bHandledByMySelf = sal_True;
- css::uno::Reference< css::task::XInteractionContinuation > xAbort = ::ucbhelper::InterceptedInteraction::extractContinuation(
- xRequest->getContinuations(),
- ::getCppuType(static_cast< css::uno::Reference< css::task::XInteractionAbort >* >(0)));
- if (!xAbort.is())
- return ::ucbhelper::InterceptedInteraction::E_NO_CONTINUATION_FOUND;
- xAbort->select();
- return ::ucbhelper::InterceptedInteraction::E_INTERCEPTED;
- }
-
- // Otherwhise use internal handler.
- if (m_xInterceptedHandler.is())
- {
- m_bHandledByInternalHandler = sal_True;
- m_xInterceptedHandler->handle(xRequest);
- }
- return ::ucbhelper::InterceptedInteraction::E_INTERCEPTED;
- }
-};
/*-----------------------------------------------
25.03.2004 12:29
diff --git a/comphelper/source/misc/officerestartmanager.cxx b/comphelper/source/misc/officerestartmanager.cxx
new file mode 100644
index 000000000000..974b8d65e7ae
--- /dev/null
+++ b/comphelper/source/misc/officerestartmanager.cxx
@@ -0,0 +1,210 @@
+/*************************************************************************
+ *
+ * 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_comphelper.hxx"
+
+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
+#include <com/sun/star/awt/XRequestCallback.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <comphelper_module.hxx>
+#include "officerestartmanager.hxx"
+
+using namespace ::com::sun::star;
+
+namespace comphelper
+{
+
+// ----------------------------------------------------------
+uno::Sequence< ::rtl::OUString > SAL_CALL OOfficeRestartManager::getSupportedServiceNames_static()
+{
+ uno::Sequence< rtl::OUString > aResult( 1 );
+ aResult[0] = getServiceName_static();
+ return aResult;
+}
+
+// ----------------------------------------------------------
+::rtl::OUString SAL_CALL OOfficeRestartManager::getImplementationName_static()
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.task.OfficeRestartManager" ) );
+}
+
+// ----------------------------------------------------------
+::rtl::OUString SAL_CALL OOfficeRestartManager::getSingletonName_static()
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.OfficeRestartManager" ) );
+}
+
+// ----------------------------------------------------------
+::rtl::OUString SAL_CALL OOfficeRestartManager::getServiceName_static()
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.task.OfficeRestartManager" ) );
+}
+
+// ----------------------------------------------------------
+uno::Reference< uno::XInterface > SAL_CALL OOfficeRestartManager::Create( const uno::Reference< uno::XComponentContext >& rxContext )
+{
+ return static_cast< cppu::OWeakObject* >( new OOfficeRestartManager( rxContext ) );
+}
+
+// XRestartManager
+// ----------------------------------------------------------
+void SAL_CALL OOfficeRestartManager::requestRestart( const uno::Reference< task::XInteractionHandler >& /* xInteractionHandler */ )
+ throw (uno::Exception, uno::RuntimeException)
+{
+ if ( !m_xContext.is() )
+ throw uno::RuntimeException();
+
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ // if the restart already running there is no need to trigger it again
+ if ( m_bRestartRequested )
+ return;
+#ifndef MACOSX
+ m_bRestartRequested = sal_True;
+#endif
+ // the office is still not initialized, no need to terminate, changing the state is enough
+ if ( !m_bOfficeInitialized )
+ return;
+ }
+
+ // TODO: use InteractionHandler to report errors
+ try
+ {
+ // register itself as a job that should be executed asynchronously
+ uno::Reference< lang::XMultiComponentFactory > xFactory( m_xContext->getServiceManager(), uno::UNO_SET_THROW );
+
+ uno::Reference< awt::XRequestCallback > xRequestCallback(
+ xFactory->createInstanceWithContext(
+ ::rtl::OUString::createFromAscii("com.sun.star.awt.AsyncCallback"),
+ m_xContext ),
+ uno::UNO_QUERY_THROW );
+
+ xRequestCallback->addCallback( this, uno::Any() );
+ }
+ catch ( uno::Exception& )
+ {
+ // the try to request restart has failed
+ m_bRestartRequested = sal_False;
+ }
+}
+
+// ----------------------------------------------------------
+::sal_Bool SAL_CALL OOfficeRestartManager::isRestartRequested( ::sal_Bool bOfficeInitialized )
+ throw (uno::Exception, uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( bOfficeInitialized && !m_bOfficeInitialized )
+ m_bOfficeInitialized = bOfficeInitialized;
+
+ return m_bRestartRequested;
+}
+
+// XCallback
+// ----------------------------------------------------------
+void SAL_CALL OOfficeRestartManager::notify( const uno::Any& /* aData */ )
+ throw ( uno::RuntimeException )
+{
+ try
+ {
+ sal_Bool bSuccess = sal_False;
+
+ if ( m_xContext.is() )
+ {
+ uno::Reference< lang::XMultiComponentFactory > xFactory( m_xContext->getServiceManager(), uno::UNO_SET_THROW );
+ uno::Reference< frame::XDesktop > xDesktop(
+ xFactory->createInstanceWithContext(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ), m_xContext ),
+ uno::UNO_QUERY_THROW );
+
+ // Turn Quickstarter veto off
+ uno::Reference< beans::XPropertySet > xPropertySet( xDesktop, uno::UNO_QUERY_THROW );
+ ::rtl::OUString aVetoPropName( RTL_CONSTASCII_USTRINGPARAM( "SuspendQuickstartVeto" ) );
+ uno::Any aValue;
+ aValue <<= (sal_Bool)sal_True;
+ xPropertySet->setPropertyValue( aVetoPropName, aValue );
+
+ try
+ {
+ bSuccess = xDesktop->terminate();
+ } catch( uno::Exception& )
+ {}
+
+ if ( !bSuccess )
+ {
+ aValue <<= (sal_Bool)sal_False;
+ xPropertySet->setPropertyValue( aVetoPropName, aValue );
+ }
+ }
+
+ if ( !bSuccess )
+ m_bRestartRequested = sal_False;
+ }
+ catch( uno::Exception& )
+ {
+ // the try to restart has failed
+ m_bRestartRequested = sal_False;
+ }
+}
+
+// XServiceInfo
+// ----------------------------------------------------------
+::rtl::OUString SAL_CALL OOfficeRestartManager::getImplementationName() throw (uno::RuntimeException)
+{
+ return getImplementationName_static();
+}
+
+// ----------------------------------------------------------
+::sal_Bool SAL_CALL OOfficeRestartManager::supportsService( const ::rtl::OUString& aServiceName ) throw (uno::RuntimeException)
+{
+ const uno::Sequence< rtl::OUString > & aSupportedNames = getSupportedServiceNames_static();
+ for ( sal_Int32 nInd = 0; nInd < aSupportedNames.getLength(); nInd++ )
+ {
+ if ( aSupportedNames[ nInd ].equals( aServiceName ) )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+// ----------------------------------------------------------
+uno::Sequence< ::rtl::OUString > SAL_CALL OOfficeRestartManager::getSupportedServiceNames() throw (uno::RuntimeException)
+{
+ return getSupportedServiceNames_static();
+}
+
+} // namespace comphelper
+
+void createRegistryInfo_OOfficeRestartManager()
+{
+ static ::comphelper::module::OAutoRegistration< ::comphelper::OOfficeRestartManager > aAutoRegistration;
+ static ::comphelper::module::OSingletonRegistration< ::comphelper::OOfficeRestartManager > aSingletonRegistration;
+}
diff --git a/comphelper/source/misc/officerestartmanager.hxx b/comphelper/source/misc/officerestartmanager.hxx
new file mode 100644
index 000000000000..2317d0217060
--- /dev/null
+++ b/comphelper/source/misc/officerestartmanager.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 __OFFICESTARTMANAGER_HXX_
+#define __OFFICESTARTMANAGER_HXX_
+
+#include <com/sun/star/task/XRestartManager.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/awt/XCallback.hpp>
+
+#include <osl/mutex.hxx>
+#include <cppuhelper/implbase3.hxx>
+
+namespace comphelper
+{
+
+class OOfficeRestartManager : public ::cppu::WeakImplHelper3< ::com::sun::star::task::XRestartManager
+ , ::com::sun::star::awt::XCallback
+ , ::com::sun::star::lang::XServiceInfo >
+{
+ ::osl::Mutex m_aMutex;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+
+ sal_Bool m_bOfficeInitialized;
+ sal_Bool m_bRestartRequested;
+
+public:
+ OOfficeRestartManager( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext )
+ : m_xContext( xContext )
+ , m_bOfficeInitialized( sal_False )
+ , m_bRestartRequested( sal_False )
+ {}
+
+ virtual ~OOfficeRestartManager()
+ {}
+
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames_static();
+
+ static ::rtl::OUString SAL_CALL getImplementationName_static();
+
+ static ::rtl::OUString SAL_CALL getSingletonName_static();
+
+ static ::rtl::OUString SAL_CALL getServiceName_static();
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ Create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
+
+// XRestartManager
+ virtual void SAL_CALL requestRestart( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xInteractionHandler ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isRestartRequested( ::sal_Bool bInitialized ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+// XCallback
+ virtual void SAL_CALL notify( const ::com::sun::star::uno::Any& aData ) 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);
+
+};
+
+} // namespace comphelper
+
+#endif
+
diff --git a/comphelper/source/misc/stillreadwriteinteraction.cxx b/comphelper/source/misc/stillreadwriteinteraction.cxx
new file mode 100644
index 000000000000..9054f0754b5e
--- /dev/null
+++ b/comphelper/source/misc/stillreadwriteinteraction.cxx
@@ -0,0 +1,144 @@
+/*************************************************************************
+*
+* 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_comphelper.hxx"
+#include <comphelper/stillreadwriteinteraction.hxx>
+
+#ifndef __COM_SUN_STAR_UCB_INTERACTIVEIOEXCEPTION_HPP__
+#include <com/sun/star/ucb/InteractiveIOException.hpp>
+#endif
+
+#ifndef __COM_SUN_STAR_TASK_XINTERACTIONABORT_HPP__
+#include <com/sun/star/task/XInteractionAbort.hpp>
+#endif
+
+#ifndef __COM_SUN_STAR_UCB_UNSUPPORTEDDATASINKEXCEPTION_HPP__
+#include <com/sun/star/ucb/UnsupportedDataSinkException.hpp>
+#endif
+
+namespace comphelper{
+
+ namespace css = ::com::sun::star;
+
+StillReadWriteInteraction::StillReadWriteInteraction(const css::uno::Reference< css::task::XInteractionHandler >& xHandler)
+ : m_bUsed (sal_False)
+ , m_bHandledByMySelf (sal_False)
+ , m_bHandledByInternalHandler(sal_False)
+{
+ ::std::vector< ::ucbhelper::InterceptedInteraction::InterceptedRequest > lInterceptions;
+ ::ucbhelper::InterceptedInteraction::InterceptedRequest aInterceptedRequest;
+
+ aInterceptedRequest.Handle = HANDLE_INTERACTIVEIOEXCEPTION;
+ aInterceptedRequest.Request <<= css::ucb::InteractiveIOException();
+ aInterceptedRequest.Continuation = ::getCppuType(static_cast< css::uno::Reference< css::task::XInteractionAbort >* >(0));
+ aInterceptedRequest.MatchExact = sal_False;
+ lInterceptions.push_back(aInterceptedRequest);
+
+ aInterceptedRequest.Handle = HANDLE_UNSUPPORTEDDATASINKEXCEPTION;
+ aInterceptedRequest.Request <<= css::ucb::UnsupportedDataSinkException();
+ aInterceptedRequest.Continuation = ::getCppuType(static_cast< css::uno::Reference< css::task::XInteractionAbort >* >(0));
+ aInterceptedRequest.MatchExact = sal_False;
+ lInterceptions.push_back(aInterceptedRequest);
+
+ setInterceptedHandler(xHandler);
+ setInterceptions(lInterceptions);
+}
+
+void StillReadWriteInteraction::resetInterceptions()
+{
+ setInterceptions(::std::vector< ::ucbhelper::InterceptedInteraction::InterceptedRequest >());
+}
+
+void StillReadWriteInteraction::resetErrorStates()
+{
+ m_bUsed = sal_False;
+ m_bHandledByMySelf = sal_False;
+ m_bHandledByInternalHandler = sal_False;
+}
+
+sal_Bool StillReadWriteInteraction::wasWriteError()
+{
+ return (m_bUsed && m_bHandledByMySelf);
+}
+
+ucbhelper::InterceptedInteraction::EInterceptionState StillReadWriteInteraction::intercepted(const ::ucbhelper::InterceptedInteraction::InterceptedRequest& aRequest,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest)
+{
+ // we are used!
+ m_bUsed = sal_True;
+
+ // check if its a real interception - might some parameters are not the right ones ...
+ sal_Bool bAbort = sal_False;
+ switch(aRequest.Handle)
+ {
+ case HANDLE_INTERACTIVEIOEXCEPTION:
+ {
+ css::ucb::InteractiveIOException exIO;
+ xRequest->getRequest() >>= exIO;
+ bAbort = (
+ (exIO.Code == css::ucb::IOErrorCode_ACCESS_DENIED )
+ || (exIO.Code == css::ucb::IOErrorCode_LOCKING_VIOLATION )
+ || (exIO.Code == css::ucb::IOErrorCode_NOT_EXISTING )
+#ifdef MACOSX
+ // this is a workaround for MAC, on this platform if the file is locked
+ // the returned error code looks to be wrong
+ || (exIO.Code == css::ucb::IOErrorCode_GENERAL )
+#endif
+ );
+ }
+ break;
+
+ case HANDLE_UNSUPPORTEDDATASINKEXCEPTION:
+ {
+ bAbort = sal_True;
+ }
+ break;
+ }
+
+ // handle interaction by ourself
+ if (bAbort)
+ {
+ m_bHandledByMySelf = sal_True;
+ css::uno::Reference< css::task::XInteractionContinuation > xAbort = ::ucbhelper::InterceptedInteraction::extractContinuation(
+ xRequest->getContinuations(),
+ ::getCppuType(static_cast< css::uno::Reference< css::task::XInteractionAbort >* >(0)));
+ if (!xAbort.is())
+ return ::ucbhelper::InterceptedInteraction::E_NO_CONTINUATION_FOUND;
+ xAbort->select();
+ return ::ucbhelper::InterceptedInteraction::E_INTERCEPTED;
+ }
+
+ // Otherwhise use internal handler.
+ if (m_xInterceptedHandler.is())
+ {
+ m_bHandledByInternalHandler = sal_True;
+ m_xInterceptedHandler->handle(xRequest);
+ }
+ return ::ucbhelper::InterceptedInteraction::E_INTERCEPTED;
+}
+}
diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx
index eda42ec98abb..e2557523f674 100644
--- a/comphelper/source/misc/storagehelper.cxx
+++ b/comphelper/source/misc/storagehelper.cxx
@@ -328,12 +328,19 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromURL(
const ::rtl::OUString& aFormat,
const ::rtl::OUString& aURL,
sal_Int32 nStorageMode,
- const uno::Reference< lang::XMultiServiceFactory >& xFactory )
+ const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+ sal_Bool bRepairStorage )
throw ( uno::Exception )
{
uno::Sequence< beans::PropertyValue > aProps( 1 );
aProps[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StorageFormat" ) );
aProps[0].Value <<= aFormat;
+ if ( bRepairStorage )
+ {
+ aProps.realloc( 2 );
+ aProps[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RepairPackage" ) );
+ aProps[1].Value <<= bRepairStorage;
+ }
uno::Sequence< uno::Any > aArgs( 3 );
aArgs[0] <<= aURL;
@@ -352,12 +359,19 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromURL(
uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromInputStream(
const ::rtl::OUString& aFormat,
const uno::Reference < io::XInputStream >& xStream,
- const uno::Reference< lang::XMultiServiceFactory >& xFactory )
+ const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+ sal_Bool bRepairStorage )
throw ( uno::Exception )
{
uno::Sequence< beans::PropertyValue > aProps( 1 );
aProps[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StorageFormat" ) );
aProps[0].Value <<= aFormat;
+ if ( bRepairStorage )
+ {
+ aProps.realloc( 2 );
+ aProps[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RepairPackage" ) );
+ aProps[1].Value <<= bRepairStorage;
+ }
uno::Sequence< uno::Any > aArgs( 3 );
aArgs[0] <<= xStream;
@@ -377,12 +391,19 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromStream(
const ::rtl::OUString& aFormat,
const uno::Reference < io::XStream >& xStream,
sal_Int32 nStorageMode,
- const uno::Reference< lang::XMultiServiceFactory >& xFactory )
+ const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+ sal_Bool bRepairStorage )
throw ( uno::Exception )
{
uno::Sequence< beans::PropertyValue > aProps( 1 );
aProps[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StorageFormat" ) );
aProps[0].Value <<= aFormat;
+ if ( bRepairStorage )
+ {
+ aProps.realloc( 2 );
+ aProps[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RepairPackage" ) );
+ aProps[1].Value <<= bRepairStorage;
+ }
uno::Sequence< uno::Any > aArgs( 3 );
aArgs[0] <<= xStream;
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index e6fb12cb2003..1423cd42ed93 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -41,7 +41,6 @@
#include <cppcanvas/canvas.hxx>
#include <com/sun/star/rendering/XGraphicDevice.hpp>
#include <com/sun/star/rendering/TexturingMode.hpp>
-#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/geometry/RealPoint2D.hpp>
#include <com/sun/star/rendering/ViewState.hpp>
@@ -52,6 +51,7 @@
#include <com/sun/star/rendering/PathCapType.hpp>
#include <com/sun/star/rendering/PathJoinType.hpp>
#include <basegfx/tools/canvastools.hxx>
+#include <basegfx/tools/gradienttools.hxx>
#include <basegfx/numeric/ftools.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
@@ -591,13 +591,12 @@ namespace cppcanvas
// discernible difference should be visible.
nSteps > 64 )
{
- uno::Reference< rendering::XParametricPolyPolygon2DFactory > xFactory(
+ uno::Reference< lang::XMultiServiceFactory> xFactory(
rParms.mrCanvas->getUNOCanvas()->getDevice()->getParametricPolyPolygonFactory() );
if( xFactory.is() )
{
- ::basegfx::B2DHomMatrix aTextureTransformation;
- rendering::Texture aTexture;
+ rendering::Texture aTexture;
aTexture.RepeatModeX = rendering::TexturingMode::CLAMP;
aTexture.RepeatModeY = rendering::TexturingMode::CLAMP;
@@ -632,240 +631,118 @@ namespace cppcanvas
uno::Sequence< uno::Sequence < double > > aColors(2);
uno::Sequence< double > aStops(2);
- aStops[0] = 0.0;
- aStops[1] = 1.0;
+ if( rGradient.GetStyle() == GRADIENT_AXIAL )
+ {
+ aStops.realloc(3);
+ aColors.realloc(3);
- aColors[0] = aStartColor;
- aColors[1] = aEndColor;
+ aStops[0] = 0.0;
+ aStops[1] = 0.5;
+ aStops[2] = 1.0;
+ aColors[0] = aEndColor;
+ aColors[1] = aStartColor;
+ aColors[2] = aEndColor;
+ }
+ else
+ {
+ aStops[0] = 0.0;
+ aStops[1] = 1.0;
- // Setup texture transformation
- // ----------------------------
+ aColors[0] = aStartColor;
+ aColors[1] = aEndColor;
+ }
const ::basegfx::B2DRectangle aBounds(
::basegfx::tools::getRange(aDevicePoly) );
+ const ::basegfx::B2DVector aOffset(
+ rGradient.GetOfsX() / 100.0,
+ rGradient.GetOfsY() / 100.0);
+ double fRotation( rGradient.GetAngle() * M_PI / 1800.0 );
+ const double fBorder( rGradient.GetBorder() / 100.0 );
- // setup rotation angle. VCL rotates
- // counter-clockwise, while canvas transformation
- // rotates clockwise
- double nRotation( -rGradient.GetAngle() * M_PI / 1800.0 );
+ basegfx::B2DHomMatrix aRot90;
+ aRot90.rotate(M_PI_2);
+ basegfx::ODFGradientInfo aGradInfo;
+ rtl::OUString aGradientService;
switch( rGradient.GetStyle() )
{
case GRADIENT_LINEAR:
- // FALLTHROUGH intended
+ basegfx::tools::createLinearODFGradientInfo(aGradInfo,
+ aBounds,
+ nSteps,
+ fBorder,
+ fRotation);
+ // map odf to svg gradient orientation - x
+ // instead of y direction
+ aGradInfo.maTextureTransform = aGradInfo.maTextureTransform * aRot90;
+ aGradientService = rtl::OUString::createFromAscii("LinearGradient");
+ break;
+
case GRADIENT_AXIAL:
{
- // standard orientation for VCL linear
- // gradient is vertical, thus, rotate 90
- // degrees
- nRotation += M_PI/2.0;
-
- const double nBorder(
- ::basegfx::pruneScaleValue(
- (1.0 - rGradient.GetBorder() / 100.0) ) );
-
- // shrink texture, to account for border
- // (only in x direction, linear gradient
- // is constant in y direction, anyway)
- aTextureTransformation.scale( nBorder,
- 1.0 );
-
- // linear gradients don't respect offsets
- // (they are implicitely assumed to be
- // 50%). linear gradients don't have
- // border on both sides, only on the
- // startColor side, axial gradients have
- // border on both sides. As both gradients
- // are invariant in y direction: leave y
- // offset alone.
- double nOffsetX( rGradient.GetBorder() / 200.0 );
-
- // determine type of gradient (and necessary
- // transformation matrix, should it be emulated by a
- // generic gradient)
- switch( rGradient.GetStyle() )
- {
- case GRADIENT_LINEAR:
- nOffsetX = rGradient.GetBorder() / 100.0;
- aTexture.Gradient = xFactory->createLinearHorizontalGradient( aColors,
- aStops );
- break;
-
- case GRADIENT_AXIAL:
- // vcl considers center color as start color
- ::std::swap(aColors[0],aColors[1]);
- aTexture.Gradient = xFactory->createAxialHorizontalGradient( aColors,
- aStops );
- break;
-
- default: // other cases can't happen
- break;
- }
-
- // apply border offset values
- aTextureTransformation.translate( nOffsetX,
- 0.0 );
-
- // rotate texture according to gradient rotation
- aTextureTransformation.translate( -0.5, -0.5 );
- aTextureTransformation.rotate( nRotation );
-
- // to let the first strip of a rotated
- // gradient start at the _edge_ of the
- // bound rect (and not, due to rotation,
- // slightly inside), slightly enlarge the
- // gradient:
- //
- // y/2 sin(alpha) + x/2 cos(alpha)
- //
- // (values to change are not actual
- // gradient scales, but original bound
- // rect dimensions. Since we still want
- // the border setting to apply after that,
- // we multiply with that as above for
- // nScaleX)
- const double nScale(
- ::basegfx::pruneScaleValue(
- fabs( aBounds.getHeight()*sin(nRotation) ) +
- fabs( aBounds.getWidth()*cos(nRotation) )));
-
- // scale and translate back origin to center of
- // primitive
- aTextureTransformation = basegfx::tools::createScaleTranslateB2DHomMatrix(
- nScale, nScale, 0.5*aBounds.getWidth(), 0.5*aBounds.getHeight())
- * aTextureTransformation;
+ basegfx::tools::createLinearODFGradientInfo(aGradInfo,
+ aBounds,
+ nSteps,
+ fBorder,
+ fRotation);
+ // map odf to svg gradient orientation - x
+ // instead of y direction
+ aGradInfo.maTextureTransform = aGradInfo.maTextureTransform * aRot90;
+
+ // map odf axial gradient to 3-stop linear
+ // gradient - shift left by 0.5
+ basegfx::B2DHomMatrix aShift;
+ aShift.translate(-0.5,0);
+ aGradInfo.maTextureTransform = aGradInfo.maTextureTransform * aShift;
+
+ aGradientService = rtl::OUString::createFromAscii("LinearGradient");
+ break;
}
- break;
case GRADIENT_RADIAL:
- // FALLTHROUGH intended
- case GRADIENT_ELLIPTICAL:
- // FALLTHROUGH intended
- case GRADIENT_SQUARE:
- // FALLTHROUGH intended
- case GRADIENT_RECT:
- {
- // determine scale factors for the gradient (must
- // be scaled up from [0,1]x[0,1] rect to object
- // bounds). Will potentially changed in switch
- // statement below.
- // Respect border value, while doing so, the VCL
- // gradient's border will effectively shrink the
- // resulting gradient.
- double nScaleX( aBounds.getWidth() * (1.0 - rGradient.GetBorder() / 100.0) );
- double nScaleY( aBounds.getHeight()* (1.0 - rGradient.GetBorder() / 100.0) );
-
- // determine offset values. Since the border is
- // divided half-by-half to both sides of the
- // gradient, divide translation offset by an
- // additional 2. Also respect offset here, but
- // since VCL gradients have their center at [0,0]
- // for zero offset, but canvas gradients have
- // their top, left edge aligned with the
- // primitive, and offset of 50% effectively must
- // yield zero shift. Both values will potentially
- // be adapted in switch statement below.
- double nOffsetX( aBounds.getWidth() *
- (2.0 * rGradient.GetOfsX() - 100.0 + rGradient.GetBorder()) / 200.0 );
- double nOffsetY( aBounds.getHeight() *
- (2.0 * rGradient.GetOfsY() - 100.0 + rGradient.GetBorder()) / 200.0 );
-
- // determine type of gradient (and necessary
- // transformation matrix, should it be emulated by a
- // generic gradient)
- switch( rGradient.GetStyle() )
- {
- case GRADIENT_RADIAL:
- {
- // create isotrophic scaling
- if( nScaleX > nScaleY )
- {
- nOffsetY -= (nScaleX - nScaleY) * 0.5;
- nScaleY = nScaleX;
- }
- else
- {
- nOffsetX -= (nScaleY - nScaleX) * 0.5;
- nScaleX = nScaleY;
- }
-
- // enlarge gradient to match bound rect diagonal
- aTextureTransformation.translate( -0.5, -0.5 );
- const double nScale( hypot(aBounds.getWidth(), aBounds.getHeight()) / nScaleX );
- aTextureTransformation.scale( nScale, nScale );
- aTextureTransformation.translate( 0.5, 0.5 );
-
- aTexture.Gradient = xFactory->createEllipticalGradient( aColors,
- aStops,
- geometry::RealRectangle2D(0.0,0.0,
- 1.0,1.0) );
- }
- break;
-
- case GRADIENT_ELLIPTICAL:
- {
- // enlarge gradient slightly
- aTextureTransformation.translate( -0.5, -0.5 );
- const double nSqrt2( sqrt(2.0) );
- aTextureTransformation.scale( nSqrt2,nSqrt2 );
- aTextureTransformation.translate( 0.5, 0.5 );
-
- aTexture.Gradient = xFactory->createEllipticalGradient(
- aColors,
- aStops,
- ::basegfx::unotools::rectangle2DFromB2DRectangle(
- aBounds ));
- }
- break;
-
- case GRADIENT_SQUARE:
- // create isotrophic scaling
- if( nScaleX > nScaleY )
- {
- nOffsetY -= (nScaleX - nScaleY) * 0.5;
- nScaleY = nScaleX;
- }
- else
- {
- nOffsetX -= (nScaleY - nScaleX) * 0.5;
- nScaleX = nScaleY;
- }
-
- aTexture.Gradient = xFactory->createRectangularGradient( aColors,
- aStops,
- geometry::RealRectangle2D(0.0,0.0,
- 1.0,1.0) );
- break;
-
- case GRADIENT_RECT:
- aTexture.Gradient = xFactory->createRectangularGradient(
- aColors,
- aStops,
- ::basegfx::unotools::rectangle2DFromB2DRectangle(
- aBounds ) );
- break;
-
- default: // other cases can't happen
- break;
- }
-
- nScaleX = ::basegfx::pruneScaleValue( nScaleX );
- nScaleY = ::basegfx::pruneScaleValue( nScaleY );
+ basegfx::tools::createRadialODFGradientInfo(aGradInfo,
+ aBounds,
+ aOffset,
+ nSteps,
+ fBorder);
+ aGradientService = rtl::OUString::createFromAscii("EllipticalGradient");
+ break;
- aTextureTransformation.scale( nScaleX, nScaleY );
+ case GRADIENT_ELLIPTICAL:
+ basegfx::tools::createEllipticalODFGradientInfo(aGradInfo,
+ aBounds,
+ aOffset,
+ nSteps,
+ fBorder,
+ fRotation);
+ aGradientService = rtl::OUString::createFromAscii("EllipticalGradient");
+ break;
- // rotate texture according to gradient rotation
- aTextureTransformation = basegfx::tools::createRotateAroundPoint(0.5*nScaleX, 0.5*nScaleY, nRotation)
- * aTextureTransformation;
+ case GRADIENT_SQUARE:
+ basegfx::tools::createSquareODFGradientInfo(aGradInfo,
+ aBounds,
+ aOffset,
+ nSteps,
+ fBorder,
+ fRotation);
+ aGradientService = rtl::OUString::createFromAscii("RectangularGradient");
+ break;
- aTextureTransformation.translate( nOffsetX, nOffsetY );
- }
- break;
+ case GRADIENT_RECT:
+ basegfx::tools::createRectangularODFGradientInfo(aGradInfo,
+ aBounds,
+ aOffset,
+ nSteps,
+ fBorder,
+ fRotation);
+ aGradientService = rtl::OUString::createFromAscii("RectangularGradient");
+ break;
default:
ENSURE_OR_THROW( false,
- "ImplRenderer::createGradientAction(): Unexpected gradient type" );
+ "ImplRenderer::createGradientAction(): Unexpected gradient type" );
break;
}
@@ -876,31 +753,49 @@ namespace cppcanvas
// gradient will always display at the origin, and
// not within the polygon bound (which might be
// miles away from the origin).
- aTextureTransformation.translate( aBounds.getMinX(),
- aBounds.getMinY() );
-
+ aGradInfo.maTextureTransform.translate( aBounds.getMinX(),
+ aBounds.getMinY() );
::basegfx::unotools::affineMatrixFromHomMatrix( aTexture.AffineTransform,
- aTextureTransformation );
+ aGradInfo.maTextureTransform );
+
+ uno::Sequence<uno::Any> args(3);
+ beans::PropertyValue aProp;
+ aProp.Name = rtl::OUString::createFromAscii("Colors");
+ aProp.Value <<= aColors;
+ args[0] <<= aProp;
+ aProp.Name = rtl::OUString::createFromAscii("Stops");
+ aProp.Value <<= aStops;
+ args[1] <<= aProp;
+ aProp.Name = rtl::OUString::createFromAscii("AspectRatio");
+ aProp.Value <<= aGradInfo.mfAspectRatio;
+ args[2] <<= aProp;
+
+ aTexture.Gradient.set(
+ xFactory->createInstanceWithArguments(aGradientService,
+ args),
+ uno::UNO_QUERY);
+ if( aTexture.Gradient.is() )
+ {
+ ActionSharedPtr pPolyAction(
+ internal::PolyPolyActionFactory::createPolyPolyAction(
+ aDevicePoly,
+ rParms.mrCanvas,
+ getState( rParms.mrStates ),
+ aTexture ) );
- ActionSharedPtr pPolyAction(
- internal::PolyPolyActionFactory::createPolyPolyAction(
- aDevicePoly,
- rParms.mrCanvas,
- getState( rParms.mrStates ),
- aTexture ) );
+ if( pPolyAction )
+ {
+ maActions.push_back(
+ MtfAction(
+ pPolyAction,
+ rParms.mrCurrActionIndex ) );
- if( pPolyAction )
- {
- maActions.push_back(
- MtfAction(
- pPolyAction,
- rParms.mrCurrActionIndex ) );
+ rParms.mrCurrActionIndex += pPolyAction->getActionCount()-1;
+ }
- rParms.mrCurrActionIndex += pPolyAction->getActionCount()-1;
+ // done, using native gradients
+ return;
}
-
- // done, using native gradients
- return;
}
}
@@ -1880,8 +1775,8 @@ namespace cppcanvas
}
else
{
- aTexture.RepeatModeX = rendering::TexturingMode::CLAMP;
- aTexture.RepeatModeY = rendering::TexturingMode::CLAMP;
+ aTexture.RepeatModeX = rendering::TexturingMode::NONE;
+ aTexture.RepeatModeY = rendering::TexturingMode::NONE;
}
::PolyPolygon aPath;
diff --git a/dtrans/source/generic/exports.map b/dtrans/source/generic/exports.map
deleted file mode 100644
index 28449cc0f4a8..000000000000
--- a/dtrans/source/generic/exports.map
+++ /dev/null
@@ -1,9 +0,0 @@
-DTRANS_1_0 {
- global:
- component_getImplementationEnvironment;
- component_writeInfo;
- component_getFactory;
- local:
- *;
-};
-
diff --git a/dtrans/source/generic/makefile.mk b/dtrans/source/generic/makefile.mk
index c1afa848d7ed..e015400c32d9 100644
--- a/dtrans/source/generic/makefile.mk
+++ b/dtrans/source/generic/makefile.mk
@@ -46,7 +46,7 @@ SLOFILES= \
SHL1TARGET= dtrans
-SHL1VERSIONMAP= exports.map
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
SHL1STDLIBS= \
$(SALLIB) \
diff --git a/dtrans/util/exports.map b/dtrans/util/exports.map
deleted file mode 100644
index 7c56baa9bd73..000000000000
--- a/dtrans/util/exports.map
+++ /dev/null
@@ -1,10 +0,0 @@
-UDK_3_0_0 {
- global:
- GetVersionInfo;
- component_getImplementationEnvironment;
- component_getFactory;
- component_writeInfo;
-
- local:
- *;
-};
diff --git a/dtrans/util/makefile.mk b/dtrans/util/makefile.mk
index 921f4458b43c..0443c131ccb6 100644
--- a/dtrans/util/makefile.mk
+++ b/dtrans/util/makefile.mk
@@ -64,7 +64,7 @@ SHL1IMPLIB=i$(SHL1TARGET)
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
DEF1EXPORTFILE= exports.dxp
-SHL1VERSIONMAP=exports.map
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
.IF "$(GUI)"=="WNT"
diff --git a/i18npool/inc/i18npool/lang.h b/i18npool/inc/i18npool/lang.h
index 8599ec75c634..52e4e51d7a41 100644
--- a/i18npool/inc/i18npool/lang.h
+++ b/i18npool/inc/i18npool/lang.h
@@ -512,5 +512,9 @@ typedef unsigned short LanguageType;
#define LANGUAGE_USER_SARDINIAN_LOGUDORESE 0x0652
#define LANGUAGE_USER_SARDINIAN_SASSARESE 0x0653
#define LANGUAGE_USER_BAFIA 0x0654
+#define LANGUAGE_USER_GIKUYU 0x0655
+#define LANGUAGE_USER_RUSYN_UKRAINE 0x0656
+#define LANGUAGE_USER_RUSYN_SLOVAKIA 0x8256 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_RUSYN_UKRAINE)) */
+
#endif /* INCLUDED_I18NPOOL_LANG_H */
diff --git a/i18npool/inc/transliteration_body.hxx b/i18npool/inc/transliteration_body.hxx
index a03b61a90194..3d474a0a53dc 100644
--- a/i18npool/inc/transliteration_body.hxx
+++ b/i18npool/inc/transliteration_body.hxx
@@ -90,6 +90,31 @@ public:
};
#endif
+
+#if defined( TRANSLITERATION_ALL )
+class Transliteration_togglecase : public Transliteration_body
+{
+public:
+ Transliteration_togglecase();
+};
+
+class Transliteration_titlecase : public Transliteration_body
+{
+public:
+ Transliteration_titlecase();
+
+ virtual rtl::OUString SAL_CALL transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset ) throw(com::sun::star::uno::RuntimeException);
+};
+
+class Transliteration_sentencecase : public Transliteration_body
+{
+public:
+ Transliteration_sentencecase();
+
+ virtual rtl::OUString SAL_CALL transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset ) throw(com::sun::star::uno::RuntimeException);
+};
+#endif
+
} } } }
#endif
diff --git a/i18npool/source/breakiterator/data/char_in.txt b/i18npool/source/breakiterator/data/char_in.txt
index 72c4a44720cd..5e1ed67596c0 100644
--- a/i18npool/source/breakiterator/data/char_in.txt
+++ b/i18npool/source/breakiterator/data/char_in.txt
@@ -1,48 +1,108 @@
#
-# Copyright (C) 2002-2003, International Business Machines Corporation and others.
+# Copyright (C) 2002-2009, International Business Machines Corporation and others.
# All Rights Reserved.
#
# file: char.txt
#
# ICU Character Break Rules, also known as Grapheme Cluster Boundaries
# See Unicode Standard Annex #29.
-# These rules are based on TR29 Version 4.0.0
+# These rules are based on TR29 Revision 13, for Unicode Version 5.1
#
#
# Character Class Definitions.
-# The names are those from TR29.
#
-$CR = \r;
-$LF = \n;
-$Control = [[:Zl:] [:Zp:] [:Cc:] [:Cf:]];
-
-# add Japanese Half Width voicing marks to $Extend
-$VoiceMarks = [\uff9e\uff9f];
-$cmcextend = [ \u0903 \u093e-\u0940 \u0949-\u094C \u09bf-\u09c0 \u09c7-\u09c8 \u09cb-\u09cc \u0bc1-\u0bc2 \u0bc6-\u0bc8 \u0bca-\u0bcc \u0c01-\u0c03 \u0c41-\u0c44];
-$Extend = [[:Grapheme_Extend = TRUE:] $VoiceMarks $cmcextend];
+$CR = [\p{Grapheme_Cluster_Break = CR}];
+$LF = [\p{Grapheme_Cluster_Break = LF}];
+$Control = [\p{Grapheme_Cluster_Break = Control}];
+$Prepend = [\p{Grapheme_Cluster_Break = Prepend}];
+$Extend = [\p{Grapheme_Cluster_Break = Extend}];
+$SpacingMark = [\p{Grapheme_Cluster_Break = SpacingMark}];
+$BengaliLetter = [\u0985-\u09B9 \u09CE \u09DC-\u09E1 \u09F0-\u09F1];
+$BengaliSignVirama = \u09CD;
+$GujaratiLetter = [\u0A85-\u0A8C \u0A8F-\u0A90 \u0A93-\u0AB9 \u0AE0-\u0AE1];
+$GujaratiSignVirama = \u0ACD;
+$DevanagariLetter = [\u0904-\u0939 \u0958-\u0961 \u0972-\u097F];
+$DevanagariSignVirama = \u094D;
+$KannadaLetter = [\u0C85-\u0CB9 \u0CDE-\u0CE1];
+$KannadaSignVirama = \u0CCD;
+$MalayalamLetter = [\u0D05-\u0D39 \u0D60-\u0D61 \u0D7A-\u0D7F];
+$MalayalamSignVirama = \u0D4D;
+$OriyaLetter = [\u0B05-\u0B39 \u0B5C-\u0B61 \u0B71];
+$OriyaSignVirama = \u0B4D;
+$GurmukhiLetter = [\u0A05-\u0A39 \u0A59-\u0A5E];
+$GurmukhiSignVirama = \u0A4D;
+$TamilLetter = [\u0B85-\u0BB9];
+$TamilSignVirama = \u0BCD;
+$TeluguLetter = [\u0C05-\u0C39 \u0C58-\u0C61];
+$TeluguSignVirama = \u0C4D;
#
# Korean Syllable Definitions
#
-$L = [:Hangul_Syllable_Type = L:];
-$V = [:Hangul_Syllable_Type = V:];
-$T = [:Hangul_Syllable_Type = T:];
+$L = [\p{Grapheme_Cluster_Break = L}];
+$V = [\p{Grapheme_Cluster_Break = V}];
+$T = [\p{Grapheme_Cluster_Break = T}];
-$LV = [:Hangul_Syllable_Type = LV:];
-$LVT = [:Hangul_Syllable_Type = LVT:];
+$LV = [\p{Grapheme_Cluster_Break = LV}];
+$LVT = [\p{Grapheme_Cluster_Break = LVT}];
-$HangulSyllable = $L+ | ($L* ($LV? $V+ | $LV | $LVT) $T*) | $T+;
-#
-# Forward Break Rules
-#
+## -------------------------------------------------
+!!chain;
+
+!!forward;
+
$CR $LF;
-([^$Control] | $HangulSyllable) $Extend*;
-.;
+$BengaliLetter ($BengaliSignVirama $BengaliLetter?)+;
+$GujaratiLetter ($GujaratiSignVirama $GujaratiLetter?)+;
+$DevanagariLetter ($DevanagariSignVirama $DevanagariLetter?)+;
+$KannadaLetter ($KannadaSignVirama $KannadaLetter?)+;
+$MalayalamLetter ($MalayalamSignVirama $MalayalamLetter?)+;
+$OriyaLetter ($OriyaSignVirama $OriyaLetter?)+;
+$GurmukhiLetter ($GurmukhiSignVirama $GurmukhiLetter?)+;
+$TamilLetter ($TamilSignVirama $TamilLetter?)+;
+$TeluguLetter ($TeluguSignVirama $TeluguLetter?)+;
+
+$L ($L | $V | $LV | $LVT);
+($LV | $V) ($V | $T);
+($LVT | $T) $T;
+
+[^$Control $CR $LF] $Extend;
+
+[^$Control $CR $LF] $SpacingMark;
+$Prepend [^$Control $CR $LF];
+
+
+## -------------------------------------------------
+
+!!reverse;
+$LF $CR;
+($BengaliLetter? $BengaliSignVirama)+ $BengaliLetter;
+($GujaratiLetter? $GujaratiSignVirama)+ $GujaratiLetter;
+($DevanagariLetter? $DevanagariSignVirama)+ $DevanagariLetter;
+($KannadaLetter? $KannadaSignVirama)+ $KannadaLetter;
+($MalayalamLetter? $MalayalamSignVirama)+ $MalayalamLetter;
+($OriyaLetter? $OriyaSignVirama)+ $OriyaLetter;
+($GurmukhiLetter? $GurmukhiSignVirama)+ $GurmukhiLetter;
+($TamilLetter? $TamilSignVirama)+ $TamilLetter;
+($TeluguLetter? $TeluguSignVirama)+ $TeluguLetter;
+($L | $V | $LV | $LVT) $L;
+($V | $T) ($LV | $V);
+$T ($LVT | $T);
+
+$Extend [^$Control $CR $LF];
+$SpacingMark [^$Control $CR $LF];
+[^$Control $CR $LF] $Prepend;
+
+
+## -------------------------------------------------
+
+!!safe_reverse;
+
+
+## -------------------------------------------------
+
+!!safe_forward;
-#
-# Reverse Rule, back up to the beginning of some preceding grapheme cluster.
-#
-! ($Extend | $V | $T )* ($LF $CR | ($LV | $LVT)?$L* | .);
diff --git a/i18npool/source/breakiterator/data/dict.map b/i18npool/source/breakiterator/data/dict.map
index 271ba8b2b83c..ebd4f9185d1f 100644
--- a/i18npool/source/breakiterator/data/dict.map
+++ b/i18npool/source/breakiterator/data/dict.map
@@ -1,4 +1,4 @@
-OOO_1.1 {
+UDK_3_0_0 {
global:
GetVersionInfo;
getDataArea;
diff --git a/i18npool/source/breakiterator/data/dict_word.txt b/i18npool/source/breakiterator/data/dict_word.txt
index 367a82db9e6f..f69f038e7f7e 100644
--- a/i18npool/source/breakiterator/data/dict_word.txt
+++ b/i18npool/source/breakiterator/data/dict_word.txt
@@ -35,7 +35,7 @@ $ALetter = [\u0002 [:Alphabetic:] [:name= COMMERCIAL AT:] [:name= HEBREW PUNCT
$MidLetter = [[:name = APOSTROPHE:] [:name = GRAVE ACCENT:] \u0084 [:name = SOFT HYPHEN:] [:name = MIDDLE DOT:] [:name = GREEK TONOS:] [:name= FULL STOP:]
[:name = HEBREW PUNCTUATION GERSHAYIM:] [:name = DOUBLE VERTICAL LINE:] [:name = LEFT SINGLE QUOTATION MARK:]
[:name = RIGHT SINGLE QUOTATION MARK:] [:name = HYPHENATION POINT:] [:name = PRIME:]
- [:name = HYPHEN-MINUS:] [:name = EN DASH:] [:name = EM DASH:] ];
+ [:name = HYPHEN-MINUS:] ];
$SufixLetter = [:name= FULL STOP:];
diff --git a/i18npool/source/breakiterator/data/dict_word_prepostdash.txt b/i18npool/source/breakiterator/data/dict_word_prepostdash.txt
index 1bf94451fae2..0a60cc5d4924 100644
--- a/i18npool/source/breakiterator/data/dict_word_prepostdash.txt
+++ b/i18npool/source/breakiterator/data/dict_word_prepostdash.txt
@@ -27,7 +27,7 @@ $Hangul = [:Script = HANGUL:];
# list of dashes or hyphens that should be accepted as part of the word if a single one of these
# pre- or postfixes a word. E.g. in German: "Arbeits-" or "-nehmer" where that hyphen needs to
# be part of the word in order to have it properly spell checked etc.
-$PrePostDashHyphen = [ [:name = HYPHEN-MINUS:] [:name = EN DASH:] [:name = EM DASH:] ];
+$PrePostDashHyphen = [ [:name = HYPHEN-MINUS:] ];
$ALetter = [\u0002 [:Alphabetic:] [:name= COMMERCIAL AT:] [:name= HEBREW PUNCTUATION GERESH:]
@@ -41,7 +41,7 @@ $ALetter = [\u0002 [:Alphabetic:] [:name= COMMERCIAL AT:] [:name= HEBREW PUNCT
$MidLetter = [[:name = APOSTROPHE:] [:name = GRAVE ACCENT:] \u0084 [:name = SOFT HYPHEN:] [:name = MIDDLE DOT:] [:name = GREEK TONOS:] [:name= FULL STOP:]
[:name = HEBREW PUNCTUATION GERSHAYIM:] [:name = DOUBLE VERTICAL LINE:] [:name = LEFT SINGLE QUOTATION MARK:]
[:name = RIGHT SINGLE QUOTATION MARK:] [:name = HYPHENATION POINT:] [:name = PRIME:]
- [:name = HYPHEN-MINUS:] [:name = EN DASH:] [:name = EM DASH:] ];
+ [:name = HYPHEN-MINUS:] ];
$SufixLetter = [:name= FULL STOP:];
diff --git a/i18npool/source/breakiterator/data/ja.dic b/i18npool/source/breakiterator/data/ja.dic
index ed76e4b4a271..d2923833e57d 100644
--- a/i18npool/source/breakiterator/data/ja.dic
+++ b/i18npool/source/breakiterator/data/ja.dic
@@ -21386,6 +21386,7 @@
シャッター
シャット
シャットアウト
+シャットダウン
シャッãƒ
シャツ
シャトル
diff --git a/i18npool/source/collator/data/collator_data.map b/i18npool/source/collator/data/collator_data.map
index 09f298912ee9..412635f19eed 100644
--- a/i18npool/source/collator/data/collator_data.map
+++ b/i18npool/source/collator/data/collator_data.map
@@ -1,4 +1,4 @@
-OOO_1.1 {
+UDK_3_0_0 {
global:
GetVersionInfo;
get_zh_charset;
diff --git a/i18npool/source/indexentry/data/index_data.map b/i18npool/source/indexentry/data/index_data.map
index b9add8b3a6f8..30d03853d6ad 100644
--- a/i18npool/source/indexentry/data/index_data.map
+++ b/i18npool/source/indexentry/data/index_data.map
@@ -1,4 +1,4 @@
-OOO_1.1 {
+UDK_3_0_0 {
global:
GetVersionInfo;
get_indexdata_ko_dict;
diff --git a/i18npool/source/isolang/isolang.cxx b/i18npool/source/isolang/isolang.cxx
index 28c86d39673e..357be80a69ea 100644
--- a/i18npool/source/isolang/isolang.cxx
+++ b/i18npool/source/isolang/isolang.cxx
@@ -287,7 +287,9 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] =
{ LANGUAGE_BELARUSIAN, "be", "BY" },
{ LANGUAGE_CATALAN, "ca", "ES" }, // Spain (default)
{ LANGUAGE_CATALAN, "ca", "AD" }, // Andorra
- { LANGUAGE_USER_CATALAN_VALENCIAN, "ca", "XV" }, // XV: ISO 3166 user-assigned; workaround for UI localization only, do not use in document content!
+ { LANGUAGE_USER_CATALAN_VALENCIAN, "ca", "XV" }, // XV: ISO 3166 user-assigned; workaround for UI localization only, do not use in document content!
+ { LANGUAGE_CATALAN, "qcv", "ES" }, // qcv: ISO 639-3 reserved-for-local-use; UI localization quirk only, do not use in document content!
+// { 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" },
@@ -456,6 +458,9 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] =
{ LANGUAGE_USER_TAHITIAN, "ty", "PF" },
{ LANGUAGE_USER_MALAGASY_PLATEAU, "plt", "MG" },
{ LANGUAGE_USER_BAFIA, "ksf", "CM" },
+ { LANGUAGE_USER_GIKUYU, "ki", "KE" },
+ { LANGUAGE_USER_RUSYN_UKRAINE, "rue", "UA" },
+ { LANGUAGE_USER_RUSYN_SLOVAKIA, "rue", "SK" },
{ 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
};
@@ -1004,6 +1009,28 @@ LanguageType MsLangId::convertIsoByteStringToLanguage(
}
// -----------------------------------------------------------------------
+
+struct IsoLangGLIBCModifiersEntry
+{
+ LanguageType mnLang;
+ sal_Char maLangStr[4];
+ sal_Char maCountry[3];
+ sal_Char maAtString[9];
+};
+
+static IsoLangGLIBCModifiersEntry const aImplIsoLangGLIBCModifiersEntries[] =
+{
+ // MS-LANGID codes ISO639-1/2/3 ISO3166 glibc modifier
+ { LANGUAGE_BOSNIAN_CYRILLIC_BOSNIA_HERZEGOVINA, "bs", "BA", "cyrillic" },
+ { LANGUAGE_USER_SERBIAN_LATIN_SERBIA, "sr", "RS", "latin" }, // Serbian Latin in Serbia
+ { LANGUAGE_SERBIAN_LATIN, "sr", "CS", "latin" }, // Serbian Latin in Serbia and Montenegro
+ { LANGUAGE_USER_SERBIAN_LATIN_MONTENEGRO, "sr", "ME", "latin" }, // Serbian Latin in Montenegro
+ { LANGUAGE_SERBIAN_LATIN_NEUTRAL, "sr", "", "latin" },
+ { LANGUAGE_AZERI_CYRILLIC, "az", "AZ", "cyrillic" },
+ { LANGUAGE_UZBEK_CYRILLIC, "uz", "UZ", "cyrillic" },
+ { LANGUAGE_DONTKNOW, "", "", "" } // marks end of table
+};
+
// convert a unix locale string into LanguageType
// static
@@ -1012,15 +1039,20 @@ LanguageType MsLangId::convertUnxByteStringToLanguage(
{
rtl::OString aLang;
rtl::OString aCountry;
+ rtl::OString aAtString;
sal_Int32 nLangSepPos = rString.indexOf( (sal_Char)'_' );
sal_Int32 nCountrySepPos = rString.indexOf( (sal_Char)'.' );
+ sal_Int32 nAtPos = rString.indexOf( (sal_Char)'@' );
if (nCountrySepPos < 0)
- nCountrySepPos = rString.indexOf( (sal_Char)'@' );
+ nCountrySepPos = nAtPos;
if (nCountrySepPos < 0)
nCountrySepPos = rString.getLength();
+ if (nAtPos >= 0)
+ aAtString = rString.copy( nAtPos+1 );
+
if ( ((nLangSepPos >= 0) && (nLangSepPos > nCountrySepPos))
|| ((nLangSepPos < 0)) )
{
@@ -1034,6 +1066,30 @@ LanguageType MsLangId::convertUnxByteStringToLanguage(
aCountry = rString.copy( nLangSepPos+1, nCountrySepPos - nLangSepPos - 1);
}
+ // if there is a glibc modifier, first look for exact match in modifier table
+ if (aAtString.getLength())
+ {
+ // language is lower case in table
+ rtl::OString aLowerLang = aLang.toAsciiLowerCase();
+ // country is upper case in table
+ rtl::OString aUpperCountry = aCountry.toAsciiUpperCase();
+ const IsoLangGLIBCModifiersEntry* pGLIBCModifiersEntry = aImplIsoLangGLIBCModifiersEntries;
+ do
+ {
+ if (( aLowerLang.equals( pGLIBCModifiersEntry->maLangStr ) ) &&
+ ( aAtString.equals( pGLIBCModifiersEntry->maAtString ) ))
+ {
+ if ( !aUpperCountry.getLength() ||
+ aUpperCountry.equals( pGLIBCModifiersEntry->maCountry ) )
+ {
+ return pGLIBCModifiersEntry->mnLang;
+ }
+ }
+ ++pGLIBCModifiersEntry;
+ }
+ while ( pGLIBCModifiersEntry->mnLang != LANGUAGE_DONTKNOW );
+ }
+
return convertIsoNamesToLanguage( aLang, aCountry );
}
diff --git a/i18npool/source/isolang/langid.pl b/i18npool/source/isolang/langid.pl
index 06883279345b..8035178b7bb5 100755
--- a/i18npool/source/isolang/langid.pl
+++ b/i18npool/source/isolang/langid.pl
@@ -39,7 +39,8 @@ sub Usage()
"\n",
"langid - a hackish utility to lookup lang.h language defines and LangIDs,\n",
"isolang.cxx ISO639/ISO3166 mapping, locale data files, langtab.src language\n",
- "listbox entries, postset.mk and file_ooo.scp registry name.\n\n",
+ "listbox entries, postset.mk, file_ooo.scp registry name, globals.pm and\n",
+ "msi-encodinglist.txt\n\n",
"Usage: $0 [--single] {language string} | {LangID} | {primarylanguage sublanguage} | {language-country}\n\n",
@@ -105,7 +106,8 @@ sub grepFile($$$$@)
my( $regex, $path, $module, $name, @addregex) = @_;
my @result;
my $found = 0;
- my $arefound = '';
+ my $areopen = 0;
+ my $arecloser = '';
my $file;
# Try module under current working directory first to catch local
# modifications. A Not yet delivered lang.h is a special case.
@@ -145,17 +147,22 @@ sub grepFile($$$$@)
print "$line\n";
push( @result, $line);
}
- else
+ elsif (@addregex)
{
- for my $re (@addregex)
+ # By convention first element is opener, second element is closer.
+ if (!$areopen)
{
- if ($re ne $arefound && $line =~ /$re/)
+ if ($line =~ /$addregex[0]/)
{
- if ($arefound eq '')
- {
- $arefound = $re;
- }
- else
+ $areopen = 1;
+ $arecloser = $addregex[1];
+ }
+ }
+ if ($areopen)
+ {
+ for (my $i = 2; $i < @addregex; ++$i)
+ {
+ if ($line =~ /$addregex[$i]/)
{
if (!$found)
{
@@ -167,13 +174,19 @@ sub grepFile($$$$@)
push( @result, $line);
}
}
+ if ($line =~ /$arecloser/)
+ {
+ $areopen = 0;
+ }
}
}
}
close( IN);
}
if (!$found) {
- print "Not found in $file\n"; }
+ print "Not found in $file\n";
+ #print "Not found in $file for $regex @addregex\n";
+ }
return @result;
}
@@ -317,13 +330,13 @@ sub main()
if ($coun)
{
$loca = $lang . "_" . $coun;
- push( @langcoungreplist, $lang . '(-' . $coun . ')?');
+ push( @langcoungreplist, '\b' . $lang . '\b(-' . $coun . ')?');
}
else
{
$loca = $lang;
$coun = "";
- push( @langcoungreplist, $lang);
+ push( @langcoungreplist, '\b' . $lang . '\b');
}
my $file = "$SRC_ROOT/i18npool/source/localedata/data/$loca.xml";
my $found;
@@ -385,12 +398,24 @@ sub main()
grepFile(
'^\s*Name\s*\(' . $langcoun . '\)\s*=',
"$SRC_ROOT", "scp2", "source/ooo/file_ooo.scp", ());
+
# completelangiso=af ar as-IN ... zu
grepFile(
- '^\s*completelangiso\s*[= ](.{2,3}(-..)?)*' . $langcoun . '',
+ '^\s*completelangiso\s*=\s*(\s*([a-z]{2,3})(-[A-Z][A-Z])?)*' . $langcoun . '',
"$SRC_ROOT", "solenv", "inc/postset.mk",
# needs a duplicated pair of backslashes to produce a literal \\
- ('^\s*completelangiso\s*=', '^\s*' . $langcoun . '\s*\\\\*$'));
+ ('^\s*completelangiso\s*=', '^\s*$', '^\s*' . $langcoun . '\s*\\\\*$'));
+
+ # @noMSLocaleLangs = ( "br", "bs", ... )
+ grepFile(
+ '^\s*@noMSLocaleLangs\s*=\s*\(\s*(\s*"([a-z]{2,3})(-[A-Z][A-Z])?"\s*,?)*' . $langcoun . '',
+ "$SRC_ROOT", "solenv", "bin/modules/installer/globals.pm",
+ ('^\s*@noMSLocaleLangs\s*=', '\)\s*$', '"' . $langcoun . '"'));
+
+ # af 1252 1078 # Afrikaans
+ grepFile(
+ '^\s*' . $langcoun . '',
+ "$SRC_ROOT", "setup_native", "source/win32/msi-encodinglist.txt", ());
}
}
return 0;
diff --git a/i18npool/source/isolang/mslangid.cxx b/i18npool/source/isolang/mslangid.cxx
index 8e9dddff872b..da9da0ff8646 100644
--- a/i18npool/source/isolang/mslangid.cxx
+++ b/i18npool/source/isolang/mslangid.cxx
@@ -102,6 +102,8 @@ LanguageType MsLangId::getRealLanguageWithoutConfig( LanguageType nLang )
nLang = getSystemUILanguage();
break;
default:
+ /* TODO: would this be useful here? */
+ //nLang = MsLangId::getReplacementForObsoleteLanguage( nLang);
; // nothing
}
if (nLang == LANGUAGE_DONTKNOW)
@@ -128,6 +130,8 @@ LanguageType MsLangId::getRealLanguage( LanguageType nLang )
nLang = nConfiguredSystemUILanguage;
break;
default:
+ /* TODO: would this be useful here? */
+ //nLang = MsLangId::getReplacementForObsoleteLanguage( nLang);
; // nothing
}
if (nLang == LANGUAGE_DONTKNOW)
@@ -451,6 +455,12 @@ LanguageType MsLangId::getReplacementForObsoleteLanguage( LanguageType nLang )
case LANGUAGE_SPANISH_DATED:
nLang = LANGUAGE_SPANISH_MODERN;
break;
+
+ // Do not use ca-XV for document content.
+ /* TODO: remove in case we implement BCP47 language tags. */
+ case LANGUAGE_USER_CATALAN_VALENCIAN:
+ nLang = LANGUAGE_CATALAN;
+ break;
}
return nLang;
}
diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx
index 4204b3636fcb..7a520047637d 100644
--- a/i18npool/source/localedata/LocaleNode.cxx
+++ b/i18npool/source/localedata/LocaleNode.cxx
@@ -493,6 +493,14 @@ void LCCTYPENode::generateCode (const OFileWriter &of) const
if (aDoubleQuoteStart == aDoubleQuoteEnd)
fprintf( stderr, "Warning: %s\n",
"DoubleQuotationStart equals DoubleQuotationEnd. Not necessarily an error, but unusual.");
+ /* TODO: should equalness of single and double quotes be an error? Would
+ * need to adapt quite some locales' data. */
+ if (aQuoteStart == aDoubleQuoteStart)
+ fprintf( stderr, "Warning: %s\n",
+ "QuotationStart equals DoubleQuotationStart. Not necessarily an error, but unusual.");
+ if (aQuoteEnd == aDoubleQuoteEnd)
+ fprintf( stderr, "Warning: %s\n",
+ "QuotationEnd equals DoubleQuotationEnd. Not necessarily an error, but unusual.");
writeParameterCheckLen( of, "TimeAM", "timeAM", 1, -1);
writeParameterCheckLen( of, "TimePM", "timePM", 1, -1);
@@ -689,7 +697,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
incErrorInt( "ThousandSeparator not present in FormatCode formatindex=\"%d\".",
formatindex);
}
- if (nDec <= nGrp)
+ if (nDec >= 0 && nGrp >= 0 && nDec <= nGrp)
incErrorInt( "Ordering of ThousandSeparator and DecimalSeparator not correct in formatindex=\"%d\".",
formatindex);
}
@@ -724,7 +732,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
incErrorInt( "Time100SecSeparator+00 not present in FormatCode formatindex=\"%d\".",
formatindex);
}
- if (n100s <= nTime)
+ if (n100s >= 0 && nTime >= 0 && n100s <= nTime)
incErrorInt( "Ordering of Time100SecSeparator and TimeSeparator not correct in formatindex=\"%d\".",
formatindex);
}
diff --git a/i18npool/source/localedata/data/ak_GH.xml b/i18npool/source/localedata/data/ak_GH.xml
index 95ac2069db31..afdbf1c2b227 100644
--- a/i18npool/source/localedata/data/ak_GH.xml
+++ b/i18npool/source/localedata/data/ak_GH.xml
@@ -337,8 +337,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/ar_DZ.xml b/i18npool/source/localedata/data/ar_DZ.xml
new file mode 100644
index 000000000000..68cf3ed441e8
--- /dev/null
+++ b/i18npool/source/localedata/data/ar_DZ.xml
@@ -0,0 +1,437 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE Locale SYSTEM 'locale.dtd'>
+<Locale versionDTD="2.0.3" allowUpdateFromCLDR="yes" version="1.0">
+ <LC_INFO>
+ <Language>
+ <LangID>ar</LangID>
+ <DefaultName>Arabic</DefaultName>
+ </Language>
+ <Country>
+ <CountryID>DZ</CountryID>
+ <DefaultName>Algeria</DefaultName>
+ </Country>
+ </LC_INFO>
+ <LC_CTYPE>
+ <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="[$د.ج.â€-1401]">
+ <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+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>[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># ##0٫00 CCC</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="CurrencyFormatskey6" default="false" type="medium" usage="CURRENCY" formatindex="17">
+ <FormatCode>[CURRENCY] # ##0٫--;[RED][CURRENCY] # ##0٫-- -</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey1" default="true" type="short" usage="DATE" formatindex="18">
+ <FormatCode>[~hijri]D/MM/YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey9" default="true" type="long" usage="DATE" formatindex="19">
+ <FormatCode>[~hijri]NNN DD MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey8" default="true" type="medium" usage="DATE" formatindex="20">
+ <FormatCode>[NatNum1][~hijri]YYYY/MM/D</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey7" default="false" type="medium" usage="DATE" formatindex="21">
+ <FormatCode>D/M/YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey10" default="false" type="long" usage="DATE" formatindex="22">
+ <FormatCode>[NatNum1][~hijri]NNN DD MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey11" default="false" type="long" usage="DATE" formatindex="23">
+ <FormatCode>DD MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey16" default="false" type="long" usage="DATE" formatindex="24">
+ <FormatCode>[NatNum1]DD MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey12" default="false" type="long" usage="DATE" formatindex="25">
+ <FormatCode>NNN DD MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey17" default="false" type="long" usage="DATE" formatindex="26">
+ <FormatCode>[NatNum1]NNN DD MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey13" default="false" type="long" usage="DATE" formatindex="27">
+ <FormatCode>DD MMMM YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey2" default="false" type="medium" usage="DATE" formatindex="28">
+ <FormatCode>[NatNum1]DD MMMM YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey14" default="false" type="long" usage="DATE" formatindex="29">
+ <FormatCode>[~hijri]DD MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey15" default="false" type="long" usage="DATE" formatindex="30">
+ <FormatCode>[NatNum1][~hijri]DD MMMM YYYY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey18" default="false" type="short" usage="DATE" formatindex="31">
+ <FormatCode>[NatNum1][~hijri]YYYY/MM/D</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey19" default="false" type="medium" usage="DATE" formatindex="32">
+ <FormatCode>[NatNum1]YY/MM/DD</FormatCode>
+ <DefaultName>ISO 8601</DefaultName>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey20" default="false" type="medium" usage="DATE" formatindex="33">
+ <FormatCode>[NatNum1]YYYY/MM/DD</FormatCode>
+ <DefaultName>ISO 8601</DefaultName>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey3" default="false" type="medium" usage="DATE" formatindex="34">
+ <FormatCode>MM/YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey4" default="false" type="medium" usage="DATE" formatindex="35">
+ <FormatCode>DD MMM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey5" default="false" type="medium" usage="DATE" formatindex="36">
+ <FormatCode>MMMM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey6" default="false" type="medium" usage="DATE" formatindex="37">
+ <FormatCode>QQ YY</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateFormatskey21" default="false" type="medium" usage="DATE" formatindex="38">
+ <FormatCode>WW</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey1" default="true" type="short" usage="TIME" formatindex="39">
+ <FormatCode>HH:MM</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey2" default="true" type="medium" usage="TIME" formatindex="40">
+ <FormatCode>HH:MM:SS</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey3" default="false" type="short" usage="TIME" formatindex="41">
+ <FormatCode>AM/PMMM:HH</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="TimeFormatskey4" default="false" type="medium" usage="TIME" formatindex="42">
+ <FormatCode>AM/PMSS:MM:HH</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>[~hijri]AM/PMHH:MM YYYY/MM/D</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateTimeFormatskey2" default="false" type="medium" usage="DATE_TIME" formatindex="47">
+ <FormatCode>[NatNum1][~hijri]AM/PMHH:MM YYYY/MM/D</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateTimeFormatskey3" default="false" type="medium" usage="DATE_TIME" formatindex="50">
+ <FormatCode>AM/PMHH:MM YYYY/MM/D</FormatCode>
+ </FormatElement>
+ <FormatElement msgid="DateTimeFormatskey4" default="false" type="medium" usage="DATE_TIME" formatindex="51">
+ <FormatCode>[NatNum1]AM/PMHH:MM YYYY/MM/D</FormatCode>
+ </FormatElement>
+ </LC_FORMAT>
+ <LC_COLLATION ref="en_US" />
+ <LC_SEARCH ref="en_US"/>
+ <LC_INDEX ref="ar_EG"/>
+ <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>sat</DayID>
+ </StartDayOfWeek>
+ <MinimalDaysInFirstWeek>1</MinimalDaysInFirstWeek>
+ </Calendar>
+ <Calendar unoid="hijri" default="false">
+ <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>BeforeHijra</EraID>
+ <DefaultAbbrvName>Ù‡â€</DefaultAbbrvName>
+ <DefaultFullName>قبل الهجرة</DefaultFullName>
+ </Era>
+ <Era>
+ <EraID>AfterHijra</EraID>
+ <DefaultAbbrvName/>
+ <DefaultFullName>هجري</DefaultFullName>
+ </Era>
+ </Eras>
+ <StartDayOfWeek>
+ <DayID>sat</DayID>
+ </StartDayOfWeek>
+ <MinimalDaysInFirstWeek>1</MinimalDaysInFirstWeek>
+ </Calendar>
+ </LC_CALENDAR>
+ <LC_CURRENCY>
+ <Currency default="true" usedInCompatibleFormatCodes="true">
+ <CurrencyID>DZD</CurrencyID>
+ <CurrencySymbol>د.ج.â€</CurrencySymbol>
+ <BankSymbol>DZD</BankSymbol>
+ <CurrencyName>دينار جزائري</CurrencyName>
+ <DecimalPlaces>2</DecimalPlaces>
+ </Currency>
+ </LC_CURRENCY>
+ <LC_TRANSLITERATION ref="en_US"/>
+ <LC_MISC ref="ar_EG"/>
+ <LC_NumberingLevel ref="ar_EG"/>
+ <LC_OutLineNumberingLevel ref="ar_EG"/>
+</Locale>
diff --git a/i18npool/source/localedata/data/bs_BA.xml b/i18npool/source/localedata/data/bs_BA.xml
index 1a6eeb82ff44..0dea5e435ec5 100644
--- a/i18npool/source/localedata/data/bs_BA.xml
+++ b/i18npool/source/localedata/data/bs_BA.xml
@@ -366,9 +366,12 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
-<Transliteration unoid="LOWERCASE_UPPERCASE"/>
-<Transliteration unoid="UPPERCASE_LOWERCASE"/>
-<Transliteration unoid="IGNORE_CASE"/>
+ <Transliteration unoid="SENTENCE_CASE"/>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
+ <Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
+ <Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
<ReservedWords>
diff --git a/i18npool/source/localedata/data/ee_GH.xml b/i18npool/source/localedata/data/ee_GH.xml
index eb19dec770da..2d4807774a8b 100644
--- a/i18npool/source/localedata/data/ee_GH.xml
+++ b/i18npool/source/localedata/data/ee_GH.xml
@@ -331,8 +331,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/en_GH.xml b/i18npool/source/localedata/data/en_GH.xml
index 660cd759944b..37437468a651 100644
--- a/i18npool/source/localedata/data/en_GH.xml
+++ b/i18npool/source/localedata/data/en_GH.xml
@@ -329,11 +329,7 @@
<DecimalPlaces>2</DecimalPlaces>
</Currency>
</LC_CURRENCY>
- <LC_TRANSLITERATION>
- <Transliteration unoid="LOWERCASE_UPPERCASE" />
- <Transliteration unoid="UPPERCASE_LOWERCASE" />
- <Transliteration unoid="IGNORE_CASE" />
- </LC_TRANSLITERATION>
+<LC_TRANSLITERATION ref="en_US"/>
<LC_MISC>
<ReservedWords>
<trueWord>True</trueWord>
diff --git a/i18npool/source/localedata/data/en_US.xml b/i18npool/source/localedata/data/en_US.xml
index 2a99dcd0fb14..7029b7cc5b30 100644
--- a/i18npool/source/localedata/data/en_US.xml
+++ b/i18npool/source/localedata/data/en_US.xml
@@ -475,8 +475,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/eo.xml b/i18npool/source/localedata/data/eo.xml
index 62098fdf75ef..33a42a8fd675 100644
--- a/i18npool/source/localedata/data/eo.xml
+++ b/i18npool/source/localedata/data/eo.xml
@@ -321,8 +321,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/eu.xml b/i18npool/source/localedata/data/eu.xml
index 5f0119b1285d..64184d0125f0 100644
--- a/i18npool/source/localedata/data/eu.xml
+++ b/i18npool/source/localedata/data/eu.xml
@@ -328,9 +328,12 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
- <Transliteration unoid="LOWERCASE_UPPERCASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
<ReservedWords>
diff --git a/i18npool/source/localedata/data/fur_IT.xml b/i18npool/source/localedata/data/fur_IT.xml
index cfec124d68b6..5aee7cbfdf15 100644
--- a/i18npool/source/localedata/data/fur_IT.xml
+++ b/i18npool/source/localedata/data/fur_IT.xml
@@ -323,8 +323,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/fy_NL.xml b/i18npool/source/localedata/data/fy_NL.xml
index 651d13417842..a4a7cc48f2da 100644
--- a/i18npool/source/localedata/data/fy_NL.xml
+++ b/i18npool/source/localedata/data/fy_NL.xml
@@ -323,8 +323,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/gsc_FR.xml b/i18npool/source/localedata/data/gsc_FR.xml
index 0a13281f9d7b..01242e586e7a 100644
--- a/i18npool/source/localedata/data/gsc_FR.xml
+++ b/i18npool/source/localedata/data/gsc_FR.xml
@@ -323,9 +323,12 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
-<Transliteration unoid="LOWERCASE_UPPERCASE"/>
-<Transliteration unoid="UPPERCASE_LOWERCASE"/>
-<Transliteration unoid="IGNORE_CASE"/>
+ <Transliteration unoid="SENTENCE_CASE"/>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
+ <Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
+ <Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
<ReservedWords>
@@ -355,4 +358,4 @@
</LC_NumberingLevel>
<LC_OutLineNumberingLevel ref="en_US"/>
</Locale>
-<!--Version 1.0 --> \ No newline at end of file
+<!--Version 1.0 -->
diff --git a/i18npool/source/localedata/data/gug_PY.xml b/i18npool/source/localedata/data/gug_PY.xml
index c21104c3d13e..60230ae64dac 100644
--- a/i18npool/source/localedata/data/gug_PY.xml
+++ b/i18npool/source/localedata/data/gug_PY.xml
@@ -323,8 +323,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/ha_GH.xml b/i18npool/source/localedata/data/ha_GH.xml
index 1794447c0e4d..6d56b80cc580 100644
--- a/i18npool/source/localedata/data/ha_GH.xml
+++ b/i18npool/source/localedata/data/ha_GH.xml
@@ -334,8 +334,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/hil_PH.xml b/i18npool/source/localedata/data/hil_PH.xml
index 6396ff261c90..1bd10219d366 100644
--- a/i18npool/source/localedata/data/hil_PH.xml
+++ b/i18npool/source/localedata/data/hil_PH.xml
@@ -324,8 +324,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/hr_HR.xml b/i18npool/source/localedata/data/hr_HR.xml
index 4c3786539b38..484efdcb9ba0 100644
--- a/i18npool/source/localedata/data/hr_HR.xml
+++ b/i18npool/source/localedata/data/hr_HR.xml
@@ -318,9 +318,12 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
-<Transliteration unoid="LOWERCASE_UPPERCASE"/>
-<Transliteration unoid="UPPERCASE_LOWERCASE"/>
-<Transliteration unoid="IGNORE_CASE"/>
+ <Transliteration unoid="SENTENCE_CASE"/>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
+ <Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
+ <Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
<ReservedWords>
diff --git a/i18npool/source/localedata/data/hy_AM.xml b/i18npool/source/localedata/data/hy_AM.xml
index 92913732a090..47c2e35d6e7b 100644
--- a/i18npool/source/localedata/data/hy_AM.xml
+++ b/i18npool/source/localedata/data/hy_AM.xml
@@ -320,8 +320,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/is_IS.xml b/i18npool/source/localedata/data/is_IS.xml
index 7e77c1d2cdad..3b16c6e4bca5 100644
--- a/i18npool/source/localedata/data/is_IS.xml
+++ b/i18npool/source/localedata/data/is_IS.xml
@@ -314,9 +314,12 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
- <Transliteration unoid="LOWERCASE_UPPERCASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
<ReservedWords>
diff --git a/i18npool/source/localedata/data/ka_GE.xml b/i18npool/source/localedata/data/ka_GE.xml
index d0a9a20369e1..ada35b465543 100644
--- a/i18npool/source/localedata/data/ka_GE.xml
+++ b/i18npool/source/localedata/data/ka_GE.xml
@@ -320,8 +320,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/kk_KZ.xml b/i18npool/source/localedata/data/kk_KZ.xml
index e5c8cc95d2fe..a9147655cdec 100644
--- a/i18npool/source/localedata/data/kk_KZ.xml
+++ b/i18npool/source/localedata/data/kk_KZ.xml
@@ -322,8 +322,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/km_KH.xml b/i18npool/source/localedata/data/km_KH.xml
index dff43def273b..bddd0e91791e 100644
--- a/i18npool/source/localedata/data/km_KH.xml
+++ b/i18npool/source/localedata/data/km_KH.xml
@@ -346,8 +346,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/ko_KR.xml b/i18npool/source/localedata/data/ko_KR.xml
index bbd5b0ded2be..3a3fbb0fb9a9 100644
--- a/i18npool/source/localedata/data/ko_KR.xml
+++ b/i18npool/source/localedata/data/ko_KR.xml
@@ -564,8 +564,11 @@
<Transliteration unoid="IGNORE_WIDTH"/>
<Transliteration unoid="FULLWIDTH_HALFWIDTH"/>
<Transliteration unoid="HALFWIDTH_FULLWIDTH"/>
- <Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
+ <Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="NumToTextFormalHangul_ko"/>
<Transliteration unoid="NumToTextFormalLower_ko"/>
<Transliteration unoid="NumToTextFormalUpper_ko"/>
diff --git a/i18npool/source/localedata/data/ku_TR.xml b/i18npool/source/localedata/data/ku_TR.xml
index 4af9e2cd28d2..0413353b8486 100644
--- a/i18npool/source/localedata/data/ku_TR.xml
+++ b/i18npool/source/localedata/data/ku_TR.xml
@@ -330,8 +330,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/lg_UG.xml b/i18npool/source/localedata/data/lg_UG.xml
index c6b3b740b10d..5fc78c71cec2 100644
--- a/i18npool/source/localedata/data/lg_UG.xml
+++ b/i18npool/source/localedata/data/lg_UG.xml
@@ -323,8 +323,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
- <Transliteration unoid="LOWERCASE_UPPERCASE" />
- <Transliteration unoid="UPPERCASE_LOWERCASE" />
+ <Transliteration unoid="SENTENCE_CASE"/>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
+ <Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE" />
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/ln_CD.xml b/i18npool/source/localedata/data/ln_CD.xml
index 602b19fb8fd8..daf7376c9df5 100644
--- a/i18npool/source/localedata/data/ln_CD.xml
+++ b/i18npool/source/localedata/data/ln_CD.xml
@@ -327,8 +327,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/localedata_en.map b/i18npool/source/localedata/data/localedata_en.map
index 10e5a998c932..ab13f033745c 100644
--- a/i18npool/source/localedata/data/localedata_en.map
+++ b/i18npool/source/localedata/data/localedata_en.map
@@ -1,4 +1,4 @@
-OOO_1.1 {
+UDK_3_0_0 {
global:
GetVersionInfo;
getAllCalendars_en_AU;
diff --git a/i18npool/source/localedata/data/localedata_es.map b/i18npool/source/localedata/data/localedata_es.map
index edcdd4e153e3..7743539232a6 100644
--- a/i18npool/source/localedata/data/localedata_es.map
+++ b/i18npool/source/localedata/data/localedata_es.map
@@ -1,4 +1,4 @@
-OOO_1.1 {
+UDK_3_0_0 {
global:
GetVersionInfo;
getAllCalendars_es_AR;
diff --git a/i18npool/source/localedata/data/localedata_euro.map b/i18npool/source/localedata/data/localedata_euro.map
index bc93cbfc5d89..e0564b85ea25 100644
--- a/i18npool/source/localedata/data/localedata_euro.map
+++ b/i18npool/source/localedata/data/localedata_euro.map
@@ -1,4 +1,4 @@
-OOO_1.1 {
+UDK_3_0_0 {
global:
GetVersionInfo;
getAllCalendars_ast_ES;
@@ -55,6 +55,7 @@ getAllCalendars_pl_PL;
getAllCalendars_pt_BR;
getAllCalendars_pt_PT;
getAllCalendars_ro_RO;
+getAllCalendars_rue_SK;
getAllCalendars_ru_RU;
getAllCalendars_sc_IT;
getAllCalendars_sh_ME;
@@ -124,6 +125,7 @@ getAllCurrencies_pl_PL;
getAllCurrencies_pt_BR;
getAllCurrencies_pt_PT;
getAllCurrencies_ro_RO;
+getAllCurrencies_rue_SK;
getAllCurrencies_ru_RU;
getAllCurrencies_sc_IT;
getAllCurrencies_sh_ME;
@@ -193,6 +195,7 @@ getAllFormats0_pl_PL;
getAllFormats0_pt_BR;
getAllFormats0_pt_PT;
getAllFormats0_ro_RO;
+getAllFormats0_rue_SK;
getAllFormats0_ru_RU;
getAllFormats0_sc_IT;
getAllFormats0_sh_ME;
@@ -262,6 +265,7 @@ getBreakIteratorRules_pl_PL;
getBreakIteratorRules_pt_BR;
getBreakIteratorRules_pt_PT;
getBreakIteratorRules_ro_RO;
+getBreakIteratorRules_rue_SK;
getBreakIteratorRules_ru_RU;
getBreakIteratorRules_sc_IT;
getBreakIteratorRules_sh_ME;
@@ -331,6 +335,7 @@ getCollationOptions_pl_PL;
getCollationOptions_pt_BR;
getCollationOptions_pt_PT;
getCollationOptions_ro_RO;
+getCollationOptions_rue_SK;
getCollationOptions_ru_RU;
getCollationOptions_sc_IT;
getCollationOptions_sh_ME;
@@ -400,6 +405,7 @@ getCollatorImplementation_pl_PL;
getCollatorImplementation_pt_BR;
getCollatorImplementation_pt_PT;
getCollatorImplementation_ro_RO;
+getCollatorImplementation_rue_SK;
getCollatorImplementation_ru_RU;
getCollatorImplementation_sc_IT;
getCollatorImplementation_sh_ME;
@@ -469,6 +475,7 @@ getContinuousNumberingLevels_pl_PL;
getContinuousNumberingLevels_pt_BR;
getContinuousNumberingLevels_pt_PT;
getContinuousNumberingLevels_ro_RO;
+getContinuousNumberingLevels_rue_SK;
getContinuousNumberingLevels_ru_RU;
getContinuousNumberingLevels_sc_IT;
getContinuousNumberingLevels_sh_ME;
@@ -538,6 +545,7 @@ getFollowPageWords_pl_PL;
getFollowPageWords_pt_BR;
getFollowPageWords_pt_PT;
getFollowPageWords_ro_RO;
+getFollowPageWords_rue_SK;
getFollowPageWords_ru_RU;
getFollowPageWords_sc_IT;
getFollowPageWords_sh_ME;
@@ -607,6 +615,7 @@ getForbiddenCharacters_pl_PL;
getForbiddenCharacters_pt_BR;
getForbiddenCharacters_pt_PT;
getForbiddenCharacters_ro_RO;
+getForbiddenCharacters_rue_SK;
getForbiddenCharacters_ru_RU;
getForbiddenCharacters_sc_IT;
getForbiddenCharacters_sh_ME;
@@ -676,6 +685,7 @@ getIndexAlgorithm_pl_PL;
getIndexAlgorithm_pt_BR;
getIndexAlgorithm_pt_PT;
getIndexAlgorithm_ro_RO;
+getIndexAlgorithm_rue_SK;
getIndexAlgorithm_ru_RU;
getIndexAlgorithm_sc_IT;
getIndexAlgorithm_sh_ME;
@@ -745,6 +755,7 @@ getLCInfo_pl_PL;
getLCInfo_pt_BR;
getLCInfo_pt_PT;
getLCInfo_ro_RO;
+getLCInfo_rue_SK;
getLCInfo_ru_RU;
getLCInfo_sc_IT;
getLCInfo_sh_ME;
@@ -814,6 +825,7 @@ getLocaleItem_pl_PL;
getLocaleItem_pt_BR;
getLocaleItem_pt_PT;
getLocaleItem_ro_RO;
+getLocaleItem_rue_SK;
getLocaleItem_ru_RU;
getLocaleItem_sc_IT;
getLocaleItem_sh_ME;
@@ -883,6 +895,7 @@ getOutlineNumberingLevels_pl_PL;
getOutlineNumberingLevels_pt_BR;
getOutlineNumberingLevels_pt_PT;
getOutlineNumberingLevels_ro_RO;
+getOutlineNumberingLevels_rue_SK;
getOutlineNumberingLevels_ru_RU;
getOutlineNumberingLevels_sc_IT;
getOutlineNumberingLevels_sh_ME;
@@ -952,6 +965,7 @@ getReservedWords_pl_PL;
getReservedWords_pt_BR;
getReservedWords_pt_PT;
getReservedWords_ro_RO;
+getReservedWords_rue_SK;
getReservedWords_ru_RU;
getReservedWords_sc_IT;
getReservedWords_sh_ME;
@@ -1021,6 +1035,7 @@ getSearchOptions_pl_PL;
getSearchOptions_pt_BR;
getSearchOptions_pt_PT;
getSearchOptions_ro_RO;
+getSearchOptions_rue_SK;
getSearchOptions_ru_RU;
getSearchOptions_sc_IT;
getSearchOptions_sh_ME;
@@ -1090,6 +1105,7 @@ getTransliterations_pl_PL;
getTransliterations_pt_BR;
getTransliterations_pt_PT;
getTransliterations_ro_RO;
+getTransliterations_rue_SK;
getTransliterations_ru_RU;
getTransliterations_sc_IT;
getTransliterations_sh_ME;
@@ -1159,6 +1175,7 @@ getUnicodeScripts_pl_PL;
getUnicodeScripts_pt_BR;
getUnicodeScripts_pt_PT;
getUnicodeScripts_ro_RO;
+getUnicodeScripts_rue_SK;
getUnicodeScripts_ru_RU;
getUnicodeScripts_sc_IT;
getUnicodeScripts_sh_ME;
diff --git a/i18npool/source/localedata/data/localedata_others.map b/i18npool/source/localedata/data/localedata_others.map
index 6857e29ce5db..e5de10cb68e5 100644
--- a/i18npool/source/localedata/data/localedata_others.map
+++ b/i18npool/source/localedata/data/localedata_others.map
@@ -1,9 +1,10 @@
-OOO_1.1 {
+UDK_3_0_0 {
global:
getAllCalendars_af_NA;
getAllCalendars_af_ZA;
getAllCalendars_ak_GH;
getAllCalendars_am_ET;
+getAllCalendars_ar_DZ;
getAllCalendars_ar_EG;
getAllCalendars_ar_LB;
getAllCalendars_ar_OM;
@@ -37,6 +38,7 @@ getAllCalendars_ky_KG;
getAllCalendars_lg_UG;
getAllCalendars_ln_CD;
getAllCalendars_lo_LA;
+getAllCalendars_mai_IN;
getAllCalendars_ml_IN;
getAllCalendars_mn_MN;
getAllCalendars_mr_IN;
@@ -80,6 +82,7 @@ getAllCurrencies_af_NA;
getAllCurrencies_af_ZA;
getAllCurrencies_ak_GH;
getAllCurrencies_am_ET;
+getAllCurrencies_ar_DZ;
getAllCurrencies_ar_EG;
getAllCurrencies_ar_LB;
getAllCurrencies_ar_OM;
@@ -113,6 +116,7 @@ getAllCurrencies_ky_KG;
getAllCurrencies_lg_UG;
getAllCurrencies_ln_CD;
getAllCurrencies_lo_LA;
+getAllCurrencies_mai_IN;
getAllCurrencies_ml_IN;
getAllCurrencies_mn_MN;
getAllCurrencies_mr_IN;
@@ -156,6 +160,7 @@ getAllFormats0_af_NA;
getAllFormats0_af_ZA;
getAllFormats0_ak_GH;
getAllFormats0_am_ET;
+getAllFormats0_ar_DZ;
getAllFormats0_ar_EG;
getAllFormats0_ar_LB;
getAllFormats0_ar_OM;
@@ -189,6 +194,7 @@ getAllFormats0_ky_KG;
getAllFormats0_lg_UG;
getAllFormats0_ln_CD;
getAllFormats0_lo_LA;
+getAllFormats0_mai_IN;
getAllFormats0_ml_IN;
getAllFormats0_mn_MN;
getAllFormats0_mr_IN;
@@ -232,6 +238,7 @@ getBreakIteratorRules_af_NA;
getBreakIteratorRules_af_ZA;
getBreakIteratorRules_ak_GH;
getBreakIteratorRules_am_ET;
+getBreakIteratorRules_ar_DZ;
getBreakIteratorRules_ar_EG;
getBreakIteratorRules_ar_LB;
getBreakIteratorRules_ar_OM;
@@ -265,6 +272,7 @@ getBreakIteratorRules_ky_KG;
getBreakIteratorRules_lg_UG;
getBreakIteratorRules_ln_CD;
getBreakIteratorRules_lo_LA;
+getBreakIteratorRules_mai_IN;
getBreakIteratorRules_ml_IN;
getBreakIteratorRules_mn_MN;
getBreakIteratorRules_mr_IN;
@@ -308,6 +316,7 @@ getCollationOptions_af_NA;
getCollationOptions_af_ZA;
getCollationOptions_ak_GH;
getCollationOptions_am_ET;
+getCollationOptions_ar_DZ;
getCollationOptions_ar_EG;
getCollationOptions_ar_LB;
getCollationOptions_ar_OM;
@@ -341,6 +350,7 @@ getCollationOptions_ky_KG;
getCollationOptions_lg_UG;
getCollationOptions_ln_CD;
getCollationOptions_lo_LA;
+getCollationOptions_mai_IN;
getCollationOptions_ml_IN;
getCollationOptions_mn_MN;
getCollationOptions_mr_IN;
@@ -384,6 +394,7 @@ getCollatorImplementation_af_NA;
getCollatorImplementation_af_ZA;
getCollatorImplementation_ak_GH;
getCollatorImplementation_am_ET;
+getCollatorImplementation_ar_DZ;
getCollatorImplementation_ar_EG;
getCollatorImplementation_ar_LB;
getCollatorImplementation_ar_OM;
@@ -417,6 +428,7 @@ getCollatorImplementation_ky_KG;
getCollatorImplementation_lg_UG;
getCollatorImplementation_ln_CD;
getCollatorImplementation_lo_LA;
+getCollatorImplementation_mai_IN;
getCollatorImplementation_ml_IN;
getCollatorImplementation_mn_MN;
getCollatorImplementation_mr_IN;
@@ -460,6 +472,7 @@ getContinuousNumberingLevels_af_NA;
getContinuousNumberingLevels_af_ZA;
getContinuousNumberingLevels_ak_GH;
getContinuousNumberingLevels_am_ET;
+getContinuousNumberingLevels_ar_DZ;
getContinuousNumberingLevels_ar_EG;
getContinuousNumberingLevels_ar_LB;
getContinuousNumberingLevels_ar_OM;
@@ -493,6 +506,7 @@ getContinuousNumberingLevels_ky_KG;
getContinuousNumberingLevels_lg_UG;
getContinuousNumberingLevels_ln_CD;
getContinuousNumberingLevels_lo_LA;
+getContinuousNumberingLevels_mai_IN;
getContinuousNumberingLevels_ml_IN;
getContinuousNumberingLevels_mn_MN;
getContinuousNumberingLevels_mr_IN;
@@ -536,6 +550,7 @@ getFollowPageWords_af_NA;
getFollowPageWords_af_ZA;
getFollowPageWords_ak_GH;
getFollowPageWords_am_ET;
+getFollowPageWords_ar_DZ;
getFollowPageWords_ar_EG;
getFollowPageWords_ar_LB;
getFollowPageWords_ar_OM;
@@ -569,6 +584,7 @@ getFollowPageWords_ky_KG;
getFollowPageWords_lg_UG;
getFollowPageWords_ln_CD;
getFollowPageWords_lo_LA;
+getFollowPageWords_mai_IN;
getFollowPageWords_ml_IN;
getFollowPageWords_mn_MN;
getFollowPageWords_mr_IN;
@@ -612,6 +628,7 @@ getForbiddenCharacters_af_NA;
getForbiddenCharacters_af_ZA;
getForbiddenCharacters_ak_GH;
getForbiddenCharacters_am_ET;
+getForbiddenCharacters_ar_DZ;
getForbiddenCharacters_ar_EG;
getForbiddenCharacters_ar_LB;
getForbiddenCharacters_ar_OM;
@@ -645,6 +662,7 @@ getForbiddenCharacters_ky_KG;
getForbiddenCharacters_lg_UG;
getForbiddenCharacters_ln_CD;
getForbiddenCharacters_lo_LA;
+getForbiddenCharacters_mai_IN;
getForbiddenCharacters_ml_IN;
getForbiddenCharacters_mn_MN;
getForbiddenCharacters_mr_IN;
@@ -688,6 +706,7 @@ getIndexAlgorithm_af_NA;
getIndexAlgorithm_af_ZA;
getIndexAlgorithm_ak_GH;
getIndexAlgorithm_am_ET;
+getIndexAlgorithm_ar_DZ;
getIndexAlgorithm_ar_EG;
getIndexAlgorithm_ar_LB;
getIndexAlgorithm_ar_OM;
@@ -721,6 +740,7 @@ getIndexAlgorithm_ky_KG;
getIndexAlgorithm_lg_UG;
getIndexAlgorithm_ln_CD;
getIndexAlgorithm_lo_LA;
+getIndexAlgorithm_mai_IN;
getIndexAlgorithm_ml_IN;
getIndexAlgorithm_mn_MN;
getIndexAlgorithm_mr_IN;
@@ -764,6 +784,7 @@ getLCInfo_af_NA;
getLCInfo_af_ZA;
getLCInfo_ak_GH;
getLCInfo_am_ET;
+getLCInfo_ar_DZ;
getLCInfo_ar_EG;
getLCInfo_ar_LB;
getLCInfo_ar_OM;
@@ -797,6 +818,7 @@ getLCInfo_ky_KG;
getLCInfo_lg_UG;
getLCInfo_ln_CD;
getLCInfo_lo_LA;
+getLCInfo_mai_IN;
getLCInfo_ml_IN;
getLCInfo_mn_MN;
getLCInfo_mr_IN;
@@ -840,6 +862,7 @@ getLocaleItem_af_NA;
getLocaleItem_af_ZA;
getLocaleItem_ak_GH;
getLocaleItem_am_ET;
+getLocaleItem_ar_DZ;
getLocaleItem_ar_EG;
getLocaleItem_ar_LB;
getLocaleItem_ar_OM;
@@ -873,6 +896,7 @@ getLocaleItem_ky_KG;
getLocaleItem_lg_UG;
getLocaleItem_ln_CD;
getLocaleItem_lo_LA;
+getLocaleItem_mai_IN;
getLocaleItem_ml_IN;
getLocaleItem_mn_MN;
getLocaleItem_mr_IN;
@@ -916,6 +940,7 @@ getOutlineNumberingLevels_af_NA;
getOutlineNumberingLevels_af_ZA;
getOutlineNumberingLevels_ak_GH;
getOutlineNumberingLevels_am_ET;
+getOutlineNumberingLevels_ar_DZ;
getOutlineNumberingLevels_ar_EG;
getOutlineNumberingLevels_ar_LB;
getOutlineNumberingLevels_ar_OM;
@@ -949,6 +974,7 @@ getOutlineNumberingLevels_ky_KG;
getOutlineNumberingLevels_lg_UG;
getOutlineNumberingLevels_ln_CD;
getOutlineNumberingLevels_lo_LA;
+getOutlineNumberingLevels_mai_IN;
getOutlineNumberingLevels_ml_IN;
getOutlineNumberingLevels_mn_MN;
getOutlineNumberingLevels_mr_IN;
@@ -992,6 +1018,7 @@ getReservedWords_af_NA;
getReservedWords_af_ZA;
getReservedWords_ak_GH;
getReservedWords_am_ET;
+getReservedWords_ar_DZ;
getReservedWords_ar_EG;
getReservedWords_ar_LB;
getReservedWords_ar_OM;
@@ -1025,6 +1052,7 @@ getReservedWords_ky_KG;
getReservedWords_lg_UG;
getReservedWords_ln_CD;
getReservedWords_lo_LA;
+getReservedWords_mai_IN;
getReservedWords_ml_IN;
getReservedWords_mn_MN;
getReservedWords_mr_IN;
@@ -1068,6 +1096,7 @@ getSearchOptions_af_NA;
getSearchOptions_af_ZA;
getSearchOptions_ak_GH;
getSearchOptions_am_ET;
+getSearchOptions_ar_DZ;
getSearchOptions_ar_EG;
getSearchOptions_ar_LB;
getSearchOptions_ar_OM;
@@ -1101,6 +1130,7 @@ getSearchOptions_ky_KG;
getSearchOptions_lg_UG;
getSearchOptions_ln_CD;
getSearchOptions_lo_LA;
+getSearchOptions_mai_IN;
getSearchOptions_ml_IN;
getSearchOptions_mn_MN;
getSearchOptions_mr_IN;
@@ -1144,6 +1174,7 @@ getTransliterations_af_NA;
getTransliterations_af_ZA;
getTransliterations_ak_GH;
getTransliterations_am_ET;
+getTransliterations_ar_DZ;
getTransliterations_ar_EG;
getTransliterations_ar_LB;
getTransliterations_ar_OM;
@@ -1177,6 +1208,7 @@ getTransliterations_ky_KG;
getTransliterations_lg_UG;
getTransliterations_ln_CD;
getTransliterations_lo_LA;
+getTransliterations_mai_IN;
getTransliterations_ml_IN;
getTransliterations_mn_MN;
getTransliterations_mr_IN;
@@ -1220,6 +1252,7 @@ getUnicodeScripts_af_NA;
getUnicodeScripts_af_ZA;
getUnicodeScripts_ak_GH;
getUnicodeScripts_am_ET;
+getUnicodeScripts_ar_DZ;
getUnicodeScripts_ar_EG;
getUnicodeScripts_ar_LB;
getUnicodeScripts_ar_OM;
@@ -1253,6 +1286,7 @@ getUnicodeScripts_ky_KG;
getUnicodeScripts_lg_UG;
getUnicodeScripts_ln_CD;
getUnicodeScripts_lo_LA;
+getUnicodeScripts_mai_IN;
getUnicodeScripts_ml_IN;
getUnicodeScripts_mn_MN;
getUnicodeScripts_mr_IN;
diff --git a/i18npool/source/localedata/data/lt_LT.xml b/i18npool/source/localedata/data/lt_LT.xml
index c23f542d6b5d..cd4cb0aca929 100644
--- a/i18npool/source/localedata/data/lt_LT.xml
+++ b/i18npool/source/localedata/data/lt_LT.xml
@@ -346,9 +346,12 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
- <Transliteration unoid="LOWERCASE_UPPERCASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
<ReservedWords>
diff --git a/i18npool/source/localedata/data/ltg_LV.xml b/i18npool/source/localedata/data/ltg_LV.xml
index c41c38c86b9c..7d4445d26426 100644
--- a/i18npool/source/localedata/data/ltg_LV.xml
+++ b/i18npool/source/localedata/data/ltg_LV.xml
@@ -65,23 +65,23 @@
<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[$Ls-64B];-# ##0[$Ls-64B]</FormatCode>
+ <FormatElement msgid="CurrencyFormatskey1" default="true" type="short" usage="CURRENCY" formatindex="12">
+ <FormatCode>[$Ls-64B] # ##0;[$Ls-64B] -# ##0</FormatCode>
</FormatElement>
- <FormatElement msgid="CurrencyFormatskey2" default="false" type="medium" usage="CURRENCY" formatindex="13">
- <FormatCode># ##0,00[$Ls-64B];-# ##0,00[$Ls-64B]</FormatCode>
+ <FormatElement msgid="CurrencyFormatskey2" default="false" type="medium" usage="CURRENCY" formatindex="13">
+ <FormatCode>[$Ls-64B] # ##0,00;[$Ls-64B] -# ##0,00</FormatCode>
</FormatElement>
- <FormatElement msgid="CurrencyFormatskey3" default="false" type="medium" usage="CURRENCY" formatindex="14">
- <FormatCode># ##0[$Ls-64B];[RED]-# ##0[$Ls-64B]</FormatCode>
+ <FormatElement msgid="CurrencyFormatskey3" default="false" type="medium" usage="CURRENCY" formatindex="14">
+ <FormatCode>[$Ls-64B] # ##0;[RED][$Ls-64B] -# ##0</FormatCode>
</FormatElement>
- <FormatElement msgid="CurrencyFormatskey4" default="true" type="medium" usage="CURRENCY" formatindex="15">
- <FormatCode># ##0,00[$Ls-64B];[RED]-# ##0,00[$Ls-64B]</FormatCode>
+ <FormatElement msgid="CurrencyFormatskey4" default="true" type="medium" usage="CURRENCY" formatindex="15">
+ <FormatCode>[$Ls-64B] # ##0,00;[RED][$Ls-64B] -# ##0,00</FormatCode>
</FormatElement>
- <FormatElement msgid="CurrencyFormatskey5" default="false" type="medium" usage="CURRENCY" formatindex="16">
+ <FormatElement msgid="CurrencyFormatskey5" default="false" type="medium" usage="CURRENCY" formatindex="16">
<FormatCode># ##0,00 CCC</FormatCode>
</FormatElement>
- <FormatElement msgid="CurrencyFormatskey6" default="false" type="medium" usage="CURRENCY" formatindex="17">
- <FormatCode># ##0,--[$Ls-64B];[RED]-# ##0,--[$Ls-64B]</FormatCode>
+ <FormatElement msgid="CurrencyFormatskey6" default="false" type="medium" usage="CURRENCY" formatindex="17">
+ <FormatCode>[$Ls-64B] # ##0,--;[RED][$Ls-64B] -# ##0,--</FormatCode>
</FormatElement>
<FormatElement msgid="DateFormatskey11" default="true" type="short" usage="DATE" formatindex="18">
<FormatCode>D.MM.YY</FormatCode>
diff --git a/i18npool/source/localedata/data/lv_LV.xml b/i18npool/source/localedata/data/lv_LV.xml
index 27bb0f13e409..0144bb4787cc 100644
--- a/i18npool/source/localedata/data/lv_LV.xml
+++ b/i18npool/source/localedata/data/lv_LV.xml
@@ -66,28 +66,28 @@
<FormatCode>0,00%</FormatCode>
</FormatElement>
<FormatElement msgid="CurrencyFormatskey1" default="true" type="short" usage="CURRENCY" formatindex="12">
- <FormatCode># ##0[$Ls-426];-# ##0[$Ls-426]</FormatCode>
+ <FormatCode>[$Ls-426] # ##0;[$Ls-426] -# ##0</FormatCode>
</FormatElement>
<FormatElement msgid="CurrencyFormatskey2" default="false" type="medium" usage="CURRENCY" formatindex="13">
- <FormatCode># ##0,00[$Ls-426];-# ##0,00[$Ls-426]</FormatCode>
+ <FormatCode>[$Ls-426] # ##0,00;[$Ls-426] -# ##0,00</FormatCode>
</FormatElement>
<FormatElement msgid="CurrencyFormatskey3" default="false" type="medium" usage="CURRENCY" formatindex="14">
- <FormatCode># ##0[$Ls-426];[RED]-# ##0[$Ls-426]</FormatCode>
+ <FormatCode>[$Ls-426] # ##0;[RED][$Ls-426] -# ##0</FormatCode>
</FormatElement>
<FormatElement msgid="CurrencyFormatskey4" default="true" type="medium" usage="CURRENCY" formatindex="15">
- <FormatCode># ##0,00[$Ls-426];[RED]-# ##0,00[$Ls-426]</FormatCode>
+ <FormatCode>[$Ls-426] # ##0,00;[RED][$Ls-426] -# ##0,00</FormatCode>
</FormatElement>
<FormatElement msgid="CurrencyFormatskey5" default="false" type="medium" usage="CURRENCY" formatindex="16">
<FormatCode># ##0,00 CCC</FormatCode>
</FormatElement>
<FormatElement msgid="CurrencyFormatskey6" default="false" type="medium" usage="CURRENCY" formatindex="17">
- <FormatCode># ##0,--[$Ls-426];[RED]-# ##0,--[$Ls-426]</FormatCode>
+ <FormatCode>[$Ls-426] # ##0,--;[RED][$Ls-426] -# ##0,--</FormatCode>
</FormatElement>
<FormatElement msgid="DateFormatskey1" default="true" type="short" usage="DATE" formatindex="18">
<FormatCode>D.M.YY</FormatCode>
</FormatElement>
<FormatElement msgid="DateFormatskey9" default="true" type="long" usage="DATE" formatindex="19">
- <FormatCode>DD. NNNNMMMM, YYYY</FormatCode>
+ <FormatCode>YYYY. "gada" DD. MMMM, NNNN</FormatCode>
</FormatElement>
<FormatElement msgid="DateFormatskey8" default="true" type="medium" usage="DATE" formatindex="20">
<FormatCode>DD.MM.YY</FormatCode>
@@ -120,7 +120,7 @@
<FormatCode>NN, D. MMMM, YYYY</FormatCode>
</FormatElement>
<FormatElement msgid="DateFormatskey15" default="false" type="long" usage="DATE" formatindex="30">
- <FormatCode>NNNNMMMM D, YYYY</FormatCode>
+ <FormatCode>NNNN, YYYY. "gada" DD. MMMM</FormatCode>
</FormatElement>
<FormatElement msgid="DateFormatskey18" default="false" type="short" usage="DATE" formatindex="31">
<FormatCode>DD-MM</FormatCode>
@@ -325,6 +325,8 @@
</LC_CURRENCY>
<LC_TRANSLITERATION>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE" />
</LC_TRANSLITERATION>
diff --git a/i18npool/source/localedata/data/mai_IN.xml b/i18npool/source/localedata/data/mai_IN.xml
new file mode 100644
index 000000000000..07c3d39c6a9d
--- /dev/null
+++ b/i18npool/source/localedata/data/mai_IN.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>mai</LangID>
+ <DefaultName>Maithili</DefaultName>
+ </Language>
+ <Country>
+ <CountryID>IN</CountryID>
+ <DefaultName>India</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="[$रू.-645]">
+ <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>14</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>INR</CurrencyID>
+ <CurrencySymbol>रू.</CurrencySymbol>
+ <BankSymbol>INR</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>पहिल चौथाई</quarter1Abbreviation>
+ <quarter2Abbreviation>दोसर चौथाई</quarter2Abbreviation>
+ <quarter3Abbreviation>तेसर चौथाई</quarter3Abbreviation>
+ <quarter4Abbreviation>चौथा चौथाई</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/makefile.mk b/i18npool/source/localedata/data/makefile.mk
index 2591b70fb63d..1ac16a31fe37 100644
--- a/i18npool/source/localedata/data/makefile.mk
+++ b/i18npool/source/localedata/data/makefile.mk
@@ -68,6 +68,7 @@ MY_MISC_CXXFILES = \
$(MISC)$/localedata_af_ZA.cxx \
$(MISC)$/localedata_ak_GH.cxx \
$(MISC)$/localedata_am_ET.cxx \
+ $(MISC)$/localedata_ar_DZ.cxx \
$(MISC)$/localedata_ar_EG.cxx \
$(MISC)$/localedata_ar_LB.cxx \
$(MISC)$/localedata_ar_SA.cxx \
@@ -176,6 +177,7 @@ MY_MISC_CXXFILES = \
$(MISC)$/localedata_lt_LT.cxx \
$(MISC)$/localedata_ltg_LV.cxx \
$(MISC)$/localedata_lv_LV.cxx \
+ $(MISC)$/localedata_mai_IN.cxx \
$(MISC)$/localedata_mk_MK.cxx \
$(MISC)$/localedata_ml_IN.cxx \
$(MISC)$/localedata_mn_MN.cxx \
@@ -200,6 +202,7 @@ MY_MISC_CXXFILES = \
$(MISC)$/localedata_pt_BR.cxx \
$(MISC)$/localedata_pt_PT.cxx \
$(MISC)$/localedata_ro_RO.cxx \
+ $(MISC)$/localedata_rue_SK.cxx \
$(MISC)$/localedata_ru_RU.cxx \
$(MISC)$/localedata_rw_RW.cxx \
$(MISC)$/localedata_sg_CF.cxx \
@@ -378,8 +381,9 @@ SHL3OBJS= \
$(SLO)$/localedata_pl_PL.obj \
$(SLO)$/localedata_pt_BR.obj \
$(SLO)$/localedata_pt_PT.obj \
- $(SLO)$/localedata_ru_RU.obj \
$(SLO)$/localedata_ro_RO.obj \
+ $(SLO)$/localedata_rue_SK.obj \
+ $(SLO)$/localedata_ru_RU.obj \
$(SLO)$/localedata_sc_IT.obj \
$(SLO)$/localedata_sh_ME.obj \
$(SLO)$/localedata_sh_RS.obj \
@@ -416,6 +420,7 @@ SHL4OBJS= \
$(SLO)$/localedata_af_ZA.obj \
$(SLO)$/localedata_ak_GH.obj \
$(SLO)$/localedata_am_ET.obj \
+ $(SLO)$/localedata_ar_DZ.obj \
$(SLO)$/localedata_ar_EG.obj \
$(SLO)$/localedata_ar_LB.obj \
$(SLO)$/localedata_ar_OM.obj \
@@ -449,6 +454,7 @@ SHL4OBJS= \
$(SLO)$/localedata_lg_UG.obj \
$(SLO)$/localedata_ln_CD.obj \
$(SLO)$/localedata_lo_LA.obj \
+ $(SLO)$/localedata_mai_IN.obj \
$(SLO)$/localedata_ml_IN.obj \
$(SLO)$/localedata_mn_MN.obj \
$(SLO)$/localedata_mr_IN.obj \
diff --git a/i18npool/source/localedata/data/mk_MK.xml b/i18npool/source/localedata/data/mk_MK.xml
index b9862478513e..10e488e3cac1 100644
--- a/i18npool/source/localedata/data/mk_MK.xml
+++ b/i18npool/source/localedata/data/mk_MK.xml
@@ -322,8 +322,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/mt_MT.xml b/i18npool/source/localedata/data/mt_MT.xml
index 790bd97303e0..bcc5869932b4 100644
--- a/i18npool/source/localedata/data/mt_MT.xml
+++ b/i18npool/source/localedata/data/mt_MT.xml
@@ -324,8 +324,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/my_MM.xml b/i18npool/source/localedata/data/my_MM.xml
index dada8a5402d9..6c12c8986c8f 100644
--- a/i18npool/source/localedata/data/my_MM.xml
+++ b/i18npool/source/localedata/data/my_MM.xml
@@ -395,8 +395,11 @@
</LC_CURRENCY>
<LC_TRANSLITERATION>
<!-- There is often English mixed with Myanmar, so leave these in for now -->
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/ne_NP.xml b/i18npool/source/localedata/data/ne_NP.xml
index cca8be996a70..558027ac0e1c 100644
--- a/i18npool/source/localedata/data/ne_NP.xml
+++ b/i18npool/source/localedata/data/ne_NP.xml
@@ -322,8 +322,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/oc_FR.xml b/i18npool/source/localedata/data/oc_FR.xml
index ef3dd47c0dc6..c64fe872c6e8 100644
--- a/i18npool/source/localedata/data/oc_FR.xml
+++ b/i18npool/source/localedata/data/oc_FR.xml
@@ -323,8 +323,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/or_IN.xml b/i18npool/source/localedata/data/or_IN.xml
index 168b542f1894..22333451f6ea 100644
--- a/i18npool/source/localedata/data/or_IN.xml
+++ b/i18npool/source/localedata/data/or_IN.xml
@@ -322,8 +322,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/rue_SK.xml b/i18npool/source/localedata/data/rue_SK.xml
new file mode 100644
index 000000000000..86b22d5c5a2e
--- /dev/null
+++ b/i18npool/source/localedata/data/rue_SK.xml
@@ -0,0 +1,359 @@
+<?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>rue</LangID>
+ <DefaultName>Rusyn</DefaultName>
+ </Language>
+ <Country>
+ <CountryID>SK</CountryID>
+ <DefaultName>Slovakia</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="[$€-8256]">
+ <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>
+ <UnicodeScript>8</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>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>евро</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>1. четвертина</quarter1Word>
+ <quarter2Word>2. четвертина</quarter2Word>
+ <quarter3Word>3. четвертина</quarter3Word>
+ <quarter4Word>4. четвертина</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/sg_CF.xml b/i18npool/source/localedata/data/sg_CF.xml
index 075b1a43ae18..61ee40b8081e 100644
--- a/i18npool/source/localedata/data/sg_CF.xml
+++ b/i18npool/source/localedata/data/sg_CF.xml
@@ -323,8 +323,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/sh_RS.xml b/i18npool/source/localedata/data/sh_RS.xml
index 4b744bdd5913..01faa188c9e2 100644
--- a/i18npool/source/localedata/data/sh_RS.xml
+++ b/i18npool/source/localedata/data/sh_RS.xml
@@ -211,8 +211,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/shs_CA.xml b/i18npool/source/localedata/data/shs_CA.xml
index c7e46fa3453d..cfd01f31ac0d 100644
--- a/i18npool/source/localedata/data/shs_CA.xml
+++ b/i18npool/source/localedata/data/shs_CA.xml
@@ -323,8 +323,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/sk_SK.xml b/i18npool/source/localedata/data/sk_SK.xml
index 7820ef290a46..b233f3981284 100644
--- a/i18npool/source/localedata/data/sk_SK.xml
+++ b/i18npool/source/localedata/data/sk_SK.xml
@@ -369,9 +369,12 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
- <Transliteration unoid="LOWERCASE_UPPERCASE" />
</LC_TRANSLITERATION>
<LC_MISC>
<ReservedWords>
diff --git a/i18npool/source/localedata/data/sl_SI.xml b/i18npool/source/localedata/data/sl_SI.xml
index b4de5c4a184b..19139d5e0cc0 100644
--- a/i18npool/source/localedata/data/sl_SI.xml
+++ b/i18npool/source/localedata/data/sl_SI.xml
@@ -331,8 +331,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/so_SO.xml b/i18npool/source/localedata/data/so_SO.xml
index 981cb54aff3e..e332e2b07d52 100644
--- a/i18npool/source/localedata/data/so_SO.xml
+++ b/i18npool/source/localedata/data/so_SO.xml
@@ -330,8 +330,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/sr_RS.xml b/i18npool/source/localedata/data/sr_RS.xml
index 4023c2d4afeb..13133333f37e 100644
--- a/i18npool/source/localedata/data/sr_RS.xml
+++ b/i18npool/source/localedata/data/sr_RS.xml
@@ -350,8 +350,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/sw_TZ.xml b/i18npool/source/localedata/data/sw_TZ.xml
index 22bf61807a54..3a92d8eb3593 100644
--- a/i18npool/source/localedata/data/sw_TZ.xml
+++ b/i18npool/source/localedata/data/sw_TZ.xml
@@ -322,8 +322,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/tk_TM.xml b/i18npool/source/localedata/data/tk_TM.xml
index cfd09c63c4ab..c30d1f782811 100644
--- a/i18npool/source/localedata/data/tk_TM.xml
+++ b/i18npool/source/localedata/data/tk_TM.xml
@@ -323,8 +323,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/tpi_PG.xml b/i18npool/source/localedata/data/tpi_PG.xml
index 0017a1081233..51cc3500cc57 100644
--- a/i18npool/source/localedata/data/tpi_PG.xml
+++ b/i18npool/source/localedata/data/tpi_PG.xml
@@ -323,8 +323,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/uk_UA.xml b/i18npool/source/localedata/data/uk_UA.xml
index 981c24f7c94f..1025096c7a6a 100644
--- a/i18npool/source/localedata/data/uk_UA.xml
+++ b/i18npool/source/localedata/data/uk_UA.xml
@@ -369,9 +369,12 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
-<Transliteration unoid="UPPERCASE_LOWERCASE"/>
-<Transliteration unoid="IGNORE_CASE"/>
-<Transliteration unoid="LOWERCASE_UPPERCASE" />
+ <Transliteration unoid="SENTENCE_CASE"/>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
+ <Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
+ <Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
<ReservedWords>
diff --git a/i18npool/source/localedata/data/vi_VN.xml b/i18npool/source/localedata/data/vi_VN.xml
index 4b9bfb266051..93fc1ee3adc4 100644
--- a/i18npool/source/localedata/data/vi_VN.xml
+++ b/i18npool/source/localedata/data/vi_VN.xml
@@ -323,8 +323,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/zh_CN.xml b/i18npool/source/localedata/data/zh_CN.xml
index 0fadbf5d9075..c9d1371cb753 100644
--- a/i18npool/source/localedata/data/zh_CN.xml
+++ b/i18npool/source/localedata/data/zh_CN.xml
@@ -415,16 +415,19 @@
<!--more currency should be put here -->
</LC_CURRENCY>
<LC_TRANSLITERATION>
-<Transliteration unoid="UPPERCASE_LOWERCASE"/>
-<Transliteration unoid="LOWERCASE_UPPERCASE"/>
-<Transliteration unoid="HALFWIDTH_FULLWIDTH"/>
-<Transliteration unoid="FULLWIDTH_HALFWIDTH"/>
-<Transliteration unoid="NumToTextLower_zh_CN"/>
-<Transliteration unoid="NumToTextUpper_zh_CN"/>
-<Transliteration unoid="NumToCharLower_zh_CN"/>
-<Transliteration unoid="NumToCharUpper_zh_CN"/>
-<Transliteration unoid="IGNORE_CASE"/>
-<Transliteration unoid="IGNORE_WIDTH"/>
+ <Transliteration unoid="SENTENCE_CASE"/>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
+ <Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
+ <Transliteration unoid="NumToTextLower_zh_CN"/>
+ <Transliteration unoid="NumToTextUpper_zh_CN"/>
+ <Transliteration unoid="NumToCharLower_zh_CN"/>
+ <Transliteration unoid="NumToCharUpper_zh_CN"/>
+ <Transliteration unoid="HALFWIDTH_FULLWIDTH"/>
+ <Transliteration unoid="FULLWIDTH_HALFWIDTH"/>
+ <Transliteration unoid="IGNORE_CASE"/>
+ <Transliteration unoid="IGNORE_WIDTH"/>
</LC_TRANSLITERATION>
<LC_MISC>
<ForbiddenCharacters>
diff --git a/i18npool/source/localedata/data/zh_TW.xml b/i18npool/source/localedata/data/zh_TW.xml
index 1d1e476b7771..aa53647057f8 100644
--- a/i18npool/source/localedata/data/zh_TW.xml
+++ b/i18npool/source/localedata/data/zh_TW.xml
@@ -343,17 +343,20 @@
<!--more currency should be put here -->
</LC_CURRENCY>
<LC_TRANSLITERATION>
-<Transliteration unoid="NumToTextLower_zh_TW" />
-<Transliteration unoid="NumToTextUpper_zh_TW" />
-<Transliteration unoid="NumToCharLower_zh_TW" />
-<Transliteration unoid="NumToCharUpper_zh_TW" />
-<Transliteration unoid="TextToChuyin_zh_TW" />
-<Transliteration unoid="IGNORE_CASE" />
-<Transliteration unoid="UPPERCASE_LOWERCASE" />
-<Transliteration unoid="LOWERCASE_UPPERCASE" />
-<Transliteration unoid="IGNORE_WIDTH" />
-<Transliteration unoid="HALFWIDTH_FULLWIDTH"/>
-<Transliteration unoid="HALFWIDTH_FULLWIDTH"/>
+ <Transliteration unoid="SENTENCE_CASE"/>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
+ <Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
+ <Transliteration unoid="NumToTextLower_zh_TW" />
+ <Transliteration unoid="NumToTextUpper_zh_TW" />
+ <Transliteration unoid="NumToCharLower_zh_TW" />
+ <Transliteration unoid="NumToCharUpper_zh_TW" />
+ <Transliteration unoid="TextToChuyin_zh_TW" />
+ <Transliteration unoid="HALFWIDTH_FULLWIDTH"/>
+ <Transliteration unoid="FULLWIDTH_HALFWIDTH"/>
+ <Transliteration unoid="IGNORE_CASE" />
+ <Transliteration unoid="IGNORE_WIDTH" />
</LC_TRANSLITERATION>
<LC_MISC>
<ForbiddenCharacters>
diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx
index 920a63fe149a..34f4f6bbb520 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 },
+ { "rue_SK", lcl_DATA_EURO },
{ "ja_JP", lcl_DATA_OTHERS },
{ "ko_KR", lcl_DATA_OTHERS },
@@ -179,6 +180,7 @@ static const struct {
{ "zh_MO", lcl_DATA_OTHERS },
{ "ar_EG", lcl_DATA_OTHERS },
+ { "ar_DZ", lcl_DATA_OTHERS },
{ "ar_LB", lcl_DATA_OTHERS },
{ "ar_SA", lcl_DATA_OTHERS },
{ "ar_TN", lcl_DATA_OTHERS },
@@ -248,6 +250,7 @@ static const struct {
{ "ug_CN", lcl_DATA_OTHERS },
{ "om_ET", lcl_DATA_OTHERS },
{ "plt_MG", lcl_DATA_OTHERS },
+ { "mai_IN", lcl_DATA_OTHERS },
};
static const sal_Unicode under = sal_Unicode('_');
diff --git a/i18npool/source/localedata/saxparser.cxx b/i18npool/source/localedata/saxparser.cxx
index 083d2097a54a..9787b9c810a6 100644
--- a/i18npool/source/localedata/saxparser.cxx
+++ b/i18npool/source/localedata/saxparser.cxx
@@ -125,13 +125,14 @@ Reference< XInputStream > createStreamFromFile(
if( f ) {
fseek( f , 0 , SEEK_END );
- int nLength = ftell( f );
+ size_t nLength = ftell( f );
fseek( f , 0 , SEEK_SET );
Sequence<sal_Int8> seqIn(nLength);
- fread( seqIn.getArray() , nLength , 1 , f );
-
- r = Reference< XInputStream > ( new OInputStream( seqIn ) );
+ if (fread( seqIn.getArray() , nLength , 1 , f ) == 1)
+ r = Reference< XInputStream > ( new OInputStream( seqIn ) );
+ else
+ fprintf(stderr, "failure reading %s\n", pcFile);
fclose( f );
}
return r;
diff --git a/i18npool/source/paper/paper.cxx b/i18npool/source/paper/paper.cxx
index 21be12588e37..e94efa6e06c5 100644
--- a/i18npool/source/paper/paper.cxx
+++ b/i18npool/source/paper/paper.cxx
@@ -436,8 +436,8 @@ Paper PaperInfo::fromPSName(const rtl::OString &rName)
}
//http://wiki.services.openoffice.org/wiki/DefaultPaperSize
-//http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/localedata/locales/?cvsroot=glibc
//http://www.unicode.org/cldr/data/charts/supplemental/territory_language_information.html
+//http://sourceware.org/git/?p=glibc.git;a=tree;f=localedata/locales
//http://en.wikipedia.org/wiki/Paper_size
//http://msdn.microsoft.com/en-us/library/cc195164.aspx
PaperInfo PaperInfo::getDefaultPaperForLocale(
@@ -448,22 +448,57 @@ PaperInfo PaperInfo::getDefaultPaperForLocale(
if (
//United States, Letter
!rLocale.Country.compareToAscii("US") ||
- //Puerto Rico, http://sources.redhat.com/ml/libc-hacker/2001-07/msg00046.html
+ //Puerto Rico:
+ // http://unicode.org/cldr/trac/ticket/1710
+ // http://sources.redhat.com/ml/libc-hacker/2001-07/msg00046.html
!rLocale.Country.compareToAscii("PR") ||
- //Canada, http://sources.redhat.com/ml/libc-hacker/2001-07/msg00053.html
+ //Canada:
+ // http://sources.redhat.com/ml/libc-hacker/2001-07/msg00053.html
!rLocale.Country.compareToAscii("CA") ||
- //Venuzuela, https://www.redhat.com/archives/fedora-devel-list/2008-August/msg00019.html
+ //Venuzuela:
+ // http://unicode.org/cldr/trac/ticket/1710
+ // https://www.redhat.com/archives/fedora-devel-list/2008-August/msg00019.html
!rLocale.Country.compareToAscii("VE") ||
- //Chile, https://www.redhat.com/archives/fedora-devel-list/2008-August/msg00240.html
+ //Chile:
+ // http://unicode.org/cldr/trac/ticket/1710
+ // https://www.redhat.com/archives/fedora-devel-list/2008-August/msg00240.html
!rLocale.Country.compareToAscii("CL") ||
- //Mexico, http://qa.openoffice.org/issues/show_bug.cgi?id=49739
+ //Mexico:
+ // http://unicode.org/cldr/trac/ticket/1710
+ // http://qa.openoffice.org/issues/show_bug.cgi?id=49739
!rLocale.Country.compareToAscii("MX") ||
- //Colombia, http://qa.openoffice.org/issues/show_bug.cgi?id=69703
+ //Colombia:
+ // http://unicode.org/cldr/trac/ticket/1710
+ // http://qa.openoffice.org/issues/show_bug.cgi?id=69703
!rLocale.Country.compareToAscii("CO") ||
- //Philippines,
+ //Philippines:
+ // http://unicode.org/cldr/trac/ticket/1710
// http://ubuntuliving.blogspot.com/2008/07/default-paper-size-in-evince.html
// http://www.gov.ph/faqs/driverslicense.asp
- !rLocale.Country.compareToAscii("PH")
+ !rLocale.Country.compareToAscii("PH") ||
+ //Belize:
+ // http://unicode.org/cldr/trac/ticket/2585
+ // http://www.belize.gov.bz/ct.asp?xItem=1666&ctNode=486&mp=27
+ !rLocale.Country.compareToAscii("BZ") ||
+ //Costa Rica:
+ // http://unicode.org/cldr/trac/ticket/2585
+ // http://sources.redhat.com/bugzilla/show_bug.cgi?id=11258
+ !rLocale.Country.compareToAscii("CR") ||
+ //Guatemala:
+ // http://unicode.org/cldr/trac/ticket/2585
+ // http://sources.redhat.com/bugzilla/show_bug.cgi?id=10936
+ !rLocale.Country.compareToAscii("GT") ||
+ //Nicaragua:
+ // http://unicode.org/cldr/trac/ticket/2585
+ !rLocale.Country.compareToAscii("NI") ||
+ //Panama:
+ // http://unicode.org/cldr/trac/ticket/2585
+ // http://www.minsa.gob.pa/minsa/tl_files/documents/baner_informativo/INSTRUMENTO%20DE%20INVESTIGACION%20DE%20RAAV%202009.pdf
+ !rLocale.Country.compareToAscii("PA") ||
+ //El Salvador:
+ // http://unicode.org/cldr/trac/ticket/2585
+ // http://www.tse.gob.sv
+ !rLocale.Country.compareToAscii("SV")
)
{
eType = PAPER_LETTER;
diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx
index 2274aa5b714d..280e12dfe4f7 100644
--- a/i18npool/source/registerservices/registerservices.cxx
+++ b/i18npool/source/registerservices/registerservices.cxx
@@ -170,6 +170,9 @@ IMPL_CREATEINSTANCE_MSF( TextConversion_zh )
IMPL_CREATEINSTANCE( Transliteration_u2l )
IMPL_CREATEINSTANCE( Transliteration_l2u )
+IMPL_CREATEINSTANCE( Transliteration_sentencecase )
+IMPL_CREATEINSTANCE( Transliteration_titlecase )
+IMPL_CREATEINSTANCE( Transliteration_togglecase )
IMPL_CREATEINSTANCE( Transliteration_caseignore )
IMPL_CREATEINSTANCE( hiraganaToKatakana )
IMPL_CREATEINSTANCE( katakanaToHiragana )
@@ -421,6 +424,15 @@ static const struct InstancesArray {
TRLT_IMPLNAME_PREFIX "LOWERCASE_UPPERCASE",
&Transliteration_l2u_CreateInstance },
{ TRLT_SERVICELNAME_L10N,
+ TRLT_IMPLNAME_PREFIX "SENTENCE_CASE",
+ &Transliteration_sentencecase_CreateInstance },
+ { TRLT_SERVICELNAME_L10N,
+ TRLT_IMPLNAME_PREFIX "TITLE_CASE",
+ &Transliteration_titlecase_CreateInstance },
+ { TRLT_SERVICELNAME_L10N,
+ TRLT_IMPLNAME_PREFIX "TOGGLE_CASE",
+ &Transliteration_togglecase_CreateInstance },
+ { TRLT_SERVICELNAME_L10N,
TRLT_IMPLNAME_PREFIX "IGNORE_CASE",
&Transliteration_caseignore_CreateInstance },
{ TRLT_SERVICELNAME_L10N,
diff --git a/i18npool/source/search/i18nsearch.map b/i18npool/source/search/i18nsearch.map
deleted file mode 100644
index 02fe32ac5839..000000000000
--- a/i18npool/source/search/i18nsearch.map
+++ /dev/null
@@ -1,10 +0,0 @@
-UDK_3_0_0 {
-global:
- GetVersionInfo;
- component_getImplementationEnvironment;
- component_getFactory;
- component_writeInfo;
-
-local:
- *;
-};
diff --git a/i18npool/source/search/makefile.mk b/i18npool/source/search/makefile.mk
index 0a0d804c5c06..aed976edd896 100644
--- a/i18npool/source/search/makefile.mk
+++ b/i18npool/source/search/makefile.mk
@@ -68,7 +68,7 @@ SHL1STDLIBS= \
$(I18NREGEXPLIB)
SHL1DEPN= makefile.mk
-SHL1VERSIONMAP= i18nsearch.map
+SHL1VERSIONMAP= $(SOLARENV)/src/component.map
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
diff --git a/i18npool/source/textconversion/data/textconv_dict.map b/i18npool/source/textconversion/data/textconv_dict.map
index 03f9073c5d86..afd873b6f38e 100644
--- a/i18npool/source/textconversion/data/textconv_dict.map
+++ b/i18npool/source/textconversion/data/textconv_dict.map
@@ -1,4 +1,4 @@
-OOO_1.1 {
+UDK_3_0_0 {
global:
GetVersionInfo;
getHangul2HanjaData;
diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx
index a869f6713b99..b58347826470 100644
--- a/i18npool/source/transliteration/transliteration_body.cxx
+++ b/i18npool/source/transliteration/transliteration_body.cxx
@@ -28,7 +28,17 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_i18npool.hxx"
+#include <rtl/ustrbuf.hxx>
#include <i18nutil/casefolding.hxx>
+#include <i18nutil/unicode.hxx>
+
+#include <comphelper/processfactory.hxx>
+#include <osl/diagnose.h>
+
+
+#include "characterclassificationImpl.hxx"
+#include "breakiteratorImpl.hxx"
+
#define TRANSLITERATION_ALL
#include "transliteration_body.hxx"
@@ -36,8 +46,11 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::rtl;
+#define A2OU(x) OUString::createFromAscii(x)
+
namespace com { namespace sun { namespace star { namespace i18n {
+
Transliteration_body::Transliteration_body()
{
nMappingType = 0;
@@ -68,9 +81,35 @@ Transliteration_body::transliterateRange( const OUString& str1, const OUString&
return ostr;
}
+
+static sal_uInt8 lcl_getMappingTypeForToggleCase( sal_uInt8 nMappingType, sal_Unicode cChar )
+{
+ sal_uInt8 nRes = nMappingType;
+
+ // take care of TOGGLE_CASE transliteration:
+ // nMappingType should not be a combination of flags, thuse we decide now
+ // which one to use.
+ if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower))
+ {
+ const sal_Int16 nType = unicode::getUnicodeType( cChar );
+ if (nType & 0x02 /* lower case*/)
+ nRes = MappingTypeLowerToUpper;
+ else
+ {
+ OSL_ENSURE( nType & 0x01 /* upper case */, "uppercase character expected! 'Toggle case' failed?" );
+ nRes = MappingTypeUpperToLower;
+ }
+ }
+
+ return nRes;
+}
+
+
OUString SAL_CALL
-Transliteration_body::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
- Sequence< sal_Int32 >& offset) throw(RuntimeException)
+Transliteration_body::transliterate(
+ const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
+ Sequence< sal_Int32 >& offset)
+ throw(RuntimeException)
{
#if 0
/* Performance optimization:
@@ -139,7 +178,12 @@ Transliteration_body::transliterate( const OUString& inStr, sal_Int32 startPos,
sal_Int32 nOffCount = 0, i;
for (i = 0; i < nCount; i++)
{
- const Mapping &map = casefolding::getValue(in, i, nCount, aLocale, nMappingType);
+ // take care of TOGGLE_CASE transliteration:
+ sal_uInt8 nTmpMappingType = nMappingType;
+ if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower))
+ nTmpMappingType = lcl_getMappingTypeForToggleCase( nMappingType, in[i] );
+
+ const Mapping &map = casefolding::getValue( in, i, nCount, aLocale, nTmpMappingType );
nOffCount += map.nmap;
}
rtl_uString* pStr = x_rtl_uString_new_WithLength( nOffCount, 1 ); // our x_rtl_ustring.h
@@ -152,7 +196,12 @@ Transliteration_body::transliterate( const OUString& inStr, sal_Int32 startPos,
sal_Int32 * pArr = offset.getArray();
for (i = 0; i < nCount; i++)
{
- const Mapping &map = casefolding::getValue(in, i, nCount, aLocale, nMappingType);
+ // take care of TOGGLE_CASE transliteration:
+ sal_uInt8 nTmpMappingType = nMappingType;
+ if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower))
+ nTmpMappingType = lcl_getMappingTypeForToggleCase( nMappingType, in[i] );
+
+ const Mapping &map = casefolding::getValue( in, i, nCount, aLocale, nTmpMappingType );
for (sal_Int32 k = 0; k < map.nmap; k++)
{
pArr[j] = i + startPos;
@@ -184,7 +233,12 @@ Transliteration_body::transliterate( const OUString& inStr, sal_Int32 startPos,
sal_Int32 j = 0;
for ( sal_Int32 i = 0; i < nCount; i++)
{
- const Mapping &map = casefolding::getValue(in, i, nCount, aLocale, nMappingType);
+ // take care of TOGGLE_CASE transliteration:
+ sal_uInt8 nTmpMappingType = nMappingType;
+ if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower))
+ nTmpMappingType = lcl_getMappingTypeForToggleCase( nMappingType, in[i] );
+
+ const Mapping &map = casefolding::getValue( in, i, nCount, aLocale, nTmpMappingType );
for (sal_Int32 k = 0; k < map.nmap; k++)
{
out[j++] = map.map[k];
@@ -258,4 +312,203 @@ Transliteration_l2u::Transliteration_l2u()
implementationName = "com.sun.star.i18n.Transliteration.Transliteration_l2u";
}
+Transliteration_togglecase::Transliteration_togglecase()
+{
+ // usually nMappingType must NOT be a combiantion of different flages here,
+ // but we take care of that problem in Transliteration_body::transliterate above
+ // before that value is used. There we will decide which of both is to be used on
+ // a per character basis.
+ nMappingType = MappingTypeLowerToUpper | MappingTypeUpperToLower;
+ transliterationName = "toggle(generic)";
+ implementationName = "com.sun.star.i18n.Transliteration.Transliteration_togglecase";
+}
+
+Transliteration_titlecase::Transliteration_titlecase()
+{
+ nMappingType = MappingTypeToTitle;
+ transliterationName = "title(generic)";
+ implementationName = "com.sun.star.i18n.Transliteration.Transliteration_titlecase";
+}
+
+rtl::OUString SAL_CALL Transliteration_titlecase::transliterate(
+ const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
+ Sequence< sal_Int32 >& /*offset*/ )
+ throw(RuntimeException)
+{
+ Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ CharacterClassificationImpl aCharClassImpl( xMSF );
+
+ // possible problem: the locale is not exactly specific for each word in the text...
+ OUString aRes( aCharClassImpl.toTitle( inStr, startPos, nCount, aLocale ) );
+ return aRes;
+}
+
+Transliteration_sentencecase::Transliteration_sentencecase()
+{
+ nMappingType = MappingTypeToTitle; // though only to be applied to the first word...
+ transliterationName = "sentence(generic)";
+ implementationName = "com.sun.star.i18n.Transliteration.Transliteration_sentencecase";
+}
+
+rtl::OUString SAL_CALL Transliteration_sentencecase::transliterate(
+ const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
+ Sequence< sal_Int32 >& offset )
+ throw(RuntimeException)
+{
+ // inspired from Transliteration_body::transliterate
+ sal_Int32 nOffCount = 0, i;
+ bool bPoint = true;
+ if (useOffset)
+ {
+ for( i = 0; i < nCount; ++i ) {
+ sal_Unicode c = inStr.getStr()[ i + startPos ];
+ if( sal_Unicode('.') == c || sal_Unicode('!') == c || sal_Unicode('?') == c ) {
+ bPoint = true;
+ nOffCount++;
+ }
+ else if( unicode::isAlpha( c ) || unicode::isDigit( c ) )
+ {
+ const Mapping* map = 0;
+ if( bPoint && unicode::isLower( c ))
+ {
+ map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeLowerToUpper);
+ bPoint = false;
+ }
+ else if (!bPoint && unicode::isUpper( c ))
+ {
+ map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeUpperToLower);
+ }
+
+ if(map == 0)
+ {
+ nOffCount++;
+ }
+ else
+ {
+ nOffCount += map->nmap;
+ }
+ }
+ else
+ {
+ nOffCount++;
+ }
+ }
+ }
+
+ bPoint = true;
+ rtl::OUStringBuffer result;
+
+ if (useOffset)
+ {
+ result.ensureCapacity(nOffCount);
+ if ( nOffCount != offset.getLength() )
+ offset.realloc( nOffCount );
+ }
+
+
+ sal_Int32 j = 0;
+ sal_Int32 * pArr = offset.getArray();
+ for( i = 0; i < nCount; ++i ) {
+ sal_Unicode c = inStr.getStr()[ i + startPos ];
+ if( sal_Unicode('.') == c || sal_Unicode('!') == c || sal_Unicode('?') == c ) {
+ bPoint = true;
+ result.append(c);
+ pArr[j++] = i + startPos;
+ }
+ else if( unicode::isAlpha( c ) || unicode::isDigit( c ) )
+ {
+ const Mapping* map = 0;
+ if( bPoint && unicode::isLower( c ))
+ {
+ map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeLowerToUpper);
+ }
+ else if (!bPoint && unicode::isUpper( c ))
+ {
+ map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeUpperToLower);
+ }
+
+ if(map == 0)
+ {
+ result.append( c );
+ pArr[j++] = i + startPos;
+ }
+ else
+ {
+ for (sal_Int32 k = 0; k < map->nmap; k++)
+ {
+ result.append( map->map[k] );
+ pArr[j++] = i + startPos;
+ }
+ }
+ bPoint = false;
+ }
+ else
+ {
+ result.append( c );
+ pArr[j++] = i + startPos;
+ }
+ }
+ return result.makeStringAndClear();
+}
+
+#if 0
+// TL: alternative implemntation try. But breakiterator has its problem too since
+// beginOfSentence does not work as expected with '.'. See comment below.
+// For the time being I will leave this code here as a from-scratch sample if the
+// breakiterator works better at some point...
+rtl::OUString SAL_CALL Transliteration_sentencecase::transliterate(
+ const OUString& inStr, sal_Int32 nStartPos, sal_Int32 nCount,
+ Sequence< sal_Int32 >& /*offset*/ )
+ throw(RuntimeException)
+{
+ OUString aRes( inStr.copy( nStartPos, nCount ) );
+
+ if (nStartPos >= 0 && nStartPos < inStr.getLength() && nCount > 0)
+ {
+ Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ BreakIteratorImpl brk( xMSF );
+
+ sal_Int32 nSentenceStart = -1, nOldSentenceStart = -1;
+ sal_Int32 nPos = nStartPos + nCount - 1;
+ while (nPos >= nStartPos && nPos != -1)
+ {
+ // possible problem: the locale is not exactly specific for each sentence in the text,
+ // but it is the only one we have...
+ nOldSentenceStart = nSentenceStart;
+ nSentenceStart = brk.beginOfSentence( inStr, nPos, aLocale );
+
+ // since the breakiterator completely ignores '.' characvters as end-of-sentence when
+ // the next word is lower case we need to take care of that ourself. The drawback:
+ // la mid-sentence abbreviation like e.g. will now be identified as end-of-sentence. :-(
+ // Well, at least the other product does it in the same way...
+ sal_Int32 nFullStopPos = inStr.lastIndexOf( (sal_Unicode)'.', nPos );
+ nPos = nSentenceStart;
+ if (nFullStopPos > 0 && nFullStopPos > nSentenceStart)
+ {
+ Boundary aBd2 = brk.nextWord( inStr, nFullStopPos, aLocale, WordType::DICTIONARY_WORD );
+ nSentenceStart = aBd2.startPos;
+ nPos = nFullStopPos;
+ }
+
+ if (nSentenceStart < nOldSentenceStart || nOldSentenceStart == -1)
+ {
+ // the sentence start might be a quotation mark or some kind of bracket, thus
+ // we need the first dictionary word starting or following this position
+ // Boundary aBd1 = brk.nextWord( inStr, nSentenceStart, aLocale, WordType::DICTIONARY_WORD );
+ Boundary aBd2 = brk.getWordBoundary( inStr, nSentenceStart, aLocale, WordType::DICTIONARY_WORD, true );
+ // OUString aWord1( inStr.copy( aBd1.startPos, aBd1.endPos - aBd1.startPos + 1 ) );
+ OUString aWord2( inStr.copy( aBd2.startPos, aBd2.endPos - aBd2.startPos + 1 ) );
+ }
+ else
+ break; // prevent endless loop
+
+ // continue with previous sentence
+ if (nPos != -1)
+ --nPos;
+ }
+ }
+ return aRes;
+}
+#endif
+
} } } }
diff --git a/i18npool/util/i18npool.map b/i18npool/util/i18npool.map
deleted file mode 100644
index 02fe32ac5839..000000000000
--- a/i18npool/util/i18npool.map
+++ /dev/null
@@ -1,10 +0,0 @@
-UDK_3_0_0 {
-global:
- GetVersionInfo;
- component_getImplementationEnvironment;
- component_getFactory;
- component_writeInfo;
-
-local:
- *;
-};
diff --git a/i18npool/util/makefile.mk b/i18npool/util/makefile.mk
index 5bf520eaad4d..57f802be62fe 100644
--- a/i18npool/util/makefile.mk
+++ b/i18npool/util/makefile.mk
@@ -60,7 +60,7 @@ SHL1IMPLIB= i$(SHL1TARGET)
SHL1DEPN= makefile.mk \
$(SLB)/i18nisolang$(ISOLANG_MAJOR)$(COMID).lib
-SHL1VERSIONMAP=$(PRJNAME).map
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
DEF1NAME=$(SHL1TARGET)
@@ -68,6 +68,7 @@ SHL1LIBS=$(LIB1TARGET)
SHL1STDLIBS= \
$(I18NUTILLIB) \
$(I18NISOLANGLIB) \
+ $(COMPHELPERLIB) \
$(CPPUHELPERLIB) \
$(CPPULIB) \
$(SALLIB) \
diff --git a/l10ntools/inc/export.hxx b/l10ntools/inc/export.hxx
index eeb0afd38373..222cd3bf5cb8 100644
--- a/l10ntools/inc/export.hxx
+++ b/l10ntools/inc/export.hxx
@@ -460,6 +460,8 @@ public:
bTitleFirst[ nId ] = true;
}
BOOL GetText( ByteString &rReturn, USHORT nTyp, const ByteString &nLangIndex, BOOL bDel = FALSE );
+ BOOL GetTransex3Text( ByteString &rReturn, USHORT nTyp, const ByteString &nLangIndex, BOOL bDel = FALSE );
+
};
//
diff --git a/l10ntools/inc/wrdtrans.hxx b/l10ntools/inc/wrdtrans.hxx
deleted file mode 100644
index b0b65526a2a2..000000000000
--- a/l10ntools/inc/wrdtrans.hxx
+++ /dev/null
@@ -1,87 +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.
- *
- ************************************************************************/
-/*
-
-// OBSOLETE //
-
-#ifndef TX3_WRDTRANS_HXX
-#define TX3_WRDTRANS_HXX
-
-// USED
- // Base Classes
- // Components
-class WordTransTree;
-class WordTrans_ErrorList;
- // Parameters
-#include <tools/string.hxx>
-
-class WordTransformer
-{
- public:
- enum E_Error
- {
- OK = 0,
- ERROR_NO_WORDLIST,
- ERROR_HOTKEY,
- ERROR_OUTPUTSTRING_TOO_LONG,
- OTHER_ERROR
- };
-
- // LIFECYCLE
- WordTransformer();
- ~WordTransformer();
- BOOL LoadWordlist( /// @return False, if file could not be read, or there is already a wordlist loaded.
- const ByteString & i_sWordlist_Filepath,
- CharSet i_nWorkingCharSet = RTL_TEXTENCODING_MS_1252,
- CharSet i_nFileCharSet = RTL_TEXTENCODING_MS_1252 );
-
- // OPERATIONS
- USHORT Transform( /// @return The number of errors during transforming.
- ByteString & io_sText);
-
- // INQUIRY
- USHORT NrOfErrors() const;
- E_Error GetError(
- USHORT i_nNr, /// [0 .. NrOfErrors()-1], other values return an empty error.
- ByteString * o_pErrorText = 0) const; /// If o_pErrorText != 0, the String is filled with the description of the error.
-
- private:
- // SERVICE FUNCTION
- void CreateError();
-
- // DATA
- WordTransTree * dpTransformer;
- WordTrans_ErrorList *
- dpErrors;
-};
-
-
-
-#endif
-
-
-*/
diff --git a/l10ntools/java/jpropex/build.xml b/l10ntools/java/jpropex/build.xml
new file mode 100755
index 000000000000..d74fb3975d0f
--- /dev/null
+++ b/l10ntools/java/jpropex/build.xml
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project name="jpropex" default="main" basedir=".">
+
+ <!-- ================================================================= -->
+ <!-- settings -->
+ <!-- ================================================================= -->
+
+ <!-- name of this sub target used in recursive builds -->
+ <property name="target" value="jpropex"/>
+
+ <!-- name of jar file created, without .jar extension -->
+ <property name="jarname" value="jpropex"/>
+
+ <!-- relative path to project directory -->
+ <property name="prj" value="."/>
+
+ <!-- build output directory -->
+ <property name="out" value="build"/>
+
+ <!-- build directories -->
+ <property name="build.dir" value="${out}"/>
+ <property name="build.class" value="${build.dir}/class/jpropex"/>
+ <property name="build.misc" value="${build.dir}/misc/jpropex"/>
+
+ <!-- start of java source code package structure -->
+ <property name="java.dir" value="java"/>
+
+ <!-- define how to handle CLASSPATH environment -->
+ <property name="build.sysclasspath" value="ignore"/>
+
+ <!-- classpath settings for compile and javadoc tasks -->
+ <path id="classpath">
+ <pathelement location="."/>
+ <pathelement location="${build.class}"/>
+ </path>
+
+ <!-- name to display in documentation -->
+ <!-- <property name="docname" value="l10n converter"/> -->
+
+ <!-- set "modern" java compiler -->
+ <property name="build.compiler" value="modern"/>
+
+ <!-- set wether we want to compile with debug information -->
+ <property name="debug" value="on"/>
+
+ <!-- set wether we want to compile with optimisation -->
+ <property name="optimize" value="off"/>
+
+ <!-- set wether we want to compile with or without deprecation -->
+ <property name="deprecation" value="on"/>
+
+ <target name="info">
+ <echo message="--------------------"/>
+ <echo message="${target}"/>
+ <echo message="--------------------"/>
+ </target>
+
+ <!-- ================================================================= -->
+ <!-- custom targets -->
+ <!-- ================================================================= -->
+
+ <!-- the main target, called in recursive builds -->
+ <target name="main" depends="info,prepare,compile,jar"/>
+
+ <!-- prepare output directories -->
+ <target name="prepare">
+ <mkdir dir="${build.dir}"/>
+ <mkdir dir="${build.class}"/>
+ <mkdir dir="${build.misc}"/>
+ </target>
+
+
+ <target name="res" depends="prepare">
+ <copy todir="${build.class}">
+ <fileset dir="${java.dir}">
+ <include name="**/*.properties"/>
+ <include name="**/*.css"/>
+ <include name="**/*.dtd"/>
+ <include name="**/*.form"/>
+ <include name="**/*.gif "/>
+ <include name="**/*.htm"/>
+ <include name="**/*.html"/>
+ <include name="**/*.js"/>
+ <include name="**/*.mod"/>
+ <include name="**/*.sql"/>
+ <include name="**/*.xml"/>
+ <include name="**/*.xsl"/>
+ <include name="**/*.map"/>
+
+ </fileset>
+ </copy>
+ </target>
+
+
+ <target name="compile" depends="prepare,res">
+ <javac destdir="${build.class}"
+ debug="${debug}"
+ deprecation="${deprication}"
+ optimize="${optimize}"
+ classpathref="classpath">
+ <src path="${java.dir}"/>
+ <include name="**/*.java"/>
+ </javac>
+ </target>
+
+ <!-- clean up -->
+ <target name="clean" depends="prepare">
+ <delete includeEmptyDirs="true">
+ <fileset dir="${build.class}">
+ <patternset>
+ <include name="${package}/**/*.class"/>
+ </patternset>
+ </fileset>
+ </delete>
+ </target>
+
+ <!-- create jar file -->
+ <target name="jar" depends="prepare,compile" if="build.class">
+ <jar jarfile="${build.class}/${jarname}.jar"
+ basedir="${build.class}"
+ manifest="${jarname}.MF">
+ <include name="**/*.class"/>
+ <include name="**/*.properties"/>
+ <include name="**/*.css"/>
+ <include name="**/*.dtd"/>
+ <include name="**/*.form"/>
+ <include name="**/*.gif "/>
+ <include name="**/*.htm"/>
+ <include name="**/*.html"/>
+ <include name="**/*.js"/>
+ <include name="**/*.mod"/>
+ <include name="**/*.sql"/>
+ <include name="**/*.xml"/>
+ <include name="**/*.xsl"/>
+ <include name="**/*.map"/>
+ </jar>
+ </target>
+
+ <target name="test" depends="prepare">
+ </target>
+
+</project>
+
diff --git a/l10ntools/java/jpropex/java/JPropEx.java b/l10ntools/java/jpropex/java/JPropEx.java
new file mode 100644
index 000000000000..224bed783cf6
--- /dev/null
+++ b/l10ntools/java/jpropex/java/JPropEx.java
@@ -0,0 +1,499 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+
+import java.util.*;
+import java.io.*;
+
+public class JPropEx
+{
+ private String inputFileArg = "";
+ private String outputFileArg = "";
+ private String pathPrefixArg = "";
+ private String pathPostfixArg = "";
+ private String projectArg = "";
+ private String rootArg = "";
+ private Vector forcedLangsArg;
+ private Vector langsArg;
+ private String inputSdfFileArg = "";
+ private boolean isQuiet = false;
+ private final String resourceType = "javaproperties";
+ private final String sourceLanguage = "en-US";
+
+ static final int JAVA_TYPE = 0;
+ static final int JAVA_ENUS_TYPE = 1;
+ static final int EXTENSION_TYPE = 2;
+
+ public JPropEx()
+ {
+ //data = new SdfData();
+ }
+
+ public JPropEx( String args[] )
+ {
+ super();
+ parseArguments( args );
+ testCL();
+ //testArguments();
+ if( inputSdfFileArg != null && inputSdfFileArg.length() > 0 )
+ merge();
+ else
+ extract();
+ }
+
+ private String getSimpleArg( String[] args , int x )
+ {
+ if( x < args.length ) x++;
+ else
+ {
+ System.err.println("ERROR: Missing arg for "+args[ x ]+"\n");
+ help();
+ }
+ return args[ x ];
+ }
+ private Vector getComplexArg( String[] args , int x )
+ {
+ if( x < args.length ) x++;
+ else
+ {
+ System.err.println("ERROR: Missing arg for "+args[ x ]+"\n");
+ help();
+ }
+ String value = args[ x ];
+ Vector values = new Vector( Arrays.asList( value.split(",") ) );
+ return values;
+ }
+
+ private void testCL()
+ {
+ if( inputFileArg.length()>0 && ( ( pathPrefixArg.length()>0 && pathPostfixArg.length()>0 ) || outputFileArg.length()>0 ) && projectArg.length()>0 && rootArg.length()>0 && langsArg.size()>0 )
+ if( ( inputSdfFileArg.length()>0 && ( outputFileArg.length()>0 || ( pathPrefixArg.length()>0 && pathPostfixArg.length()>0 ) ) ) || ( inputFileArg.length()>0 && outputFileArg.length()>0 ) )
+ return;
+ System.out.println("ERROR: Strange parameters!");
+ help();
+ System.exit( -1 );
+ }
+ private void help()
+ {
+ System.out.println("jpropex -> extract / merge java properties files");
+ System.out.println("-p <project> -r <project_root> -i <input>|@<input> -o <output> -x <path1> -y <path2> -m <sdf_file> -l <lang>\n");
+ System.out.println("Example:\ncd /data/cws/l10ntooling17/DEV300/ooo/reportbuilder/java/com/sun/star/report/function/metadata");
+ System.out.println("Extract:\njpropex -p reportbuilder -r ../../../../../../.. -i Title-Function.properties -o new.sdf -l en-US");
+ System.out.println("Merge: use either ( -x path -y more_path ) or ( -o ) and ( -i filename ) or ( -i @filename ). @filename contains a list with files");
+ System.out.println("jpropex -p reportbuilder -r ../../../../../../.. -x ../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata -y ivo -i @abc -l all -lf en-US,de,fr,pt -m ../../../../../../../common.pro/misc/reportbuilder/java/com/sun/star/report/function/metadata/localize.sdf");
+ System.out.println("jpropex -p reportbuilder -r ../../../../../../.. -x ../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata -y ivo -i @abc -l all -lf en-US,de,fr,pt -m ../../../../../../../common.pro/misc/reportbuilder/java/com/sun/star/report/function/metadata/localize.sdf");
+ System.out.println("jpropex -p reportbuilder -r ../../../../../../.. -o ../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata/ -i Title-Function.properties -l all -lf en-US,de,fr,pt -m ../../../../../../../common.pro/misc/reportbuilder/java/com/sun/star/report/function/metadata/localize.sdf");
+ System.out.println("jpropex -p reportbuilder -r ../../../../../../.. -x ../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata -y ivooo -i Title-Function.properties -l all -lf en-US,de,fr,pt -m ../../../../../../../common.pro/misc/reportbuilder/java/com/sun/star/report/function/metadata/localize.sdf");
+ System.exit( -1 );
+ }
+
+ private void extract()
+ {
+ SdfData data = new SdfData();
+ java.util.Properties prop = loadProp( inputFileArg );
+
+ // Get a prototype that already contains the most common settings
+ SdfEntity dolly = prepareSdfObj( inputFileArg );
+ String key;
+ SdfEntity currentStr;
+ String value;
+ for( Enumeration e = prop.propertyNames() ; e.hasMoreElements() ; )
+ {
+ key = (String) e.nextElement();
+ currentStr = (SdfEntity) dolly.clone();
+ // Set the new LID and the string text
+ currentStr.setLid( key );
+ value = prop.getProperty( key , "" );
+ //if( value.equals("") ) System.err.println("Warning: in file "+inputFileArg+" the string with the key "+key+" has a empty string!");
+ currentStr.setText( (prop.getProperty( key )).replaceAll("\t" , " " ) ); // TODO: Quoting!!!!
+ data.add( currentStr );
+ }
+ data.write( outputFileArg );
+ }
+
+ private SdfEntity prepareSdfObj( String filename )
+ {
+ String path = makeAbs( filename );
+ //String path = makeAbs( inputFileArg );
+ path = path.replace( rootArg + "/" , "" );
+ path = path.replace("/","\\");
+ return new SdfEntity( projectArg , path , "" /* dummy1 */ , resourceType , "", "" , "" , "" , "" /* dummy2 */ ,
+ sourceLanguage , "", "" , "" , "" , "2002-02-02 02:02:02" );
+ }
+
+ private void merge()
+ {
+ SdfData data = getSdfData();
+ if( inputFileArg.startsWith("@") )
+ {
+ // Read files
+ Vector fileList = readFileList( inputFileArg );
+ for( Enumeration e = fileList.elements(); e.hasMoreElements(); )
+ mergeFile( (String) e.nextElement() , data , false );
+ }
+ else
+ {
+ // Single file
+ mergeFile( inputFileArg , data , true );
+ }
+ }
+
+ private Vector readFileList( String filename )
+ {
+ Vector lines = new Vector();
+ try
+ {
+ BufferedReader in = new BufferedReader( new FileReader( filename.substring( 1 ) ) );
+ while( in.ready() )
+ lines.add( in.readLine() );
+ }
+ catch( IOException e )
+ {
+ System.out.println("ERROR: Can't open file '"+filename.substring( 1 )+"'");
+ System.exit( -1 );
+ }
+ return lines;
+ }
+
+ private void mergeFile( String filename , SdfData data , boolean isSingleFile )
+ {
+ int type = detectFormat( filename );
+ java.util.Properties sourceProp = loadProp( filename );
+ Vector langs = getLanguages( data );
+ HashMap props = new HashMap();
+ // Create a properties object for every language
+ for( Enumeration e = langs.elements(); e.hasMoreElements();)
+ {
+ props.put( (String)e.nextElement() , new java.util.Properties() );
+ }
+ // Get a prototype that already contains the most common settings
+
+ SdfEntity dolly = prepareSdfObj( filename );
+ String key;
+ String sourceString;
+ SdfEntity curStr;
+ SdfEntity curEntity;
+ SdfEntity mergedEntity;
+ String curLang;
+ for( Enumeration e = sourceProp.propertyNames() ; e.hasMoreElements() ; ) // For all property keys
+ {
+ key = (String) e.nextElement();
+ sourceString = sourceProp.getProperty( key );
+ curStr = (SdfEntity) dolly.clone();
+ curStr.setLid( key );
+ for( Enumeration lang = langs.elements(); lang.hasMoreElements(); ) // merge in every language
+ {
+ curEntity = (SdfEntity) curStr.clone();
+ curLang = (String) lang.nextElement();
+ curEntity.setLangid( curLang );
+ mergedEntity = data.get( curEntity );
+ if( mergedEntity == null )
+ {
+ // in case there is no translation then fallback to the en-US source string
+ ( (java.util.Properties) props.get( curLang )).setProperty( curEntity.getLid() , sourceString );
+ }
+ else
+ {
+ // Set the merged text from the sdf file
+ ( (java.util.Properties) props.get( curLang )).setProperty( mergedEntity.getLid() , mergedEntity.getText() ); // TODO: Quoting ???
+ }
+ }
+
+ }
+ // Now write them out
+ String lang;
+ for( Iterator i = props.keySet().iterator() ; i.hasNext() ; )
+ {
+ lang = (String) i.next();
+ writeSinglePropertiesFile( filename , (java.util.Properties) props.get( lang ) , lang , isSingleFile , type );
+ }
+ }
+ private void writeSinglePropertiesFile( String filename , java.util.Properties prop , String lang , boolean isSingleFile , int type )
+ {
+ // Prepare path to file
+ int filenameIdx = filename.lastIndexOf( "/" ) > 0 ? filename.lastIndexOf( "/" )+1 : 0 ;
+ String path = new String();
+ String name = new String();
+ String lcLang = lang.toLowerCase();
+ // use of -x <path> -y <more_path>
+ // -> <path>/<lang>/<more_path>
+ if( pathPrefixArg != null && pathPrefixArg.length()>0 && pathPostfixArg != null && pathPostfixArg.length()>0 )
+ {
+ path = new StringBuffer().append( pathPrefixArg ).append( "/" ).append( lcLang ).append( "/" ).append( pathPostfixArg ).append( "/" ).toString();
+ name += formatFilename( filename , filenameIdx , lang , type );
+ }
+ //use of -i <one_filename>
+ else if( !isSingleFile && outputFileArg != null && outputFileArg.length()>0 )
+ {
+ //name = outputFileArg;
+ path = outputFileArg;
+ name += formatFilename( filename , filenameIdx , lang , type );
+ }
+ //use of -i @<file_containing_many_filenames>
+ else if( isSingleFile && outputFileArg != null && outputFileArg.length()>0 )
+ {
+ //name = outputFileArg;
+ path = outputFileArg;
+ name += formatFilename( filename , filenameIdx , lang , type );
+ }
+ else
+ {
+ System.err.println("ERROR: No outputfile specified .. either -o or -x -y !");
+ System.exit( -1 );
+ }
+
+ File dir = new File( path );
+ try
+ {
+ if( !dir.exists() && path.length()>0 )
+ {
+ if( !dir.mkdirs() )
+ {
+ System.out.println("ERROR: Can't create directory '"+path+"' !!!");
+ System.exit( -1 );
+ }
+ }
+ }
+ catch( SecurityException e )
+ {
+ System.out.println("ERROR: Can't create directory '"+path+"'!!!Wrong Permissions?");
+ System.exit( -1 );
+ }
+ path += name;
+ // Write the properties file
+ //System.out.println("DBG: Writing to "+path);
+ try{
+ BufferedOutputStream out = new BufferedOutputStream( new FileOutputStream( path ) );
+ if( prop == null )
+ System.out.println("DBG: prop == null!!!");
+ prop.store( out , "" ); // Legal headers?
+ }
+ catch( IOException e )
+ {
+ System.out.println("ERROR: Can't write file '"+path+"' !!!!");
+ System.exit( -1 );
+ }
+ }
+
+ // we have different types of properties in the source code
+ // each needs a different file nameing scheme
+ private int detectFormat( String filename )
+ {
+ if( filename.endsWith( "_en_US.properties" ) )
+ return EXTENSION_TYPE;
+ else if( filename.endsWith("_en_us.properties" ) )
+ return JAVA_ENUS_TYPE;
+ else if( filename.endsWith( ".properties" ) )
+ return JAVA_TYPE;
+
+ // Can not detect, exit
+ System.err.println("ERROR: Invalid file name. Only allowed (case sensitive!) *_en_US.properties , *_en_us.properties or *.properties\n");
+ System.exit(-1);
+ return JAVA_TYPE; // dummy
+ }
+
+ private String formatFilename( String filename , int filenameIdx , String lang , int type )
+ {
+
+ if( !lang.equals( "en-US" ) )
+ {
+ // Parse iso code
+ int pos = lang.indexOf("-");
+ String langpart1 = new String();
+ String langpart2 = new String();
+ if( pos == -1 )
+ {
+ langpart1 = lang;
+ }
+ else if( pos > 0 )
+ {
+ langpart1 = lang.substring( 0 , pos );
+ langpart2 = lang.substring( pos+1 , lang.length() );
+ }
+ // change filename according to the type
+ switch( type )
+ {
+ // -> de_DE
+ case EXTENSION_TYPE:
+ lang = langpart1.toLowerCase();
+ if( langpart2.length() > 0 ) // -> en_US
+ lang += "_" + langpart2.toUpperCase();
+ else // -> de_DE
+ lang += "_" + langpart1.toUpperCase();
+ return new StringBuffer().append( filename.substring( filenameIdx , filename.lastIndexOf( "_en_US.properties" ) ) )
+ .append( "_" ).append( lang.replaceAll("-","_") ).append( ".properties" ).toString();
+ // -> de
+ case JAVA_ENUS_TYPE:
+ lang = langpart1.toLowerCase();
+ if( langpart2.length() > 0 )
+ lang += "_" + langpart2.toLowerCase();
+ return new StringBuffer().append( filename.substring( filenameIdx , filename.lastIndexOf( "_en_us.properties" ) ) )
+ .append( "_" ).append( lang.replaceAll("-","_") ).append( ".properties" ).toString();
+ // -> de
+ case JAVA_TYPE:
+ lang = langpart1.toLowerCase();
+ if( langpart2.length() > 0 )
+ lang += "_" + langpart2.toLowerCase();
+ return new StringBuffer().append( filename.substring( filenameIdx , filename.lastIndexOf( ".properties" ) ) )
+ .append( "_" ).append( lang.replaceAll("-","_") ).append( ".properties" ).toString();
+ default:
+ System.err.println("ERROR: Something is really broken here, l10ntools/java/jprop/java/JPropEx.java :: formatFilename()");
+ System.exit( -1 );
+ break;
+ }
+ }
+ return filename; // don't change en-US source file name
+ }
+ private SdfData getSdfData()
+ {
+ SdfData data = new SdfData( inputSdfFileArg );
+ data.read();
+ return data;
+ }
+ private Vector getLanguages( SdfData data )
+ {
+ Vector langs = new Vector();
+
+ if( ((String)langsArg.get( 0 )).equalsIgnoreCase( "all" ) ) // for "-l all" use all languages found in the -m sdf file
+ langs.addAll( data.getLanguages() );
+ else
+ langs.addAll( langsArg ); // use the langs giving by -l
+
+ if( forcedLangsArg != null )
+ langs.addAll( forcedLangsArg );
+
+ return removeDupes( langs );
+ }
+ private Vector removeDupes( Vector vec )
+ {
+ Collection coll = new LinkedHashSet( vec );
+ return new Vector( coll );
+ }
+ private java.util.Properties loadProp( String filename )
+ {
+ java.util.Properties prop = new java.util.Properties();
+ try
+ {
+ prop.load( new BufferedInputStream( new NoLocalizeFilter( new FileInputStream( filename ) ) ) );
+ }
+ catch( IOException e )
+ {
+ System.err.println("ERROR: Can't read file '"+filename+"'!!!");
+ }
+ return prop;
+ }
+ private void parseArguments( String[] args )
+ {
+
+ if( args.length == 0 )
+ {
+ System.out.println("ERROR: No args???");
+ help();
+ System.exit( -1 );
+ }
+ for( int x = 0; x < args.length ; x++ )
+ {
+ if( args[ x ].equalsIgnoreCase("-i") )
+ {
+ // Input resource file
+ inputFileArg = getSimpleArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-o") )
+ {
+ // Output sdf file
+ outputFileArg = getSimpleArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-x") )
+ {
+ // path prefix
+ pathPrefixArg = getSimpleArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-y") )
+ {
+ // path postfix
+ pathPostfixArg = getSimpleArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-p") )
+ {
+ // project
+ projectArg = getSimpleArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-r") )
+ {
+ // root
+ rootArg = getSimpleArg( args , x );
+ rootArg = makeAbs( rootArg );
+ }
+ else if( args[ x ].equalsIgnoreCase("-lf") )
+ {
+ // forced langs
+ forcedLangsArg = getComplexArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-l") )
+ {
+ // langs
+ langsArg = getComplexArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-m") )
+ {
+ // input sdf file
+ inputSdfFileArg = getSimpleArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-qq") )
+ {
+ isQuiet = true;
+ }
+ }
+ }
+ private String makeAbs( String path )
+ {
+ File file;
+ try
+ {
+ file = new File( path );
+ return file.getCanonicalPath();
+ }catch( IOException e )
+ {
+ e.printStackTrace();
+ System.exit( -1 );
+ }
+ return null;
+ }
+/* private boolean testArguments()
+ {
+ // nice merge
+ if( inputSdfFileArg != null && inputSdfFileArg.length()>0 )
+ // nice merge
+ return projectArg != null && rootArg != null && inputFileArg != null && pathPrefixArg != null && pathPostfixArg != null && langsArg != null &&
+ projectArg.length()>0 && rootArg.length()>0 && inputFileArg.length()>0 && pathPrefixArg.length()>0 && pathPostfixArg.length()>0 && langsArg.size()>0 ;
+ else
+ // nice extract
+ return projectArg != null && rootArg != null && inputFileArg != null && outputFileArg != null && langsArg != null &&
+ projectArg.length()>0 && rootArg.length()>0 && inputFileArg.length()>0 && outputFileArg.length()>0 && langsArg.size()>0;
+ }
+*/
+}
diff --git a/canvas/source/java/SpriteBase.java b/l10ntools/java/jpropex/java/Main.java
index 5f2ed3c57ecc..23dc477ddec3 100644
--- a/canvas/source/java/SpriteBase.java
+++ b/l10ntools/java/jpropex/java/Main.java
@@ -25,10 +25,14 @@
*
************************************************************************/
-// Canvas
-public interface SpriteBase
+class Main
{
- // to be overridden
- public SpriteRep getSpriteRep();
+
+ public static void main( String args[] )
+ {
+ JPropEx jpropex = new JPropEx( args );
+ //jpropex.init();
+ }
}
+
diff --git a/basegfx/source/polygon/b3dgeometry.cxx b/l10ntools/java/jpropex/java/NoLocalizeFilter.java
index 6c1537bac0a6..989ee64bfc86 100644
--- a/basegfx/source/polygon/b3dgeometry.cxx
+++ b/l10ntools/java/jpropex/java/NoLocalizeFilter.java
@@ -25,31 +25,30 @@
*
************************************************************************/
-#include <osl/diagnose.h>
-#include <basegfx/polygon/b3dgeometry.hxx>
-//////////////////////////////////////////////////////////////////////////////
+import java.io.*;
+import java.util.regex.*;
-namespace basegfx
+// exit if the sequence x-no-localize is found in stream!
+public class NoLocalizeFilter extends FilterInputStream
{
- B3DGeometry::B3DGeometry()
- : mbUnifiedVectorValid(false)
- {
- }
+ InputStream in;
+ Pattern p = Pattern.compile("#[\\s]*x-no-translate");
- B3DGeometry::~B3DGeometry()
- {
+ public NoLocalizeFilter( InputStream in ) {
+ super(in);
+ this.in = in;
}
-
- bool B3DGeometry::operator==(const B3DGeometry& rGeometry) const
+ public int read(byte[] b, int off, int len) throws IOException
{
- return (maPolyPolygon == maPolyPolygon
- && maPolygonTo3D == maPolygonTo3D
- && maPolyNormal == maPolyNormal
- && maPolyTexture == maPolyTexture
+ String search = new String( b );
+ Matcher m = p.matcher( search );
+ if( m.find() )
+ {
+ in.close();
+ close();
+ System.exit( 0 );
+ }
+ return in.read( b , off , len );
}
-
-} // end of namespace basegfx
-
-//////////////////////////////////////////////////////////////////////////////
-// eof
+}
diff --git a/l10ntools/java/jpropex/java/OrderedHashMap.java b/l10ntools/java/jpropex/java/OrderedHashMap.java
new file mode 100644
index 000000000000..a462d598b307
--- /dev/null
+++ b/l10ntools/java/jpropex/java/OrderedHashMap.java
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+
+import java.util.*;
+
+// LinkedHashMap implrementation
+public class OrderedHashMap
+{
+ private HashMap hm = new HashMap();
+ private LinkedList list = new LinkedList();
+
+ public Iterator iterator() { return list.iterator(); }
+
+ public boolean isEmpty() { return hm.isEmpty(); }
+ public Object get( Object key ) { return hm.get( key ); }
+ public Object get( int index ) { return hm.get( list.get( index ) ); }
+ public Iterator keys() { return list.iterator(); }
+ public Object add( Object key , Object value )
+ {
+ list.add( key );
+ return hm.put( key, value );
+ }
+ public Object add( int index , Object key , Object value )
+ {
+ list.add( index , key );
+ return hm.put( key, value );
+ }
+ public Object remove( Object key )
+ {
+ list.remove( list.indexOf( key ) );
+ return hm.remove( key );
+ }
+ public void move( int idxFrom , int idxTo )
+ {
+ Object key = list.get( idxFrom );
+ list.remove( idxFrom );
+ list.add( idxTo , key );
+ }
+ public void move( Object key , int idxTo )
+ {
+ move( list.indexOf( key ) , idxTo );
+ }
+ public int size()
+ {
+ return hm.size();
+ }
+ public Enumeration elements()
+ {
+ return new OHMenum( this );
+ }
+}
+
+final class OHMenum implements Enumeration
+{
+ OrderedHashMap ohm;
+ int index = 0;
+
+ private OHMenum(){};
+ public OHMenum( OrderedHashMap ohm ){
+ this.ohm = ohm ;
+ }
+
+ public boolean hasMoreElements()
+ {
+ return index < ohm.size();
+ }
+ public Object nextElement()
+ {
+ return ohm.get( index++ );
+ }
+}
diff --git a/l10ntools/java/jpropex/java/SdfData.java b/l10ntools/java/jpropex/java/SdfData.java
new file mode 100644
index 000000000000..6f79909df1b2
--- /dev/null
+++ b/l10ntools/java/jpropex/java/SdfData.java
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+
+import java.util.*;
+import java.io.*;
+
+public class SdfData
+{
+ private String filename;
+ private OrderedHashMap ohm;
+ private LinkedHashSet languagesFound;
+
+ public SdfData()
+ {
+ languagesFound = new LinkedHashSet();
+ ohm = new OrderedHashMap();
+ languagesFound = new LinkedHashSet();
+ }
+ public SdfData( String filename )
+ {
+ this();
+ this.filename = filename;
+ }
+
+ public LinkedHashSet getLanguages()
+ {
+ return languagesFound;
+ }
+ public SdfEntity get( SdfEntity obj )
+ {
+ return (SdfEntity) ohm.get( (String)obj.getId() );
+ }
+ public SdfEntity get( String key ){
+ return (SdfEntity) ohm.get( key );
+ }
+ public void add( SdfEntity obj )
+ {
+ ohm.add( obj.getId() , obj );
+ }
+
+ public void read()
+ {
+ BufferedReader in;
+ try
+ {
+ in = new BufferedReader( new FileReader( filename ) );
+ SdfEntity entity;
+ while( in.ready() )
+ {
+ String line = in.readLine();
+ if( line.length() > 0 )
+ {
+ entity = new SdfEntity( line );
+ ohm.add( entity.getId() , entity ); // test if is valid
+ languagesFound.add( entity.getLangid() );
+ }
+ }
+ in.close();
+ }
+ catch( IOException e )
+ {
+ System.out.println("Warning: can not read file " + filename);
+ }
+ }
+ public void write( String filename )
+ {
+ FileWriter out;
+ try
+ {
+ out = new FileWriter( filename , true ); // Always append
+ for( Enumeration e = ohm.elements(); e.hasMoreElements(); )
+ {
+ out.write( ( (SdfEntity) e.nextElement() ).toString() + "\n" );
+ }
+ out.close();
+ }
+ catch( IOException e )
+ {
+ System.out.println("Error: Can't write to file " + filename);
+ System.exit( -1 );
+ }
+ }
+}
diff --git a/l10ntools/java/jpropex/java/SdfEntity.java b/l10ntools/java/jpropex/java/SdfEntity.java
new file mode 100644
index 000000000000..52dc61ca40ca
--- /dev/null
+++ b/l10ntools/java/jpropex/java/SdfEntity.java
@@ -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.
+ *
+ ************************************************************************/
+
+
+public class SdfEntity implements Cloneable{
+ private String project = new String("");
+ private String source_file = new String("");
+ private String dummy1 = new String("");
+ private String resource_type= new String("");
+ private String gid = new String("");
+ private String lid = new String("");
+ private String helpid = new String("");
+ private String platform = new String("");
+ private String dummy2 = new String("");
+ private String langid = new String("");
+ private String text = new String("");
+ private String helptext = new String("");
+ private String quickhelptext= new String("");
+ private String title = new String("");
+ private String date = new String("");
+
+ public static int PROJECT_POS = 0;
+ public static int SOURCE_FILE_POS = 1;
+ public static int DUMMY1_POS = 2;
+ public static int RESOURCE_TYPE_POS = 3;
+ public static int GID_POS = 4;
+ public static int LID_POS = 5;
+ public static int HELPID_POS = 6;
+ public static int PLATFORM_POS = 7;
+ public static int DUMMY2_POS = 8;
+ public static int LANGID_POS = 9;
+ public static int TEXT_POS = 10;
+ public static int HELPTEXT_POS = 11;
+ public static int QUICKHELPTEXT_POS = 12;
+ public static int TITLE_POS = 13;
+ public static int DATE_POS = 14;
+
+ public Object clone()
+ {
+ try
+ {
+ return super.clone();
+ }
+ catch( CloneNotSupportedException e )
+ {
+ System.out.println("ERROR: Can not clone, something is broken here ....");
+ System.exit( -1 );
+ }
+ return null; // dummy
+ }
+
+ public SdfEntity( String line ){
+ // isValid?
+ setProperties( line ) ;
+ }
+ public SdfEntity(String project, String source_file, String dummy1, String resource_type, String gid, String lid, String helpid, String platform, String dummy2, String langid, String text, String helptext, String quickhelptext, String title , String date) {
+ super();
+ this.project = project;
+ this.source_file = source_file;
+ this.dummy1 = dummy1;
+ this.resource_type = resource_type;
+ this.gid = gid;
+ this.lid = lid;
+ this.helpid = helpid;
+ this.platform = platform;
+ this.dummy2 = dummy2;
+ this.langid = langid;
+ this.text = text;
+ this.helptext = helptext;
+ this.quickhelptext = quickhelptext;
+ this.title = title;
+ this.date = date;
+ }
+
+ public void setProperties( String line ){
+
+ String[] splitted = line.split("\t");
+
+ setProject( splitted[ SdfEntity.PROJECT_POS ] );
+ setSource_file( splitted[ SdfEntity.SOURCE_FILE_POS ] );
+ setDummy1( splitted[ SdfEntity.DUMMY1_POS ] );
+ setResource_type( splitted[ SdfEntity.RESOURCE_TYPE_POS ] );
+ setGid( splitted[ SdfEntity.GID_POS ] );
+ setLid( splitted[ SdfEntity.LID_POS ] );
+ setHelpid( splitted[ SdfEntity.HELPID_POS ] );
+ setPlatform( splitted[ SdfEntity.PLATFORM_POS ] );
+ setDummy2( splitted[ SdfEntity.DUMMY2_POS ] );
+ setLangid( splitted[ SdfEntity.LANGID_POS ] );
+ setText( splitted[ SdfEntity.TEXT_POS ] );
+ setHelptext( splitted[ SdfEntity.HELPTEXT_POS ] );
+ setQuickhelptext( splitted[ SdfEntity.QUICKHELPTEXT_POS ] );
+ setTitle( splitted[ SdfEntity.TITLE_POS ] );
+ setDate( splitted[ SdfEntity.DATE_POS ] );
+ }
+
+ public String getFileId(){
+ return project+"\\"+source_file;
+ }
+ public String getResourcePath(){
+ return source_file.substring(0 , source_file.lastIndexOf( "\\" )-1 );
+ }
+ public String toString(){
+ return new StringBuffer( project ).append( "\t" ).append( source_file ).append( "\t" ).append( dummy1 ).append( "\t" ).append( resource_type ).append( "\t" ).append( gid ).append( "\t" )
+ .append( lid ).append( "\t" ).append( helpid ).append( "\t" ).append( platform ).append( "\t" ).append( dummy2 ).append( "\t" ).append( langid ).append( "\t" )
+ .append( text ).append( "\t" ).append( helptext ).append( "\t" ).append( quickhelptext ).append( "\t" ).append( title ).append( "\t" ).append( date ).toString();
+ }
+ public String getId(){
+ return new StringBuffer( project ).append( gid ).append( lid ).append( source_file ).append( resource_type ).append( platform ).append( helpid ).append( langid ).toString();
+ }
+
+ public String getDummy1() {
+ return dummy1;
+ }
+
+ public void setDummy1(String dummy1) {
+ this.dummy1 = dummy1;
+ }
+
+ public String getPlatform() {
+ return platform;
+ }
+
+ public void setPlatform(String platform) {
+ this.platform = platform;
+ }
+
+ public String getDummy2() {
+ return dummy2;
+ }
+
+ public void setDummy2(String dummy2) {
+ this.dummy2 = dummy2;
+ }
+
+ public String getGid() {
+ return gid;
+ }
+
+ public void setGid(String gid) {
+ this.gid = gid;
+ }
+
+ public String getHelpid() {
+ return helpid;
+ }
+
+ public void setHelpid(String helpid) {
+ this.helpid = helpid;
+ }
+
+ public String getHelptext() {
+ return helptext;
+ }
+
+ public void setHelptext(String helptext) {
+ this.helptext = helptext;
+ }
+
+ public String getLangid() {
+ return langid;
+ }
+
+ public void setLangid(String langid) {
+ this.langid = langid;
+ }
+
+ public String getLid() {
+ return lid;
+ }
+
+ public void setLid(String lid) {
+ this.lid = lid;
+ }
+
+ public String getProject() {
+ return project;
+ }
+
+ public void setProject(String project) {
+ this.project = project;
+ }
+
+ public String getQuickhelptext() {
+ return quickhelptext;
+ }
+
+ public void setQuickhelptext(String quickhelptext) {
+ this.quickhelptext = quickhelptext;
+ }
+
+ public String getResource_type() {
+ return resource_type;
+ }
+
+ public void setResource_type(String resource_type) {
+ this.resource_type = resource_type;
+ }
+
+ public String getSource_file() {
+ return source_file;
+ }
+
+ public void setSource_file(String source_file) {
+ this.source_file = source_file;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+ public String getDate() {
+ return date;
+ }
+ public void setDate(String date) {
+ this.date = date;
+ }
+
+
+}
diff --git a/l10ntools/java/jpropex/jpropex b/l10ntools/java/jpropex/jpropex
new file mode 100755
index 000000000000..2d62d13b093e
--- /dev/null
+++ b/l10ntools/java/jpropex/jpropex
@@ -0,0 +1,10 @@
+#!/bin/sh
+if [ x${SOLARENV}x = xx ]; then
+ echo No environment found, please use 'configure' or 'setsolar'
+ exit 1
+fi
+if [ x${JAVA_HOME}x = xx ]; then
+ echo No Java found!
+ exit 1
+fi
+exec java -DSOLARSRC=${SOLARSRC} -DWORK_STAMP=${WORK_STAMP} -DUSE_SHELL= -jar ${SOLARVER}/${INPATH}/bin${UPDMINOREXT}/jpropex.jar "$@"
diff --git a/l10ntools/java/jpropex/jpropex.MF b/l10ntools/java/jpropex/jpropex.MF
new file mode 100755
index 000000000000..3e22e7e9bfbf
--- /dev/null
+++ b/l10ntools/java/jpropex/jpropex.MF
@@ -0,0 +1 @@
+Main-Class: Main
diff --git a/l10ntools/java/jpropex/makefile.mk b/l10ntools/java/jpropex/makefile.mk
new file mode 100755
index 000000000000..f86d2c830025
--- /dev/null
+++ b/l10ntools/java/jpropex/makefile.mk
@@ -0,0 +1,36 @@
+#*************************************************************************
+#
+# 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=transex3
+TARGET=jpropex
+
+.INCLUDE : ant.mk
+
+ALLTAR : ANTBUILD
+
diff --git a/l10ntools/java/receditor/java/transex3/model/SdfString.java b/l10ntools/java/receditor/java/transex3/model/SdfString.java
index 7419aeb5578b..7eec2151b7c3 100644
--- a/l10ntools/java/receditor/java/transex3/model/SdfString.java
+++ b/l10ntools/java/receditor/java/transex3/model/SdfString.java
@@ -97,32 +97,7 @@ public class SdfString {
public void setModuleName(String modulename) {
this.modulename = modulename;
}
- /*
- public String getRealFileName(){
- //String srcroot = "U:\\cws01\\l10ncleanup\\SRC680\\src.m213";//java.lang.System.getProperty( "SOLARSRC");
- //String isWindows = "4nt";//java.lang.System.getProperty( "USE_SHELL");
- String srcroot = java.lang.System.getProperty( "SOLARSRC" );
- String isWindows = java.lang.System.getProperty( "USE_SHELL" );
- //System.out.println("srcroot="+srcroot+" isWindows="+isWindows );
- //if( true ) return;
- //String relpath = sourceString.getFileId().substring( sourceString.getFileId().lastIndexOf("\\")
- // , sourceString.getFileId().length() );
- String filename;
- if( isWindows != null && isWindows.compareTo( "4nt") == 0 )
- {
- filename = srcroot + "\\" + //sourceString.getProject() + "\\" +
- sourceString.getFileId() +".recommand";
- }
- else
- {
- String filepart = sourceString.getFileId();
- filepart = filepart.replaceAll( "\\\\" , "/" );
- filename = srcroot + "/" + //sourceString.getProject() + "//" +
- filepart +".recommand";
- }
- return filename;
- }*/
public String getRealFileName(){
String filepart = sourceString.getFileId();
filepart = filepart.replaceAll( "\\\\" , "_" );
diff --git a/l10ntools/prj/build.lst b/l10ntools/prj/build.lst
index ff961c096cbd..8387154897b3 100644
--- a/l10ntools/prj/build.lst
+++ b/l10ntools/prj/build.lst
@@ -3,8 +3,7 @@ tr l10ntools usr1 - all tr_mkout NULL
tr l10ntools\inc nmake - all tr_inc NULL
tr l10ntools\source nmake - all tr_src tr_inc NULL
tr l10ntools\layout nmake - all rt_layout tr_src tr_inc NULL
-#tr l10ntools\java\l10nconv nmake - all tr_conv NULL
-#tr l10ntools\java\receditor nmake - all tr_rece NULL
+tr l10ntools\java\jpropex nmake - all tr_blah NULL
tr l10ntools\source\help nmake - all tr_bla_help NULL
tr l10ntools\source\filter\utils nmake - all tr_bla_utils NULL
tr l10ntools\source\filter\merge nmake - all tr_bla_merge tr_bla_utils NULL
diff --git a/l10ntools/prj/d.lst b/l10ntools/prj/d.lst
index f75c16b43764..0b6a43444613 100644
--- a/l10ntools/prj/d.lst
+++ b/l10ntools/prj/d.lst
@@ -29,6 +29,7 @@ mkdir: %_DEST%\bin%_EXT%\help\com\sun\star\help
..\%__SRC%\bin\ulfconv %_DEST%\bin%_EXT%\ulfconv
..\%__SRC%\class\FCFGMerge.jar %_DEST%\bin%_EXT%\FCFGMerge.jar
..\%__SRC%\class\HelpIndexerTool.jar %_DEST%\bin%_EXT%\HelpIndexerTool.jar
+..\%__SRC%\class\jpropex\jpropex.jar %_DEST%\bin%_EXT%\jpropex.jar
..\%__SRC%\bin\HelpLinker %_DEST%\bin%_EXT%\HelpLinker
..\%__SRC%\bin\HelpCompiler %_DEST%\bin%_EXT%\HelpCompiler
..\%__SRC%\bin\HelpCompiler.exe %_DEST%\bin%_EXT%\HelpCompiler.exe
@@ -40,6 +41,7 @@ mkdir: %_DEST%\bin%_EXT%\help\com\sun\star\help
..\%__SRC%\class\receditor\receditor.jar %_DEST%\bin%_EXT%\receditor.jar
+..\java\jpropex\jpropex %_DEST%\bin%_EXT%\jpropex
..\scripts\localize.pl %_DEST%\bin%_EXT%\localize.pl
..\scripts\localize_old.pl %_DEST%\bin%_EXT%\localize_old.pl
..\scripts\localize %_DEST%\bin%_EXT%\localize
@@ -50,6 +52,7 @@ mkdir: %_DEST%\bin%_EXT%\help\com\sun\star\help
..\inc\l10ntools\directory.hxx %_DEST%\inc%_EXT%\l10ntools\directory.hxx
..\inc\l10ntools\file.hxx %_DEST%\inc%_EXT%\l10ntools\file.hxx
..\inc\l10ntools\vosapp.hxx %_DEST%\inc%_EXT%\l10ntools\vosapp.hxx
+..\source\filter\merge\FCFGMerge.cfg %_DEST%\inc%_EXT%\l10ntools\FCFGMerge.cfg
..\inc\utf8conv.hxx %_DEST%\inc%_EXT%\l10ntools\utf8conv.hxx
..\%__SRC%\lib\transex.lib %_DEST%\lib%_EXT%\transex.lib
diff --git a/l10ntools/scripts/fast_merge.pl b/l10ntools/scripts/fast_merge.pl
index e2980fafddda..5dc63cf95d79 100644
--- a/l10ntools/scripts/fast_merge.pl
+++ b/l10ntools/scripts/fast_merge.pl
@@ -45,12 +45,8 @@ my $last_localize_file;
my $first_run = "1";
my $sdf_filename;
my $merge_dir;
-my $WIN;
my $state = "none";
-if ( defined $ENV{USE_SHELL} && $ENV{USE_SHELL} eq '4nt' ) { $WIN = 'TRUE'; }
-else { $WIN = ''; }
-
$SIG{INT} = 'inthandler';
$SIG{QUIT} = 'quithandler';
@@ -67,7 +63,6 @@ struct ( sdf_obj =>
parse_options();
my $lock_file = $merge_dir."/lock.mk";
-$lock_file =~ s/\//\\/g , if ( $WIN ) ;
acquire_lock();
read_sdf_file_names();
init();
@@ -247,10 +242,9 @@ sub make_paths
{
my $localizeFile = $merge_dir."\\".$current[ 0 ]->module."\\".$current[ 0 ]->file;
my $path = getDir( $localizeFile );
- if ( !$WIN ) { $path =~ s/\\/\//g; }
+ $path =~ s/\\/\//g;
- $localizeFile = $path."\\localize.sdf";
- if ( !$WIN ) { $localizeFile =~ s/\\/\//g; }
+ $localizeFile = $path."/localize.sdf";
return ( $path , $localizeFile );
}
diff --git a/l10ntools/scripts/localize.pl b/l10ntools/scripts/localize.pl
index 8b6a8231ebce..4aea1d933992 100755..100644
--- a/l10ntools/scripts/localize.pl
+++ b/l10ntools/scripts/localize.pl
@@ -70,14 +70,12 @@ my $no_gsicheck = '';
my $mode = '';
my $bVerbose = "0";
my $srcpath = '';
-my $WIN;
my $languages;
#my %sl_modules; # Contains all modules where en-US and de is source language
my $use_default_date = '0';
my $force_ooo_module = '0';
my %is_ooo_module;
my %is_so_module;
-my $DELIMITER;
# ( leftpart ) ( rightpart )
# prj file dummy type gid lid helpid pform width lang text helptext qhelptext title timestamp
@@ -91,23 +89,14 @@ my @sdfparticles;
parse_options();
check_modules_scm();
-if ( defined $ENV{USE_SHELL} && $ENV{USE_SHELL} eq '4nt' ) {
- $WIN = 'TRUE';
- $DELIMITER = "\\";
-}
- else {
- $WIN = '';
- $DELIMITER = "/";
-}
-
my $binpath = '';
if( defined $ENV{UPDMINOREXT} )
{
- $binpath = $ENV{SOLARVER}.$DELIMITER.$ENV{INPATH}.$DELIMITER."bin".$ENV{UPDMINOREXT}.$DELIMITER ;
+ $binpath = $ENV{SOLARVER}."/".$ENV{INPATH}."/bin".$ENV{UPDMINOREXT}."/" ;
}
else
{
- $binpath = $ENV{SOLARVER}.$DELIMITER.$ENV{INPATH}.$DELIMITER."bin".$DELIMITER ;
+ $binpath = $ENV{SOLARVER}."/".$ENV{INPATH}."/bin/" ;
}
#%sl_modules = fetch_sourcelanguage_dirlist();
@@ -187,9 +176,8 @@ sub splitfile{
exit( -1 );
}
my $src_root = $ENV{SRC_ROOT};
- #print $WIN eq "TRUE" ? $src_root."\\l10n_so\n" : $src_root."/l10n_so\n";
- my $so_l10n_path = $WIN eq "TRUE" ? $src_root."\\l10n_so\\source" : $src_root."/l10n_so/source";
- my $ooo_l10n_path = $WIN eq "TRUE" ? $src_root."\\l10n\\source" : $src_root."/l10n/source";
+ my $so_l10n_path = $src_root."/l10n_so/source";
+ my $ooo_l10n_path = $src_root."/l10n/source";
#print "$so_l10n_path\n";
#print "$ooo_l10n_path\n";
@@ -284,9 +272,11 @@ sub write_sdf
foreach my $lang( keys( %{ $string_hash } ) )
{
my @sdf_file;
+ next , if( $lang eq "en-US" );
+ mkdir $l10n_file."/$lang";
# mkdir!!!!
- my $current_l10n_file = $WIN eq "TRUE" ? $l10n_file."\\$lang\\localize.sdf" : $l10n_file."/$lang/localize.sdf";
+ my $current_l10n_file = $l10n_file."/$lang/localize.sdf";
print "Writing '$current_l10n_file'\n";
if( open DESTFILE , "< $current_l10n_file" ){
@@ -392,11 +382,9 @@ sub merge_gsicheck{
my ( $TMPHANDLE , $tmpfile ) = File::Temp::tempfile();
close ( $TMPHANDLE );
- if( $ENV{WRAPCMD} ){
- $command = "$ENV{WRAPCMD} gsicheck";
- }else{
- $command = "gsicheck";
- }
+ $command = "$ENV{WRAPCMD} " if( $ENV{WRAPCMD} );
+ $command .= "$ENV{SOLARVER}/$ENV{INPATH}/bin/gsicheck";
+
my $errfile = $sdffile.".err";
$command .= " -k -c -wcf $tmpfile -wef $errfile -l \"\" $sdffile";
#my $rc = system( $command );
@@ -430,17 +418,17 @@ sub add_paths
{
my $langhash_ref = shift;
my $root_dir = $ENV{ SRC_ROOT };
- my $ooo_l10n_dir = "$root_dir"."$DELIMITER"."l10n"."$DELIMITER"."source";
- my $so_l10n_dir = "$root_dir"."$DELIMITER"."l10n_so"."$DELIMITER"."source";
+ my $ooo_l10n_dir = "$root_dir/l10n/source";
+ my $so_l10n_dir = "$root_dir/l10n_so/source";
if( -e $ooo_l10n_dir )
{
foreach my $lang ( keys( %{ $langhash_ref } ) )
{
- my $loc_file = "$ooo_l10n_dir"."$DELIMITER"."$lang"."$DELIMITER"."localize.sdf";
+ my $loc_file = "$ooo_l10n_dir/$lang/localize.sdf";
if( -e $loc_file )
{
- push @sdfparticles , "$ooo_l10n_dir"."$DELIMITER"."$lang"."$DELIMITER"."localize.sdf";
+ push @sdfparticles , "$ooo_l10n_dir/$lang/localize.sdf";
}
else { print "WARNING: $loc_file not found ....\n"; }
}
@@ -450,10 +438,10 @@ sub add_paths
{
foreach my $lang ( keys( %{ $langhash_ref } ) )
{
- my $loc_file = "$so_l10n_dir"."$DELIMITER"."$lang"."$DELIMITER"."localize.sdf";
+ my $loc_file = "$so_l10n_dir/$lang/localize.sdf";
if( -e $loc_file )
{
- push @sdfparticles , "$ooo_l10n_dir"."$DELIMITER"."$lang"."$DELIMITER"."localize.sdf";
+ push @sdfparticles , "$ooo_l10n_dir/$lang/localize.sdf";
}
else { #print "WARNING: $loc_file not found ....\n";
}
@@ -530,10 +518,6 @@ sub collectfiles{
} #foreach
} # if
} # if
-# if ( !$bVerbose ){
-# if ( $WIN eq "TRUE" ) { $args .= " > $my_localize_log"; }
-# else { $args .= " >& $my_localize_log"; }
-# }
if ( $bVerbose ) { print STDOUT $command.$args."\n"; }
my $rc = system( $command.$args );
diff --git a/l10ntools/scripts/localize_old.pl b/l10ntools/scripts/localize_old.pl
index fe63ba9a93de..d6b66d6bb535 100755..100644
--- a/l10ntools/scripts/localize_old.pl
+++ b/l10ntools/scripts/localize_old.pl
@@ -63,7 +63,6 @@ my $outputfile = '';
my $mode = '';
my $bVerbose="0";
my $srcpath = '';
-my $WIN;
my $languages;
#my %sl_modules; # Contains all modules where en-US and de is source language
my $use_default_date = '0';
@@ -78,13 +77,6 @@ my $default_date = "2002-02-02 02:02:02";
#### main ####
parse_options();
-if ( defined $ENV{USE_SHELL} && $ENV{USE_SHELL} eq '4nt' ) {
- $WIN = 'TRUE';
-}
- else {
- $WIN = '';
-}
-
#%sl_modules = fetch_sourcelanguage_dirlist();
@@ -136,13 +128,11 @@ sub splitfile{
next if( $prj eq "binfilter" ); # Don't merge strings into binfilter module
chomp( $line );
$currentFile = $srcpath . '\\' . $prj . '\\' . $file;
- if ( $WIN ) { $currentFile =~ s/\//\\/g; }
- else { $currentFile =~ s/\\/\//g; }
+ $currentFile =~ s/\\/\//g;
$cur_sdffile = $currentFile;
#if( $cur_sdffile =~ /\.$file_types[\s]*$/ ){
- if( $WIN ) { $cur_sdffile =~ s/\\[^\\]*\.$file_types[\s]*$/\\localize.sdf/; }
- else { $cur_sdffile =~ s/\/[^\/]*\.$file_types[\s]*$/\/localize.sdf/; }
+ $cur_sdffile =~ s/\/[^\/]*\.$file_types[\s]*$/\/localize.sdf/;
#}
# Set default date
@@ -182,41 +172,6 @@ sub splitfile{
}
#########################################################
-#sub fetch_sourcelanguage_dirlist
-#{
-#
-# my $working_path = getcwd();
-# my %sl_dirlist;
-#
-# chdir $srcpath;
-# my @all_dirs = csh_glob( "*" );
-#
-# foreach my $file ( @all_dirs )
-# {
-# if( -d $file )
-# {
-# my $module = $file;
-# $file .= "/prj/l10n";
-# $file =~ s/\//\\/ , if( $WIN ) ;
-#
-# if( -f $file ) # Test file <module>/prj/l10n
-# {
-# $sl_dirlist{ $module } = 1;
-# if( $bVerbose eq "1" ) { print STDOUT "$module: de and en-US source language detected\n"; }
-# }
-# }
-# }
-#
-# chdir $working_path;
-#
-# return %sl_dirlist;
-#}
-
-#sub has_two_sourcelanguages
-#{
-# my $module = shift;
-# return defined $sl_modules{ $module } ;
-#}
sub writesdf{
my $lastFile = shift;
@@ -225,8 +180,7 @@ sub writesdf{
my %index=();
if( $localizeFile =~ /\.$file_types[\s]*$/ ){
- if( $WIN ) { $localizeFile =~ s/\\[^\\]*\.$file_types[\s]*$/\\localize.sdf/; }
- else { $localizeFile =~ s/\/[^\/]*\.$file_types[\s]*$/\/localize.sdf/; }
+ $localizeFile =~ s/\/[^\/]*\.$file_types[\s]*$/\/localize.sdf/;
}else {
print STDERR "Strange filetype found '$localizeFile'\n";
return;
@@ -471,10 +425,6 @@ sub collectfiles{
} #foreach
} # if
} # if
-# if ( !$bVerbose ){
-# if ( $WIN eq "TRUE" ) { $args .= " > $my_localize_log"; }
-# else { $args .= " >& $my_localize_log"; }
-# }
if ( $bVerbose ) { print STDOUT $command.$args."\n"; }
my $rc = system( $command.$args );
diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx
index a3df11c2920b..59f29525eda4 100644
--- a/l10ntools/source/export.cxx
+++ b/l10ntools/source/export.cxx
@@ -2096,7 +2096,7 @@ BOOL Export::PrepareTextToMerge( ByteString &rText, USHORT nTyp,
}
ByteString sContent;
- pEntrys->GetText( sContent, nTyp, nLangIndex );
+ pEntrys->GetTransex3Text( sContent, nTyp, nLangIndex );
//if ( !sContent.Len() && ( ! nLangIndex.EqualsIgnoreCaseAscii("en-US") )) {
if ( !sContent.Len() && ( ! Export::isSourceLanguage( nLangIndex ) )) {
rText = sOrigText;
@@ -2158,7 +2158,7 @@ void Export::MergeRest( ResData *pResData, USHORT nMode )
sCur = aLanguages[ n ];
ByteString sText;
- BOOL bText = pEntry->GetText( sText, STRING_TYP_TEXT, sCur , TRUE );
+ BOOL bText = pEntry->GetTransex3Text( sText, STRING_TYP_TEXT, sCur , TRUE );
if ( bText && sText.Len() && sText != "-" ) {
ByteString sOutput;
if ( bNextMustBeDefineEOL) {
@@ -2211,7 +2211,7 @@ void Export::MergeRest( ResData *pResData, USHORT nMode )
sCur = aLanguages[ n ];
ByteString sText;
- BOOL bText = pEntry->GetText( sText, STRING_TYP_QUICKHELPTEXT, sCur, TRUE );
+ BOOL bText = pEntry->GetTransex3Text( sText, STRING_TYP_QUICKHELPTEXT, sCur, TRUE );
if ( bText && sText.Len() && sText != "-" ) {
ByteString sOutput;
if ( bNextMustBeDefineEOL) {
@@ -2258,7 +2258,7 @@ void Export::MergeRest( ResData *pResData, USHORT nMode )
sCur = aLanguages[ n ];
ByteString sText;
- BOOL bText = pEntry->GetText( sText, STRING_TYP_TITLE, sCur, TRUE );
+ BOOL bText = pEntry->GetTransex3Text( sText, STRING_TYP_TITLE, sCur, TRUE );
if ( bText && sText.Len() && sText != "-" ) {
ByteString sOutput;
if ( bNextMustBeDefineEOL) {
@@ -2343,9 +2343,9 @@ void Export::MergeRest( ResData *pResData, USHORT nMode )
//printf("Lang %s, List Index %d\n",sCur.GetBuffer(),(int)nLIndex);
ByteString sText;
BOOL bText;
- bText = pEntrys->GetText( sText, STRING_TYP_TEXT, sCur, TRUE );
+ bText = pEntrys->GetTransex3Text( sText, STRING_TYP_TEXT, sCur, TRUE );
if( !bText )
- bText = pEntrys->GetText( sText , STRING_TYP_TEXT, SOURCE_LANGUAGE , FALSE );
+ bText = pEntrys->GetTransex3Text( sText , STRING_TYP_TEXT, SOURCE_LANGUAGE , FALSE );
// Use fallback, if data is missing in sdf file
//if( !bText && pResData->sResTyp.Equals( "pairedlist" ) ){
diff --git a/l10ntools/source/export2.cxx b/l10ntools/source/export2.cxx
index 8a384b415b6f..fc8f823b7deb 100644
--- a/l10ntools/source/export2.cxx
+++ b/l10ntools/source/export2.cxx
@@ -703,11 +703,6 @@ void Export::getRandomName( ByteString& sRandStr )
DirEntry Export::GetTempFile()
/*****************************************************************************/
{
-#if defined(WNT) || defined(OS2)
- String sTempDir( Export::GetEnv( "TEMP" ), RTL_TEXTENCODING_ASCII_US );
-#else
- String sTempDir( String::CreateFromAscii( "/tmp" ));
-#endif
rtl::OUString* sTempFilename = new rtl::OUString();
// Create a temp file
diff --git a/l10ntools/source/help/HelpIndexerTool.java b/l10ntools/source/help/HelpIndexerTool.java
index 1245247c3c9a..2a49f964d48f 100644
--- a/l10ntools/source/help/HelpIndexerTool.java
+++ b/l10ntools/source/help/HelpIndexerTool.java
@@ -69,6 +69,7 @@ public class HelpIndexerTool
String aModule = "";
String aTargetZipFileStr = "";
String aCfsName = "";
+ String aSegmentName = "";
// Scan arguments
boolean bLang = false;
@@ -77,6 +78,7 @@ public class HelpIndexerTool
boolean bSrcDir = false;
boolean bOutput = false;
boolean bCfsName = false;
+ boolean bSegmentName = false;
int nArgCount = args.length;
for( int i = 0 ; i < nArgCount ; i++ )
@@ -126,7 +128,7 @@ public class HelpIndexerTool
}
i++;
}
- else if( "-checkcfsname".equals(args[i]) )
+ else if( "-checkcfsandsegname".equals(args[i]) )
{
if( i + 1 < nArgCount )
{
@@ -134,6 +136,17 @@ public class HelpIndexerTool
bCfsName = true;
}
i++;
+ if( i + 1 < nArgCount )
+ {
+ aSegmentName = "segments" + args[i + 1];
+ bSegmentName = true;
+ }
+ i++;
+ if (!(bCfsName && bSegmentName))
+ {
+ System.out.println("Usage: HelpIndexer -checkcfsandsegname _0 _3 (2 arguments needed)");
+ System.exit( -1 );
+ }
}
}
@@ -173,12 +186,17 @@ public class HelpIndexerTool
writer.close();
boolean bCfsFileOk = true;
- if( bCfsName && !bExtensionMode && nRet != -1 )
+ boolean bSegmentFileOk = true;
+ if( bCfsName && bSegmentName && !bExtensionMode && nRet != -1 )
{
String aCompleteCfsFileName = aDirToZipStr + File.separator + aIndexDirName + File.separator + aCfsName;
+ String aCompleteSegmentFileName = aDirToZipStr + File.separator + aIndexDirName + File.separator + aSegmentName;
File aCfsFile = new File( aCompleteCfsFileName );
+ File aSegmentFile = new File( aCompleteSegmentFileName );
bCfsFileOk = aCfsFile.exists();
+ bSegmentFileOk = aSegmentFile.exists();
System.out.println( "Checking cfs file " + aCfsName+ ": " + (bCfsFileOk ? "Found" : "Not found") );
+ System.out.println( "Checking segment file " + aSegmentName+ ": " + (bSegmentFileOk ? "Found" : "Not found") );
}
if( bExtensionMode )
@@ -194,7 +212,7 @@ public class HelpIndexerTool
if( nRet == -1 )
deleteRecursively( aIndexDir );
- if( bCfsFileOk )
+ if( bCfsFileOk && bSegmentFileOk )
System.out.println( "Zipping ..." );
File aDirToZipFile = new File( aDirToZipStr );
createZipFile( aDirToZipFile, aTargetZipFileStr );
@@ -207,6 +225,12 @@ public class HelpIndexerTool
System.exit( -1 );
}
+ if( !bSegmentFileOk )
+ {
+ System.out.println( "segment file check failed, terminating..." );
+ System.exit( -1 );
+ }
+
Date end = new Date();
if( !bExtensionMode )
System.out.println(end.getTime() - start.getTime() + " total milliseconds");
diff --git a/l10ntools/source/help/HelpLinker.cxx b/l10ntools/source/help/HelpLinker.cxx
index ae2b88bfc470..94139f89de1e 100644
--- a/l10ntools/source/help/HelpLinker.cxx
+++ b/l10ntools/source/help/HelpLinker.cxx
@@ -245,7 +245,11 @@ class HelpLinker
{
public:
void main(std::vector<std::string> &args,
- std::string* pExtensionPath = NULL, const rtl::OUString* pOfficeHelpPath = NULL )
+// std::string* pExtensionPath = NULL, const rtl::OUString* pOfficeHelpPath = NULL )
+ std::string* pExtensionPath = NULL,
+ std::string* pDestination = NULL,
+ const rtl::OUString* pOfficeHelpPath = NULL )
+
throw( HelpProcessingException );
HelpLinker()
@@ -269,6 +273,7 @@ private:
std::string lang;
std::string hid;
std::string extensionPath;
+ std::string extensionDestination;
bool bExtensionMode;
fs::path indexDirName;
Stringtable hidlistTranslation;
@@ -396,7 +401,8 @@ void HelpLinker::link() throw( HelpProcessingException )
if( bExtensionMode )
{
- indexDirParentName = sourceRoot;
+ //indexDirParentName = sourceRoot;
+ indexDirParentName = extensionDestination;
}
else
{
@@ -752,8 +758,9 @@ void HelpLinker::link() throw( HelpProcessingException )
void HelpLinker::main( std::vector<std::string> &args,
- std::string* pExtensionPath, const rtl::OUString* pOfficeHelpPath )
- throw( HelpProcessingException )
+ std::string* pExtensionPath, std::string* pDestination,
+ const rtl::OUString* pOfficeHelpPath )
+ throw( HelpProcessingException )
{
rtl::OUString aOfficeHelpPath;
@@ -764,7 +771,7 @@ void HelpLinker::main( std::vector<std::string> &args,
bExtensionMode = true;
extensionPath = *pExtensionPath;
sourceRoot = fs::path(extensionPath);
-
+ extensionDestination = *pDestination;
aOfficeHelpPath = *pOfficeHelpPath;
}
if (args.size() > 0 && args[0][0] == '@')
@@ -1069,6 +1076,7 @@ HELPLINKER_DLLPUBLIC bool compileExtensionHelp
const rtl::OUString& aExtensionName,
const rtl::OUString& aExtensionLanguageRoot,
sal_Int32 nXhpFileCount, const rtl::OUString* pXhpFiles,
+ const rtl::OUString& aDestination,
HelpProcessingErrorInfo& o_rHelpProcessingErrorInfo
)
{
@@ -1096,19 +1104,22 @@ HELPLINKER_DLLPUBLIC bool compileExtensionHelp
args.push_back(std::string( argv[i]) );
for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp )
- delete argv[iXhp + 3];
+ delete[] argv[iXhp + 3];
delete[] argv;
rtl::OString aOExtensionLanguageRoot = rtl::OUStringToOString( aExtensionLanguageRoot, fs::getThreadTextEncoding() );
const char* pExtensionPath = aOExtensionLanguageRoot.getStr();
std::string aStdStrExtensionPath = pExtensionPath;
+ rtl::OString aODestination = rtl::OUStringToOString(aDestination, fs::getThreadTextEncoding());
+ const char* pDestination = aODestination.getStr();
+ std::string aStdStrDestination = pDestination;
// Set error handler
xmlSetStructuredErrorFunc( NULL, (xmlStructuredErrorFunc)StructuredXMLErrorFunction );
try
{
HelpLinker* pHelpLinker = new HelpLinker();
- pHelpLinker->main( args, &aStdStrExtensionPath, &aOfficeHelpPath );
+ pHelpLinker->main( args, &aStdStrExtensionPath, &aStdStrDestination, &aOfficeHelpPath );
delete pHelpLinker;
}
catch( const HelpProcessingException& e )
diff --git a/l10ntools/source/help/compilehelp.hxx b/l10ntools/source/help/compilehelp.hxx
index 472b15231639..9c59083bf038 100644
--- a/l10ntools/source/help/compilehelp.hxx
+++ b/l10ntools/source/help/compilehelp.hxx
@@ -72,6 +72,7 @@ HELPLINKER_DLLPUBLIC bool compileExtensionHelp
const rtl::OUString& aExtensionName,
const rtl::OUString& aExtensionLanguageRoot,
sal_Int32 nXhpFileCount, const rtl::OUString* pXhpFiles,
+ const rtl::OUString& aDestination,
HelpProcessingErrorInfo& o_rHelpProcessingErrorInfo
);
diff --git a/l10ntools/source/help/makefile.mk b/l10ntools/source/help/makefile.mk
index 50351913fe55..b66077501a8d 100644
--- a/l10ntools/source/help/makefile.mk
+++ b/l10ntools/source/help/makefile.mk
@@ -101,7 +101,7 @@ JAVACLASSFILES = \
$(CLASSDIR)$/$(PACKAGE)$/HelpFileDocument.class
.IF "$(SYSTEM_LUCENE)" == "YES"
-CLASSPATH!:=$(CLASSPATH)$(PATH_SEPERATOR)$(LUCENE_CORE_JAR)$(PATH_SEPERATOR)$(LUCENE_ANALYZERS_JAR)
+EXTRAJARFILES += $(LUCENE_CORE_JAR) $(LUCENE_ANALYZERS_JAR)
.ELSE
JARFILES += lucene-core-2.3.jar lucene-analyzers-2.3.jar
.ENDIF
diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx
index b869098faed7..6cecb0972cb7 100644
--- a/l10ntools/source/localize.cxx
+++ b/l10ntools/source/localize.cxx
@@ -66,6 +66,7 @@ const char *ExeTable[][5] = {
{ "xcs", "cfgex", "-UTF8 -e -f", "negative", "iso" },
{ "xrm", "xrmex", "-UTF8 -e", "negative", "iso" },
{ "xhp", "helpex", " -e", "negative", "noiso" },
+ { "properties", "jpropex", " -e", "negative", "noiso" },
{ "NULL", "NULL", "NULL", "NULL", "NULL" }
};
@@ -959,8 +960,16 @@ int _cdecl main( int argc, char *argv[] )
aIter.SetLanguageRestriction( sLanguages );
if ( bExport ){
if( bQuiet2 ){ /*printf("");*/fflush( stdout );}
- aIter.Extract( sFileName );
- if( bQuiet2 ){ printf("\n %d files found!\n",aIter.GetFileCnt());}
+ if( *iter == "ooo" )
+ aIter.Extract( sFileName );
+ else
+ {
+ ByteString sFileNameWithExt( sFileName );
+ sFileNameWithExt += ByteString( "." );
+ sFileNameWithExt += ByteString( (*iter).c_str() );
+ aIter.Extract( sFileNameWithExt );
+ }
+ if( bQuiet2 ){ printf("\n%d files found!\n",aIter.GetFileCnt());}
}
}
if( hasPwd )
@@ -973,7 +982,7 @@ int _cdecl main( int argc, char *argv[] )
if ( bExport ){
if( bQuiet2 ){ /*printf("");*/fflush( stdout );}
aIter.Extract( sFileName );
- if( bQuiet2 ){ printf("\n %d files found!\n",aIter.GetFileCnt());}
+ if( bQuiet2 ){ printf("\n%d files found!\n",aIter.GetFileCnt());}
}
}
diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx
index 660247ce1f8a..8c06d5a28171 100644
--- a/l10ntools/source/merge.cxx
+++ b/l10ntools/source/merge.cxx
@@ -61,6 +61,23 @@ ByteString PFormEntrys::Dump()
return sRet;
}
+BOOL PFormEntrys::GetTransex3Text( ByteString &rReturn,
+ USHORT nTyp, const ByteString &nLangIndex, BOOL bDel )
+{
+ BOOL rc = GetText( rReturn , nTyp , nLangIndex , bDel );
+ ByteString test( rReturn );
+ for( USHORT idx = 0; idx < rReturn.Len(); idx++ )
+ {
+ if( rReturn.GetChar( idx ) == '\"' && ( idx >= 1 ) && rReturn.GetChar( idx-1 ) == '\\' )
+ {
+ rReturn.Erase( idx-1 , 1 );
+ }
+ }
+ //if( !rReturn.Equals( test ) )
+ // printf("*CHANGED******************\n%s\n%s\n",test.GetBuffer(),rReturn.GetBuffer());
+ return rc;
+}
+/*****************************************************************************/
BOOL PFormEntrys::GetText( ByteString &rReturn,
USHORT nTyp, const ByteString &nLangIndex, BOOL bDel )
{
diff --git a/l10ntools/source/wrdtrans.cxx b/l10ntools/source/wrdtrans.cxx
deleted file mode 100644
index 10d6f472640f..000000000000
--- a/l10ntools/source/wrdtrans.cxx
+++ /dev/null
@@ -1,245 +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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_l10ntools.hxx"
-
-/*
-#include "wrdtrans.hxx"
-
-
-// NOT FULLY DECLARED SERVICES
-#include <vector>
-#include <vos/macros.hxx>
-
-
-#include <tools/stream.hxx>
-#include "wtratree.hxx"
-
-#include <tools/string.hxx>
-*/
-//************** Declaration WordTrans_ErrorList ******************//
-/*
-typedef NAMESPACE_STD(vector)<ByteString> Stl_ByteStringList;
-
-class WordTrans_ErrorList
-{
- public:
- // OPERATIONS
- void AddError(
- WordTransformer::E_Error
- i_eType,
- const char * i_sErrorDescription );
- void Clear(); /// Empties the list.
-
- // INQUIRY
- USHORT NrOfErrors() const;
- WordTransformer::E_Error
- GetError(
- USHORT i_nNr, /// [0 .. NrOfErrors()-1], other values return an empty error.
- ByteString * o_pErrorText ) const; /// If o_pErrorText != 0, the String is filled with the description of the error.
- private:
- // DATA
- Stl_ByteStringList aErrors;
-};
-
-*/
-
-//************** Implementation WordTransformer ******************//
-
-/*
-WordTransformer::WordTransformer()
- : dpTransformer(0),
- dpErrors(new WordTrans_ErrorList)
-{
-}
-
-WordTransformer::~WordTransformer()
-{
- if (dpTransformer != 0)
- delete dpTransformer;
- delete dpErrors;
-}
-
-BOOL
-WordTransformer::LoadWordlist( const ByteString & i_sWordlist_Filepath,
- CharSet i_nWorkingCharSet,
- CharSet i_nFileCharSet )
-{
- if (dpTransformer != 0)
- return FALSE;
-
- SvFileStream aFile(String(i_sWordlist_Filepath,RTL_TEXTENCODING_ASCII_US),STREAM_STD_READ);
- if (! aFile.IsOpen())
- return FALSE;
- aFile.SetStreamCharSet( i_nFileCharSet ) ;
-// aFile.SetTargetCharSet( i_nWorkingCharSet );
-
- dpTransformer = new WordTransTree;
-
- ByteString sTrans;
- while ( aFile.ReadLine(sTrans) )
- {
- dpTransformer->AddWordPair(sTrans.GetToken(0,';'),sTrans.GetToken(1,';'));
- }
-
- aFile.Close();
- return TRUE;
-}
-
-USHORT
-WordTransformer::Transform(ByteString & io_sText)
-{
- // Initialization and precondition testing:
- dpErrors->Clear();
- if (dpTransformer == 0)
- {
- dpErrors->AddError(ERROR_NO_WORDLIST,"Error: No wordlist was loaded.");
- return dpErrors->NrOfErrors();
- }
- else if (io_sText.Len() > 63 * 1024)
- {
- dpErrors->AddError(ERROR_OUTPUTSTRING_TOO_LONG,"Error: Inputstring was too long (bigger than 63 KB).");
- return dpErrors->NrOfErrors();
- }
- else if (io_sText.Len() == 0)
- {
- return 0;
- }
-
- // Transform:
- dpTransformer->InitTransformation(
- io_sText.GetBuffer(),
- io_sText.Len() );
-
- for ( ; !dpTransformer->TextEndReached(); )
- {
- if (dpTransformer->TransformNextToken() != WordTransTree::OK)
- {
- CreateError();
- }
- }
- io_sText = dpTransformer->Output();
- return dpErrors->NrOfErrors();
-}
-
-USHORT
-WordTransformer::NrOfErrors() const
-{
- return dpErrors->NrOfErrors();
-}
-
-WordTransformer::E_Error
-WordTransformer::GetError( USHORT i_nNr,
- ByteString * o_pErrorText) const
-{
- return dpErrors->GetError(i_nNr,o_pErrorText);
-}
-
-void
-WordTransformer::CreateError()
-{
- ByteString sErr;
-
- switch (dpTransformer->CurResult())
- {
- case WordTransTree::OK:
- break;
- case WordTransTree::HOTKEY_LOST:
- sErr = ByteString("Error: By replacement of string ");
- sErr += dpTransformer->CurReplacedString();
- sErr += " by ";
- sErr += dpTransformer->CurReplacingString();
- sErr += "the hotkey at char '";
- sErr += dpTransformer->CurHotkey();
- sErr += "' was lost.";
- dpErrors->AddError( ERROR_HOTKEY,sErr.GetBufferAccess());
- sErr.ReleaseBufferAccess();
- break;
- case WordTransTree::OUTPUT_OVERFLOW:
- dpErrors->AddError(ERROR_OUTPUTSTRING_TOO_LONG,"Error: Output buffer overflow.");
- break;
- default:
- dpErrors->AddError(OTHER_ERROR,"Error: Unknown error.");
- }
-}
-*/
-//************** Implementation WordTrans_ErrorList ******************//
-/*
-void
-WordTrans_ErrorList::AddError( WordTransformer::E_Error i_eType,
- const char * i_sErrorDescription )
-{
- ByteString sErrorType = "xxx";
- char * pErrorChars = sErrorType.GetBufferAccess();
- pErrorChars[0] = char(i_eType / 100 + '0');
- pErrorChars[1] = char( (i_eType % 100) / 10 + '0');
- pErrorChars[2] = char(i_eType % 10 + '0');
- sErrorType += i_sErrorDescription;
-
- aErrors.push_back(sErrorType);
- sErrorType.ReleaseBufferAccess();
-}
-
-void
-WordTrans_ErrorList::Clear()
-{
- aErrors.erase(aErrors.begin(),aErrors.end());
-}
-
-USHORT
-WordTrans_ErrorList::NrOfErrors() const
-{
- return aErrors.size();
-}
-
-WordTransformer::E_Error
-WordTrans_ErrorList::GetError( USHORT i_nNr,
- ByteString * o_pErrorText ) const
-{
- if ( i_nNr < aErrors.size() )
- {
- const ByteString & rError = aErrors[i_nNr];
- const char * pErrorChars = rError.GetBuffer();
-
- USHORT nError = USHORT( (pErrorChars[0] - '0') ) * 100
- + (pErrorChars[1] - '0') * 10
- + pErrorChars[2] - '0';
-
- if (o_pErrorText != 0)
- *o_pErrorText = pErrorChars+3;
-
- return WordTransformer::E_Error(nError);
- }
- else
- {
- if (o_pErrorText != 0)
- *o_pErrorText = "";
- return WordTransformer::OK;
- }
-}
-*/
diff --git a/l10ntools/source/xrmlex.l b/l10ntools/source/xrmlex.l
index c28aede4c6c1..4770a851c741 100644
--- a/l10ntools/source/xrmlex.l
+++ b/l10ntools/source/xrmlex.l
@@ -55,54 +55,55 @@ int bText=0;
%%
-"<Readme"[^\>]*\> {
- WorkOnTokenSet( XRM_README_START, yytext );
+"<p "[^\>]*xml:lang[^\>]*\> {
+ WorkOnTokenSet( XRM_TEXT_START , yytext );
}
-"</Readme>" {
- WorkOnTokenSet( XRM_README_END, yytext );
+"</p>" {
+ WorkOnTokenSet( XRM_TEXT_END, yytext );
}
-"<apochelp"[^\>]*\> {
- WorkOnTokenSet( XRM_README_START, yytext );
+"<h1 "[^\>]*xml:lang[^\>]*\> {
+ WorkOnTokenSet( XRM_TEXT_START , yytext );
}
-"</apochelp>" {
- WorkOnTokenSet( XRM_README_END, yytext );
+"</h1>" {
+ WorkOnTokenSet( XRM_TEXT_END, yytext );
}
-
-"<Section"[^\>]*\> {
- WorkOnTokenSet( XRM_SECTION_START, yytext );
+"<h2 "[^\>]*xml:lang[^\>]*\> {
+ WorkOnTokenSet( XRM_TEXT_START , yytext );
}
-"</Section>" {
- WorkOnTokenSet( XRM_SECTION_END, yytext );
+"</h2>" {
+ WorkOnTokenSet( XRM_TEXT_END, yytext );
}
-
-"<Paragraph"[^\>]*\> {
- WorkOnTokenSet( XRM_PARAGRAPH_START, yytext );
+"<h3 "[^\>]*xml:lang[^\>]*\> {
+ WorkOnTokenSet( XRM_TEXT_START , yytext );
}
-"</Paragraph>" {
- WorkOnTokenSet( XRM_PARAGRAPH_END, yytext );
+"</h3>" {
+ WorkOnTokenSet( XRM_TEXT_END, yytext );
}
-
-"<Text"[^\>]*\> {
- WorkOnTokenSet( XRM_TEXT_START, yytext );
+"<h4 "[^\>]*xml:lang[^\>]*\> {
+ WorkOnTokenSet( XRM_TEXT_START , yytext );
}
-"</Text>" {
+"</h4>" {
WorkOnTokenSet( XRM_TEXT_END, yytext );
}
-
-"<List"[^\>]*\> {
- WorkOnTokenSet( XRM_LIST_START, yytext );
+"<h5 "[^\>]*xml:lang[^\>]*\> {
+ WorkOnTokenSet( XRM_TEXT_START , yytext );
}
-"</List>" {
- WorkOnTokenSet( XRM_LIST_END, yytext );
+"</h5>" {
+ WorkOnTokenSet( XRM_TEXT_END, yytext );
}
+
+
+
+
+
"<!--" {
char c1 = 0, c2 = 0, c3 = input();
char pChar[2];
diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx
index 149fd560fe3b..b77f75ea04e5 100644
--- a/l10ntools/source/xrmmerge.cxx
+++ b/l10ntools/source/xrmmerge.cxx
@@ -268,7 +268,7 @@ extern FILE *GetXrmFile()
int WorkOnTokenSet( int nTyp, char *pTokenText )
/*****************************************************************************/
{
-// printf("Typ = %d , text = '%s'\n",nTyp , pTokenText );
+ //printf("Typ = %d , text = '%s'\n",nTyp , pTokenText );
pParser->Execute( nTyp, pTokenText );
return 1;
@@ -346,10 +346,10 @@ int XRMResParser::Execute( int nToken, char * pToken )
sLID = "";
sGID += ".";
sGID += GetAttribute( rToken, "id" );
- if ( GetAttribute( rToken, "localized" ) == "false" )
+// if ( GetAttribute( rToken, "localized" ) == "false" )
// sLocalized += "0";
- sLocalized = false;
- else
+// sLocalized = false;
+// else
// sLocalized += "1";
sLocalized = true;
break;
@@ -368,47 +368,32 @@ int XRMResParser::Execute( int nToken, char * pToken )
}
break;
- case XRM_TEXT_START:
-// if ( sLocalized.GetChar( sLocalized.Len() - 1 ) == '1' ) {
- if ( sLocalized ) {
-
+ case XRM_TEXT_START:{
+ //printf("->XRM_TEXT_START\n");
ByteString sNewLID = GetAttribute( rToken, "id" );
if ( sNewLID != sLID ) {
- EndOfText( sCurrentOpenTag, sCurrentCloseTag );
+ //EndOfText( sCurrentOpenTag, sCurrentCloseTag );
sLID = sNewLID;
}
bText = TRUE;
sCurrentText = "";
sCurrentOpenTag = rToken;
Output( rToken );
+ //printf("<-XRM_TEXT_START\n");
}
break;
case XRM_TEXT_END: {
-// if ( sLocalized.GetChar( sLocalized.Len() - 1 ) == '1' ) {
- if( sLocalized ){
sCurrentCloseTag = rToken;
-
+ //printf("->XRM_TEXT_END\n");
ByteString sLang = GetAttribute( sCurrentOpenTag, "xml:lang" );
- if( sLang.EqualsIgnoreCaseAscii("de") ){
- ULONG nLen = 0;
- while ( sCurrentText.Len() != nLen )
- {
- nLen = sCurrentText.Len();
- sCurrentText.SearchAndReplaceAll( "\n\t", "\n" );
- sCurrentText.SearchAndReplaceAll( "\n ", "\n" );
- }
- sCurrentText.SearchAndReplaceAll( "\n", " " );
- sCurrentCloseTag = rToken;
- }
WorkOnText( sCurrentOpenTag, sCurrentText );
Output( sCurrentText );
-
- //fprintf( stdout, "%s %s\n", sGID.GetBuffer(), sLID.GetBuffer());
- //fprintf( stdout, "%s\n\n", sCurrentText.GetBuffer());
-
+ EndOfText( sCurrentOpenTag, sCurrentCloseTag );// <---
bText = FALSE;
- }
+ rToken = ByteString("");
+ sCurrentText = ByteString("");
+ //printf("<-XRM_TEXT_END");
}
break;
@@ -429,8 +414,9 @@ int XRMResParser::Execute( int nToken, char * pToken )
}
if ( !bText )
+ {
Output( rToken );
-
+ }
return 0;
}
@@ -598,15 +584,19 @@ void XRMResExport::EndOfText(
sCur = aLanguages[ n ];
ByteString sAct = pResData->sText[ sCur ];
- Export::UnquotHTML( sAct );
+ //Export::UnquotHTML( sAct );
sAct.EraseAllChars( 0x0A );
ByteString sOutput( sPrj ); sOutput += "\t";
sOutput += sPath;
sOutput += "\t0\t";
sOutput += "readmeitem\t";
- sOutput += pResData->sGId; sOutput += "\t";
- sOutput += pResData->sId; sOutput += "\t\t\t0\t";
+ sOutput += pResData->sId;
+ // USE LID AS GID OR MERGE DON'T WORK
+ //sOutput += pResData->sGId;
+ sOutput += "\t";
+ sOutput += pResData->sId;
+ sOutput += "\t\t\t0\t";
sOutput += sCur;
sOutput += "\t";
@@ -615,7 +605,8 @@ void XRMResExport::EndOfText(
sOutput.SearchAndReplaceAll( sSearch, "_" );
//if( !sCur.EqualsIgnoreCaseAscii("de") ||( sCur.EqualsIgnoreCaseAscii("de") && !Export::isMergingGermanAllowed( sPrj ) ) )
- pOutputStream->WriteLine( sOutput );
+ if( sAct.Len() > 1 )
+ pOutputStream->WriteLine( sOutput );
}
}
delete pResData;
@@ -666,12 +657,14 @@ void XRMResMerge::WorkOnText(
if ( pMergeDataFile ) {
if ( !pResData ) {
ByteString sPlatform( "" );
- pResData = new ResData( sPlatform, GetGID() , sFilename );
+// pResData = new ResData( sPlatform, GetGID() , sFilename );
+ pResData = new ResData( sPlatform, GetLID() , sFilename );
pResData->sId = GetLID();
+
pResData->sResTyp = "readmeitem";
}
- PFormEntrys *pEntrys = pMergeDataFile->GetPFormEntrys( pResData );
+ PFormEntrys *pEntrys = pMergeDataFile->GetPFormEntrys( pResData );
if ( pEntrys ) {
ByteString sContent;
if ( Export::isAllowed( sLang ) &&
@@ -682,7 +675,7 @@ void XRMResMerge::WorkOnText(
{
rText = sContent;
ConvertStringToXMLFormat( rText );
- Export::QuotHTMLXRM( rText );
+ //Export::QuotHTMLXRM( rText );
}
}
}
@@ -692,7 +685,8 @@ void XRMResMerge::WorkOnText(
void XRMResMerge::Output( const ByteString& rOutput )
/*****************************************************************************/
{
- if ( pOutputStream )
+ //printf("W: %s\n",rOutput.GetBuffer());
+ if ( pOutputStream && rOutput.Len() > 0 )
pOutputStream->Write( rOutput.GetBuffer(), rOutput.Len());
}
@@ -703,6 +697,8 @@ void XRMResMerge::EndOfText(
)
/*****************************************************************************/
{
+
+ Output( rCloseTag );
if ( pMergeDataFile && pResData ) {
PFormEntrys *pEntrys = pMergeDataFile->GetPFormEntrys( pResData );
if ( pEntrys ) {
@@ -710,18 +706,13 @@ void XRMResMerge::EndOfText(
for( unsigned int n = 0; n < aLanguages.size(); n++ ){
sCur = aLanguages[ n ];
ByteString sContent;
-//<<<<<<< xrmmerge.cxx
if ( !sCur.EqualsIgnoreCaseAscii("en-US") &&
- // ( !sCur.EqualsIgnoreCaseAscii("de") ||( sCur.EqualsIgnoreCaseAscii("de") && Export::isMergingGermanAllowed( sPrj ) )) &&
-//=======
-// if ( Export::isAllowed( sCur ) &&
-//>>>>>>> 1.17
( pEntrys->GetText(
sContent, STRING_TYP_TEXT, sCur, TRUE )) &&
( sContent != "-" ) && ( sContent.Len()))
{
ByteString sText( sContent );
- Export::QuotHTMLXRM( sText );
+ //Export::QuotHTMLXRM( sText );
ByteString sAdditionalLine( "\t" );
sAdditionalLine += rOpenTag;
diff --git a/o3tl/inc/o3tl/vector_pool.hxx b/o3tl/inc/o3tl/vector_pool.hxx
new file mode 100644
index 000000000000..19fc3d6d74c4
--- /dev/null
+++ b/o3tl/inc/o3tl/vector_pool.hxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: lazy_update.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * 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_O3TL_VECTOR_POOL_HXX
+#define INCLUDED_O3TL_VECTOR_POOL_HXX
+
+#include <sal/types.h>
+#include <vector>
+
+namespace o3tl
+{
+ namespace detail
+ {
+ template<typename ValueType, class Container> class simple_pool_impl :
+ public Container
+ {
+ typedef typename Container::value_type value_type;
+ std::ptrdiff_t mnFirstFreeIndex;
+
+ public:
+ simple_pool_impl() :
+ mnFirstFreeIndex(-1)
+ {}
+
+ std::ptrdiff_t alloc()
+ {
+ return store(ValueType());
+ }
+
+ std::ptrdiff_t store(const ValueType& rCopy)
+ {
+ if( mnFirstFreeIndex != -1 )
+ {
+ std::ptrdiff_t nIdx=mnFirstFreeIndex;
+ mnFirstFreeIndex = this->at(mnFirstFreeIndex).nextFree;
+ this->at(nIdx).value = rCopy;
+ this->at(nIdx).nextFree = -1;
+
+ return nIdx;
+ }
+ else
+ {
+ push_back(value_type(rCopy));
+ return this->size()-1;
+ }
+ }
+
+ void free( std::ptrdiff_t nIdx )
+ {
+ this->at(nIdx).nextFree = mnFirstFreeIndex;
+ mnFirstFreeIndex = nIdx;
+ }
+
+ const ValueType& get( std::ptrdiff_t nIdx ) const
+ {
+ return this->operator[](nIdx).value;
+ }
+ ValueType& get( std::ptrdiff_t nIdx )
+ {
+ return this->operator[](nIdx).value;
+ }
+ };
+
+ template< typename ValueType > struct struct_from_value
+ {
+ struct type
+ {
+ type() :
+ value(),
+ nextFree(-1)
+ {}
+ explicit type( const ValueType& val ) :
+ value(val),
+ nextFree(-1)
+ {}
+
+ ValueType value;
+ std::ptrdiff_t nextFree;
+ };
+ };
+ }
+
+ /** Simple vector-based memory pool allocator
+
+ This template can be used to provide simple pooled memory
+ allocation from a container class that adheres to the stl
+ random access container concept. Note that alloc/free works
+ with _indices_ into the container!
+
+ @example
+ <pre>
+vector_pool<type> myPool;
+int nIdx=myPool.alloc();
+myPool[nIdx] = myVal;
+ ... do stuff ...
+myPool.free(nIdx);
+ </pre>
+ */
+ template<typename ValueType> struct vector_pool :
+ public detail::simple_pool_impl<ValueType,
+ std::vector<typename detail::struct_from_value<ValueType>::type > >
+ {};
+}
+
+#endif /* INCLUDED_O3TL_VECTOR_POOL_HXX */
diff --git a/o3tl/prj/build.lst b/o3tl/prj/build.lst
index 98293257e4bd..2606d1df8586 100644
--- a/o3tl/prj/build.lst
+++ b/o3tl/prj/build.lst
@@ -1,4 +1,4 @@
-ot o3tl : sal testshl2 BOOST:boost NULL
+ot o3tl : sal CPPUNIT:cppunit BOOST:boost NULL
ot o3tl usr1 - all ot_mkout NULL
ot o3tl\inc get - all ot_inc NULL
ot o3tl\prj get - all ot_prj NULL
diff --git a/o3tl/qa/export.map b/o3tl/qa/export.map
index 709047ae63e5..3308588ef6f8 100644
--- a/o3tl/qa/export.map
+++ b/o3tl/qa/export.map
@@ -25,9 +25,9 @@
#
#*************************************************************************
-UDK_3.1 {
+UDK_3_0_0 {
global:
- registerAllTestFunction;
+ cppunitTestPlugIn;
local:
*;
diff --git a/o3tl/qa/makefile.mk b/o3tl/qa/makefile.mk
index 7effe534bbee..3475aeeca9bb 100644
--- a/o3tl/qa/makefile.mk
+++ b/o3tl/qa/makefile.mk
@@ -35,6 +35,9 @@ ENABLE_EXCEPTIONS=TRUE
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
+
+CFLAGSCXX += $(CPPUNIT_CFLAGS)
+
.IF "$(L10N_framework)"==""
# --- Common ----------------------------------------------------------
@@ -42,18 +45,19 @@ ENABLE_EXCEPTIONS=TRUE
SHL1OBJS= \
$(SLO)$/cow_wrapper_clients.obj \
$(SLO)$/test-cow_wrapper.obj \
+ $(SLO)$/test-vector_pool.obj \
$(SLO)$/test-heap_ptr.obj \
$(SLO)$/test-range.obj
SHL1TARGET= tests
SHL1STDLIBS= $(SALLIB) \
- $(TESTSHL2LIB)\
$(CPPUNITLIB)
SHL1IMPLIB= i$(SHL1TARGET)
DEF1NAME =$(SHL1TARGET)
SHL1VERSIONMAP = export.map
+SHL1RPATH = NONE
# END ------------------------------------------------------------------
@@ -65,16 +69,9 @@ SLOFILES=$(SHL1OBJS)
.ENDIF # L10N_framework
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
# --- Enable test execution in normal build ------------------------
.IF "$(L10N_framework)"==""
-unittest : $(SHL1TARGETN)
- @echo ----------------------------------------------------------
- @echo - start unit test on library $(SHL1TARGETN)
- @echo ----------------------------------------------------------
- $(TESTSHL2) -sf $(mktmp ) $(SHL1TARGETN)
-
-ALLTAR : unittest
+.INCLUDE : _cppunit.mk
.ENDIF # L10N_framework
diff --git a/o3tl/qa/test-cow_wrapper.cxx b/o3tl/qa/test-cow_wrapper.cxx
index eebbb633f82b..84d615fca3db 100644
--- a/o3tl/qa/test-cow_wrapper.cxx
+++ b/o3tl/qa/test-cow_wrapper.cxx
@@ -1,6 +1,9 @@
// autogenerated file with codegen.pl
-#include <testshl/simpleheader.hxx>
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
+#include "cppunit/plugin/TestPlugIn.h"
#include "cow_wrapper_clients.hxx"
@@ -119,15 +122,6 @@ public:
};
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(cow_wrapper_test, "cow_wrapper_test");
-
-
-// -----------------------------------------------------------------------------
-
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-void RegisterAdditionalFunctions(FktRegFuncPtr )
-{
-}
-// NOADDITIONAL;
+CPPUNIT_TEST_SUITE_REGISTRATION(cow_wrapper_test);
+CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/o3tl/qa/test-heap_ptr.cxx b/o3tl/qa/test-heap_ptr.cxx
index 44dc2083947a..fe2f78eec8af 100644
--- a/o3tl/qa/test-heap_ptr.cxx
+++ b/o3tl/qa/test-heap_ptr.cxx
@@ -25,7 +25,9 @@
*
************************************************************************/
-#include <testshl/simpleheader.hxx>
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
#include <o3tl/heap_ptr.hxx>
@@ -160,4 +162,4 @@ class heap_ptr_test : public CppUnit::TestFixture
}; // class heap_ptr_test
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(heap_ptr_test, "o3tltests");
+CPPUNIT_TEST_SUITE_REGISTRATION(heap_ptr_test);
diff --git a/o3tl/qa/test-range.cxx b/o3tl/qa/test-range.cxx
index 9ead908675b9..31cf2aec7c10 100644
--- a/o3tl/qa/test-range.cxx
+++ b/o3tl/qa/test-range.cxx
@@ -25,8 +25,9 @@
*
************************************************************************/
-
-#include <testshl/simpleheader.hxx>
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
#include <o3tl/range.hxx>
#include <vector>
@@ -230,4 +231,4 @@ public:
}; // class range_test
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(range_test, "o3tltests");
+CPPUNIT_TEST_SUITE_REGISTRATION(range_test);
diff --git a/o3tl/qa/test-vector_pool.cxx b/o3tl/qa/test-vector_pool.cxx
new file mode 100644
index 000000000000..4efaebdd3414
--- /dev/null
+++ b/o3tl/qa/test-vector_pool.cxx
@@ -0,0 +1,69 @@
+// autogenerated file with codegen.pl
+
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
+
+#include <o3tl/vector_pool.hxx>
+
+using namespace ::o3tl;
+
+class vector_pool_test : public CppUnit::TestFixture
+{
+public:
+ void testPoolBasics()
+ {
+ vector_pool<int> aPool;
+
+ std::ptrdiff_t nIdx1 = aPool.alloc();
+ std::ptrdiff_t nIdx2 = aPool.alloc();
+ std::ptrdiff_t nIdx3 = aPool.alloc();
+
+ CPPUNIT_ASSERT_MESSAGE("allocator idx order 1", nIdx1 < nIdx2 );
+ CPPUNIT_ASSERT_MESSAGE("allocator idx order 2", nIdx2 < nIdx3 );
+
+ aPool.free(nIdx2);
+ aPool.free(nIdx3);
+
+ nIdx2 = aPool.alloc();
+ nIdx3 = aPool.alloc();
+
+ CPPUNIT_ASSERT_MESSAGE("allocator idx order 1 after fragmentation", nIdx1 < nIdx3 );
+ CPPUNIT_ASSERT_MESSAGE("allocator idx order 2 after fragmentation", nIdx3 < nIdx2 );
+ }
+
+ void testPoolValueSemantics()
+ {
+ vector_pool<int> aPool;
+
+ std::ptrdiff_t nIdx1 = aPool.store(0);
+ CPPUNIT_ASSERT_MESSAGE("allocator value semantics 1", aPool.get(nIdx1) == 0 );
+
+ std::ptrdiff_t nIdx2 = aPool.store(1);
+ CPPUNIT_ASSERT_MESSAGE("allocator value semantics 2", aPool.get(nIdx2) == 1 );
+
+ std::ptrdiff_t nIdx3 = aPool.store(2);
+ CPPUNIT_ASSERT_MESSAGE("allocator value semantics 3", aPool.get(nIdx3) == 2 );
+
+ aPool.free(nIdx2);
+ aPool.free(nIdx3);
+
+ nIdx2 = aPool.store(1);
+ CPPUNIT_ASSERT_MESSAGE("allocator value semantics 2 after fragmentation", aPool.get(nIdx2) == 1 );
+
+ nIdx3 = aPool.store(2);
+ CPPUNIT_ASSERT_MESSAGE("allocator value semantics 3 after fragmentation", aPool.get(nIdx3) == 2 );
+ }
+
+ // Change the following lines only, if you add, remove or rename
+ // member functions of the current class,
+ // because these macros are need by auto register mechanism.
+
+ CPPUNIT_TEST_SUITE(vector_pool_test);
+ CPPUNIT_TEST(testPoolBasics);
+ CPPUNIT_TEST(testPoolValueSemantics);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+// -----------------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION(vector_pool_test);
diff --git a/padmin/source/padialog.cxx b/padmin/source/padialog.cxx
index 3ea15e28141c..583e14c06caa 100644
--- a/padmin/source/padialog.cxx
+++ b/padmin/source/padialog.cxx
@@ -147,6 +147,11 @@ void PADialog::Init()
::psp::PrintFontManager& rFontManager( ::psp::PrintFontManager::get() );
if( ! rFontManager.checkImportPossible() )
m_aFontsPB.Enable( FALSE );
+ if( rFontManager.hasFontconfig() )
+ {
+ m_aFontsPB.Enable( FALSE );
+ m_aFontsPB.Show( FALSE );
+ }
}
PADialog::~PADialog()
diff --git a/rsc/inc/rsctools.hxx b/rsc/inc/rsctools.hxx
index 287a079f63c8..3a3eff653cd7 100644
--- a/rsc/inc/rsctools.hxx
+++ b/rsc/inc/rsctools.hxx
@@ -68,7 +68,6 @@ class RscChar
{
public:
static char * MakeUTF8( char * pStr, UINT16 nTextEncoding );
- static char * MakeUTF8FromL( char * pStr );
};
/****************** R s c P t r P t r ************************************/
diff --git a/rsc/source/parser/erscerr.cxx b/rsc/source/parser/erscerr.cxx
index 11aaf9cce85f..158aea21b6e3 100644
--- a/rsc/source/parser/erscerr.cxx
+++ b/rsc/source/parser/erscerr.cxx
@@ -200,7 +200,7 @@ void RscError::WriteError( const ERRTYPE& rError, const char * pMessage )
case ERR_NOINPUT:
StdLstErr( "Input file was not specified.\n");
case ERR_USAGE:
- StdLstOut( "Copyright (C) 1990-92 STAR DIVISION GmbH\n" );
+ StdLstOut( "Copyright (C) 2000, 2010 Oracle and/or its affiliates.\n" );
{
char buf[40];
diff --git a/rsc/source/prj/gui.cxx b/rsc/source/prj/gui.cxx
index 0ff0549d161f..67d86a8b35cf 100644
--- a/rsc/source/prj/gui.cxx
+++ b/rsc/source/prj/gui.cxx
@@ -30,6 +30,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include <sal/main.h>
#include <rscrsc.hxx>
#include <rscdb.hxx>
@@ -68,15 +69,7 @@ RscVerbosity lcl_determineVerbosity( int argc, char ** argv )
return RscVerbosityNormal;
}
-#if defined( UNX ) || ( defined( OS2 ) && ( defined( CSET ) || defined ( GCC ))) || defined (WTC) || defined(ICC) || defined(__MINGW32__)
-int main ( int argc, char ** argv) {
-#else
-#if defined( MTW )
-int main ( int argc, char const ** argv) {
-#else
-int cdecl main ( int argc, char ** argv) {
-#endif
-#endif
+SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
#ifndef UNX
#ifdef CSET
atexit( ExitProgram );
diff --git a/rsc/source/prj/start.cxx b/rsc/source/prj/start.cxx
index 8b952acb75f9..a2841dd9765b 100644
--- a/rsc/source/prj/start.cxx
+++ b/rsc/source/prj/start.cxx
@@ -54,6 +54,7 @@
#endif // UNX
#include <rsctools.hxx>
#include <rscerror.h>
+#include <sal/main.h>
#include <tools/fsys.hxx>
/*************** C O D E ************************************************/
@@ -322,14 +323,8 @@ static BOOL CallRsc2( ByteString aRsc2Name,
|* Letzte Aenderung MM 05.09.91
|*
*************************************************************************/
-#if defined UNX || (defined OS2 && (defined CSET || defined GCC )) || defined WTC || defined MTW || defined ICC || defined(__MINGW32__)
-int main ( int argc, char ** argv)
+SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
{
-#else
-int cdecl main ( int argc, char ** argv)
-{
-#endif
-
BOOL bPrePro = TRUE;
BOOL bResFile = TRUE;
BOOL bHelp = FALSE;
diff --git a/rsc/source/tools/rscchar.cxx b/rsc/source/tools/rscchar.cxx
index ca421dde372a..c23022e4222e 100644
--- a/rsc/source/tools/rscchar.cxx
+++ b/rsc/source/tools/rscchar.cxx
@@ -194,136 +194,3 @@ char * RscChar::MakeUTF8( char * pStr, UINT16 nTextEncoding )
return pUtf8;
};
-
-/*************************************************************************
-|*
-|* RscChar::MakeChar()
-|*
-|* Beschreibung Der String wird nach C-Konvention umgesetzt
-|* Ersterstellung MM 20.03.91
-|* Letzte Aenderung MM 20.03.91
-|*
-*************************************************************************/
-char * RscChar::MakeUTF8FromL( char * pStr )
-{
- sal_Size nUniPos = 0;
- sal_Unicode * pUniCode = new sal_Unicode[ strlen( pStr ) + 1 ];
-
- char cOld = '1';
- while( cOld != 0 )
- {
- sal_Unicode c;
- if( *pStr == '\\' )
- {
- ++pStr;
- switch( *pStr )
- {
- case 'a':
- c = '\a';
- break;
- case 'b':
- c = '\b';
- break;
- case 'f':
- c = '\f';
- break;
- case 'n':
- c = '\n';
- break;
- case 'r':
- c = '\r';
- break;
- case 't':
- c = '\t';
- break;
- case 'v':
- c = '\v';
- break;
- case '\\':
- c = '\\';
- break;
- case '?':
- c = '\?';
- break;
- case '\'':
- c = '\'';
- break;
- case '\"':
- c = '\"';
- break;
- default:
- {
- if( '0' <= *pStr && '7' >= *pStr )
- {
- UINT32 nChar = 0;
- int i = 0;
- while( '0' <= *pStr && '7' >= *pStr && i != 6 )
- {
- nChar = nChar * 8 + (BYTE)*pStr - (BYTE)'0';
- ++pStr;
- i++;
- }
- if( nChar > 0xFFFF )
- // Wert zu gross, oder kein 3 Ziffern
- return( FALSE );
- c = (UINT16)nChar;
- pStr--;
- }
- else if( 'x' == *pStr || 'X' == *pStr )
- {
- UINT32 nChar = 0;
- int i = 0;
- ++pStr;
- while( isxdigit( *pStr ) && i != 4 )
- {
- if( isdigit( *pStr ) )
- nChar = nChar * 16 + (BYTE)*pStr - (BYTE)'0';
- else if( isupper( *pStr ) )
- nChar = nChar * 16 + (BYTE)*pStr - (BYTE)'A' +10;
- else
- nChar = nChar * 16 + (BYTE)*pStr - (BYTE)'a' +10;
- ++pStr;
- i++;
- }
- c = (UINT16)nChar;
- pStr--;
- }
- else
- c = *pStr;
- };
- }
- }
- else
- c = *pStr;
-
- pUniCode[ nUniPos++ ] = c;
- cOld = *pStr;
- pStr++;
- }
-
- // factor fo 6 is the maximum size of an UNICODE character as utf8
- sal_Size nMaxUtf8Len = nUniPos * 6;
- if( nUniPos * 6 > 0x0FFFFF )
- RscExit( 10 );
-
- char * pUtf8 = (char *)rtl_allocateMemory( nMaxUtf8Len );
- rtl_TextToUnicodeConverter hConv = rtl_createUnicodeToTextConverter( RTL_TEXTENCODING_UTF8 );
-
- sal_uInt32 nInfo;
- sal_Size nSrcCvtBytes;
- rtl_convertUnicodeToText( hConv, 0,
- pUniCode, nUniPos,
- pUtf8, nMaxUtf8Len,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT
- | RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT
- | RTL_UNICODETOTEXT_FLAGS_FLUSH,
- &nInfo,
- &nSrcCvtBytes );
-
- rtl_destroyUnicodeToTextConverter( hConv );
-
- delete[] pUniCode;
-
- return pUtf8;
-};
-
diff --git a/sax/inc/sax/tools/converter.hxx b/sax/inc/sax/tools/converter.hxx
index 1e783b4a4ec9..4b65c1dc83b2 100644
--- a/sax/inc/sax/tools/converter.hxx
+++ b/sax/inc/sax/tools/converter.hxx
@@ -32,6 +32,7 @@
#include <sal/types.h>
+#include <com/sun/star/uno/Sequence.h>
#include <com/sun/star/util/MeasureUnit.hpp>
diff --git a/sax/prj/build.lst b/sax/prj/build.lst
index e3f70c484610..653d77ce9e25 100644
--- a/sax/prj/build.lst
+++ b/sax/prj/build.lst
@@ -3,3 +3,4 @@ ax sax usr1 - all ax_mkout NULL
ax sax\source\expatwrap nmake - all ax_expatwrap NULL
ax sax\source\tools nmake - all ax_tools NULL
ax sax\source\fastparser nmake - all ax_fastparser ax_expatwrap ax_tools NULL
+ax sax\qa\cppunit nmake - all ax_qa_cppunit ax_tools NULL
diff --git a/sax/qa/cppunit/makefile.mk b/sax/qa/cppunit/makefile.mk
new file mode 100644
index 000000000000..e06eca25a737
--- /dev/null
+++ b/sax/qa/cppunit/makefile.mk
@@ -0,0 +1,71 @@
+#*************************************************************************
+#
+# 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=sax
+TARGET=qa_cppunit
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+CFLAGSCXX += $(CPPUNIT_CFLAGS)
+DLLPRE = # no leading "lib" on .so files
+
+# --- Libs ---------------------------------------------------------
+
+SHL1OBJS= \
+ $(SLO)/test_converter.obj \
+
+
+SHL1STDLIBS= \
+ $(SAXLIB) \
+ $(SALLIB) \
+ $(CPPUNITLIB) \
+
+
+SHL1TARGET= test_converter
+SHL1RPATH = NONE
+SHL1IMPLIB= i$(SHL1TARGET)
+# SHL1DEF= $(MISC)/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+# DEF1EXPORTFILE= export.exp
+SHL1VERSIONMAP= version.map
+
+# --- All object files ---------------------------------------------
+
+SLOFILES= \
+ $(SHL1OBJS) \
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+.INCLUDE : _cppunit.mk
+
diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx
new file mode 100644
index 000000000000..1ea781afff95
--- /dev/null
+++ b/sax/qa/cppunit/test_converter.cxx
@@ -0,0 +1,244 @@
+/*************************************************************************
+ *
+ * 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 <cppunit/TestAssert.h>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+
+#include <rtl/ustrbuf.hxx>
+
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/Duration.hpp>
+
+#include "sax/tools/converter.hxx"
+
+
+using namespace ::com::sun::star;
+using sax::Converter;
+
+
+namespace {
+
+class ConverterTest
+ : public ::CppUnit::TestFixture
+{
+public:
+ virtual void setUp();
+ virtual void tearDown();
+
+ void testDuration();
+ void testDateTime();
+
+ CPPUNIT_TEST_SUITE(ConverterTest);
+ CPPUNIT_TEST(testDuration);
+ CPPUNIT_TEST(testDateTime);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+};
+
+void ConverterTest::setUp()
+{
+}
+
+void ConverterTest::tearDown()
+{
+}
+
+static bool eqDuration(util::Duration a, util::Duration b) {
+ return a.Years == b.Years && a.Months == b.Months && a.Days == b.Days
+ && a.Hours == b.Hours && a.Minutes == b.Minutes
+ && a.Seconds == b.Seconds
+ && a.MilliSeconds == b.MilliSeconds
+ && a.Negative == b.Negative;
+}
+
+static void doTest(util::Duration const & rid, char const*const pis,
+ char const*const i_pos = 0)
+{
+ char const*const pos((i_pos) ? i_pos : pis);
+ util::Duration od;
+ ::rtl::OUString is(::rtl::OUString::createFromAscii(pis));
+ bool bSuccess = Converter::convertDuration(od, is);
+ OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dm",
+ od.Negative, od.Years, od.Months, od.Days,
+ od.Hours, od.Minutes, od.Seconds, od.MilliSeconds);
+ CPPUNIT_ASSERT(bSuccess);
+ CPPUNIT_ASSERT(eqDuration(rid, od));
+ ::rtl::OUStringBuffer buf;
+ Converter::convertDuration(buf, od);
+ OSL_TRACE(
+ ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8));
+ CPPUNIT_ASSERT(buf.makeStringAndClear().equalsAscii(pos));
+}
+
+static void doTestDurationF(char const*const pis)
+{
+ util::Duration od;
+ bool bSuccess = Converter::convertDuration(od,
+ ::rtl::OUString::createFromAscii(pis));
+ OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dH",
+ od.Negative, od.Years, od.Months, od.Days,
+ od.Hours, od.Minutes, od.Seconds, od.MilliSeconds);
+ CPPUNIT_ASSERT(!bSuccess);
+}
+
+void ConverterTest::testDuration()
+{
+ OSL_TRACE("\nSAX CONVERTER TEST BEGIN\n");
+ doTest( util::Duration(false, 1, 0, 0, 0, 0, 0, 0), "P1Y" );
+ doTest( util::Duration(false, 0, 42, 0, 0, 0, 0, 0), "P42M" );
+ doTest( util::Duration(false, 0, 0, 111, 0, 0, 0, 0), "P111D" );
+ doTest( util::Duration(false, 0, 0, 0, 52, 0, 0, 0), "PT52H" );
+ doTest( util::Duration(false, 0, 0, 0, 0, 717, 0, 0), "PT717M" );
+ doTest( util::Duration(false, 0, 0, 0, 0, 0, 121, 0), "PT121S" );
+ doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 190), "PT0.19S" );
+ doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 90), "PT0.09S" );
+ doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 9), "PT0.009S" );
+ doTest( util::Duration(false, 0, 0, 0, 0, 0, 9, 999),
+ "PT9.999999999999999999999999999999S", "PT9.999S" );
+ doTest( util::Duration(true , 0, 0, 9999, 0, 0, 0, 0), "-P9999D" );
+ doTest( util::Duration(true , 7, 6, 5, 4, 3, 2, 10),
+ "-P7Y6M5DT4H3M2.01S" );
+ doTest( util::Duration(false, 0, 6, 0, 0, 3, 0, 0), "P6MT3M" );
+ doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 0), "P0D" );
+ doTestDurationF("1Y1M"); // invalid: no ^P
+ doTestDurationF("P-1Y1M"); // invalid: - after P
+ doTestDurationF("P1M1Y"); // invalid: Y after M
+ doTestDurationF("PT1Y"); // invalid: Y after T
+ doTestDurationF("P1Y1M1M"); // invalid: M twice, no T
+ doTestDurationF("P1YT1MT1M"); // invalid: T twice
+ doTestDurationF("P1YT"); // invalid: T but no H,M,S
+ doTestDurationF("P99999999999Y"); // cannot parse so many Ys
+ doTestDurationF("PT.1S"); // invalid: no 0 preceding .
+ doTestDurationF("PT5M.134S"); // invalid: no 0 preceding .
+ doTestDurationF("PT1.S"); // invalid: no digit following .
+ OSL_TRACE("\nSAX CONVERTER TEST END\n");
+}
+
+
+static bool eqDateTime(util::DateTime a, util::DateTime b) {
+ return a.Year == b.Year && a.Month == b.Month && a.Day == b.Day
+ && a.Hours == b.Hours && a.Minutes == b.Minutes
+ && a.Seconds == b.Seconds
+ && a.HundredthSeconds == b.HundredthSeconds;
+}
+
+static void doTest(util::DateTime const & rdt, char const*const pis,
+ char const*const i_pos = 0)
+{
+ char const*const pos((i_pos) ? i_pos : pis);
+ ::rtl::OUString is(::rtl::OUString::createFromAscii(pis));
+ util::DateTime odt;
+ bool bSuccess( Converter::convertDateTime(odt, is) );
+ OSL_TRACE("Y:%d M:%d D:%d H:%d M:%d S:%d H:%d",
+ odt.Year, odt.Month, odt.Day,
+ odt.Hours, odt.Minutes, odt.Seconds, odt.HundredthSeconds);
+ CPPUNIT_ASSERT(bSuccess);
+ CPPUNIT_ASSERT(eqDateTime(rdt, odt));
+ ::rtl::OUStringBuffer buf;
+ Converter::convertDateTime(buf, odt, true);
+ OSL_TRACE(
+ ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8));
+ CPPUNIT_ASSERT(buf.makeStringAndClear().equalsAscii(pos));
+}
+
+static void doTestDateTimeF(char const*const pis)
+{
+ util::DateTime odt;
+ bool bSuccess = Converter::convertDateTime(odt,
+ ::rtl::OUString::createFromAscii(pis));
+ OSL_TRACE("Y:%d M:%d D:%d H:%dH M:%d S:%d H:%d",
+ odt.Year, odt.Month, odt.Day,
+ odt.Hours, odt.Minutes, odt.Seconds, odt.HundredthSeconds);
+ CPPUNIT_ASSERT(!bSuccess);
+}
+
+void ConverterTest::testDateTime()
+{
+ OSL_TRACE("\nSAX CONVERTER TEST BEGIN\n");
+ doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), "0001-01-01T00:00:00" );
+ doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1),
+ "0001-01-01T00:00:00Z", "0001-01-01T00:00:00" );
+// doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1), "-0001-01-01T00:00:00" );
+// doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1), "-0001-01-01T00:00:00Z" );
+ doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1),
+ "0001-01-01T00:00:00-00:00", "0001-01-01T00:00:00" );
+ doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1),
+ "0001-01-01T00:00:00+00:00", "0001-01-01T00:00:00" );
+ doTest( util::DateTime(0, 0, 0, 0, 2, 1, 1)/*(0, 0, 12, 0, 2, 1, 1)*/,
+ "0001-01-02T00:00:00-12:00", "0001-01-02T00:00:00" );
+// "0001-02-01T12:00:00" );
+ doTest( util::DateTime(0, 0, 0, 0, 2, 1, 1)/*(0, 0, 12, 0, 1, 1, 1)*/,
+ "0001-01-02T00:00:00+12:00", "0001-01-02T00:00:00" );
+// "0001-01-01T12:00:00" );
+ doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999),
+ "9999-12-31T23:59:59.99" );
+ doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999),
+ "9999-12-31T23:59:59.99Z", "9999-12-31T23:59:59.99" );
+ doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999),
+ "9999-12-31T23:59:59.9999999999999999999999999999999999999",
+ "9999-12-31T23:59:59.99" );
+ doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999),
+ "9999-12-31T23:59:59.9999999999999999999999999999999999999Z",
+ "9999-12-31T23:59:59.99" );
+ doTest( util::DateTime(0, 0, 0, 24, 1, 1, 333)
+ /*(0, 0, 0, 0, 2, 1, 333)*/,
+ "0333-01-01T24:00:00"/*, "0333-01-02T00:00:00"*/ );
+ doTestDateTimeF( "+0001-01-01T00:00:00" ); // invalid: ^+
+ doTestDateTimeF( "1-01-01T00:00:00" ); // invalid: < 4 Y
+ doTestDateTimeF( "0001-1-01T00:00:00" ); // invalid: < 2 M
+ doTestDateTimeF( "0001-01-1T00:00:00" ); // invalid: < 2 D
+ doTestDateTimeF( "0001-01-01T0:00:00" ); // invalid: < 2 H
+ doTestDateTimeF( "0001-01-01T00:0:00" ); // invalid: < 2 M
+ doTestDateTimeF( "0001-01-01T00:00:0" ); // invalid: < 2 S
+ doTestDateTimeF( "0001-01-01T00:00:00." ); // invalid: .$
+ doTestDateTimeF( "0001-01-01T00:00:00+1:00" ); // invalid: < 2 TZ H
+ doTestDateTimeF( "0001-01-01T00:00:00+00:1" ); // invalid: < 2 TZ M
+ doTestDateTimeF( "0001-13-01T00:00:00" ); // invalid: M > 12
+ doTestDateTimeF( "0001-01-32T00:00:00" ); // invalid: D > 31
+ doTestDateTimeF( "0001-01-01T25:00:00" ); // invalid: H > 24
+ doTestDateTimeF( "0001-01-01T00:60:00" ); // invalid: H > 59
+ doTestDateTimeF( "0001-01-01T00:00:60" ); // invalid: S > 59
+ doTestDateTimeF( "0001-01-01T24:01:00" ); // invalid: H=24, but M != 0
+ doTestDateTimeF( "0001-01-01T24:00:01" ); // invalid: H=24, but S != 0
+ doTestDateTimeF( "0001-01-01T24:00:00.1" ); // invalid: H=24, but H != 0
+ doTestDateTimeF( "0001-01-02T00:00:00+15:00" ); // invalid: TZ > +14:00
+ doTestDateTimeF( "0001-01-02T00:00:00+14:01" ); // invalid: TZ > +14:00
+ doTestDateTimeF( "0001-01-02T00:00:00-15:00" ); // invalid: TZ < -14:00
+ doTestDateTimeF( "0001-01-02T00:00:00-14:01" ); // invalid: TZ < -14:00
+ OSL_TRACE("\nSAX CONVERTER TEST END\n");
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ConverterTest);
+
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
diff --git a/sax/qa/cppunit/version.map b/sax/qa/cppunit/version.map
new file mode 100644
index 000000000000..3308588ef6f8
--- /dev/null
+++ b/sax/qa/cppunit/version.map
@@ -0,0 +1,34 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+UDK_3_0_0 {
+ global:
+ cppunitTestPlugIn;
+
+ local:
+ *;
+};
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 84941bee8e37..1a4cc9278e1e 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -31,6 +31,7 @@
#include <boost/scoped_ptr.hpp>
#include <osl/diagnose.h>
+#include <rtl/ustrbuf.hxx>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/xml/sax/XFastContextHandler.hpp>
@@ -41,8 +42,9 @@
#include <string.h>
-using ::rtl::OUString;
using ::rtl::OString;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
using namespace ::std;
using namespace ::osl;
using namespace ::cppu;
@@ -51,8 +53,8 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::xml::sax;
//using namespace ::com::sun::star::util;
using namespace ::com::sun::star::io;
-namespace sax_fastparser
-{
+
+namespace sax_fastparser {
// --------------------------------------------------------------------
@@ -111,30 +113,35 @@ private:
// the implementation part
//---------------------------------------------
-extern "C"
+extern "C" {
+
+static void call_callbackStartElement(void *userData, const XML_Char *name , const XML_Char **atts)
{
- static void call_callbackStartElement(void *userData, const XML_Char *name , const XML_Char **atts)
- {
- FastSaxParser::callbackStartElement(userData,name,atts);
- }
- static void call_callbackEndElement(void *userData, const XML_Char *name)
- {
- FastSaxParser::callbackEndElement(userData,name);
- }
- static void call_callbackCharacters( void *userData , const XML_Char *s , int nLen )
- {
- FastSaxParser::callbackCharacters(userData,s,nLen);
- }
- static int call_callbackExternalEntityRef(XML_Parser parser,
- const XML_Char *openEntityNames,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId)
- {
- return FastSaxParser::callbackExternalEntityRef(parser,openEntityNames,base,systemId,publicId);
- }
+ FastSaxParser* pFastParser = reinterpret_cast< FastSaxParser* >( userData );
+ pFastParser->callbackStartElement( name, atts );
+}
+
+static void call_callbackEndElement(void *userData, const XML_Char *name)
+{
+ FastSaxParser* pFastParser = reinterpret_cast< FastSaxParser* >( userData );
+ pFastParser->callbackEndElement( name );
+}
+
+static void call_callbackCharacters( void *userData , const XML_Char *s , int nLen )
+{
+ FastSaxParser* pFastParser = reinterpret_cast< FastSaxParser* >( userData );
+ pFastParser->callbackCharacters( s, nLen );
}
+static int call_callbackExternalEntityRef( XML_Parser parser,
+ const XML_Char *openEntityNames, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId )
+{
+ FastSaxParser* pFastParser = reinterpret_cast< FastSaxParser* >( XML_GetUserData( parser ) );
+ return pFastParser->callbackExternalEntityRef( parser, openEntityNames, base, systemId, publicId );
+}
+
+} // extern "C"
+
// --------------------------------------------------------------------
// FastLocatorImpl implementation
// --------------------------------------------------------------------
@@ -169,18 +176,36 @@ OUString SAL_CALL FastLocatorImpl::getSystemId(void) throw (RuntimeException)
}
// --------------------------------------------------------------------
-// FastSaxParser implementation
-// --------------------------------------------------------------------
-FastSaxParser::FastSaxParser( )
+ParserData::ParserData()
{
- mxDocumentLocator.set( new FastLocatorImpl( this ) );
+}
+ParserData::~ParserData()
+{
+}
+
+// --------------------------------------------------------------------
+
+Entity::Entity( const ParserData& rData ) :
+ ParserData( rData )
+{
// performance-Improvment. Reference is needed when calling the startTag callback.
// Handing out the same object with every call is allowed (see sax-specification)
mxAttributes.set( new FastAttributeList( mxTokenHandler ) );
+}
- mbExceptionWasThrown = sal_False;
+Entity::~Entity()
+{
+}
+
+// --------------------------------------------------------------------
+// FastSaxParser implementation
+// --------------------------------------------------------------------
+
+FastSaxParser::FastSaxParser()
+{
+ mxDocumentLocator.set( new FastLocatorImpl( this ) );
}
// --------------------------------------------------------------------
@@ -195,46 +220,43 @@ FastSaxParser::~FastSaxParser()
void FastSaxParser::pushContext()
{
- bool bRootContext = false;
- SaxContextImplPtr p;
- if( maContextStack.empty() )
+ Entity& rEntity = getEntity();
+ if( rEntity.maContextStack.empty() )
{
- p.reset( new SaxContextImpl() );
- bRootContext = true;
+ rEntity.maContextStack.push( SaxContextImplPtr( new SaxContextImpl ) );
+ DefineNamespace( OString("xml"), "http://www.w3.org/XML/1998/namespace");
}
else
{
- p.reset( new SaxContextImpl( maContextStack.top() ) );
+ rEntity.maContextStack.push( SaxContextImplPtr( new SaxContextImpl( rEntity.maContextStack.top() ) ) );
}
- maContextStack.push( p );
-
- if( bRootContext )
- DefineNamespace( OString("xml"), "http://www.w3.org/XML/1998/namespace");
}
// --------------------------------------------------------------------
void FastSaxParser::popContext()
{
- OSL_ENSURE( !maContextStack.empty(), "sax::FastSaxParser::popContext(), pop without push?" );
- if( !maContextStack.empty() )
- maContextStack.pop();
+ Entity& rEntity = getEntity();
+ OSL_ENSURE( !rEntity.maContextStack.empty(), "sax::FastSaxParser::popContext(), pop without push?" );
+ if( !rEntity.maContextStack.empty() )
+ rEntity.maContextStack.pop();
}
// --------------------------------------------------------------------
void FastSaxParser::DefineNamespace( const OString& rPrefix, const sal_Char* pNamespaceURL )
{
- OSL_ENSURE( !maContextStack.empty(), "sax::FastSaxParser::DefineNamespace(), I need a context!" );
- if( !maContextStack.empty() )
+ Entity& rEntity = getEntity();
+ OSL_ENSURE( !rEntity.maContextStack.empty(), "sax::FastSaxParser::DefineNamespace(), I need a context!" );
+ if( !rEntity.maContextStack.empty() )
{
- sal_uInt32 nOffset = maContextStack.top()->mnNamespaceCount++;
+ sal_uInt32 nOffset = rEntity.maContextStack.top()->mnNamespaceCount++;
- if( maNamespaceDefines.size() <= nOffset )
- maNamespaceDefines.resize( maNamespaceDefines.size() + 64 );
+ if( rEntity.maNamespaceDefines.size() <= nOffset )
+ rEntity.maNamespaceDefines.resize( rEntity.maNamespaceDefines.size() + 64 );
const OUString aNamespaceURL( pNamespaceURL, strlen( pNamespaceURL ), RTL_TEXTENCODING_UTF8 );
- maNamespaceDefines[nOffset].reset( new NamespaceDefine( rPrefix, GetNamespaceToken( aNamespaceURL ), aNamespaceURL ) );
+ rEntity.maNamespaceDefines[nOffset].reset( new NamespaceDefine( rPrefix, GetNamespaceToken( aNamespaceURL ), aNamespaceURL ) );
}
}
@@ -244,7 +266,7 @@ sal_Int32 FastSaxParser::GetToken( const OString& rToken )
{
Sequence< sal_Int8 > aSeq( (sal_Int8*)rToken.getStr(), rToken.getLength() );
- return mxTokenHandler->getTokenFromUTF8( aSeq );
+ return getEntity().mxTokenHandler->getTokenFromUTF8( aSeq );
}
sal_Int32 FastSaxParser::GetToken( const sal_Char* pToken, sal_Int32 nLen /* = 0 */ )
@@ -254,7 +276,7 @@ sal_Int32 FastSaxParser::GetToken( const sal_Char* pToken, sal_Int32 nLen /* = 0
Sequence< sal_Int8 > aSeq( (sal_Int8*)pToken, nLen );
- return mxTokenHandler->getTokenFromUTF8( aSeq );
+ return getEntity().mxTokenHandler->getTokenFromUTF8( aSeq );
}
// --------------------------------------------------------------------
@@ -263,12 +285,13 @@ sal_Int32 FastSaxParser::GetTokenWithPrefix( const OString& rPrefix, const OStri
{
sal_Int32 nNamespaceToken = FastToken::DONTKNOW;
- sal_uInt32 nNamespace = maContextStack.top()->mnNamespaceCount;
+ Entity& rEntity = getEntity();
+ sal_uInt32 nNamespace = rEntity.maContextStack.top()->mnNamespaceCount;
while( nNamespace-- )
{
- if( maNamespaceDefines[nNamespace]->maPrefix == rPrefix )
+ if( rEntity.maNamespaceDefines[nNamespace]->maPrefix == rPrefix )
{
- nNamespaceToken = maNamespaceDefines[nNamespace]->mnToken;
+ nNamespaceToken = rEntity.maNamespaceDefines[nNamespace]->mnToken;
break;
}
@@ -290,14 +313,15 @@ sal_Int32 FastSaxParser::GetTokenWithPrefix( const sal_Char*pPrefix, int nPrefix
{
sal_Int32 nNamespaceToken = FastToken::DONTKNOW;
- sal_uInt32 nNamespace = maContextStack.top()->mnNamespaceCount;
+ Entity& rEntity = getEntity();
+ sal_uInt32 nNamespace = rEntity.maContextStack.top()->mnNamespaceCount;
while( nNamespace-- )
{
- const OString& rPrefix( maNamespaceDefines[nNamespace]->maPrefix );
+ const OString& rPrefix( rEntity.maNamespaceDefines[nNamespace]->maPrefix );
if( (rPrefix.getLength() == nPrefixLen) &&
(strncmp( rPrefix.getStr(), pPrefix, nPrefixLen ) == 0 ) )
{
- nNamespaceToken = maNamespaceDefines[nNamespace]->mnToken;
+ nNamespaceToken = rEntity.maNamespaceDefines[nNamespace]->mnToken;
break;
}
@@ -330,12 +354,13 @@ sal_Int32 FastSaxParser::GetNamespaceToken( const OUString& rNamespaceURL )
OUString FastSaxParser::GetNamespaceURL( const OString& rPrefix ) throw (SAXException)
{
- if( !maContextStack.empty() )
+ Entity& rEntity = getEntity();
+ if( !rEntity.maContextStack.empty() )
{
- sal_uInt32 nNamespace = maContextStack.top()->mnNamespaceCount;
+ sal_uInt32 nNamespace = rEntity.maContextStack.top()->mnNamespaceCount;
while( nNamespace-- )
- if( maNamespaceDefines[nNamespace]->maPrefix == rPrefix )
- return maNamespaceDefines[nNamespace]->maNamespaceURL;
+ if( rEntity.maNamespaceDefines[nNamespace]->maPrefix == rPrefix )
+ return rEntity.maNamespaceDefines[nNamespace]->maNamespaceURL;
}
throw SAXException(); // prefix that has no defined namespace url
@@ -343,16 +368,17 @@ OUString FastSaxParser::GetNamespaceURL( const OString& rPrefix ) throw (SAXExce
OUString FastSaxParser::GetNamespaceURL( const sal_Char*pPrefix, int nPrefixLen ) throw(SAXException)
{
- if( pPrefix && !maContextStack.empty() )
+ Entity& rEntity = getEntity();
+ if( pPrefix && !rEntity.maContextStack.empty() )
{
- sal_uInt32 nNamespace = maContextStack.top()->mnNamespaceCount;
+ sal_uInt32 nNamespace = rEntity.maContextStack.top()->mnNamespaceCount;
while( nNamespace-- )
{
- const OString& rPrefix( maNamespaceDefines[nNamespace]->maPrefix );
+ const OString& rPrefix( rEntity.maNamespaceDefines[nNamespace]->maPrefix );
if( (rPrefix.getLength() == nPrefixLen) &&
(strncmp( rPrefix.getStr(), pPrefix, nPrefixLen ) == 0 ) )
{
- return maNamespaceDefines[nNamespace]->maNamespaceURL;
+ return rEntity.maNamespaceDefines[nNamespace]->maNamespaceURL;
}
}
}
@@ -416,54 +442,44 @@ void FastSaxParser::parseStream( const InputSource& maStructSource) throw (SAXEx
// Only one text at one time
MutexGuard guard( maMutex );
- struct Entity entity;
+ Entity entity( maData );
entity.maStructSource = maStructSource;
- if( ! entity.maStructSource.aInputStream.is() )
- {
- throw SAXException( OUString::createFromAscii( "No input source" ), Reference< XInterface > () , Any() );
- }
+ if( !entity.maStructSource.aInputStream.is() )
+ throw SAXException( OUString( RTL_CONSTASCII_USTRINGPARAM( "No input source" ) ), Reference< XInterface >(), Any() );
entity.maConverter.setInputStream( entity.maStructSource.aInputStream );
if( entity.maStructSource.sEncoding.getLength() )
- {
- entity.maConverter.setEncoding( OUStringToOString( entity.maStructSource.sEncoding , RTL_TEXTENCODING_ASCII_US ) );
- }
+ entity.maConverter.setEncoding( OUStringToOString( entity.maStructSource.sEncoding, RTL_TEXTENCODING_ASCII_US ) );
// create parser with proper encoding
entity.mpParser = XML_ParserCreate( 0 );
- if( ! entity.mpParser )
- {
- throw SAXException( OUString::createFromAscii( "Couldn't create parser" ), Reference< XInterface > (), Any() );
- }
+ if( !entity.mpParser )
+ throw SAXException( OUString( RTL_CONSTASCII_USTRINGPARAM( "Couldn't create parser" ) ), Reference< XInterface >(), Any() );
// set all necessary C-Callbacks
- XML_SetUserData( entity.mpParser , this );
- XML_SetElementHandler( entity.mpParser ,
- call_callbackStartElement ,
- call_callbackEndElement );
- XML_SetCharacterDataHandler( entity.mpParser , call_callbackCharacters );
- XML_SetExternalEntityRefHandler( entity.mpParser,
- call_callbackExternalEntityRef);
-
- maSavedException.clear();
+ XML_SetUserData( entity.mpParser, this );
+ XML_SetElementHandler( entity.mpParser, call_callbackStartElement, call_callbackEndElement );
+ XML_SetCharacterDataHandler( entity.mpParser, call_callbackCharacters );
+ XML_SetExternalEntityRefHandler( entity.mpParser, call_callbackExternalEntityRef );
+
pushEntity( entity );
try
{
// start the document
- if( mxDocumentHandler.is() )
+ if( entity.mxDocumentHandler.is() )
{
Reference< XLocator > xLoc( mxDocumentLocator.get() );
- mxDocumentHandler->setDocumentLocator( xLoc );
- mxDocumentHandler->startDocument();
+ entity.mxDocumentHandler->setDocumentLocator( xLoc );
+ entity.mxDocumentHandler->startDocument();
}
parse();
// finish document
- if( mxDocumentHandler.is() )
+ if( entity.mxDocumentHandler.is() )
{
- mxDocumentHandler->endDocument();
+ entity.mxDocumentHandler->endDocument();
}
}
catch( SAXException & )
@@ -491,13 +507,12 @@ void FastSaxParser::parseStream( const InputSource& maStructSource) throw (SAXEx
void FastSaxParser::setFastDocumentHandler( const Reference< XFastDocumentHandler >& Handler ) throw (RuntimeException)
{
- mxDocumentHandler = Handler;
+ maData.mxDocumentHandler = Handler;
}
void SAL_CALL FastSaxParser::setTokenHandler( const Reference< XFastTokenHandler >& Handler ) throw (RuntimeException)
{
- mxTokenHandler = Handler;
- mxAttributes.set( new FastAttributeList( mxTokenHandler ) );
+ maData.mxTokenHandler = Handler;
}
void SAL_CALL FastSaxParser::registerNamespace( const OUString& NamespaceURL, sal_Int32 NamespaceToken ) throw (IllegalArgumentException, RuntimeException)
@@ -515,17 +530,17 @@ void SAL_CALL FastSaxParser::registerNamespace( const OUString& NamespaceURL, sa
void FastSaxParser::setErrorHandler(const Reference< XErrorHandler > & Handler) throw (RuntimeException)
{
- mxErrorHandler = Handler;
+ maData.mxErrorHandler = Handler;
}
void FastSaxParser::setEntityResolver(const Reference < XEntityResolver > & Resolver) throw (RuntimeException)
{
- mxEntityResolver = Resolver;
+ maData.mxEntityResolver = Resolver;
}
void FastSaxParser::setLocale( const Locale & Locale ) throw (RuntimeException)
{
- maLocale = Locale;
+ maData.maLocale = Locale;
}
Sequence< OUString > FastSaxParser::getSupportedServiceNames_Static(void)
@@ -569,139 +584,98 @@ Sequence< OUString > FastSaxParser::getSupportedServiceNames(void) throw (Runtim
* Helper functions and classes
*
*-------------------------------------------*/
-OUString getErrorMessage( XML_Error xmlE, OUString sSystemId , sal_Int32 nLine )
-{
- OUString Message;
- if( XML_ERROR_NONE == xmlE ) {
- Message = OUString::createFromAscii( "No" );
- }
- else if( XML_ERROR_NO_MEMORY == xmlE ) {
- Message = OUString::createFromAscii( "no memory" );
- }
- else if( XML_ERROR_SYNTAX == xmlE ) {
- Message = OUString::createFromAscii( "syntax" );
- }
- else if( XML_ERROR_NO_ELEMENTS == xmlE ) {
- Message = OUString::createFromAscii( "no elements" );
- }
- else if( XML_ERROR_INVALID_TOKEN == xmlE ) {
- Message = OUString::createFromAscii( "invalid token" );
- }
- else if( XML_ERROR_UNCLOSED_TOKEN == xmlE ) {
- Message = OUString::createFromAscii( "unclosed token" );
- }
- else if( XML_ERROR_PARTIAL_CHAR == xmlE ) {
- Message = OUString::createFromAscii( "partial char" );
- }
- else if( XML_ERROR_TAG_MISMATCH == xmlE ) {
- Message = OUString::createFromAscii( "tag mismatch" );
- }
- else if( XML_ERROR_DUPLICATE_ATTRIBUTE == xmlE ) {
- Message = OUString::createFromAscii( "duplicate attribute" );
- }
- else if( XML_ERROR_JUNK_AFTER_DOC_ELEMENT == xmlE ) {
- Message = OUString::createFromAscii( "junk after doc element" );
- }
- else if( XML_ERROR_PARAM_ENTITY_REF == xmlE ) {
- Message = OUString::createFromAscii( "parameter entity reference" );
- }
- else if( XML_ERROR_UNDEFINED_ENTITY == xmlE ) {
- Message = OUString::createFromAscii( "undefined entity" );
- }
- else if( XML_ERROR_RECURSIVE_ENTITY_REF == xmlE ) {
- Message = OUString::createFromAscii( "recursive entity reference" );
- }
- else if( XML_ERROR_ASYNC_ENTITY == xmlE ) {
- Message = OUString::createFromAscii( "async entity" );
- }
- else if( XML_ERROR_BAD_CHAR_REF == xmlE ) {
- Message = OUString::createFromAscii( "bad char reference" );
- }
- else if( XML_ERROR_BINARY_ENTITY_REF == xmlE ) {
- Message = OUString::createFromAscii( "binary entity reference" );
- }
- else if( XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF == xmlE ) {
- Message = OUString::createFromAscii( "attribute external entity reference" );
- }
- else if( XML_ERROR_MISPLACED_XML_PI == xmlE ) {
- Message = OUString::createFromAscii( "misplaced xml processing instruction" );
- }
- else if( XML_ERROR_UNKNOWN_ENCODING == xmlE ) {
- Message = OUString::createFromAscii( "unknown encoding" );
- }
- else if( XML_ERROR_INCORRECT_ENCODING == xmlE ) {
- Message = OUString::createFromAscii( "incorrect encoding" );
- }
- else if( XML_ERROR_UNCLOSED_CDATA_SECTION == xmlE ) {
- Message = OUString::createFromAscii( "unclosed cdata section" );
- }
- else if( XML_ERROR_EXTERNAL_ENTITY_HANDLING == xmlE ) {
- Message = OUString::createFromAscii( "external entity reference" );
- }
- else if( XML_ERROR_NOT_STANDALONE == xmlE ) {
- Message = OUString::createFromAscii( "not standalone" );
- }
- OUString str = OUString::createFromAscii( "[" );
- str += sSystemId;
- str += OUString::createFromAscii( " line " );
- str += OUString::valueOf( nLine );
- str += OUString::createFromAscii( "]: " );
- str += Message;
- str += OUString::createFromAscii( "error" );
+namespace {
- return str;
+OUString lclGetErrorMessage( XML_Error xmlE, const OUString& sSystemId, sal_Int32 nLine )
+{
+ const sal_Char* pMessage = "";
+ switch( xmlE )
+ {
+ case XML_ERROR_NONE: pMessage = "No"; break;
+ case XML_ERROR_NO_MEMORY: pMessage = "no memory"; break;
+ case XML_ERROR_SYNTAX: pMessage = "syntax"; break;
+ case XML_ERROR_NO_ELEMENTS: pMessage = "no elements"; break;
+ case XML_ERROR_INVALID_TOKEN: pMessage = "invalid token"; break;
+ case XML_ERROR_UNCLOSED_TOKEN: pMessage = "unclosed token"; break;
+ case XML_ERROR_PARTIAL_CHAR: pMessage = "partial char"; break;
+ case XML_ERROR_TAG_MISMATCH: pMessage = "tag mismatch"; break;
+ case XML_ERROR_DUPLICATE_ATTRIBUTE: pMessage = "duplicate attribute"; break;
+ case XML_ERROR_JUNK_AFTER_DOC_ELEMENT: pMessage = "junk after doc element"; break;
+ case XML_ERROR_PARAM_ENTITY_REF: pMessage = "parameter entity reference"; break;
+ case XML_ERROR_UNDEFINED_ENTITY: pMessage = "undefined entity"; break;
+ case XML_ERROR_RECURSIVE_ENTITY_REF: pMessage = "recursive entity reference"; break;
+ case XML_ERROR_ASYNC_ENTITY: pMessage = "async entity"; break;
+ case XML_ERROR_BAD_CHAR_REF: pMessage = "bad char reference"; break;
+ case XML_ERROR_BINARY_ENTITY_REF: pMessage = "binary entity reference"; break;
+ case XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF: pMessage = "attribute external entity reference"; break;
+ case XML_ERROR_MISPLACED_XML_PI: pMessage = "misplaced xml processing instruction"; break;
+ case XML_ERROR_UNKNOWN_ENCODING: pMessage = "unknown encoding"; break;
+ case XML_ERROR_INCORRECT_ENCODING: pMessage = "incorrect encoding"; break;
+ case XML_ERROR_UNCLOSED_CDATA_SECTION: pMessage = "unclosed cdata section"; break;
+ case XML_ERROR_EXTERNAL_ENTITY_HANDLING: pMessage = "external entity reference"; break;
+ case XML_ERROR_NOT_STANDALONE: pMessage = "not standalone"; break;
+ default:;
+ }
+
+ OUStringBuffer aBuffer( sal_Unicode( '[' ) );
+ aBuffer.append( sSystemId );
+ aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( " line " ) );
+ aBuffer.append( nLine );
+ aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "]: " ) );
+ aBuffer.appendAscii( pMessage );
+ aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( " error" ) );
+ return aBuffer.makeStringAndClear();
}
+} // namespace
// starts parsing with actual parser !
-void FastSaxParser::parse( )
+void FastSaxParser::parse()
{
- const int nBufSize = 16*1024;
+ const int BUFFER_SIZE = 16 * 1024;
+ Sequence< sal_Int8 > seqOut( BUFFER_SIZE );
- int nRead = nBufSize;
- Sequence< sal_Int8 > seqOut(nBufSize);
-
- while( nRead )
+ Entity& rEntity = getEntity();
+ int nRead = 0;
+ do
{
- nRead = getEntity().maConverter.readAndConvert( seqOut, nBufSize );
-
- if( ! nRead )
+ nRead = rEntity.maConverter.readAndConvert( seqOut, BUFFER_SIZE );
+ if( nRead <= 0 )
{
- XML_Parse( getEntity().mpParser, ( const char * ) seqOut.getArray(), 0 , 1 );
+ XML_Parse( rEntity.mpParser, (const char*) seqOut.getConstArray(), 0, 1 );
break;
}
- sal_Bool bContinue = ( XML_Parse( getEntity().mpParser, (const char *) seqOut.getArray(), nRead, 0 ) != 0 );
-
- if( !bContinue || mbExceptionWasThrown )
+ bool bContinue = XML_Parse( rEntity.mpParser, (const char*) seqOut.getConstArray(), nRead, 0 ) != 0;
+ // callbacks used inside XML_Parse may have caught an exception
+ if( !bContinue || rEntity.maSavedException.hasValue() )
{
// Error during parsing !
- XML_Error xmlE = XML_GetErrorCode( getEntity().mpParser );
+ XML_Error xmlE = XML_GetErrorCode( rEntity.mpParser );
OUString sSystemId = mxDocumentLocator->getSystemId();
sal_Int32 nLine = mxDocumentLocator->getLineNumber();
SAXParseException aExcept(
- getErrorMessage(xmlE , sSystemId, nLine) ,
+ lclGetErrorMessage( xmlE, sSystemId, nLine ),
Reference< XInterface >(),
- Any( &maSavedException , getCppuType( &maSavedException) ),
+ Any( &rEntity.maSavedException, getCppuType( &rEntity.maSavedException ) ),
mxDocumentLocator->getPublicId(),
mxDocumentLocator->getSystemId(),
mxDocumentLocator->getLineNumber(),
mxDocumentLocator->getColumnNumber()
- );
+ );
- if( mxErrorHandler.is() )
- {
- // error handler is set, so the handler may throw the maSavedException
- mxErrorHandler->fatalError( Any( aExcept ) );
- }
+ // error handler is set, it may throw the exception
+ if( rEntity.mxErrorHandler.is() )
+ rEntity.mxErrorHandler->fatalError( Any( aExcept ) );
- // Error handler has not thrown an maSavedException, but parsing cannot go on,
- // so an maSavedException MUST be thrown.
+ // error handler has not thrown, but parsing cannot go on, the
+ // exception MUST be thrown
throw aExcept;
}
}
+ while( nRead > 0 );
}
//------------------------------------------
@@ -721,25 +695,24 @@ struct AttributeData
} // namespace
-void FastSaxParser::callbackStartElement( void *pvThis, const XML_Char *pwName, const XML_Char **awAttributes )
+void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char** awAttributes )
{
- FastSaxParser *pThis = (FastSaxParser*)pvThis;
-
Reference< XFastContextHandler > xParentContext;
- if( !pThis->maContextStack.empty() )
+ Entity& rEntity = getEntity();
+ if( !rEntity.maContextStack.empty() )
{
- xParentContext = pThis->maContextStack.top()->mxContext;
+ xParentContext = rEntity.maContextStack.top()->mxContext;
if( !xParentContext.is() )
{
// we ignore current elements, so no processing needed
- pThis->pushContext();
+ pushContext();
return;
}
}
- pThis->pushContext();
+ pushContext();
- pThis->mxAttributes->clear();
+ rEntity.mxAttributes->clear();
// create attribute map and process namespace instructions
int i = 0;
@@ -747,108 +720,100 @@ void FastSaxParser::callbackStartElement( void *pvThis, const XML_Char *pwName,
const XML_Char *pName;
const XML_Char *pPrefix;
- /* #158414# Each element may define new namespaces, also for attribues.
- First, process all namespace attributes and cache other attributes in a
- vector. Second, process the attributes after namespaces have been
- initialized. */
- ::std::vector< AttributeData > aAttribs;
-
- // #158414# first: get namespaces
- for( ; awAttributes[i]; i += 2 )
+ try
{
- OSL_ASSERT( awAttributes[i+1] );
+ /* #158414# Each element may define new namespaces, also for attribues.
+ First, process all namespace attributes and cache other attributes in a
+ vector. Second, process the attributes after namespaces have been
+ initialized. */
+ ::std::vector< AttributeData > aAttribs;
- pThis->splitName( awAttributes[i], pPrefix, nPrefixLen, pName, nNameLen );
- if( nPrefixLen )
+ // #158414# first: get namespaces
+ for( ; awAttributes[i]; i += 2 )
{
- if( (nPrefixLen == 5) && (strncmp( pPrefix, "xmlns", 5 ) == 0) )
+ OSL_ASSERT( awAttributes[i+1] );
+
+ splitName( awAttributes[i], pPrefix, nPrefixLen, pName, nNameLen );
+ if( nPrefixLen )
{
- pThis->DefineNamespace( OString( pName, nNameLen ), awAttributes[i+1] );
+ if( (nPrefixLen == 5) && (strncmp( pPrefix, "xmlns", 5 ) == 0) )
+ {
+ DefineNamespace( OString( pName, nNameLen ), awAttributes[i+1] );
+ }
+ else
+ {
+ aAttribs.resize( aAttribs.size() + 1 );
+ aAttribs.back().maPrefix = OString( pPrefix, nPrefixLen );
+ aAttribs.back().maName = OString( pName, nNameLen );
+ aAttribs.back().maValue = OString( awAttributes[i+1] );
+ }
}
else
{
- aAttribs.resize( aAttribs.size() + 1 );
- aAttribs.back().maPrefix = OString( pPrefix, nPrefixLen );
- aAttribs.back().maName = OString( pName, nNameLen );
- aAttribs.back().maValue = OString( awAttributes[i+1] );
+ if( (nNameLen == 5) && (strcmp( pName, "xmlns" ) == 0) )
+ {
+ // namespace of the element found
+ rEntity.maContextStack.top()->maNamespace = OUString( awAttributes[i+1], strlen( awAttributes[i+1] ), RTL_TEXTENCODING_UTF8 );
+ }
+ else
+ {
+ aAttribs.resize( aAttribs.size() + 1 );
+ aAttribs.back().maName = OString( pName, nNameLen );
+ aAttribs.back().maValue = OString( awAttributes[i+1] );
+ }
}
}
- else
+
+ // #158414# second: fill attribute list with other attributes
+ for( ::std::vector< AttributeData >::const_iterator aIt = aAttribs.begin(), aEnd = aAttribs.end(); aIt != aEnd; ++aIt )
{
- if( (nNameLen == 5) && (strcmp( pName, "xmlns" ) == 0) )
+ if( aIt->maPrefix.getLength() > 0 )
{
- // namespace of the element found
- pThis->maContextStack.top()->maNamespace = OUString( awAttributes[i+1], strlen( awAttributes[i+1] ), RTL_TEXTENCODING_UTF8 );
+ sal_Int32 nAttributeToken = GetTokenWithPrefix( aIt->maPrefix, aIt->maName );
+ if( nAttributeToken != FastToken::DONTKNOW )
+ rEntity.mxAttributes->add( nAttributeToken, aIt->maValue );
+ else
+ rEntity.mxAttributes->addUnknown( GetNamespaceURL( aIt->maPrefix ), aIt->maName, aIt->maValue );
}
else
{
- aAttribs.resize( aAttribs.size() + 1 );
- aAttribs.back().maName = OString( pName, nNameLen );
- aAttribs.back().maValue = OString( awAttributes[i+1] );
+ sal_Int32 nAttributeToken = GetToken( aIt->maName );
+ if( nAttributeToken != FastToken::DONTKNOW )
+ rEntity.mxAttributes->add( nAttributeToken, aIt->maValue );
+ else
+ rEntity.mxAttributes->addUnknown( aIt->maName, aIt->maValue );
}
}
- }
- // #158414# second: fill attribute list with other attributes
- for( ::std::vector< AttributeData >::const_iterator aIt = aAttribs.begin(), aEnd = aAttribs.end(); aIt != aEnd; ++aIt )
- {
- if( aIt->maPrefix.getLength() )
- {
- const sal_Int32 nAttributeToken = pThis->GetTokenWithPrefix( aIt->maPrefix, aIt->maName );
- if( nAttributeToken != FastToken::DONTKNOW )
- pThis->mxAttributes->add( nAttributeToken, aIt->maValue );
- else
- pThis->mxAttributes->addUnknown( pThis->GetNamespaceURL( aIt->maPrefix ), aIt->maName, aIt->maValue );
- }
+ sal_Int32 nElementToken;
+ splitName( pwName, pPrefix, nPrefixLen, pName, nNameLen );
+ if( nPrefixLen > 0 )
+ nElementToken = GetTokenWithPrefix( pPrefix, nPrefixLen, pName, nNameLen );
+ else if( rEntity.maContextStack.top()->maNamespace.getLength() > 0 )
+ nElementToken = GetTokenWithNamespaceURL( rEntity.maContextStack.top()->maNamespace, pName, nNameLen );
else
- {
- const sal_Int32 nAttributeToken = pThis->GetToken( aIt->maName );
- if( nAttributeToken != FastToken::DONTKNOW )
- pThis->mxAttributes->add( nAttributeToken, aIt->maValue );
- else
- pThis->mxAttributes->addUnknown( aIt->maName, aIt->maValue );
- }
- }
+ nElementToken = GetToken( pName );
+ rEntity.maContextStack.top()->mnElementToken = nElementToken;
- sal_Int32 nElementToken;
- pThis->splitName( pwName, pPrefix, nPrefixLen, pName, nNameLen );
- if( nPrefixLen )
- {
- nElementToken = pThis->GetTokenWithPrefix( pPrefix, nPrefixLen, pName, nNameLen );
- }
- else if( pThis->maContextStack.top()->maNamespace.getLength() )
- {
- nElementToken = pThis->GetTokenWithNamespaceURL( pThis->maContextStack.top()->maNamespace, pName, nNameLen );
- }
- else
- {
- nElementToken = pThis->GetToken( pName );
- }
- pThis->maContextStack.top()->mnElementToken = nElementToken;
-
- try
- {
- Reference< XFastAttributeList > xAttr( pThis->mxAttributes.get() );
+ Reference< XFastAttributeList > xAttr( rEntity.mxAttributes.get() );
Reference< XFastContextHandler > xContext;
if( nElementToken == FastToken::DONTKNOW )
{
- if( nPrefixLen )
- {
- pThis->maContextStack.top()->maNamespace = pThis->GetNamespaceURL( pPrefix, nPrefixLen );
- }
+ if( nPrefixLen > 0 )
+ rEntity.maContextStack.top()->maNamespace = GetNamespaceURL( pPrefix, nPrefixLen );
- const OUString aNamespace( pThis->maContextStack.top()->maNamespace );
+ const OUString aNamespace( rEntity.maContextStack.top()->maNamespace );
const OUString aElementName( pPrefix, nPrefixLen, RTL_TEXTENCODING_UTF8 );
- pThis->maContextStack.top()->maElementName = aElementName;
+ rEntity.maContextStack.top()->maElementName = aElementName;
if( xParentContext.is() )
xContext = xParentContext->createUnknownChildContext( aNamespace, aElementName, xAttr );
else
- xContext = pThis->mxDocumentHandler->createUnknownChildContext( aNamespace, aElementName, xAttr );
+ xContext = rEntity.mxDocumentHandler->createUnknownChildContext( aNamespace, aElementName, xAttr );
if( xContext.is() )
{
- pThis->maContextStack.top()->mxContext = xContext;
+ rEntity.maContextStack.top()->mxContext = xContext;
xContext->startUnknownElement( aNamespace, aElementName, xAttr );
}
}
@@ -857,147 +822,132 @@ void FastSaxParser::callbackStartElement( void *pvThis, const XML_Char *pwName,
if( xParentContext.is() )
xContext = xParentContext->createFastChildContext( nElementToken, xAttr );
else
- xContext = pThis->mxDocumentHandler->createFastChildContext( nElementToken, xAttr );
+ xContext = rEntity.mxDocumentHandler->createFastChildContext( nElementToken, xAttr );
if( xContext.is() )
{
- pThis->maContextStack.top()->mxContext = xContext;
+ rEntity.maContextStack.top()->mxContext = xContext;
xContext->startFastElement( nElementToken, xAttr );
}
}
}
catch( Exception& e )
{
- pThis->maSavedException <<= e;
+ rEntity.maSavedException <<= e;
}
}
-void FastSaxParser::callbackEndElement( void *pvThis , const XML_Char * )
+void FastSaxParser::callbackEndElement( const XML_Char* )
{
- FastSaxParser *pThis = (FastSaxParser*)pvThis;
-
- if( !pThis->maContextStack.empty() )
+ Entity& rEntity = getEntity();
+ OSL_ENSURE( !rEntity.maContextStack.empty(), "FastSaxParser::callbackEndElement - no context" );
+ if( !rEntity.maContextStack.empty() )
{
- SaxContextImplPtr pContext( pThis->maContextStack.top() );
+ SaxContextImplPtr pContext = rEntity.maContextStack.top();
const Reference< XFastContextHandler >& xContext( pContext->mxContext );
if( xContext.is() ) try
{
sal_Int32 nElementToken = pContext->mnElementToken;
if( nElementToken != FastToken::DONTKNOW )
- {
xContext->endFastElement( nElementToken );
- }
else
- {
xContext->endUnknownElement( pContext->maNamespace, pContext->maElementName );
- }
}
catch( Exception& e )
{
- pThis->maSavedException <<= e;
+ rEntity.maSavedException <<= e;
}
- pThis->popContext();
- }
- else
- {
- OSL_ENSURE( false, "no context on sax::FastSaxParser::callbackEndElement() ??? ");
+ popContext();
}
}
-void FastSaxParser::callbackCharacters( void *pvThis , const XML_Char *s , int nLen )
+void FastSaxParser::callbackCharacters( const XML_Char* s, int nLen )
{
- FastSaxParser *pThis = (FastSaxParser*)pvThis;
-
- const Reference< XFastContextHandler >& xContext( pThis->maContextStack.top()->mxContext );
+ Entity& rEntity = getEntity();
+ const Reference< XFastContextHandler >& xContext( rEntity.maContextStack.top()->mxContext );
if( xContext.is() ) try
{
xContext->characters( OUString( s, nLen, RTL_TEXTENCODING_UTF8 ) );
}
catch( Exception& e )
{
- pThis->maSavedException <<= e;
+ rEntity.maSavedException <<= e;
}
}
int FastSaxParser::callbackExternalEntityRef( XML_Parser parser,
- const XML_Char *context,
- const XML_Char * /*base*/,
- const XML_Char *systemId,
- const XML_Char *publicId)
+ const XML_Char *context, const XML_Char * /*base*/, const XML_Char *systemId, const XML_Char *publicId )
{
bool bOK = true;
InputSource source;
- FastSaxParser *pImpl = ((FastSaxParser*)XML_GetUserData( parser ));
- struct Entity entity;
+ Entity& rCurrEntity = getEntity();
+ Entity aNewEntity( rCurrEntity );
- if( pImpl->mxEntityResolver.is() ) {
- try
- {
- entity.maStructSource = pImpl->mxEntityResolver->resolveEntity(
- OUString( publicId, strlen( publicId ), RTL_TEXTENCODING_UTF8 ) ,
- OUString( systemId, strlen( systemId ), RTL_TEXTENCODING_UTF8 ) );
- }
- catch( SAXParseException & e )
- {
- pImpl->maSavedException <<= e;
- bOK = false;
- }
- catch( SAXException & e )
- {
- pImpl->maSavedException <<= SAXParseException(
- e.Message , e.Context , e.WrappedException ,
- pImpl->mxDocumentLocator->getPublicId(),
- pImpl->mxDocumentLocator->getSystemId(),
- pImpl->mxDocumentLocator->getLineNumber(),
- pImpl->mxDocumentLocator->getColumnNumber() );
- bOK = false;
- }
+ if( rCurrEntity.mxEntityResolver.is() ) try
+ {
+ aNewEntity.maStructSource = rCurrEntity.mxEntityResolver->resolveEntity(
+ OUString( publicId, strlen( publicId ), RTL_TEXTENCODING_UTF8 ) ,
+ OUString( systemId, strlen( systemId ), RTL_TEXTENCODING_UTF8 ) );
+ }
+ catch( SAXParseException & e )
+ {
+ rCurrEntity.maSavedException <<= e;
+ bOK = false;
+ }
+ catch( SAXException & e )
+ {
+ rCurrEntity.maSavedException <<= SAXParseException(
+ e.Message, e.Context, e.WrappedException,
+ mxDocumentLocator->getPublicId(),
+ mxDocumentLocator->getSystemId(),
+ mxDocumentLocator->getLineNumber(),
+ mxDocumentLocator->getColumnNumber() );
+ bOK = false;
}
- if( entity.maStructSource.aInputStream.is() )
+ if( aNewEntity.maStructSource.aInputStream.is() )
{
- entity.mpParser = XML_ExternalEntityParserCreate( parser , context, 0 );
- if( ! entity.mpParser )
+ aNewEntity.mpParser = XML_ExternalEntityParserCreate( parser, context, 0 );
+ if( !aNewEntity.mpParser )
{
return false;
}
- entity.maConverter.setInputStream( entity.maStructSource.aInputStream );
- pImpl->pushEntity( entity );
+ aNewEntity.maConverter.setInputStream( aNewEntity.maStructSource.aInputStream );
+ pushEntity( aNewEntity );
try
{
- pImpl->parse();
+ parse();
}
catch( SAXParseException & e )
{
- pImpl->maSavedException <<= e;
+ rCurrEntity.maSavedException <<= e;
bOK = false;
}
catch( IOException &e )
{
SAXException aEx;
aEx.WrappedException <<= e;
- pImpl->maSavedException <<= aEx;
+ rCurrEntity.maSavedException <<= aEx;
bOK = false;
}
catch( RuntimeException &e )
{
SAXException aEx;
aEx.WrappedException <<= e;
- pImpl->maSavedException <<= aEx;
+ rCurrEntity.maSavedException <<= aEx;
bOK = false;
}
- pImpl->popEntity();
-
- XML_ParserFree( entity.mpParser );
+ popEntity();
+ XML_ParserFree( aNewEntity.mpParser );
}
return bOK;
}
-}
+} // namespace sax_fastparser
diff --git a/sax/source/fastparser/fastparser.hxx b/sax/source/fastparser/fastparser.hxx
index 236db124c99e..a0331fe4035a 100644
--- a/sax/source/fastparser/fastparser.hxx
+++ b/sax/source/fastparser/fastparser.hxx
@@ -47,25 +47,51 @@
#define PARSER_IMPLEMENTATION_NAME "com.sun.star.comp.extensions.xml.sax.FastParser"
#define PARSER_SERVICE_NAME "com.sun.star.xml.sax.FastParser"
-namespace sax_fastparser
+namespace sax_fastparser {
+
+class FastLocatorImpl;
+struct NamespaceDefine;
+struct SaxContextImpl;
+
+typedef ::boost::shared_ptr< SaxContextImpl > SaxContextImplPtr;
+typedef ::boost::shared_ptr< NamespaceDefine > NamespaceDefineRef;
+
+typedef ::std::hash_map< ::rtl::OUString, sal_Int32,
+ ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > NamespaceMap;
+
+// --------------------------------------------------------------------
+
+struct ParserData
{
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastDocumentHandler > mxDocumentHandler;
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler > mxTokenHandler;
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XErrorHandler > mxErrorHandler;
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XEntityResolver > mxEntityResolver;
+ ::com::sun::star::lang::Locale maLocale;
- class FastLocatorImpl;
- struct NamespaceDefine;
- struct SaxContextImpl;
- typedef boost::shared_ptr< SaxContextImpl > SaxContextImplPtr;
- typedef ::std::hash_map< ::rtl::OUString, sal_Int32,
- ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString >
- > NamespaceMap;
+ ParserData();
+ ~ParserData();
+};
// --------------------------------------------------------------------
-// Entity binds all information neede for a single file
-struct Entity
+// Entity binds all information needed for a single file
+struct Entity : public ParserData
{
- ::com::sun::star::xml::sax::InputSource maStructSource;
- XML_Parser mpParser;
- sax_expatwrap::XMLFile2UTFConverter maConverter;
+ ::com::sun::star::xml::sax::InputSource maStructSource;
+ XML_Parser mpParser;
+ ::sax_expatwrap::XMLFile2UTFConverter maConverter;
+ ::rtl::Reference< FastAttributeList > mxAttributes;
+
+ // Exceptions cannot be thrown through the C-XmlParser (possible resource leaks),
+ // therefore the exception must be saved somewhere.
+ ::com::sun::star::uno::Any maSavedException;
+
+ ::std::stack< SaxContextImplPtr > maContextStack;
+ ::std::vector< NamespaceDefineRef > maNamespaceDefines;
+
+ explicit Entity( const ParserData& rData );
+ ~Entity();
};
// --------------------------------------------------------------------
@@ -75,7 +101,7 @@ class FastSaxParser : public ::cppu::WeakImplHelper2< ::com::sun::star::xml::sax
{
public:
FastSaxParser();
- ~FastSaxParser();
+ virtual ~FastSaxParser();
// The implementation details
static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void);
@@ -94,17 +120,15 @@ public:
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);
-public:
- // the C-Callbacks for the expat parser
- void static callbackStartElement(void *userData, const XML_Char *name , const XML_Char **atts);
- void static callbackEndElement(void *userData, const XML_Char *name);
- void static callbackCharacters( void *userData , const XML_Char *s , int nLen );
- int static callbackExternalEntityRef( XML_Parser parser, const XML_Char *openEntityNames, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId);
+ // called by the C callbacks of the expat parser
+ void callbackStartElement( const XML_Char* name, const XML_Char** atts );
+ void callbackEndElement( const XML_Char* name );
+ void callbackCharacters( const XML_Char* s, int nLen );
+ int callbackExternalEntityRef( XML_Parser parser, const XML_Char *openEntityNames, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId);
-public:
- void pushEntity( const struct Entity &entity ) { vecEntity.push_back( entity ); }
- void popEntity() { vecEntity.pop_back( ); }
- struct Entity &getEntity() { return vecEntity.back(); }
+ inline void pushEntity( const Entity& rEntity ) { maEntities.push( rEntity ); }
+ inline void popEntity() { maEntities.pop(); }
+ Entity& getEntity() { return maEntities.top(); }
private:
void parse();
@@ -128,27 +152,11 @@ private:
private:
::osl::Mutex maMutex;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastDocumentHandler > mxDocumentHandler;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler > mxTokenHandler;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XErrorHandler > mxErrorHandler;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XEntityResolver > mxEntityResolver;
-
- rtl::Reference < FastLocatorImpl > mxDocumentLocator;
- rtl::Reference < FastAttributeList > mxAttributes;
-
- // External entity stack
- std::vector< struct Entity > vecEntity;
-
- // Exception cannot be thrown through the C-XmlParser (possible resource leaks),
- // therefor the maSavedException must be saved somewhere.
- ::com::sun::star::uno::Any maSavedException;
- sal_Bool mbExceptionWasThrown;
-
- ::com::sun::star::lang::Locale maLocale;
+ ::rtl::Reference< FastLocatorImpl > mxDocumentLocator;
+ NamespaceMap maNamespaceMap;
- std::stack< SaxContextImplPtr > maContextStack;
- std::vector< boost::shared_ptr< NamespaceDefine > > maNamespaceDefines;
- NamespaceMap maNamespaceMap;
+ ParserData maData; /// Cached parser configuration for next call of parseStream().
+ ::std::stack< Entity > maEntities; /// Entity stack for each call of parseStream().
};
}
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index 35bfba29c904..5df3044bd6d3 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -1217,78 +1217,6 @@ bool Converter::convertDuration(util::Duration& rDuration,
return bSuccess;
}
-#if 0
-//FIXME
-struct Test {
- static bool eqDuration(util::Duration a, util::Duration b) {
- return a.Years == b.Years && a.Months == b.Months && a.Days == b.Days
- && a.Hours == b.Hours && a.Minutes == b.Minutes
- && a.Seconds == b.Seconds
- && a.MilliSeconds == b.MilliSeconds
- && a.Negative == b.Negative;
- }
- static void doTest(util::Duration const & rid, char const*const pis,
- char const*const i_pos = 0)
- {
- char const*const pos((i_pos) ? i_pos : pis);
- util::Duration od;
- ::rtl::OUString is(::rtl::OUString::createFromAscii(pis));
- bool bSuccess = Converter::convertDuration(od, is);
- OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dm",
- od.Negative, od.Years, od.Months, od.Days,
- od.Hours, od.Minutes, od.Seconds, od.MilliSeconds);
- OSL_ASSERT(bSuccess);
- OSL_ASSERT(eqDuration(rid, od));
- ::rtl::OUStringBuffer buf;
- Converter::convertDuration(buf, od);
- OSL_TRACE(
- ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8));
- OSL_ASSERT(buf.makeStringAndClear().equalsAscii(pos));
- }
- static void doTestF(const char * pis)
- {
- util::Duration od;
- bool bSuccess = Converter::convertDuration(od,
- ::rtl::OUString::createFromAscii(pis));
- OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dH",
- od.Negative, od.Years, od.Months, od.Days,
- od.Hours, od.Minutes, od.Seconds, od.MilliSeconds);
- OSL_ASSERT(!bSuccess);
- }
- Test() {
- OSL_TRACE("\nSAX CONVERTER TEST BEGIN\n");
- doTest( util::Duration(false, 1, 0, 0, 0, 0, 0, 0), "P1Y" );
- doTest( util::Duration(false, 0, 42, 0, 0, 0, 0, 0), "P42M" );
- doTest( util::Duration(false, 0, 0, 111, 0, 0, 0, 0), "P111D" );
- doTest( util::Duration(false, 0, 0, 0, 52, 0, 0, 0), "PT52H" );
- doTest( util::Duration(false, 0, 0, 0, 0, 717, 0, 0), "PT717M" );
- doTest( util::Duration(false, 0, 0, 0, 0, 0, 121, 0), "PT121S" );
- doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 190), "PT0.19S" );
- doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 90), "PT0.09S" );
- doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 9), "PT0.009S" );
- doTest( util::Duration(false, 0, 0, 0, 0, 0, 9, 999),
- "PT9.999999999999999999999999999999S", "PT9.999S" );
- doTest( util::Duration(true , 0, 0, 9999, 0, 0, 0, 0), "-P9999D" );
- doTest( util::Duration(true , 7, 6, 5, 4, 3, 2, 10),
- "-P7Y6M5DT4H3M2.01S" );
- doTest( util::Duration(false, 0, 6, 0, 0, 3, 0, 0), "P6MT3M" );
- doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 0), "P0D" );
- doTestF("1Y1M"); // invalid: no ^P
- doTestF("P-1Y1M"); // invalid: - after P
- doTestF("P1M1Y"); // invalid: Y after M
- doTestF("PT1Y"); // invalid: Y after T
- doTestF("P1Y1M1M"); // invalid: M twice, no T
- doTestF("P1YT1MT1M"); // invalid: T twice
- doTestF("P1YT"); // invalid: T but no H,M,S
- doTestF("P99999999999Y"); // cannot parse so many Ys
- doTestF("PT.1S"); // invalid: no 0 preceding .
- doTestF("PT5M.134S"); // invalid: no 0 preceding .
- doTestF("PT1.S"); // invalid: no digit following .
- OSL_TRACE("\nSAX CONVERTER TEST END\n");
- }
-};
-static Test test;
-#endif
/** convert util::Date to ISO "date" string */
void Converter::convertDate(
@@ -1675,99 +1603,6 @@ bool Converter::convertDateOrDateTime(
return bSuccess;
}
-#if 0
-struct Test {
- static bool eqDateTime(util::DateTime a, util::DateTime b) {
- return a.Year == b.Year && a.Month == b.Month && a.Day == b.Day
- && a.Hours == b.Hours && a.Minutes == b.Minutes
- && a.Seconds == b.Seconds
- && a.HundredthSeconds == b.HundredthSeconds;
- }
- static void doTest(util::DateTime const & rdt, char const*const pis,
- char const*const i_pos = 0)
- {
- char const*const pos((i_pos) ? i_pos : pis);
- ::rtl::OUString is(::rtl::OUString::createFromAscii(pis));
- util::DateTime odt;
- bool bSuccess( Converter::convertDateTime(odt, is) );
- OSL_TRACE("Y:%d M:%d D:%d H:%d M:%d S:%d H:%d",
- odt.Year, odt.Month, odt.Day,
- odt.Hours, odt.Minutes, odt.Seconds, odt.HundredthSeconds);
- OSL_ASSERT(bSuccess);
- OSL_ASSERT(eqDateTime(rdt, odt));
- ::rtl::OUStringBuffer buf;
- Converter::convertDateTime(buf, odt, true);
- OSL_TRACE(
- ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8));
- OSL_ASSERT(buf.makeStringAndClear().equalsAscii(pos));
- }
- static void doTestF(const char * pis)
- {
- util::DateTime odt;
- bool bSuccess = Converter::convertDateTime(odt,
- ::rtl::OUString::createFromAscii(pis));
- OSL_TRACE("Y:%d M:%d D:%d H:%dH M:%d S:%d H:%d",
- odt.Year, odt.Month, odt.Day,
- odt.Hours, odt.Minutes, odt.Seconds, odt.HundredthSeconds);
- OSL_ASSERT(!bSuccess);
- }
- Test() {
- OSL_TRACE("\nSAX CONVERTER TEST BEGIN\n");
- doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), "0001-01-01T00:00:00" );
- doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1),
- "0001-01-01T00:00:00Z", "0001-01-01T00:00:00" );
-// doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1), "-0001-01-01T00:00:00" );
-// doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1), "-0001-01-01T00:00:00Z" );
- doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1),
- "0001-01-01T00:00:00-00:00", "0001-01-01T00:00:00" );
- doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1),
- "0001-01-01T00:00:00+00:00", "0001-01-01T00:00:00" );
- doTest( util::DateTime(0, 0, 0, 0, 2, 1, 1)/*(0, 0, 12, 0, 2, 1, 1)*/,
- "0001-01-02T00:00:00-12:00", "0001-01-02T00:00:00" );
-// "0001-02-01T12:00:00" );
- doTest( util::DateTime(0, 0, 0, 0, 2, 1, 1)/*(0, 0, 12, 0, 1, 1, 1)*/,
- "0001-01-02T00:00:00+12:00", "0001-01-02T00:00:00" );
-// "0001-01-01T12:00:00" );
- doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999),
- "9999-12-31T23:59:59.99" );
- doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999),
- "9999-12-31T23:59:59.99Z", "9999-12-31T23:59:59.99" );
- doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999),
- "9999-12-31T23:59:59.9999999999999999999999999999999999999",
- "9999-12-31T23:59:59.99" );
- doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999),
- "9999-12-31T23:59:59.9999999999999999999999999999999999999Z",
- "9999-12-31T23:59:59.99" );
- doTest( util::DateTime(0, 0, 0, 24, 1, 1, 333)
- /*(0, 0, 0, 0, 2, 1, 333)*/,
- "0333-01-01T24:00:00"/*, "0333-01-02T00:00:00"*/ );
- doTestF( "+0001-01-01T00:00:00" ); // invalid: ^+
- doTestF( "1-01-01T00:00:00" ); // invalid: < 4 Y
- doTestF( "0001-1-01T00:00:00" ); // invalid: < 2 M
- doTestF( "0001-01-1T00:00:00" ); // invalid: < 2 D
- doTestF( "0001-01-01T0:00:00" ); // invalid: < 2 H
- doTestF( "0001-01-01T00:0:00" ); // invalid: < 2 M
- doTestF( "0001-01-01T00:00:0" ); // invalid: < 2 S
- doTestF( "0001-01-01T00:00:00." ); // invalid: .$
- doTestF( "0001-01-01T00:00:00+1:00" ); // invalid: < 2 TZ H
- doTestF( "0001-01-01T00:00:00+00:1" ); // invalid: < 2 TZ M
- doTestF( "0001-13-01T00:00:00" ); // invalid: M > 12
- doTestF( "0001-01-32T00:00:00" ); // invalid: D > 31
- doTestF( "0001-01-01T25:00:00" ); // invalid: H > 24
- doTestF( "0001-01-01T00:60:00" ); // invalid: H > 59
- doTestF( "0001-01-01T00:00:60" ); // invalid: S > 59
- doTestF( "0001-01-01T24:01:00" ); // invalid: H=24, but M != 0
- doTestF( "0001-01-01T24:00:01" ); // invalid: H=24, but S != 0
- doTestF( "0001-01-01T24:00:00.1" ); // invalid: H=24, but H != 0
- doTestF( "0001-01-02T00:00:00+15:00" ); // invalid: TZ > +14:00
- doTestF( "0001-01-02T00:00:00+14:01" ); // invalid: TZ > +14:00
- doTestF( "0001-01-02T00:00:00-15:00" ); // invalid: TZ < -14:00
- doTestF( "0001-01-02T00:00:00-14:01" ); // invalid: TZ < -14:00
- OSL_TRACE("\nSAX CONVERTER TEST END\n");
- }
-};
-static Test test;
-#endif
/** gets the position of the first comma after npos in the string
rStr. Commas inside '"' pairs are not matched */
diff --git a/sot/source/unoolestorage/xolesimplestorage.cxx b/sot/source/unoolestorage/xolesimplestorage.cxx
index 478309330e80..45baf9eed4c5 100644
--- a/sot/source/unoolestorage/xolesimplestorage.cxx
+++ b/sot/source/unoolestorage/xolesimplestorage.cxx
@@ -199,9 +199,9 @@ void OLESimpleStorage::InsertNameAccessToStorage_Impl( BaseStorage* pStorage, ::
uno::Reference< container::XNameAccess > xSubNameAccess;
uno::Any aAny = xNameAccess->getByName( aElements[nInd] );
if ( aAny >>= xInputStream )
- InsertInputStreamToStorage_Impl( pNewStorage, aName, xInputStream );
+ InsertInputStreamToStorage_Impl( pNewStorage, aElements[nInd], xInputStream );
else if ( aAny >>= xSubNameAccess )
- InsertNameAccessToStorage_Impl( pNewStorage, aName, xSubNameAccess );
+ InsertNameAccessToStorage_Impl( pNewStorage, aElements[nInd], xSubNameAccess );
}
}
catch( uno::Exception& )
diff --git a/svl/Package_inc.mk b/svl/Package_inc.mk
index e2814e6eddab..e0f4b1835f95 100644
--- a/svl/Package_inc.mk
+++ b/svl/Package_inc.mk
@@ -83,7 +83,6 @@ $(eval $(call gb_Package_add_file,svl_inc,inc/svl/svdde.hxx,svl/svdde.hxx))
$(eval $(call gb_Package_add_file,svl_inc,inc/svl/svldata.hxx,svl/svldata.hxx))
$(eval $(call gb_Package_add_file,svl_inc,inc/svl/svldllapi.h,svl/svldllapi.h))
$(eval $(call gb_Package_add_file,svl_inc,inc/svl/svstdarr.hxx,svl/svstdarr.hxx))
-$(eval $(call gb_Package_add_file,svl_inc,inc/svl/svtools.hrc,svl/svtools.hrc))
$(eval $(call gb_Package_add_file,svl_inc,inc/svl/szitem.hxx,svl/szitem.hxx))
$(eval $(call gb_Package_add_file,svl_inc,inc/svl/undo.hxx,svl/undo.hxx))
$(eval $(call gb_Package_add_file,svl_inc,inc/svl/urlfilter.hxx,svl/urlfilter.hxx))
diff --git a/svl/inc/svl/solar.hrc b/svl/inc/svl/solar.hrc
index b559766b982b..6d13d46ec759 100644
--- a/svl/inc/svl/solar.hrc
+++ b/svl/inc/svl/solar.hrc
@@ -99,8 +99,8 @@
#define RID_GOODIES_START (RID_LIB_START+7400)
#define RID_GOODIES_END (RID_LIB_START+7449)
-#define RID_CHANNEL_START (RID_LIB_START+7450)
-#define RID_CHANNEL_END (RID_LIB_START+7899)
+#define RID_SVL_START (RID_LIB_START+7450)
+#define RID_SVL_END (RID_LIB_START+7899)
#define RID_CHAOS_START (RID_LIB_START+7900)
#define RID_CHAOS_END (RID_LIB_START+7999)
diff --git a/svl/inc/svl/svl.hrc b/svl/inc/svl/svl.hrc
new file mode 100644
index 000000000000..d63e84f2b91f
--- /dev/null
+++ b/svl/inc/svl/svl.hrc
@@ -0,0 +1,160 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: svtools.hrc,v $
+ * $Revision: 1.7 $
+ *
+ * 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 _SVL_HRC
+#define _SVL_HRC
+
+#include <svl/solar.hrc>
+
+#define STR_SVT_MIMETYPE_START (RID_SVL_START)
+#define STR_SVT_MIMETYPE_APP_OCTSTREAM (STR_SVT_MIMETYPE_START+0)
+#define STR_SVT_MIMETYPE_APP_PDF (STR_SVT_MIMETYPE_START+1)
+#define STR_SVT_MIMETYPE_APP_RTF (STR_SVT_MIMETYPE_START+2)
+#define STR_SVT_MIMETYPE_APP_MSWORD (STR_SVT_MIMETYPE_START+3)
+#define STR_SVT_MIMETYPE_APP_STARCALC (STR_SVT_MIMETYPE_START+4)
+#define STR_SVT_MIMETYPE_APP_STARCHART (STR_SVT_MIMETYPE_START+5)
+#define STR_SVT_MIMETYPE_APP_STARDRAW (STR_SVT_MIMETYPE_START+6)
+#define STR_SVT_MIMETYPE_APP_STARIMAGE (STR_SVT_MIMETYPE_START+7)
+#define STR_SVT_MIMETYPE_APP_STARMATH (STR_SVT_MIMETYPE_START+8)
+#define STR_SVT_MIMETYPE_APP_STARWRITER (STR_SVT_MIMETYPE_START+9)
+#define STR_SVT_MIMETYPE_APP_ZIP (STR_SVT_MIMETYPE_START+10)
+#define STR_SVT_MIMETYPE_AUDIO_AIFF (STR_SVT_MIMETYPE_START+11)
+#define STR_SVT_MIMETYPE_AUDIO_BASIC (STR_SVT_MIMETYPE_START+12)
+#define STR_SVT_MIMETYPE_AUDIO_MIDI (STR_SVT_MIMETYPE_START+13)
+#define STR_SVT_MIMETYPE_AUDIO_WAV (STR_SVT_MIMETYPE_START+14)
+#define STR_SVT_MIMETYPE_IMAGE_GIF (STR_SVT_MIMETYPE_START+15)
+#define STR_SVT_MIMETYPE_IMAGE_JPEG (STR_SVT_MIMETYPE_START+16)
+#define STR_SVT_MIMETYPE_IMAGE_PCX (STR_SVT_MIMETYPE_START+17)
+#define STR_SVT_MIMETYPE_IMAGE_BMP (STR_SVT_MIMETYPE_START+18)
+#define STR_SVT_MIMETYPE_TEXT_HTML (STR_SVT_MIMETYPE_START+19)
+#define STR_SVT_MIMETYPE_TEXT_PLAIN (STR_SVT_MIMETYPE_START+20)
+#define STR_SVT_MIMETYPE_TEXT_URL (STR_SVT_MIMETYPE_START+21)
+#define STR_SVT_MIMETYPE_TEXT_VCARD (STR_SVT_MIMETYPE_START+22)
+#define STR_SVT_MIMETYPE_VIDEO_VDO (STR_SVT_MIMETYPE_START+23)
+#define STR_SVT_MIMETYPE_VIDEO_MSVIDEO (STR_SVT_MIMETYPE_START+24)
+#define STR_SVT_MIMETYPE_X_STARMAIL (STR_SVT_MIMETYPE_START+25)
+#define STR_SVT_MIMETYPE_X_VRML (STR_SVT_MIMETYPE_START+26)
+#define STR_SVT_MIMETYPE_APP_STARHELP (STR_SVT_MIMETYPE_START+27)
+#define STR_SVT_MIMETYPE_APP_STARIMPRESS (STR_SVT_MIMETYPE_START+28)
+#define STR_SVT_MIMETYPE_APP_SCHED_CMB (STR_SVT_MIMETYPE_START+29)
+#define STR_SVT_MIMETYPE_APP_SCHED_EVT (STR_SVT_MIMETYPE_START+30)
+#define STR_SVT_MIMETYPE_APP_SCHED_TASK (STR_SVT_MIMETYPE_START+31)
+#define STR_SVT_MIMETYPE_APP_SCHED_TVIEW (STR_SVT_MIMETYPE_START+32)
+
+#define STR_SVT_MIMETYPE_CNT_MSG (STR_SVT_MIMETYPE_START+33)
+#define STR_SVT_MIMETYPE_CNT_DOCUMENT (STR_SVT_MIMETYPE_START+34)
+#define STR_SVT_MIMETYPE_CNT_POP3BOX (STR_SVT_MIMETYPE_START+35)
+#define STR_SVT_MIMETYPE_CNT_IMAPBOX (STR_SVT_MIMETYPE_START+36)
+#define STR_SVT_MIMETYPE_CNT_IMAPFLD (STR_SVT_MIMETYPE_START+37)
+#define STR_SVT_MIMETYPE_CNT_VIMBOX (STR_SVT_MIMETYPE_START+38)
+#define STR_SVT_MIMETYPE_CNT_VIMINBOX (STR_SVT_MIMETYPE_START+39)
+#define STR_SVT_MIMETYPE_CNT_BBBOX (STR_SVT_MIMETYPE_START+40)
+#define STR_SVT_MIMETYPE_CNT_VIM_BB (STR_SVT_MIMETYPE_START+41)
+#define STR_SVT_MIMETYPE_CNT_NEWSBOX (STR_SVT_MIMETYPE_START+42)
+#define STR_SVT_MIMETYPE_CNT_NEWSGRP (STR_SVT_MIMETYPE_START+43)
+#define STR_SVT_MIMETYPE_CNT_OUTBOX (STR_SVT_MIMETYPE_START+44)
+#define STR_SVT_MIMETYPE_CNT_FTPBOX (STR_SVT_MIMETYPE_START+45)
+#define STR_SVT_MIMETYPE_CNT_FTPFLD (STR_SVT_MIMETYPE_START+46)
+#define STR_SVT_MIMETYPE_CNT_FTPFILE (STR_SVT_MIMETYPE_START+47)
+#define STR_SVT_MIMETYPE_CNT_FTPLINK (STR_SVT_MIMETYPE_START+48)
+#define STR_SVT_MIMETYPE_CNT_HTTPBOX (STR_SVT_MIMETYPE_START+49)
+#define STR_SVT_MIMETYPE_CNT_FSYSBOX (STR_SVT_MIMETYPE_START+50)
+#define STR_SVT_MIMETYPE_CNT_FSYSFLD (STR_SVT_MIMETYPE_START+51)
+#define STR_SVT_MIMETYPE_CNT_FSYSFILE (STR_SVT_MIMETYPE_START+52)
+#define STR_SVT_MIMETYPE_CNT_FSYSURLFILE (STR_SVT_MIMETYPE_START+53)
+#define STR_SVT_MIMETYPE_CNT_PUBLBOX (STR_SVT_MIMETYPE_START+54)
+#define STR_SVT_MIMETYPE_CNT_SRCHBOX (STR_SVT_MIMETYPE_START+55)
+#define STR_SVT_MIMETYPE_CNT_SUBSCRBOX (STR_SVT_MIMETYPE_START+56)
+#define STR_SVT_MIMETYPE_CNT_BOOKMARK (STR_SVT_MIMETYPE_START+57)
+#define STR_SVT_MIMETYPE_CNT_CDF (STR_SVT_MIMETYPE_START+58)
+#define STR_SVT_MIMETYPE_CNT_CDFSUB (STR_SVT_MIMETYPE_START+59)
+#define STR_SVT_MIMETYPE_CNT_CDFITEM (STR_SVT_MIMETYPE_START+60)
+#define STR_SVT_MIMETYPE_CNT_STARCHANNEL (STR_SVT_MIMETYPE_START+61)
+#define STR_SVT_MIMETYPE_CNT_TRASHBOX (STR_SVT_MIMETYPE_START+62)
+#define STR_SVT_MIMETYPE_CNT_TRASH (STR_SVT_MIMETYPE_START+63)
+#define STR_SVT_MIMETYPE_CNT_REMOV_VOL (STR_SVT_MIMETYPE_START+64)
+#define STR_SVT_MIMETYPE_CNT_FIX_VOL (STR_SVT_MIMETYPE_START+65)
+#define STR_SVT_MIMETYPE_CNT_REM_VOL (STR_SVT_MIMETYPE_START+66)
+#define STR_SVT_MIMETYPE_CNT_RAM_VOL (STR_SVT_MIMETYPE_START+67)
+#define STR_SVT_MIMETYPE_CNT_CDROM (STR_SVT_MIMETYPE_START+68)
+#define STR_SVT_MIMETYPE_CNT_DISK_35 (STR_SVT_MIMETYPE_START+69)
+#define STR_SVT_MIMETYPE_CNT_DISK_525 (STR_SVT_MIMETYPE_START+70)
+#define STR_SVT_MIMETYPE_CNT_TAPEDRIVE (STR_SVT_MIMETYPE_START+71)
+#define STR_SVT_MIMETYPE_APP_GAL (STR_SVT_MIMETYPE_START+72)
+#define STR_SVT_MIMETYPE_APP_GAL_THEME (STR_SVT_MIMETYPE_START+73)
+#define STR_SVT_MIMETYPE_CNT_SEPARATOR (STR_SVT_MIMETYPE_START+74)
+#define STR_SVT_MIMETYPE_APP_STARW_GLOB (STR_SVT_MIMETYPE_START+75)
+#define STR_SVT_MIMETYPE_APP_SDM (STR_SVT_MIMETYPE_START+76)
+#define STR_SVT_MIMETYPE_APP_SMD (STR_SVT_MIMETYPE_START+77)
+#define STR_SVT_MIMETYPE_APP_STARW_WEB (STR_SVT_MIMETYPE_START+78)
+#define STR_SVT_MIMETYPE_SCHEDULE (STR_SVT_MIMETYPE_START+79)
+#define STR_SVT_MIMETYPE_SCHEDULE_EVT (STR_SVT_MIMETYPE_START+80)
+#define STR_SVT_MIMETYPE_SCHEDULE_TASK (STR_SVT_MIMETYPE_START+81)
+#define STR_SVT_MIMETYPE_SCHEDULE_FEVT (STR_SVT_MIMETYPE_START+82)
+#define STR_SVT_MIMETYPE_SCHEDULE_FTASK (STR_SVT_MIMETYPE_START+83)
+#define STR_SVT_MIMETYPE_FRAMESET (STR_SVT_MIMETYPE_START+84)
+#define STR_SVT_MIMETYPE_MACRO (STR_SVT_MIMETYPE_START+85)
+#define STR_SVT_MIMETYPE_CNT_SFSYSFOLDER (STR_SVT_MIMETYPE_START+86)
+#define STR_SVT_MIMETYPE_CNT_SFSYSFILE (STR_SVT_MIMETYPE_START+87)
+#define STR_SVT_MIMETYPE_APP_TEMPLATE (STR_SVT_MIMETYPE_START+88)
+#define STR_SVT_MIMETYPE_IMAGE_GENERIC (STR_SVT_MIMETYPE_START+89)
+#define STR_SVT_MIMETYPE_APP_MSEXCEL (STR_SVT_MIMETYPE_START+90)
+#define STR_SVT_MIMETYPE_APP_MSEXCEL_TEMPL (STR_SVT_MIMETYPE_START+91)
+#define STR_SVT_MIMETYPE_APP_MSPPOINT (STR_SVT_MIMETYPE_START+92)
+#define STR_SVT_MIMETYPE_TEXT_VCALENDAR (STR_SVT_MIMETYPE_START+93)
+#define STR_SVT_MIMETYPE_TEXT_ICALENDAR (STR_SVT_MIMETYPE_START+94)
+#define STR_SVT_MIMETYPE_TEXT_XMLICALENDAR (STR_SVT_MIMETYPE_START+95)
+#define STR_SVT_MIMETYPE_TEXT_CDE_CALENDAR_APP (STR_SVT_MIMETYPE_START+96)
+#define STR_SVT_MIMETYPE_INET_MSG_RFC822 (STR_SVT_MIMETYPE_START+97)
+#define STR_SVT_MIMETYPE_INET_MULTI_ALTERNATIVE (STR_SVT_MIMETYPE_START+98)
+#define STR_SVT_MIMETYPE_INET_MULTI_DIGEST (STR_SVT_MIMETYPE_START+99)
+#define STR_SVT_MIMETYPE_INET_MULTI_PARALLEL (STR_SVT_MIMETYPE_START+100)
+#define STR_SVT_MIMETYPE_INET_MULTI_RELATED (STR_SVT_MIMETYPE_START+101)
+#define STR_SVT_MIMETYPE_INET_MULTI_MIXED (STR_SVT_MIMETYPE_START+102)
+#define STR_SVT_MIMETYPE_APP_IMPRESSPACKED (STR_SVT_MIMETYPE_START+103)
+#define STR_SVT_MIMETYPE_APP_JAR (STR_SVT_MIMETYPE_START+104)
+#define STR_SVT_MIMETYPE_IMAGE_PNG (STR_SVT_MIMETYPE_START+105)
+#define STR_SVT_MIMETYPE_IMAGE_TIFF (STR_SVT_MIMETYPE_START+106)
+
+#define STR_SVT_MIMETYPE_APP_SXCALC (STR_SVT_MIMETYPE_START+107)
+#define STR_SVT_MIMETYPE_APP_SXCHART (STR_SVT_MIMETYPE_START+108)
+#define STR_SVT_MIMETYPE_APP_SXDRAW (STR_SVT_MIMETYPE_START+109)
+#define STR_SVT_MIMETYPE_APP_SXMATH (STR_SVT_MIMETYPE_START+110)
+#define STR_SVT_MIMETYPE_APP_SXWRITER (STR_SVT_MIMETYPE_START+111)
+#define STR_SVT_MIMETYPE_APP_SXIMPRESS (STR_SVT_MIMETYPE_START+112)
+#define STR_SVT_MIMETYPE_APP_SXGLOBAL (STR_SVT_MIMETYPE_START+113)
+#define STR_SVT_MIMETYPE_APP_SXIPACKED (STR_SVT_MIMETYPE_START+114)
+#define STR_SVT_MIMETYPE_END (STR_SVT_MIMETYPE_APP_SXIPACKED)
+
+#define STR_COLUM_DT_AUTO (STR_SVT_MIMETYPE_END+1)
+
+#endif // #ifndef _SVTOOLS_HRC
+
+// ******************************************************************* EOF
+
diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx
index 00f2dbe92b4c..598295797ea6 100644
--- a/svl/inc/svl/zforlist.hxx
+++ b/svl/inc/svl/zforlist.hxx
@@ -333,6 +333,17 @@ class SvNumberFormatterRegistry_Impl;
class SVL_DLLPUBLIC SvNumberFormatter
{
public:
+ /**
+ * We can't technically have an "infinite" value, so we use an arbitrary
+ * upper precision threshold to represent the "unlimited" precision.
+ */
+ static const sal_uInt16 UNLIMITED_PRECISION;
+
+ /**
+ * Precision suitable for numbers displayed in input bar, for instance
+ * Calc's formula input bar.
+ */
+ static const sal_uInt16 INPUTSTRING_PRECISION;
/// Preferred ctor with service manager and language/country enum
SvNumberFormatter(
@@ -583,7 +594,7 @@ public:
/// Return the reference date
Date* GetNullDate();
/// Return the standard decimal precision
- short GetStandardPrec();
+ sal_uInt16 GetStandardPrec();
/// Return whether zero suppression is switched on
BOOL GetNoZero() { return bNoZero; }
/** Get the type of a format (or NUMBERFORMAT_UNDEFINED if no entry),
diff --git a/svl/inc/svl/zformat.hxx b/svl/inc/svl/zformat.hxx
index 7cdcf4db518d..7c361382796a 100644
--- a/svl/inc/svl/zformat.hxx
+++ b/svl/inc/svl/zformat.hxx
@@ -236,6 +236,12 @@ public:
// in fact that could be any string used in number formats.
static void LoadString( SvStream& rStream, String& rStr );
+ /**
+ * Get output string from a numeric value that fits the number of
+ * characters specified.
+ */
+ bool GetOutputString( double fNumber, sal_uInt16 nCharCount, String& rOutString ) const;
+
BOOL GetOutputString( double fNumber, String& OutString, Color** ppColor );
BOOL GetOutputString( String& sString, String& OutString, Color** ppColor );
@@ -487,6 +493,7 @@ private:
// standard number output
SVL_DLLPRIVATE void ImpGetOutputStandard( double& fNumber, String& OutString );
+ SVL_DLLPRIVATE void ImpGetOutputStdToPrecision( double& rNumber, String& rOutString, sal_uInt16 nPrecision ) const;
// numbers in input line
SVL_DLLPRIVATE void ImpGetOutputInputLine( double fNumber, String& OutString );
diff --git a/svl/qa/complex/ConfigItems/helper/exports.map b/svl/qa/complex/ConfigItems/helper/exports.map
deleted file mode 100644
index 85610ad80888..000000000000
--- a/svl/qa/complex/ConfigItems/helper/exports.map
+++ /dev/null
@@ -1,10 +0,0 @@
-UDK_3_0_0 {
- global:
- GetVersionInfo;
- component_getImplementationEnvironment;
- component_getFactory;
- component_writeInfo;
-
- local:
- *;
-};
diff --git a/svl/qa/complex/ConfigItems/helper/makefile.mk b/svl/qa/complex/ConfigItems/helper/makefile.mk
index 2c949da7b168..13ea12106792 100644
--- a/svl/qa/complex/ConfigItems/helper/makefile.mk
+++ b/svl/qa/complex/ConfigItems/helper/makefile.mk
@@ -65,7 +65,7 @@ SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
-SHL1VERSIONMAP= exports.map
+SHL1VERSIONMAP= $(SOLARENV)/src/component.map
# --- Targets ------------------------------------------------------
diff --git a/svl/qa/makefile.mk b/svl/qa/makefile.mk
index 4e107e31f924..7e8c7ee795cc 100644
--- a/svl/qa/makefile.mk
+++ b/svl/qa/makefile.mk
@@ -35,6 +35,8 @@ ENABLE_EXCEPTIONS = true
.INCLUDE : settings.mk
+CFLAGSCXX += $(CPPUNIT_CFLAGS)
+
# BEGIN ----------------------------------------------------------------
# auto generated Target:job by codegen.pl
SHL1OBJS= \
diff --git a/svl/source/fsstor/exports.map b/svl/source/fsstor/exports.map
deleted file mode 100644
index f4ed78b9e970..000000000000
--- a/svl/source/fsstor/exports.map
+++ /dev/null
@@ -1,8 +0,0 @@
-UDK_3_0_0 {
- global:
- component_getImplementationEnvironment;
- component_writeInfo;
- component_getFactory;
- local:
- *;
-};
diff --git a/svl/source/fsstor/makefile.mk b/svl/source/fsstor/makefile.mk
index 43515155d63d..dc91814772f9 100644
--- a/svl/source/fsstor/makefile.mk
+++ b/svl/source/fsstor/makefile.mk
@@ -56,7 +56,7 @@ SHL1STDLIBS=\
$(CPPULIB) \
$(SALLIB)
-SHL1VERSIONMAP=exports.map
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
diff --git a/svl/source/items/cstitem.src b/svl/source/items/cstitem.src
index b3511ffb302b..009fcb19e3c6 100644
--- a/svl/source/items/cstitem.src
+++ b/svl/source/items/cstitem.src
@@ -25,7 +25,7 @@
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svl/svl.hrc>
String STR_COLUM_DT_AUTO
{
Text [ en-US ] = "automatic" ;
diff --git a/svl/source/items/dateitem.cxx b/svl/source/items/dateitem.cxx
index 3c8e85c461f2..27170c1d4f6e 100644
--- a/svl/source/items/dateitem.cxx
+++ b/svl/source/items/dateitem.cxx
@@ -33,7 +33,7 @@
#define _DATETIMEITEM_CXX
#include <svl/dateitem.hxx>
#include <svl/svldata.hxx>
-#include <svl/svtools.hrc>
+#include <svl/svl.hrc>
#include <unotools/intlwrapper.hxx>
#include <comphelper/processfactory.hxx>
@@ -45,7 +45,6 @@
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/lang/Locale.hpp>
-
// STATIC DATA -----------------------------------------------------------
DBG_NAME(SfxDateTimeItem)
diff --git a/svl/source/items/nranges.cxx b/svl/source/items/nranges.cxx
index 284bc251a3a4..813c1fec8ebd 100644
--- a/svl/source/items/nranges.cxx
+++ b/svl/source/items/nranges.cxx
@@ -480,7 +480,7 @@ SfxNumRanges& SfxNumRanges::operator -=
NUMTYPE nThisSize = Count_Impl(_pRanges);
NUMTYPE nTargetSize = 1 + ( nThisSize + Count_Impl(rRanges._pRanges) );
NUMTYPE *pTarget = new NUMTYPE[ nTargetSize ];
- memset( pTarget, sizeof(NUMTYPE)*nTargetSize, 0 );
+ memset( pTarget, 0, sizeof(NUMTYPE)*nTargetSize );
memcpy( pTarget, _pRanges, sizeof(NUMTYPE)*nThisSize );
NUMTYPE nPos1 = 0, nPos2 = 0, nTargetPos = 0;
@@ -690,7 +690,7 @@ SfxNumRanges& SfxNumRanges::operator /=
NUMTYPE nThisSize = Count_Impl(_pRanges);
NUMTYPE nTargetSize = 1 + ( nThisSize + Count_Impl(rRanges._pRanges) );
NUMTYPE *pTarget = new NUMTYPE[ nTargetSize ];
- memset( pTarget, sizeof(NUMTYPE)*nTargetSize, 0 );
+ memset( pTarget, 0, sizeof(NUMTYPE)*nTargetSize );
memcpy( pTarget, _pRanges, sizeof(NUMTYPE)*nThisSize );
NUMTYPE nPos1 = 0, nPos2 = 0, nTargetPos = 0;
diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx
index b7422c56224b..cc033bc6905e 100644
--- a/svl/source/items/srchitem.cxx
+++ b/svl/source/items/srchitem.cxx
@@ -151,40 +151,44 @@ SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) :
rFlags |= TransliterationModules_IGNORE_CASE;
if ( aOpt.IsMatchFullHalfWidthForms())
rFlags |= TransliterationModules_IGNORE_WIDTH;
- if ( aOpt.IsMatchHiraganaKatakana())
- rFlags |= TransliterationModules_IGNORE_KANA;
- if ( aOpt.IsMatchContractions())
- rFlags |= TransliterationModules_ignoreSize_ja_JP;
- if ( aOpt.IsMatchMinusDashChoon())
- rFlags |= TransliterationModules_ignoreMinusSign_ja_JP;
- if ( aOpt.IsMatchRepeatCharMarks())
- rFlags |= TransliterationModules_ignoreIterationMark_ja_JP;
- if ( aOpt.IsMatchVariantFormKanji())
- rFlags |= TransliterationModules_ignoreTraditionalKanji_ja_JP;
- if ( aOpt.IsMatchOldKanaForms())
- rFlags |= TransliterationModules_ignoreTraditionalKana_ja_JP;
- if ( aOpt.IsMatchDiziDuzu())
- rFlags |= TransliterationModules_ignoreZiZu_ja_JP;
- if ( aOpt.IsMatchBavaHafa())
- rFlags |= TransliterationModules_ignoreBaFa_ja_JP;
- if ( aOpt.IsMatchTsithichiDhizi())
- rFlags |= TransliterationModules_ignoreTiJi_ja_JP;
- if ( aOpt.IsMatchHyuiyuByuvyu())
- rFlags |= TransliterationModules_ignoreHyuByu_ja_JP;
- if ( aOpt.IsMatchSesheZeje())
- rFlags |= TransliterationModules_ignoreSeZe_ja_JP;
- if ( aOpt.IsMatchIaiya())
- rFlags |= TransliterationModules_ignoreIandEfollowedByYa_ja_JP;
- if ( aOpt.IsMatchKiku())
- rFlags |= TransliterationModules_ignoreKiKuFollowedBySa_ja_JP;
- if ( aOpt.IsIgnorePunctuation())
- rFlags |= TransliterationModules_ignoreSeparator_ja_JP;
- if ( aOpt.IsIgnoreWhitespace())
- rFlags |= TransliterationModules_ignoreSpace_ja_JP;
- if ( aOpt.IsIgnoreProlongedSoundMark())
- rFlags |= TransliterationModules_ignoreProlongedSoundMark_ja_JP;
- if ( aOpt.IsIgnoreMiddleDot())
- rFlags |= TransliterationModules_ignoreMiddleDot_ja_JP;
+ if ( bAsianOptions )
+ {
+ if ( aOpt.IsMatchHiraganaKatakana())
+ rFlags |= TransliterationModules_IGNORE_KANA;
+ if ( aOpt.IsMatchContractions())
+ rFlags |= TransliterationModules_ignoreSize_ja_JP;
+ if ( aOpt.IsMatchMinusDashChoon())
+ rFlags |= TransliterationModules_ignoreMinusSign_ja_JP;
+ if ( aOpt.IsMatchRepeatCharMarks())
+ rFlags |= TransliterationModules_ignoreIterationMark_ja_JP;
+ if ( aOpt.IsMatchVariantFormKanji())
+ rFlags |= TransliterationModules_ignoreTraditionalKanji_ja_JP;
+ if ( aOpt.IsMatchOldKanaForms())
+ rFlags |= TransliterationModules_ignoreTraditionalKana_ja_JP;
+ if ( aOpt.IsMatchDiziDuzu())
+ rFlags |= TransliterationModules_ignoreZiZu_ja_JP;
+ if ( aOpt.IsMatchBavaHafa())
+ rFlags |= TransliterationModules_ignoreBaFa_ja_JP;
+ if ( aOpt.IsMatchTsithichiDhizi())
+ rFlags |= TransliterationModules_ignoreTiJi_ja_JP;
+ if ( aOpt.IsMatchHyuiyuByuvyu())
+ rFlags |= TransliterationModules_ignoreHyuByu_ja_JP;
+ if ( aOpt.IsMatchSesheZeje())
+ rFlags |= TransliterationModules_ignoreSeZe_ja_JP;
+ if ( aOpt.IsMatchIaiya())
+ rFlags |= TransliterationModules_ignoreIandEfollowedByYa_ja_JP;
+ if ( aOpt.IsMatchKiku())
+ rFlags |= TransliterationModules_ignoreKiKuFollowedBySa_ja_JP;
+ if ( aOpt.IsIgnorePunctuation())
+ rFlags |= TransliterationModules_ignoreSeparator_ja_JP;
+ if ( aOpt.IsIgnoreWhitespace())
+ rFlags |= TransliterationModules_ignoreSpace_ja_JP;
+ if ( aOpt.IsIgnoreProlongedSoundMark())
+ rFlags |= TransliterationModules_ignoreProlongedSoundMark_ja_JP;
+ if ( aOpt.IsIgnoreMiddleDot())
+ rFlags |= TransliterationModules_ignoreMiddleDot_ja_JP;
+ }
+
}
// -----------------------------------------------------------------------
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index b8bed49b603b..60c622208d53 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -28,7 +28,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svl.hxx"
-#ifndef GCC
+#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
+#include <com/sun/star/lang/XComponent.hpp>
#endif
#define _SVSTDARR_STRINGS
@@ -808,6 +809,16 @@ void SfxStyleSheetBasePool::Remove( SfxStyleSheetBase* p )
{
// Alle Styles umsetzen, deren Parent dieser hier ist
ChangeParent( p->GetName(), p->GetParent() );
+
+ com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComp( static_cast< ::cppu::OWeakObject* >((*aIter).get()), com::sun::star::uno::UNO_QUERY );
+ if( xComp.is() ) try
+ {
+ xComp->dispose();
+ }
+ catch( com::sun::star::uno::Exception& )
+ {
+ }
+
aStyles.erase(aIter);
Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *p ) );
}
@@ -838,6 +849,15 @@ void SfxStyleSheetBasePool::Clear()
SfxStyles::iterator aIter( aClearStyles.begin() );
while( aIter != aClearStyles.end() )
{
+ com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComp( static_cast< ::cppu::OWeakObject* >((*aIter).get()), com::sun::star::uno::UNO_QUERY );
+ if( xComp.is() ) try
+ {
+ xComp->dispose();
+ }
+ catch( com::sun::star::uno::Exception& )
+ {
+ }
+
Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *(*aIter++).get() ) );
}
}
diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx
index bec8b91e7c22..0b9efdf22afd 100644
--- a/svl/source/misc/inettype.cxx
+++ b/svl/source/misc/inettype.cxx
@@ -31,9 +31,7 @@
#include <tools/wldcrd.hxx>
#include <svl/inettype.hxx>
#include <svl/svldata.hxx>
-#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
-#endif
+#include <svl/svl.hrc>
#ifndef _SVSTDARR_STRINGSSORT_DECL
#define _SVSTDARR_STRINGSSORT
@@ -806,16 +804,13 @@ namespace unnamed_svl_inettype {
MediaTypeEntry const * seekEntry(UniString const & rTypeName,
MediaTypeEntry const * pMap, sal_Size nSize)
{
-#if defined DBG_UTIL || defined INETTYPE_DEBUG
- static bool bChecked = false;
- if (!bChecked)
- {
- for (sal_Size i = 0; i < nSize - 1; ++i)
- DBG_ASSERT(pMap[i].m_pTypeName < pMap[i + 1].m_pTypeName,
- "seekEntry(): Bad map");
- bChecked = true;
- }
-#endif // DBG_UTIL, INETTYPE_DEBUG
+#if defined DBG_UTIL
+ for (sal_Size i = 0; i < nSize - 1; ++i)
+ DBG_ASSERT(
+ rtl_str_compare(
+ pMap[i].m_pTypeName, pMap[i + 1].m_pTypeName) < 0,
+ "seekEntry(): Bad map");
+#endif
sal_Size nLow = 0;
sal_Size nHigh = nSize;
diff --git a/svl/source/misc/mediatyp.src b/svl/source/misc/mediatyp.src
index 195b2c640d67..333963c1d2d9 100644
--- a/svl/source/misc/mediatyp.src
+++ b/svl/source/misc/mediatyp.src
@@ -32,7 +32,7 @@
//============================================================================
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svl/svl.hrc>
#endif
String STR_SVT_MIMETYPE_APP_OCTSTREAM
diff --git a/svl/source/misc/urihelper.cxx b/svl/source/misc/urihelper.cxx
index 95d957655d5e..656000fceae3 100644
--- a/svl/source/misc/urihelper.cxx
+++ b/svl/source/misc/urihelper.cxx
@@ -123,8 +123,7 @@ inline UniString SmartRel2Abs_Impl(INetURLObject const & rTheBaseURIRef,
eStyle);
if (bCheckFileExists
&& !bWasAbsolute
- && (aAbsURIRef.GetProtocol() == INET_PROT_FILE
- || aAbsURIRef.GetProtocol() == INET_PROT_VND_SUN_STAR_WFS))
+ && (aAbsURIRef.GetProtocol() == INET_PROT_FILE))
{
INetURLObject aNonFileURIRef;
aNonFileURIRef.SetSmartURL(rTheRelURIRef,
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 05dab66754e1..cb66a75558c2 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -61,6 +61,7 @@
#include <rtl/instance.hxx>
#include <math.h>
+#include <limits>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -178,6 +179,9 @@ SV_IMPL_PTRARR( NfWSStringsDtor, String* );
/***********************Funktionen SvNumberFormatter**************************/
+const sal_uInt16 SvNumberFormatter::UNLIMITED_PRECISION = ::std::numeric_limits<sal_uInt16>::max();
+const sal_uInt16 SvNumberFormatter::INPUTSTRING_PRECISION = ::std::numeric_limits<sal_uInt16>::max()-1;
+
SvNumberFormatter::SvNumberFormatter(
const Reference< XMultiServiceFactory >& xSMgr,
LanguageType eLang )
@@ -338,7 +342,7 @@ void SvNumberFormatter::ChangeStandardPrec(short nPrec)
pFormatScanner->ChangeStandardPrec(nPrec);
}
-short SvNumberFormatter::GetStandardPrec()
+sal_uInt16 SvNumberFormatter::GetStandardPrec()
{
return pFormatScanner->GetStandardPrec();
}
@@ -1473,7 +1477,6 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
String& sOutString)
{
SvNumberformat* pFormat;
- short nOldPrec;
Color* pColor;
pFormat = (SvNumberformat*) aFTable.Get(nFIndex);
if (!pFormat)
@@ -1483,7 +1486,8 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
short eType = pFormat->GetType() & ~NUMBERFORMAT_DEFINED;
if (eType == 0)
eType = NUMBERFORMAT_DEFINED;
- nOldPrec = -1;
+ sal_uInt16 nOldPrec = pFormatScanner->GetStandardPrec();
+ bool bPrecChanged = false;
if (eType == NUMBERFORMAT_NUMBER || eType == NUMBERFORMAT_PERCENT
|| eType == NUMBERFORMAT_CURRENCY
|| eType == NUMBERFORMAT_SCIENTIFIC
@@ -1491,8 +1495,8 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
{
if (eType != NUMBERFORMAT_PERCENT) // spaeter Sonderbehandlung %
eType = NUMBERFORMAT_NUMBER;
- nOldPrec = pFormatScanner->GetStandardPrec();
- ChangeStandardPrec(300); // Merkwert
+ ChangeStandardPrec(INPUTSTRING_PRECISION);
+ bPrecChanged = true;
}
sal_uInt32 nKey = nFIndex;
switch ( eType )
@@ -1512,12 +1516,12 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
{
if ( eType == NUMBERFORMAT_TIME && pFormat->GetFormatPrecision() )
{
- nOldPrec = pFormatScanner->GetStandardPrec();
- ChangeStandardPrec(300); // Merkwert
+ ChangeStandardPrec(INPUTSTRING_PRECISION);
+ bPrecChanged = true;
}
pFormat->GetOutputString(fOutNumber, sOutString, &pColor);
}
- if (nOldPrec != -1)
+ if (bPrecChanged)
ChangeStandardPrec(nOldPrec);
}
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 0e63b91e15d0..dbcad199f367 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -54,6 +54,9 @@
#include "numhead.hxx"
#include <unotools/digitgroupingiterator.hxx>
#include <svl/nfsymbol.hxx>
+
+#include <cmath>
+
using namespace svt;
namespace {
@@ -63,6 +66,10 @@ struct Gregorian
return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("gregorian"));
}
};
+
+const sal_uInt16 UPPER_PRECISION = 300; // entirely arbitrary...
+const double EXP_LOWER_BOUND = 1.0E-4; // prefer scientific notation below this value.
+
}
const double _D_MAX_U_LONG_ = (double) 0xffffffff; // 4294967295.0
@@ -675,7 +682,7 @@ SvNumberformat::SvNumberformat(String& rString,
xub_StrLen nAnzChars = ImpGetNumber(rString, nPos, sStr);
if (nAnzChars > 0)
{
- short F_Type;
+ short F_Type = NUMBERFORMAT_UNDEFINED;
if (!pISc->IsNumberFormat(sStr,F_Type,fNumber) ||
( F_Type != NUMBERFORMAT_NUMBER &&
F_Type != NUMBERFORMAT_SCIENTIFIC) )
@@ -1774,47 +1781,62 @@ void SvNumberformat::Build50Formatstring( String& rStr ) const
void SvNumberformat::ImpGetOutputStandard(double& fNumber, String& OutString)
{
- USHORT nStandardPrec = rScan.GetStandardPrec();
+ sal_uInt16 nStandardPrec = rScan.GetStandardPrec();
+
if ( fabs(fNumber) > 1.0E15 ) // #58531# war E16
+ {
+ nStandardPrec = ::std::min(nStandardPrec, static_cast<sal_uInt16>(14)); // limits to 14 decimals
OutString = ::rtl::math::doubleToUString( fNumber,
rtl_math_StringFormat_E, nStandardPrec /*2*/,
GetFormatter().GetNumDecimalSep().GetChar(0));
+ }
else
- {
+ ImpGetOutputStdToPrecision(fNumber, OutString, nStandardPrec);
+}
+
+void SvNumberformat::ImpGetOutputStdToPrecision(double& rNumber, String& rOutString, sal_uInt16 nPrecision) const
+{
+ // Make sure the precision doesn't go over the maximum allowable precision.
+ nPrecision = ::std::min(UPPER_PRECISION, nPrecision);
+
#if 0
{
- // debugger test case for ANSI standard correctness
- ::rtl::OUString aTest;
- // expect 0.00123 OK
- aTest = ::rtl::math::doubleToUString( 0.001234567,
- rtl_math_StringFormat_G, 3, '.', sal_True );
- // expect 123 OK
- aTest = ::rtl::math::doubleToUString( 123.4567,
- rtl_math_StringFormat_G, 3, '.', sal_True );
- // expect 123.5 OK
- aTest = ::rtl::math::doubleToUString( 123.4567,
- rtl_math_StringFormat_G, 4, '.', sal_True );
- // expect 1e+03 (as 999.6 rounded to 3 significant digits results in
- // 1000 with an exponent equal to significant digits)
- // Currently (24-Jan-2003) we do fail in this case and output 1000
- // instead, negligible.
- aTest = ::rtl::math::doubleToUString( 999.6,
- rtl_math_StringFormat_G, 3, '.', sal_True );
- // expect what? result is 1.2e+004
- aTest = ::rtl::math::doubleToUString( 12345.6789,
- rtl_math_StringFormat_G, -3, '.', sal_True );
+ // debugger test case for ANSI standard correctness
+ ::rtl::OUString aTest;
+ // expect 0.00123 OK
+ aTest = ::rtl::math::doubleToUString( 0.001234567,
+ rtl_math_StringFormat_G, 3, '.', sal_True );
+ // expect 123 OK
+ aTest = ::rtl::math::doubleToUString( 123.4567,
+ rtl_math_StringFormat_G, 3, '.', sal_True );
+ // expect 123.5 OK
+ aTest = ::rtl::math::doubleToUString( 123.4567,
+ rtl_math_StringFormat_G, 4, '.', sal_True );
+ // expect 1e+03 (as 999.6 rounded to 3 significant digits results in
+ // 1000 with an exponent equal to significant digits)
+ // Currently (24-Jan-2003) we do fail in this case and output 1000
+ // instead, negligible.
+ aTest = ::rtl::math::doubleToUString( 999.6,
+ rtl_math_StringFormat_G, 3, '.', sal_True );
+ // expect what? result is 1.2e+004
+ aTest = ::rtl::math::doubleToUString( 12345.6789,
+ rtl_math_StringFormat_G, -3, '.', sal_True );
}
#endif
- OutString = ::rtl::math::doubleToUString( fNumber,
- rtl_math_StringFormat_F, nStandardPrec /*2*/,
- GetFormatter().GetNumDecimalSep().GetChar(0), sal_True );
- if (OutString.GetChar(0) == '-' &&
- OutString.GetTokenCount('0') == OutString.Len())
- OutString.EraseLeadingChars('-'); // nicht -0
- }
- ImpTransliterate( OutString, NumFor[0].GetNatNum() );
- return;
+ // We decided to strip trailing zeros unconditionally, since binary
+ // double-precision rounding error makes it impossible to determine e.g.
+ // whether 844.10000000000002273737 is what the user has typed, or the
+ // user has typed 844.1 but IEEE 754 represents it that way internally.
+
+ rOutString = ::rtl::math::doubleToUString( rNumber,
+ rtl_math_StringFormat_F, nPrecision /*2*/,
+ GetFormatter().GetNumDecimalSep().GetChar(0), true );
+ if (rOutString.GetChar(0) == '-' &&
+ rOutString.GetTokenCount('0') == rOutString.Len())
+ rOutString.EraseLeadingChars('-'); // nicht -0
+
+ ImpTransliterate( rOutString, NumFor[0].GetNatNum() );
}
void SvNumberformat::ImpGetOutputInputLine(double fNumber, String& OutString)
@@ -1955,6 +1977,71 @@ ULONG SvNumberformat::ImpGGTRound(ULONG x, ULONG y)
}
}
+namespace {
+
+void lcl_GetOutputStringScientific(
+ double fNumber, sal_uInt16 nCharCount, const SvNumberFormatter& rFormatter, String& rOutString)
+{
+ bool bSign = ::rtl::math::isSignBitSet(fNumber);
+
+ // 1.000E+015 (one digit and the decimal point, and the five chars for the exponential part, totalling 7).
+ sal_uInt16 nPrec = nCharCount > 7 ? nCharCount - 7 : 0;
+ if (nPrec && bSign)
+ // Make room for the negative sign.
+ --nPrec;
+
+ nPrec = ::std::min(nPrec, static_cast<sal_uInt16>(14)); // limit to 14 decimals.
+
+ rOutString = ::rtl::math::doubleToUString(
+ fNumber, rtl_math_StringFormat_E, nPrec, rFormatter.GetNumDecimalSep().GetChar(0));
+}
+
+}
+
+bool SvNumberformat::GetOutputString(double fNumber, sal_uInt16 nCharCount, String& rOutString) const
+{
+ using namespace std;
+
+ if (eType != NUMBERFORMAT_NUMBER)
+ return false;
+
+ double fTestNum = fNumber;
+ bool bSign = ::rtl::math::isSignBitSet(fTestNum);
+ if (bSign)
+ fTestNum = -fTestNum;
+
+ if (fTestNum < EXP_LOWER_BOUND)
+ {
+ lcl_GetOutputStringScientific(fNumber, nCharCount, GetFormatter(), rOutString);
+ return true;
+ }
+
+ double fExp = log10(fTestNum);
+ // Values < 1.0 always have one digit before the decimal point.
+ sal_uInt16 nDigitPre = fExp >= 0.0 ? static_cast<sal_uInt16>(ceil(fExp)) : 1;
+
+ if (nDigitPre > 15)
+ {
+ lcl_GetOutputStringScientific(fNumber, nCharCount, GetFormatter(), rOutString);
+ return true;
+ }
+
+ sal_uInt16 nPrec = nCharCount >= nDigitPre ? nCharCount - nDigitPre : 0;
+ if (nPrec && bSign)
+ // Subtract the negative sign.
+ --nPrec;
+ if (nPrec)
+ // Subtract the decimal point.
+ --nPrec;
+
+ ImpGetOutputStdToPrecision(fNumber, rOutString, nPrec);
+ if (rOutString.Len() > nCharCount)
+ // String still wider than desired. Switch to scientific notation.
+ lcl_GetOutputStringScientific(fNumber, nCharCount, GetFormatter(), rOutString);
+
+ return true;
+}
+
BOOL SvNumberformat::GetOutputString(double fNumber,
String& OutString,
Color** ppColor)
@@ -1978,16 +2065,43 @@ BOOL SvNumberformat::GetOutputString(double fNumber,
BOOL bHadStandard = FALSE;
if (bStandard) // einzelne Standardformate
{
- if (rScan.GetStandardPrec() == 300) // alle Zahlformate InputLine
+ if (rScan.GetStandardPrec() == SvNumberFormatter::INPUTSTRING_PRECISION) // alle Zahlformate InputLine
{
ImpGetOutputInputLine(fNumber, OutString);
- return FALSE;
+ return false;
}
switch (eType)
{
case NUMBERFORMAT_NUMBER: // Standardzahlformat
+ {
+ if (rScan.GetStandardPrec() == SvNumberFormatter::UNLIMITED_PRECISION)
+ {
+ bool bSign = ::rtl::math::isSignBitSet(fNumber);
+ if (bSign)
+ fNumber = -fNumber;
+ ImpGetOutputStdToPrecision(fNumber, OutString, 10); // Use 10 decimals for general 'unlimited' format.
+ if (fNumber < EXP_LOWER_BOUND)
+ {
+ xub_StrLen nLen = OutString.Len();
+ if (!nLen)
+ return false;
+
+ if (nLen > 11)
+ {
+ sal_uInt16 nStandardPrec = rScan.GetStandardPrec();
+ nStandardPrec = ::std::min(nStandardPrec, static_cast<sal_uInt16>(14)); // limits to 14 decimals
+ OutString = ::rtl::math::doubleToUString( fNumber,
+ rtl_math_StringFormat_E, nStandardPrec /*2*/,
+ GetFormatter().GetNumDecimalSep().GetChar(0), true);
+ }
+ }
+ if (bSign)
+ OutString.Insert('-', 0);
+ return false;
+ }
ImpGetOutputStandard(fNumber, OutString);
bHadStandard = TRUE;
+ }
break;
case NUMBERFORMAT_DATE:
bRes |= ImpGetDateOutput(fNumber, 0, OutString);
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index 11a51a662aee..ab68d8309159 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -465,7 +465,7 @@ void ImpSvNumberformatScan::ChangeNullDate(USHORT nDay, USHORT nMonth, USHORT nY
pNullDate = new Date(nDay, nMonth, nYear);
}
-void ImpSvNumberformatScan::ChangeStandardPrec(short nPrec)
+void ImpSvNumberformatScan::ChangeStandardPrec(sal_uInt16 nPrec)
{
nStandardPrec = nPrec;
}
diff --git a/svl/source/numbers/zforscan.hxx b/svl/source/numbers/zforscan.hxx
index 1ca6271443ae..176da84b652e 100644
--- a/svl/source/numbers/zforscan.hxx
+++ b/svl/source/numbers/zforscan.hxx
@@ -54,7 +54,7 @@ public:
void ChangeNullDate(USHORT nDay, USHORT nMonth, USHORT nYear);
// tauscht Referenzdatum aus
- void ChangeStandardPrec(short nPrec); // tauscht Standardprecision aus
+ void ChangeStandardPrec(sal_uInt16 nPrec); // tauscht Standardprecision aus
xub_StrLen ScanFormat( String& rString, String& rComment ); // Aufruf der Scan-Analyse
@@ -93,7 +93,7 @@ public:
InitKeywords();
return sNameStandardFormat;
}
- short GetStandardPrec() const { return nStandardPrec; }
+ sal_uInt16 GetStandardPrec() const { return nStandardPrec; }
const Color& GetRedColor() const { return StandardColor[4]; }
Color* GetColor(String& sStr); // Setzt Hauptfarben oder
// definierte Farben
@@ -158,7 +158,7 @@ private: // ---- privater Teil
// Array der Standardfarben
Date* pNullDate; // 30Dec1899
String sNameStandardFormat; // "Standard"
- short nStandardPrec; // default Precision fuer Standardformat (2)
+ sal_uInt16 nStandardPrec; // default Precision for Standardformat
SvNumberFormatter* pFormatter; // Pointer auf die Formatliste
String sStrArray[NF_MAX_FORMAT_SYMBOLS]; // Array der Symbole
diff --git a/svl/source/passwordcontainer/exports.map b/svl/source/passwordcontainer/exports.map
deleted file mode 100644
index f4ed78b9e970..000000000000
--- a/svl/source/passwordcontainer/exports.map
+++ /dev/null
@@ -1,8 +0,0 @@
-UDK_3_0_0 {
- global:
- component_getImplementationEnvironment;
- component_writeInfo;
- component_getFactory;
- local:
- *;
-};
diff --git a/svl/source/passwordcontainer/makefile.mk b/svl/source/passwordcontainer/makefile.mk
index 92a9993fd251..d9eb9615cf80 100644
--- a/svl/source/passwordcontainer/makefile.mk
+++ b/svl/source/passwordcontainer/makefile.mk
@@ -52,7 +52,7 @@ SHL1STDLIBS=\
$(CPPULIB) \
$(SALLIB)
-SHL1VERSIONMAP=exports.map
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
diff --git a/svtools/AllLangResTarget_svt.mk b/svtools/AllLangResTarget_svt.mk
index 1e3e21b7ca6b..c198601f3ca7 100644
--- a/svtools/AllLangResTarget_svt.mk
+++ b/svtools/AllLangResTarget_svt.mk
@@ -57,7 +57,6 @@ $(eval $(call gb_SrsTarget_add_files,svt/res,\
svtools/source/dialogs/colrdlg.src \
svtools/source/dialogs/filedlg2.src \
svtools/source/dialogs/formats.src \
- svtools/source/dialogs/logindlg.src \
svtools/source/dialogs/printdlg.src \
svtools/source/dialogs/prnsetup.src \
svtools/source/dialogs/so3res.src \
@@ -71,9 +70,9 @@ $(eval $(call gb_SrsTarget_add_files,svt/res,\
svtools/source/misc/helpagent.src \
svtools/source/misc/imagemgr.src \
svtools/source/misc/langtab.src \
- svtools/source/misc/undo.src \
svtools/source/plugapp/testtool.src \
- svtools/source/uno/unoifac2.src \
))
+ #svtools/source/misc/undo.src \
+# vim: set noet sw=4 ts=4:
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk
index 8968775b8e7c..f8415a98b922 100644
--- a/svtools/Library_svt.mk
+++ b/svtools/Library_svt.mk
@@ -84,38 +84,136 @@ $(eval $(call gb_Library_add_linked_static_libs,svt,\
endif
$(eval $(call gb_Library_add_exception_objects,svt,\
+ svtools/source/brwbox/brwbox1 \
+ svtools/source/brwbox/brwbox2 \
+ svtools/source/brwbox/brwbox3 \
+ svtools/source/brwbox/brwhead \
+ svtools/source/brwbox/datwin \
+ svtools/source/brwbox/ebbcontrols \
+ svtools/source/brwbox/editbrowsebox \
+ svtools/source/brwbox/editbrowsebox2 \
+ svtools/source/config/accessibilityoptions \
+ svtools/source/config/apearcfg \
+ svtools/source/config/colorcfg \
+ svtools/source/config/extcolorcfg \
+ svtools/source/config/fontsubstconfig \
+ svtools/source/config/helpopt \
+ svtools/source/config/htmlcfg \
+ svtools/source/config/itemholder2 \
+ svtools/source/config/menuoptions \
+ svtools/source/config/miscopt \
+ svtools/source/config/optionsdrawinglayer \
+ svtools/source/config/printoptions \
+ svtools/source/contnr/contentenumeration \
+ svtools/source/contnr/ctrdll \
+ svtools/source/contnr/fileview \
+ svtools/source/contnr/imivctl1 \
+ svtools/source/contnr/imivctl2 \
+ svtools/source/contnr/ivctrl \
+ svtools/source/contnr/svicnvw \
+ svtools/source/contnr/svimpbox \
+ svtools/source/contnr/svimpicn \
+ svtools/source/contnr/svlbitm \
+ svtools/source/contnr/svlbox \
+ svtools/source/contnr/svtabbx \
+ svtools/source/contnr/svtreebx \
+ svtools/source/contnr/templwin \
+ svtools/source/contnr/tooltiplbox \
+ svtools/source/contnr/treelist \
+ svtools/source/control/asynclink \
+ svtools/source/control/calendar \
+ svtools/source/control/collatorres \
+ svtools/source/control/ctrlbox \
+ svtools/source/control/ctrldll \
+ svtools/source/control/ctrltool \
+ svtools/source/control/filectrl \
+ svtools/source/control/filectrl2 \
+ svtools/source/control/fileurlbox \
+ svtools/source/control/fixedhyper \
+ svtools/source/control/fmtfield \
+ svtools/source/control/headbar \
+ svtools/source/control/hyperlabel \
+ svtools/source/control/indexentryres \
+ svtools/source/control/inettbc \
+ svtools/source/control/prgsbar \
+ svtools/source/control/roadmap \
+ svtools/source/control/ruler \
+ svtools/source/control/scriptedtext \
+ svtools/source/control/scrwin \
+ svtools/source/control/stdctrl \
+ svtools/source/control/stdmenu \
+ svtools/source/control/tabbar \
+ svtools/source/control/taskbar \
+ svtools/source/control/taskbox \
+ svtools/source/control/taskmisc \
+ svtools/source/control/taskstat \
+ svtools/source/control/toolbarmenu \
+ svtools/source/control/toolbarmenuacc \
+ svtools/source/control/urlcontrol \
+ svtools/source/control/valueacc \
+ svtools/source/control/valueset \
+ svtools/source/dialogs/addresstemplate \
+ svtools/source/dialogs/colctrl \
+ svtools/source/dialogs/colrdlg \
+ svtools/source/dialogs/filedlg \
+ svtools/source/dialogs/filedlg2 \
+ svtools/source/dialogs/insdlg \
+ svtools/source/dialogs/mcvmath \
+ svtools/source/dialogs/printdlg \
+ svtools/source/dialogs/prnsetup \
+ svtools/source/dialogs/property \
+ svtools/source/dialogs/roadmapwizard \
+ svtools/source/dialogs/wizardmachine \
+ svtools/source/dialogs/wizdlg \
+ svtools/source/edit/editsyntaxhighlighter \
svtools/source/edit/svmedit \
svtools/source/edit/svmedit2 \
- svtools/source/edit/textundo \
- svtools/source/edit/syntaxhighlight \
- svtools/source/edit/textwindowpeer \
svtools/source/edit/sychconv \
- svtools/source/edit/xtextedt \
- svtools/source/edit/txtattr \
+ svtools/source/edit/syntaxhighlight \
+ svtools/source/edit/textdata \
svtools/source/edit/textdoc \
svtools/source/edit/texteng \
- svtools/source/edit/textdata \
- svtools/source/edit/editsyntaxhighlighter \
+ svtools/source/edit/textundo \
svtools/source/edit/textview \
- svtools/source/urlobj/inetimg \
- svtools/source/java/javainteractionhandler \
+ svtools/source/edit/textwindowpeer \
+ svtools/source/edit/txtattr \
+ svtools/source/edit/xtextedt \
+ svtools/source/filter.vcl/filter/FilterConfigCache \
+ svtools/source/filter.vcl/filter/FilterConfigItem \
+ svtools/source/filter.vcl/filter/SvFilterOptionsDialog \
+ svtools/source/filter.vcl/filter/dlgejpg \
+ svtools/source/filter.vcl/filter/dlgepng \
+ svtools/source/filter.vcl/filter/dlgexpor \
+ svtools/source/filter.vcl/filter/filter \
+ svtools/source/filter.vcl/filter/filter2 \
+ svtools/source/filter.vcl/filter/fldll \
+ svtools/source/filter.vcl/filter/sgfbram \
+ svtools/source/filter.vcl/filter/sgvmain \
+ svtools/source/filter.vcl/filter/sgvspln \
+ svtools/source/filter.vcl/filter/sgvtext \
+ svtools/source/filter.vcl/igif/decode \
+ svtools/source/filter.vcl/igif/gifread \
+ svtools/source/filter.vcl/ixbm/xbmread \
+ svtools/source/filter.vcl/ixpm/xpmread \
+ svtools/source/filter.vcl/jpeg/jpeg \
+ svtools/source/filter.vcl/wmf/emfwr \
+ svtools/source/filter.vcl/wmf/enhwmf \
+ svtools/source/filter.vcl/wmf/winmtf \
+ svtools/source/filter.vcl/wmf/winwmf \
+ svtools/source/filter.vcl/wmf/wmf \
+ svtools/source/filter.vcl/wmf/wmfwr \
+ svtools/source/graphic/descriptor \
+ svtools/source/graphic/graphic \
+ svtools/source/graphic/graphicunofactory \
+ svtools/source/graphic/grfattr \
+ svtools/source/graphic/grfcache \
+ svtools/source/graphic/grfmgr \
+ svtools/source/graphic/grfmgr2 \
+ svtools/source/graphic/provider \
+ svtools/source/graphic/renderer \
+ svtools/source/graphic/transformer \
svtools/source/java/javacontext \
- svtools/source/svhtml/htmlout \
- svtools/source/svhtml/htmlsupp \
- svtools/source/svhtml/parhtml \
- svtools/source/svhtml/htmlkywd \
- svtools/source/config/itemholder2 \
- svtools/source/config/optionsdrawinglayer \
- svtools/source/config/menuoptions \
- svtools/source/config/helpopt \
- svtools/source/config/htmlcfg \
- svtools/source/config/accessibilityoptions \
- svtools/source/config/printoptions \
- svtools/source/config/miscopt \
- svtools/source/config/extcolorcfg \
- svtools/source/config/colorcfg \
- svtools/source/config/fontsubstconfig \
- svtools/source/config/apearcfg \
+ svtools/source/java/javainteractionhandler \
svtools/source/misc/acceleratorexecute \
svtools/source/misc/chartprettypainter \
svtools/source/misc/cliplistener \
@@ -136,137 +234,60 @@ $(eval $(call gb_Library_add_exception_objects,svt,\
svtools/source/misc/svtaccessiblefactory \
svtools/source/misc/svtdata \
svtools/source/misc/templatefoldercache \
- svtools/source/misc/transfer2 \
svtools/source/misc/transfer \
+ svtools/source/misc/transfer2 \
svtools/source/misc/unitconv \
svtools/source/misc/wallitem \
+ svtools/source/misc/xwindowitem \
svtools/source/plugapp/ttprops \
- svtools/source/control/ctrlbox \
- svtools/source/control/valueacc \
- svtools/source/control/valueset \
- svtools/source/control/taskbar \
- svtools/source/control/urlcontrol \
- svtools/source/control/scriptedtext \
- svtools/source/control/headbar \
- svtools/source/control/fileurlbox \
- svtools/source/control/fmtfield \
- svtools/source/control/collatorres \
- svtools/source/control/indexentryres \
- svtools/source/control/filectrl \
- svtools/source/control/scrwin \
- svtools/source/control/taskbox \
- svtools/source/control/hyperlabel \
- svtools/source/control/filectrl2 \
- svtools/source/control/fixedhyper \
- svtools/source/control/taskstat \
- svtools/source/control/inettbc \
- svtools/source/control/calendar \
- svtools/source/control/roadmap \
- svtools/source/control/ctrltool \
- svtools/source/control/asynclink \
- svtools/source/control/stdctrl \
- svtools/source/control/ctrldll \
- svtools/source/control/tabbar \
- svtools/source/control/ruler \
- svtools/source/control/stdmenu \
- svtools/source/control/prgsbar \
- svtools/source/control/taskmisc \
- svtools/source/dialogs/insdlg \
- svtools/source/dialogs/roadmapwizard \
- svtools/source/dialogs/mcvmath \
- svtools/source/dialogs/logindlg \
- svtools/source/dialogs/wizdlg \
- svtools/source/dialogs/addresstemplate \
- svtools/source/dialogs/printdlg \
- svtools/source/dialogs/filedlg2 \
- svtools/source/dialogs/colctrl \
- svtools/source/dialogs/colrdlg \
- svtools/source/dialogs/wizardmachine \
- svtools/source/dialogs/prnsetup \
- svtools/source/dialogs/filedlg \
- svtools/source/dialogs/property \
- svtools/source/table/tablecontrol \
- svtools/source/table/tablegeometry \
- svtools/source/table/gridtablerenderer \
- svtools/source/table/tabledatawindow \
+ svtools/source/svhtml/htmlkywd \
+ svtools/source/svhtml/htmlout \
+ svtools/source/svhtml/htmlsupp \
+ svtools/source/svhtml/parhtml \
+ svtools/source/svrtf/parrtf \
+ svtools/source/svrtf/rtfkeywd \
+ svtools/source/svrtf/rtfout \
+ svtools/source/svrtf/svparser \
svtools/source/table/defaultinputhandler \
+ svtools/source/table/gridtablerenderer \
+ svtools/source/table/tablecontrol \
svtools/source/table/tablecontrol_impl \
- svtools/source/contnr/svlbox \
- svtools/source/contnr/svtabbx \
- svtools/source/contnr/ivctrl \
- svtools/source/contnr/templwin \
- svtools/source/contnr/svicnvw \
- svtools/source/contnr/contentenumeration \
- svtools/source/contnr/svimpbox \
- svtools/source/contnr/imivctl1 \
- svtools/source/contnr/svtreebx \
- svtools/source/contnr/fileview \
- svtools/source/contnr/svimpicn \
- svtools/source/contnr/svlbitm \
- svtools/source/contnr/ctrdll \
- svtools/source/contnr/tooltiplbox \
- svtools/source/contnr/treelist \
- svtools/source/contnr/imivctl2 \
- svtools/source/uno/unoiface \
- svtools/source/uno/genericunodialog \
- svtools/source/uno/unocontroltablemodel \
+ svtools/source/table/tabledatawindow \
+ svtools/source/table/tablegeometry \
+ svtools/source/toolpanel/drawerlayouter \
+ svtools/source/toolpanel/dummypanel \
+ svtools/source/toolpanel/paneldecklisteners \
+ svtools/source/toolpanel/paneltabbar \
+ svtools/source/toolpanel/paneltabbarpeer \
+ svtools/source/toolpanel/refbase \
+ svtools/source/toolpanel/tabbargeometry \
+ svtools/source/toolpanel/tablayouter \
+ svtools/source/toolpanel/toolpanel \
+ svtools/source/toolpanel/toolpanelcollection \
+ svtools/source/toolpanel/toolpaneldeck \
+ svtools/source/toolpanel/toolpaneldeckpeer \
+ svtools/source/toolpanel/toolpaneldrawer \
+ svtools/source/toolpanel/toolpaneldrawerpeer \
+ svtools/source/uno/addrtempuno \
svtools/source/uno/contextmenuhelper \
- svtools/source/uno/toolboxcontroller \
+ svtools/source/uno/framestatuslistener \
svtools/source/uno/generictoolboxcontroller \
- svtools/source/uno/addrtempuno \
+ svtools/source/uno/genericunodialog \
svtools/source/uno/miscservices \
+ svtools/source/uno/popupmenucontrollerbase \
+ svtools/source/uno/popupwindowcontroller \
svtools/source/uno/statusbarcontroller \
svtools/source/uno/svtxgridcontrol \
- svtools/source/uno/unoimap \
- svtools/source/uno/unoevent \
+ svtools/source/uno/toolboxcontroller \
svtools/source/uno/treecontrolpeer \
- svtools/source/uno/framestatuslistener \
- svtools/source/brwbox/editbrowsebox \
- svtools/source/brwbox/brwhead \
- svtools/source/brwbox/brwbox3 \
- svtools/source/brwbox/brwbox1 \
- svtools/source/brwbox/ebbcontrols \
- svtools/source/brwbox/brwbox2 \
- svtools/source/brwbox/datwin \
- svtools/source/brwbox/editbrowsebox2 \
- svtools/source/svrtf/rtfkeywd \
- svtools/source/svrtf/svparser \
- svtools/source/svrtf/parrtf \
- svtools/source/svrtf/rtfout \
- svtools/source/filter.vcl/filter/dlgepng \
- svtools/source/filter.vcl/filter/filter2 \
- svtools/source/filter.vcl/filter/FilterConfigItem \
- svtools/source/filter.vcl/filter/sgvspln \
- svtools/source/filter.vcl/filter/filter \
- svtools/source/filter.vcl/filter/sgvtext \
- svtools/source/filter.vcl/filter/sgfbram \
- svtools/source/filter.vcl/filter/SvFilterOptionsDialog \
- svtools/source/filter.vcl/filter/dlgexpor \
- svtools/source/filter.vcl/filter/fldll \
- svtools/source/filter.vcl/filter/sgvmain \
- svtools/source/filter.vcl/filter/FilterConfigCache \
- svtools/source/filter.vcl/filter/dlgejpg \
- svtools/source/filter.vcl/wmf/winwmf \
- svtools/source/filter.vcl/wmf/winmtf \
- svtools/source/filter.vcl/wmf/emfwr \
- svtools/source/filter.vcl/wmf/wmf \
- svtools/source/filter.vcl/wmf/enhwmf \
- svtools/source/filter.vcl/wmf/wmfwr \
- svtools/source/filter.vcl/igif/decode \
- svtools/source/filter.vcl/igif/gifread \
- svtools/source/filter.vcl/ixbm/xbmread \
- svtools/source/filter.vcl/jpeg/jpeg \
- svtools/source/filter.vcl/ixpm/xpmread \
- svtools/source/graphic/descriptor \
- svtools/source/graphic/graphic \
- svtools/source/graphic/graphicunofactory \
- svtools/source/graphic/grfattr \
- svtools/source/graphic/grfcache \
- svtools/source/graphic/grfmgr \
- svtools/source/graphic/grfmgr2 \
- svtools/source/graphic/provider \
- svtools/source/graphic/renderer \
- svtools/source/graphic/transformer \
+ svtools/source/uno/unocontroltablemodel \
+ svtools/source/uno/unoevent \
+ svtools/source/uno/unoiface \
+ svtools/source/uno/unoimap \
+ svtools/source/uno/wizard/unowizard \
+ svtools/source/uno/wizard/wizardpagecontroller \
+ svtools/source/uno/wizard/wizardshell \
+ svtools/source/urlobj/inetimg \
))
$(eval $(call gb_Library_add_cobjects,svt,\
diff --git a/svtools/Package_inc.mk b/svtools/Package_inc.mk
index f47251f31590..cc767b803ede 100644
--- a/svtools/Package_inc.mk
+++ b/svtools/Package_inc.mk
@@ -105,7 +105,6 @@ $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/javacontext.hxx,svtool
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/javainteractionhandler.hxx,svtools/javainteractionhandler.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/langtab.hxx,svtools/langtab.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/localresaccess.hxx,svtools/localresaccess.hxx))
-$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/logindlg.hxx,svtools/logindlg.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/menuoptions.hxx,svtools/menuoptions.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/miscopt.hxx,svtools/miscopt.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/optionsdrawinglayer.hxx,svtools/optionsdrawinglayer.hxx))
@@ -178,3 +177,4 @@ $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/wizardmachine.hxx,svto
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/wizdlg.hxx,svtools/wizdlg.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/wmf.hxx,svtools/wmf.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/xtextedt.hxx,svtools/xtextedt.hxx))
+$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/svtools.hrc,svtools/svtools.hrc))
diff --git a/svtools/inc/svtools/accessiblefactory.hxx b/svtools/inc/svtools/accessiblefactory.hxx
index b435d3da96a7..9606e93a2fa0 100644..100755
--- a/svtools/inc/svtools/accessiblefactory.hxx
+++ b/svtools/inc/svtools/accessiblefactory.hxx
@@ -61,6 +61,10 @@ namespace svt
{
//........................................................................
+ class ToolPanelDeck;
+ class IToolPanelDeck;
+ class PanelTabBar;
+
/** a function which is able to create a factory for the standard Accessible/Context
components needed for standard toolkit controls
@@ -162,6 +166,18 @@ namespace svt
sal_Int32 _nRowPos,
sal_uInt16 _nColPos
) const = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleToolPanelDeck(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent,
+ ::svt::ToolPanelDeck& i_rPanelDeck
+ ) = 0;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleToolPanelTabBar(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent,
+ ::svt::IToolPanelDeck& i_rPanelDeck,
+ ::svt::PanelTabBar& i_rTabBar
+ ) = 0;
};
//........................................................................
diff --git a/svtools/inc/svtools/accessibletable.hxx b/svtools/inc/svtools/accessibletable.hxx
index b08a7f04f1da..8ff17a2b71c7 100755
--- a/svtools/inc/svtools/accessibletable.hxx
+++ b/svtools/inc/svtools/accessibletable.hxx
@@ -94,13 +94,12 @@ public:
virtual ::rtl::OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const= 0;
/** Fills the StateSet with all states (except DEFUNC and SHOWING, done by
- the accessible object), depending on the specified object type. */
- virtual void FillAccessibleStateSet(
- ::utl::AccessibleStateSetHelper& rStateSet,
+ the accessible object), depending on the specified object type. */
+ virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& rStateSet,
AccessibleTableControlObjType eObjType ) const= 0;
// Window
- virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) = 0;
+ virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const = 0;
virtual void GrabFocus()= 0;
virtual XACC GetAccessible( BOOL bCreate = TRUE )= 0;
virtual Window* GetAccessibleParentWindow() const= 0;
@@ -122,8 +121,10 @@ public:
virtual ::rtl::OUString GetRowName(sal_Int32 _nIndex) const = 0;
virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const = 0;
virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const = 0;
- virtual ::rtl::OUString GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) 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;
};
// ----------------------------------------------------------------------------
diff --git a/svtools/inc/svtools/accessibletableprovider.hxx b/svtools/inc/svtools/accessibletableprovider.hxx
index fd29c72f35be..d14aecce9f58 100644
--- a/svtools/inc/svtools/accessibletableprovider.hxx
+++ b/svtools/inc/svtools/accessibletableprovider.hxx
@@ -132,7 +132,7 @@ public:
virtual BOOL GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector ) = 0;
// Window
- virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) = 0;
+ virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const = 0;
virtual void GrabFocus() = 0;
virtual XACC GetAccessible( BOOL bCreate = TRUE ) = 0;
virtual Window* GetAccessibleParentWindow() const = 0;
diff --git a/svtools/inc/svtools/brwbox.hxx b/svtools/inc/svtools/brwbox.hxx
index 9adeaf7efd05..42fb4b4d36ac 100644
--- a/svtools/inc/svtools/brwbox.hxx
+++ b/svtools/inc/svtools/brwbox.hxx
@@ -96,8 +96,6 @@ typedef ULONG BrowserMode;
#define BROWSER_HIGHLIGHT_NONE 0x0100 // == BROWSER_HIDESELECT
#define BROWSER_HIGHLIGHT_TOGGLE 0x00000000 // old default => NULL, dont use!
-#define BROWSER_HIGHLIGHT_AUTO 0x00010000
-#define BROWSER_HIGHLIGHT_MANU 0x00020000
#define BROWSER_HEADERBAR_NEW 0x00040000
#define BROWSER_AUTOSIZE_LASTCOL 0x00080000
@@ -848,7 +846,7 @@ public:
virtual sal_Bool IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumn ) const;
virtual String GetAccessibleCellText(long _nRow, USHORT _nColPos) const;
virtual BOOL GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector );
- virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow );
+ virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const;
virtual void GrabFocus();
virtual XACC GetAccessible( BOOL bCreate = TRUE );
virtual Window* GetAccessibleParentWindow() const;
diff --git a/svtools/inc/svtools/filter.hxx b/svtools/inc/svtools/filter.hxx
index 770e81b00551..49ec77adfea5 100644
--- a/svtools/inc/svtools/filter.hxx
+++ b/svtools/inc/svtools/filter.hxx
@@ -62,6 +62,8 @@ class Graphic;
#define GRFILTER_ABORT 6
#define GRFILTER_TOOBIG 7
+#define GRFILTER_OUTHINT_GREY 1
+
#define GRFILTER_FORMAT_NOTFOUND ((USHORT)0xFFFF)
#define GRFILTER_FORMAT_DONTKNOW ((USHORT)0xFFFF)
@@ -323,7 +325,7 @@ protected:
sal_Bool bDummy2;
sal_Bool bDummy3;
sal_Bool bDummy4;
- long nDummy1;
+ long nExpGraphHint;
long nDummy2;
void* pDummy1;
void* pDummy2;
@@ -374,6 +376,7 @@ public:
USHORT ExportGraphic( const Graphic& rGraphic, const String& rPath,
SvStream& rOStm, USHORT nFormat = GRFILTER_FORMAT_DONTKNOW,
const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* pFilterData = NULL );
+ long GetExportGraphicHint() const { return nExpGraphHint; }
USHORT CanImportGraphic( const INetURLObject& rPath,
USHORT nFormat = GRFILTER_FORMAT_DONTKNOW,
diff --git a/svtools/inc/svtools/logindlg.hxx b/svtools/inc/svtools/logindlg.hxx
deleted file mode 100644
index 9cf12dd70610..000000000000
--- a/svtools/inc/svtools/logindlg.hxx
+++ /dev/null
@@ -1,118 +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_LOGINDLG_HXX_
-#define _SVTOOLS_LOGINDLG_HXX_
-
-#include "svtools/svtdllapi.h"
-#include <svtools/stdctrl.hxx>
-#ifndef _SV_BUTTON_HXX
-#include <vcl/button.hxx>
-#endif
-#include <vcl/dialog.hxx>
-#include <vcl/edit.hxx>
-#include <vcl/fixed.hxx>
-
-//============================================================================
-#define LF_NO_PATH 0x0001 // hide "path"
-#define LF_NO_USERNAME 0x0002 // hide "name"
-#define LF_NO_PASSWORD 0x0004 // hide "password"
-#define LF_NO_SAVEPASSWORD 0x0008 // hide "save password"
-#define LF_NO_ERRORTEXT 0x0010 // hide message
-#define LF_PATH_READONLY 0x0020 // "path" readonly
-#define LF_USERNAME_READONLY 0x0040 // "name" readonly
-#define LF_NO_ACCOUNT 0x0080 // hide "account"
-
-//............................................................................
-namespace svt
-{
-//............................................................................
-
-//============================================================================
-class SVT_DLLPUBLIC LoginDialog : public ModalDialog
-{
- FixedInfo aErrorInfo;
- FixedLine aErrorGB;
- FixedInfo aRequestInfo;
- FixedText aPathFT;
- Edit aPathED;
- FixedInfo aPathInfo;
- PushButton aPathBtn;
- FixedText aNameFT;
- Edit aNameED;
- FixedInfo aNameInfo;
- FixedText aPasswordFT;
- Edit aPasswordED;
- FixedText aAccountFT;
- Edit aAccountED;
- CheckBox aSavePasswdBtn;
- FixedLine aLoginGB;
- OKButton aOKBtn;
- CancelButton aCancelBtn;
- HelpButton aHelpBtn;
-
- SVT_DLLPRIVATE void HideControls_Impl( USHORT nFlags );
-
- DECL_DLLPRIVATE_LINK( OKHdl_Impl, OKButton * );
- DECL_DLLPRIVATE_LINK( PathHdl_Impl, PushButton * );
-
-public:
- LoginDialog( Window* pParent, USHORT nFlags,
- const String& rServer, const String* pRealm = NULL );
-
- String GetPath() const { return aPathED.GetText(); }
- void SetPath( const String& rNewPath )
- { aPathED.SetText( rNewPath );
- aPathInfo.SetText( rNewPath );}
- String GetName() const { return aNameED.GetText(); }
- void SetName( const String& rNewName );
- String GetPassword() const { return aPasswordED.GetText(); }
- void SetPassword( const String& rNew )
- { aPasswordED.SetText( rNew ); }
- String GetAccount() const { return aAccountED.GetText(); }
- void SetAccount( const String& rNew )
- { aAccountED.SetText( rNew ); }
- BOOL IsSavePassword() const
- { return aSavePasswdBtn.IsChecked(); }
- void SetSavePassword( BOOL bSave )
- { aSavePasswdBtn.Check( bSave ); }
- void SetSavePasswordText( const String& rTxt )
- { aSavePasswdBtn.SetText( rTxt ); }
- void SetErrorText( const String& rTxt )
- { aErrorInfo.SetText( rTxt ); }
- void SetLoginRequestText( const String& rTxt )
- { aRequestInfo.SetText( rTxt ); }
- void ClearPassword();
- void ClearAccount();
-};
-
-//............................................................................
-} // namespace svt
-//............................................................................
-
-#endif // _SVTOOLS_LOGINDLG_HXX_
-
diff --git a/svtools/inc/svtools/popupmenucontrollerbase.hxx b/svtools/inc/svtools/popupmenucontrollerbase.hxx
new file mode 100644
index 000000000000..b062234a512e
--- /dev/null
+++ b/svtools/inc/svtools/popupmenucontrollerbase.hxx
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * 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_POPUPMENUCONTROLLERBASE_HXX_
+#define __SVTOOLS_POPUPMENUCONTROLLERBASE_HXX_
+
+#include "svtools/svtdllapi.h"
+
+//_________________________________________________________________________________________________________________
+// interface includes
+//_________________________________________________________________________________________________________________
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/frame/XPopupMenuController.hpp>
+#include <com/sun/star/uri/XUriReferenceFactory.hpp>
+#include <com/sun/star/uri/XUriReference.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+//_________________________________________________________________________________________________________________
+// includes of other projects
+//_________________________________________________________________________________________________________________
+#include <toolkit/awt/vclxmenu.hxx>
+#include <cppuhelper/compbase7.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <cppuhelper/weak.hxx>
+#include <rtl/ustring.hxx>
+
+namespace svt
+{
+ struct PopupMenuControllerBaseDispatchInfo;
+
+ typedef ::cppu::WeakComponentImplHelper7<
+ com::sun::star::lang::XServiceInfo ,
+ com::sun::star::frame::XPopupMenuController ,
+ com::sun::star::lang::XInitialization ,
+ com::sun::star::frame::XStatusListener ,
+ com::sun::star::awt::XMenuListener ,
+ com::sun::star::frame::XDispatchProvider ,
+ com::sun::star::frame::XDispatch > PopupMenuControllerBaseType;
+
+ class SVT_DLLPUBLIC PopupMenuControllerBase : protected ::comphelper::OBaseMutex, // Struct for right initalization of mutex member! Must be first of baseclasses.
+ public PopupMenuControllerBaseType
+ {
+ public:
+ PopupMenuControllerBase( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
+ virtual ~PopupMenuControllerBase();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+ 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) = 0;
+
+ // XPopupMenuController
+ virtual void SAL_CALL setPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& PopupMenu ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updatePopupMenu() 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);
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) = 0;
+
+ // XMenuListener
+ virtual void SAL_CALL highlight( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deactivate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XDispatchProvider
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& sTarget, sal_Int32 nFlags ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& lDescriptor ) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XDispatch
+ virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& seqProperties ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) 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 );
+
+ void dispatchCommand( const ::rtl::OUString& sCommandURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs );
+
+ protected:
+ void throwIfDisposed() throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** helper method to cause statusChanged is called once for the given command url */
+ void SAL_CALL updateCommand( const rtl::OUString& rCommandURL );
+
+ /** this function is called upon disposing the component
+ */
+ virtual void SAL_CALL disposing();
+
+ virtual void resetPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu );
+ virtual void impl_setPopupMenu();
+ virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL);
+ ::rtl::OUString determineBaseURL( const ::rtl::OUString& aURL );
+
+ DECL_STATIC_LINK( PopupMenuControllerBase, ExecuteHdl_Impl, PopupMenuControllerBaseDispatchInfo* );
+
+
+ bool m_bInitialized;
+ rtl::OUString m_aCommandURL;
+ rtl::OUString m_aBaseURL;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xDispatch;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > m_xPopupMenu;
+ };
+}
+
+#endif // __SVTOOLS_POPUPMENUCONTROLLERBASE_HXX_
diff --git a/svtools/inc/svtools/popupwindowcontroller.hxx b/svtools/inc/svtools/popupwindowcontroller.hxx
new file mode 100644
index 000000000000..4877d0184318
--- /dev/null
+++ b/svtools/inc/svtools/popupwindowcontroller.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 __SVTOOLS_POPUPWINDOWCONTROLLER_HXX_
+#define __SVTOOLS_POPUPWINDOWCONTROLLER_HXX_
+
+#include "svtools/svtdllapi.h"
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+#include "svtools/toolboxcontroller.hxx"
+#include "boost/scoped_ptr.hpp"
+
+class Window;
+
+namespace svt
+{
+class PopupWindowControllerImpl;
+
+class SVT_DLLPUBLIC PopupWindowController : public svt::ToolboxController, public ::com::sun::star::lang::XServiceInfo
+{
+public:
+ PopupWindowController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
+ const rtl::OUString& aCommandURL );
+ ~PopupWindowController();
+
+ virtual ::Window* createPopupWindow( ::Window* pParent ) = 0;
+
+ // 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 ();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ) = 0;
+ 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 ) = 0;
+
+ // 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);
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XToolbarController
+ virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException);
+private:
+ boost::scoped_ptr< PopupWindowControllerImpl > mpImpl;
+};
+
+} // namespace svt
+
+#endif // __SVTOOLS_POPUPWINDOWCONTROLLER_HXX_
diff --git a/svtools/inc/svtools/roadmapwizard.hxx b/svtools/inc/svtools/roadmapwizard.hxx
index 49a0f441c49c..5d8e0d9b01bb 100644
--- a/svtools/inc/svtools/roadmapwizard.hxx
+++ b/svtools/inc/svtools/roadmapwizard.hxx
@@ -80,6 +80,11 @@ namespace svt
const ResId& _rRes,
sal_uInt32 _nButtonFlags = WZB_NEXT | WZB_PREVIOUS | WZB_FINISH | WZB_CANCEL | WZB_HELP
);
+ RoadmapWizard(
+ Window* _pParent,
+ const WinBits i_nStyle,
+ sal_uInt32 _nButtonFlags = WZB_NEXT | WZB_PREVIOUS | WZB_FINISH | WZB_CANCEL | WZB_HELP
+ );
~RoadmapWizard( );
void SetRoadmapBitmap( const BitmapEx& _rBitmap );
@@ -137,7 +142,7 @@ protected:
You can only activate paths which share the first <code>k</code> states with the path
which is previously active (if any), where <code>k</code> is the index of the
- current state within the current page.
+ current state within the current path.
<example>
Say you have paths, <code>(0,1,2,5)</code> and <code>(0,1,4,5)</code>. This means that after
@@ -197,6 +202,10 @@ protected:
*/
void enableState( WizardState _nState, bool _bEnable = true );
+ /** returns true if and only if the given state is known in at least one declared path
+ */
+ bool knowsState( WizardState _nState ) const;
+
// OWizardMachine overriables
virtual void enterState( WizardState _nState );
@@ -230,13 +239,15 @@ protected:
private:
SVT_DLLPRIVATE void ResizeFixedLine();
- private:
DECL_DLLPRIVATE_LINK( OnRoadmapItemSelected, void* );
/** updates the roadmap control to show the given path, as far as possible
(modulo conflicts with other paths)
*/
SVT_DLLPRIVATE void implUpdateRoadmap( );
+
+ private:
+ SVT_DLLPRIVATE void impl_construct();
};
//........................................................................
diff --git a/svtools/inc/svtools/svtabbx.hxx b/svtools/inc/svtools/svtabbx.hxx
index 8b8092260e33..89fd92a4fc09 100644
--- a/svtools/inc/svtools/svtabbx.hxx
+++ b/svtools/inc/svtools/svtabbx.hxx
@@ -251,7 +251,7 @@ public:
virtual BOOL GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector );
// Window
- virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow );
+ virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const;
virtual void GrabFocus();
virtual XACC GetAccessible( BOOL bCreate = TRUE );
virtual Window* GetAccessibleParentWindow() const;
diff --git a/svl/inc/svl/svtools.hrc b/svtools/inc/svtools/svtools.hrc
index a95f09662860..67607e1d281e 100644
--- a/svl/inc/svl/svtools.hrc
+++ b/svtools/inc/svtools/svtools.hrc
@@ -2,10 +2,13 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
+ * $RCSfile: svtools.hrc,v $
+ * $Revision: 1.7 $
+ *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -87,7 +90,6 @@
#define STR_SVT_SAMPLES_HELP (RID_SVTOOLS_START+66)
#define STR_WARNING_ITEM (RID_SVTOOLS_START+90)
-#define STR_COLUM_DT_AUTO (RID_SVTOOLS_START+99)
#define CONFIG_BASIC_FORMAT_START (RID_SVTOOLS_START+102)
#define STR_BASICKEY_FORMAT_ON (RID_SVTOOLS_START+103)
@@ -101,6 +103,7 @@
#define STR_REDO (RID_SVTOOLS_START+111)
#define STR_REPEAT (RID_SVTOOLS_START+112)
+
#define STR_INVALIDTRYBUY (RID_SVTOOLS_START+120)
#define STR_OLDTRYBUY (RID_SVTOOLS_START+121)
#define STR_TRYBUY (RID_SVTOOLS_START+122)
@@ -122,127 +125,7 @@
#define STR_KEYERR_INVALID_CNR (RID_SVTOOLS_START+139)
#define RID_LIMITED_DIALOG (RID_SVTOOLS_START+140)
-#define STR_SVT_MIMETYPE_START (RID_SVTOOLS_START+141)
-#define STR_SVT_MIMETYPE_APP_OCTSTREAM (STR_SVT_MIMETYPE_START+0)
-#define STR_SVT_MIMETYPE_APP_PDF (STR_SVT_MIMETYPE_START+1)
-#define STR_SVT_MIMETYPE_APP_RTF (STR_SVT_MIMETYPE_START+2)
-#define STR_SVT_MIMETYPE_APP_MSWORD (STR_SVT_MIMETYPE_START+3)
-#define STR_SVT_MIMETYPE_APP_STARCALC (STR_SVT_MIMETYPE_START+4)
-#define STR_SVT_MIMETYPE_APP_STARCHART (STR_SVT_MIMETYPE_START+5)
-#define STR_SVT_MIMETYPE_APP_STARDRAW (STR_SVT_MIMETYPE_START+6)
-#define STR_SVT_MIMETYPE_APP_STARIMAGE (STR_SVT_MIMETYPE_START+7)
-#define STR_SVT_MIMETYPE_APP_STARMATH (STR_SVT_MIMETYPE_START+8)
-#define STR_SVT_MIMETYPE_APP_STARWRITER (STR_SVT_MIMETYPE_START+9)
-#define STR_SVT_MIMETYPE_APP_ZIP (STR_SVT_MIMETYPE_START+10)
-#define STR_SVT_MIMETYPE_AUDIO_AIFF (STR_SVT_MIMETYPE_START+11)
-#define STR_SVT_MIMETYPE_AUDIO_BASIC (STR_SVT_MIMETYPE_START+12)
-#define STR_SVT_MIMETYPE_AUDIO_MIDI (STR_SVT_MIMETYPE_START+13)
-#define STR_SVT_MIMETYPE_AUDIO_WAV (STR_SVT_MIMETYPE_START+14)
-#define STR_SVT_MIMETYPE_IMAGE_GIF (STR_SVT_MIMETYPE_START+15)
-#define STR_SVT_MIMETYPE_IMAGE_JPEG (STR_SVT_MIMETYPE_START+16)
-#define STR_SVT_MIMETYPE_IMAGE_PCX (STR_SVT_MIMETYPE_START+17)
-#define STR_SVT_MIMETYPE_IMAGE_BMP (STR_SVT_MIMETYPE_START+18)
-#define STR_SVT_MIMETYPE_TEXT_HTML (STR_SVT_MIMETYPE_START+19)
-#define STR_SVT_MIMETYPE_TEXT_PLAIN (STR_SVT_MIMETYPE_START+20)
-#define STR_SVT_MIMETYPE_TEXT_URL (STR_SVT_MIMETYPE_START+21)
-#define STR_SVT_MIMETYPE_TEXT_VCARD (STR_SVT_MIMETYPE_START+22)
-#define STR_SVT_MIMETYPE_VIDEO_VDO (STR_SVT_MIMETYPE_START+23)
-#define STR_SVT_MIMETYPE_VIDEO_MSVIDEO (STR_SVT_MIMETYPE_START+24)
-#define STR_SVT_MIMETYPE_X_STARMAIL (STR_SVT_MIMETYPE_START+25)
-#define STR_SVT_MIMETYPE_X_VRML (STR_SVT_MIMETYPE_START+26)
-#define STR_SVT_MIMETYPE_APP_STARHELP (STR_SVT_MIMETYPE_START+27)
-#define STR_SVT_MIMETYPE_APP_STARIMPRESS (STR_SVT_MIMETYPE_START+28)
-#define STR_SVT_MIMETYPE_APP_SCHED_CMB (STR_SVT_MIMETYPE_START+29)
-#define STR_SVT_MIMETYPE_APP_SCHED_EVT (STR_SVT_MIMETYPE_START+30)
-#define STR_SVT_MIMETYPE_APP_SCHED_TASK (STR_SVT_MIMETYPE_START+31)
-#define STR_SVT_MIMETYPE_APP_SCHED_TVIEW (STR_SVT_MIMETYPE_START+32)
-
-#define STR_SVT_MIMETYPE_CNT_MSG (STR_SVT_MIMETYPE_START+33)
-#define STR_SVT_MIMETYPE_CNT_DOCUMENT (STR_SVT_MIMETYPE_START+34)
-#define STR_SVT_MIMETYPE_CNT_POP3BOX (STR_SVT_MIMETYPE_START+35)
-#define STR_SVT_MIMETYPE_CNT_IMAPBOX (STR_SVT_MIMETYPE_START+36)
-#define STR_SVT_MIMETYPE_CNT_IMAPFLD (STR_SVT_MIMETYPE_START+37)
-#define STR_SVT_MIMETYPE_CNT_VIMBOX (STR_SVT_MIMETYPE_START+38)
-#define STR_SVT_MIMETYPE_CNT_VIMINBOX (STR_SVT_MIMETYPE_START+39)
-#define STR_SVT_MIMETYPE_CNT_BBBOX (STR_SVT_MIMETYPE_START+40)
-#define STR_SVT_MIMETYPE_CNT_VIM_BB (STR_SVT_MIMETYPE_START+41)
-#define STR_SVT_MIMETYPE_CNT_NEWSBOX (STR_SVT_MIMETYPE_START+42)
-#define STR_SVT_MIMETYPE_CNT_NEWSGRP (STR_SVT_MIMETYPE_START+43)
-#define STR_SVT_MIMETYPE_CNT_OUTBOX (STR_SVT_MIMETYPE_START+44)
-#define STR_SVT_MIMETYPE_CNT_FTPBOX (STR_SVT_MIMETYPE_START+45)
-#define STR_SVT_MIMETYPE_CNT_FTPFLD (STR_SVT_MIMETYPE_START+46)
-#define STR_SVT_MIMETYPE_CNT_FTPFILE (STR_SVT_MIMETYPE_START+47)
-#define STR_SVT_MIMETYPE_CNT_FTPLINK (STR_SVT_MIMETYPE_START+48)
-#define STR_SVT_MIMETYPE_CNT_HTTPBOX (STR_SVT_MIMETYPE_START+49)
-#define STR_SVT_MIMETYPE_CNT_FSYSBOX (STR_SVT_MIMETYPE_START+50)
-#define STR_SVT_MIMETYPE_CNT_FSYSFLD (STR_SVT_MIMETYPE_START+51)
-#define STR_SVT_MIMETYPE_CNT_FSYSFILE (STR_SVT_MIMETYPE_START+52)
-#define STR_SVT_MIMETYPE_CNT_FSYSURLFILE (STR_SVT_MIMETYPE_START+53)
-#define STR_SVT_MIMETYPE_CNT_PUBLBOX (STR_SVT_MIMETYPE_START+54)
-#define STR_SVT_MIMETYPE_CNT_SRCHBOX (STR_SVT_MIMETYPE_START+55)
-#define STR_SVT_MIMETYPE_CNT_SUBSCRBOX (STR_SVT_MIMETYPE_START+56)
-#define STR_SVT_MIMETYPE_CNT_BOOKMARK (STR_SVT_MIMETYPE_START+57)
-#define STR_SVT_MIMETYPE_CNT_CDF (STR_SVT_MIMETYPE_START+58)
-#define STR_SVT_MIMETYPE_CNT_CDFSUB (STR_SVT_MIMETYPE_START+59)
-#define STR_SVT_MIMETYPE_CNT_CDFITEM (STR_SVT_MIMETYPE_START+60)
-#define STR_SVT_MIMETYPE_CNT_STARCHANNEL (STR_SVT_MIMETYPE_START+61)
-#define STR_SVT_MIMETYPE_CNT_TRASHBOX (STR_SVT_MIMETYPE_START+62)
-#define STR_SVT_MIMETYPE_CNT_TRASH (STR_SVT_MIMETYPE_START+63)
-#define STR_SVT_MIMETYPE_CNT_REMOV_VOL (STR_SVT_MIMETYPE_START+64)
-#define STR_SVT_MIMETYPE_CNT_FIX_VOL (STR_SVT_MIMETYPE_START+65)
-#define STR_SVT_MIMETYPE_CNT_REM_VOL (STR_SVT_MIMETYPE_START+66)
-#define STR_SVT_MIMETYPE_CNT_RAM_VOL (STR_SVT_MIMETYPE_START+67)
-#define STR_SVT_MIMETYPE_CNT_CDROM (STR_SVT_MIMETYPE_START+68)
-#define STR_SVT_MIMETYPE_CNT_DISK_35 (STR_SVT_MIMETYPE_START+69)
-#define STR_SVT_MIMETYPE_CNT_DISK_525 (STR_SVT_MIMETYPE_START+70)
-#define STR_SVT_MIMETYPE_CNT_TAPEDRIVE (STR_SVT_MIMETYPE_START+71)
-#define STR_SVT_MIMETYPE_APP_GAL (STR_SVT_MIMETYPE_START+72)
-#define STR_SVT_MIMETYPE_APP_GAL_THEME (STR_SVT_MIMETYPE_START+73)
-#define STR_SVT_MIMETYPE_CNT_SEPARATOR (STR_SVT_MIMETYPE_START+74)
-#define STR_SVT_MIMETYPE_APP_STARW_GLOB (STR_SVT_MIMETYPE_START+75)
-#define STR_SVT_MIMETYPE_APP_SDM (STR_SVT_MIMETYPE_START+76)
-#define STR_SVT_MIMETYPE_APP_SMD (STR_SVT_MIMETYPE_START+77)
-#define STR_SVT_MIMETYPE_APP_STARW_WEB (STR_SVT_MIMETYPE_START+78)
-#define STR_SVT_MIMETYPE_SCHEDULE (STR_SVT_MIMETYPE_START+79)
-#define STR_SVT_MIMETYPE_SCHEDULE_EVT (STR_SVT_MIMETYPE_START+80)
-#define STR_SVT_MIMETYPE_SCHEDULE_TASK (STR_SVT_MIMETYPE_START+81)
-#define STR_SVT_MIMETYPE_SCHEDULE_FEVT (STR_SVT_MIMETYPE_START+82)
-#define STR_SVT_MIMETYPE_SCHEDULE_FTASK (STR_SVT_MIMETYPE_START+83)
-#define STR_SVT_MIMETYPE_FRAMESET (STR_SVT_MIMETYPE_START+84)
-#define STR_SVT_MIMETYPE_MACRO (STR_SVT_MIMETYPE_START+85)
-#define STR_SVT_MIMETYPE_CNT_SFSYSFOLDER (STR_SVT_MIMETYPE_START+86)
-#define STR_SVT_MIMETYPE_CNT_SFSYSFILE (STR_SVT_MIMETYPE_START+87)
-#define STR_SVT_MIMETYPE_APP_TEMPLATE (STR_SVT_MIMETYPE_START+88)
-#define STR_SVT_MIMETYPE_IMAGE_GENERIC (STR_SVT_MIMETYPE_START+89)
-#define STR_SVT_MIMETYPE_APP_MSEXCEL (STR_SVT_MIMETYPE_START+90)
-#define STR_SVT_MIMETYPE_APP_MSEXCEL_TEMPL (STR_SVT_MIMETYPE_START+91)
-#define STR_SVT_MIMETYPE_APP_MSPPOINT (STR_SVT_MIMETYPE_START+92)
-#define STR_SVT_MIMETYPE_TEXT_VCALENDAR (STR_SVT_MIMETYPE_START+93)
-#define STR_SVT_MIMETYPE_TEXT_ICALENDAR (STR_SVT_MIMETYPE_START+94)
-#define STR_SVT_MIMETYPE_TEXT_XMLICALENDAR (STR_SVT_MIMETYPE_START+95)
-#define STR_SVT_MIMETYPE_TEXT_CDE_CALENDAR_APP (STR_SVT_MIMETYPE_START+96)
-#define STR_SVT_MIMETYPE_INET_MSG_RFC822 (STR_SVT_MIMETYPE_START+97)
-#define STR_SVT_MIMETYPE_INET_MULTI_ALTERNATIVE (STR_SVT_MIMETYPE_START+98)
-#define STR_SVT_MIMETYPE_INET_MULTI_DIGEST (STR_SVT_MIMETYPE_START+99)
-#define STR_SVT_MIMETYPE_INET_MULTI_PARALLEL (STR_SVT_MIMETYPE_START+100)
-#define STR_SVT_MIMETYPE_INET_MULTI_RELATED (STR_SVT_MIMETYPE_START+101)
-#define STR_SVT_MIMETYPE_INET_MULTI_MIXED (STR_SVT_MIMETYPE_START+102)
-#define STR_SVT_MIMETYPE_APP_IMPRESSPACKED (STR_SVT_MIMETYPE_START+103)
-#define STR_SVT_MIMETYPE_APP_JAR (STR_SVT_MIMETYPE_START+104)
-#define STR_SVT_MIMETYPE_IMAGE_PNG (STR_SVT_MIMETYPE_START+105)
-#define STR_SVT_MIMETYPE_IMAGE_TIFF (STR_SVT_MIMETYPE_START+106)
-
-#define STR_SVT_MIMETYPE_APP_SXCALC (STR_SVT_MIMETYPE_START+107)
-#define STR_SVT_MIMETYPE_APP_SXCHART (STR_SVT_MIMETYPE_START+108)
-#define STR_SVT_MIMETYPE_APP_SXDRAW (STR_SVT_MIMETYPE_START+109)
-#define STR_SVT_MIMETYPE_APP_SXMATH (STR_SVT_MIMETYPE_START+110)
-#define STR_SVT_MIMETYPE_APP_SXWRITER (STR_SVT_MIMETYPE_START+111)
-#define STR_SVT_MIMETYPE_APP_SXIMPRESS (STR_SVT_MIMETYPE_START+112)
-#define STR_SVT_MIMETYPE_APP_SXGLOBAL (STR_SVT_MIMETYPE_START+113)
-#define STR_SVT_MIMETYPE_APP_SXIPACKED (STR_SVT_MIMETYPE_START+114)
-#define STR_SVT_MIMETYPE_END (STR_SVT_MIMETYPE_APP_SXIPACKED)
-
-#define STR_SVT_PRNDLG_START (STR_SVT_MIMETYPE_END+1)
+#define STR_SVT_PRNDLG_START (RID_SVTOOLS_START+141)
#define DLG_SVT_PRNDLG_PRNSETUPDLG (STR_SVT_PRNDLG_START+0)
#define DLG_SVT_PRNDLG_PRINTDLG (STR_SVT_PRNDLG_START+1)
#define STR_SVT_PRNDLG_READY (STR_SVT_PRNDLG_START+2)
@@ -369,8 +252,8 @@
// String-Ids for accessibility
#define STR_SVT_ACC_BEGIN (STR_SVT_FILEPICKER_END+1)
- // FREE
- // FREE
+#define STR_SVT_TOOL_PANEL_BUTTON_FWD (STR_SVT_ACC_BEGIN+0)
+#define STR_SVT_TOOL_PANEL_BUTTON_BACK (STR_SVT_ACC_BEGIN+1)
#define STR_SVT_ACC_DESC_TABLISTBOX (STR_SVT_ACC_BEGIN+2)
#define STR_SVT_ACC_DESC_FILEVIEW (STR_SVT_ACC_BEGIN+3)
#define STR_SVT_ACC_DESC_FOLDER (STR_SVT_ACC_BEGIN+4)
@@ -471,6 +354,11 @@
#define RID_IMG_BITMAPFONT_HC (RID_SVTOOLS_START + 16)
#define RID_IMG_SCALABLEFONT_HC (RID_SVTOOLS_START + 17)
+#define IMG_TRIANGLE_RIGHT (RID_SVTOOLS_START + 18)
+#define IMG_TRIANGLE_RIGHT_HC (RID_SVTOOLS_START + 19)
+#define IMG_TRIANGLE_DOWN (RID_SVTOOLS_START + 20)
+#define IMG_TRIANGLE_DOWN_HC (RID_SVTOOLS_START + 21)
+
#define IMG_SVT_FOLDER (RID_SVTOOLS_START + 40)
#define IMG_SVT_NEWDOC (RID_SVTOOLS_START + 52)
diff --git a/svtools/inc/svtools/tabbar.hxx b/svtools/inc/svtools/tabbar.hxx
index cf89d4426726..e036f4c2f045 100644
--- a/svtools/inc/svtools/tabbar.hxx
+++ b/svtools/inc/svtools/tabbar.hxx
@@ -320,9 +320,6 @@ typedef USHORT TabBarPageBits;
// - TabBar-Types -
// ----------------
-#define TABBAR_APPEND ((USHORT)0xFFFF)
-#define TABBAR_PAGE_NOTFOUND ((USHORT)0xFFFF)
-
#define TABBAR_RENAMING_YES ((long)TRUE)
#define TABBAR_RENAMING_NO ((long)FALSE)
#define TABBAR_RENAMING_CANCEL ((long)2)
@@ -400,6 +397,9 @@ private:
DECL_DLLPRIVATE_LINK( ImplClickHdl, ImplTabButton* );
public:
+ static const sal_uInt16 APPEND;
+ static const sal_uInt16 PAGE_NOT_FOUND;
+
TabBar( Window* pParent, WinBits nWinStyle = WB_STDTABBAR );
virtual ~TabBar();
@@ -424,9 +424,14 @@ public:
void InsertPage( USHORT nPageId, const XubString& rText,
TabBarPageBits nBits = 0,
- USHORT nPos = TABBAR_APPEND );
+ USHORT nPos = TabBar::APPEND );
void RemovePage( USHORT nPageId );
void MovePage( USHORT nPageId, USHORT nNewPos );
+
+ Color GetTabBgColor( USHORT nPageId ) const;
+ void SetTabBgColor( USHORT nPageId, const Color& aTabBgColor );
+ BOOL IsDefaultTabBgColor( USHORT nPageId );
+
void Clear();
void EnablePage( USHORT nPageId, BOOL bEnable = TRUE );
@@ -453,7 +458,7 @@ public:
void SelectPage( USHORT nPageId, BOOL bSelect = TRUE );
void SelectPageRange( BOOL bSelect = FALSE,
USHORT nStartPos = 0,
- USHORT nEndPos = TABBAR_APPEND );
+ USHORT nEndPos = TabBar::APPEND );
USHORT GetSelectPage( USHORT nSelIndex = 0 ) const;
USHORT GetSelectPageCount() const;
BOOL IsPageSelected( USHORT nPageId ) const;
diff --git a/svtools/inc/svtools/table/abstracttablecontrol.hxx b/svtools/inc/svtools/table/abstracttablecontrol.hxx
index 8e92abc6c04c..9206f20ecbcb 100644
--- a/svtools/inc/svtools/table/abstracttablecontrol.hxx
+++ b/svtools/inc/svtools/table/abstracttablecontrol.hxx
@@ -30,6 +30,7 @@
#include <sal/types.h>
#include <vcl/event.hxx>
#include <vcl/seleng.hxx>
+#include "tabletypes.hxx"
//........................................................................
namespace svt { namespace table
{
@@ -112,14 +113,16 @@ namespace svt { namespace table
@see TableControlAction
*/
virtual bool dispatchAction( TableControlAction _eAction ) = 0;
- /** to be called on mouse button up/down
- @return
- <TRUE/> if the click was in the visible area of the table control,
- <FALSE/> otherwise.*/
- virtual bool isClickInVisibleArea( const Point& _rPoint ) = 0;
- /** returns selection engine*/
- virtual SelectionEngine* getSelEngine() = 0;
- virtual void setCursorAtCurrentCell(const Point& rPoint) = 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() {};
};
diff --git a/svtools/inc/svtools/table/defaultinputhandler.hxx b/svtools/inc/svtools/table/defaultinputhandler.hxx
index b9e2db31ca01..ca760896d539 100644
--- a/svtools/inc/svtools/table/defaultinputhandler.hxx
+++ b/svtools/inc/svtools/table/defaultinputhandler.hxx
@@ -44,6 +44,7 @@ namespace svt { namespace table
friend class TableDataWindow;
private:
DefaultInputHandler_Impl* m_pImpl;
+ bool m_bResize;
public:
DefaultInputHandler();
diff --git a/svtools/inc/svtools/table/gridtablerenderer.hxx b/svtools/inc/svtools/table/gridtablerenderer.hxx
index 13d44617d523..e474306c0423 100644
--- a/svtools/inc/svtools/table/gridtablerenderer.hxx
+++ b/svtools/inc/svtools/table/gridtablerenderer.hxx
@@ -90,10 +90,14 @@ namespace svt { namespace table
bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea,
const StyleSettings& _rStyle, rtl::OUString& _rText );
- virtual void PaintCell( ColPos _nColumn,
+ virtual void PaintCellImage( ColPos _nColumn,
bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea,
- const StyleSettings& _rStyle, rtl::OUString& _rText );
+ const StyleSettings& _rStyle, Image* _pCellData );
+ virtual void PaintCellString( ColPos _nColumn,
+ bool _bActive, bool _bSelected,
+ OutputDevice& _rDevice, const Rectangle& _rArea,
+ const StyleSettings& _rStyle, rtl::OUString& _rText );
virtual void ShowCellCursor( Window& _rView, const Rectangle& _rCursorRect);
virtual void HideCellCursor( Window& _rView, const Rectangle& _rCursorRect);
};
diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx
index c1381e3b3c0b..f3b7ed88b565 100644
--- a/svtools/inc/svtools/table/tablecontrol.hxx
+++ b/svtools/inc/svtools/table/tablecontrol.hxx
@@ -27,12 +27,14 @@
#ifndef SVTOOLS_INC_TABLE_TABLECONTROL_HXX
#define SVTOOLS_INC_TABLE_TABLECONTROL_HXX
+#include "svtools/svtdllapi.h"
#include <svtools/table/tablemodel.hxx>
#include <vcl/ctrl.hxx>
#include <vcl/seleng.hxx>
#include <svtools/table/tabledatawindow.hxx>
#include <svtools/accessibletable.hxx>
-#include "svtaccessiblefactory.hxx"
+#include <com/sun/star/util/Color.hpp>
+#include <svtools/accessiblefactory.hxx>
//........................................................................
namespace svt { namespace table
@@ -64,13 +66,20 @@ namespace svt { namespace table
// TODO: scrolling?
*/
- class TableControl : public Control, public IAccessibleTable
+ class SVT_DLLPUBLIC TableControl : public Control, public IAccessibleTable
{
private:
- DECL_LINK( ImplMouseButtonDownHdl, MouseEvent* );
- DECL_LINK( ImplMouseButtonUpHdl, MouseEvent* );
+ DECL_DLLPRIVATE_LINK( ImplMouseButtonDownHdl, MouseEvent* );
+ DECL_DLLPRIVATE_LINK( ImplMouseButtonUpHdl, MouseEvent* );
+
+ 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;
@@ -78,7 +87,7 @@ namespace svt { namespace table
~TableControl();
/// sets a new table model
- void SetModel( PTableModel _pModel );
+ SVT_DLLPRIVATE void SetModel( PTableModel _pModel );
/// retrieves the current table model
PTableModel GetModel() const;
@@ -148,66 +157,74 @@ namespace svt { namespace table
{
return GoTo( GetCurrentColumn(), _nRow );
}
- virtual void Resize();
+ 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, 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
- */
- void removeSelectedRow(RowPos _nRowPos);
- SelectionEngine* getSelEngine();
- TableDataWindow* getDataWindow();
+ /**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();
// Window overridables
virtual void GetFocus();
virtual void LoseFocus();
virtual void KeyInput( const KeyEvent& rKEvt );
- //virtual long Notify(NotifyEvent& rNEvt);
-
- /** Creates and returns the accessible object of the whole BrowseBox. */
- virtual XACC CreateAccessible();
- virtual XACC CreateAccessibleControl( sal_Int32 _nIndex );
- virtual ::rtl::OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const;
- virtual sal_Bool GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow );
- 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 );
- virtual void GrabFocus();
- virtual XACC GetAccessible( BOOL bCreate = 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, BOOL _bOnScreen = TRUE );
- virtual Rectangle calcTableRect( BOOL _bOnScreen = 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 ::rtl::OUString 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 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( BOOL bCreate = 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, BOOL _bOnScreen = TRUE );
+ virtual Rectangle calcTableRect( BOOL _bOnScreen = 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
@@ -219,27 +236,6 @@ namespace svt { namespace table
TableControl& operator=( const TableControl& ); // never implemented
};
- class AccessibleTableControl_Impl
- {
- 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( );
-
- };
-
//........................................................................
} } // namespace svt::table
//........................................................................
diff --git a/svtools/inc/svtools/table/tabledatawindow.hxx b/svtools/inc/svtools/table/tabledatawindow.hxx
index d14a25289c99..9a6ece489119 100644
--- a/svtools/inc/svtools/table/tabledatawindow.hxx
+++ b/svtools/inc/svtools/table/tabledatawindow.hxx
@@ -53,21 +53,32 @@ namespace svt { namespace table
private:
TableControl_Impl& m_rTableControl;
Link m_aMouseButtonDownHdl;
- Link m_aMouseButtonUpHdl;
-
+ Link m_aMouseButtonUpHdl;
+ Link m_aSelectHdl;
+ RowPos m_nRowAlreadySelected;
public:
TableDataWindow( TableControl_Impl& _rTableControl );
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; }
inline const Link& GetMouseButtonUpHdl() const { return m_aMouseButtonUpHdl; }
+ inline void SetSelectHdl( const Link& rLink ) { m_aSelectHdl = rLink; }
+ inline const Link& GetSelectHdl() const { return m_aSelectHdl; }
// Window overridables
virtual void Paint( const Rectangle& rRect );
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();
+ void SetBackground(const Wallpaper& rColor);
+ void SetBackground();
};
//........................................................................
} } // namespace svt::table
diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx
index 34a89cb03e6b..3da396d9d86c 100644
--- a/svtools/inc/svtools/table/tablemodel.hxx
+++ b/svtools/inc/svtools/table/tablemodel.hxx
@@ -27,13 +27,16 @@
#ifndef SVTOOLS_INC_TABLE_TABLEMODEL_HXX
#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 <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>
//........................................................................
namespace svt { namespace table
@@ -44,21 +47,16 @@ namespace svt { namespace table
//====================================================================
//= cell data
//====================================================================
- struct CellEntryType
+ struct TableContentType
{
- String m_aStr;
- //Image m_aImage;
- //Control m_aControl;
- CellEntryType( const String& _rStr ) :
- m_aStr( _rStr )
- {}
+ ::rtl::OUString sContent;
+ Image* pImage;
+ TableContentType() :
+ sContent(),
+ pImage( )
+ {
+ }
};
-
- //typedef ::std::vector<CellEntryType*> CellColumnContent;
- //vector, which contains text data for each cell
- typedef ::std::vector<String> CellColumnContent;
- //vector, which contains data for rows
- typedef ::std::vector<CellColumnContent> CellContent;
//====================================================================
//= ScrollbarVisibility
//====================================================================
@@ -285,7 +283,24 @@ 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
+ */
+ virtual TableMetrics getPreferredWidth() const = 0;
+ /** sets the preferred width of the column, to be used when user resizes column
+
+ @see getMaxWidth
+ @see setMinWidth
+ @see setWidth
+ */
+ 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() { }
};
@@ -296,7 +311,7 @@ namespace svt { namespace table
//====================================================================
/** declares the interface to implement by an abtract table model
*/
- class SAL_NO_VTABLE ITableModel
+ class SAL_NO_VTABLE SVT_DLLPUBLIC ITableModel
{
public:
/** returns the number of columns in the table
@@ -307,8 +322,8 @@ namespace svt { namespace table
*/
virtual TableSize getRowCount() const = 0;
- virtual void setColumnCount(TableSize _nColCount) = 0;
- virtual void setRowCount(TableSize _nRowCount) = 0;
+ SVT_DLLPRIVATE virtual void setColumnCount(TableSize _nColCount) = 0;
+ SVT_DLLPRIVATE virtual void setRowCount(TableSize _nRowCount) = 0;
/** determines whether the table has column headers
@@ -321,12 +336,12 @@ namespace svt { namespace table
/** sets whether the table should have row headers
@see IColumnRenderer
*/
- virtual void setRowHeaders( bool rowHeaders) = 0;
+ SVT_DLLPRIVATE virtual void setRowHeaders( bool rowHeaders) = 0;
/** sets whether the table should have column headers
@see IColumnRenderer
*/
- virtual void setColumnHeaders( bool columnHeaders) = 0;
+ SVT_DLLPRIVATE virtual void setColumnHeaders( bool columnHeaders) = 0;
/** determines whether the table has row headers
@@ -346,11 +361,11 @@ namespace svt { namespace table
/** adds the given listener to the list of ->ITableModelListener's
*/
- virtual void addTableModelListener( const PTableModelListener& listener ) = 0;
+ SVT_DLLPRIVATE virtual void addTableModelListener( const PTableModelListener& listener ) = 0;
/** revokes the given listener from the list of ->ITableModelListener's
*/
- virtual void removeTableModelListener( const PTableModelListener& listener ) = 0;
+ SVT_DLLPRIVATE virtual void removeTableModelListener( const PTableModelListener& listener ) = 0;
/** returns a model for a certain column
@@ -380,7 +395,7 @@ namespace svt { namespace table
@return the renderer to use. Must not be <NULL/>
*/
- virtual PTableRenderer getRenderer() const = 0;
+ SVT_DLLPRIVATE virtual PTableRenderer getRenderer() const = 0;
/** returns the component handling input in a view associated with the model
*/
@@ -392,9 +407,9 @@ namespace svt { namespace table
the logical height of rows in the table, in 1/100 millimeters. The height must be
greater 0.
*/
- virtual TableMetrics getRowHeight() const = 0;
+ SVT_DLLPRIVATE virtual TableMetrics getRowHeight() const = 0;
- virtual void setRowHeight(TableMetrics _nRowHeight) = 0;
+ SVT_DLLPRIVATE virtual void setRowHeight(TableMetrics _nRowHeight) = 0;
/** determines the height of the column header row
@@ -405,7 +420,7 @@ namespace svt { namespace table
the logical height of the column header row, in 1/100 millimeters.
Must be greater than 0.
*/
- virtual TableMetrics getColumnHeaderHeight() const = 0;
+ SVT_DLLPRIVATE virtual TableMetrics getColumnHeaderHeight() const = 0;
/** determines the width of the row header column
@@ -416,7 +431,7 @@ namespace svt { namespace table
the logical width of the row header column, in 1/100 millimeters.
Must be greater than 0.
*/
- virtual TableMetrics getRowHeaderWidth() const = 0;
+ SVT_DLLPRIVATE 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
@@ -429,19 +444,32 @@ namespace svt { namespace table
@param actWidth the given width of the table
*/
virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const = 0;
-
- /** fills cells with content
- */
- virtual void setCellContent(std::vector<std::vector<rtl::OUString> > cellContent)=0;
- /** gets the content of the cells
- */
- virtual std::vector<std::vector<rtl::OUString> >& getCellContent() = 0;
- /**sets title of header rows
- */
- virtual void setRowHeaderName(std::vector<rtl::OUString> cellColumnContent)=0;
- /** gets title of header rows
- */
- virtual std::vector<rtl::OUString>& getRowHeaderName() = 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;
/// destroys the table model instance
virtual ~ITableModel() { }
diff --git a/svtools/inc/svtools/table/tablerenderer.hxx b/svtools/inc/svtools/table/tablerenderer.hxx
index cf8cd20680c2..f81771dd22e6 100644
--- a/svtools/inc/svtools/table/tablerenderer.hxx
+++ b/svtools/inc/svtools/table/tablerenderer.hxx
@@ -45,7 +45,7 @@ namespace svt { namespace table
*/
class SAL_NO_VTABLE ITableRenderer
{
- public:
+ public:
/** paints a (part of) header area
There are two header areas in a table control:
@@ -178,10 +178,9 @@ namespace svt { namespace table
@param _rText
the title of the header row
*/
- virtual void PaintRowHeader(
- bool _bActive, bool _bSelected,
+ virtual void PaintRowHeader( bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea,
- const StyleSettings& _rStyle, rtl::OUString& _rText ) = 0;
+ const StyleSettings& _rStyle, rtl::OUString& _rText ) = 0;
/** paints a certain cell
@@ -208,13 +207,46 @@ 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,
+ 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 PaintCell( ColPos _nColumn,
+ virtual void PaintCellString( ColPos _nColumn,
bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea,
- const StyleSettings& _rStyle, rtl::OUString& _rText ) = 0;
+ const StyleSettings& _rStyle, rtl::OUString& _rText ) = 0;
/** draws a cell cursor in the given rectangle
diff --git a/svtools/inc/svtools/table/tabletypes.hxx b/svtools/inc/svtools/table/tabletypes.hxx
index f423b64c2faa..645120e30d4b 100644
--- a/svtools/inc/svtools/table/tabletypes.hxx
+++ b/svtools/inc/svtools/table/tabletypes.hxx
@@ -56,17 +56,17 @@ namespace svt { namespace table
/** special column width value which indicates that the column should be
automatically resized to fit the view
*/
-#define COLWIDTH_FIT_TO_VIEW ((TableMetrics)-1)
+#define COLWIDTH_FIT_TO_VIEW ((::svt::table::TableMetrics)-1)
/// denotes the column containing the row headers
-#define COL_ROW_HEADERS ((ColPos)-1)
+#define COL_ROW_HEADERS ((::svt::table::ColPos)-1)
/// denotes the row containing the column headers
-#define ROW_COL_HEADERS ((RowPos)-1)
+#define ROW_COL_HEADERS ((::svt::table::RowPos)-1)
/// denotes an invalid column index
-#define COL_INVALID ((ColPos)-2)
+#define COL_INVALID ((::svt::table::ColPos)-2)
/// denotes an invalid row index
-#define ROW_INVALID ((RowPos)-2)
+#define ROW_INVALID ((::svt::table::RowPos)-2)
//........................................................................
diff --git a/svtools/inc/svtools/toolbarmenu.hxx b/svtools/inc/svtools/toolbarmenu.hxx
new file mode 100644
index 000000000000..92b873158a98
--- /dev/null
+++ b/svtools/inc/svtools/toolbarmenu.hxx
@@ -0,0 +1,155 @@
+/*************************************************************************
+ *
+ * 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_TOOLBARMENU_HXX_
+#define _SVTOOLS_TOOLBARMENU_HXX_
+
+#include "svtools/svtdllapi.h"
+
+#include <com/sun/star/frame/FeatureStateEvent.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+
+#include <vector>
+
+#include <rtl/ref.hxx>
+
+#include <vcl/ctrl.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/dockwin.hxx>
+
+class ValueSet;
+
+namespace svtools {
+
+class ToolbarMenuEntry;
+struct ToolbarMenu_Impl;
+
+class SVT_DLLPUBLIC ToolbarMenu : public DockingWindow
+{
+ friend class ToolbarMenuStatusListener;
+ friend struct ToolbarMenu_Impl;
+public:
+ ToolbarMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ Window* pParentWindow,
+ WinBits nBits );
+
+ ToolbarMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ Window* pParentWindow,
+ const ResId& rResId );
+
+ ~ToolbarMenu();
+
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void KeyInput( const KeyEvent& rKEvent );
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void Paint( const Rectangle& rRect );
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ virtual void GetFocus();
+ virtual void LoseFocus();
+
+ void appendEntry( int nEntryId, const String& rStr, MenuItemBits nItemBits = 0 );
+ void appendEntry( int nEntryId, const Image& rImage, MenuItemBits nItemBits = 0 );
+ void appendEntry( int nEntryId, const String& rStr, const Image& rImage, MenuItemBits nItemBits = 0 );
+ void appendEntry( int nEntryId, Control* pControl, MenuItemBits nItemBits = 0 );
+ void appendSeparator();
+
+ /** creates an empty ValueSet that is initialized and can be inserted with appendEntry. */
+ ValueSet* createEmptyValueSetControl();
+
+ void checkEntry( int nEntryId, bool bCheck = true );
+ bool isEntryChecked( int nEntryId ) const;
+
+ void enableEntry( int nEntryId, bool bEnable = true );
+ bool isEntryEnabled( int nEntryId ) const;
+
+ void setEntryText( int nEntryId, const String& rStr );
+ const String& getEntryText( int nEntryId ) const;
+
+ void setEntryImage( int nEntryId, const Image& rImage );
+ const Image& getEntryImage( int nEntryId ) const;
+
+ const Size& getMenuSize() const;
+
+ void SetSelectHdl( const Link& rLink );
+ const Link& GetSelectHdl() const;
+
+ int getSelectedEntryId() const;
+ int getHighlightedEntryId() const;
+
+ void highlightFirstEntry();
+
+protected:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+
+ // todo: move to new base class that will replace SfxPopupWindow
+ void AddStatusListener( const rtl::OUString& rCommandURL );
+ void RemoveStatusListener( const rtl::OUString& rCommandURL );
+ void UpdateStatus( const rtl::OUString& rCommandURL );
+
+ bool IsInPopupMode();
+ void EndPopupMode();
+
+ // XStatusListener (subclasses must override this one to get the status updates
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ void StateChanged( StateChangedType nType );
+ void DataChanged( const DataChangedEvent& rDCEvt );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > GetFrame() const;
+private:
+ DECL_LINK( HighlightHdl, Control * );
+
+ void initStatusListener();
+
+ void implInit( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
+ void initWindow();
+
+ Size implCalcSize();
+
+ void appendEntry( ToolbarMenuEntry* pEntry );
+
+ void implPaint( ToolbarMenuEntry* pThisOnly = NULL, bool bHighlight = false );
+
+ void implHighlightEntry( int nHighlightEntry, bool bHighlight );
+ void implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown );
+
+ void implChangeHighlightEntry( int nEntry );
+ void implSelectEntry( int nSelectedEntry );
+
+ ToolbarMenuEntry* implCursorUpDown( bool bUp, bool bHomeEnd );
+ ToolbarMenuEntry* implGetEntry( int nEntry ) const;
+ ToolbarMenuEntry* implSearchEntry( int nEntryId ) const;
+
+ ToolbarMenu_Impl* mpImpl;
+};
+
+} // namespace svtools
+
+#endif
diff --git a/svtools/inc/svtools/toolboxcontroller.hxx b/svtools/inc/svtools/toolboxcontroller.hxx
index 27ed315a3c04..7a49b294759c 100644
--- a/svtools/inc/svtools/toolboxcontroller.hxx
+++ b/svtools/inc/svtools/toolboxcontroller.hxx
@@ -42,12 +42,20 @@
#include <cppuhelper/interfacecontainer.hxx>
#include <comphelper/broadcasthelper.hxx>
#include <com/sun/star/util/XURLTransformer.hpp>
-
+//shizhoubo for ToolbarController Visiable
+#include <comphelper/proparrhlp.hxx>
+#include <comphelper/property.hxx>
+#include <comphelper/propertycontainer.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+//end
#ifndef INCLUDED_HASH_MAP
#include <hash_map>
#define INCLUDED_HASH_MAP
#endif
+class ToolBox;
+
namespace svt
{
struct ToolboxController_Impl;
@@ -57,9 +65,13 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL
public ::com::sun::star::lang::XInitialization,
public ::com::sun::star::util::XUpdatable,
public ::com::sun::star::lang::XComponent,
- public ::comphelper::OBaseMutex,
+ public ::comphelper::OMutexAndBroadcastHelper,//shizhoubo
+ public ::comphelper::OPropertyContainer,//shizhoubo
+ public ::comphelper::OPropertyArrayUsageHelper< ToolboxController >,//shizhoubo
public ::cppu::OWeakObject
{
+ private:
+ sal_Bool m_bSupportVisiable; //shizhoubo
public:
ToolboxController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
@@ -91,6 +103,7 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL
virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
// XEventListener
+ using cppu::OPropertySetHelper::disposing;
virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
// XStatusListener
@@ -102,8 +115,26 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL
virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException);
+ // OPropertySetHelper //shizhoubo
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const com::sun::star::uno::Any& rValue ) throw(com::sun::star::uno::Exception);
+ virtual sal_Bool SAL_CALL convertFastPropertyValue( com::sun::star::uno::Any& rConvertedValue, com::sun::star::uno::Any& rOldValue, sal_Int32 nHandle, const com::sun::star::uno::Any& rValue) throw(com::sun::star::lang::IllegalArgumentException);
+ // XPropertySet //shizhoubo
+ virtual ::com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ // OPropertyArrayUsageHelper //shizhoubo
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+
+
+ const rtl::OUString& getCommandURL() const { return m_aCommandURL; }
+ const rtl::OUString& getModuleName() const;
+
+ void dispatchCommand( const ::rtl::OUString& sCommandURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs );
+
+ void enable( bool bEnable );
protected:
+ bool getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox );
+ void setSupportVisiableProperty(sal_Bool bValue); //shizhoubo
struct Listener
{
Listener( const ::com::sun::star::util::URL& rURL, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& rDispatch ) :
diff --git a/svtools/inc/svtools/toolpanel/decklayouter.hxx b/svtools/inc/svtools/toolpanel/decklayouter.hxx
new file mode 100755
index 000000000000..da03d7c6c3aa
--- /dev/null
+++ b/svtools/inc/svtools/toolpanel/decklayouter.hxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ * 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 SVT_DECKLAYOUTER_HXX
+#define SVT_DECKLAYOUTER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <rtl/ref.hxx>
+
+#include <boost/optional.hpp>
+
+namespace com { namespace sun { namespace star { namespace accessibility {
+ class XAccessible;
+} } } }
+class Rectangle;
+class Point;
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //====================================================================
+ //= IDeckLayouter
+ //====================================================================
+ class IDeckLayouter : public ::rtl::IReference
+ {
+ public:
+ /** re-arranges the elements of the tool deck, taking into account the
+ available space for the complete deck.
+
+ @param i_rDeckPlayground
+ the playground for the complete tool panel deck
+ @return
+ the content area for a single tool panel
+ */
+ virtual ::Rectangle Layout( const ::Rectangle& i_rDeckPlayground ) = 0;
+
+ /** destroys the instance
+
+ Since the layouter is ref-counted, but might keep references to non-ref-counted objects
+ (in particular, the ToolPanelDeck, which is a VCL-Window, and thus cannot be ref-counted),
+ Destroy is the definitive way to dispose the instance. Technically, it's still alive afterwards,
+ but non-functional.
+ */
+ virtual void Destroy() = 0;
+
+ /** assuming that a layouter neesds to provide some kind of panel selector control, this method
+ requests to set the focus to this control.
+ */
+ virtual void SetFocusToPanelSelector() = 0;
+
+ /** returns the number of components in the XAccessible hierarchy which are needed to represent all elements
+ the layouter is responsible form.
+
+ Note that the implementation must guarantee that the count is fixed over the life time of the layouter.
+ */
+ virtual size_t GetAccessibleChildCount() const = 0;
+
+ /** retrieves the XAccessible implementation for the <code>i_nChildIndex</code>'th child in the XAccessible
+ hierarchy.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ GetAccessibleChild(
+ const size_t i_nChildIndex,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible
+ ) = 0;
+
+ virtual ~IDeckLayouter()
+ {
+ }
+ };
+
+ typedef ::rtl::Reference< IDeckLayouter > PDeckLayouter;
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_DECKLAYOUTER_HXX
diff --git a/svtools/inc/svtools/toolpanel/drawerlayouter.hxx b/svtools/inc/svtools/toolpanel/drawerlayouter.hxx
new file mode 100644
index 000000000000..0ecf493d0e98
--- /dev/null
+++ b/svtools/inc/svtools/toolpanel/drawerlayouter.hxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ * 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 SVT_DRAWERLAYOUTER_HXX
+#define SVT_DRAWERLAYOUTER_HXX
+
+#include "svtools/svtdllapi.h"
+#include "svtools/toolpanel/refbase.hxx"
+#include "svtools/toolpanel/toolpaneldeck.hxx"
+#include "svtools/toolpanel/decklayouter.hxx"
+
+#include <boost/shared_ptr.hpp>
+
+//......................................................................................................................
+namespace svt
+{
+//......................................................................................................................
+
+ class ToolPanelViewShell;
+ class ToolPanelDrawer;
+ typedef ::boost::shared_ptr< ToolPanelDrawer > PToolPanelDrawer;
+
+ //==================================================================================================================
+ //= ToolPanelDrawer
+ //==================================================================================================================
+ /** a class which implements a tool panel selector in the form of the classical drawers
+ */
+ class SVT_DLLPUBLIC DrawerDeckLayouter :public RefBase
+ ,public IDeckLayouter
+ ,public IToolPanelDeckListener
+ {
+ public:
+ DrawerDeckLayouter(
+ ::Window& i_rParentWindow,
+ IToolPanelDeck& i_rPanels
+ );
+ ~DrawerDeckLayouter();
+
+ // IReference
+ DECLARE_IREFERENCE()
+
+ // IDeckLayouter
+ virtual Rectangle Layout( const Rectangle& i_rDeckPlayground );
+ virtual void Destroy();
+ virtual void SetFocusToPanelSelector();
+ virtual size_t GetAccessibleChildCount() const;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ GetAccessibleChild(
+ const size_t i_nChildIndex,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible
+ );
+
+ // IToolPanelDeckListener
+ virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition );
+ virtual void PanelRemoved( const size_t i_nPosition );
+ virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
+ virtual void LayouterChanged( const PDeckLayouter& i_rNewLayouter );
+ virtual void Dying();
+
+ private:
+ // triggers a re-arrance of the panel deck elements
+ void impl_triggerRearrange() const;
+ size_t impl_getPanelPositionFromWindow( const Window* i_pDrawerWindow ) const;
+ void impl_removeDrawer( const size_t i_nPosition );
+
+ DECL_LINK( OnWindowEvent, VclSimpleEvent* );
+
+private:
+ Window& m_rParentWindow;
+ IToolPanelDeck& m_rPanelDeck;
+ ::std::vector< PToolPanelDrawer > m_aDrawers;
+ ::boost::optional< size_t > m_aLastKnownActivePanel;
+ };
+
+//......................................................................................................................
+} // namespace svt
+//......................................................................................................................
+
+#endif // SVT_DRAWERLAYOUTER_HXX
diff --git a/svtools/inc/svtools/toolpanel/paneltabbar.hxx b/svtools/inc/svtools/toolpanel/paneltabbar.hxx
new file mode 100644
index 000000000000..668935d8a739
--- /dev/null
+++ b/svtools/inc/svtools/toolpanel/paneltabbar.hxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ * 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 SVT_PANELTABBAR_HXX
+#define SVT_PANELTABBAR_HXX
+
+#include "svtools/svtdllapi.h"
+#include "svtools/toolpanel/tabalignment.hxx"
+#include "svtools/toolpanel/tabitemcontent.hxx"
+
+#include <vcl/ctrl.hxx>
+
+#include <memory>
+#include <boost/optional.hpp>
+
+class PushButton;
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ class PanelTabBar_Impl;
+ class IToolPanelDeck;
+
+ //====================================================================
+ //= PanelTabBar
+ //====================================================================
+ /** a tab bar for selecting panels
+
+ At the moment, this control aligns the tabs vertically, this might be extended to also support a horizontal
+ layout in the future.
+ */
+ class SVT_DLLPUBLIC PanelTabBar : public Control
+ {
+ public:
+ PanelTabBar( Window& i_rParentWindow, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent );
+ ~PanelTabBar();
+
+ // attribute access
+ TabItemContent GetTabItemContent() const;
+ void SetTabItemContent( const TabItemContent& i_eItemContent );
+
+ ::boost::optional< size_t > GetFocusedPanelItem() const;
+ void FocusPanelItem( const size_t i_nItemPos );
+ Rectangle GetItemScreenRect( const size_t i_nItemPos ) const;
+ bool IsVertical() const;
+ IToolPanelDeck& GetPanelDeck() const;
+ PushButton& GetScrollButton( const bool i_bForward );
+
+ // Window overridables
+ virtual Size GetOptimalSize( WindowSizeType i_eType ) const;
+
+ protected:
+ // Window overridables
+ virtual void Paint( const Rectangle& i_rRect );
+ virtual void Resize();
+ virtual void MouseMove( const MouseEvent& i_rMouseEvent );
+ virtual void MouseButtonDown( const MouseEvent& i_rMouseEvent );
+ virtual void MouseButtonUp( const MouseEvent& i_rMouseEvent );
+ virtual void RequestHelp( const HelpEvent& i_rHelpEvent );
+ virtual void GetFocus();
+ virtual void LoseFocus();
+ virtual void KeyInput( const KeyEvent& i_rKeyEvent );
+ virtual void DataChanged( const DataChangedEvent& i_rDataChanedEvent );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >
+ GetComponentInterface( BOOL i_bCreate );
+
+ private:
+ ::std::auto_ptr< PanelTabBar_Impl > m_pImpl;
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_PANELTABBAR_HXX
+
diff --git a/svtools/inc/svtools/toolpanel/refbase.hxx b/svtools/inc/svtools/toolpanel/refbase.hxx
new file mode 100644
index 000000000000..991d6e619090
--- /dev/null
+++ b/svtools/inc/svtools/toolpanel/refbase.hxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ * 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 SVT_REFBASE_HXX
+#define SVT_REFBASE_HXX
+
+#include "svtools/svtdllapi.h"
+
+#include <rtl/ref.hxx>
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //====================================================================
+ //= RefBase
+ //====================================================================
+ class SVT_DLLPUBLIC RefBase : public ::rtl::IReference
+ {
+ protected:
+ RefBase()
+ :m_refCount( 0 )
+ {
+ }
+
+ virtual ~RefBase()
+ {
+ }
+
+ virtual oslInterlockedCount SAL_CALL acquire();
+ virtual oslInterlockedCount SAL_CALL release();
+
+ private:
+ oslInterlockedCount m_refCount;
+ };
+
+#define DECLARE_IREFERENCE() \
+ virtual oslInterlockedCount SAL_CALL acquire(); \
+ virtual oslInterlockedCount SAL_CALL release();
+
+
+#define IMPLEMENT_IREFERENCE( classname ) \
+ oslInterlockedCount classname::acquire() \
+ { \
+ return RefBase::acquire(); \
+ } \
+ oslInterlockedCount classname::release() \
+ { \
+ return RefBase::release(); \
+ }
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_REFBASE_HXX
diff --git a/svtools/inc/svtools/toolpanel/tabalignment.hxx b/svtools/inc/svtools/toolpanel/tabalignment.hxx
new file mode 100644
index 000000000000..cc3f17469ffe
--- /dev/null
+++ b/svtools/inc/svtools/toolpanel/tabalignment.hxx
@@ -0,0 +1,47 @@
+/*************************************************************************
+ * 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 SVT_TABALIGNMENT_HXX
+#define SVT_TABALIGNMENT_HXX
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ enum TabAlignment
+ {
+ TABS_LEFT,
+ TABS_RIGHT,
+ TABS_TOP,
+ TABS_BOTTOM
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_TABALIGNMENT_HXX
diff --git a/svtools/inc/svtools/toolpanel/tabitemcontent.hxx b/svtools/inc/svtools/toolpanel/tabitemcontent.hxx
new file mode 100644
index 000000000000..a1cf9deae9f4
--- /dev/null
+++ b/svtools/inc/svtools/toolpanel/tabitemcontent.hxx
@@ -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.
+ *
+************************************************************************/
+
+#ifndef SVT_TABITEMCONTENT_HXX
+#define SVT_TABITEMCONTENT_HXX
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ enum TabItemContent
+ {
+ TABITEM_IMAGE_AND_TEXT,
+ TABITEM_IMAGE_ONLY,
+ TABITEM_TEXT_ONLY,
+
+ TABITEM_AUTO
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_TABITEMCONTENT_HXX
diff --git a/svtools/inc/svtools/toolpanel/tablayouter.hxx b/svtools/inc/svtools/toolpanel/tablayouter.hxx
new file mode 100755
index 000000000000..92b36acf9114
--- /dev/null
+++ b/svtools/inc/svtools/toolpanel/tablayouter.hxx
@@ -0,0 +1,112 @@
+/*************************************************************************
+ * 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 SVT_TABLAYOUTER_HXX
+#define SVT_TABLAYOUTER_HXX
+
+#include "svtools/svtdllapi.h"
+#include "svtools/toolpanel/decklayouter.hxx"
+#include "svtools/toolpanel/tabalignment.hxx"
+#include "svtools/toolpanel/tabitemcontent.hxx"
+#include "svtools/toolpanel/refbase.hxx"
+
+#include <memory>
+
+#include <boost/noncopyable.hpp>
+
+class Window;
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ class IToolPanelDeck;
+
+ struct TabDeckLayouter_Data;
+
+ //====================================================================
+ //= TabDeckLayouter
+ //====================================================================
+ class SVT_DLLPUBLIC TabDeckLayouter :public RefBase
+ ,public IDeckLayouter
+ ,public ::boost::noncopyable
+ {
+ public:
+ /** creates a new layouter
+ @param i_rParent
+ is the parent window for any VCL windows the layouter needs to create.
+ @param i_rPanels
+ is the panel deck which the layouter is responsible for.
+ @param i_eAlignment
+ specifies the alignment of the panel selector
+ @param TabItemContent
+ specifies the content to show on the tab items
+ */
+ TabDeckLayouter(
+ Window& i_rParent,
+ IToolPanelDeck& i_rPanels,
+ const TabAlignment i_eAlignment,
+ const TabItemContent i_eItemContent
+ );
+ ~TabDeckLayouter();
+
+ // attribute access
+ TabItemContent GetTabItemContent() const;
+ void SetTabItemContent( const TabItemContent& i_eItemContent );
+ TabAlignment GetTabAlignment() const;
+
+ // helpers for the A11Y implementation
+ ::boost::optional< size_t >
+ GetFocusedPanelItem() const;
+ void FocusPanelItem( const size_t i_nItemPos );
+ bool IsPanelSelectorEnabled() const;
+ bool IsPanelSelectorVisible() const;
+ Rectangle GetItemScreenRect( const size_t i_nItemPos ) const;
+
+ // IDeckLayouter
+ virtual Rectangle Layout( const Rectangle& i_rDeckPlayground );
+ virtual void Destroy();
+ virtual void SetFocusToPanelSelector();
+ virtual size_t GetAccessibleChildCount() const;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ GetAccessibleChild(
+ const size_t i_nChildIndex,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible
+ );
+
+ // IReference
+ DECLARE_IREFERENCE()
+
+ private:
+ ::std::auto_ptr< TabDeckLayouter_Data > m_pData;
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_TABLAYOUTER_HXX
diff --git a/svtools/inc/svtools/toolpanel/toolpanel.hxx b/svtools/inc/svtools/toolpanel/toolpanel.hxx
new file mode 100644
index 000000000000..432dea64e8b5
--- /dev/null
+++ b/svtools/inc/svtools/toolpanel/toolpanel.hxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ * 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 SVT_TOOLPANEL_HXX
+#define SVT_TOOLPANEL_HXX
+
+#include "svtools/svtdllapi.h"
+#include "svtools/toolpanel/refbase.hxx"
+
+#include <rtl/ustring.hxx>
+#include <vcl/image.hxx>
+#include <vcl/smartid.hxx>
+
+#include <boost/noncopyable.hpp>
+
+class Rectangle;
+class Window;
+namespace com { namespace sun { namespace star { namespace accessibility {
+ class XAccessible;
+} } } }
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //====================================================================
+ //= IToolPanel
+ //====================================================================
+ /** abstract interface for a single tool panel
+ */
+ class SVT_DLLPUBLIC IToolPanel : public ::rtl::IReference
+ {
+ public:
+ /// retrieves the display name of the panel
+ virtual ::rtl::OUString GetDisplayName() const = 0;
+
+ /// retrieves the image associated with the panel, if any
+ virtual Image GetImage() const = 0;
+
+ /// retrieves the help ID associated with the panel, if any.
+ virtual SmartId GetHelpID() const = 0;
+
+ /** activates the panel
+
+ Usually, this means the panel's Window is created (if not previosly done so) and shown.
+
+ @param i_rParentWindow
+ the parent window to anchor the panel window at. Subsequent calls to the Activate
+ method will always get the same parent window. The complete area of this window is
+ available, and should be used, for the panel window.
+ */
+ virtual void Activate( Window& i_rParentWindow ) = 0;
+
+ /** deactivates the panel
+
+ There are different ways how an implementation could deactivate a panel. The easiest way
+ would be to simply hide the associated Window. Alternatively, you could completely destroy it,
+ or decide to cache it by re-parenting it to another (temporary, invisible) window.
+ */
+ virtual void Deactivate() = 0;
+
+ /** sets a new size for the panel's Window
+
+ The panel window is always expected to be positioned at (0,0), relative to the parent window
+ which was passed to the Activate member. Resizing the panel window is necessary when the size of
+ this parent window changes. Effectively, this method is a means of convenience, to relief panel
+ implementations from reacting on size changes of their parent window themselves.
+ */
+ virtual void SetSizePixel( const Size& i_rPanelWindowSize ) = 0;
+
+ /// sets the focus to the panel window
+ virtual void GrabFocus() = 0;
+
+ /** release any resources associated with the panel.
+
+ In particular, implementations should ultimately destroy the VCL window which implements the panel
+ window. No subsequent calls to any other method will happen after Destroy has been called.
+ */
+ virtual void Dispose() = 0;
+
+ /** creates an XAccessible for the tool panel
+
+ Implementations are allowed to create a new instance each time this method is called, the caller
+ is responsible for caching the XAccessible implementation, if this is desired.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ CreatePanelAccessible(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible
+ ) = 0;
+
+ virtual ~IToolPanel()
+ {
+ }
+ };
+
+ typedef ::rtl::Reference< IToolPanel > PToolPanel;
+
+ //====================================================================
+ //= ToolPanelBase
+ //====================================================================
+ /** base class for tool panel implementations, adding ref count implementation to the IToolPanel interface,
+ but still being abstract
+ */
+ class SVT_DLLPUBLIC ToolPanelBase :public IToolPanel
+ ,public RefBase
+ ,public ::boost::noncopyable
+ {
+ protected:
+ ToolPanelBase();
+ ~ToolPanelBase();
+
+ public:
+ DECLARE_IREFERENCE()
+
+ private:
+ oslInterlockedCount m_refCount;
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_TOOLPANEL_HXX
diff --git a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx
new file mode 100755
index 000000000000..a1009591ffba
--- /dev/null
+++ b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx
@@ -0,0 +1,193 @@
+/*************************************************************************
+ * 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 SVT_TOOLPANELDECK_HXX
+#define SVT_TOOLPANELDECK_HXX
+
+#include "svtools/svtdllapi.h"
+#include "svtools/toolpanel/toolpanel.hxx"
+#include "svtools/toolpanel/decklayouter.hxx"
+
+#include <vcl/ctrl.hxx>
+
+#include <boost/optional.hpp>
+#include <memory>
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ class ToolPanelCollection;
+ class ToolPanelDeck_Impl;
+
+ //====================================================================
+ //= IToolPanelDeckListener
+ //====================================================================
+ class SAL_NO_VTABLE IToolPanelDeckListener
+ {
+ public:
+ /** called when a panel has been inserted into the deck
+ */
+ virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) = 0;
+
+ /** called when a panel has been removed from the deck
+ */
+ virtual void PanelRemoved( const size_t i_nPosition ) = 0;
+
+ /** called when the active panel of the deck changed
+ */
+ virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) = 0;
+
+ /** called when a new layouter has been set at a tool panel deck.
+
+ The method is called after the old layouter has been disposed (i.e. its Destroy method has been
+ invoked), and after the complete deck has been re-layouter.
+ */
+ virtual void LayouterChanged( const PDeckLayouter& i_rNewLayouter ) = 0;
+
+ /** called when the tool panel deck which the listener registered at is dying. The listener is required to
+ release all references to the deck then.
+ */
+ virtual void Dying() = 0;
+ };
+
+ //====================================================================
+ //= IToolPanelDeck
+ //====================================================================
+ class SVT_DLLPUBLIC IToolPanelDeck
+ {
+ public:
+ /** returns the number of panels in the container
+ */
+ virtual size_t GetPanelCount() const = 0;
+
+ /** retrieves the panel with the given index. Invalid indexes will be reported via an assertion in the
+ non-product version, and silently ignored in the product version, with a NULL panel being returned.
+ */
+ virtual PToolPanel GetPanel( const size_t i_nPos ) const = 0;
+
+ /** returns the number of the currently active panel.
+ */
+ virtual ::boost::optional< size_t >
+ GetActivePanel() const = 0;
+
+ /** activates the panel with the given number. If the given number is larger or equal to the number of panels
+ in the deck, this will be reported via an assertion in non-product builds, and otherwise ignored.
+ @param i_rPanel
+ the number of the panel to activate. If this is not set, the currently active panel is de-activated,
+ and no new panel is activated at all. Whether or not this makes sense for your application is at
+ your own discretion.
+ */
+ virtual void ActivatePanel( const ::boost::optional< size_t >& i_rPanel ) = 0;
+
+ /** inserts a new panel into the container. NULL panels are not allowed, as are positions greater than the
+ current panel count. Violations of this will be reported via an assertion in the non-product version, and
+ silently ignored in the product version.
+ */
+ virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ) = 0;
+
+ /** removes a panel specified by its position.
+
+ Note: It is the responsibility of the caller to ensure that the panel is destroyed appropriately. That is,
+ the tool panel deck will <em>not</em> invoke <member>IToolPanel::Dispose</member> on the removed panel.
+ The advantage is that the panel might be re-used later, with the disadvantage that the owner of the panel
+ deck must know whether Dispose must be invoked after removal, or whether the panel will properly
+ dispose itself when its ref count drops to 0.
+ */
+ virtual PToolPanel RemovePanel( const size_t i_nPosition ) = 0;
+
+ /** adds a new listener to be notified when the container content changes. The caller is responsible
+ for life time control, i.e. removing the listener before it actually dies.
+ */
+ virtual void AddListener( IToolPanelDeckListener& i_rListener ) = 0;
+
+ /** removes a container listener previously added via addListener.
+ */
+ virtual void RemoveListener( IToolPanelDeckListener& i_rListener ) = 0;
+ };
+
+ //====================================================================
+ //= ToolPanelDeck
+ //====================================================================
+ class SVT_DLLPUBLIC ToolPanelDeck :public Control
+ ,public IToolPanelDeck
+ {
+ public:
+ ToolPanelDeck( Window& i_rParent, const WinBits i_nStyle = WB_DIALOGCONTROL );
+ ~ToolPanelDeck();
+
+ // attributes
+ PDeckLayouter GetLayouter() const;
+ void SetLayouter( const PDeckLayouter& i_pNewLayouter );
+
+ /** returns the window which acts as anchor for the panel windows.
+
+ This is a single dedicated window, which is passed to the IToolPanel::ActivatePanel method
+ whenever a panel is activated, to act as parent window for the panel's VCL-Window.
+ */
+ ::Window& GetPanelWindowAnchor();
+ const ::Window& GetPanelWindowAnchor() const;
+
+ /** sets the window which should act as parent in the A11Y object hierarchy.
+
+ Calling this method has no effect if CreateAccessible had always been called.
+ */
+ void SetAccessibleParentWindow( ::Window* i_pAccessibleParent );
+ ::Window* GetAccessibleParentWindow() const;
+
+ // IToolPanelDeck
+ virtual size_t GetPanelCount() const;
+ virtual PToolPanel GetPanel( const size_t i_nPos ) const;
+ virtual ::boost::optional< size_t >
+ GetActivePanel() const;
+ virtual void ActivatePanel( const ::boost::optional< size_t >& i_rPanel );
+ virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition );
+ virtual PToolPanel RemovePanel( const size_t i_nPosition );
+ virtual void AddListener( IToolPanelDeckListener& i_rListener );
+ virtual void RemoveListener( IToolPanelDeckListener& i_rListener );
+
+ protected:
+ // Window overridables
+ virtual void Resize();
+ virtual long Notify( NotifyEvent& i_rNotifyEvent );
+ virtual void GetFocus();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >
+ GetComponentInterface( BOOL i_bCreate );
+
+ private:
+ ::std::auto_ptr< ToolPanelDeck_Impl > m_pImpl;
+
+ private:
+ using Window::GetAccessibleParentWindow;
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_TOOLPANELDECK_HXX
diff --git a/svtools/inc/svtools/valueset.hxx b/svtools/inc/svtools/valueset.hxx
index 9d72751c5e20..0937d824daf0 100644
--- a/svtools/inc/svtools/valueset.hxx
+++ b/svtools/inc/svtools/valueset.hxx
@@ -426,6 +426,9 @@ public:
void SetDoubleClickHdl( const Link& rLink ) { maDoubleClickHdl = rLink; }
const Link& GetDoubleClickHdl() const { return maDoubleClickHdl; }
+ void SetHighlightHdl( const Link& rLink );
+ const Link& GetHighlightHdl() const;
+
private:
/** Determine whether RTL (right to left writing) is active. For this
method to return <true/> two conditions have to be fullfilled:
diff --git a/svtools/inc/svtools/wizardmachine.hxx b/svtools/inc/svtools/wizardmachine.hxx
index f45087f78705..02562ac4bb63 100644
--- a/svtools/inc/svtools/wizardmachine.hxx
+++ b/svtools/inc/svtools/wizardmachine.hxx
@@ -42,6 +42,7 @@ namespace svt
//.........................................................................
// wizard buttons
+#define WZB_NONE 0x0000
#define WZB_NEXT 0x0001
#define WZB_PREVIOUS 0x0002
#define WZB_FINISH 0x0004
@@ -62,12 +63,11 @@ namespace svt
eTravelForward, // traveling forward (maybe with skipping pages)
eTravelBackward, // traveling backward (maybe with skipping pages)
eFinish, // the wizard is about to be finished
- eValidate, // the data should be validated only, no traveling wll happen
- eValidateNoUI // the data should be validated only, without displaying error messages and other UI
+ eValidate // the data should be validated only, no traveling wll happen
};
};
- class SAL_NO_VTABLE IWizardPage : public WizardTypes
+ class SAL_NO_VTABLE IWizardPageController
{
public:
//-----------------------------------------------------------------
@@ -78,7 +78,16 @@ namespace svt
// to be committed for this.
// So initializePage and commitPage are designated to initialitzing/committing data on the page.
virtual void initializePage() = 0;
- virtual sal_Bool commitPage( CommitPageReason _eReason ) = 0;
+ virtual sal_Bool commitPage( WizardTypes::CommitPageReason _eReason ) = 0;
+
+ /** determines whether or not it is allowed to advance to a next page
+
+ You should make this dependent on the current state of the page only, not on
+ states on other pages of the whole dialog.
+
+ The default implementation always returns <TRUE/>.
+ */
+ virtual bool canAdvance() const = 0;
};
//=====================================================================
@@ -87,7 +96,7 @@ namespace svt
class OWizardMachine;
struct WizardPageImplData;
- class SVT_DLLPUBLIC OWizardPage : public TabPage, public IWizardPage
+ class SVT_DLLPUBLIC OWizardPage : public TabPage, public IWizardPageController
{
private:
WizardPageImplData* m_pImpl;
@@ -101,23 +110,10 @@ namespace svt
OWizardPage( Window* _pParent, const ResId& _rResId );
~OWizardPage();
- // This methods behave somewhat different than ActivatePage/DeactivatePage
- // The latter are handled by the base class itself whenever changing the pages is in the offing,
- // i.e., when it's already decided which page is the next.
- // We may have situations where the next page depends on the state of the current, which needs
- // to be committed for this.
- // So initializePage and commitPage are designated to initialitzing/committing data on the page.
+ // IWizardPageController overridables
virtual void initializePage();
- virtual sal_Bool commitPage( CommitPageReason _eReason );
-
- /** determines whether or not it is allowed to advance to a next page
-
- You should make this dependent on the current state of the page only, not on
- states on other pages of the whole dialog.
-
- The default implementation always returns <TRUE/>.
- */
- virtual bool canAdvance() const;
+ virtual sal_Bool commitPage( WizardTypes::CommitPageReason _eReason );
+ virtual bool canAdvance() const;
protected:
// TabPage overridables
@@ -189,6 +185,7 @@ namespace svt
For the button flags, use any combination of the WZB_* flags.
*/
OWizardMachine(Window* _pParent, const ResId& _rRes, sal_uInt32 _nButtonFlags );
+ OWizardMachine(Window* _pParent, const WinBits i_nStyle, sal_uInt32 _nButtonFlags );
~OWizardMachine();
/// enable (or disable) buttons
@@ -263,7 +260,7 @@ namespace svt
/** called when the finish button is pressed
<p>By default, only the base class' Finnish method (which is not virtual) is called</p>
*/
- virtual sal_Bool onFinish(sal_Int32 _nResult);
+ virtual sal_Bool onFinish();
/// travel to the next state
sal_Bool travelNext();
@@ -342,7 +339,8 @@ namespace svt
*/
WizardState getCurrentState() const { return WizardDialog::GetCurLevel(); }
- virtual IWizardPage* getWizardPage(TabPage* _pCurrentPage) const;
+ virtual IWizardPageController*
+ getPageController( TabPage* _pCurrentPage ) const;
/** retrieves a copy of the state history, i.e. all states we already visited
*/
@@ -355,6 +353,9 @@ namespace svt
void resumeTraveling( AccessGuard );
bool isTravelingSuspended() const;
+ protected:
+ TabPage* GetOrCreatePage( const WizardState i_nState );
+
private:
// long OnNextPage( PushButton* );
DECL_DLLPRIVATE_LINK(OnNextPage, PushButton*);
@@ -363,6 +364,7 @@ namespace svt
SVT_DLLPRIVATE void implResetDefault(Window* _pWindow);
SVT_DLLPRIVATE void implUpdateTitle();
+ SVT_DLLPRIVATE void implConstruct( const sal_uInt32 _nButtonFlags );
};
/// helper class to temporarily suspend any traveling in the wizard
diff --git a/svtools/inc/svtools/xwindowitem.hxx b/svtools/inc/svtools/xwindowitem.hxx
new file mode 100755
index 000000000000..eca425cf1369
--- /dev/null
+++ b/svtools/inc/svtools/xwindowitem.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: chrtitem.hxx,v $
+ * $Revision: 1.9 $
+ *
+ * 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 _XWINDOWITEM_HXX_
+#define _XWINDOWITEM_HXX_
+
+
+#include "svtools/svtdllapi.h"
+
+#include <svl/poolitem.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+#include <com/sun/star/awt/XWindow.hpp>
+
+class Window;
+
+//////////////////////////////////////////////////////////////////////
+
+class SVT_DLLPUBLIC XWindowItem : public SfxPoolItem
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xWin;
+
+ // disallow use assignment operator
+ XWindowItem & operator = ( const XWindowItem & );
+
+public:
+ TYPEINFO();
+ XWindowItem();
+ explicit XWindowItem( USHORT nWhich, Window * pWin );
+ XWindowItem( USHORT nWhich, com::sun::star::uno::Reference< com::sun::star::awt::XWindow > & rxWin );
+ XWindowItem( const XWindowItem &rItem );
+ ~XWindowItem();
+
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual int operator == ( const SfxPoolItem& rAttr ) const;
+
+ Window * GetWindowPtr() const { return VCLUnoHelper::GetWindow( m_xWin ); }
+ com::sun::star::uno::Reference< com::sun::star::awt::XWindow > GetXWindow() const { return m_xWin; }
+};
+
+//////////////////////////////////////////////////////////////////////
+
+#endif
+
diff --git a/svtools/prj/d.lst b/svtools/prj/d.lst
index 0a3ccd8a9819..b46ddef72311 100644
--- a/svtools/prj/d.lst
+++ b/svtools/prj/d.lst
@@ -1,6 +1,8 @@
mkdir: %COMMON_DEST%\bin%_EXT%\hid
mkdir: %COMMON_DEST%\res%_EXT%
mkdir: %_DEST%\inc%_EXT%\svtools
+mkdir: %_DEST%\inc%_EXT%\svtools\toolpanel
+mkdir: %_DEST%\inc%_EXT%\svtools\table
..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid
..\%__SRC%\srs\ehdl.srs %_DEST%\res%_EXT%\svtools.srs
@@ -25,10 +27,13 @@ mkdir: %_DEST%\inc%_EXT%\svtools
..\inc\svtools\*.hxx %_DEST%\inc%_EXT%\svtools\*.hxx
..\inc\svtools\*.h %_DEST%\inc%_EXT%\svtools\*.h
..\inc\svtools\*.hrc %_DEST%\inc%_EXT%\svtools\*.hrc
+..\inc\svtools\table\*.hxx %_DEST%\inc%_EXT%\svtools\table\*.hxx
..\inc\*.hxx %_DEST%\inc%_EXT%\svtools\*.hxx
..\inc\*.h %_DEST%\inc%_EXT%\svtools\*.h
..\inc\*.hrc %_DEST%\inc%_EXT%\svtools\*.hrc
+..\inc\svtools\toolpanel\*.* %_DEST%\inc%_EXT%\svtools\toolpanel\*.hrc
+
dos: sh -c "if test %OS% = MACOSX; then macosx-create-bundle %_DEST%\bin%_EXT%\bmp=%__PRJROOT%\%__SRC%\bin%_EXT%; fi"
*.xml %_DEST%\xml%_EXT%\*.xml
diff --git a/svtools/qa/unoapi/Test.java b/svtools/qa/unoapi/Test.java
new file mode 100644
index 000000000000..8ae4af55ed61
--- /dev/null
+++ b/svtools/qa/unoapi/Test.java
@@ -0,0 +1,51 @@
+/*************************************************************************
+* 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 org.openoffice.svtools.qa.unoapi;
+
+import org.openoffice.Runner;
+import org.openoffice.test.OfficeConnection;
+import static org.junit.Assert.*;
+
+public final class Test {
+ @org.junit.Before public void setUp() throws Exception {
+ connection.setUp();
+ }
+
+ @org.junit.After public void tearDown()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ connection.tearDown();
+ }
+
+ @org.junit.Test public void test() {
+ assertTrue(
+ Runner.run(
+ "-sce", "svtools.sce", "-xcl", "knownissues.xcl", "-cs",
+ connection.getDescription()));
+ }
+
+ private final OfficeConnection connection = new OfficeConnection();
+}
diff --git a/svtools/qa/unoapi/makefile.mk b/svtools/qa/unoapi/makefile.mk
index 2d75735d4b0d..e3afb77e637a 100644
--- a/svtools/qa/unoapi/makefile.mk
+++ b/svtools/qa/unoapi/makefile.mk
@@ -1,7 +1,6 @@
#*************************************************************************
-#
# 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
@@ -22,19 +21,28 @@
# version 3 along with OpenOffice.org. If not, see
# <http://www.openoffice.org/license.html>
# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
+#***********************************************************************/
-PRJ=..$/..
+.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
+nothing .PHONY:
+.ELSE
-PRJNAME=svtools
-TARGET=qa_unoapi
+PRJ = ../..
+PRJNAME = svtools
+TARGET = qa_unoapi
-.INCLUDE: settings.mk
+.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 : UNOAPI_TEST
+ALLTAR : javatest
-UNOAPI_TEST:
- +$(SOLARENV)$/bin$/checkapi -sce svtools.sce -xcl knownissues.xcl -tdoc $(PWD)$/testdocuments
+.END
diff --git a/svtools/qa/unoapi/svtools.sce b/svtools/qa/unoapi/svtools.sce
index 53d53e0e6824..90fb50358f99 100644
--- a/svtools/qa/unoapi/svtools.sce
+++ b/svtools/qa/unoapi/svtools.sce
@@ -1,12 +1,12 @@
#i88276 -o svtools.AccessibleIconChoiceCtrlEntry
#i88647 -o svtools.AccessibleTabBarPage
--o svtools.AccessibleBrowseBox
--o svtools.AccessibleBrowseBoxHeaderBar
--o svtools.AccessibleBrowseBoxHeaderCell
--o svtools.AccessibleBrowseBoxTable
+#i110988 -o svtools.AccessibleBrowseBox
+#i110988 -o svtools.AccessibleBrowseBoxHeaderBar
+#i110988 -o svtools.AccessibleBrowseBoxHeaderCell
+#i110988 -o svtools.AccessibleBrowseBoxTable
#i85245 -o svtools.AccessibleBrowseBoxTableCell
#i88276 -o svtools.AccessibleIconChoiceCtrl
-o svtools.AccessibleTabBar
#i85246 -o svtools.AccessibleTabBarPageList
--o svtools.AccessibleTreeListBox
--o svtools.AccessibleTreeListBoxEntry \ No newline at end of file
+#i110988 -o svtools.AccessibleTreeListBox
+#i110988 -o svtools.AccessibleTreeListBoxEntry
diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx
index 9a4903b1e093..3a29c4ae63fa 100644
--- a/svtools/source/brwbox/brwbox1.cxx
+++ b/svtools/source/brwbox/brwbox1.cxx
@@ -2446,8 +2446,6 @@ void BrowseBox::SetMode( BrowserMode nMode )
BROWSER_AUTO_HSCROLL |
BROWSER_TRACKING_TIPS |
// BROWSER_HIGHLIGHT_NONE |
- BROWSER_HIGHLIGHT_AUTO |
-// BROWSER_HIGHLIGHT_MANU |
BROWSER_HEADERBAR_NEW |
// BROWSER_AUTOSIZE_LASTCOL |
0;
@@ -2517,9 +2515,6 @@ void BrowseBox::SetMode( BrowserMode nMode )
pVScroll->SetScrollHdl( LINK( this, BrowseBox, ScrollHdl ) );
pVScroll->SetEndScrollHdl( LINK( this, BrowseBox, EndScrollHdl ) );
- getDataWindow()->bHighlightAuto =
- BROWSER_HIGHLIGHT_AUTO == ( nMode & BROWSER_HIGHLIGHT_AUTO ) ||
- BROWSER_HIGHLIGHT_MANU != ( nMode & BROWSER_HIGHLIGHT_MANU );
getDataWindow()->bAutoSizeLastCol =
BROWSER_AUTOSIZE_LASTCOL == ( nMode & BROWSER_AUTOSIZE_LASTCOL );
getDataWindow()->bOwnDataChangedHdl =
diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx
index da07415dfee8..68cf316e813b 100644
--- a/svtools/source/brwbox/brwbox2.cxx
+++ b/svtools/source/brwbox/brwbox2.cxx
@@ -340,10 +340,6 @@ void BrowseBox::ToggleSelection( BOOL bForce )
if ( !bForce &&
( bNotToggleSel || !IsUpdateMode() || !bSelectionIsVisible ) )
return;
-//MI, 28.01.98
-// if ( !getDataWindow()->bHighlightToggle &&
-// !getDataWindow()->bHighlightAuto )
-// return;
// only highlight painted areas!
bNotToggleSel = TRUE;
@@ -984,11 +980,10 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, BOOL
Size( _rRect.GetSize().Width(), nDataRowHeigt ) );
PaintRow( _rOut, aRowRect );
- BOOL bRowAutoHighlight = _bDrawSelections
- && !bHideSelect
- && ((BrowserDataWin&)GetDataWindow()).bHighlightAuto
- && IsRowSelected( nRow );
- if ( bRowAutoHighlight )
+ BOOL bRowSelected = _bDrawSelections
+ && !bHideSelect
+ && IsRowSelected( nRow );
+ if ( bRowSelected )
{
_rOut.SetTextColor( rHighlightTextColor );
_rOut.SetFillColor( rHighlightFillColor );
@@ -1082,7 +1077,7 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, BOOL
bRetouching = TRUE;
// reset auto-highlight
- if ( bRowAutoHighlight )
+ if ( bRowSelected )
{
_rOut.SetTextColor( aOldTextColor );
_rOut.SetFillColor( aOldFillColor );
diff --git a/svtools/source/brwbox/brwbox3.cxx b/svtools/source/brwbox/brwbox3.cxx
index 449d5642e034..102af1b6e1a1 100644
--- a/svtools/source/brwbox/brwbox3.cxx
+++ b/svtools/source/brwbox/brwbox3.cxx
@@ -542,7 +542,7 @@ BOOL BrowseBox::GetGlyphBoundRects( const Point& rOrigin, const String& rStr, in
return Control::GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, nBase, rVector );
}
// -----------------------------------------------------------------------------
-Rectangle BrowseBox::GetWindowExtentsRelative( Window *pRelativeWindow )
+Rectangle BrowseBox::GetWindowExtentsRelative( Window *pRelativeWindow ) const
{
return Control::GetWindowExtentsRelative( pRelativeWindow );
}
diff --git a/svtools/source/brwbox/datwin.hxx b/svtools/source/brwbox/datwin.hxx
index e068f669e46e..1deb8aeb5b56 100644
--- a/svtools/source/brwbox/datwin.hxx
+++ b/svtools/source/brwbox/datwin.hxx
@@ -142,7 +142,6 @@ public:
FASTBOOL bAutoVScroll; // autohide horizontaler Scrollbar
FASTBOOL bUpdateMode; // nicht SV-UpdateMode wegen Invalidate()
FASTBOOL bAutoSizeLastCol;// last column always fills up window
- FASTBOOL bHighlightAuto; // new auto-highlight by SetFont() etc.
FASTBOOL bResizeOnPaint; // outstanding resize-event
FASTBOOL bUpdateOnUnlock; // Update() while locked
FASTBOOL bInUpdateScrollbars; // Rekursionsschutz
diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx
index 817ab743140a..4f0afbaf5d2d 100644
--- a/svtools/source/brwbox/editbrowsebox.cxx
+++ b/svtools/source/brwbox/editbrowsebox.cxx
@@ -47,7 +47,7 @@
#include <svtools/svtdata.hxx>
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
#include <algorithm>
diff --git a/svtools/source/brwbox/editbrowsebox.src b/svtools/source/brwbox/editbrowsebox.src
index 8c00c673c32b..6511d97ea86a 100644
--- a/svtools/source/brwbox/editbrowsebox.src
+++ b/svtools/source/brwbox/editbrowsebox.src
@@ -30,7 +30,7 @@
#endif
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
ImageList RID_SVTOOLS_IMAGELIST_EDITBROWSEBOX
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index 25048527ade0..1a34354603fa 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -33,7 +33,7 @@
#include <svtools/imagemgr.hxx>
#include <svtools/headbar.hxx>
#include <svtools/svtabbx.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include "fileview.hrc"
#include "contentenumeration.hxx"
#include <svtools/AccessibleBrowseBoxObjType.hxx>
@@ -53,6 +53,10 @@
#include <vcl/waitobj.hxx>
#include <com/sun/star/io/XPersist.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/ucb/XCommandInfo.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
#include <algorithm>
#include <memory>
#include <tools/urlobj.hxx>
@@ -62,7 +66,9 @@
#include <ucbhelper/content.hxx>
#include <ucbhelper/commandenvironment.hxx>
#include <vcl/msgbox.hxx>
+#ifndef INCLUDED_RTL_MATH_H
#include <rtl/math.hxx>
+#endif
#include <tools/config.hxx>
#include <osl/mutex.hxx>
#include <osl/conditn.hxx>
@@ -96,7 +102,7 @@ using ::rtl::OUString;
DECLARE_LIST( StringList_Impl, OUString* )
-#define ROW_HEIGHT 17 // the height of a row has to be a little higher than the bitmap
+#define ROW_HEIGHT 17 // the height of a row has to be a little higher than the bitmap
#define QUICK_SEARCH_TIMEOUT 1500 // time in mSec before the quicksearch string will be reseted
namespace
@@ -206,6 +212,7 @@ private:
sal_Bool mbResizeDisabled : 1;
sal_Bool mbAutoResize : 1;
sal_Bool mbEnableDelete : 1;
+ sal_Bool mbEnableRename : 1;
void DeleteEntries();
void DoQuickSearch( const xub_Unicode& rChar );
@@ -228,6 +235,7 @@ public:
void EnableAutoResize() { mbAutoResize = sal_True; }
void EnableDelete( sal_Bool bEnable ) { mbEnableDelete = bEnable; }
+ void EnableRename( sal_Bool bEnable ) { mbEnableRename = bEnable; }
sal_Bool IsDeleteOrContextMenuEnabled() { return mbEnableDelete || IsContextMenuHandlingEnabled(); }
Reference< XCommandEnvironment > GetCommandEnvironment() const { return mxCmdEnv; }
@@ -295,11 +303,11 @@ inline const OUString& HashedEntry::GetName() const
class HashedEntryList : protected List
{// provides a list of _unique_ Entries
protected:
- inline HashedEntry* First();
- inline HashedEntry* Next();
- inline void Append( HashedEntry* pNewEntry );
+ inline HashedEntry* First();
+ inline HashedEntry* Next();
+ inline void Append( HashedEntry* pNewEntry );
public:
- virtual ~HashedEntryList();
+ virtual ~HashedEntryList();
const HashedEntry* Find( const OUString& rNameToSearchFor );
const HashedEntry* Find( const HashedEntry& rToSearchFor );
@@ -334,7 +342,7 @@ HashedEntryList::~HashedEntryList()
const HashedEntry* HashedEntryList::Find( const OUString& rRefName )
{ // simple linear search, which should be fast enough for this purpose
- HashedEntry aRef( rRefName );
+ HashedEntry aRef( rRefName );
HashedEntry* pIter = First();
while( pIter && *pIter != aRef )
pIter = Next();
@@ -415,12 +423,12 @@ class NameTranslationList : protected HashedEntryList
{ // contains a list of substitutes of strings for a given folder (as URL)
// explanation of the circumstances see in remarks for Init();
protected:
- INetURLObject maTransFile; // URL of file with translation entries
- HashedEntry maHashedURL; // for future purposes when dealing with a set of cached
- // NameTranslationLists
+ INetURLObject maTransFile; // URL of file with translation entries
+ HashedEntry maHashedURL; // for future purposes when dealing with a set of cached
+ // NameTranslationLists
private:
const String maTransFileName;
- void Init(); // reads the translation file and fills the (internal) list
+ void Init(); // reads the translation file and fills the (internal) list
public:
NameTranslationList( const INetURLObject& rBaseURL );
@@ -432,12 +440,12 @@ public:
using List::operator!=;
inline sal_Bool operator !=( const HashedEntry& rRef ) const;
- const OUString* Translate( const OUString& rName ) const;
+ const OUString* Translate( const OUString& rName ) const;
// returns NULL, if rName can't be found
- inline void Update(); // clears list and init
+ inline void Update(); // clears list and init
- inline const String& GetTransTableFileName() const;
+ inline const String& GetTransTableFileName() const;
// returns the name for the file, which contains the translation strings
};
@@ -459,7 +467,7 @@ void NameTranslationList::Init()
if( aTestContent.isDocument() )
{// ... also tests the existence of maTransFile by throwing an Exception
- const sal_Char* pSection = "TRANSLATIONNAMES";
+ const sal_Char* pSection = "TRANSLATIONNAMES";
String aFsysName( maTransFile.getFSysPath( INetURLObject::FSYS_DETECT ) );
Config aConfig( aFsysName );
@@ -471,7 +479,7 @@ void NameTranslationList::Init()
Insert( new NameTranslationEntry( aConfig.GetKeyName( nCnt ), aConfig.ReadKey( nCnt ) ) );
}
}
- catch( Exception& ) {}
+ catch( Exception const & ) {}
}
NameTranslationList::NameTranslationList( const INetURLObject& rBaseURL ):
@@ -523,7 +531,7 @@ public:
// IContentTitleTranslation
virtual sal_Bool GetTranslation( const OUString& rOriginalName, OUString& rTranslatedName ) const;
- void UpdateTranslationTable(); // reads the translation file again
+ void UpdateTranslationTable(); // reads the translation file again
void SetActualFolder( const INetURLObject& rActualFolder );
const String* GetTransTableFileName() const;
@@ -596,7 +604,7 @@ public:
void OpenFolder_Impl();
// #83004# -------
- void ReplaceTabWithString( OUString& aValue );
+ void ReplaceTabWithString( OUString& aValue );
void CreateDisplayText_Impl();
void CreateVector_Impl( const Sequence < OUString > &rList );
void SortFolderContent_Impl();
@@ -657,11 +665,13 @@ inline void SvtFileView_Impl::EnableDelete( sal_Bool bEnable )
inline sal_Bool SvtFileView_Impl::EnableNameReplacing( sal_Bool bEnable )
{
+ mpView->EnableRename( bEnable );
+
sal_Bool bRet;
if( mpView->IsDeleteOrContextMenuEnabled() )
{
DBG_ASSERT( !mbReplaceNames, "SvtFileView_Impl::EnableNameReplacing(): state should be not possible!" );
- bRet = !bEnable; // only for enabling this is an unsuccessful result
+ bRet = !bEnable; // only for enabling this is an unsuccessful result
}
else
{
@@ -740,7 +750,8 @@ ViewTabListBox_Impl::ViewTabListBox_Impl( Window* pParentWin,
mnSearchIndex ( 0 ),
mbResizeDisabled ( sal_False ),
mbAutoResize ( sal_False ),
- mbEnableDelete ( sal_True )
+ mbEnableDelete ( sal_True ),
+ mbEnableRename ( sal_True )
{
Size aBoxSize = pParentWin->GetSizePixel();
@@ -820,7 +831,7 @@ void ViewTabListBox_Impl::Resize()
mbResizeDisabled = sal_True;
Point aPos = GetPosPixel();
SetPosSizePixel( Point( 0, aBarSize.Height() ),
- Size( aBoxSize.Width(), aBoxSize.Height() - aBarSize.Height() ) );
+ Size( aBoxSize.Width(), aBoxSize.Height() - aBarSize.Height() ) );
mbResizeDisabled = sal_False;
}
}
@@ -866,20 +877,90 @@ void ViewTabListBox_Impl::KeyInput( const KeyEvent& rKEvt )
PopupMenu* ViewTabListBox_Impl::CreateContextMenu( void )
{
- PopupMenu* pRet;
- sal_Int32 nSelectedEntries = GetSelectionCount();
+ bool bEnableDelete = mbEnableDelete;
+ bool bEnableRename = mbEnableRename;
+
+ if ( bEnableDelete || bEnableRename )
+ {
+ sal_Int32 nSelectedEntries = GetSelectionCount();
+ bEnableDelete &= nSelectedEntries > 0;
+ bEnableRename &= nSelectedEntries == 1;
+ }
+
+ if ( bEnableDelete || bEnableRename )
+ {
+ SvLBoxEntry* pEntry = FirstSelected();
+ while ( pEntry )
+ {
+ ::ucbhelper::Content aCnt;
+ try
+ {
+ OUString aURL( static_cast< SvtContentEntry * >(
+ pEntry->GetUserData() )->maURL );
+ aCnt = ::ucbhelper::Content( aURL, mxCmdEnv );
+ }
+ catch( Exception const & )
+ {
+ bEnableDelete = bEnableRename = false;
+ }
+
+ if ( bEnableDelete )
+ {
+ try
+ {
+ Reference< XCommandInfo > aCommands = aCnt.getCommands();
+ if ( aCommands.is() )
+ bEnableDelete
+ = aCommands->hasCommandByName(
+ OUString::createFromAscii( "delete" ) );
+ else
+ bEnableDelete = false;
+ }
+ catch( Exception const & )
+ {
+ bEnableDelete = false;
+ }
+ }
+
+ if ( bEnableRename )
+ {
+ try
+ {
+ Reference< XPropertySetInfo > aProps = aCnt.getProperties();
+ if ( aProps.is() )
+ {
+ Property aProp
+ = aProps->getPropertyByName(
+ OUString::createFromAscii( "Title" ) );
+ bEnableRename
+ = !( aProp.Attributes & PropertyAttribute::READONLY );
+ }
+ else
+ bEnableRename = false;
+ }
+ catch( Exception const & )
+ {
+ bEnableRename = false;
+ }
+ }
+
+ pEntry = ( bEnableDelete || bEnableRename )
+ ? NextSelected( pEntry )
+ : 0;
+ }
+ }
- if ( nSelectedEntries )
+ if ( bEnableDelete || bEnableRename )
{
- pRet = new PopupMenu( SvtResId( RID_FILEVIEW_CONTEXTMENU ) );
- pRet->EnableItem( MID_FILEVIEW_DELETE, 0 < nSelectedEntries );
- pRet->EnableItem( MID_FILEVIEW_RENAME, 1 == nSelectedEntries );
+ PopupMenu * pRet
+ = new PopupMenu( SvtResId( RID_FILEVIEW_CONTEXTMENU ) );
+ pRet->EnableItem( MID_FILEVIEW_DELETE, bEnableDelete );
+ pRet->EnableItem( MID_FILEVIEW_RENAME, bEnableRename );
pRet->RemoveDisabledEntries( sal_True, sal_True );
+ return pRet;
}
- else
- pRet = NULL;
- return pRet;
+ return NULL;
}
// -----------------------------------------------------------------------
@@ -924,12 +1005,31 @@ void ViewTabListBox_Impl::DeleteEntries()
aURL = ( (SvtContentEntry*)pCurEntry->GetUserData() )->maURL;
if ( !aURL.Len() )
- return;
+ continue;
+
+ bool canDelete = true;
+ try
+ {
+ ::ucbhelper::Content aCnt( aURL, mxCmdEnv );
+ Reference< XCommandInfo > aCommands = aCnt.getCommands();
+ if ( aCommands.is() )
+ canDelete
+ = aCommands->hasCommandByName(
+ OUString::createFromAscii( "delete" ) );
+ else
+ canDelete = false;
+ }
+ catch( Exception const & )
+ {
+ canDelete = false;
+ }
- INetURLObject aObj( aURL );
+ if (!canDelete)
+ continue; // process next entry
if ( eResult != svtools::QUERYDELETE_ALL )
{
+ INetURLObject aObj( aURL );
svtools::QueryDeleteDlg_Impl aDlg( NULL, aObj.GetName( INetURLObject::DECODE_WITH_CHARSET ) );
if ( sDialogPosition.Len() )
aDlg.SetWindowState( sDialogPosition );
@@ -975,22 +1075,44 @@ BOOL ViewTabListBox_Impl::EditedEntry( SvLBoxEntry* pEntry,
try
{
+ OUString aPropName = OUString::createFromAscii( "Title" );
+ bool canRename = true;
::ucbhelper::Content aContent( aURL, mxCmdEnv );
- OUString aPropName = OUString::createFromAscii( "Title" );
- Any aValue;
- aValue <<= OUString( rNewText );
- aContent.setPropertyValue( aPropName, aValue );
- mpParent->EntryRenamed( aURL, rNewText );
+ try
+ {
+ Reference< XPropertySetInfo > aProps = aContent.getProperties();
+ if ( aProps.is() )
+ {
+ Property aProp = aProps->getPropertyByName( aPropName );
+ canRename = !( aProp.Attributes & PropertyAttribute::READONLY );
+ }
+ else
+ {
+ canRename = false;
+ }
+ }
+ catch ( Exception const & )
+ {
+ canRename = false;
+ }
+
+ if ( canRename )
+ {
+ Any aValue;
+ aValue <<= OUString( rNewText );
+ aContent.setPropertyValue( aPropName, aValue );
+ mpParent->EntryRenamed( aURL, rNewText );
- pData->maURL = aURL;
- pEntry->SetUserData( pData );
+ pData->maURL = aURL;
+ pEntry->SetUserData( pData );
- bRet = TRUE;
+ bRet = TRUE;
+ }
+ }
+ catch( Exception const & )
+ {
}
- catch( ::com::sun::star::ucb::ContentCreationException ) {}
- catch( ::com::sun::star::ucb::CommandAbortedException ) {}
- catch( ::com::sun::star::uno::Exception ) {}
return bRet;
}
@@ -1091,12 +1213,12 @@ sal_Bool ViewTabListBox_Impl::Kill( const OUString& rContent )
::ucbhelper::Content aCnt( rContent, mxCmdEnv );
aCnt.executeCommand( OUString::createFromAscii( "delete" ), makeAny( sal_Bool( sal_True ) ) );
}
- catch( ::com::sun::star::ucb::CommandAbortedException& )
+ catch( ::com::sun::star::ucb::CommandAbortedException const & )
{
DBG_WARNING( "CommandAbortedException" );
bRet = sal_False;
}
- catch( ::com::sun::star::uno::Exception& )
+ catch( Exception const & )
{
DBG_WARNING( "Any other exception" );
bRet = sal_False;
@@ -1310,7 +1432,7 @@ sal_Bool SvtFileView::GetParentURL( String& rParentURL ) const
}
}
}
- catch( ::com::sun::star::uno::Exception )
+ catch( Exception const & )
{
// perhaps an unkown url protocol (e.g. "private:newdoc")
}
@@ -1362,7 +1484,7 @@ sal_Bool SvtFileView::Initialize( const ::com::sun::star::uno::Reference< ::com:
mpImp->FilterFolderContent_Impl( rFilter );
- mpImp->SortFolderContent_Impl(); // possibly not necessary!!!!!!!!!!
+ mpImp->SortFolderContent_Impl(); // possibly not necessary!!!!!!!!!!
mpImp->CreateDisplayText_Impl();
mpImp->OpenFolder_Impl();
@@ -1995,7 +2117,7 @@ void SvtFileView_Impl::FilterFolderContent_Impl( const OUString &rFilter )
{
// normalize the content title (we always match case-insensitive)
// 91872 - 11.09.2001 - frank.schoenheit@sun.com
- sCompareString = (*aContentLoop)->GetFileName(); // filter works on file name, not on title!
+ sCompareString = (*aContentLoop)->GetFileName(); // filter works on file name, not on title!
sal_Bool bDelete;
if( bHideTransFile && sCompareString == sHideEntry )
@@ -2639,12 +2761,12 @@ QueryDeleteDlg_Impl::QueryDeleteDlg_Impl
ModalDialog( pParent, SvtResId( DLG_SVT_QUERYDELETE ) ),
- _aEntryLabel ( this, SvtResId( TXT_ENTRY ) ),
- _aEntry ( this, SvtResId( TXT_ENTRYNAME ) ),
- _aQueryMsg ( this, SvtResId( TXT_QUERYMSG ) ),
- _aYesButton ( this, SvtResId( BTN_YES ) ),
- _aAllButton ( this, SvtResId( BTN_ALL ) ),
- _aNoButton ( this, SvtResId( BTN_NO ) ),
+ _aEntryLabel ( this, SvtResId( TXT_ENTRY ) ),
+ _aEntry ( this, SvtResId( TXT_ENTRYNAME ) ),
+ _aQueryMsg ( this, SvtResId( TXT_QUERYMSG ) ),
+ _aYesButton ( this, SvtResId( BTN_YES ) ),
+ _aAllButton ( this, SvtResId( BTN_ALL ) ),
+ _aNoButton ( this, SvtResId( BTN_NO ) ),
_aCancelButton( this, SvtResId( BTN_CANCEL ) )
{
@@ -2667,12 +2789,6 @@ QueryDeleteDlg_Impl::QueryDeleteDlg_Impl
// -----------------------------------------------------------------------
IMPL_STATIC_LINK( QueryDeleteDlg_Impl, ClickLink, PushButton*, pBtn )
-
-/* [Beschreibung]
-
- Die Methode wertet das Resultat der Abfrage aus.
-*/
-
{
if ( pBtn == &pThis->_aYesButton )
pThis->_eResult = QUERYDELETE_YES;
diff --git a/svtools/source/contnr/fileview.src b/svtools/source/contnr/fileview.src
index e45f35fc1927..f40530c10347 100644
--- a/svtools/source/contnr/fileview.src
+++ b/svtools/source/contnr/fileview.src
@@ -27,7 +27,7 @@
// includes ------------------------------------------------------------------
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include "fileview.hrc"
#include <svtools/helpid.hrc>
diff --git a/svtools/source/contnr/svcontnr.src b/svtools/source/contnr/svcontnr.src
index c296cc686c1d..bcd1e060664f 100644
--- a/svtools/source/contnr/svcontnr.src
+++ b/svtools/source/contnr/svcontnr.src
@@ -25,7 +25,7 @@
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
Image RID_IMG_TREENODE_COLLAPSED
{
diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx
index bae5309ffff3..1b791ab8d904 100644
--- a/svtools/source/contnr/svimpbox.cxx
+++ b/svtools/source/contnr/svimpbox.cxx
@@ -40,7 +40,7 @@
#include <svimpbox.hxx>
#include <rtl/instance.hxx>
#include <svtools/svtdata.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
// #102891# --------------------
#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
diff --git a/svtools/source/contnr/svlbox.cxx b/svtools/source/contnr/svlbox.cxx
index 2752e813052e..fb71f64772ad 100644
--- a/svtools/source/contnr/svlbox.cxx
+++ b/svtools/source/contnr/svlbox.cxx
@@ -1515,9 +1515,10 @@ void SvLBox::MakeVisible( SvLBoxEntry* )
DBG_CHKTHIS(SvLBox,0);
}
-void SvLBox::Command( const CommandEvent& )
+void SvLBox::Command( const CommandEvent& i_rCommandEvent )
{
DBG_CHKTHIS(SvLBox,0);
+ Control::Command( i_rCommandEvent );
}
void SvLBox::KeyInput( const KeyEvent& rKEvt )
@@ -1774,10 +1775,14 @@ void SvLBox::StartDrag( sal_Int8, const Point& rPosPixel )
{
DBG_CHKTHIS(SvLBox,0);
+ nOldDragMode = GetDragDropMode();
+ if ( !nOldDragMode )
+ return;
+
ReleaseMouse();
+
SvLBoxEntry* pEntry = GetEntry( rPosPixel ); // GetDropTarget( rPos );
- nOldDragMode = GetDragDropMode();
- if( !pEntry || !nOldDragMode )
+ if( !pEntry )
{
DragFinished( DND_ACTION_NONE );
return;
diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx
index 9d4ad1ba15b5..53fbded59f11 100644
--- a/svtools/source/contnr/svtabbx.cxx
+++ b/svtools/source/contnr/svtabbx.cxx
@@ -31,7 +31,7 @@
#include <svtools/headbar.hxx>
#include <svtools/svtdata.hxx>
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
@@ -1232,7 +1232,7 @@ BOOL SvHeaderTabListBox::GetGlyphBoundRects( const Point& rOrigin, const String&
return Control::GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, nBase, rVector );
}
// -----------------------------------------------------------------------
-Rectangle SvHeaderTabListBox::GetWindowExtentsRelative( Window *pRelativeWindow )
+Rectangle SvHeaderTabListBox::GetWindowExtentsRelative( Window *pRelativeWindow ) const
{
return Control::GetWindowExtentsRelative( pRelativeWindow );
}
diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx
index 143ac922eebc..c1c746f2dd63 100644
--- a/svtools/source/contnr/svtreebx.cxx
+++ b/svtools/source/contnr/svtreebx.cxx
@@ -40,6 +40,7 @@ class TabBar;
#include <svtools/svlbox.hxx>
#include <svtools/svlbitm.hxx>
#include <svtools/svtreebx.hxx>
+#include <tools/diagnose_ex.h>
#include <svimpbox.hxx>
#include <unotools/accessiblestatesethelper.hxx>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
@@ -427,17 +428,6 @@ SvLBoxEntry* SvTreeListBox::InsertEntry( const XubString& aText,SvLBoxEntry* pPa
else
SvLBox::Insert( pEntry, pParent, nPos );
- short nExpWidth = (short)rDefExpBmp.GetSizePixel().Width();
- short nColWidth = (short)rDefColBmp.GetSizePixel().Width();
- short nMax = Max(nExpWidth, nColWidth);
- // #97680# ----------------
- nMax = pImp->UpdateContextBmpWidthVector( pEntry, nMax );
- if( nMax > nContextBmpWidthMax )
- {
- nContextBmpWidthMax = nMax;
- SetTabs();
- }
-
aPrevInsertedExpBmp = rDefExpBmp;
aPrevInsertedColBmp = rDefColBmp;
@@ -468,17 +458,6 @@ SvLBoxEntry* SvTreeListBox::InsertEntry( const XubString& aText,
else
SvLBox::Insert( pEntry, pParent, nPos );
- short nExpWidth = (short)aExpEntryBmp.GetSizePixel().Width();
- short nColWidth = (short)aCollEntryBmp.GetSizePixel().Width();
- short nMax = Max(nExpWidth, nColWidth);
- // #97680# ----------------
- nMax = pImp->UpdateContextBmpWidthVector( pEntry, nMax );
- if( nMax > nContextBmpWidthMax )
- {
- nContextBmpWidthMax = nMax;
- SetTabs();
- }
-
aPrevInsertedExpBmp = aExpEntryBmp;
aPrevInsertedColBmp = aCollEntryBmp;
@@ -1041,7 +1020,7 @@ BOOL SvTreeListBox::Expand( SvLBoxEntry* pParent )
// --> OD 2009-04-01 #i92103#
if ( bExpanded )
{
- pImp->CallEventListeners( VCLEVENT_LISTBOX_ENTRY_EXPANDED, pParent );
+ pImp->CallEventListeners( VCLEVENT_ITEM_EXPANDED, pParent );
}
// <--
@@ -1068,7 +1047,7 @@ BOOL SvTreeListBox::Collapse( SvLBoxEntry* pParent )
// --> OD 2009-04-01 #i92103#
if ( bCollapsed )
{
- pImp->CallEventListeners( VCLEVENT_LISTBOX_ENTRY_COLLAPSED, pParent );
+ pImp->CallEventListeners( VCLEVENT_ITEM_COLLAPSED, pParent );
}
// <--
@@ -2250,6 +2229,7 @@ Region SvTreeListBox::GetDragRegion() const
void SvTreeListBox::Command( const CommandEvent& rCEvt )
{
DBG_CHKTHIS(SvTreeListBox,0);
+ // FIXME gnumake2 resync to DEV300_m84
pImp->Command( rCEvt );
}
@@ -2346,6 +2326,25 @@ void SvTreeListBox::ModelNotification( USHORT nActionId, SvListEntry* pEntry1,
SvLBox::ModelNotification( nActionId, pEntry1, pEntry2, nPos );
switch( nActionId )
{
+ case LISTACTION_INSERTED:
+ {
+ SvLBoxEntry* pEntry( dynamic_cast< SvLBoxEntry* >( pEntry1 ) );
+ ENSURE_OR_BREAK( pEntry, "SvTreeListBox::ModelNotification: invalid entry!" );
+ SvLBoxContextBmp* pBmpItem = static_cast< SvLBoxContextBmp* >( pEntry->GetFirstItem( SV_ITEM_ID_LBOXCONTEXTBMP ) );
+ if ( !pBmpItem )
+ break;
+ const Image& rBitmap1( pBmpItem->GetBitmap1() );
+ const Image& rBitmap2( pBmpItem->GetBitmap2() );
+ short nMaxWidth = short( Max( rBitmap1.GetSizePixel().Width(), rBitmap2.GetSizePixel().Width() ) );
+ nMaxWidth = pImp->UpdateContextBmpWidthVector( pEntry, nMaxWidth );
+ if( nMaxWidth > nContextBmpWidthMax )
+ {
+ nContextBmpWidthMax = nMaxWidth;
+ SetTabs();
+ }
+ }
+ break;
+
case LISTACTION_RESORTING:
SetUpdateMode( FALSE );
break;
diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx
index 19236e869d16..86bab5b8e42a 100644
--- a/svtools/source/contnr/templwin.cxx
+++ b/svtools/source/contnr/templwin.cxx
@@ -40,7 +40,7 @@
#include <svtools/templatefoldercache.hxx>
#include <svtools/imgdef.hxx>
#include <svtools/txtattr.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include "templwin.hrc"
#include <svtools/helpid.hrc>
#include <unotools/pathoptions.hxx>
diff --git a/svtools/source/contnr/templwin.src b/svtools/source/contnr/templwin.src
index e596465c6c33..3b0dff5d12e6 100644
--- a/svtools/source/contnr/templwin.src
+++ b/svtools/source/contnr/templwin.src
@@ -30,7 +30,7 @@
#include "templwin.hrc"
#include <svtools/controldims.hrc>
#include <svtools/helpid.hrc>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
// Magenta and Grey as mask colors
#define MASK_COL_MAGENTA Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx
index b88be8aa977d..043d7023508b 100644..100755
--- a/svtools/source/control/calendar.cxx
+++ b/svtools/source/control/calendar.cxx
@@ -43,7 +43,7 @@
#include <com/sun/star/i18n/CalendarFieldIndex.hpp>
#define _SV_CALENDAR_CXX
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <svtools/svtdata.hxx>
#include <svtools/calendar.hxx>
diff --git a/svtools/source/control/calendar.src b/svtools/source/control/calendar.src
index 15c82cfdd184..4dd31765a5c1 100644..100755
--- a/svtools/source/control/calendar.src
+++ b/svtools/source/control/calendar.src
@@ -25,7 +25,7 @@
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
String STR_SVT_CALENDAR_DAY
{
Text [ en-US ] = "Day" ;
diff --git a/svtools/source/control/collatorres.cxx b/svtools/source/control/collatorres.cxx
index 0ac66659d639..4514ec918b24 100644..100755
--- a/svtools/source/control/collatorres.cxx
+++ b/svtools/source/control/collatorres.cxx
@@ -29,7 +29,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
#include <svtools/svtdata.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <svtools/collatorres.hxx>
// -------------------------------------------------------------------------
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index fdccbaa11a49..91c446a880a9 100644..100755
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -36,7 +36,7 @@
#include <unotools/charclass.hxx>
#include <svtools/svtdata.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <svtools/ctrlbox.hxx>
#include <svtools/ctrltool.hxx>
diff --git a/svtools/source/control/ctrlbox.src b/svtools/source/control/ctrlbox.src
index 0c63aef259b3..95440c905d89 100644..100755
--- a/svtools/source/control/ctrlbox.src
+++ b/svtools/source/control/ctrlbox.src
@@ -24,7 +24,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#ifndef IMAGE_STDBTN_COLOR
#define IMAGE_STDBTN_COLOR Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; }
diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx
index f22b872e3a61..979a8a3a3d32 100644..100755
--- a/svtools/source/control/ctrltool.cxx
+++ b/svtools/source/control/ctrltool.cxx
@@ -37,7 +37,7 @@
#include <vcl/window.hxx>
#include <vcl/svapp.hxx>
#include <vcl/wrkwin.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <svtools/svtdata.hxx>
#include <svtools/ctrltool.hxx>
diff --git a/svtools/source/control/ctrltool.src b/svtools/source/control/ctrltool.src
index 3e1c1ba884f8..72420af4908e 100644..100755
--- a/svtools/source/control/ctrltool.src
+++ b/svtools/source/control/ctrltool.src
@@ -24,7 +24,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
String STR_SVT_STYLE_LIGHT
{
diff --git a/svtools/source/control/indexentryres.cxx b/svtools/source/control/indexentryres.cxx
index 7dbca80892b1..23eada244a47 100644..100755
--- a/svtools/source/control/indexentryres.cxx
+++ b/svtools/source/control/indexentryres.cxx
@@ -29,7 +29,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
#include <svtools/svtdata.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <svtools/indexentryres.hxx>
// -------------------------------------------------------------------------
diff --git a/svtools/source/control/makefile.mk b/svtools/source/control/makefile.mk
index a40a81163eb3..a2e622730635 100644..100755
--- a/svtools/source/control/makefile.mk
+++ b/svtools/source/control/makefile.mk
@@ -51,7 +51,9 @@ EXCEPTIONSFILES=\
$(SLO)$/scriptedtext.obj\
$(SLO)$/fmtfield.obj \
$(SLO)$/inettbc.obj \
- $(SLO)$/valueacc.obj
+ $(SLO)$/valueacc.obj \
+ $(SLO)$/toolbarmenu.obj \
+ $(SLO)$/toolbarmenuacc.obj
SLOFILES=\
$(EXCEPTIONSFILES) \
diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index 640aaea008bd..36d1e6c3b5c4 100644..100755
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -39,6 +39,8 @@
#include <vcl/edit.hxx>
#include "svtaccessiblefactory.hxx"
+#include <limits>
+
// =======================================================================
#define TABBAR_OFFSET_X 7
@@ -62,6 +64,10 @@ struct ImplTabBarItem
BOOL mbShort;
BOOL mbSelect;
BOOL mbEnable;
+ Color maTabBgColor;
+ bool IsDefaultTabBgColor() const { return maTabBgColor == Color(COL_AUTO) ? TRUE : FALSE; };
+ Color maTabTextColor;
+ bool IsDefaultTabTextColor() const { return maTabTextColor == Color(COL_AUTO) ? TRUE : FALSE; };
ImplTabBarItem( USHORT nItemId, const XubString& rText,
TabBarPageBits nPageBits ) :
@@ -74,6 +80,8 @@ struct ImplTabBarItem
mbShort = FALSE;
mbSelect = FALSE;
mbEnable = TRUE;
+ maTabBgColor = Color( COL_AUTO );
+ maTabTextColor = Color( COL_AUTO );
}
};
@@ -348,6 +356,9 @@ struct TabBar_Impl
// =======================================================================
+const sal_uInt16 TabBar::APPEND = ::std::numeric_limits<sal_uInt16>::max();
+const sal_uInt16 TabBar::PAGE_NOT_FOUND = ::std::numeric_limits<sal_uInt16>::max();
+
void TabBar::ImplInit( WinBits nWinStyle )
{
mpItemList = new ImplTabBarList;
@@ -1046,7 +1057,8 @@ void TabBar::Paint( const Rectangle& )
// Font selektieren
Font aFont = GetFont();
Font aLightFont = aFont;
- aLightFont.SetWeight( WEIGHT_LIGHT );
+ //aLightFont.SetWeight( WEIGHT_LIGHT ); //TODO Make font weight light on custom color only?
+ aLightFont.SetWeight( WEIGHT_NORMAL );
// #i36013# exclude push buttons from painting area
Rectangle aClipRect( Point( mnOffX, 0 ), Point( mnLastOffX, GetOutputHeightPixel() - 1 ) );
@@ -1120,15 +1132,23 @@ void TabBar::Paint( const Rectangle& )
SetFont( aLightFont );
// Je nach Status die richtige FillInBrush setzen
+ // Set the correct FillInBrush depending upon status
if ( pItem->mbSelect || (pItem->mnId == mnCurPageId) )
{
+ // Currently selected Tab
SetFillColor( aSelectColor );
SetTextColor( aSelectTextColor );
}
else
{
- SetFillColor( aFaceColor );
- SetTextColor( aFaceTextColor );
+ if ( !pItem->IsDefaultTabBgColor() && !rStyleSettings.GetHighContrastMode() )
+ {
+ SetFillColor( pItem->maTabBgColor );
+ SetTextColor( pItem->maTabTextColor );
+ } else {
+ SetFillColor( aFaceColor );
+ SetTextColor( aFaceTextColor );
+ }
}
// Muss Font Kursiv geschaltet werden
@@ -1160,21 +1180,38 @@ void TabBar::Paint( const Rectangle& )
long nTextHeight = GetTextHeight();
Point aTxtPos( aRect.Left()+(aRectSize.Width()-nTextWidth)/2,
(aRectSize.Height()-nTextHeight)/2 );
- if ( !pItem->mbEnable )
- DrawCtrlText( aTxtPos, aText, 0, STRING_LEN, (TEXT_DRAW_DISABLE | TEXT_DRAW_MNEMONIC) );
- else
- DrawText( aTxtPos, aText );
-
+ if ( pItem->IsDefaultTabBgColor() || (!pItem->mbSelect) )
+ {
+ if ( !pItem->mbEnable )
+ DrawCtrlText( aTxtPos, aText, 0, STRING_LEN, (TEXT_DRAW_DISABLE | TEXT_DRAW_MNEMONIC) );
+ else
+ DrawText( aTxtPos, aText );
+ }
// Jetzt im Inhalt den 3D-Effekt ausgeben
aPos0.X()++;
aPos1.X()++;
aPos2.X()--;
aPos3.X()--;
- SetLineColor( rStyleSettings.GetLightColor() );
+
+ // If this is the current tab, draw the left inner shadow the default color,
+ // otherwise make it the same as the custom background color
+ if ( pItem->mbSelect || (pItem->mnId == mnCurPageId) ) {
+ SetLineColor( rStyleSettings.GetLightColor() );
+ } else {
+ if ( !pItem->IsDefaultTabBgColor() && ! rStyleSettings.GetHighContrastMode() )
+ {
+ SetLineColor( pItem->maTabBgColor );
+ } else {
+ SetLineColor( rStyleSettings.GetLightColor() );
+ }
+ }
+ // Draw the left side of the tab
DrawLine( aPos0, aPos1 );
if ( !pItem->mbSelect && (pItem->mnId != mnCurPageId) )
{
+ // Draw the top inner shadow
+ // ToDo: Change from this static color to tab custom bg color
DrawLine( Point( aPos0.X(), aPos0.Y()+1 ),
Point( aPos3.X(), aPos3.Y()+1 ) );
}
@@ -1184,8 +1221,27 @@ void TabBar::Paint( const Rectangle& )
aPos1.X()--;
aPos1.Y()--;
aPos2.Y()--;
+ if ( !pItem->IsDefaultTabBgColor() && ( pItem->mbSelect || (pItem->mnId == mnCurPageId) ) )
+ {
+ SetLineColor( pItem->maTabBgColor );
+ DrawLine( Point(aPos1.X()-1, aPos1.Y()-1), Point(aPos2.X(), aPos2.Y()-1) );
+ }
DrawLine( aPos1, aPos2 );
+ // draw a small 2px sliver of the original background color at the bottom of the selected tab
+
+ if ( !pItem->IsDefaultTabBgColor() )
+ {
+ if ( pItem->mbSelect || (pItem->mnId == mnCurPageId) || rStyleSettings.GetHighContrastMode() ) {
+ SetLineColor( pItem->maTabBgColor );
+ DrawLine( Point(aPos1.X()-1, aPos1.Y()-1), Point(aPos2.X(), aPos2.Y()-1) );
+ if ( !pItem->mbEnable )
+ DrawCtrlText( aTxtPos, aText, 0, STRING_LEN, (TEXT_DRAW_DISABLE | TEXT_DRAW_MNEMONIC) );
+ else
+ DrawText( aTxtPos, aText );
+ }
+ }
+
// Da etwas uebermalt werden konnte, muessen wir die Polygon-
// umrandung nocheinmal ausgeben
SetLineColor( rStyleSettings.GetDarkShadowColor() );
@@ -1540,7 +1596,7 @@ void TabBar::InsertPage( USHORT nPageId, const XubString& rText,
TabBarPageBits nBits, USHORT nPos )
{
DBG_ASSERT( nPageId, "TabBar::InsertPage(): PageId == 0" );
- DBG_ASSERT( GetPagePos( nPageId ) == TABBAR_PAGE_NOTFOUND,
+ DBG_ASSERT( GetPagePos( nPageId ) == PAGE_NOT_FOUND,
"TabBar::InsertPage(): PageId already exists" );
DBG_ASSERT( nBits <= TPB_SPECIAL, "TabBar::InsertPage(): nBits is wrong" );
@@ -1562,12 +1618,47 @@ void TabBar::InsertPage( USHORT nPageId, const XubString& rText,
// -----------------------------------------------------------------------
+Color TabBar::GetTabBgColor( USHORT nPageId ) const
+{
+ USHORT nPos = GetPagePos( nPageId );
+
+ if ( nPos != PAGE_NOT_FOUND )
+ return mpItemList->GetObject( nPos )->maTabBgColor;
+ else
+ return Color( COL_AUTO );
+}
+
+void TabBar::SetTabBgColor( USHORT nPageId, const Color& aTabBgColor )
+{
+ USHORT nPos = GetPagePos( nPageId );
+ ImplTabBarItem* pItem;
+ if ( nPos != PAGE_NOT_FOUND )
+ {
+ pItem = mpItemList->GetObject( nPos );
+ if ( aTabBgColor != Color( COL_AUTO ) )
+ {
+ pItem->maTabBgColor = aTabBgColor;
+ if ( aTabBgColor.GetLuminance() <= 128 ) //Do not use aTabBgColor.IsDark(), because that threshold is way too low...
+ pItem->maTabTextColor = Color( COL_WHITE );
+ else
+ pItem->maTabTextColor = Color( COL_BLACK );
+ }
+ else
+ {
+ pItem->maTabBgColor = Color( COL_AUTO );
+ pItem->maTabTextColor = Color( COL_AUTO );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
void TabBar::RemovePage( USHORT nPageId )
{
USHORT nPos = GetPagePos( nPageId );
// Existiert Item
- if ( nPos != TABBAR_PAGE_NOTFOUND )
+ if ( nPos != PAGE_NOT_FOUND )
{
if ( mnCurPageId == nPageId )
mnCurPageId = 0;
@@ -1602,7 +1693,7 @@ void TabBar::MovePage( USHORT nPageId, USHORT nNewPos )
return;
// Existiert Item
- if ( nPos != TABBAR_PAGE_NOTFOUND )
+ if ( nPos != PAGE_NOT_FOUND )
{
// TabBar-Item in der Liste verschieben
ImplTabBarItem* pItem = mpItemList->Remove( nPos );
@@ -1640,7 +1731,7 @@ void TabBar::Clear()
if ( IsReallyVisible() && IsUpdateMode() )
Invalidate();
- CallEventListeners( VCLEVENT_TABBAR_PAGEREMOVED, (void*) TABBAR_PAGE_NOTFOUND );
+ CallEventListeners( VCLEVENT_TABBAR_PAGEREMOVED, (void*) PAGE_NOT_FOUND );
}
// -----------------------------------------------------------------------
@@ -1649,7 +1740,7 @@ void TabBar::EnablePage( USHORT nPageId, BOOL bEnable )
{
USHORT nPos = GetPagePos( nPageId );
- if ( nPos != TABBAR_PAGE_NOTFOUND )
+ if ( nPos != PAGE_NOT_FOUND )
{
ImplTabBarItem* pItem = mpItemList->GetObject( nPos );
@@ -1672,7 +1763,7 @@ BOOL TabBar::IsPageEnabled( USHORT nPageId ) const
{
USHORT nPos = GetPagePos( nPageId );
- if ( nPos != TABBAR_PAGE_NOTFOUND )
+ if ( nPos != PAGE_NOT_FOUND )
return mpItemList->GetObject( nPos )->mbEnable;
else
return FALSE;
@@ -1684,7 +1775,7 @@ void TabBar::SetPageBits( USHORT nPageId, TabBarPageBits nBits )
{
USHORT nPos = GetPagePos( nPageId );
- if ( nPos != TABBAR_PAGE_NOTFOUND )
+ if ( nPos != PAGE_NOT_FOUND )
{
ImplTabBarItem* pItem = mpItemList->GetObject( nPos );
@@ -1705,7 +1796,7 @@ TabBarPageBits TabBar::GetPageBits( USHORT nPageId ) const
{
USHORT nPos = GetPagePos( nPageId );
- if ( nPos != TABBAR_PAGE_NOTFOUND )
+ if ( nPos != PAGE_NOT_FOUND )
return mpItemList->GetObject( nPos )->mnBits;
else
return FALSE;
@@ -1742,7 +1833,7 @@ USHORT TabBar::GetPagePos( USHORT nPageId ) const
pItem = mpItemList->Next();
}
- return TABBAR_PAGE_NOTFOUND;
+ return PAGE_NOT_FOUND;
}
// -----------------------------------------------------------------------
@@ -1767,7 +1858,7 @@ Rectangle TabBar::GetPageRect( USHORT nPageId ) const
{
USHORT nPos = GetPagePos( nPageId );
- if ( nPos != TABBAR_PAGE_NOTFOUND )
+ if ( nPos != PAGE_NOT_FOUND )
return mpItemList->GetObject( nPos )->maRect;
else
return Rectangle();
@@ -1780,7 +1871,7 @@ void TabBar::SetCurPageId( USHORT nPageId )
USHORT nPos = GetPagePos( nPageId );
// Wenn Item nicht existiert, dann nichts machen
- if ( nPos != TABBAR_PAGE_NOTFOUND )
+ if ( nPos != PAGE_NOT_FOUND )
{
// Wenn sich aktuelle Page nicht geaendert hat, dann muessen wir
// jetzt nichts mehr machen
@@ -1872,7 +1963,7 @@ void TabBar::MakeVisible( USHORT nPageId )
USHORT nPos = GetPagePos( nPageId );
// Wenn Item nicht existiert, dann nichts machen
- if ( nPos != TABBAR_PAGE_NOTFOUND )
+ if ( nPos != PAGE_NOT_FOUND )
{
if ( nPos < mnFirstPos )
SetFirstPageId( nPageId );
@@ -1921,7 +2012,7 @@ void TabBar::SetFirstPageId( USHORT nPageId )
USHORT nPos = GetPagePos( nPageId );
// Wenn Item nicht existiert, dann FALSE zurueckgeben
- if ( nPos != TABBAR_PAGE_NOTFOUND )
+ if ( nPos != PAGE_NOT_FOUND )
{
if ( nPos != mnFirstPos )
{
@@ -1955,7 +2046,7 @@ void TabBar::SelectPage( USHORT nPageId, BOOL bSelect )
{
USHORT nPos = GetPagePos( nPageId );
- if ( nPos != TABBAR_PAGE_NOTFOUND )
+ if ( nPos != PAGE_NOT_FOUND )
{
ImplTabBarItem* pItem = mpItemList->GetObject( nPos );
@@ -2036,7 +2127,7 @@ USHORT TabBar::GetSelectPageCount() const
BOOL TabBar::IsPageSelected( USHORT nPageId ) const
{
USHORT nPos = GetPagePos( nPageId );
- if ( nPos != TABBAR_PAGE_NOTFOUND )
+ if ( nPos != PAGE_NOT_FOUND )
return mpItemList->GetObject( nPos )->mbSelect;
else
return FALSE;
@@ -2047,7 +2138,7 @@ BOOL TabBar::IsPageSelected( USHORT nPageId ) const
BOOL TabBar::StartEditMode( USHORT nPageId )
{
USHORT nPos = GetPagePos( nPageId );
- if ( mpEdit || (nPos == TABBAR_PAGE_NOTFOUND) || (mnLastOffX < 8) )
+ if ( mpEdit || (nPos == PAGE_NOT_FOUND) || (mnLastOffX < 8) )
return FALSE;
mnEditId = nPageId;
@@ -2268,7 +2359,7 @@ void TabBar::SetSelectTextColor( const Color& rColor )
void TabBar::SetPageText( USHORT nPageId, const XubString& rText )
{
USHORT nPos = GetPagePos( nPageId );
- if ( nPos != TABBAR_PAGE_NOTFOUND )
+ if ( nPos != PAGE_NOT_FOUND )
{
mpItemList->GetObject( nPos )->maText = rText;
mbSizeFormat = TRUE;
@@ -2286,7 +2377,7 @@ void TabBar::SetPageText( USHORT nPageId, const XubString& rText )
XubString TabBar::GetPageText( USHORT nPageId ) const
{
USHORT nPos = GetPagePos( nPageId );
- if ( nPos != TABBAR_PAGE_NOTFOUND )
+ if ( nPos != PAGE_NOT_FOUND )
return mpItemList->GetObject( nPos )->maText;
else
return XubString();
@@ -2297,7 +2388,7 @@ XubString TabBar::GetPageText( USHORT nPageId ) const
void TabBar::SetHelpText( USHORT nPageId, const XubString& rText )
{
USHORT nPos = GetPagePos( nPageId );
- if ( nPos != TABBAR_PAGE_NOTFOUND )
+ if ( nPos != PAGE_NOT_FOUND )
mpItemList->GetObject( nPos )->maHelpText = rText;
}
@@ -2306,7 +2397,7 @@ void TabBar::SetHelpText( USHORT nPageId, const XubString& rText )
XubString TabBar::GetHelpText( USHORT nPageId ) const
{
USHORT nPos = GetPagePos( nPageId );
- if ( nPos != TABBAR_PAGE_NOTFOUND )
+ if ( nPos != PAGE_NOT_FOUND )
{
ImplTabBarItem* pItem = mpItemList->GetObject( nPos );
if ( !pItem->maHelpText.Len() && pItem->mnHelpId )
@@ -2327,7 +2418,7 @@ XubString TabBar::GetHelpText( USHORT nPageId ) const
void TabBar::SetHelpId( USHORT nPageId, ULONG nHelpId )
{
USHORT nPos = GetPagePos( nPageId );
- if ( nPos != TABBAR_PAGE_NOTFOUND )
+ if ( nPos != PAGE_NOT_FOUND )
mpItemList->GetObject( nPos )->mnHelpId = nHelpId;
}
@@ -2336,7 +2427,7 @@ void TabBar::SetHelpId( USHORT nPageId, ULONG nHelpId )
ULONG TabBar::GetHelpId( USHORT nPageId ) const
{
USHORT nPos = GetPagePos( nPageId );
- if ( nPos != TABBAR_PAGE_NOTFOUND )
+ if ( nPos != PAGE_NOT_FOUND )
return mpItemList->GetObject( nPos )->mnHelpId;
else
return 0;
@@ -2483,9 +2574,12 @@ USHORT TabBar::ShowDropPos( const Point& rPos )
nX--;
else
nX++;
+ if ( !pItem->IsDefaultTabBgColor() && !pItem->mbSelect)
+ SetLineColor( pItem->maTabTextColor );
DrawLine( Point( nX, nY ), Point( nX, nY ) );
DrawLine( Point( nX+1, nY-1 ), Point( nX+1, nY+1 ) );
DrawLine( Point( nX+2, nY-2 ), Point( nX+2, nY+2 ) );
+ SetLineColor( aBlackColor );
}
if ( (mnDropPos > 0) && (mnDropPos < nItemCount+1) )
{
@@ -2493,6 +2587,8 @@ USHORT TabBar::ShowDropPos( const Point& rPos )
nX = pItem->maRect.Right()-TABBAR_OFFSET_X;
if ( mnDropPos == nCurPos )
nX++;
+ if ( !pItem->IsDefaultTabBgColor() && !pItem->mbSelect)
+ SetLineColor( pItem->maTabTextColor );
DrawLine( Point( nX, nY ), Point( nX, nY ) );
DrawLine( Point( nX-1, nY-1 ), Point( nX-1, nY+1 ) );
DrawLine( Point( nX-2, nY-2 ), Point( nX-2, nY+2 ) );
diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx
new file mode 100644
index 000000000000..fa393da3d5a8
--- /dev/null
+++ b/svtools/source/control/toolbarmenu.cxx
@@ -0,0 +1,1806 @@
+/*************************************************************************
+ *
+ * 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 <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <comphelper/processfactory.hxx>
+
+#include <vcl/dockwin.hxx>
+#include <vcl/decoview.hxx>
+#include <vcl/image.hxx>
+#include <vcl/taskpanelist.hxx>
+#include <vcl/toolbox.hxx>
+
+#include "svtools/valueset.hxx"
+#include "svtools/toolbarmenu.hxx"
+#include "toolbarmenuimp.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::accessibility;
+
+namespace svtools {
+
+// --------------------------------------------------------------------
+
+static Window* GetTopMostParentSystemWindow( Window* pWindow )
+{
+ OSL_ASSERT( pWindow );
+ if ( pWindow )
+ {
+ // ->manually search topmost system window
+ // required because their might be another system window between this and the top window
+ pWindow = pWindow->GetParent();
+ SystemWindow* pTopMostSysWin = NULL;
+ while ( pWindow )
+ {
+ if ( pWindow->IsSystemWindow() )
+ pTopMostSysWin = (SystemWindow*)pWindow;
+ pWindow = pWindow->GetParent();
+ }
+ pWindow = pTopMostSysWin;
+ OSL_ASSERT( pWindow );
+ return pWindow;
+ }
+
+ return NULL;
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenuEntry::init( int nEntryId, MenuItemBits nBits )
+{
+ mnEntryId = nEntryId;
+ mnBits = nBits;
+
+ mbHasText = false;
+ mbHasImage = false;
+ mbChecked = false;
+ mbEnabled = true;
+
+ mpControl = NULL;
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenuEntry::ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, const String& rText, MenuItemBits nBits )
+: mrMenu( rMenu )
+{
+ init( nEntryId, nBits );
+
+ maText = rText;
+ mbHasText = true;
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenuEntry::ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, const Image& rImage, MenuItemBits nBits )
+: mrMenu( rMenu )
+{
+ init( nEntryId, nBits );
+
+ maImage = rImage;
+ mbHasImage = true;
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenuEntry::ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, const Image& rImage, const String& rText, MenuItemBits nBits )
+: mrMenu( rMenu )
+{
+ init( nEntryId, nBits );
+
+ maText = rText;
+ mbHasText = true;
+
+ maImage = rImage;
+ mbHasImage = true;
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenuEntry::ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, Control* pControl, MenuItemBits nBits )
+: mrMenu( rMenu )
+{
+ init( nEntryId, nBits );
+
+ if( pControl )
+ {
+ mpControl = pControl;
+ mpControl->Show();
+ }
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenuEntry::~ToolbarMenuEntry()
+{
+ if( mxAccContext.is() )
+ {
+ Reference< XComponent > xComponent( mxAccContext, UNO_QUERY );
+ if( xComponent.is() )
+ xComponent->dispose();
+ mxAccContext.clear();
+ }
+ delete mpControl;
+}
+
+// --------------------------------------------------------------------
+
+const Reference< XAccessibleContext >& ToolbarMenuEntry::GetAccessible( bool bCreate /* = false */ )
+{
+ if( !mxAccContext.is() && bCreate )
+ {
+ if( mpControl )
+ {
+ mxAccContext = Reference< XAccessibleContext >( mpControl->GetAccessible( TRUE ), UNO_QUERY );
+ }
+ else
+ {
+ mxAccContext = Reference< XAccessibleContext >( new ToolbarMenuEntryAcc( this ) );
+ }
+ }
+
+ return mxAccContext;
+}
+
+// --------------------------------------------------------------------
+
+sal_Int32 ToolbarMenuEntry::getAccessibleChildCount() throw (RuntimeException)
+{
+ if( mpControl )
+ {
+ const Reference< XAccessibleContext >& xContext = GetAccessible( true );
+ if( xContext.is() )
+ {
+ return xContext->getAccessibleChildCount();
+ }
+ }
+ return 1;
+}
+
+// --------------------------------------------------------------------
+
+Reference< XAccessible > ToolbarMenuEntry::getAccessibleChild( sal_Int32 index ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ const Reference< XAccessibleContext >& xContext = GetAccessible( true );
+ if( mpControl )
+ {
+ if( xContext.is() )
+ {
+ return xContext->getAccessibleChild(index);
+ }
+ }
+ else if( index == 0 )
+ {
+ Reference< XAccessible > xRet( xContext, UNO_QUERY );
+ if( xRet.is() )
+ return xRet;
+ }
+
+ throw IndexOutOfBoundsException();
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenu_Impl::ToolbarMenu_Impl( ToolbarMenu& rMenu, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame )
+: mrMenu( rMenu )
+, mxFrame( xFrame )
+, mxServiceManager( ::comphelper::getProcessServiceFactory() )
+, mnCheckPos(0)
+, mnImagePos(0)
+, mnTextPos(0)
+, mnHighlightedEntry(-1)
+, mnSelectedEntry(-1)
+, mnLastColumn(0)
+{
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenu_Impl::~ToolbarMenu_Impl()
+{
+ setAccessible( 0 );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu_Impl::setAccessible( ToolbarMenuAcc* pAccessible )
+{
+ if( mxAccessible.get() != pAccessible )
+ {
+ if( mxAccessible.is() )
+ mxAccessible->dispose();
+
+ mxAccessible.set( pAccessible );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolbarMenu_Impl::fireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue )
+{
+ if( mxAccessible.is() )
+ mxAccessible->FireAccessibleEvent( nEventId, rOldValue, rNewValue );
+}
+
+// -----------------------------------------------------------------------
+
+bool ToolbarMenu_Impl::hasAccessibleListeners()
+{
+ return( mxAccessible.is() && mxAccessible->HasAccessibleListeners() );
+}
+
+// --------------------------------------------------------------------
+
+sal_Int32 ToolbarMenu_Impl::getAccessibleChildCount() throw (RuntimeException)
+{
+ sal_Int32 nCount = 0;
+ const int nEntryCount = maEntryVector.size();
+ for( int nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ ToolbarMenuEntry* pEntry = maEntryVector[nEntry];
+ if( pEntry )
+ {
+ if( pEntry->mpControl )
+ {
+ nCount += pEntry->getAccessibleChildCount();
+ }
+ else
+ {
+ nCount += 1;
+ }
+ }
+ }
+
+ return nCount;
+}
+
+// --------------------------------------------------------------------
+
+Reference< XAccessible > ToolbarMenu_Impl::getAccessibleChild( sal_Int32 index ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ const int nEntryCount = maEntryVector.size();
+ for( int nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ ToolbarMenuEntry* pEntry = maEntryVector[nEntry];
+ if( pEntry )
+ {
+ const sal_Int32 nCount = pEntry->getAccessibleChildCount();
+ if( index < nCount )
+ {
+ return pEntry->getAccessibleChild( index );
+ }
+ index -= nCount;
+ }
+ }
+
+ throw IndexOutOfBoundsException();
+}
+
+// --------------------------------------------------------------------
+
+Reference< XAccessible > ToolbarMenu_Impl::getAccessibleChild( Control* pControl, sal_Int32 childIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ const int nEntryCount = maEntryVector.size();
+ for( int nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ ToolbarMenuEntry* pEntry = maEntryVector[nEntry];
+ if( pEntry && (pEntry->mpControl == pControl) )
+ {
+ return pEntry->getAccessibleChild( childIndex );
+ }
+ }
+
+ throw IndexOutOfBoundsException();
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu_Impl::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ const int nEntryCount = maEntryVector.size();
+ for( int nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ ToolbarMenuEntry* pEntry = maEntryVector[nEntry];
+ if( pEntry )
+ {
+ const sal_Int32 nCount = pEntry->getAccessibleChildCount();
+ if( nChildIndex < nCount )
+ {
+ if( pEntry->mpControl )
+ {
+ Reference< XAccessibleSelection > xSel( pEntry->GetAccessible(true), UNO_QUERY_THROW );
+ xSel->selectAccessibleChild(nChildIndex);
+ }
+ else if( pEntry->mnEntryId != TITLE_ID )
+ {
+ mrMenu.implSelectEntry( nEntry );
+ }
+ return;
+ }
+ nChildIndex -= nCount;
+ }
+ }
+
+ throw IndexOutOfBoundsException();
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool ToolbarMenu_Impl::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ const int nEntryCount = maEntryVector.size();
+ for( int nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ ToolbarMenuEntry* pEntry = maEntryVector[nEntry];
+ if( pEntry )
+ {
+ const sal_Int32 nCount = pEntry->getAccessibleChildCount();
+ if( nChildIndex < nCount )
+ {
+ if( mnHighlightedEntry == nEntry )
+ {
+ if( pEntry->mpControl )
+ {
+ Reference< XAccessibleSelection > xSel( pEntry->GetAccessible(true), UNO_QUERY_THROW );
+ xSel->isAccessibleChildSelected(nChildIndex);
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ nChildIndex -= nCount;
+ }
+ }
+
+ throw IndexOutOfBoundsException();
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu_Impl::clearAccessibleSelection()
+{
+ if( mnHighlightedEntry != -1 )
+ {
+ mrMenu.implHighlightEntry( mnHighlightedEntry, false );
+ mnHighlightedEntry = -1;
+ }
+}
+
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu_Impl::notifyHighlightedEntry()
+{
+ if( hasAccessibleListeners() )
+ {
+ ToolbarMenuEntry* pEntry = implGetEntry( mnHighlightedEntry );
+ if( pEntry && pEntry->mbEnabled && (pEntry->mnEntryId != TITLE_ID) )
+ {
+ Any aNew;
+ Any aOld( mxOldSelection );
+ if( pEntry->mpControl )
+ {
+ sal_Int32 nChildIndex = 0;
+ // todo: if other controls than ValueSet are allowed, addapt this code
+ ValueSet* pValueSet = dynamic_cast< ValueSet* >( pEntry->mpControl );
+ if( pValueSet )
+ nChildIndex = static_cast< sal_Int32 >( pValueSet->GetItemPos( pValueSet->GetSelectItemId() ) );
+
+ if( nChildIndex >= pEntry->getAccessibleChildCount() )
+ return;
+
+ aNew <<= getAccessibleChild( pEntry->mpControl, nChildIndex );
+ }
+ else
+ {
+ aNew <<= pEntry->GetAccessible(true);
+ }
+
+ fireAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOld, aNew );
+ fireAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, aOld, aNew );
+ fireAccessibleEvent( AccessibleEventId::STATE_CHANGED, Any(), Any( AccessibleStateType::FOCUSED ) );
+ aNew >>= mxOldSelection;
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenuEntry* ToolbarMenu_Impl::implGetEntry( int nEntry ) const
+{
+ if( (nEntry < 0) || (nEntry >= (int)maEntryVector.size() ) )
+ return NULL;
+
+ return maEntryVector[nEntry];
+}
+
+
+// --------------------------------------------------------------------
+
+IMPL_LINK( ToolbarMenu, HighlightHdl, Control *, pControl )
+{
+ (void)pControl;
+ mpImpl->notifyHighlightedEntry();
+ return 0;
+}
+
+// ====================================================================
+
+ToolbarMenu::ToolbarMenu( const Reference< XFrame >& rFrame, Window* pParentWindow, WinBits nBits )
+: DockingWindow(pParentWindow, nBits)
+{
+ implInit(rFrame);
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenu::ToolbarMenu( const Reference< XFrame >& rFrame, Window* pParentWindow, const ResId& rResId )
+: DockingWindow(pParentWindow, rResId)
+{
+ implInit(rFrame);
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::implInit(const Reference< XFrame >& rFrame)
+{
+ mpImpl = new ToolbarMenu_Impl( *this, rFrame );
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ SetControlBackground( rStyleSettings.GetMenuColor() );
+
+ initWindow();
+
+ Window* pWindow = GetTopMostParentSystemWindow( this );
+ if ( pWindow )
+ ((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( this );
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenu::~ToolbarMenu()
+{
+ Window* pWindow = GetTopMostParentSystemWindow( this );
+ if ( pWindow )
+ ((SystemWindow *)pWindow)->GetTaskPaneList()->RemoveWindow( this );
+
+ if ( mpImpl->mxStatusListener.is() )
+ {
+ mpImpl->mxStatusListener->dispose();
+ mpImpl->mxStatusListener.clear();
+ }
+
+ // delete all menu entries
+ const int nEntryCount = mpImpl->maEntryVector.size();
+ int nEntry;
+ for( nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ delete mpImpl->maEntryVector[nEntry];
+ }
+
+ delete mpImpl;
+}
+
+// --------------------------------------------------------------------
+
+int ToolbarMenu::getSelectedEntryId() const
+{
+ ToolbarMenuEntry* pEntry = implGetEntry( mpImpl->mnSelectedEntry );
+ return pEntry ? pEntry->mnEntryId : -1;
+}
+
+// --------------------------------------------------------------------
+
+int ToolbarMenu::getHighlightedEntryId() const
+{
+ ToolbarMenuEntry* pEntry = implGetEntry( mpImpl->mnHighlightedEntry );
+ return pEntry ? pEntry->mnEntryId : -1;
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::checkEntry( int nEntryId, bool bChecked )
+{
+ ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId );
+ if( pEntry && pEntry->mbChecked != bChecked )
+ {
+ pEntry->mbChecked = bChecked;
+ Invalidate();
+ }
+}
+
+// --------------------------------------------------------------------
+
+bool ToolbarMenu::isEntryChecked( int nEntryId ) const
+{
+ ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId );
+ return pEntry && pEntry->mbChecked;
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::enableEntry( int nEntryId, bool bEnable )
+{
+ ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId );
+ if( pEntry && pEntry->mbEnabled != bEnable )
+ {
+ pEntry->mbEnabled = bEnable;
+ if( pEntry->mpControl )
+ {
+ pEntry->mpControl->Enable( bEnable );
+
+ // hack for the valueset to make it paint itself anew
+ pEntry->mpControl->Resize();
+ }
+ Invalidate();
+ }
+}
+
+// --------------------------------------------------------------------
+
+bool ToolbarMenu::isEntryEnabled( int nEntryId ) const
+{
+ ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId );
+ return pEntry && pEntry->mbEnabled;
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::setEntryText( int nEntryId, const String& rStr )
+{
+ ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId );
+ if( pEntry && pEntry->maText != rStr )
+ {
+ pEntry->maText = rStr;
+ mpImpl->maSize = implCalcSize();
+ if( IsVisible() )
+ Invalidate();
+ }
+}
+
+// --------------------------------------------------------------------
+
+const String& ToolbarMenu::getEntryText( int nEntryId ) const
+{
+ ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId );
+ if( pEntry )
+ return pEntry->maText;
+ else
+ {
+ static String aEmptyStr;
+ return aEmptyStr;
+ }
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::setEntryImage( int nEntryId, const Image& rImage )
+{
+ ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId );
+ if( pEntry && pEntry->maImage != rImage )
+ {
+ pEntry->maImage = rImage;
+ mpImpl->maSize = implCalcSize();
+ if( IsVisible() )
+ Invalidate();
+ }
+}
+
+// --------------------------------------------------------------------
+
+const Image& ToolbarMenu::getEntryImage( int nEntryId ) const
+{
+ ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId );
+ if( pEntry )
+ return pEntry->maImage;
+ else
+ {
+ static Image aEmptyImage;
+ return aEmptyImage;
+ }
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::initWindow()
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ SetPointFont( rStyleSettings.GetMenuFont() );
+ SetBackground( Wallpaper( GetControlBackground() ) );
+ SetTextColor( rStyleSettings.GetMenuTextColor() );
+ SetTextFillColor();
+ SetLineColor();
+
+ mpImpl->maSize = implCalcSize();
+}
+
+// --------------------------------------------------------------------
+
+Size ToolbarMenu::implCalcSize()
+{
+ const long nFontHeight = GetTextHeight();
+ long nExtra = nFontHeight/4;
+
+ Size aSz;
+ Size aMaxImgSz;
+ long nMaxTextWidth = 0;
+ long nMinMenuItemHeight = nFontHeight+2;
+ sal_Bool bCheckable = sal_False;
+
+ const int nEntryCount = mpImpl->maEntryVector.size();
+ int nEntry;
+
+ const StyleSettings& rSettings = GetSettings().GetStyleSettings();
+ const bool bUseImages = rSettings.GetUseImagesInMenus();
+
+ // get maximum image size
+ if( bUseImages )
+ {
+ for( nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ ToolbarMenuEntry* pEntry = mpImpl->maEntryVector[nEntry];
+ if( pEntry && pEntry->mbHasImage )
+ {
+ Size aImgSz( pEntry->maImage.GetSizePixel() );
+ nMinMenuItemHeight = std::max( nMinMenuItemHeight, aImgSz.Height() + 6 );
+ aMaxImgSz.Width() = std::max( aMaxImgSz.Width(), aImgSz.Width() );
+ }
+ }
+ }
+
+ mpImpl->mnCheckPos = nExtra;
+ mpImpl->mnImagePos = nExtra;
+ mpImpl->mnTextPos = mpImpl->mnImagePos + aMaxImgSz.Width();
+
+ if ( aMaxImgSz.Width() )
+ mpImpl->mnTextPos += std::max( nExtra, 7L );
+ if ( bCheckable )
+ mpImpl->mnTextPos += 16;
+
+ // set heights, calc maximum width
+ for( nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ ToolbarMenuEntry* pEntry = mpImpl->maEntryVector[nEntry];
+
+ if( pEntry )
+ {
+ if ( ( pEntry->mnBits ) & ( MIB_RADIOCHECK | MIB_CHECKABLE ) )
+ bCheckable = sal_True;
+
+ // Text:
+ if( pEntry->mbHasText || pEntry->mbHasImage )
+ {
+ pEntry->maSize.Height() = nMinMenuItemHeight;
+
+ if( pEntry->mbHasText )
+ {
+ long nTextWidth = GetCtrlTextWidth( pEntry->maText ) + mpImpl->mnTextPos + nExtra;
+ nMaxTextWidth = std::max( nTextWidth, nMaxTextWidth );
+ }
+ }
+ // Control:
+ else if( pEntry->mpControl )
+ {
+ Size aControlSize( pEntry->mpControl->GetOutputSizePixel() );
+
+ nMaxTextWidth = std::max( aControlSize.Width(), nMaxTextWidth );
+ pEntry->maSize.Height() = aControlSize.Height() + 1;
+ }
+
+ }
+ }
+
+ aSz.Width() = nMaxTextWidth + (BORDER_X<<1);
+
+ // positionate controls
+ int nY = BORDER_Y;
+ for( nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ ToolbarMenuEntry* pEntry = mpImpl->maEntryVector[nEntry];
+
+ if( pEntry )
+ {
+ pEntry->maSize.Width() = nMaxTextWidth;
+
+ if( pEntry->mpControl )
+ {
+ Size aControlSize( pEntry->mpControl->GetOutputSizePixel() );
+ Point aControlPos( (aSz.Width() - aControlSize.Width())>>1, nY);
+
+ pEntry->mpControl->SetPosPixel( aControlPos );
+
+ pEntry->maRect = Rectangle( aControlPos, aControlSize );
+ }
+ else
+ {
+ pEntry->maRect = Rectangle( Point( 0, nY ), pEntry->maSize );
+ }
+
+ nY += pEntry->maSize.Height();
+ }
+ else
+ {
+ nY += SEPARATOR_HEIGHT;
+ }
+ }
+
+ aSz.Height() += nY + BORDER_Y;
+
+ return aSz;
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::highlightFirstEntry()
+{
+ implChangeHighlightEntry( 0 );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::GetFocus()
+{
+ if( mpImpl->mnHighlightedEntry == -1 )
+ implChangeHighlightEntry( 0 );
+
+ DockingWindow::GetFocus();
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::LoseFocus()
+{
+ if( mpImpl->mnHighlightedEntry != -1 )
+ implChangeHighlightEntry( -1 );
+
+ DockingWindow::LoseFocus();
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::appendEntry( int nEntryId, const String& rStr, MenuItemBits nItemBits )
+{
+ appendEntry( new ToolbarMenuEntry( *this, nEntryId, rStr, nItemBits ) );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::appendEntry( int nEntryId, const Image& rImage, MenuItemBits nItemBits )
+{
+ appendEntry( new ToolbarMenuEntry( *this, nEntryId, rImage, nItemBits ) );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::appendEntry( int nEntryId, const String& rStr, const Image& rImage, MenuItemBits nItemBits )
+{
+ appendEntry( new ToolbarMenuEntry( *this, nEntryId, rImage, rStr, nItemBits ) );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::appendEntry( int nEntryId, Control* pControl, MenuItemBits nItemBits )
+{
+ appendEntry( new ToolbarMenuEntry( *this, nEntryId, pControl, nItemBits ) );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::appendEntry( ToolbarMenuEntry* pEntry )
+{
+ mpImpl->maEntryVector.push_back( pEntry );
+ mpImpl->maSize = implCalcSize();
+ if( IsVisible() )
+ Invalidate();
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::appendSeparator()
+{
+ appendEntry( 0 );
+}
+
+// --------------------------------------------------------------------
+
+/** creates an empty ValueSet that is initialized and can be inserted with appendEntry. */
+ValueSet* ToolbarMenu::createEmptyValueSetControl()
+{
+ ValueSet* pSet = new ValueSet( this, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT );
+ pSet->EnableFullItemMode( FALSE );
+ pSet->SetColor( GetControlBackground() );
+ pSet->SetHighlightHdl( LINK( this, ToolbarMenu, HighlightHdl ) );
+ return pSet;
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenuEntry* ToolbarMenu::implGetEntry( int nEntry ) const
+{
+ return mpImpl->implGetEntry( nEntry );
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenuEntry* ToolbarMenu::implSearchEntry( int nEntryId ) const
+{
+ const int nEntryCount = mpImpl->maEntryVector.size();
+ int nEntry;
+ for( nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ ToolbarMenuEntry* p = mpImpl->maEntryVector[nEntry];
+ if( p && p->mnEntryId == nEntryId )
+ {
+ return p;
+ }
+ }
+
+ return NULL;
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::implHighlightEntry( int nHighlightEntry, bool bHighlight )
+{
+ Size aSz( GetOutputSizePixel() );
+ long nX = 0, nY = 0;
+
+ const int nEntryCount = mpImpl->maEntryVector.size();
+ int nEntry;
+ for( nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ ToolbarMenuEntry* pEntry = mpImpl->maEntryVector[nEntry];
+ if( pEntry && (nEntry == nHighlightEntry) )
+ {
+ // no highlights for controls only items
+ if( pEntry->mpControl )
+ {
+ if( !bHighlight )
+ {
+ ValueSet* pValueSet = dynamic_cast< ValueSet* >( pEntry->mpControl );
+ if( pValueSet )
+ {
+ pValueSet->SetNoSelection();
+ }
+ }
+ break;
+ }
+
+ bool bRestoreLineColor = false;
+ Color oldLineColor;
+ bool bDrawItemRect = true;
+
+ Rectangle aItemRect( Point( nX, nY ), Size( aSz.Width(), pEntry->maSize.Height() ) );
+ if ( pEntry->mnBits & MIB_POPUPSELECT )
+ {
+ long nFontHeight = GetTextHeight();
+ aItemRect.Right() -= nFontHeight + nFontHeight/4;
+ }
+
+ if( IsNativeControlSupported( CTRL_MENU_POPUP, PART_ENTIRE_CONTROL ) )
+ {
+ Size aPxSize( GetOutputSizePixel() );
+ Push( PUSH_CLIPREGION );
+ IntersectClipRegion( Rectangle( Point( nX, nY ), Size( aSz.Width(), pEntry->maSize.Height() ) ) );
+ Rectangle aCtrlRect( Point( nX, 0 ), Size( aPxSize.Width()-nX, aPxSize.Height() ) );
+ DrawNativeControl( CTRL_MENU_POPUP, PART_ENTIRE_CONTROL,
+ Region( aCtrlRect ),
+ CTRL_STATE_ENABLED,
+ ImplControlValue(),
+ OUString() );
+ if( bHighlight && IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM ) )
+ {
+ bDrawItemRect = false;
+ if( FALSE == DrawNativeControl( CTRL_MENU_POPUP, PART_MENU_ITEM,
+ Region( aItemRect ),
+ CTRL_STATE_SELECTED | ( pEntry->mbEnabled? CTRL_STATE_ENABLED: 0 ),
+ ImplControlValue(),
+ OUString() ) )
+ {
+ bDrawItemRect = bHighlight;
+ }
+ }
+ else
+ bDrawItemRect = bHighlight;
+ Pop();
+ }
+ if( bDrawItemRect )
+ {
+ if ( bHighlight )
+ {
+ if( pEntry->mbEnabled )
+ SetFillColor( GetSettings().GetStyleSettings().GetMenuHighlightColor() );
+ else
+ {
+ SetFillColor();
+ oldLineColor = GetLineColor();
+ SetLineColor( GetSettings().GetStyleSettings().GetMenuHighlightColor() );
+ bRestoreLineColor = true;
+ }
+ }
+ else
+ SetFillColor( GetSettings().GetStyleSettings().GetMenuColor() );
+
+ DrawRect( aItemRect );
+ }
+ implPaint( pEntry, bHighlight );
+ if( bRestoreLineColor )
+ SetLineColor( oldLineColor );
+ break;
+ }
+
+ nY += pEntry ? pEntry->maSize.Height() : SEPARATOR_HEIGHT;
+ }
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::implSelectEntry( int nSelectedEntry )
+{
+ mpImpl->mnSelectedEntry = nSelectedEntry;
+
+ ToolbarMenuEntry* pEntry = NULL;
+ if( nSelectedEntry != -1 )
+ pEntry = mpImpl->maEntryVector[ nSelectedEntry ];
+
+ if( pEntry )
+ mpImpl->maSelectHdl.Call( this );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ implHighlightEntry( rMEvt, true );
+
+ implSelectEntry( mpImpl->mnHighlightedEntry );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::MouseButtonUp( const MouseEvent& )
+{
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::MouseMove( const MouseEvent& rMEvt )
+{
+ if ( !IsVisible() )
+ return;
+
+ implHighlightEntry( rMEvt, false );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown )
+{
+ long nY = 0;
+ long nMouseY = rMEvt.GetPosPixel().Y();
+ Size aOutSz = GetOutputSizePixel();
+ if ( ( nMouseY >= 0 ) && ( nMouseY < aOutSz.Height() ) )
+ {
+ bool bHighlighted = FALSE;
+
+ const int nEntryCount = mpImpl->maEntryVector.size();
+ int nEntry;
+ for( nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ ToolbarMenuEntry* pEntry = mpImpl->maEntryVector[nEntry];
+ if( pEntry )
+ {
+ long nOldY = nY;
+ nY += pEntry->maSize.Height();
+
+ if( pEntry->mnEntryId != TITLE_ID )
+ {
+ if ( ( nOldY <= nMouseY ) && ( nY > nMouseY ) )
+ {
+ if( bMBDown )
+ {
+ if( nEntry != mpImpl->mnHighlightedEntry )
+ {
+ implChangeHighlightEntry( nEntry );
+ }
+ }
+ else
+ {
+ if ( nEntry != mpImpl->mnHighlightedEntry )
+ {
+ implChangeHighlightEntry( nEntry );
+ }
+ }
+ bHighlighted = true;
+ }
+ }
+ }
+ else
+ {
+ nY += SEPARATOR_HEIGHT;
+ }
+ }
+ if ( !bHighlighted )
+ implChangeHighlightEntry( -1 );
+ }
+ else
+ {
+ implChangeHighlightEntry( -1 );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::implChangeHighlightEntry( int nEntry )
+{
+ if( mpImpl->mnHighlightedEntry != -1 )
+ {
+ implHighlightEntry( mpImpl->mnHighlightedEntry, false );
+ }
+
+ mpImpl->mnHighlightedEntry = nEntry;
+ Invalidate();
+
+ if( mpImpl->mnHighlightedEntry != -1 )
+ {
+ implHighlightEntry( mpImpl->mnHighlightedEntry, true );
+ }
+
+ mpImpl->notifyHighlightedEntry();
+}
+
+// --------------------------------------------------------------------
+
+static bool implCheckSubControlCursorMove( Control* pControl, bool bUp, int& nLastColumn )
+{
+ ValueSet* pValueSet = dynamic_cast< ValueSet* >( pControl );
+ if( pValueSet )
+ {
+ USHORT nItemPos = pValueSet->GetItemPos( pValueSet->GetSelectItemId() );
+ if( nItemPos != VALUESET_ITEM_NOTFOUND )
+ {
+ const USHORT nColCount = pValueSet->GetColCount();
+ const USHORT nLine = nItemPos / nColCount;
+
+ nLastColumn = nItemPos - (nLine * nColCount);
+
+ if( bUp )
+ {
+ return nLine > 0;
+ }
+ else
+ {
+ const USHORT nLineCount = (pValueSet->GetItemCount() + nColCount - 1) / nColCount;
+ return (nLine+1) < nLineCount;
+ }
+ }
+ }
+
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenuEntry* ToolbarMenu::implCursorUpDown( bool bUp, bool bHomeEnd )
+{
+ int n = 0, nLoop = 0;
+ if( !bHomeEnd )
+ {
+ n = mpImpl->mnHighlightedEntry;
+ if( n == -1 )
+ {
+ if( bUp )
+ n = 0;
+ else
+ n = mpImpl->maEntryVector.size()-1;
+ }
+ else
+ {
+ // if we have a currently selected entry and
+ // cursor keys are used than check if this entry
+ // has a control that can use those cursor keys
+ ToolbarMenuEntry* pData = mpImpl->maEntryVector[n];
+ if( pData && pData->mpControl && !pData->mbHasText )
+ {
+ if( implCheckSubControlCursorMove( pData->mpControl, bUp, mpImpl->mnLastColumn ) )
+ return pData;
+ }
+ }
+ nLoop = n;
+ }
+ else
+ {
+ // absolute positioning
+ if( bUp )
+ {
+ n = mpImpl->maEntryVector.size();
+ nLoop = n-1;
+ }
+ else
+ {
+ n = -1;
+ nLoop = mpImpl->maEntryVector.size()-1;
+ }
+ }
+
+ do
+ {
+ if( bUp )
+ {
+ if ( n )
+ n--;
+ else
+ if( mpImpl->mnHighlightedEntry == -1 )
+ n = mpImpl->maEntryVector.size()-1;
+ else
+ break;
+ }
+ else
+ {
+ if( n < ((int)mpImpl->maEntryVector.size()-1) )
+ n++;
+ else
+ if( mpImpl->mnHighlightedEntry == -1 )
+ n = 0;
+ else
+ break;
+ }
+
+ ToolbarMenuEntry* pData = mpImpl->maEntryVector[n];
+ if( pData && (pData->mnEntryId != TITLE_ID) )
+ {
+ implChangeHighlightEntry( n );
+ return pData;
+ }
+ } while ( n != nLoop );
+
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu_Impl::implHighlightControl( USHORT nCode, Control* pControl )
+{
+ ValueSet* pValueSet = dynamic_cast< ValueSet* >( pControl );
+ if( pValueSet )
+ {
+ const USHORT nItemCount = pValueSet->GetItemCount();
+ USHORT nItemPos = VALUESET_ITEM_NOTFOUND;
+ switch( nCode )
+ {
+ case KEY_UP:
+ {
+ const USHORT nColCount = pValueSet->GetColCount();
+ const USHORT nLastLine = nItemCount / nColCount;
+ nItemPos = std::min( ((nLastLine-1) * nColCount) + mnLastColumn, nItemCount-1 );
+ break;
+ }
+ case KEY_DOWN:
+ nItemPos = std::min( mnLastColumn, nItemCount-1 );
+ break;
+ case KEY_END:
+ nItemPos = nItemCount -1;
+ break;
+ case KEY_HOME:
+ nItemPos = 0;
+ break;
+ }
+ pValueSet->SelectItem( pValueSet->GetItemId( nItemPos ) );
+ notifyHighlightedEntry();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::KeyInput( const KeyEvent& rKEvent )
+{
+ Control* pForwardControl = 0;
+ USHORT nCode = rKEvent.GetKeyCode().GetCode();
+ switch ( nCode )
+ {
+ case KEY_UP:
+ case KEY_DOWN:
+ {
+ int nOldEntry = mpImpl->mnHighlightedEntry;
+ ToolbarMenuEntry*p = implCursorUpDown( nCode == KEY_UP, false );
+ if( p && p->mpControl )
+ {
+ if( nOldEntry != mpImpl->mnHighlightedEntry )
+ {
+ mpImpl->implHighlightControl( nCode, p->mpControl );
+ }
+ else
+ {
+ // in case we are in a system floating window, GrabFocus does not work :-/
+ pForwardControl = p->mpControl;
+ }
+ }
+ }
+ break;
+ case KEY_END:
+ case KEY_HOME:
+ {
+ ToolbarMenuEntry* p = implCursorUpDown( nCode == KEY_END, true );
+ if( p && p->mpControl )
+ {
+ mpImpl->implHighlightControl( nCode, p->mpControl );
+ }
+ }
+ break;
+ case KEY_F6:
+ case KEY_ESCAPE:
+ {
+ // Ctrl-F6 acts like ESC here, the menu bar however will then put the focus in the document
+ if( nCode == KEY_F6 && !rKEvent.GetKeyCode().IsMod1() )
+ break;
+
+ implSelectEntry( -1 );
+ }
+ break;
+
+ case KEY_RETURN:
+ {
+ ToolbarMenuEntry* pEntry = implGetEntry( mpImpl->mnHighlightedEntry );
+ if ( pEntry && pEntry->mbEnabled && (pEntry->mnEntryId != TITLE_ID) )
+ {
+ if( pEntry->mpControl )
+ {
+ pForwardControl = pEntry->mpControl;
+ }
+ else
+ {
+ implSelectEntry( mpImpl->mnHighlightedEntry );
+ }
+ }
+ }
+ break;
+ default:
+ {
+ ToolbarMenuEntry* pEntry = implGetEntry( mpImpl->mnHighlightedEntry );
+ if ( pEntry && pEntry->mbEnabled && pEntry->mpControl && !pEntry->mbHasText )
+ {
+ pForwardControl = pEntry->mpControl;
+ }
+ }
+
+ }
+ if( pForwardControl )
+ pForwardControl->KeyInput( rKEvent );
+
+}
+
+// --------------------------------------------------------------------
+static void ImplPaintCheckBackground( Window* i_pWindow, const Rectangle& i_rRect, bool i_bHighlight )
+{
+ BOOL bNativeOk = FALSE;
+ if( i_pWindow->IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) )
+ {
+ ImplControlValue aControlValue;
+ Region aCtrlRegion( i_rRect );
+ ControlState nState = CTRL_STATE_PRESSED | CTRL_STATE_ENABLED;
+
+ aControlValue.setTristateVal( BUTTONVALUE_ON );
+
+ bNativeOk = i_pWindow->DrawNativeControl( CTRL_TOOLBAR, PART_BUTTON,
+ aCtrlRegion, nState, aControlValue,
+ rtl::OUString() );
+ }
+
+ if( ! bNativeOk )
+ {
+ const StyleSettings& rSettings = i_pWindow->GetSettings().GetStyleSettings();
+ Color aColor( i_bHighlight ? rSettings.GetMenuHighlightTextColor() : rSettings.GetHighlightColor() );
+ i_pWindow->DrawSelectionBackground( i_rRect, 0, i_bHighlight, TRUE, FALSE, 2, NULL, &aColor );
+ }
+}
+
+static long ImplGetNativeCheckAndRadioSize( Window* pWin, long& rCheckHeight, long& rRadioHeight, long &rMaxWidth )
+{
+ rMaxWidth = rCheckHeight = rRadioHeight = 0;
+
+ ImplControlValue aVal;
+ Region aNativeBounds;
+ Region aNativeContent;
+ Point tmp( 0, 0 );
+ Region aCtrlRegion( Rectangle( tmp, Size( 100, 15 ) ) );
+ if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM_CHECK_MARK ) )
+ {
+ if( pWin->GetNativeControlRegion( ControlType(CTRL_MENU_POPUP),
+ ControlPart(PART_MENU_ITEM_CHECK_MARK),
+ aCtrlRegion,
+ ControlState(CTRL_STATE_ENABLED),
+ aVal,
+ OUString(),
+ aNativeBounds,
+ aNativeContent )
+ )
+ {
+ rCheckHeight = aNativeBounds.GetBoundRect().GetHeight();
+ rMaxWidth = aNativeContent.GetBoundRect().GetWidth();
+ }
+ }
+ if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM_RADIO_MARK ) )
+ {
+ if( pWin->GetNativeControlRegion( ControlType(CTRL_MENU_POPUP),
+ ControlPart(PART_MENU_ITEM_RADIO_MARK),
+ aCtrlRegion,
+ ControlState(CTRL_STATE_ENABLED),
+ aVal,
+ OUString(),
+ aNativeBounds,
+ aNativeContent )
+ )
+ {
+ rRadioHeight = aNativeBounds.GetBoundRect().GetHeight();
+ rMaxWidth = Max (rMaxWidth, aNativeContent.GetBoundRect().GetWidth());
+ }
+ }
+ return (rCheckHeight > rRadioHeight) ? rCheckHeight : rRadioHeight;
+}
+
+void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted )
+{
+ USHORT nBorder = 0; long nStartY = 0; // from Menu implementations, needed when we support native menu background & scrollable menu
+
+ long nFontHeight = GetTextHeight();
+// long nExtra = nFontHeight/4;
+
+ long nCheckHeight = 0, nRadioHeight = 0, nMaxCheckWidth = 0;
+ ImplGetNativeCheckAndRadioSize( this, nCheckHeight, nRadioHeight, nMaxCheckWidth );
+
+ DecorationView aDecoView( this );
+ const StyleSettings& rSettings = GetSettings().GetStyleSettings();
+ const bool bUseImages = rSettings.GetUseImagesInMenus();
+
+ int nOuterSpace = 0; // ImplGetSVData()->maNWFData.mnMenuFormatExtraBorder;
+ Point aTopLeft( nOuterSpace, nOuterSpace ), aTmpPos;
+
+ Size aOutSz( GetOutputSizePixel() );
+ const int nEntryCount = mpImpl->maEntryVector.size();
+ int nEntry;
+ for( nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ ToolbarMenuEntry* pEntry = mpImpl->maEntryVector[nEntry];
+
+ Point aPos( aTopLeft );
+ aPos.Y() += nBorder;
+ aPos.Y() += nStartY;
+
+
+ if( (pEntry == 0) && !pThisOnly )
+ {
+ // Separator
+ aTmpPos.Y() = aPos.Y() + ((SEPARATOR_HEIGHT-2)/2);
+ aTmpPos.X() = aPos.X() + 2 + nOuterSpace;
+ SetLineColor( rSettings.GetShadowColor() );
+ DrawLine( aTmpPos, Point( aOutSz.Width() - 3 - 2*nOuterSpace, aTmpPos.Y() ) );
+ aTmpPos.Y()++;
+ SetLineColor( rSettings.GetLightColor() );
+ DrawLine( aTmpPos, Point( aOutSz.Width() - 3 - 2*nOuterSpace, aTmpPos.Y() ) );
+ SetLineColor();
+ }
+ else if( !pThisOnly || ( pEntry == pThisOnly ) )
+ {
+ const bool bTitle = pEntry->mnEntryId == TITLE_ID;
+
+ if ( pThisOnly && bHighlighted )
+ SetTextColor( rSettings.GetMenuHighlightTextColor() );
+
+ if( aPos.Y() >= 0 )
+ {
+ long nTextOffsetY = ((pEntry->maSize.Height()-nFontHeight)/2);
+
+ USHORT nTextStyle = 0;
+ USHORT nSymbolStyle = 0;
+ USHORT nImageStyle = 0;
+
+ if( !pEntry->mbEnabled )
+ {
+ nTextStyle |= TEXT_DRAW_DISABLE;
+ nSymbolStyle |= SYMBOL_DRAW_DISABLE;
+ nImageStyle |= IMAGE_DRAW_DISABLE;
+ }
+
+ Rectangle aOuterCheckRect( Point( aPos.X()+mpImpl->mnCheckPos, aPos.Y() ), Size( pEntry->maSize.Height(), pEntry->maSize.Height() ) );
+ aOuterCheckRect.Left() += 1;
+ aOuterCheckRect.Right() -= 1;
+ aOuterCheckRect.Top() += 1;
+ aOuterCheckRect.Bottom() -= 1;
+
+ if( bTitle )
+ {
+ // fill the background
+ Rectangle aRect( aTopLeft, Size( aOutSz.Width(), pEntry->maSize.Height() ) );
+ SetFillColor(rSettings.GetDialogColor());
+ SetLineColor();
+ DrawRect(aRect);
+ SetLineColor( rSettings.GetLightColor() );
+ DrawLine( aRect.TopLeft(), aRect.TopRight() );
+ SetLineColor( rSettings.GetShadowColor() );
+ DrawLine( aRect.BottomLeft(), aRect.BottomRight() );
+ }
+
+ // CheckMark
+ if ( pEntry->HasCheck() )
+ {
+ // draw selection transparent marker if checked
+ // onto that either a checkmark or the item image
+ // will be painted
+ // however do not do this if native checks will be painted since
+ // the selection color too often does not fit the theme's check and/or radio
+
+ if( !pEntry->mbHasImage )
+ {
+ if( this->IsNativeControlSupported( CTRL_MENU_POPUP,
+ (pEntry->mnBits & MIB_RADIOCHECK)
+ ? PART_MENU_ITEM_CHECK_MARK
+ : PART_MENU_ITEM_RADIO_MARK ) )
+ {
+ ControlPart nPart = ((pEntry->mnBits & MIB_RADIOCHECK)
+ ? PART_MENU_ITEM_RADIO_MARK
+ : PART_MENU_ITEM_CHECK_MARK);
+
+ ControlState nState = 0;
+
+ if ( pEntry->mbChecked )
+ nState |= CTRL_STATE_PRESSED;
+
+ if ( pEntry->mbEnabled )
+ nState |= CTRL_STATE_ENABLED;
+
+ if ( bHighlighted )
+ nState |= CTRL_STATE_SELECTED;
+
+ long nCtrlHeight = (pEntry->mnBits & MIB_RADIOCHECK) ? nCheckHeight : nRadioHeight;
+ aTmpPos.X() = aOuterCheckRect.Left() + (aOuterCheckRect.GetWidth() - nCtrlHeight)/2;
+ aTmpPos.Y() = aOuterCheckRect.Top() + (aOuterCheckRect.GetHeight() - nCtrlHeight)/2;
+
+ Rectangle aCheckRect( aTmpPos, Size( nCtrlHeight, nCtrlHeight ) );
+ DrawNativeControl( CTRL_MENU_POPUP, nPart, Region( aCheckRect ), nState, ImplControlValue(), OUString() );
+ }
+ else if ( pEntry->mbChecked ) // by default do nothing for unchecked items
+ {
+ ImplPaintCheckBackground( this, aOuterCheckRect, pThisOnly && bHighlighted );
+
+ SymbolType eSymbol;
+ Size aSymbolSize;
+ if ( pEntry->mnBits & MIB_RADIOCHECK )
+ {
+ eSymbol = SYMBOL_RADIOCHECKMARK;
+ aSymbolSize = Size( nFontHeight/2, nFontHeight/2 );
+ }
+ else
+ {
+ eSymbol = SYMBOL_CHECKMARK;
+ aSymbolSize = Size( (nFontHeight*25)/40, nFontHeight/2 );
+ }
+ aTmpPos.X() = aOuterCheckRect.Left() + (aOuterCheckRect.GetWidth() - aSymbolSize.Width())/2;
+ aTmpPos.Y() = aOuterCheckRect.Top() + (aOuterCheckRect.GetHeight() - aSymbolSize.Height())/2;
+ Rectangle aRect( aTmpPos, aSymbolSize );
+ aDecoView.DrawSymbol( aRect, eSymbol, GetTextColor(), nSymbolStyle );
+ }
+ }
+ }
+
+ // Image:
+ if( pEntry->mbHasImage && bUseImages )
+ {
+ // Don't render an image for a check thing
+ /* if((nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES) || !pEntry->HasCheck() )*/
+ {
+ if( pEntry->mbChecked )
+ ImplPaintCheckBackground( this, aOuterCheckRect, pThisOnly && bHighlighted );
+ aTmpPos = aOuterCheckRect.TopLeft();
+ aTmpPos.X() += (aOuterCheckRect.GetWidth()-pEntry->maImage.GetSizePixel().Width())/2;
+ aTmpPos.Y() += (aOuterCheckRect.GetHeight()-pEntry->maImage.GetSizePixel().Height())/2;
+ DrawImage( aTmpPos, pEntry->maImage, nImageStyle );
+ }
+ }
+
+ // Text:
+ if( pEntry->mbHasText )
+ {
+ aTmpPos.X() = aPos.X() + (bTitle ? 4 : mpImpl->mnTextPos);
+ aTmpPos.Y() = aPos.Y();
+ aTmpPos.Y() += nTextOffsetY;
+ USHORT nStyle = nTextStyle|TEXT_DRAW_MNEMONIC;
+
+ DrawCtrlText( aTmpPos, pEntry->maText, 0, pEntry->maText.Len(), nStyle, NULL, NULL ); // pVector, pDisplayText );
+ }
+
+/*
+ // Accel
+ if ( !bLayout && !bIsMenuBar && pData->aAccelKey.GetCode() && !ImplAccelDisabled() )
+ {
+ XubString aAccText = pData->aAccelKey.GetName();
+ aTmpPos.X() = aOutSz.Width() - this->GetTextWidth( aAccText );
+ aTmpPos.X() -= 4*nExtra;
+
+ aTmpPos.X() -= nOuterSpace;
+ aTmpPos.Y() = aPos.Y();
+ aTmpPos.Y() += nTextOffsetY;
+ this->DrawCtrlText( aTmpPos, aAccText, 0, aAccText.Len(), nTextStyle );
+ }
+*/
+
+/*
+ // SubMenu?
+ if ( !bLayout && !bIsMenuBar && pData->pSubMenu )
+ {
+ aTmpPos.X() = aOutSz.Width() - nFontHeight + nExtra - nOuterSpace;
+ aTmpPos.Y() = aPos.Y();
+ aTmpPos.Y() += nExtra/2;
+ aTmpPos.Y() += ( pEntry->maSize.Height() / 2 ) - ( nFontHeight/4 );
+ if ( pEntry->mnBits & MIB_POPUPSELECT )
+ {
+ this->SetTextColor( rSettings.GetMenuTextColor() );
+ Point aTmpPos2( aPos );
+ aTmpPos2.X() = aOutSz.Width() - nFontHeight - nFontHeight/4;
+ aDecoView.DrawFrame(
+ Rectangle( aTmpPos2, Size( nFontHeight+nFontHeight/4, pEntry->maSize.Height() ) ), FRAME_DRAW_GROUP );
+ }
+ aDecoView.DrawSymbol(
+ Rectangle( aTmpPos, Size( nFontHeight/2, nFontHeight/2 ) ),
+ SYMBOL_SPIN_RIGHT, this->GetTextColor(), nSymbolStyle );
+// if ( pEntry->mnBits & MIB_POPUPSELECT )
+// {
+// aTmpPos.Y() += nFontHeight/2 ;
+// this->SetLineColor( rSettings.GetShadowColor() );
+// this->DrawLine( aTmpPos, Point( aTmpPos.X() + nFontHeight/3, aTmpPos.Y() ) );
+// this->SetLineColor( rSettings.GetLightColor() );
+// aTmpPos.Y()++;
+// this->DrawLine( aTmpPos, Point( aTmpPos.X() + nFontHeight/3, aTmpPos.Y() ) );
+// this->SetLineColor();
+// }
+ }
+*/
+
+ if ( pThisOnly && bHighlighted )
+ {
+ // This restores the normal menu or menu bar text
+ // color for when it is no longer highlighted.
+ SetTextColor( rSettings.GetMenuTextColor() );
+ }
+ }
+ }
+
+ aTopLeft.Y() += pEntry ? pEntry->maSize.Height() : SEPARATOR_HEIGHT;
+ }
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::Paint( const Rectangle& )
+{
+ SetFillColor( GetSettings().GetStyleSettings().GetMenuColor() );
+
+ implPaint();
+
+ if( mpImpl->mnHighlightedEntry != -1 )
+ implHighlightEntry( mpImpl->mnHighlightedEntry, true );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::RequestHelp( const HelpEvent& rHEvt )
+{
+ DockingWindow::RequestHelp( rHEvt );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::StateChanged( StateChangedType nType )
+{
+ DockingWindow::StateChanged( nType );
+
+ if ( ( nType == STATE_CHANGE_CONTROLFOREGROUND ) || ( nType == STATE_CHANGE_CONTROLBACKGROUND ) )
+ {
+ initWindow();
+ Invalidate();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ DockingWindow::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ initWindow();
+ Invalidate();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.GetCommand() == COMMAND_WHEEL )
+ {
+ const CommandWheelData* pData = rCEvt.GetWheelData();
+ if( !pData->GetModifier() && ( pData->GetMode() == COMMAND_WHEEL_SCROLL ) )
+ {
+ implCursorUpDown( pData->GetDelta() > 0L, false );
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+Reference< ::com::sun::star::accessibility::XAccessible > ToolbarMenu::CreateAccessible()
+{
+ mpImpl->setAccessible( new ToolbarMenuAcc( *mpImpl ) );
+ return Reference< XAccessible >( mpImpl->mxAccessible.get() );
+}
+
+// --------------------------------------------------------------------
+
+// todo: move to new base class that will replace SfxPopupWindo
+void ToolbarMenu::AddStatusListener( const rtl::OUString& rCommandURL )
+{
+ initStatusListener();
+ mpImpl->mxStatusListener->addStatusListener( rCommandURL );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::RemoveStatusListener( const rtl::OUString& rCommandURL )
+{
+ mpImpl->mxStatusListener->removeStatusListener( rCommandURL );
+}
+// --------------------------------------------------------------------
+
+
+void ToolbarMenu::UpdateStatus( const rtl::OUString& rCommandURL )
+{
+ mpImpl->mxStatusListener->updateStatus( rCommandURL );
+}
+
+// --------------------------------------------------------------------
+
+// XStatusListener (subclasses must override this one to get the status updates
+void SAL_CALL ToolbarMenu::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& /*Event*/ ) throw ( ::com::sun::star::uno::RuntimeException )
+{
+}
+
+// --------------------------------------------------------------------
+
+class ToolbarMenuStatusListener : public svt::FrameStatusListener
+{
+public:
+ ToolbarMenuStatusListener( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
+ ToolbarMenu& rToolbarMenu );
+
+ virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ ToolbarMenu* mpMenu;
+};
+
+// --------------------------------------------------------------------
+
+ToolbarMenuStatusListener::ToolbarMenuStatusListener(
+ const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
+ ToolbarMenu& rToolbarMenu )
+: svt::FrameStatusListener( xServiceManager, xFrame )
+, mpMenu( &rToolbarMenu )
+{
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuStatusListener::dispose() throw (::com::sun::star::uno::RuntimeException)
+{
+ mpMenu = 0;
+ svt::FrameStatusListener::dispose();
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuStatusListener::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException )
+{
+ if( mpMenu )
+ mpMenu->statusChanged( Event );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::initStatusListener()
+{
+ if( !mpImpl->mxStatusListener.is() )
+ mpImpl->mxStatusListener.set( new ToolbarMenuStatusListener( mpImpl->mxServiceManager, mpImpl->mxFrame, *this ) );
+}
+
+// --------------------------------------------------------------------
+
+bool ToolbarMenu::IsInPopupMode()
+{
+ return GetDockingManager()->IsInPopupMode(this);
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::EndPopupMode()
+{
+ GetDockingManager()->EndPopupMode(this);
+}
+
+// --------------------------------------------------------------------
+
+const Size& ToolbarMenu::getMenuSize() const
+{
+ return mpImpl->maSize;
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::SetSelectHdl( const Link& rLink )
+{
+ mpImpl->maSelectHdl = rLink;
+}
+
+// --------------------------------------------------------------------
+
+const Link& ToolbarMenu::GetSelectHdl() const
+{
+ return mpImpl->maSelectHdl;
+}
+
+// --------------------------------------------------------------------
+
+Reference< XFrame > ToolbarMenu::GetFrame() const
+{
+ return mpImpl->mxFrame;
+}
+
+// --------------------------------------------------------------------
+
+
+// --------------------------------------------------------------------
+
+}
+
+
diff --git a/svtools/source/control/toolbarmenuacc.cxx b/svtools/source/control/toolbarmenuacc.cxx
new file mode 100644
index 000000000000..020467084748
--- /dev/null
+++ b/svtools/source/control/toolbarmenuacc.cxx
@@ -0,0 +1,1003 @@
+/*************************************************************************
+ *
+ * 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 <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+
+#include <unotools/accessiblestatesethelper.hxx>
+
+#include <vcl/svapp.hxx>
+
+#include "svtools/toolbarmenu.hxx"
+
+#include "toolbarmenuimp.hxx"
+
+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::accessibility;
+
+namespace svtools {
+
+// ------------------
+// - ToolbarMenuAcc -
+// ------------------
+
+ToolbarMenuAcc::ToolbarMenuAcc( ToolbarMenu_Impl& rParent )
+: ToolbarMenuAccComponentBase(m_aMutex)
+, mpParent( &rParent )
+, mbIsFocused(false)
+{
+ mpParent->mrMenu.AddEventListener( LINK( this, ToolbarMenuAcc, WindowEventListener ) );
+}
+
+// -----------------------------------------------------------------------------
+
+ToolbarMenuAcc::~ToolbarMenuAcc()
+{
+ if( mpParent )
+ mpParent->mrMenu.RemoveEventListener( LINK( this, ToolbarMenuAcc, WindowEventListener ) );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ToolbarMenuAcc, WindowEventListener, VclSimpleEvent*, pEvent )
+{
+ DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" );
+
+ /* Ignore VCLEVENT_WINDOW_ENDPOPUPMODE, because the UNO accessibility wrapper
+ * might have been destroyed by the previous VCLEventListener (if no AT tool
+ * is running), e.g. sub-toolbars in impress.
+ */
+ if ( mpParent && pEvent && pEvent->ISA( VclWindowEvent ) && (pEvent->GetId() != VCLEVENT_WINDOW_ENDPOPUPMODE) )
+ {
+ DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow(), "Window???" );
+ if( !((VclWindowEvent*)pEvent)->GetWindow()->IsAccessibilityEventsSuppressed() || ( pEvent->GetId() == VCLEVENT_OBJECT_DYING ) )
+ {
+ ProcessWindowEvent( *(VclWindowEvent*)pEvent );
+ }
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void ToolbarMenuAcc::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ Any aOldValue, aNewValue;
+
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_OBJECT_DYING:
+ {
+ mpParent->mrMenu.RemoveEventListener( LINK( this, ToolbarMenuAcc, WindowEventListener ) );
+ mpParent = 0;
+ }
+ break;
+
+ case VCLEVENT_WINDOW_GETFOCUS:
+ {
+ if( !mbIsFocused )
+ {
+ mpParent->notifyHighlightedEntry();
+ mbIsFocused = true;
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_LOSEFOCUS:
+ {
+ if( mbIsFocused )
+ {
+ mbIsFocused = false;
+ }
+ }
+ break;
+ default:
+ {
+ }
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolbarMenuAcc::FireAccessibleEvent( short nEventId, const Any& rOldValue, const Any& rNewValue )
+{
+ if( nEventId )
+ {
+ EventListenerVector aTmpListeners( mxEventListeners );
+ EventListenerVector::const_iterator aIter( aTmpListeners.begin() );
+ AccessibleEventObject aEvtObject;
+
+ aEvtObject.EventId = nEventId;
+ aEvtObject.Source = static_cast<XWeak*>(this);
+ aEvtObject.NewValue = rNewValue;
+ aEvtObject.OldValue = rOldValue;
+
+ while( aIter != aTmpListeners.end() )
+ {
+ try
+ {
+ (*aIter)->notifyEvent( aEvtObject );
+ }
+ catch( Exception& )
+ {
+ }
+
+ aIter++;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleContext > SAL_CALL ToolbarMenuAcc::getAccessibleContext() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ return this;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL ToolbarMenuAcc::getAccessibleChildCount() throw (RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ThrowIfDisposed();
+
+ return mpParent->getAccessibleChildCount();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL ToolbarMenuAcc::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ThrowIfDisposed();
+
+ return mpParent->getAccessibleChild(i);
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL ToolbarMenuAcc::getAccessibleParent() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XAccessible > xRet;
+
+ Window* pParent = mpParent->mrMenu.GetParent();
+ if( pParent )
+ xRet = pParent->GetAccessible();
+
+ return xRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL ToolbarMenuAcc::getAccessibleIndexInParent() throw (RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ThrowIfDisposed();
+
+ Window* pParent = mpParent->mrMenu.GetParent();
+ if( pParent )
+ {
+ for( USHORT i = 0, nCount = pParent->GetChildCount(); i < nCount ; i++ )
+ {
+ if( pParent->GetChild( i ) == &mpParent->mrMenu )
+ return i;
+ }
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int16 SAL_CALL ToolbarMenuAcc::getAccessibleRole() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ return AccessibleRole::LIST;
+}
+
+// -----------------------------------------------------------------------------
+
+OUString SAL_CALL ToolbarMenuAcc::getAccessibleDescription() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "ToolbarMenu" ) );
+}
+
+// -----------------------------------------------------------------------------
+
+OUString SAL_CALL ToolbarMenuAcc::getAccessibleName() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ OUString aRet;
+
+ if( mpParent )
+ aRet = mpParent->mrMenu.GetAccessibleName();
+
+ if( !aRet.getLength() )
+ {
+ Window* pLabel = mpParent->mrMenu.GetLabeledBy();
+ if( pLabel && pLabel != &mpParent->mrMenu )
+ aRet = OutputDevice::GetNonMnemonicString( pLabel->GetText() );
+ }
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleRelationSet > SAL_CALL ToolbarMenuAcc::getAccessibleRelationSet() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ return Reference< XAccessibleRelationSet >();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleStateSet > SAL_CALL ToolbarMenuAcc::getAccessibleStateSet() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper();
+
+ // Set some states.
+ pStateSet->AddState (AccessibleStateType::ENABLED);
+ pStateSet->AddState (AccessibleStateType::SENSITIVE);
+ pStateSet->AddState (AccessibleStateType::SHOWING);
+ pStateSet->AddState (AccessibleStateType::VISIBLE);
+ pStateSet->AddState (AccessibleStateType::MANAGES_DESCENDANTS);
+ pStateSet->AddState (AccessibleStateType::FOCUSABLE);
+ if (mbIsFocused)
+ pStateSet->AddState (AccessibleStateType::FOCUSED);
+
+ return pStateSet;
+}
+
+// -----------------------------------------------------------------------------
+
+Locale SAL_CALL ToolbarMenuAcc::getLocale() throw (IllegalAccessibleComponentStateException, RuntimeException)
+{
+ ThrowIfDisposed();
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ const ::rtl::OUString aEmptyStr;
+ Reference< XAccessible > xParent( getAccessibleParent() );
+ Locale aRet( aEmptyStr, aEmptyStr, aEmptyStr );
+
+ if( xParent.is() )
+ {
+ Reference< XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
+
+ if( xParentContext.is() )
+ aRet = xParentContext->getLocale ();
+ }
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuAcc::addEventListener( const Reference< XAccessibleEventListener >& rxListener ) throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ if( rxListener.is() )
+ {
+ EventListenerVector::const_iterator aIter = mxEventListeners.begin();
+ bool bFound = false;
+
+ while( !bFound && ( aIter != mxEventListeners.end() ) )
+ {
+ if( *aIter == rxListener )
+ bFound = true;
+ else
+ aIter++;
+ }
+
+ if (!bFound)
+ mxEventListeners.push_back( rxListener );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuAcc::removeEventListener( const Reference< XAccessibleEventListener >& rxListener ) throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ if( rxListener.is() )
+ {
+ EventListenerVector::iterator aIter = mxEventListeners.begin();
+ bool bFound = false;
+
+ while( !bFound && ( aIter != mxEventListeners.end() ) )
+ {
+ if( *aIter == rxListener )
+ {
+ mxEventListeners.erase( aIter );
+ bFound = true;
+ }
+ else
+ aIter++;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL ToolbarMenuAcc::containsPoint( const awt::Point& aPoint ) throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ const awt::Rectangle aRect( getBounds() );
+ const Point aSize( aRect.Width, aRect.Height );
+ const Point aNullPoint, aTestPoint( aPoint.X, aPoint.Y );
+
+ return Rectangle( aNullPoint, aSize ).IsInside( aTestPoint );
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL ToolbarMenuAcc::getAccessibleAtPoint( const awt::Point& aPoint ) throw (RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ThrowIfDisposed();
+
+ Reference< XAccessible > xRet;
+
+ const Point aVclPoint( aPoint.X, aPoint.Y );
+
+ const int nEntryCount = mpParent->maEntryVector.size();
+ for( int nEntry = 0; (nEntry < nEntryCount) && !xRet.is(); nEntry++ )
+ {
+ ToolbarMenuEntry* pEntry = mpParent->maEntryVector[nEntry];
+ if( pEntry && pEntry->maRect.IsInside( aVclPoint ) )
+ {
+ if( pEntry->mpControl )
+ {
+ awt::Point aChildPoint( aPoint.X - pEntry->maRect.Left(), aPoint.Y - pEntry->maRect.Top() );
+ Reference< XAccessibleComponent > xComp( pEntry->GetAccessible(true), UNO_QUERY_THROW );
+ xRet = xComp->getAccessibleAtPoint(aChildPoint);
+ }
+ else
+ {
+ xRet = Reference< XAccessible >( pEntry->GetAccessible(true), UNO_QUERY );
+ }
+ }
+ }
+ return xRet;
+}
+
+// -----------------------------------------------------------------------------
+
+awt::Rectangle SAL_CALL ToolbarMenuAcc::getBounds() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ const Point aOutPos( mpParent->mrMenu.GetPosPixel() );
+ const Size aOutSize( mpParent->mrMenu.GetOutputSizePixel() );
+ awt::Rectangle aRet;
+
+ aRet.X = aOutPos.X();
+ aRet.Y = aOutPos.Y();
+ aRet.Width = aOutSize.Width();
+ aRet.Height = aOutSize.Height();
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+awt::Point SAL_CALL ToolbarMenuAcc::getLocation() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ const Point aOutPos( mpParent->mrMenu.GetPosPixel() );
+ return awt::Point( aOutPos.X(), aOutPos.Y() );
+}
+
+// -----------------------------------------------------------------------------
+
+awt::Point SAL_CALL ToolbarMenuAcc::getLocationOnScreen() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ const Point aScreenPos( mpParent->mrMenu.OutputToAbsoluteScreenPixel( Point() ) );
+ return awt::Point( aScreenPos.X(), aScreenPos.Y() );
+}
+
+// -----------------------------------------------------------------------------
+
+awt::Size SAL_CALL ToolbarMenuAcc::getSize() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ const Size aOutSize( mpParent->mrMenu.GetOutputSizePixel() );
+ return awt::Size( aOutSize.Width(), aOutSize.Height() );
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuAcc::grabFocus() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ mpParent->mrMenu.GrabFocus();
+}
+
+// -----------------------------------------------------------------------------
+
+Any SAL_CALL ToolbarMenuAcc::getAccessibleKeyBinding() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ return Any();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL ToolbarMenuAcc::getForeground() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ UINT32 nColor = Application::GetSettings().GetStyleSettings().GetMenuTextColor().GetColor();
+ return static_cast<sal_Int32>(nColor);
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL ToolbarMenuAcc::getBackground() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ UINT32 nColor = Application::GetSettings().GetStyleSettings().GetMenuColor().GetColor();
+ return static_cast<sal_Int32>(nColor);
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuAcc::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ThrowIfDisposed();
+
+ mpParent->selectAccessibleChild( nChildIndex );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL ToolbarMenuAcc::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ThrowIfDisposed();
+ return mpParent->isAccessibleChildSelected( nChildIndex );
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuAcc::clearAccessibleSelection() throw (RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ThrowIfDisposed();
+ mpParent->clearAccessibleSelection();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuAcc::selectAllAccessibleChildren() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ // unsupported due to single selection only
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL ToolbarMenuAcc::getSelectedAccessibleChildCount() throw (RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ThrowIfDisposed();
+
+ return mpParent->mnHighlightedEntry != -1 ? 1 : 0;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL ToolbarMenuAcc::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ThrowIfDisposed();
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ if( (mpParent->mnHighlightedEntry != -1) && (nSelectedChildIndex == 0) )
+ {
+ ToolbarMenuEntry* pEntry = mpParent->maEntryVector[ mpParent->mnHighlightedEntry ];
+ if( pEntry )
+ {
+ if( pEntry->mpControl )
+ {
+ Reference< XAccessibleSelection > xSel( pEntry->GetAccessible(true), UNO_QUERY_THROW );
+ return xSel->getSelectedAccessibleChild(0);
+ }
+ else
+ return Reference< XAccessible >( pEntry->GetAccessible(true), UNO_QUERY );
+ }
+ }
+
+ throw IndexOutOfBoundsException();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuAcc::deselectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ThrowIfDisposed();
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ // Because of the single selection we can reset the whole selection when
+ // the specified child is currently selected.
+ if (isAccessibleChildSelected(nChildIndex))
+ mpParent->clearAccessibleSelection();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuAcc::disposing (void)
+{
+ EventListenerVector aListenerListCopy;
+
+ {
+ // Make a copy of the list and clear the original.
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard (m_aMutex);
+ aListenerListCopy = mxEventListeners;
+ mxEventListeners.clear();
+
+ // Reset the pointer to the parent. It has to be the one who has
+ // disposed us because he is dying.
+ mpParent = NULL;
+ }
+
+ // Inform all listeners that this objects is disposing.
+ EventListenerVector::const_iterator aListenerIterator (aListenerListCopy.begin());
+ EventObject aEvent (static_cast<XAccessible*>(this));
+ while(aListenerIterator != aListenerListCopy.end())
+ {
+ try
+ {
+ (*aListenerIterator)->disposing (aEvent);
+ }
+ catch( Exception& )
+ {
+ // Ignore exceptions.
+ }
+
+ ++aListenerIterator;
+ }
+}
+
+void ToolbarMenuAcc::ThrowIfDisposed (void) throw (DisposedException)
+{
+ if(rBHelper.bDisposed || rBHelper.bInDispose || !mpParent)
+ {
+ throw DisposedException ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("object has been already disposed")), static_cast<XWeak*>(this));
+ }
+}
+
+// -----------------------
+// - ToolbarMenuEntryAcc -
+// -----------------------
+
+ToolbarMenuEntryAcc::ToolbarMenuEntryAcc( ToolbarMenuEntry* pParent )
+: ToolbarMenuEntryAccBase( m_aMutex )
+, mpParent( pParent )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+ToolbarMenuEntryAcc::~ToolbarMenuEntryAcc()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void ToolbarMenuEntryAcc::FireAccessibleEvent( short nEventId, const Any& rOldValue, const Any& rNewValue )
+{
+ if( nEventId )
+ {
+ EventListenerVector aTmpListeners( mxEventListeners );
+ ::std::vector< Reference< XAccessibleEventListener > >::const_iterator aIter( aTmpListeners.begin() );
+ AccessibleEventObject aEvtObject;
+
+ aEvtObject.EventId = nEventId;
+ aEvtObject.Source = static_cast<XWeak*>(this);
+ aEvtObject.NewValue = rNewValue;
+ aEvtObject.OldValue = rOldValue;
+
+ while( aIter != aTmpListeners.end() )
+ {
+ (*aIter)->notifyEvent( aEvtObject );
+ aIter++;
+ }
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuEntryAcc::disposing (void)
+{
+ EventListenerVector aListenerListCopy;
+
+ {
+ // Make a copy of the list and clear the original.
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard (m_aMutex);
+ aListenerListCopy = mxEventListeners;
+ mxEventListeners.clear();
+
+ // Reset the pointer to the parent. It has to be the one who has
+ // disposed us because he is dying.
+ mpParent = NULL;
+ }
+
+ // Inform all listeners that this objects is disposing.
+ EventListenerVector::const_iterator aListenerIterator (aListenerListCopy.begin());
+ EventObject aEvent (static_cast<XAccessible*>(this));
+ while(aListenerIterator != aListenerListCopy.end())
+ {
+ try
+ {
+ (*aListenerIterator)->disposing (aEvent);
+ }
+ catch( Exception& )
+ {
+ // Ignore exceptions.
+ }
+
+ ++aListenerIterator;
+ }
+}
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleContext > SAL_CALL ToolbarMenuEntryAcc::getAccessibleContext() throw (RuntimeException)
+{
+ return this;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL ToolbarMenuEntryAcc::getAccessibleChildCount() throw (RuntimeException)
+{
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL ToolbarMenuEntryAcc::getAccessibleChild( sal_Int32 ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ throw IndexOutOfBoundsException();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL ToolbarMenuEntryAcc::getAccessibleParent() throw (RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference< XAccessible > xRet;
+
+ if( mpParent )
+ xRet = mpParent->mrMenu.GetAccessible();
+
+ return xRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL ToolbarMenuEntryAcc::getAccessibleIndexInParent() throw (RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ // The index defaults to -1 to indicate the child does not belong to its
+ // parent.
+ sal_Int32 nIndexInParent = -1;
+
+ if( mpParent )
+ {
+ Reference< XAccessibleContext > xParent( mpParent->mrMenu.GetAccessible(), UNO_QUERY );
+
+ if( xParent.is() )
+ {
+ Reference< XAccessible > xThis( this );
+
+ const sal_Int32 nCount = xParent->getAccessibleChildCount();
+ for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ if( xParent->getAccessibleChild(nIndex) == xThis )
+ {
+ nIndexInParent = nIndex;
+ break;
+ }
+ }
+ }
+ }
+
+ return nIndexInParent;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int16 SAL_CALL ToolbarMenuEntryAcc::getAccessibleRole() throw (RuntimeException)
+{
+ return AccessibleRole::LIST_ITEM;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL ToolbarMenuEntryAcc::getAccessibleDescription() throw (RuntimeException)
+{
+ return ::rtl::OUString();
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL ToolbarMenuEntryAcc::getAccessibleName() throw (RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ String aRet;
+
+ if( mpParent )
+ {
+ aRet = mpParent->maText;
+
+ if( !aRet.Len() )
+ {
+ aRet = String( RTL_CONSTASCII_USTRINGPARAM( "Item " ) );
+ aRet += String::CreateFromInt32( mpParent->mnEntryId );
+ }
+ }
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleRelationSet > SAL_CALL ToolbarMenuEntryAcc::getAccessibleRelationSet() throw (RuntimeException)
+{
+ return Reference< XAccessibleRelationSet >();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleStateSet > SAL_CALL ToolbarMenuEntryAcc::getAccessibleStateSet() throw (RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper;
+
+ if( mpParent )
+ {
+ pStateSet->AddState (AccessibleStateType::ENABLED);
+ pStateSet->AddState (AccessibleStateType::SENSITIVE);
+ pStateSet->AddState (AccessibleStateType::SHOWING);
+ pStateSet->AddState (AccessibleStateType::VISIBLE);
+ pStateSet->AddState (AccessibleStateType::TRANSIENT);
+ if( mpParent->mnEntryId != TITLE_ID )
+ {
+ pStateSet->AddState( AccessibleStateType::SELECTABLE );
+
+ // SELECTED
+ if( mpParent->mrMenu.getHighlightedEntryId() == mpParent->mnEntryId )
+ pStateSet->AddState( AccessibleStateType::SELECTED );
+ }
+ }
+
+ return pStateSet;
+}
+
+// -----------------------------------------------------------------------------
+
+Locale SAL_CALL ToolbarMenuEntryAcc::getLocale() throw (IllegalAccessibleComponentStateException, RuntimeException)
+{
+ const ::rtl::OUString aEmptyStr;
+ Locale aRet( aEmptyStr, aEmptyStr, aEmptyStr );
+
+ Reference< XAccessible > xParent( getAccessibleParent() );
+ if( xParent.is() )
+ {
+ Reference< XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
+
+ if( xParentContext.is() )
+ aRet = xParentContext->getLocale();
+ }
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuEntryAcc::addEventListener( const Reference< XAccessibleEventListener >& rxListener ) throw (RuntimeException)
+{
+ const ::vos::OGuard aGuard( maMutex );
+
+ if( rxListener.is() )
+ {
+ EventListenerVector::const_iterator aIter( mxEventListeners.begin() );
+ bool bFound = false;
+
+ while( !bFound && ( aIter != mxEventListeners.end() ) )
+ {
+ if( *aIter == rxListener )
+ bFound = true;
+ else
+ aIter++;
+ }
+
+ if (!bFound)
+ mxEventListeners.push_back( rxListener );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuEntryAcc::removeEventListener( const Reference< XAccessibleEventListener >& rxListener ) throw (RuntimeException)
+{
+ const ::vos::OGuard aGuard( maMutex );
+
+ if( rxListener.is() )
+ {
+ EventListenerVector::iterator aIter = mxEventListeners.begin();
+ bool bFound = false;
+
+ while( !bFound && ( aIter != mxEventListeners.end() ) )
+ {
+ if( *aIter == rxListener )
+ {
+ mxEventListeners.erase( aIter );
+ bFound = true;
+ }
+ else
+ aIter++;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL ToolbarMenuEntryAcc::containsPoint( const awt::Point& aPoint ) throw (RuntimeException)
+{
+ const awt::Rectangle aRect( getBounds() );
+ const Point aSize( aRect.Width, aRect.Height );
+ const Point aNullPoint, aTestPoint( aPoint.X, aPoint.Y );
+
+ return Rectangle( aNullPoint, aSize ).IsInside( aTestPoint );
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL ToolbarMenuEntryAcc::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException)
+{
+ Reference< XAccessible > xRet;
+ return xRet;
+}
+
+// -----------------------------------------------------------------------------
+
+awt::Rectangle SAL_CALL ToolbarMenuEntryAcc::getBounds() throw (RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ awt::Rectangle aRet;
+
+ if( mpParent )
+ {
+ Rectangle aRect( mpParent->maRect );
+ Point aOrigin;
+ Rectangle aParentRect( aOrigin, mpParent->mrMenu.GetOutputSizePixel() );
+
+ aRect.Intersection( aParentRect );
+
+ aRet.X = aRect.Left();
+ aRet.Y = aRect.Top();
+ aRet.Width = aRect.GetWidth();
+ aRet.Height = aRect.GetHeight();
+ }
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+awt::Point SAL_CALL ToolbarMenuEntryAcc::getLocation() throw (RuntimeException)
+{
+ const awt::Rectangle aRect( getBounds() );
+ return awt::Point( aRect.X, aRect.Y );
+}
+
+// -----------------------------------------------------------------------------
+
+awt::Point SAL_CALL ToolbarMenuEntryAcc::getLocationOnScreen() throw (RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ awt::Point aRet;
+
+ if( mpParent )
+ {
+ const Point aScreenPos( mpParent->mrMenu.OutputToAbsoluteScreenPixel( mpParent->maRect.TopLeft() ) );
+
+ aRet.X = aScreenPos.X();
+ aRet.Y = aScreenPos.Y();
+ }
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+awt::Size SAL_CALL ToolbarMenuEntryAcc::getSize() throw (RuntimeException)
+{
+ const awt::Rectangle aRect( getBounds() );
+ awt::Size aRet;
+
+ aRet.Width = aRect.Width;
+ aRet.Height = aRect.Height;
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuEntryAcc::grabFocus() throw (RuntimeException)
+{
+ // nothing to do
+}
+
+// -----------------------------------------------------------------------------
+
+Any SAL_CALL ToolbarMenuEntryAcc::getAccessibleKeyBinding() throw (RuntimeException)
+{
+ return Any();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL ToolbarMenuEntryAcc::getForeground( ) throw (RuntimeException)
+{
+ return static_cast<sal_Int32>(Application::GetSettings().GetStyleSettings().GetMenuTextColor().GetColor());
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL ToolbarMenuEntryAcc::getBackground( ) throw (RuntimeException)
+{
+ return static_cast<sal_Int32>(Application::GetSettings().GetStyleSettings().GetMenuColor().GetColor());
+}
+
+}
diff --git a/svtools/source/control/toolbarmenuimp.hxx b/svtools/source/control/toolbarmenuimp.hxx
new file mode 100644
index 000000000000..d1de4f704b76
--- /dev/null
+++ b/svtools/source/control/toolbarmenuimp.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#include <vos/mutex.hxx>
+#include <vcl/image.hxx>
+#include <vcl/menu.hxx>
+
+#include <cppuhelper/compbase4.hxx>
+#include <cppuhelper/compbase5.hxx>
+#include <comphelper/broadcasthelper.hxx>
+
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+
+#include <rtl/ref.hxx>
+
+#include <vector>
+
+#include "framestatuslistener.hxx"
+
+#include "svtools/valueset.hxx"
+
+namespace svtools {
+
+struct ToolbarMenu_Impl;
+class ToolbarMenu;
+class ToolbarMenuEntry;
+
+typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener > > EventListenerVector;
+typedef std::vector< ToolbarMenuEntry * > ToolbarMenuEntryVector;
+
+const int EXTRAITEMHEIGHT = 0; // 4;
+const int SEPARATOR_HEIGHT = 4;
+const int TITLE_ID = -1;
+const int BORDER_X = 0;
+const int BORDER_Y = 0;
+
+// --------------------
+// - ToolbarMenuEntry -
+// --------------------
+
+class ToolbarMenuEntry
+{
+public:
+ ToolbarMenu& mrMenu;
+
+ int mnEntryId;
+ MenuItemBits mnBits;
+ Size maSize;
+
+ bool mbHasText;
+ bool mbHasImage;
+ bool mbChecked;
+ bool mbEnabled;
+
+ String maText;
+ Image maImage;
+ Control* mpControl;
+ Rectangle maRect;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > mxAccContext;
+
+public:
+ ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, const String& rText, MenuItemBits nBits );
+ ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, const Image& rImage, MenuItemBits nBits );
+ ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, const Image& rImage, const String& rText, MenuItemBits nBits );
+ ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, Control* pControl, MenuItemBits nBits );
+ ~ToolbarMenuEntry();
+
+ void init( int nEntryId, MenuItemBits nBits );
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& GetAccessible( bool bCreate = false );
+
+ sal_Int32 getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > getAccessibleChild( sal_Int32 index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ void selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ bool HasCheck() const
+ {
+ return mbChecked || ( mnBits & ( MIB_RADIOCHECK | MIB_CHECKABLE | MIB_AUTOCHECK ) );
+ }
+};
+
+// ---------------
+// - ToolbarMenuAcc -
+// ---------------
+
+typedef ::cppu::WeakComponentImplHelper5<
+ ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+ ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleComponent,
+ ::com::sun::star::accessibility::XAccessibleSelection >
+ ToolbarMenuAccComponentBase;
+
+class ToolbarMenuAcc :
+ public ::comphelper::OBaseMutex,
+ public ToolbarMenuAccComponentBase
+{
+public:
+
+ ToolbarMenuAcc( ToolbarMenu_Impl& rParent );
+ ~ToolbarMenuAcc();
+
+ void FireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue );
+ bool HasAccessibleListeners() const { return( mxEventListeners.size() > 0 ); }
+
+public:
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleEventBroadcaster
+ using cppu::WeakComponentImplHelper5<com::sun::star::accessibility::XAccessible, com::sun::star::accessibility::XAccessibleEventBroadcaster, com::sun::star::accessibility::XAccessibleContext, com::sun::star::accessibility::XAccessibleComponent, com::sun::star::accessibility::XAccessibleSelection>::addEventListener;
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ using cppu::WeakComponentImplHelper5<com::sun::star::accessibility::XAccessible, com::sun::star::accessibility::XAccessibleEventBroadcaster, com::sun::star::accessibility::XAccessibleContext, com::sun::star::accessibility::XAccessibleComponent, com::sun::star::accessibility::XAccessibleSelection>::removeEventListener;
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleSelection
+ virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ DECL_LINK( WindowEventListener, VclSimpleEvent* );
+
+private:
+ EventListenerVector mxEventListeners;
+ ToolbarMenu_Impl* mpParent;
+ /// The current FOCUSED state.
+ bool mbIsFocused;
+
+ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+
+ /** Tell all listeners that the object is dying. This callback is
+ usually called from the WeakComponentImplHelper class.
+ */
+ virtual void SAL_CALL disposing (void);
+
+ /** Check whether or not the object has been disposed (or is in the
+ state of beeing disposed). If that is the case then
+ DisposedException is thrown to inform the (indirect) caller of the
+ foul deed.
+ */
+ void ThrowIfDisposed (void) throw (::com::sun::star::lang::DisposedException);
+};
+
+// -----------------------
+// - ToolbarMenuEntryAcc -
+// -----------------------
+
+typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+ ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleComponent > ToolbarMenuEntryAccBase;
+
+class ToolbarMenuEntryAcc : public ::comphelper::OBaseMutex,
+ public ToolbarMenuEntryAccBase
+{
+public:
+ ToolbarMenuEntryAcc( ToolbarMenuEntry* pParent );
+ ~ToolbarMenuEntryAcc();
+
+ void FireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue );
+ bool HasAccessibleListeners() const { return( mxEventListeners.size() > 0 ); }
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleEventBroadcaster
+ using ToolbarMenuEntryAccBase::addEventListener;
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ using ToolbarMenuEntryAccBase::removeEventListener;
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ EventListenerVector mxEventListeners;
+ ::vos::OMutex maMutex;
+ ToolbarMenuEntry* mpParent;
+
+ /** Tell all listeners that the object is dying. This callback is
+ usually called from the WeakComponentImplHelper class.
+ */
+ virtual void SAL_CALL disposing (void);
+};
+
+// -----------------------------------------------------------------------------
+
+struct ToolbarMenu_Impl
+{
+ ToolbarMenu& mrMenu;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame;
+ rtl::Reference< svt::FrameStatusListener > mxStatusListener;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceManager;
+ rtl::Reference< ToolbarMenuAcc > mxAccessible;
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxOldSelection;
+
+ ToolbarMenuEntryVector maEntryVector;
+
+ int mnCheckPos;
+ int mnImagePos;
+ int mnTextPos;
+
+ int mnHighlightedEntry;
+ int mnSelectedEntry;
+ int mnLastColumn;
+
+ Size maSize;
+
+ Link maSelectHdl;
+
+ ToolbarMenu_Impl( ToolbarMenu& rMenu, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame );
+ ~ToolbarMenu_Impl();
+
+ void setAccessible( ToolbarMenuAcc* pAccessible );
+
+ void fireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue );
+ bool hasAccessibleListeners();
+
+ sal_Int32 getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > getAccessibleChild( sal_Int32 index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > getAccessibleChild( Control* pControl, sal_Int32 childIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ void selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ sal_Bool isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ void clearAccessibleSelection();
+
+ ToolbarMenuEntry* implGetEntry( int nEntry ) const;
+ void notifyHighlightedEntry();
+
+ void implHighlightControl( USHORT nCode, Control* pControl );
+};
+
+}
diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx
index 6712e75aa9b4..66da5636d89c 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -976,10 +976,7 @@ sal_Int16 SAL_CALL ValueItemAcc::getAccessibleRole()
::rtl::OUString SAL_CALL ValueItemAcc::getAccessibleDescription()
throw (uno::RuntimeException)
{
- const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- String aRet( RTL_CONSTASCII_USTRINGPARAM( "ValueSet item" ) );
-
- return aRet;
+ return ::rtl::OUString();
}
// -----------------------------------------------------------------------------
@@ -1239,7 +1236,7 @@ sal_Int32 SAL_CALL ValueItemAcc::getBackground( )
throw (uno::RuntimeException)
{
UINT32 nColor;
- if (mpParent->meType == VALUESETITEM_COLOR)
+ if (mpParent && mpParent->meType == VALUESETITEM_COLOR)
nColor = mpParent->maColor.GetColor();
else
nColor = Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor();
diff --git a/svtools/source/control/valueimp.hxx b/svtools/source/control/valueimp.hxx
index f74cdf00a4db..abde4a015ab8 100644..100755
--- a/svtools/source/control/valueimp.hxx
+++ b/svtools/source/control/valueimp.hxx
@@ -111,6 +111,7 @@ struct ValueSet_Impl
{
::std::auto_ptr< ValueItemList > mpItemList;
bool mbIsTransientChildrenDisabled;
+ Link maHighlightHdl;
ValueSet_Impl() : mpItemList( ::std::auto_ptr< ValueItemList >( new ValueItemList() ) ),
mbIsTransientChildrenDisabled( false )
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index bb48c11c7c0b..62193eadf735 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -1418,7 +1418,7 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt )
{
USHORT nLastItem = (USHORT)mpImpl->mpItemList->Count();
USHORT nItemPos = VALUESET_ITEM_NOTFOUND;
- USHORT nCurPos;
+ USHORT nCurPos = VALUESET_ITEM_NONEITEM;
USHORT nCalcPos;
if ( !nLastItem || !ImplGetFirstItem() )
@@ -1431,8 +1431,6 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt )
if ( mnSelItemId )
nCurPos = GetItemPos( mnSelItemId );
- else
- nCurPos = VALUESET_ITEM_NONEITEM;
nCalcPos = nCurPos;
//switch off selection mode if key travelling is used
@@ -1528,30 +1526,20 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt )
nCalcPos - ( nLineCount * mnCols ));
else
{
- if( (KEY_UP == rKEvt.GetKeyCode().GetCode() ) && (GetStyle() & WB_MENUSTYLEVALUESET) )
+ if ( mpNoneItem )
{
- Window* pParent = GetParent();
- pParent->GrabFocus();
- pParent->KeyInput( rKEvt );
- break;
+ mnCurCol = nCalcPos%mnCols;
+ nItemPos = VALUESET_ITEM_NONEITEM;
}
else
{
- if ( mpNoneItem )
- {
- mnCurCol = nCalcPos%mnCols;
- nItemPos = VALUESET_ITEM_NONEITEM;
- }
+ if ( nLastItem+1 <= mnCols )
+ nItemPos = nCalcPos;
else
{
- if ( nLastItem+1 <= mnCols )
- nItemPos = nCalcPos;
- else
- {
- nItemPos = ((((nLastItem+1)/mnCols)-1)*mnCols)+(nCalcPos%mnCols);
- if ( nItemPos+mnCols <= nLastItem )
- nItemPos = nItemPos + mnCols;
- }
+ nItemPos = ((((nLastItem+1)/mnCols)-1)*mnCols)+(nCalcPos%mnCols);
+ if ( nItemPos+mnCols <= nLastItem )
+ nItemPos = nItemPos + mnCols;
}
}
}
@@ -1580,6 +1568,7 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt )
nCalcPos + ( nLineCount * mnCols ));
else
{
+#if 0
if( (KEY_DOWN == rKEvt.GetKeyCode().GetCode() ) && (GetStyle() & WB_MENUSTYLEVALUESET) )
{
Window* pParent = GetParent();
@@ -1588,6 +1577,7 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt )
break;
}
else
+#endif
{
if ( mpNoneItem )
{
@@ -1620,7 +1610,6 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt )
bDefault = TRUE;
break;
}
-
if(!bDefault)
EndSelection();
if ( nItemPos != VALUESET_ITEM_NOTFOUND )
@@ -1630,6 +1619,7 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt )
nItemId = GetItemId( nItemPos );
else
nItemId = 0;
+
if ( nItemId != mnSelItemId )
{
SelectItem( nItemId );
@@ -2278,6 +2268,7 @@ void ValueSet::SelectItem( USHORT nItemId )
::com::sun::star::uno::Any aOldAny, aNewAny;
ImplFireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventId::SELECTION_CHANGED, aOldAny, aNewAny );
}
+ mpImpl->maHighlightHdl.Call(this);
}
}
@@ -2749,3 +2740,19 @@ bool ValueSet::IsRTLActive (void)
return Application::GetSettings().GetLayoutRTL() && IsRTLEnabled();
}
+// -----------------------------------------------------------------------
+
+void ValueSet::SetHighlightHdl( const Link& rLink )
+{
+ mpImpl->maHighlightHdl = rLink;
+}
+
+// -----------------------------------------------------------------------
+
+const Link& ValueSet::GetHighlightHdl() const
+{
+ return mpImpl->maHighlightHdl;
+}
+
+// -----------------------------------------------------------------------
+
diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx
index 817973cb920f..bfcdfe98ea5a 100644
--- a/svtools/source/dialogs/addresstemplate.cxx
+++ b/svtools/source/dialogs/addresstemplate.cxx
@@ -31,7 +31,7 @@
#include <stdio.h>
#include <svtools/addresstemplate.hxx>
#include "addresstemplate.hrc"
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <svtools/helpid.hrc>
#include <svtools/svtdata.hxx>
#include <tools/debug.hxx>
diff --git a/svtools/source/dialogs/addresstemplate.src b/svtools/source/dialogs/addresstemplate.src
index 3b1e98137ebf..536f6d2a90b4 100644
--- a/svtools/source/dialogs/addresstemplate.src
+++ b/svtools/source/dialogs/addresstemplate.src
@@ -25,7 +25,7 @@
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include "addresstemplate.hrc"
#include <svtools/controldims.hrc>
diff --git a/svtools/source/dialogs/logindlg.cxx b/svtools/source/dialogs/logindlg.cxx
deleted file mode 100644
index 95b77eb57ff3..000000000000
--- a/svtools/source/dialogs/logindlg.cxx
+++ /dev/null
@@ -1,307 +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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#include <svtools/filedlg.hxx>
-#include <vcl/msgbox.hxx>
-#include <svtools/logindlg.hxx>
-#include "logindlg.hrc"
-#include <svl/svtools.hrc>
-#include <svtools/svtdata.hxx>
-
-#ifdef UNX
-#include <limits.h>
-#define _MAX_PATH PATH_MAX
-#endif
-
-// LoginDialog -------------------------------------------------------
-
-//............................................................................
-namespace svt
-{
-//............................................................................
-
-void LoginDialog::HideControls_Impl( USHORT nFlags )
-{
- FASTBOOL bPathHide = FALSE;
- FASTBOOL bErrorHide = FALSE;
- FASTBOOL bAccountHide = FALSE;
-
- if ( ( nFlags & LF_NO_PATH ) == LF_NO_PATH )
- {
- aPathFT.Hide();
- aPathED.Hide();
- aPathBtn.Hide();
- bPathHide = TRUE;
- }
- else if ( ( nFlags & LF_PATH_READONLY ) == LF_PATH_READONLY )
- {
- aPathED.Hide();
- aPathInfo.Show();
- aPathBtn.Hide();
- }
-
- if ( ( nFlags & LF_NO_USERNAME ) == LF_NO_USERNAME )
- {
- aNameFT.Hide();
- aNameED.Hide();
- }
- else if ( ( nFlags & LF_USERNAME_READONLY ) == LF_USERNAME_READONLY )
- {
- aNameED.Hide();
- aNameInfo.Show();
- }
-
- if ( ( nFlags & LF_NO_PASSWORD ) == LF_NO_PASSWORD )
- {
- aPasswordFT.Hide();
- aPasswordED.Hide();
- }
-
- if ( ( nFlags & LF_NO_SAVEPASSWORD ) == LF_NO_SAVEPASSWORD )
- aSavePasswdBtn.Hide();
-
- if ( ( nFlags & LF_NO_ERRORTEXT ) == LF_NO_ERRORTEXT )
- {
- aErrorInfo.Hide();
- aErrorGB.Hide();
- bErrorHide = TRUE;
- }
-
- if ( ( nFlags & LF_NO_ACCOUNT ) == LF_NO_ACCOUNT )
- {
- aAccountFT.Hide();
- aAccountED.Hide();
- bAccountHide = TRUE;
- }
-
- if ( bErrorHide )
- {
- long nOffset = aLoginGB.GetPosPixel().Y() -
- aErrorGB.GetPosPixel().Y();
- Point aNewPnt = aRequestInfo.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aRequestInfo.SetPosPixel( aNewPnt );
- aNewPnt = aPathFT.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aPathFT.SetPosPixel( aNewPnt );
- aNewPnt = aPathED.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aPathED.SetPosPixel( aNewPnt );
- aNewPnt = aPathInfo.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aPathInfo.SetPosPixel( aNewPnt );
- aNewPnt = aPathBtn.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aPathBtn.SetPosPixel( aNewPnt );
- aNewPnt = aNameFT.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aNameFT.SetPosPixel( aNewPnt );
- aNewPnt = aNameED.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aNameED.SetPosPixel( aNewPnt );
- aNewPnt = aNameInfo.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aNameInfo.SetPosPixel( aNewPnt );
- aNewPnt = aPasswordFT.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aPasswordFT.SetPosPixel( aNewPnt );
- aNewPnt = aPasswordED.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aPasswordED.SetPosPixel( aNewPnt );
- aNewPnt = aAccountFT.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aAccountFT.SetPosPixel( aNewPnt );
- aNewPnt = aAccountED.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aAccountED.SetPosPixel( aNewPnt );
- aNewPnt = aSavePasswdBtn.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aSavePasswdBtn.SetPosPixel( aNewPnt );
- aNewPnt = aLoginGB.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aLoginGB.SetPosPixel( aNewPnt );
- Size aNewSiz = GetSizePixel();
- aNewSiz.Height() -= nOffset;
- SetSizePixel( aNewSiz );
- }
-
- if ( bPathHide )
- {
- long nOffset = aNameED.GetPosPixel().Y() -
- aPathED.GetPosPixel().Y();
-
- Point aTmpPnt1 = aNameFT.GetPosPixel();
- Point aTmpPnt2 = aPasswordFT.GetPosPixel();
- aNameFT.SetPosPixel( aPathFT.GetPosPixel() );
- aPasswordFT.SetPosPixel( aTmpPnt1 );
- aAccountFT.SetPosPixel( aTmpPnt2 );
- aTmpPnt1 = aNameED.GetPosPixel();
- aTmpPnt2 = aPasswordED.GetPosPixel();
- aNameED.SetPosPixel( aPathED.GetPosPixel() );
- aPasswordED.SetPosPixel( aTmpPnt1 );
- aAccountED.SetPosPixel( aTmpPnt2 );
- aNameInfo.SetPosPixel( aPathInfo.GetPosPixel() );
- aTmpPnt1 = aSavePasswdBtn.GetPosPixel();
- aTmpPnt1.Y() -= nOffset;
- aSavePasswdBtn.SetPosPixel( aTmpPnt1 );
- Size aNewSz = GetSizePixel();
- aNewSz.Height() -= nOffset;
- SetSizePixel( aNewSz );
- }
-
- if ( bAccountHide )
- {
- long nOffset = aAccountED.GetPosPixel().Y() - aPasswordED.GetPosPixel().Y();
-
- Point aTmpPnt = aSavePasswdBtn.GetPosPixel();
- aTmpPnt.Y() -= nOffset;
- aSavePasswdBtn.SetPosPixel( aTmpPnt );
- Size aNewSz = GetSizePixel();
- aNewSz.Height() -= nOffset;
- SetSizePixel( aNewSz );
- }
-};
-
-// -----------------------------------------------------------------------
-
-IMPL_LINK( LoginDialog, OKHdl_Impl, OKButton *, EMPTYARG )
-{
- // trim the strings
- aNameED.SetText( aNameED.GetText().EraseLeadingChars().
- EraseTrailingChars() );
- aPasswordED.SetText( aPasswordED.GetText().EraseLeadingChars().
- EraseTrailingChars() );
- EndDialog( RET_OK );
- return 1;
-}
-
-// -----------------------------------------------------------------------
-
-IMPL_LINK( LoginDialog, PathHdl_Impl, PushButton *, EMPTYARG )
-{
- PathDialog* pDlg = new PathDialog( this, WB_3DLOOK );
-// DirEntry aEntry;
-// aEntry.ToAbs();
-// pDlg->SetPath( aEntry.GetFull() );
-
- if ( pDlg->Execute() == RET_OK )
- aPathED.SetText( pDlg->GetPath() );
-
- delete pDlg;
- return 1;
-}
-
-// -----------------------------------------------------------------------
-
-LoginDialog::LoginDialog
-(
- Window* pParent,
- USHORT nFlags,
- const String& rServer,
- const String* pRealm
-) :
-
- ModalDialog( pParent, SvtResId( DLG_LOGIN ) ),
-
- aErrorInfo ( this, SvtResId( INFO_LOGIN_ERROR ) ),
- aErrorGB ( this, SvtResId( GB_LOGIN_ERROR ) ),
- aRequestInfo ( this, SvtResId( INFO_LOGIN_REQUEST ) ),
- aPathFT ( this, SvtResId( FT_LOGIN_PATH ) ),
- aPathED ( this, SvtResId( ED_LOGIN_PATH ) ),
- aPathInfo ( this, SvtResId( INFO_LOGIN_PATH ) ),
- aPathBtn ( this, SvtResId( BTN_LOGIN_PATH ) ),
- aNameFT ( this, SvtResId( FT_LOGIN_USERNAME ) ),
- aNameED ( this, SvtResId( ED_LOGIN_USERNAME ) ),
- aNameInfo ( this, SvtResId( INFO_LOGIN_USERNAME ) ),
- aPasswordFT ( this, SvtResId( FT_LOGIN_PASSWORD ) ),
- aPasswordED ( this, SvtResId( ED_LOGIN_PASSWORD ) ),
- aAccountFT ( this, SvtResId( FT_LOGIN_ACCOUNT ) ),
- aAccountED ( this, SvtResId( ED_LOGIN_ACCOUNT ) ),
- aSavePasswdBtn ( this, SvtResId( CB_LOGIN_SAVEPASSWORD ) ),
- aLoginGB ( this, SvtResId( GB_LOGIN_LOGIN ) ),
- aOKBtn ( this, SvtResId( BTN_LOGIN_OK ) ),
- aCancelBtn ( this, SvtResId( BTN_LOGIN_CANCEL ) ),
- aHelpBtn ( this, SvtResId( BTN_LOGIN_HELP ) )
-
-{
- // Einlog-Ort eintragen
- String aServer;
-
- if ( ( ( nFlags & LF_NO_ACCOUNT ) == LF_NO_ACCOUNT ) && pRealm && pRealm->Len() )
- {
- aServer = *pRealm;
- ( ( aServer += ' ' ) += String( SvtResId( STR_LOGIN_AT ) ) ) += ' ';
- }
- aServer += rServer;
- String aTxt = aRequestInfo.GetText();
- aTxt.SearchAndReplaceAscii( "%1", aServer );
- aRequestInfo.SetText( aTxt );
-
- FreeResource();
-
- aPathED.SetMaxTextLen( _MAX_PATH );
- aNameED.SetMaxTextLen( _MAX_PATH );
-
- aOKBtn.SetClickHdl( LINK( this, LoginDialog, OKHdl_Impl ) );
- aPathBtn.SetClickHdl( LINK( this, LoginDialog, PathHdl_Impl ) );
-
- HideControls_Impl( nFlags );
-};
-
-// -----------------------------------------------------------------------
-
-void LoginDialog::SetName( const String& rNewName )
-{
- aNameED.SetText( rNewName );
- aNameInfo.SetText( rNewName );
-}
-
-// -----------------------------------------------------------------------
-
-void LoginDialog::ClearPassword()
-{
- aPasswordED.SetText( String() );
-
- if ( 0 == aNameED.GetText().Len() )
- aNameED.GrabFocus();
- else
- aPasswordED.GrabFocus();
-};
-
-// -----------------------------------------------------------------------
-
-void LoginDialog::ClearAccount()
-{
- aAccountED.SetText( String() );
- aAccountED.GrabFocus();
-};
-
-//............................................................................
-} // namespace svt
-//............................................................................
diff --git a/svtools/source/dialogs/logindlg.src b/svtools/source/dialogs/logindlg.src
deleted file mode 100644
index 338b608ab0e4..000000000000
--- a/svtools/source/dialogs/logindlg.src
+++ /dev/null
@@ -1,200 +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_HRC
-#include <svl/svtools.hrc>
-#endif
-
-#ifndef _SVTOOLS_LOGINDLG_HRC_
-#include "logindlg.hrc"
-#endif
-
-ModalDialog DLG_LOGIN
-{
-// HelpId = HID_DLG_LOGIN ;
- Border = TRUE ;
- Moveable = TRUE ;
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Size = MAP_APPFONT ( 265 , 158 ) ;
- FixedText INFO_LOGIN_ERROR
- {
- Pos = MAP_APPFONT ( 12 , 14 ) ;
- Size = MAP_APPFONT ( 185 , 18 ) ;
- WordBreak = TRUE ;
- };
- FixedLine GB_LOGIN_ERROR
- {
- Pos = MAP_APPFONT ( 6 , 3 ) ;
- Size = MAP_APPFONT ( 197 , 8 ) ;
- Text [ en-US ] = "Message from server" ;
- };
- FixedText INFO_LOGIN_REQUEST
- {
- Pos = MAP_APPFONT ( 12 , 55 ) ;
- Size = MAP_APPFONT ( 185 , 18 ) ;
- WordBreak = TRUE ;
- Text [ en-US ] = "Please enter user name and password for %1." ;
- };
- FixedText FT_LOGIN_PATH
- {
- Pos = MAP_APPFONT ( 12 , 77 ) ;
- Size = MAP_APPFONT ( 57 , 10 ) ;
- Text [ en-US ] = "~Path" ;
- };
- Edit ED_LOGIN_PATH
- {
- Border = TRUE ;
- Pos = MAP_APPFONT ( 72 , 76 ) ;
- Size = MAP_APPFONT ( 108 , 12 ) ;
- };
- FixedText INFO_LOGIN_PATH
- {
- Hide = TRUE ;
- Pos = MAP_APPFONT ( 72 , 77 ) ;
- Size = MAP_APPFONT ( 125 , 10 ) ;
- };
- PushButton BTN_LOGIN_PATH
- {
- Pos = MAP_APPFONT ( 183 , 75 ) ;
- Size = MAP_APPFONT ( 14 , 14 ) ;
- Text = "~..." ;
- };
- FixedText FT_LOGIN_USERNAME
- {
- Pos = MAP_APPFONT ( 12 , 92 ) ;
- Size = MAP_APPFONT ( 57 , 10 ) ;
- Text [ en-US ] = "~User name" ;
- };
- Edit ED_LOGIN_USERNAME
- {
- Border = TRUE ;
- Pos = MAP_APPFONT ( 72 , 91 ) ;
- Size = MAP_APPFONT ( 125 , 12 ) ;
- };
- FixedText INFO_LOGIN_USERNAME
- {
- Hide = TRUE ;
- Pos = MAP_APPFONT ( 72 , 92 ) ;
- Size = MAP_APPFONT ( 125 , 10 ) ;
- };
- FixedText FT_LOGIN_PASSWORD
- {
- Pos = MAP_APPFONT ( 12 , 107 ) ;
- Size = MAP_APPFONT ( 57 , 10 ) ;
- Text [ en-US ] = "Pass~word" ;
- };
- Edit ED_LOGIN_PASSWORD
- {
- Border = TRUE ;
- Pos = MAP_APPFONT ( 72 , 106 ) ;
- Size = MAP_APPFONT ( 125 , 12 ) ;
- PassWord = TRUE ;
- };
- FixedText FT_LOGIN_ACCOUNT
- {
- Pos = MAP_APPFONT ( 12 , 122 ) ;
- Size = MAP_APPFONT ( 57 , 10 ) ;
- Text [ en-US ] = "A~ccount";
- };
- Edit ED_LOGIN_ACCOUNT
- {
- Border = TRUE ;
- Pos = MAP_APPFONT ( 72 , 121 ) ;
- Size = MAP_APPFONT ( 125 , 12 ) ;
- PassWord = TRUE ;
- };
- CheckBox CB_LOGIN_SAVEPASSWORD
- {
- Pos = MAP_APPFONT ( 12 , 136 ) ;
- Size = MAP_APPFONT ( 185 , 10 ) ;
- Text [ en-US ] = "~Save password" ;
- };
- FixedLine GB_LOGIN_LOGIN
- {
- Pos = MAP_APPFONT ( 7 , 44 ) ;
- Size = MAP_APPFONT ( 197 , 8 ) ;
- Text [ en-US ] = "Log in" ;
- };
- OKButton BTN_LOGIN_OK
- {
- Pos = MAP_APPFONT ( 209 , 6 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- DefButton = TRUE ;
- };
- CancelButton BTN_LOGIN_CANCEL
- {
- Pos = MAP_APPFONT ( 209 , 23 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- };
- HelpButton BTN_LOGIN_HELP
- {
- Pos = MAP_APPFONT ( 209 , 43 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- };
- String STR_LOGIN_AT
- {
- Text [ en-US ] = "to " ;
- };
- Text [ en-US ] = "User Name and Password Required" ;
-};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/svtools/source/dialogs/makefile.mk b/svtools/source/dialogs/makefile.mk
index 16528ee7d4cd..99c4b59b76ae 100644..100755
--- a/svtools/source/dialogs/makefile.mk
+++ b/svtools/source/dialogs/makefile.mk
@@ -44,7 +44,6 @@ SRC1FILES= filedlg2.src \
prnsetup.src \
printdlg.src \
colrdlg.src \
- logindlg.src \
addresstemplate.src \
wizardmachine.src
@@ -69,8 +68,7 @@ SLOFILES= \
$(SLO)$/colrdlg.obj \
$(SLO)$/property.obj \
$(SLO)$/wizdlg.obj \
- $(SLO)$/mcvmath.obj \
- $(SLO)$/logindlg.obj
+ $(SLO)$/mcvmath.obj
# --- Targets ------------------------------------------------------
diff --git a/svtools/source/dialogs/printdlg.hrc b/svtools/source/dialogs/printdlg.hrc
index ef780acbb47c..83b7b0b28c82 100644
--- a/svtools/source/dialogs/printdlg.hrc
+++ b/svtools/source/dialogs/printdlg.hrc
@@ -25,7 +25,7 @@
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#define FL_PRINTER 1
#define LB_NAMES 2
diff --git a/svtools/source/dialogs/prnsetup.hrc b/svtools/source/dialogs/prnsetup.hrc
index 7d10c4652d45..4a06c3cf0e63 100644
--- a/svtools/source/dialogs/prnsetup.hrc
+++ b/svtools/source/dialogs/prnsetup.hrc
@@ -24,7 +24,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#define FL_PRINTER 1
#define LB_NAMES 2
diff --git a/svtools/source/dialogs/roadmapwizard.cxx b/svtools/source/dialogs/roadmapwizard.cxx
index cdaf1d09e32f..5f99358132f1 100644
--- a/svtools/source/dialogs/roadmapwizard.cxx
+++ b/svtools/source/dialogs/roadmapwizard.cxx
@@ -29,7 +29,7 @@
#include "precompiled_svtools.hxx"
#include <svtools/roadmapwizard.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <svtools/svtdata.hxx>
#include <svtools/roadmap.hxx>
#include <tools/debug.hxx>
@@ -182,7 +182,21 @@ namespace svt
,m_pImpl( new RoadmapWizardImpl )
{
DBG_CTOR( RoadmapWizard, CheckInvariants );
+ impl_construct();
+ }
+
+ //--------------------------------------------------------------------
+ RoadmapWizard::RoadmapWizard( Window* _pParent, const WinBits i_nStyle, sal_uInt32 _nButtonFlags )
+ :OWizardMachine( _pParent, i_nStyle, _nButtonFlags )
+ ,m_pImpl( new RoadmapWizardImpl )
+ {
+ DBG_CTOR( RoadmapWizard, CheckInvariants );
+ impl_construct();
+ }
+ //--------------------------------------------------------------------
+ void RoadmapWizard::impl_construct()
+ {
SetLeftAlignedButtonCount( 1 );
SetEmptyViewMargin();
@@ -328,15 +342,16 @@ namespace svt
if ( (sal_Int32)aNewPathPos->second.size() <= nCurrentStatePathIndex )
return;
-#if OSL_DEBUG_LEVEL > 0
// assert that the current and the new path are equal, up to nCurrentStatePathIndex
Paths::const_iterator aActivePathPos = m_pImpl->aPaths.find( m_pImpl->nActivePath );
if ( aActivePathPos != m_pImpl->aPaths.end() )
{
- DBG_ASSERT( m_pImpl->getFirstDifferentIndex( aActivePathPos->second, aNewPathPos->second ) > nCurrentStatePathIndex,
- "RoadmapWizard::activate: you cannot activate a path which conflicts with the current one *before* the current state!" );
+ if ( m_pImpl->getFirstDifferentIndex( aActivePathPos->second, aNewPathPos->second ) <= nCurrentStatePathIndex )
+ {
+ OSL_ENSURE( false, "RoadmapWizard::activate: you cannot activate a path which conflicts with the current one *before* the current state!" );
+ return;
+ }
}
-#endif
m_pImpl->nActivePath = _nPathId;
m_pImpl->bActivePathIsDefinite = _bDecideForIt;
@@ -383,8 +398,14 @@ namespace svt
}
// can we advance from the current page?
- const OWizardPage* pCurrentPage = dynamic_cast< const OWizardPage* >( GetPage( getCurrentState() ) );
- const bool bCurrentPageCanAdvance = !pCurrentPage || pCurrentPage->canAdvance();
+ bool bCurrentPageCanAdvance = true;
+ TabPage* pCurrentPage = GetPage( getCurrentState() );
+ if ( pCurrentPage )
+ {
+ const IWizardPageController* pController = getPageController( GetPage( getCurrentState() ) );
+ OSL_ENSURE( pController != NULL, "RoadmapWizard::implUpdateRoadmap: no controller for the current page!" );
+ bCurrentPageCanAdvance = !pController || pController->canAdvance();
+ }
// now, we have to remove all items after nCurrentStatePathIndex, and insert the items from the active
// path, up to (excluding) nUpperStepBoundary
@@ -641,11 +662,33 @@ namespace svt
// if the state is currently in the roadmap, reflect it's new status
m_pImpl->pRoadmap->EnableRoadmapItem( (RoadmapTypes::ItemId)_nState, _bEnable );
}
+
+ //--------------------------------------------------------------------
+ bool RoadmapWizard::knowsState( WizardState i_nState ) const
+ {
+ for ( Paths::const_iterator path = m_pImpl->aPaths.begin();
+ path != m_pImpl->aPaths.end();
+ ++path
+ )
+ {
+ for ( WizardPath::const_iterator state = path->second.begin();
+ state != path->second.end();
+ ++state
+ )
+ {
+ if ( *state == i_nState )
+ return true;
+ }
+ }
+ return false;
+ }
+
//--------------------------------------------------------------------
bool RoadmapWizard::isStateEnabled( WizardState _nState ) const
{
return m_pImpl->aDisabledStates.find( _nState ) == m_pImpl->aDisabledStates.end();
}
+
//--------------------------------------------------------------------
void RoadmapWizard::Resize()
{
diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx
index 6a09f85036fd..2053da80019d 100644
--- a/svtools/source/dialogs/wizardmachine.cxx
+++ b/svtools/source/dialogs/wizardmachine.cxx
@@ -30,10 +30,11 @@
#include <svtools/wizardmachine.hxx>
#include <svtools/helpid.hrc>
#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
#include <vcl/msgbox.hxx>
#include <svtools/svtdata.hxx>
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
//.........................................................................
@@ -101,7 +102,7 @@ namespace svt
}
//---------------------------------------------------------------------
- sal_Bool OWizardPage::commitPage( CommitPageReason )
+ sal_Bool OWizardPage::commitPage( WizardTypes::CommitPageReason )
{
return sal_True;
}
@@ -161,6 +162,25 @@ namespace svt
,m_pHelp(NULL)
,m_pImpl( new WizardMachineImplData )
{
+ implConstruct( _nButtonFlags );
+ }
+
+ //---------------------------------------------------------------------
+ OWizardMachine::OWizardMachine(Window* _pParent, const WinBits i_nStyle, sal_uInt32 _nButtonFlags )
+ :WizardDialog( _pParent, i_nStyle )
+ ,m_pFinish(NULL)
+ ,m_pCancel(NULL)
+ ,m_pNextPage(NULL)
+ ,m_pPrevPage(NULL)
+ ,m_pHelp(NULL)
+ ,m_pImpl( new WizardMachineImplData )
+ {
+ implConstruct( _nButtonFlags );
+ }
+
+ //---------------------------------------------------------------------
+ void OWizardMachine::implConstruct( const sal_uInt32 _nButtonFlags )
+ {
m_pImpl->sTitleBase = GetText();
// create the buttons according to the wizard button flags
@@ -225,8 +245,6 @@ namespace svt
AddButton( m_pCancel, WIZARDDIALOG_BUTTON_STDOFFSET_X );
}
-
-
}
//---------------------------------------------------------------------
@@ -274,35 +292,42 @@ namespace svt
}
//---------------------------------------------------------------------
- void OWizardMachine::ActivatePage()
+ TabPage* OWizardMachine::GetOrCreatePage( const WizardState i_nState )
{
- WizardDialog::ActivatePage();
-
- WizardState nCurrentLevel = GetCurLevel();
- if (NULL == GetPage(nCurrentLevel))
+ if ( NULL == GetPage( i_nState ) )
{
- TabPage* pNewPage = createPage(nCurrentLevel);
- DBG_ASSERT(pNewPage, "OWizardMachine::ActivatePage: invalid new page (NULL)!");
+ TabPage* pNewPage = createPage( i_nState );
+ DBG_ASSERT( pNewPage, "OWizardMachine::GetOrCreatePage: invalid new page (NULL)!" );
// fill up the page sequence of our base class (with dummies)
- while (m_pImpl->nFirstUnknownPage < nCurrentLevel)
+ while ( m_pImpl->nFirstUnknownPage < i_nState )
{
- AddPage(NULL);
+ AddPage( NULL );
++m_pImpl->nFirstUnknownPage;
}
- if (m_pImpl->nFirstUnknownPage == nCurrentLevel)
+ if ( m_pImpl->nFirstUnknownPage == i_nState )
{
// encountered this page number the first time
- AddPage(pNewPage);
+ AddPage( pNewPage );
++m_pImpl->nFirstUnknownPage;
}
else
// already had this page - just change it
- SetPage(nCurrentLevel, pNewPage);
+ SetPage( i_nState, pNewPage );
}
+ return GetPage( i_nState );
+ }
- enterState(nCurrentLevel);
+ //---------------------------------------------------------------------
+ void OWizardMachine::ActivatePage()
+ {
+ WizardDialog::ActivatePage();
+
+ WizardState nCurrentLevel = GetCurLevel();
+ GetOrCreatePage( nCurrentLevel );
+
+ enterState( nCurrentLevel );
}
//---------------------------------------------------------------------
@@ -330,8 +355,10 @@ namespace svt
if (m_pCancel && (_nWizardButtonFlags & WZB_CANCEL))
pNewDefButton = m_pCancel;
- if (pNewDefButton)
- defaultButton(pNewDefButton);
+ if ( pNewDefButton )
+ defaultButton( pNewDefButton );
+ else
+ implResetDefault( this );
}
//---------------------------------------------------------------------
@@ -395,9 +422,10 @@ namespace svt
void OWizardMachine::enterState(WizardState _nState)
{
// tell the page
- IWizardPage* pCurrentPage = getWizardPage(GetPage(_nState));
- if ( pCurrentPage )
- pCurrentPage->initializePage();
+ IWizardPageController* pController = getPageController( GetPage( _nState ) );
+ OSL_ENSURE( pController, "OWizardMachine::enterState: no controller for the given page!" );
+ if ( pController )
+ pController->initializePage();
if ( isAutomaticNextButtonStateEnabled() )
enableButtons( WZB_NEXT, canAdvance() );
@@ -419,9 +447,9 @@ namespace svt
}
//---------------------------------------------------------------------
- sal_Bool OWizardMachine::onFinish(sal_Int32 _nResult)
+ sal_Bool OWizardMachine::onFinish()
{
- return Finnish(_nResult);
+ return Finnish( RET_OK );
}
//---------------------------------------------------------------------
@@ -434,8 +462,7 @@ namespace svt
{
return 0L;
}
- long nRet = onFinish( RET_OK );
- return nRet;
+ return onFinish() ? 1L : 0L;
}
//---------------------------------------------------------------------
@@ -447,10 +474,9 @@ namespace svt
//---------------------------------------------------------------------
sal_Bool OWizardMachine::prepareLeaveCurrentState( CommitPageReason _eReason )
{
- IWizardPage* pCurrentPage = getWizardPage(GetPage(getCurrentState()));
- if ( pCurrentPage )
- return pCurrentPage->commitPage( _eReason );
- return sal_True;
+ IWizardPageController* pController = getPageController( GetPage( getCurrentState() ) );
+ ENSURE_OR_RETURN( pController != NULL, "OWizardMachine::prepareLeaveCurrentState: no controller for the current page!", sal_True );
+ return pController->commitPage( _eReason );
}
//---------------------------------------------------------------------
@@ -664,10 +690,10 @@ namespace svt
}
//---------------------------------------------------------------------
- IWizardPage* OWizardMachine::getWizardPage(TabPage* _pCurrentPage) const
+ IWizardPageController* OWizardMachine::getPageController( TabPage* _pCurrentPage ) const
{
- OWizardPage* pPage = dynamic_cast< OWizardPage* >( _pCurrentPage );
- return pPage;
+ IWizardPageController* pController = dynamic_cast< IWizardPageController* >( _pCurrentPage );
+ return pController;
}
//---------------------------------------------------------------------
@@ -690,11 +716,12 @@ namespace svt
//---------------------------------------------------------------------
void OWizardMachine::updateTravelUI()
{
- OWizardPage* pPage = dynamic_cast< OWizardPage* >( GetPage( getCurrentState() ) );
+ const IWizardPageController* pController = getPageController( GetPage( getCurrentState() ) );
+ OSL_ENSURE( pController != NULL, "RoadmapWizard::updateTravelUI: no controller for the current page!" );
bool bCanAdvance =
- ( !pPage || pPage->canAdvance() ) // the current page allows to advance
- && canAdvance(); // the dialog as a whole allows to advance
+ ( !pController || pController->canAdvance() ) // the current page allows to advance
+ && canAdvance(); // the dialog as a whole allows to advance
enableButtons( WZB_NEXT, bCanAdvance );
}
diff --git a/svtools/source/dialogs/wizardmachine.src b/svtools/source/dialogs/wizardmachine.src
index c3570335773f..9c82ea30071f 100644
--- a/svtools/source/dialogs/wizardmachine.src
+++ b/svtools/source/dialogs/wizardmachine.src
@@ -26,7 +26,7 @@
************************************************************************/
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
String STR_WIZDLG_FINISH
diff --git a/svtools/source/filter.vcl/filter/dlgejpg.hrc b/svtools/source/filter.vcl/filter/dlgejpg.hrc
index 523a1d9553f1..90a3c1d162be 100644
--- a/svtools/source/filter.vcl/filter/dlgejpg.hrc
+++ b/svtools/source/filter.vcl/filter/dlgejpg.hrc
@@ -24,7 +24,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#define BTN_OK 1
#define BTN_CANCEL 1
diff --git a/svtools/source/filter.vcl/filter/dlgepng.hrc b/svtools/source/filter.vcl/filter/dlgepng.hrc
index 4a05771534ab..b3ffaab3ab1e 100644
--- a/svtools/source/filter.vcl/filter/dlgepng.hrc
+++ b/svtools/source/filter.vcl/filter/dlgepng.hrc
@@ -24,7 +24,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#define BTN_OK 1
#define BTN_CANCEL 1
diff --git a/svtools/source/filter.vcl/filter/dlgexpor.hrc b/svtools/source/filter.vcl/filter/dlgexpor.hrc
index 2e5377ce4fcb..69870c9b00b0 100644
--- a/svtools/source/filter.vcl/filter/dlgexpor.hrc
+++ b/svtools/source/filter.vcl/filter/dlgexpor.hrc
@@ -24,7 +24,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#define BTN_OK_PIX 1
#define BTN_CANCEL_PIX 1
diff --git a/svtools/source/filter.vcl/filter/filter.cxx b/svtools/source/filter.vcl/filter/filter.cxx
index 3c99b4a7ffb8..d0066f8a4899 100644
--- a/svtools/source/filter.vcl/filter/filter.cxx
+++ b/svtools/source/filter.vcl/filter/filter.cxx
@@ -988,7 +988,8 @@ namespace { struct Cache : public rtl::Static<ImpFilterLibCache, Cache> {}; }
// -----------------
GraphicFilter::GraphicFilter( sal_Bool bConfig ) :
- bUseConfig ( bConfig )
+ bUseConfig ( bConfig ),
+ nExpGraphHint ( 0 )
{
ImplInit();
}
@@ -1674,6 +1675,7 @@ USHORT GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& rPat
USHORT nFormatCount = GetExportFormatCount();
ResetLastError();
+ nExpGraphHint = 0;
if( nFormat == GRFILTER_FORMAT_DONTKNOW )
{
@@ -1846,8 +1848,10 @@ USHORT GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& rPat
}
else if( aFilterName.EqualsIgnoreCaseAscii( EXP_JPEG ) )
{
- if( !ExportJPEG( rOStm, aGraphic, pFilterData ) )
+ bool bExportedGrayJPEG = false;
+ if( !ExportJPEG( rOStm, aGraphic, pFilterData, &bExportedGrayJPEG ) )
nStatus = GRFILTER_FORMATERROR;
+ nExpGraphHint = bExportedGrayJPEG ? GRFILTER_OUTHINT_GREY : 0;
if( rOStm.GetError() )
nStatus = GRFILTER_IOERROR;
diff --git a/svtools/source/filter.vcl/filter/strings.hrc b/svtools/source/filter.vcl/filter/strings.hrc
index ac162bff09f4..0eea67fb2338 100644
--- a/svtools/source/filter.vcl/filter/strings.hrc
+++ b/svtools/source/filter.vcl/filter/strings.hrc
@@ -24,4 +24,4 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
diff --git a/svtools/source/filter.vcl/jpeg/jpeg.cxx b/svtools/source/filter.vcl/jpeg/jpeg.cxx
index 7fd2e09a82dd..a2de92171af3 100644
--- a/svtools/source/filter.vcl/jpeg/jpeg.cxx
+++ b/svtools/source/filter.vcl/jpeg/jpeg.cxx
@@ -590,10 +590,11 @@ ReadState JPEGReader::Read( Graphic& rGraphic )
// - JPEGWriter -
// --------------
-JPEGWriter::JPEGWriter( SvStream& rStm, const uno::Sequence< beans::PropertyValue >* pFilterData ) :
+JPEGWriter::JPEGWriter( SvStream& rStm, const uno::Sequence< beans::PropertyValue >* pFilterData, bool* pExportWasGrey ) :
rOStm ( rStm ),
pAcc ( NULL ),
- pBuffer ( NULL )
+ pBuffer ( NULL ),
+ pExpWasGrey ( pExportWasGrey )
{
FilterConfigItem aConfigItem( (uno::Sequence< beans::PropertyValue >*)pFilterData );
bGreys = aConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "ColorMode" ) ), 0 ) != 0;
@@ -704,6 +705,9 @@ BOOL JPEGWriter::Write( const Graphic& rGraphic )
bGreys = sal_True;
}
+ if( pExpWasGrey )
+ *pExpWasGrey = bGreys;
+
if( pAcc )
{
bNative = ( pAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB );
@@ -765,8 +769,11 @@ BOOL ImportJPEG( SvStream& rStm, Graphic& rGraphic, void* pCallerData, sal_Int32
// - ExportJPEG -
// --------------
-BOOL ExportJPEG( SvStream& rOStm, const Graphic& rGraphic, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData )
+BOOL ExportJPEG( SvStream& rOStm, const Graphic& rGraphic,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData,
+ bool* pExportWasGrey
+ )
{
- JPEGWriter aJPEGWriter( rOStm, pFilterData );
+ JPEGWriter aJPEGWriter( rOStm, pFilterData, pExportWasGrey );
return aJPEGWriter.Write( rGraphic );
}
diff --git a/svtools/source/filter.vcl/wmf/winmtf.cxx b/svtools/source/filter.vcl/wmf/winmtf.cxx
index 21f6e69c8d9e..bf176015fd77 100644
--- a/svtools/source/filter.vcl/wmf/winmtf.cxx
+++ b/svtools/source/filter.vcl/wmf/winmtf.cxx
@@ -36,7 +36,7 @@
// ------------------------------------------------------------------------
-#define WIN_MTF_MAX_POLYPOLYCOUNT 16
+#define WIN_MTF_MAX_CLIP_DEPTH 16
void WinMtfClipPath::ImpUpdateType()
{
@@ -54,26 +54,28 @@ void WinMtfClipPath::IntersectClipRect( const Rectangle& rRect )
{
if ( !aPolyPoly.Count() )
aPolyPoly = Polygon( rRect );
- else if ( aPolyPoly.Count() < WIN_MTF_MAX_POLYPOLYCOUNT )
+ else if ( nDepth < WIN_MTF_MAX_CLIP_DEPTH )
{
Polygon aPolygon( rRect );
PolyPolygon aIntersection;
PolyPolygon aPolyPolyRect( aPolygon );
aPolyPoly.GetIntersection( aPolyPolyRect, aIntersection );
aPolyPoly = aIntersection;
+ nDepth++;
}
ImpUpdateType();
}
void WinMtfClipPath::ExcludeClipRect( const Rectangle& rRect )
{
- if ( aPolyPoly.Count() && ( aPolyPoly.Count() < WIN_MTF_MAX_POLYPOLYCOUNT ) )
+ if ( aPolyPoly.Count() && ( nDepth < WIN_MTF_MAX_CLIP_DEPTH ) )
{
Polygon aPolygon( rRect );
PolyPolygon aPolyPolyRect( aPolygon );
PolyPolygon aDifference;
aPolyPoly.GetDifference( aPolyPolyRect, aDifference );
aPolyPoly = aDifference;
+ nDepth++;
}
ImpUpdateType();
}
@@ -82,8 +84,10 @@ void WinMtfClipPath::SetClipPath( const PolyPolygon& rPolyPolygon, sal_Int32 nCl
{
if ( !rPolyPolygon.Count() )
aPolyPoly = rPolyPolygon;
- else if ( rPolyPolygon.Count() < WIN_MTF_MAX_POLYPOLYCOUNT )
+ else if ( nDepth < WIN_MTF_MAX_CLIP_DEPTH )
{
+ nDepth++;
+
PolyPolygon aNewClipPath;
// #115345# Watch out for empty aPolyPoly here - conceptually,
diff --git a/svtools/source/filter.vcl/wmf/winmtf.hxx b/svtools/source/filter.vcl/wmf/winmtf.hxx
index beb1f62e22d6..fb4fd2fe0c57 100644
--- a/svtools/source/filter.vcl/wmf/winmtf.hxx
+++ b/svtools/source/filter.vcl/wmf/winmtf.hxx
@@ -314,6 +314,7 @@ class WinMtfClipPath
{
PolyPolygon aPolyPoly;
WinMtfClipPathType eType;
+ sal_Int32 nDepth;
void ImpUpdateType();
@@ -321,7 +322,7 @@ class WinMtfClipPath
sal_Bool bNeedsUpdate;
- WinMtfClipPath(): eType(EMPTY), bNeedsUpdate( sal_False ){};
+ WinMtfClipPath(): eType(EMPTY), nDepth( 0 ), bNeedsUpdate( sal_False ){};
void SetClipPath( const PolyPolygon& rPolyPolygon, sal_Int32 nClippingMode );
void IntersectClipRect( const Rectangle& rRect );
diff --git a/svtools/source/hatchwindow/exports.map b/svtools/source/hatchwindow/exports.map
deleted file mode 100644
index f4ed78b9e970..000000000000
--- a/svtools/source/hatchwindow/exports.map
+++ /dev/null
@@ -1,8 +0,0 @@
-UDK_3_0_0 {
- global:
- component_getImplementationEnvironment;
- component_writeInfo;
- component_getFactory;
- local:
- *;
-};
diff --git a/svtools/source/hatchwindow/makefile.mk b/svtools/source/hatchwindow/makefile.mk
index c5a4dab09762..316e4ab1bfe2 100644
--- a/svtools/source/hatchwindow/makefile.mk
+++ b/svtools/source/hatchwindow/makefile.mk
@@ -55,7 +55,7 @@ SHL1STDLIBS=\
$(CPPULIB) \
$(SALLIB)
-SHL1VERSIONMAP=exports.map
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
diff --git a/svtools/source/inc/accessibletableimp.hxx b/svtools/source/inc/accessibletableimp.hxx
new file mode 100644
index 000000000000..3a01c01567d3
--- /dev/null
+++ b/svtools/source/inc/accessibletableimp.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ * 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_SOURCE_INC_ACCESSIBLETABLEIMP_HXX
+#define SVTOOLS_SOURCE_INC_ACCESSIBLETABLEIMP_HXX
+
+#include "svtaccessiblefactory.hxx"
+
+namespace svt { namespace table
+{
+//........................................................................
+
+
+ class AccessibleTableControl_Impl
+ {
+ 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( );
+
+ };
+
+//........................................................................
+} } // namespace svt::table
+//........................................................................
+
+#endif // SVTOOLS_SOURCE_INC_ACCESSIBLETABLEIMP_HXX
diff --git a/svtools/source/inc/iodlg.hrc b/svtools/source/inc/iodlg.hrc
index 918e47f849b4..e78e3fb687fe 100644
--- a/svtools/source/inc/iodlg.hrc
+++ b/svtools/source/inc/iodlg.hrc
@@ -29,7 +29,7 @@
#define _SVTOOLS_IODLGIMPL_HRC
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
// ModalDialog DLG_SVT_EXPLORERFILE
diff --git a/svtools/source/inc/jpeg.hxx b/svtools/source/inc/jpeg.hxx
index 906bcd9ea2de..9923190c5e21 100644
--- a/svtools/source/inc/jpeg.hxx
+++ b/svtools/source/inc/jpeg.hxx
@@ -99,13 +99,16 @@ class JPEGWriter
sal_Bool bGreys;
sal_Int32 nQuality;
+ bool* pExpWasGrey;
+
com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
public:
void* GetScanline( long nY );
- JPEGWriter( SvStream& rOStm, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData );
+ JPEGWriter( SvStream& rOStm, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData,
+ bool* pExportWasGrey = NULL );
~JPEGWriter() {};
BOOL Write( const Graphic& rGraphic );
@@ -119,6 +122,10 @@ public:
BOOL ImportJPEG( SvStream& rStream, Graphic& rGraphic, void* pCallerData, sal_Int32 nImportFlags );
-BOOL ExportJPEG( SvStream& rStream, const Graphic& rGraphic, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData );
+BOOL ExportJPEG( SvStream& rStream,
+ const Graphic& rGraphic,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData,
+ bool* pExportWasGrey = NULL
+ );
#endif // _JPEG_HXX
diff --git a/svtools/source/java/javaerror.src b/svtools/source/java/javaerror.src
index e16992a3473d..d5990c05a663 100644
--- a/svtools/source/java/javaerror.src
+++ b/svtools/source/java/javaerror.src
@@ -25,7 +25,7 @@
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
WarningBox WARNINGBOX_JAVANOTFOUND
{
diff --git a/svtools/source/java/javainteractionhandler.cxx b/svtools/source/java/javainteractionhandler.cxx
index 3dde9c33cd48..ec34ed07f25d 100644
--- a/svtools/source/java/javainteractionhandler.cxx
+++ b/svtools/source/java/javainteractionhandler.cxx
@@ -30,7 +30,7 @@
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <tools/resid.hxx>
#include <com/sun/star/task/XInteractionContinuation.hpp>
#include <com/sun/star/task/XInteractionAbort.hpp>
diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx
index 9b832a253a74..5beb55d72fb6 100644
--- a/svtools/source/misc/ehdl.cxx
+++ b/svtools/source/misc/ehdl.cxx
@@ -42,7 +42,7 @@
#include <svtools/ehdl.hxx>
#include <svtools/svtdata.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <svtools/sfxecode.hxx>
//=========================================================================
diff --git a/svtools/source/misc/ehdl.src b/svtools/source/misc/ehdl.src
index 1ebb0d80cfd2..2c2fab3e19b5 100644
--- a/svtools/source/misc/ehdl.src
+++ b/svtools/source/misc/ehdl.src
@@ -26,7 +26,7 @@
************************************************************************/
#define __RSC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <svtools/sfxecode.hxx>
// pragma ----------------------------------------------------------------
diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx
index f606e1e2e4b1..3aa0016c225e 100644
--- a/svtools/source/misc/embedhlp.cxx
+++ b/svtools/source/misc/embedhlp.cxx
@@ -30,7 +30,7 @@
#include <svtools/embedhlp.hxx>
#include <svtools/filter.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <svtools/svtdata.hxx>
#include <comphelper/embeddedobjectcontainer.hxx>
diff --git a/svtools/source/misc/helpagent.src b/svtools/source/misc/helpagent.src
index c649c1f17a40..1f2eaaa291a3 100644
--- a/svtools/source/misc/helpagent.src
+++ b/svtools/source/misc/helpagent.src
@@ -26,7 +26,7 @@
************************************************************************/
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
Bitmap BMP_HELP_AGENT_IMAGE
diff --git a/svtools/source/misc/helpagentwindow.cxx b/svtools/source/misc/helpagentwindow.cxx
index 8db5fcc88789..a909c2f77ca9 100644
--- a/svtools/source/misc/helpagentwindow.cxx
+++ b/svtools/source/misc/helpagentwindow.cxx
@@ -32,7 +32,7 @@
#include <vcl/button.hxx>
#include <vcl/bitmap.hxx>
#include <svtools/svtdata.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <svtools/helpid.hrc>
#define WB_AGENT_STYLE 0
diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx
index 8fb0706901de..4dbd132b9dc8 100644
--- a/svtools/source/misc/imagemgr.cxx
+++ b/svtools/source/misc/imagemgr.cxx
@@ -49,7 +49,7 @@
#include <tools/rcid.h>
#include <rtl/logfile.hxx>
#include <unotools/configmgr.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <svtools/imagemgr.hrc>
#include <svtools/svtdata.hxx>
#include <vos/mutex.hxx>
diff --git a/svtools/source/misc/imagemgr.src b/svtools/source/misc/imagemgr.src
index b12cd417ce28..03e68b3b30b7 100644
--- a/svtools/source/misc/imagemgr.src
+++ b/svtools/source/misc/imagemgr.src
@@ -26,7 +26,7 @@
************************************************************************/
// includes ******************************************************************
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <svtools/imagemgr.hrc>
// images ********************************************************************
diff --git a/svtools/source/misc/imageresourceaccess.cxx b/svtools/source/misc/imageresourceaccess.cxx
index 3a906bb63501..a4fd7e372880 100644
--- a/svtools/source/misc/imageresourceaccess.cxx
+++ b/svtools/source/misc/imageresourceaccess.cxx
@@ -46,8 +46,6 @@ namespace svt
{
//........................................................................
-#define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
-
using namespace ::utl;
using namespace ::comphelper;
using namespace ::com::sun::star::io;
@@ -139,8 +137,14 @@ namespace svt
//--------------------------------------------------------------------
bool GraphicAccess::isSupportedURL( const ::rtl::OUString& _rURL )
{
- ::rtl::OUString sIndicator( RTL_CONSTASCII_USTRINGPARAM( "private:resource/" ) );
- return ( ( _rURL.indexOf( sIndicator ) == 0 ) || ( _rURL.compareToAscii( GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( GRAPHOBJ_URLPREFIX ) ) == 0 ) );
+ if ( ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:resource/" ) ) == 0 )
+ || ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:graphicrepository/" ) ) == 0 )
+ || ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:standardimage/" ) ) == 0 )
+ || ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "vnd.sun.star.GraphicObject:" ) ) == 0 )
+ || ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "vnd.sun.star.extension://" ) ) == 0 )
+ )
+ return true;
+ return false;
}
//--------------------------------------------------------------------
diff --git a/svtools/source/misc/langtab.cxx b/svtools/source/misc/langtab.cxx
index b656dbf501c4..d1ff94572a99 100644
--- a/svtools/source/misc/langtab.cxx
+++ b/svtools/source/misc/langtab.cxx
@@ -39,7 +39,7 @@
#include <i18npool/lang.h>
#include <i18npool/mslangid.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <svtools/svtdata.hxx>
#include <svtools/langtab.hxx>
#include <unotools/syslocale.hxx>
diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src
index 39f9362e3940..067eb601a5af 100644
--- a/svtools/source/misc/langtab.src
+++ b/svtools/source/misc/langtab.src
@@ -26,7 +26,7 @@
************************************************************************/
// include ---------------------------------------------------------------
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#define RSC_RESOURCE_USAGE 1
#include <i18npool/lang.h>
@@ -138,7 +138,7 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE
< "Lithuanian" ; LANGUAGE_LITHUANIAN ; > ;
< "Macedonian" ; LANGUAGE_MACEDONIAN ; > ;
< "Malay (Malaysia)" ; LANGUAGE_MALAY_MALAYSIA ; > ;
- < "Malay (Brunei Darusalam)" ; LANGUAGE_MALAY_BRUNEI_DARUSSALAM ; > ;
+ < "Malay (Brunei Darussalam)" ; LANGUAGE_MALAY_BRUNEI_DARUSSALAM ; > ;
< "Malayalam" ; LANGUAGE_MALAYALAM ; > ;
< "Manipuri" ; LANGUAGE_MANIPURI ; > ;
< "Marathi" ; LANGUAGE_MARATHI ; > ;
@@ -319,6 +319,10 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE
< "Sardinian, Logudorese" ; LANGUAGE_USER_SARDINIAN_LOGUDORESE ; > ;
< "Sardinian, Sassarese" ; LANGUAGE_USER_SARDINIAN_SASSARESE ; > ;
< "Bafia" ; LANGUAGE_USER_BAFIA ; > ;
+ < "Gikuyu" ; LANGUAGE_USER_GIKUYU ; > ;
+ < "Yoruba" ; LANGUAGE_YORUBA ; > ;
+ < "Rusyn (Ukraine)" ; LANGUAGE_USER_RUSYN_UKRAINE ; > ;
+ < "Rusyn (Slovakia)" ; LANGUAGE_USER_RUSYN_SLOVAKIA ; > ;
};
};
diff --git a/svtools/source/misc/makefile.mk b/svtools/source/misc/makefile.mk
index 64bb38efa13b..266dad976e4b 100644..100755
--- a/svtools/source/misc/makefile.mk
+++ b/svtools/source/misc/makefile.mk
@@ -72,7 +72,8 @@ SLOFILES=\
$(SLO)$/transfer.obj \
$(SLO)$/transfer2.obj \
$(SLO)$/unitconv.obj \
- $(SLO)$/wallitem.obj
+ $(SLO)$/wallitem.obj \
+ $(SLO)$/xwindowitem.obj
# --- Targets -------------------------------------------------------
diff --git a/svtools/source/misc/svtaccessiblefactory.cxx b/svtools/source/misc/svtaccessiblefactory.cxx
index 1a8284642698..b20863db3208 100644..100755
--- a/svtools/source/misc/svtaccessiblefactory.cxx
+++ b/svtools/source/misc/svtaccessiblefactory.cxx
@@ -209,6 +209,24 @@ namespace svt
{
return NULL;
}
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleToolPanelDeck(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*i_rAccessibleParent*/,
+ ::svt::ToolPanelDeck& /*i_rPanelDeck*/
+ )
+ {
+ return NULL;
+ }
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleToolPanelTabBar(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*i_rAccessibleParent*/,
+ ::svt::IToolPanelDeck& /*i_rPanelDeck*/,
+ ::svt::PanelTabBar& /*i_rTabBar*/
+ )
+ {
+ return NULL;
+ }
};
//----------------------------------------------------------------
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index 1be4928d96a3..4e245ca50520 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -42,6 +42,7 @@
#include <vos/mutex.hxx>
#include <rtl/memory.h>
#include <rtl/uuid.h>
+#include <rtl/uri.hxx>
#include <tools/debug.hxx>
#include <tools/urlobj.hxx>
#include <unotools/ucbstreamhelper.hxx>
@@ -56,6 +57,7 @@
#include <comphelper/processfactory.hxx>
#include <sot/filelist.hxx>
#include <cppuhelper/implbase1.hxx>
+
#include <comphelper/seqstream.hxx>
#include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp>
#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
@@ -63,8 +65,9 @@
#include <com/sun/star/datatransfer/XMimeContentType.hpp>
#include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
+
#include "svl/urlbmk.hxx"
-#include <svtools/inetimg.hxx>
+#include "inetimg.hxx"
#include <svtools/wmf.hxx>
#include <svtools/imap.hxx>
#include <svtools/transfer.hxx>
@@ -144,6 +147,10 @@ SvStream& operator<<( SvStream& rOStm, const TransferableObjectDescriptor& rObjD
}
// -----------------------------------------------------------------------------
+// the reading of the parameter is done using the special service ::com::sun::star::datatransfer::MimeContentType,
+// a similar approach should be implemented for creation of the mimetype string;
+// for now the set of acceptable characters has to be hardcoded, in future it should be part of the service that creates the mimetype
+const ::rtl::OUString aQuotedParamChars = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "()<>@,;:\\\"/[]?=!#$%&'*+-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz{|}~. " ) );
static ::rtl::OUString ImplGetParameterString( const TransferableObjectDescriptor& rObjDesc )
{
@@ -167,8 +174,21 @@ static ::rtl::OUString ImplGetParameterString( const TransferableObjectDescripto
if( rObjDesc.maDisplayName.Len() )
{
+ // the display name might contain unacceptable characters, encode all of them
+ // this seems to be the only parameter currently that might contain such characters
+ sal_Bool pToAccept[128];
+ for ( sal_Int32 nBInd = 0; nBInd < 128; nBInd++ )
+ pToAccept[nBInd] = sal_False;
+
+ for ( sal_Int32 nInd = 0; nInd < aQuotedParamChars.getLength(); nInd++ )
+ {
+ sal_Unicode nChar = aQuotedParamChars.getStr()[nInd];
+ if ( nChar < 128 )
+ pToAccept[nChar] = sal_True;
+ }
+
aParams += ::rtl::OUString::createFromAscii( ";displayname=\"" );
- aParams += rObjDesc.maDisplayName;
+ aParams += ::rtl::Uri::encode( rObjDesc.maDisplayName, pToAccept, rtl_UriEncodeIgnoreEscapes, RTL_TEXTENCODING_UTF8 );
aParams += aChar;
}
@@ -238,7 +258,9 @@ static void ImplSetParameterString( TransferableObjectDescriptor& rObjDesc, cons
if( xMimeType->hasParameter( aDisplayNameString ) )
{
- rObjDesc.maDisplayName = xMimeType->getParameterValue( aDisplayNameString );
+ // the display name might contain unacceptable characters, in this case they should be encoded
+ // this seems to be the only parameter currently that might contain such characters
+ rObjDesc.maDisplayName = ::rtl::Uri::decode( xMimeType->getParameterValue( aDisplayNameString ), rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
}
if( xMimeType->hasParameter( aViewAspectString ) )
diff --git a/svtools/source/misc/undo.src b/svtools/source/misc/undo.src
index bdfb1259b5d3..6f341741b112 100644
--- a/svtools/source/misc/undo.src
+++ b/svtools/source/misc/undo.src
@@ -27,7 +27,7 @@
// include ------------------------------------------------------------------
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
String STR_UNDO
{
diff --git a/svtools/source/misc/xwindowitem.cxx b/svtools/source/misc/xwindowitem.cxx
new file mode 100755
index 000000000000..a382d8293617
--- /dev/null
+++ b/svtools/source/misc/xwindowitem.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+
+#include "svtools/xwindowitem.hxx"
+
+#include <vcl/window.hxx>
+
+
+using namespace ::com::sun::star;
+
+//////////////////////////////////////////////////////////////////////
+
+TYPEINIT1_FACTORY( XWindowItem, SfxPoolItem, new XWindowItem );
+
+
+XWindowItem::XWindowItem() :
+ SfxPoolItem()
+{
+}
+
+
+XWindowItem::XWindowItem( USHORT nWhichId, Window * pWin ) :
+ SfxPoolItem( nWhichId )
+{
+ if (pWin)
+ {
+ m_xWin = uno::Reference< awt::XWindow >( pWin->GetComponentInterface(), uno::UNO_QUERY );
+ // the assertion can't possibly fails since VCLXWindow implements XWindow...
+ DBG_ASSERT( m_xWin.is(), "failed to get XWindow" );
+ }
+}
+
+
+XWindowItem::XWindowItem( USHORT nWhichId, uno::Reference< awt::XWindow > & rxWin ) :
+ SfxPoolItem( nWhichId ),
+ m_xWin( rxWin )
+{
+}
+
+
+XWindowItem::XWindowItem( const XWindowItem &rItem ) :
+ SfxPoolItem( Which() ),
+ m_xWin( rItem.m_xWin )
+{
+}
+
+
+XWindowItem::~XWindowItem()
+{
+}
+
+
+SfxPoolItem * XWindowItem::Clone( SfxItemPool* /*pPool*/ ) const
+{
+ return new XWindowItem( *this );
+}
+
+
+int XWindowItem::operator == ( const SfxPoolItem & rAttr ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
+
+ const XWindowItem * pItem = dynamic_cast< const XWindowItem * >(&rAttr);
+ return pItem ? m_xWin == pItem->m_xWin : 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+
+
diff --git a/svtools/source/productregistration/exports.map b/svtools/source/productregistration/exports.map
deleted file mode 100644
index f4ed78b9e970..000000000000
--- a/svtools/source/productregistration/exports.map
+++ /dev/null
@@ -1,8 +0,0 @@
-UDK_3_0_0 {
- global:
- component_getImplementationEnvironment;
- component_writeInfo;
- component_getFactory;
- local:
- *;
-};
diff --git a/svtools/source/productregistration/makefile.mk b/svtools/source/productregistration/makefile.mk
index 0b970b651059..a26e8feca753 100644
--- a/svtools/source/productregistration/makefile.mk
+++ b/svtools/source/productregistration/makefile.mk
@@ -59,7 +59,7 @@ SHL1STDLIBS=\
$(CPPULIB) \
$(SALLIB)
-SHL1VERSIONMAP=exports.map
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
diff --git a/svtools/source/productregistration/productregistration.cxx b/svtools/source/productregistration/productregistration.cxx
index 4a5db9cf47c4..39629f5c3f77 100644
--- a/svtools/source/productregistration/productregistration.cxx
+++ b/svtools/source/productregistration/productregistration.cxx
@@ -32,7 +32,7 @@
#include "unotools/regoptions.hxx"
#include "registrationdlg.hxx"
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
#include "cppuhelper/factory.hxx"
#include <cppuhelper/implbase1.hxx>
diff --git a/svtools/source/productregistration/registrationdlg.cxx b/svtools/source/productregistration/registrationdlg.cxx
index 93b7e5c88462..460cedb060d1 100644
--- a/svtools/source/productregistration/registrationdlg.cxx
+++ b/svtools/source/productregistration/registrationdlg.cxx
@@ -32,7 +32,7 @@
#if 0 /* @@@ */
#include <svtools/svtdata.hxx>
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
#endif /* @@@ */
diff --git a/svtools/source/productregistration/registrationdlg.src b/svtools/source/productregistration/registrationdlg.src
index e0598ab05e60..c4cdcbcbe3ec 100644
--- a/svtools/source/productregistration/registrationdlg.src
+++ b/svtools/source/productregistration/registrationdlg.src
@@ -29,7 +29,7 @@
#include "registrationdlg.hrc"
#endif
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
#ifndef _SVT_HELPID_HRC
#include <svtools/helpid.hrc>
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index ba24931983cd..28df35a4bb2a 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -2118,11 +2118,7 @@ enum eHtmlMetas {
};
// <META NAME=xxx>
-#ifdef __MINGW32__ // for runtime pseudo reloc
-static HTMLOptionEnum aHTMLMetaNameTable[] =
-#else
static HTMLOptionEnum __READONLY_DATA aHTMLMetaNameTable[] =
-#endif
{
{ OOO_STRING_SVTOOLS_HTML_META_author, HTML_META_AUTHOR },
{ OOO_STRING_SVTOOLS_HTML_META_changed, HTML_META_CHANGED },
diff --git a/svtools/source/table/defaultinputhandler.cxx b/svtools/source/table/defaultinputhandler.cxx
index b11357db95d1..ad8f7a7562d3 100644
--- a/svtools/source/table/defaultinputhandler.cxx
+++ b/svtools/source/table/defaultinputhandler.cxx
@@ -50,6 +50,7 @@ namespace svt { namespace table
//--------------------------------------------------------------------
DefaultInputHandler::DefaultInputHandler()
:m_pImpl( new DefaultInputHandler_Impl )
+ ,m_bResize(false)
{
}
@@ -62,8 +63,12 @@ namespace svt { namespace table
//--------------------------------------------------------------------
bool DefaultInputHandler::MouseMove( IAbstractTableControl& _rControl, const MouseEvent& _rMEvt )
{
- (void)_rControl;
- (void)_rMEvt;
+ Point aPoint = _rMEvt.GetPosPixel();
+ if(m_bResize)
+ {
+ _rControl.resizeColumn(aPoint);
+ return true;
+ }
return false;
}
@@ -72,41 +77,60 @@ namespace svt { namespace table
{
bool bHandled = false;
Point aPoint = _rMEvt.GetPosPixel();
- if(_rControl.isClickInVisibleArea(aPoint))
+ 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)
{
- LoseFocus(_rControl);
_rControl.setCursorAtCurrentCell(aPoint);
bHandled = true;
}
else
{
- bHandled = _rControl.getSelEngine()->SelMouseButtonDown(_rMEvt);
+ if(!_rControl.isRowSelected(nRow))
+ bHandled = _rControl.getSelEngine()->SelMouseButtonDown(_rMEvt);
+ else
+ bHandled = true;
}
}
return bHandled;
}
-
//--------------------------------------------------------------------
bool DefaultInputHandler::MouseButtonUp( IAbstractTableControl& _rControl, const MouseEvent& _rMEvt )
{
bool bHandled = false;
Point aPoint = _rMEvt.GetPosPixel();
- if(_rControl.isClickInVisibleArea(aPoint))
+ if(_rControl.getCurrentRow(aPoint) >= 0)
{
- if(_rControl.getSelEngine()->GetSelectionMode() == NO_SELECTION)
+ if(m_bResize)
+ {
+ m_bResize = _rControl.endResizeColumn(aPoint);
+ bHandled = true;
+ }
+ else if(_rControl.getSelEngine()->GetSelectionMode() == NO_SELECTION)
{
- GetFocus(_rControl);
- _rControl.setCursorAtCurrentCell(aPoint);
bHandled = true;
}
else
+ {
bHandled = _rControl.getSelEngine()->SelMouseButtonUp(_rMEvt);
+ }
+ }
+ else
+ {
+ if(m_bResize)
+ {
+ m_bResize = _rControl.endResizeColumn(aPoint);
+ bHandled = true;
+ }
}
return bHandled;
}
-
//--------------------------------------------------------------------
bool DefaultInputHandler::KeyInput( IAbstractTableControl& _rControl, const KeyEvent& rKEvt )
{
@@ -134,11 +158,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 }
};
@@ -205,7 +229,6 @@ namespace svt { namespace table
// TODO
return false;
}
-
//........................................................................
} } // namespace svt::table
//........................................................................
diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx
index ada2e463c8af..8e5bd181a583 100644
--- a/svtools/source/table/gridtablerenderer.cxx
+++ b/svtools/source/table/gridtablerenderer.cxx
@@ -31,6 +31,7 @@
#include <tools/debug.hxx>
#include <vcl/window.hxx>
+#include <vcl/image.hxx>
//........................................................................
namespace svt { namespace table
@@ -78,15 +79,15 @@ namespace svt { namespace table
OSL_PRECOND( _bIsColHeaderArea || _bIsRowHeaderArea,
"GridTableRenderer::PaintHeaderArea: invalid area flags!" );
- // fill the rows with alternating background colors
- _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR );
-
- _rDevice.SetLineColor();
- _rDevice.SetFillColor( _rStyle.GetDialogColor() );
+ _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.DrawRect( _rArea );
-
// delimiter lines at bottom/right
- _rDevice.SetLineColor( _rStyle.GetDialogTextColor() );
_rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
_rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
@@ -99,31 +100,41 @@ namespace svt { namespace table
void GridTableRenderer::PaintColumnHeader( ColPos _nCol, bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle )
{
- _rDevice.Push( PUSH_LINECOLOR );
-
- _rDevice.SetLineColor( _rStyle.GetDialogTextColor() );
- _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
+ _rDevice.Push( PUSH_LINECOLOR);
+ _rDevice.SetLineColor(_rStyle.GetSeparatorColor());
+ _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight());
String sHeaderText;
-
PColumnModel pColumn = m_pImpl->rModel.getColumnModel( _nCol );
DBG_ASSERT( !!pColumn, "GridTableRenderer::PaintColumnHeader: invalid column model object!" );
if ( !!pColumn )
sHeaderText = pColumn->getName();
- Color aRowBackground = _rStyle.GetFieldColor();
- if ( _bSelected )
- {
- aRowBackground = COL_BLUE;
- }
- _rDevice.DrawText( _rArea, sHeaderText, TEXT_DRAW_LEFT | TEXT_DRAW_TOP );
+ if(m_pImpl->rModel.getTextColor() != 0x000000)
+ _rDevice.SetTextColor(m_pImpl->rModel.getTextColor());
+ else
+ _rDevice.SetTextColor(_rStyle.GetFieldTextColor());
+ ULONG nHorFlag = TEXT_DRAW_LEFT;
+ 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);
_rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
_rDevice.Pop();
(void)_bActive;
// no special painting for the active column at the moment
- //(void)_bSelected;
- // TODO: selection not yet implemented
+ (void)_bSelected;
+ //selection for column header not yet implemented
}
//--------------------------------------------------------------------
@@ -133,86 +144,222 @@ namespace svt { namespace table
// remember the row for subsequent calls to the other ->ITableRenderer methods
m_pImpl->nCurrentRow = _nRow;
- // fill the rows with alternating background colors
- _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR );
-
- _rDevice.SetLineColor();
-
- Color aRowBackground = _rStyle.GetFieldColor();
-
+ _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 aSelected(_rStyle.GetHighlightColor());
+ aRowBackground = aSelected;
+ if(line == 0xFFFFFF)
+ _rDevice.SetLineColor(aRowBackground);
+ else
+ _rDevice.SetLineColor(line);
+ }
+ //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)
+ {
+ aRowBackground = aRowBackground2;
+ if(line == 0xFFFFFF)
+ _rDevice.SetLineColor(aRowBackground);
+ else
+ _rDevice.SetLineColor(line);
+ }
+ //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);
+ }
+ }
_rDevice.SetFillColor( aRowBackground );
-
_rDevice.DrawRect( _rRowArea );
- // TODO: active? selected?
+ // TODO: active?
_rDevice.Pop();
- (void) _bSelected;
(void)_bActive;
-
- // no special painting for the active row at the moment
-
- //(void)_bSelected;
- // TODO: selection not yet implemented
}
//--------------------------------------------------------------------
void GridTableRenderer::PaintRowHeader( bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea,
const StyleSettings& _rStyle, rtl::OUString& _rText )
{
- _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR );
-
- _rDevice.SetLineColor( _rStyle.GetDialogTextColor() );
+ _rDevice.Push( PUSH_LINECOLOR);
+ _rDevice.SetLineColor(_rStyle.GetSeparatorColor());
_rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
- _rDevice.DrawText( _rArea, _rText, TEXT_DRAW_LEFT);
+ if(m_pImpl->rModel.getTextColor() != 0x000000)
+ _rDevice.SetTextColor(m_pImpl->rModel.getTextColor());
+ else
+ _rDevice.SetTextColor(_rStyle.GetFieldTextColor());
+ ULONG nHorFlag = TEXT_DRAW_LEFT;
+ 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);
// TODO: active? selected?
(void)_bActive;
(void)_bSelected;
-
+ //at the moment no special paint for selected row header
_rDevice.Pop();
}
//--------------------------------------------------------------------
- void GridTableRenderer::PaintCell( ColPos _nColumn, bool _bSelected, bool _bActive,
- OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, rtl::OUString& _rText )
+ void GridTableRenderer::PaintCellImage( ColPos _nColumn, bool _bSelected, bool _bActive,
+ OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, Image* _pCellData )
{
- _rDevice.Push( PUSH_LINECOLOR );
-
- // draw the grid
- _rDevice.SetLineColor( COL_LIGHTGRAY );
- // TODO: the LIGHTGRAY should probably be a property/setting
+ _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)
+ {
+ if(line == 0xFFFFFF)
+ _rDevice.SetLineColor(_rStyle.GetHighlightColor());
+ else
+ _rDevice.SetLineColor(line);
+ }
+ //else set line color to the color of row background
+ else
+ {
+ 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
+ {
+ //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);
+ }
+ }
_rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
- _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
+ 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())
{
- // TODO: remove those temporary place holders
- Rectangle aRect( _rArea );
- ++aRect.Left(); --aRect.Right();
- ++aRect.Top(); --aRect.Bottom();
+ 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();
+ }
+ 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
+ }
- String sText;
- if(_bSelected)
+ //--------------------------------------------------------------------
+ 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)
+ {
+ if(line == 0xFFFFFF)
+ _rDevice.SetLineColor(_rStyle.GetHighlightColor());
+ else
+ _rDevice.SetLineColor(line);
+ }
+ //else set line color to the color of row background
+ else
+ {
+ if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2)
{
- Color aRed(COL_BLUE);
- _rDevice.SetFillColor( aRed );
- _rDevice.SetTextColor(COL_WHITE);
+ 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);
}
- _rDevice.DrawRect( _rArea );
- (void)_nColumn;
- _rDevice.DrawText( aRect, _rText, TEXT_DRAW_LEFT | TEXT_DRAW_TOP);
}
+ _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
+
+ Rectangle aRect( _rArea );
+ ++aRect.Left(); --aRect.Right();
+ aRect.Top(); aRect.Bottom();
if(_bSelected)
- {
- _rDevice.SetFillColor( _rStyle.GetFieldColor() );
- _rDevice.SetTextColor(COL_BLACK);
- }
+ _rDevice.SetTextColor(_rStyle.GetHighlightTextColor());
+ else if(m_pImpl->rModel.getTextColor() != 0x000000)
+ _rDevice.SetTextColor(m_pImpl->rModel.getTextColor());
+ else
+ _rDevice.SetTextColor(_rStyle.GetFieldTextColor());
+ ULONG nHorFlag = TEXT_DRAW_LEFT;
+ 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);
_rDevice.Pop();
-
(void)_bActive;
-// // no special painting for the active cell at the moment
- (void)_rStyle;
-// // TODO: do we need this?
+ // no special painting for the active cell at the moment
}
//--------------------------------------------------------------------
@@ -224,7 +371,7 @@ namespace svt { namespace table
//--------------------------------------------------------------------
void GridTableRenderer::HideCellCursor( Window& _rView, const Rectangle& _rCursorRect)
{
- (void)_rCursorRect;
+ (void)_rCursorRect;
_rView.HideFocus();
}
diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx
index 71c753d3ea86..33c80e642118 100644
--- a/svtools/source/table/tablecontrol.cxx
+++ b/svtools/source/table/tablecontrol.cxx
@@ -30,6 +30,7 @@
#include "svtools/table/tablecontrol.hxx"
#include "tablegeometry.hxx"
#include "tablecontrol_impl.hxx"
+#include "accessibletableimp.hxx"
#include "svtools/table/tabledatawindow.hxx"
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
@@ -68,15 +69,25 @@ namespace svt { namespace table
TableControl::TableControl( Window* _pParent, WinBits _nStyle )
:Control( _pParent, _nStyle )
,m_pImpl( new TableControl_Impl( *this ) )
+ ,m_bSelectionChanged(false)
+ ,m_bTooltip(false)
{
- m_pImpl->getDataWindow()->SetMouseButtonDownHdl( LINK( this, TableControl, ImplMouseButtonDownHdl ) );
- m_pImpl->getDataWindow()->SetMouseButtonUpHdl( LINK( this, TableControl, ImplMouseButtonUpHdl ) );
+ 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());
+
+ // by default, use the background as determined by the style settings
+ const Color aWindowColor( GetSettings().GetStyleSettings().GetFieldColor() );
+ SetBackground( Wallpaper( aWindowColor ) );
+ SetFillColor( aWindowColor );
}
//--------------------------------------------------------------------
TableControl::~TableControl()
{
+ ImplCallEventListeners( VCLEVENT_OBJECT_DYING );
DELETEZ( m_pImpl );
if ( m_pAccessTable->m_pAccessible )
{
@@ -106,7 +117,48 @@ namespace svt { namespace table
{
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 );
+
+ // forward certain settings to the data window
+ switch ( i_nStateChange )
+ {
+ case STATE_CHANGE_CONTROLBACKGROUND:
+ if ( IsControlBackground() )
+ getDataWindow()->SetControlBackground( GetControlBackground() );
+ else
+ getDataWindow()->SetControlBackground();
+ break;
+
+ case STATE_CHANGE_CONTROLFOREGROUND:
+ if ( IsControlForeground() )
+ getDataWindow()->SetControlForeground( GetControlForeground() );
+ else
+ getDataWindow()->SetControlForeground();
+ break;
+
+ case STATE_CHANGE_CONTROLFONT:
+ if ( IsControlFont() )
+ getDataWindow()->SetControlFont( GetControlFont() );
+ else
+ getDataWindow()->SetControlFont();
+ break;
+ }
}
+
//--------------------------------------------------------------------
void TableControl::Resize()
{
@@ -162,13 +214,26 @@ namespace svt { namespace table
return m_pImpl->goTo( _nColPos, _nRowPos );
}
//--------------------------------------------------------------------
- void TableControl::InvalidateDataWindow(RowPos _nRowStart, bool _bRemoved)
+ void TableControl::clearSelection()
+ {
+ m_pImpl->clearSelection();
+ }
+ //--------------------------------------------------------------------
+ void TableControl::InvalidateDataWindow(RowPos _nRowStart, RowPos _nRowEnd, bool _bRemoved)
{
Rectangle _rRect;
if(_bRemoved)
- return m_pImpl->invalidateRows(_nRowStart, _rRect);
+ m_pImpl->invalidateRows();
else
- return m_pImpl->invalidateRow(_nRowStart, _rRect);
+ {
+ if(m_bSelectionChanged)
+ {
+ m_pImpl->invalidateSelectedRegion(_nRowStart, _nRowEnd, _rRect);
+ m_bSelectionChanged = false;
+ }
+ else
+ m_pImpl->invalidateRow(_nRowStart, _rRect);
+ }
}
//--------------------------------------------------------------------
std::vector<sal_Int32>& TableControl::GetSelectedRows()
@@ -176,7 +241,7 @@ namespace svt { namespace table
return m_pImpl->getSelectedRows();
}
//--------------------------------------------------------------------
- void TableControl::removeSelectedRow(RowPos _nRowPos)
+ void TableControl::RemoveSelectedRow(RowPos _nRowPos)
{
m_pImpl->removeSelectedRow(_nRowPos);
}
@@ -187,20 +252,6 @@ namespace svt { namespace table
return m_pImpl->getCurrentRow( rPoint );
}
- //--------------------------------------------------------------------
-
- 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;
- }
-
SelectionEngine* TableControl::getSelEngine()
{
return m_pImpl->getSelEngine();
@@ -240,6 +291,7 @@ namespace svt { namespace table
::rtl::OUString TableControl::GetAccessibleObjectName( AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const
{
::rtl::OUString aRetText;
+ //Window* pWin;
switch( eObjType )
{
case TCTYPE_GRIDCONTROL:
@@ -255,7 +307,7 @@ namespace svt { namespace table
aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnHeaderBar" ) );
break;
case TCTYPE_TABLECELL:
- aRetText = GetCellContent(_nRow, _nCol);
+ aRetText = GetAccessibleCellText(_nRow, _nCol);
break;
case TCTYPE_ROWHEADERCELL:
aRetText = GetRowName(_nRow);
@@ -328,20 +380,23 @@ namespace svt { namespace table
// -----------------------------------------------------------------------------
-::rtl::OUString TableControl::GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const
+::com::sun::star::uno::Any TableControl::GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const
{
- ::rtl::OUString cellContent = ::rtl::OUString::createFromAscii("");
- std::vector<std::vector<rtl::OUString> >& aTableContent = GetModel()->getCellContent();
+ ::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)
- {
- std::vector<rtl::OUString>& aRowContent = aTableContent[_nRowPos];
- if(&aRowContent)
- cellContent = aRowContent[_nColPos];
- }
+ 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
@@ -374,10 +429,6 @@ void TableControl::FillAccessibleStateSet(
break;
case TCTYPE_TABLECELL:
{
- //sal_Int32 nRow = GetCurRow();
- //sal_uInt16 nColumn = GetCurColumnId();
- //if ( IsFieldVisible(nRow,nColumn) )
- // rStateSet.AddState( AccessibleStateType::VISIBLE );
rStateSet.AddState( AccessibleStateType::TRANSIENT );
rStateSet.AddState( AccessibleStateType::SELECTABLE);
if( GetSelectedRowCount()>0)
@@ -394,7 +445,7 @@ void TableControl::FillAccessibleStateSet(
}
}
-Rectangle TableControl::GetWindowExtentsRelative( Window *pRelativeWindow )
+Rectangle TableControl::GetWindowExtentsRelative( Window *pRelativeWindow ) const
{
return Control::GetWindowExtentsRelative( pRelativeWindow );
}
@@ -516,25 +567,62 @@ void TableControl::commitGridControlEvent( sal_Int16 _nEventId, const Any& _rNew
Rectangle TableControl::calcHeaderRect(sal_Bool _bIsColumnBar,BOOL _bOnScreen)
{
(void)_bOnScreen;
- Rectangle aRectTable, aRectTableWithHeaders;
- m_pImpl->impl_getAllVisibleDataCellArea(aRectTable);
- m_pImpl->impl_getAllVisibleCellsArea(aRectTableWithHeaders);
- Size aSizeTable(aRectTable.GetSize());
- Size aSizeTableWithHeaders(aRectTableWithHeaders.GetSize());
- if(_bIsColumnBar)
- return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width()-aSizeTable.Width(), aSizeTableWithHeaders.Height()));
- else
- return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width(), aSizeTableWithHeaders.Height()-aSizeTable.Height()));
+ return m_pImpl->calcHeaderRect(_bIsColumnBar);
}
// -----------------------------------------------------------------------------
Rectangle TableControl::calcTableRect(BOOL _bOnScreen)
{
(void)_bOnScreen;
- Rectangle aRect;
- m_pImpl->impl_getAllVisibleDataCellArea(aRect);
- return aRect;
+ 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 );
}
-
//........................................................................
}} // namespace svt::table
//........................................................................
diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx
index aacfc28d05be..90bc4899209b 100644
--- a/svtools/source/table/tablecontrol_impl.cxx
+++ b/svtools/source/table/tablecontrol_impl.cxx
@@ -33,9 +33,13 @@
#include "tablecontrol_impl.hxx"
#include "tablegeometry.hxx"
#include "svtools/table/tabledatawindow.hxx"
-
+#include <com/sun/star/awt/XControl.hpp>
#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 <functional>
#include <stdlib.h>
@@ -98,22 +102,22 @@ namespace svt { namespace table
{
return false;
}
- virtual void setRowHeaders(bool _bRowHeaders)
+ virtual void setRowHeaders(bool _bRowHeaders)
{
(void)_bRowHeaders;
}
- virtual void setColumnHeaders(bool _bColumnHeaders)
- {
- (void)_bColumnHeaders;
- }
- void setColumnCount(TableSize _nColCount)
- {
- (void) _nColCount;
- }
- void setRowCount(TableSize _nRowCount)
+ virtual void setColumnHeaders(bool _bColumnHeaders)
{
- (void)_nRowCount;
+ (void)_bColumnHeaders;
}
+ void setColumnCount(TableSize _nColCount)
+ {
+ (void) _nColCount;
+ }
+ void setRowCount(TableSize _nRowCount)
+ {
+ (void)_nRowCount;
+ }
virtual bool isCellEditable( ColPos col, RowPos row ) const
{
(void)col;
@@ -166,39 +170,83 @@ namespace svt { namespace table
{
return 0;
}
- virtual ScrollbarVisibility getVerticalScrollbarVisibility(int overAllHeight, int actHeight) const
- {
- (void)overAllHeight;
- (void)actHeight;
- return ScrollbarShowNever;
- }
- virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const
- {
- (void)overAllWidth;
- (void)actWidth;
- return ScrollbarShowNever;
- }
- virtual void setCellContent(std::vector<std::vector<rtl::OUString> > pCellEntryType)
- {
- (void)pCellEntryType;
- }
- virtual std::vector<std::vector<rtl::OUString> >& getCellContent()
+ virtual ScrollbarVisibility getVerticalScrollbarVisibility(int , int ) const
{
- return *( new std::vector<std::vector<rtl::OUString> >);
+ return ScrollbarShowNever;
}
- virtual void setRowHeaderName(std::vector<rtl::OUString> pCellEntryType)
+ virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int , int ) const
{
- (void)pCellEntryType;
+ return ScrollbarShowNever;
}
- virtual std::vector<rtl::OUString>& getRowHeaderName()
- {
- aRowHeaderNames.clear();
- aRowHeaderNames.push_back(rtl::OUString::createFromAscii(""));
- return aRowHeaderNames;
- }
-
- private:
- std::vector<rtl::OUString> aRowHeaderNames;
+ 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;
};
@@ -222,8 +270,8 @@ namespace svt { namespace table
:m_rTable( _rTable )
,m_nSuspendFlags( _nSuspendFlags )
{
- DBG_ASSERT( ( m_rTable.m_nRequiredInvariants & m_nSuspendFlags ) == m_nSuspendFlags,
- "SuspendInvariants: cannot suspend what is already suspended!" );
+ //DBG_ASSERT( ( m_rTable.m_nRequiredInvariants & m_nSuspendFlags ) == m_nSuspendFlags,
+ // "SuspendInvariants: cannot suspend what is already suspended!" );
const_cast< TableControl_Impl& >( m_rTable ).m_nRequiredInvariants &= ~m_nSuspendFlags;
}
~SuspendInvariants()
@@ -303,7 +351,7 @@ namespace svt { namespace table
// m_nColHeaderHeightPixel consistent with the model's value?
{
TableMetrics nHeaderHeight = m_pModel->hasColumnHeaders() ? m_pModel->getColumnHeaderHeight() : 0;
- nHeaderHeight = m_rAntiImpl.LogicToPixel( Size( 0, nHeaderHeight ), MAP_100TH_MM ).Height();
+ nHeaderHeight = m_rAntiImpl.LogicToPixel( Size( 0, nHeaderHeight ), MAP_APPFONT ).Height();
if ( nHeaderHeight != m_nColHeaderHeightPixel )
return "column header heights are inconsistent!";
}
@@ -312,7 +360,7 @@ namespace svt { namespace table
if ( !isDummyModel )
{
TableMetrics nRowHeight = m_pModel->getRowHeight();
- nRowHeight = m_rAntiImpl.LogicToPixel( Size( 0, nRowHeight ), MAP_100TH_MM ).Height();
+ nRowHeight = m_rAntiImpl.LogicToPixel( Size( 0, nRowHeight ), MAP_APPFONT).Height();
if ( nRowHeight != m_nRowHeightPixel )
return "row heights are inconsistent!";
}
@@ -320,13 +368,12 @@ namespace svt { namespace table
// m_nRowHeaderWidthPixel consistent with the model's value?
{
TableMetrics nHeaderWidth = m_pModel->hasRowHeaders() ? m_pModel->getRowHeaderWidth() : 0;
- nHeaderWidth = m_rAntiImpl.LogicToPixel( Size( nHeaderWidth, 0 ), MAP_100TH_MM ).Width();
+ nHeaderWidth = m_rAntiImpl.LogicToPixel( Size( nHeaderWidth, 0 ), MAP_APPFONT ).Width();
if ( nHeaderWidth != m_nRowHeaderWidthPixel )
return "row header widths are inconsistent!";
}
// TODO: check m_aColumnWidthsPixel and m_aAccColumnWidthsPixel
-
if ( m_nCursorHidden < 0 )
return "invalid hidden count for the cursor!";
@@ -369,30 +416,33 @@ namespace svt { namespace table
,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_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_pSelEngine ( )
+ ,m_nRowSelected ( )
+ ,m_pTableFunctionSet ( new TableFunctionSet(this ) )
+ ,m_nAnchor (-1 )
+ ,m_bResizing ( false )
+ ,m_nResizingColumn ( 0 )
+ ,m_bResizingGrid ( false )
#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, m_pTableFunctionSet);
+ m_pSelEngine->SetSelectionMode(SINGLE_SELECTION);
m_pDataWindow->SetPosPixel( Point( 0, 0 ) );
m_pDataWindow->Show();
}
@@ -427,14 +477,10 @@ namespace svt { namespace table
TempHideCursor aHideCursor( *this );
- // TODO: revoke as table listener from the model
-
m_pModel = _pModel;
- if ( !m_pModel )
+ if ( !m_pModel)
m_pModel.reset( new EmptyTableModel );
- // TODO: register as table listener
- //m_pModel->addTableModelListener(PTableModelListener(m_pTableModelListener));
m_nCurRow = ROW_INVALID;
m_nCurColumn = COL_INVALID;
@@ -504,11 +550,11 @@ namespace svt { namespace table
m_pInputHandler.reset();
m_nColumnCount = m_nRowCount = 0;
- m_nRowHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getRowHeight() ), MAP_100TH_MM ).Height();
- if ( m_pModel->hasColumnHeaders() )
- m_nColHeaderHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getColumnHeaderHeight() ), MAP_100TH_MM ).Height();
+ m_nRowHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getRowHeight() ), MAP_APPFONT ).Height();
+ if ( m_pModel->hasColumnHeaders() )
+ m_nColHeaderHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getColumnHeaderHeight() ), MAP_APPFONT ).Height();
if ( m_pModel->hasRowHeaders() )
- m_nRowHeaderWidthPixel = m_rAntiImpl.LogicToPixel( Size( m_pModel->getRowHeaderWidth(), 0 ), MAP_100TH_MM ).Width();
+ m_nRowHeaderWidthPixel = m_rAntiImpl.LogicToPixel( Size( m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT).Width();
impl_ni_updateColumnWidths();
@@ -529,34 +575,116 @@ namespace svt { namespace table
return;
TableSize colCount = m_pModel->getColumnCount();
+
m_aColumnWidthsPixel.reserve( colCount );
m_aAccColumnWidthsPixel.reserve( colCount );
- long accumulatedPixelWidth = 0;
- for ( ColPos col = 0; col < colCount; ++col )
+ if(colCount>0)
{
- 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 = pColumn->getWidth();
- DBG_ASSERT( ( colWidth == COLWIDTH_FIT_TO_VIEW ) || ( colWidth > 0 ),
- "TableControl_Impl::impl_ni_updateColumnWidths: invalid column width!" );
-
- long pixelWidth = 0;
- if ( colWidth == COLWIDTH_FIT_TO_VIEW )
+ 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())
+ {
+ sal_Int32 scrollbarWidth = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize();
+ gridWidth-=scrollbarWidth;
+ }
+ double colWidthsSum = 0.0;
+ double colWithoutFixedWidthsSum = 0.0;
+ double minColWithoutFixedSum = 0.0;
+ for ( ColPos col = 0; col < colCount; ++col )
+ {
+ 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)
+ {
+ colWithoutFixedWidthsSum+=pixelWidth;
+ lastResizableCol = col;
+ }
+ colWidthsSum+=pixelWidth;
+ aPrePixelWidths.push_back(pixelWidth);
+ }
+ double gridWidthWithoutFixed = gridWidth - colWidthsSum + colWithoutFixedWidthsSum;
+ double scalingFactor = 1.0;
+ if(m_bResizingGrid)
{
- // TODO
- DBG_ERROR( "TableControl_Impl::impl_ni_updateColumnWidths: COLWIDTH_FIT_TO_VIEW not implemented, yet!" );
+ if(gridWidthWithoutFixed > (minColWithoutFixedSum+colWidthsSum - colWithoutFixedWidthsSum))
+ scalingFactor = gridWidthWithoutFixed/colWithoutFixedWidthsSum;
}
else
{
- pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_100TH_MM ).Width();
+ if(colWidthsSum < gridWidthWithoutFixed)
+ {
+ if(colWithoutFixedWidthsSum>0)
+ scalingFactor = gridWidthWithoutFixed/colWithoutFixedWidthsSum;
+ }
+ }
+ for ( ColPos i = 0; i < colCount; ++i )
+ {
+ 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)
+ {
+ aPrePixelWidths[i]*=scalingFactor;
+ TableMetrics logicColWidth = m_rAntiImpl.PixelToLogic( Size( aPrePixelWidths[i], 0 ), MAP_APPFONT ).Width();
+ pColumn->setWidth(logicColWidth);
+ }
+ m_aColumnWidthsPixel.push_back( aPrePixelWidths[i] );
+ m_aAccColumnWidthsPixel.push_back( accumulatedPixelWidth += aPrePixelWidths[i] );
+ }
+ if(gridWidth > m_aAccColumnWidthsPixel[colCount-1])
+ {
+ if(lastResizableCol >= 0)
+ {
+ 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)
+ {
+ if(lastResizableCol == 0)
+ m_aAccColumnWidthsPixel[0] = m_aColumnWidthsPixel[lastResizableCol];
+ else
+ m_aAccColumnWidthsPixel[lastResizableCol]=m_aAccColumnWidthsPixel[lastResizableCol-1]+m_aColumnWidthsPixel[lastResizableCol];
+ ++lastResizableCol;
+ }
+ }
}
-
- m_aColumnWidthsPixel.push_back( pixelWidth );
-
- m_aAccColumnWidthsPixel.push_back( accumulatedPixelWidth += pixelWidth );
}
}
@@ -678,6 +806,13 @@ namespace svt { namespace table
Rectangle aDataCellPlayground( Point( 0, 0 ), m_rAntiImpl.GetOutputSizePixel() );
aDataCellPlayground.Left() = m_nRowHeaderWidthPixel;
aDataCellPlayground.Top() = m_nColHeaderHeightPixel;
+ m_nRowCount = m_pModel->getRowCount();
+ m_nColumnCount = m_pModel->getColumnCount();
+
+ if(m_aAccColumnWidthsPixel.empty())
+ {
+ impl_ni_updateColumnWidths();
+ }
// do we need a vertical scrollbar?
bool bFirstRoundVScrollNeed = false;
@@ -709,15 +844,6 @@ namespace svt { namespace table
aDataCellPlayground.Right() -= nScrollbarMetrics;
}
}
- else
- {
- Size regionWithoutHeader = m_rAntiImpl.PixelToLogic(Size(aDataCellPlayground.Right() - aDataCellPlayground.Left(),0),MAP_100TH_MM);
- TableMetrics nColWidth = regionWithoutHeader.Width()/m_nColumnCount;
- for ( ColPos col = 0; col < m_nColumnCount; ++col )
- m_pModel->getColumnModel(col)->setWidth(nColWidth);
- m_rAntiImpl.SetModel(m_pModel);
- }
-
// create or destroy the vertical scrollbar, as needed
lcl_updateScrollbar(
m_rAntiImpl,
@@ -758,6 +884,16 @@ 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)
+ {
+ if(m_aAccColumnWidthsPixel[nRange-2] - m_aAccColumnWidthsPixel[m_nLeftColumn] + m_aColumnWidthsPixel[nRange-1]>aDataCellPlayground.GetWidth())
+ {
+ m_pHScroll->SetVisibleSize( nVisibleUnits -1 );
+ m_pHScroll->SetPageSize(nVisibleUnits -1);
+ }
+ }
Rectangle aScrollbarArea(
Point( 0, aDataCellPlayground.Bottom() + 1 ),
Size( aDataCellPlayground.Right() + 1, nScrollbarMetrics )
@@ -780,6 +916,11 @@ namespace svt { namespace table
m_pScrollCorner->SetPosPixel( Point( aDataCellPlayground.Right() + 1, aDataCellPlayground.Bottom() + 1 ) );
m_pScrollCorner->Show();
}
+ else if(bHaveScrollCorner && bNeedScrollCorner)
+ {
+ m_pScrollCorner->SetPosPixel( Point( aDataCellPlayground.Right() + 1, aDataCellPlayground.Bottom() + 1 ) );
+ m_pScrollCorner->Show();
+ }
// resize the data window
m_pDataWindow->SetSizePixel( Size(
@@ -792,10 +933,26 @@ namespace svt { namespace table
void TableControl_Impl::onResize()
{
DBG_CHECK_ME();
- impl_ni_updateScrollbars();
- //Rectangle aAllCells;
- // impl_getAllVisibleCellsArea( aAllCells );
- //m_pSelEngine->SetVisibleArea(aAllCells);
+ 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_nColumnCount != 0)
+ impl_ni_updateScrollbars();
+ }
}
//--------------------------------------------------------------------
@@ -805,7 +962,6 @@ namespace svt { namespace table
if ( !getModel() )
return;
-
PTableRenderer pRenderer = getModel()->getRenderer();
DBG_ASSERT( !!pRenderer, "TableDataWindow::Paint: invalid renderer!" );
if ( !pRenderer )
@@ -813,21 +969,28 @@ namespace svt { namespace table
// 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 );
- m_nRowCount = m_pModel->getRowCount();
// ............................
// draw the header column area
- if ( getModel()->hasColumnHeaders() )
+ if ( m_pModel->hasColumnHeaders() )
{
TableRowGeometry 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();
pRenderer->PaintHeaderArea(
- *m_pDataWindow, aHeaderRow.getRect(), true, false, rStyle
+ *m_pDataWindow, aColRect, true, false, rStyle
);
// Note that strictly, aHeaderRow.getRect() also contains the intersection between column
// and row header area. However, below we go to paint this intersection, again,
@@ -847,27 +1010,39 @@ namespace svt { namespace table
*m_pDataWindow, aCell.getRect(), rStyle );
}
}
-
// the area occupied by the row header, if any
Rectangle aRowHeaderArea;
- if ( getModel()->hasRowHeaders() )
+ if ( m_pModel->hasRowHeaders() )
{
aRowHeaderArea = aAllCellsWithHeaders;
aRowHeaderArea.Right() = m_nRowHeaderWidthPixel - 1;
- aRowHeaderArea.Bottom() = m_nRowHeightPixel * m_nRowCount + m_nColHeaderHeightPixel - 1;
- pRenderer->PaintHeaderArea(
- *m_pDataWindow, aRowHeaderArea, false, true, rStyle
- );
+ 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);
// 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 ( getModel()->hasColumnHeaders() )
+ if ( m_pModel->hasColumnHeaders() )
{
TableCellGeometry 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();
pRenderer->PaintHeaderArea(
- *m_pDataWindow, aIntersection.getRect(), true, true, rStyle
+ *m_pDataWindow, aInters, true, true, rStyle
);
}
}
@@ -880,113 +1055,74 @@ namespace svt { namespace table
// paint all rows
Rectangle aAllDataCellsArea;
impl_getAllVisibleDataCellArea( aAllDataCellsArea );
-
- //get the vector, which contains row vectors, each containing the data for the cells in this row
- std::vector<std::vector<rtl::OUString> >& aCellContent = m_pModel->getCellContent();
- //if the vector is empty, fill it with empty data, so the table can be painted
- if(aCellContent.empty())
- {
- std::vector<rtl::OUString> emptyCells;
- while(m_nRowCount!=0)
- {
- aCellContent.push_back(emptyCells);
- --m_nRowCount;
- }
- }
- std::vector<std::vector<rtl::OUString> >::iterator it = aCellContent.begin()+m_nTopRow;
- //get the vector, which contains the row header titles
- std::vector<rtl::OUString>& aRowHeaderContent = m_pModel->getRowHeaderName();
- ::std::vector<rtl::OUString>::iterator itRowName = aRowHeaderContent.begin();
-
- if(m_pModel->hasRowHeaders())
- {
- aRowHeaderContent = m_pModel->getRowHeaderName();
- //if the vector is empty, fill it with empty strings, so the table can be painted
- if(aRowHeaderContent.empty())
- {
- while(m_nRowCount!=0)
- {
- aRowHeaderContent.push_back(rtl::OUString::createFromAscii(""));
- --m_nRowCount;
- }
- }
- itRowName = aRowHeaderContent.begin()+m_nTopRow;
- }
+ ::std::vector< std::vector< ::com::sun::star::uno::Any > >& aCellContent = m_pModel->getCellContent();
for ( TableRowGeometry aRowIterator( *this, aAllCellsWithHeaders, getTopRow() );
aRowIterator.isValid();
aRowIterator.moveDown() )
{
if ( _rUpdateRect.GetIntersection( aRowIterator.getRect() ).IsEmpty() )
- {
- if(m_pModel->hasRowHeaders())
- ++itRowName;
- ++it;
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)
+ itSel!=m_nRowSelected.end();++itSel)
{
if(*itSel == aRowIterator.getRow())
isSelectedRow = true;
}
}
- std::vector<rtl::OUString> aCellData;
- if(it != aCellContent.end())
+ Rectangle aRect = aRowIterator.getRect().GetIntersection( aAllDataCellsArea );
+ //to avoid double lines
+ if( aRowIterator.getRow() != 0 )
+ --aRect.Top();
+ if(m_nLeftColumn != 0)
+ --aRect.Left();
+ else
{
- aCellData = *it;
- ++it;
+ if(m_pModel->hasRowHeaders())
+ --aRect.Left();
}
- ::std::vector<rtl::OUString>::iterator iter = aCellData.begin()+m_nLeftColumn;
-
// give the redenderer a chance to prepare the row
pRenderer->PrepareRow( aRowIterator.getRow(), isActiveRow, isSelectedRow,
- *m_pDataWindow, aRowIterator.getRect().GetIntersection( aAllDataCellsArea ), rStyle );
+ *m_pDataWindow, aRect, rStyle );
// paint the row header
if ( m_pModel->hasRowHeaders() )
{
- rtl::OUString rowHeaderName;
- if(itRowName != aRowHeaderContent.end())
- {
- rowHeaderName = *itRowName;
- ++itRowName;
- }
Rectangle aCurrentRowHeader( aRowHeaderArea.GetIntersection( aRowIterator.getRect() ) );
+ rtl::OUString rowHeaderName = m_pModel->getRowHeaderName()[aRowIterator.getRow()];
pRenderer->PaintRowHeader( isActiveRow, isSelectedRow, *m_pDataWindow, aCurrentRowHeader,
rStyle, rowHeaderName );
}
if ( !colCount )
continue;
-
// paint all cells in this row
for ( TableCellGeometry aCell( aRowIterator, m_nLeftColumn );
aCell.isValid();
aCell.moveRight()
)
{
- // if ( _rUpdateRect.GetIntersection( aCell.getRect() ).IsEmpty() )
- // continue;
-
- //bool isActiveCell = isActiveRow && ( aCell.getColumn() == getCurColumn() );
bool isSelectedColumn = false;
- rtl::OUString cellData;
- if(aCellData.empty())
- cellData=rtl::OUString::createFromAscii("");
- else if(iter != aCellData.end())
+ ::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
{
- cellData = *iter;
- ++iter;
+ ::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, cellData );
- }
+ }
}
}
-
//--------------------------------------------------------------------
void TableControl_Impl::hideCursor()
{
@@ -1016,70 +1152,70 @@ namespace svt { namespace table
switch ( _eAction )
{
case cursorDown:
- if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+ if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+ {
+ //if other rows already selected, deselect them
+ if(m_nRowSelected.size()>0)
{
- //if other rows already selected, deselect them
- if(m_nRowSelected.size()>0)
- {
- for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
- it!=m_nRowSelected.end();++it)
- {
- invalidateSelectedRow(*it,rCells);
- m_pDataWindow->Invalidate(rCells);
- }
- m_nRowSelected.clear();
- }
- if(m_nCurRow < m_nRowCount-1)
+ for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
+ it!=m_nRowSelected.end();++it)
{
- ++m_nCurRow;
- m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(*it, *it, rCells);
}
- else
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
- ensureVisible(m_nCurColumn,m_nCurRow,false);
- bSuccess = true;
+ m_nRowSelected.clear();
}
- else
+ if(m_nCurRow < m_nRowCount-1)
{
- if ( m_nCurRow < m_nRowCount - 1 )
- bSuccess = goTo( m_nCurColumn, m_nCurRow + 1 );
+ ++m_nCurRow;
+ m_nRowSelected.push_back(m_nCurRow);
}
+ else
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+ ensureVisible(m_nCurColumn,m_nCurRow,false);
+ m_rAntiImpl.selectionChanged(true);
+ bSuccess = true;
+ }
+ else
+ {
+ if ( m_nCurRow < m_nRowCount - 1 )
+ bSuccess = goTo( m_nCurColumn, m_nCurRow + 1 );
+ }
break;
case cursorUp:
- if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+ if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+ {
+ if(m_nRowSelected.size()>0)
{
- if(m_nRowSelected.size()>0)
- {
- for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
+ for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
it!=m_nRowSelected.end();++it)
- {
- invalidateSelectedRow(*it,rCells);
- m_pDataWindow->Invalidate(rCells);
- }
- m_nRowSelected.clear();
- }
- if(m_nCurRow>0)
{
- --m_nCurRow;
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
+ invalidateSelectedRegion(*it, *it, rCells);
}
- else
- {
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
- }
- ensureVisible(m_nCurColumn,m_nCurRow,false);
- bSuccess = true;
+ m_nRowSelected.clear();
+ }
+ if(m_nCurRow>0)
+ {
+ --m_nCurRow;
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
}
else
{
- if ( m_nCurRow > 0 )
- bSuccess = goTo( m_nCurColumn, m_nCurRow - 1 );
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
}
- break;
+ ensureVisible(m_nCurColumn,m_nCurRow,false);
+ m_rAntiImpl.selectionChanged(true);
+ bSuccess = true;
+ }
+ else
+ {
+ if ( m_nCurRow > 0 )
+ bSuccess = goTo( m_nCurColumn, m_nCurRow - 1 );
+ }
+ break;
case cursorLeft:
if ( m_nCurColumn > 0 )
bSuccess = goTo( m_nCurColumn - 1, m_nCurRow );
@@ -1133,225 +1269,251 @@ namespace svt { namespace table
case cursorBottomRight:
bSuccess = goTo( m_nColumnCount - 1, m_nRowCount - 1 );
break;
-
- case cursorSelectRow:
+ 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)
{
- 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);
- //else select the row->put it in the vector
- else
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
- bSuccess = true;
+ //if there are other selected rows, deselect them
+ return false;
}
- break;
- case cursorSelectRowUp:
+ else
{
- if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
- return bSuccess = false;
- else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+ //there are other selected rows
+ if(m_nRowSelected.size()>0)
{
- //if there are other selected rows, deselect them
- return false;
- }
- else
- {
- //there are other selected rows
- if(m_nRowSelected.size()>0)
+ //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)
{
- //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)
- {
- for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
+ for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
it!=m_nRowSelected.end();++it)
- {
- invalidateSelectedRow(*it,rCells);
- m_pDataWindow->Invalidate(rCells);
- }
- m_nRowSelected.clear();
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
+ {
+ 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
+ {
+ 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>0)
{
- //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(m_nRowSelected[nextRow] == m_nCurRow)
- {
- m_nRowSelected.erase(m_nRowSelected.begin()+prevRow);
- invalidateSelectedRow(m_nCurRow+1, rCells);
- }
- else
- {
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
- }
+ m_nRowSelected.push_back(m_nCurRow);
+ m_nCurRow--;
+ m_nRowSelected.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
{
- //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);
- invalidateSelectedRow(m_nCurRow, rCells);
- }
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
}
- m_pSelEngine->SetAnchor(TRUE);
- m_nAnchor = m_nCurRow;
- ensureVisible(m_nCurColumn, m_nCurRow, false);
- bSuccess = true;
}
+ m_pSelEngine->SetAnchor(TRUE);
+ m_nAnchor = m_nCurRow;
+ ensureVisible(m_nCurColumn, m_nCurRow, false);
+ m_rAntiImpl.selectionChanged(true);
+ bSuccess = true;
}
- break;
- case cursorSelectRowDown:
+ }
+ break;
+ case cursorSelectRowDown:
+ {
+ if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
+ bSuccess = false;
+ else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
{
- if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
- bSuccess = false;
- else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
- {
- bSuccess = false;
- }
- else
+ bSuccess = false;
+ }
+ else
+ {
+ if(m_nRowSelected.size()>0)
{
- if(m_nRowSelected.size()>0)
+ //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)
{
- //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)
- {
- for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
+ for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
it!=m_nRowSelected.end();++it)
- {
- invalidateSelectedRow(*it,rCells);
- m_pDataWindow->Invalidate(rCells);
- }
- m_nRowSelected.clear();
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(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)
- m_nCurRow++;
- else
- return bSuccess = true;
- //if net row already selected, deselect it, otherwise select it
- if(m_nRowSelected[nextRow] == m_nCurRow)
- {
- m_nRowSelected.erase(m_nRowSelected.begin()+prevRow);
- invalidateSelectedRow(m_nCurRow-1, rCells);
- }
- else
- {
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
- }
- }
+ invalidateSelectedRegion(*it, *it, rCells);
+ }
+ m_nRowSelected.clear();
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
}
- }
else
{
- //there wasn't any selection, select curennt and row beneath, otherwise onlyrow beneath
- 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);
+ //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);
+ }
}
else
{
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
+ 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_pSelEngine->SetAnchor(TRUE);
- m_nAnchor = m_nCurRow;
- ensureVisible(m_nCurColumn, m_nCurRow, false);
- bSuccess = true;
}
- }
- break;
- case cursorSelectRowAreaTop:
- {
- if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
- bSuccess = false;
- else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
- bSuccess = false;
else
{
- //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)
+ //there wasn't any selection, select current and row beneath, otherwise only row beneath
+ if(m_nCurRow<m_nRowCount-1)
{
- if(!isRowSelected(m_nRowSelected, iter))
- m_nRowSelected.push_back(iter);
- --iter;
+ 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);
}
- m_nCurRow = 0;
- m_nAnchor = m_nCurRow;
- m_pSelEngine->SetAnchor(TRUE);
- ensureVisible(m_nCurColumn, 0, false);
- bSuccess = true;
}
+ m_pSelEngine->SetAnchor(TRUE);
+ m_nAnchor = m_nCurRow;
+ ensureVisible(m_nCurColumn, m_nCurRow, false);
+ m_rAntiImpl.selectionChanged(true);
+ bSuccess = true;
}
+ }
break;
- case cursorSelectRowAreaBottom:
+ case cursorSelectRowAreaTop:
+ {
+ if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
+ bSuccess = false;
+ else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+ bSuccess = false;
+ else
{
- 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
+ //select the region between the current and the upper row
RowPos iter = m_nCurRow;
- invalidateSelectedRegion(m_nCurRow, m_nRowCount-1, rCells);
- //put the rows in the vector
- while(iter<=m_nRowCount)
+ invalidateSelectedRegion(m_nCurRow, 0, rCells);
+ //put the rows in vector
+ while(iter>=0)
{
if(!isRowSelected(m_nRowSelected, iter))
m_nRowSelected.push_back(iter);
- ++iter;
+ --iter;
}
- m_nCurRow = m_nRowCount-1;
+ m_nCurRow = 0;
m_nAnchor = m_nCurRow;
m_pSelEngine->SetAnchor(TRUE);
- ensureVisible(m_nCurColumn, m_nRowCount, false);
+ ensureVisible(m_nCurColumn, 0, false);
+ m_rAntiImpl.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(TRUE);
+ ensureVisible(m_nCurColumn, m_nRowCount-1, false);
+ m_rAntiImpl.selectionChanged(true);
+ bSuccess = true;
+ }
break;
default:
DBG_ERROR( "TableControl_Impl::dispatchAction: unsupported action!" );
@@ -1367,16 +1529,12 @@ namespace svt { namespace table
{
Rectangle aCellRect;
impl_getCellRect( m_nCurColumn, m_nCurRow, aCellRect );
-
- // const StyleSettings& rStyle = m_rAntiImpl.GetSettings().GetStyleSettings();
+ if(!m_pModel->hasRowHeaders() && m_nCurColumn == 0)
+ aCellRect.Left()++;
if ( _bShow )
- {
pRenderer->ShowCellCursor( *m_pDataWindow, aCellRect);
- }
else
- {
pRenderer->HideCellCursor( *m_pDataWindow, aCellRect);
- }
}
}
@@ -1394,16 +1552,12 @@ namespace svt { namespace table
return;
}
- DBG_ASSERT( ( _nColumn >= 0 ) && ( _nColumn < m_pModel->getColumnCount() ),
- "TableControl_Impl::impl_getCellRect: invalid column index!" );
- DBG_ASSERT( ( _nRow >= 0 ) && ( _nRow < m_pModel->getRowCount() ),
- "TableControl_Impl::impl_getCellRect: invalid row index!" );
-
Rectangle aAllCells;
impl_getAllVisibleCellsArea( aAllCells );
TableCellGeometry aCell( *this, aAllCells, _nColumn, _nRow );
_rCellRect = aCell.getRect();
+ _rCellRect.Top()--;_rCellRect.Left()--;
}
//-------------------------------------------------------------------------------
RowPos TableControl_Impl::getCurrentRow(const Point& rPoint)
@@ -1412,8 +1566,7 @@ namespace svt { namespace table
Rectangle rCellRect;
RowPos newRowPos = -2;//-1 is HeaderRow
ColPos newColPos = 0;
- //To Do: when only row position needed, the second loop isn't necessary, Please proove this!!!
- for(int i=0;i<m_nRowCount;i++)
+ for(int i=-1;i<m_nRowCount;i++)
{
for(int j=-1;j<m_nColumnCount;j++)
{
@@ -1422,9 +1575,7 @@ namespace svt { namespace table
{
newRowPos = i;
newColPos = j;
- if(newColPos == -1)
- m_nCurColumn = 0;
- else
+ if(newColPos != -1)
m_nCurColumn = newColPos;
return newRowPos;
}
@@ -1432,7 +1583,7 @@ namespace svt { namespace table
}
return newRowPos;
}
- //-------------------------------------------------------------------------------
+ //-------------------------------------------------------------------------------
void TableControl_Impl::setCursorAtCurrentCell(const Point& rPoint)
{
DBG_CHECK_ME();
@@ -1440,7 +1591,6 @@ namespace svt { namespace table
Rectangle rCellRect;
RowPos newRowPos = -2;//-1 is HeaderRow
ColPos newColPos = 0;
- //To Do: when only row position needed, the second loop isn't necessary, Please proove this!!!
for(int i=0;i<m_nRowCount;i++)
{
for(int j=-1;j<m_nColumnCount;j++)
@@ -1460,7 +1610,6 @@ namespace svt { namespace table
}
showCursor();
}
-
//-------------------------------------------------------------------------------
void TableControl_Impl::invalidateSelectedRegion(RowPos _nPrevRow, RowPos _nCurRow, Rectangle& _rCellRect)
{
@@ -1475,14 +1624,14 @@ namespace svt { namespace table
if(_nPrevRow == _nCurRow)
{
impl_getCellRect(m_nCurColumn,_nCurRow,rCells);
- _rCellRect.Top()=rCells.Top();
+ _rCellRect.Top()=--rCells.Top();
_rCellRect.Bottom()=rCells.Bottom();
}
//if the region is above the current row
else if(_nPrevRow < _nCurRow )
{
impl_getCellRect(m_nCurColumn,_nPrevRow,rCells);
- _rCellRect.Top()=rCells.Top();
+ _rCellRect.Top()= --rCells.Top();
impl_getCellRect(m_nCurColumn,_nCurRow,rCells);
_rCellRect.Bottom()=rCells.Bottom();
}
@@ -1490,46 +1639,37 @@ namespace svt { namespace table
else
{
impl_getCellRect(m_nCurColumn,_nCurRow,rCells);
- _rCellRect.Top()=rCells.Top();
+ _rCellRect.Top()= --rCells.Top();
impl_getCellRect(m_nCurColumn,_nPrevRow,rCells);
_rCellRect.Bottom()=rCells.Bottom();
}
m_pDataWindow->Invalidate(_rCellRect);
}
-
- //-------------------------------------------------------------------------------
- //To Do: not really needed, because in method above one row can be invalidate. Please Prove this!!!
- void TableControl_Impl::invalidateSelectedRow(RowPos _nCurRow, Rectangle& _rCellRect)
- {
- DBG_CHECK_ME();
- Rectangle aAllCells;
- impl_getAllVisibleCellsArea( aAllCells );
- _rCellRect.Left() = aAllCells.Left();
- _rCellRect.Right() = aAllCells.Right();
- Rectangle rCells;
- impl_getCellRect(m_nCurColumn,_nCurRow,rCells);
- _rCellRect.Top()=rCells.Top();
- _rCellRect.Bottom()=rCells.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)
{
- //DBG_CHECK_ME();
- TempHideCursor aHideCursor( *this );
+ if(m_nCurRow < 0)
+ m_nCurRow = 0;
+ if(m_nCursorHidden == 2)
+ --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;
@@ -1556,57 +1696,23 @@ namespace svt { namespace table
else
m_nCurRow = _nRowPos-1;
}
- //-------------------------------------------------------------------------------
- void TableControl_Impl::invalidateRows(RowPos _nRowStart, Rectangle& _rCellRect)
+ //------------------------------------------------------------------------------
+ void TableControl_Impl::invalidateRows()
{
- //DBG_CHECK_ME();
- (void)_nRowStart;
- (void)_rCellRect;
- /*TempHideCursor aHideCursor(*this);
- Rectangle aAllCells;
- impl_getAllVisibleCellsArea( aAllCells );
- TableRowGeometry _rRow( *this, aAllCells, _nRowStart);
- _rCellRect = _rRow.getRect();
- Rectangle rCells1;
- impl_getCellRect(m_nCurColumn,m_nRowCount,rCells1);
- _rCellRect.Bottom() = rCells1.Bottom();*/
- /*if(_nRowStart != _nRowEnd)
- {
- TableRowGeometry _rRow( *this, aAllCells, _nRowEnd);
- _rCellRect.Bottom() = _rRow.getRect().Bottom();
- }
- */
- //_rCellRect.Right() = aAllCells.Right();
- //_rCellRect.Left() = aAllCells.Left();
- //Rectangle rCells1;
- //impl_getCellRect(m_nCurColumn,_nRowStart,rCells1);
- //_rCellRect.Top()=rCells1.Top();
- //Rectangle rCells2;
- //impl_getCellRect(m_nCurColumn,_nRowEnd,rCells2);
- //_rCellRect.Bottom()=rCells2.Bottom();
impl_ni_updateScrollbars();
- //m_pDataWindow->Invalidate(_rCellRect);
+ TableSize nVisibleRows = impl_getVisibleRows(true);
+ TableSize nVisibleCols = impl_getVisibleColumns(true);
+ 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--;
+ else
+ m_nLeftColumn = 0;
m_pDataWindow->Invalidate();
}
-
- //-------------------------------------------------------------------------------
- bool TableControl_Impl::isClickInVisibleArea(const Point& rPoint)
- {
- DBG_CHECK_ME();
- long nScrollbarMetrics = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize();
- //clickable area is in the visible table control area without the scrollbars
- Rectangle aDataCellPlayground( Point( 0, 0 ), m_rAntiImpl.GetOutputSizePixel() );
- aDataCellPlayground.Top() = m_nColHeaderHeightPixel;
- aDataCellPlayground.Right() -= nScrollbarMetrics;
- aDataCellPlayground.Bottom() -= nScrollbarMetrics;
- if((rPoint.X() >= aDataCellPlayground.Left() && rPoint.X() <= aDataCellPlayground.Right()) && rPoint.Y() >= aDataCellPlayground.Top() && rPoint.Y() <= aDataCellPlayground.Bottom())
- {
- return true;
- }
- else
- return false;
- }
//--------------------------------------------------------------------
TableSize TableControl_Impl::impl_getVisibleRows( bool _bAcceptPartialRow ) const
{
@@ -1654,20 +1760,6 @@ namespace svt { namespace table
// ensure that the new cell is visible
ensureVisible( m_nCurColumn, m_nCurRow, false );
-
- // TODO: invalidate all and new column/row header, if present, to enforce
- // re-painting them
- //if(!m_nRowSelected.empty())
- //{
- // Rectangle rCells;
- // for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
- // it!=m_nRowSelected.end();++it)
- // {
- // invalidateSelectedRow(*it,rCells);
- // }
- // m_nRowSelected.clear();
- //}
- // TODO: notify listeners about new position
return true;
}
@@ -1735,7 +1827,7 @@ namespace svt { namespace table
&& abs( nPixelDelta ) < aDataArea.GetHeight()
)
{
- m_pDataWindow->Scroll( 0, (long)-nPixelDelta, aDataArea, SCROLL_CLIP | SCROLL_UPDATE );
+ m_pDataWindow->Scroll( 0, (long)-nPixelDelta, aDataArea, SCROLL_CLIP | SCROLL_UPDATE | SCROLL_CHILDREN);
}
else
m_pDataWindow->Invalidate( INVALIDATE_UPDATE );
@@ -1791,42 +1883,315 @@ namespace svt { namespace table
return (TableSize)( m_nLeftColumn - nOldLeftColumn );
}
-
+ //-------------------------------------------------------------------------------
SelectionEngine* TableControl_Impl::getSelEngine()
{
return m_pSelEngine;
}
+ //-------------------------------------------------------------------------------
TableDataWindow* TableControl_Impl::getDataWindow()
{
return m_pDataWindow;
}
- BOOL TableControl_Impl::isRowSelected(::std::vector<RowPos> selectedRows, RowPos current)
+ //-------------------------------------------------------------------------------
+ ScrollBar* TableControl_Impl::getHorzScrollbar()
+ {
+ return m_pHScroll;
+ }
+ //-------------------------------------------------------------------------------
+ ScrollBar* TableControl_Impl::getVertScrollbar()
+ {
+ return m_pVScroll;
+ }
+ //-------------------------------------------------------------------------------
+ BOOL TableControl_Impl::isRowSelected(const ::std::vector<RowPos>& selectedRows, RowPos current)
+ {
+ return ::std::find(selectedRows.begin(),selectedRows.end(),current) != selectedRows.end();
+ }
+ //-------------------------------------------------------------------------------
+ bool TableControl_Impl::isRowSelected(RowPos current)
+ {
+ return ::std::find(m_nRowSelected.begin(),m_nRowSelected.end(),current) != m_nRowSelected.end();
+ }
+ //-------------------------------------------------------------------------------
+ int TableControl_Impl::getRowSelectedNumber(const ::std::vector<RowPos>& selectedRows, RowPos current)
{
- for(::std::vector<RowPos>::iterator it=selectedRows.begin();
- it!=selectedRows.end();++it)
+ std::vector<RowPos>::const_iterator it = ::std::find(selectedRows.begin(),selectedRows.end(),current);
+ if ( it != selectedRows.end() )
{
- if(*it == current)
- return TRUE;
+ return it - selectedRows.begin();
}
- return FALSE;
+ return -1;
}
-
- int TableControl_Impl::getRowSelectedNumber(::std::vector<RowPos> selectedRows, RowPos current)
+ //-------------------------------------------------------------------------------
+ bool TableControl_Impl::isTooltipActive()
+ {
+ return m_rAntiImpl.isTooltip();
+ }
+ //-------------------------------------------------------------------------------
+ ::rtl::OUString& TableControl_Impl::setTooltip(const Point& rPoint )
{
- int pos = -1;
- int i = 0;
- for(std::vector<RowPos>::iterator it=selectedRows.begin();it!=selectedRows.end();++it)
+ ::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)
{
- if(*it == current)
- return pos = i;
- ++i;
+ ::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);
+ }
+ }
}
- return pos;
+ 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
+ {
+ 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);
+ }
+ }
+ }
+ }
+ return m_aTooltipText = aTooltipText;
}
-
- void TableControl_Impl::setCellContent(CellEntryType* pCellEntryType)
+ //--------------------------------------------------------------------
+ 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];
+ //subtract 1 from m_aAccColumnWidthPixel because right border should be part of the current cell
+ if(m_aVisibleColumnWidthsPixel[resizingColumn]-1 == rPoint.X() && 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);
+ }
+ //--------------------------------------------------------------------
+ bool TableControl_Impl::startResizeColumn(const Point& rPoint)
{
- (void)pCellEntryType;
+ m_bResizingGrid = false;
+ m_nResizingColumn = m_nCurColumn;
+ PColumnModel pColumn = m_pModel->getColumnModel(m_nResizingColumn);
+ if(m_aVisibleColumnWidthsPixel[m_nResizingColumn-m_nLeftColumn]-1 == rPoint.X() && pColumn->isResizable())
+ {
+ m_pDataWindow->CaptureMouse();
+ m_bResizing = true;
+ }
+ return m_bResizing;
+ }
+ //--------------------------------------------------------------------
+ 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)
+ {
+ 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();
+ }
+ else if(oldX < actX)
+ {
+ if(actWidth < maxWidth)
+ {
+ newActWidth = m_rAntiImpl.PixelToLogic( Size( actWidth, 0 ), MAP_APPFONT ).Width();
+ pColumn->setPreferredWidth(newActWidth);
+ }
+ else
+ pColumn->setPreferredWidth(pColumn->getMaxWidth());
+ }
+ 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--;
+ }
+ //--------------------------------------------------------------------
+ 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()));
+ else
+ return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width(), aSizeTableWithHeaders.Height()-aSizeTable.Height()));
+ }
+ Rectangle TableControl_Impl::calcTableRect()
+ {
+ Rectangle aRect;
+ impl_getAllVisibleDataCellArea(aRect);
+ return aRect;
}
//--------------------------------------------------------------------
@@ -1842,34 +2207,33 @@ namespace svt { namespace table
return 0L;
}
-
//---------------------------------------------------------------------------------------
- TableFunctionSet::TableFunctionSet(TableControl_Impl* _pTableControl):
- m_pTableControl( _pTableControl)
- ,m_nCurrentRow (-2)
+ TableFunctionSet::TableFunctionSet(TableControl_Impl* _pTableControl)
+ :m_pTableControl( _pTableControl)
+ ,m_nCurrentRow (-2)
{
}
-
+ //-------------------------------------------------------------------------------
TableFunctionSet::~TableFunctionSet()
{
}
-
+ //-------------------------------------------------------------------------------
void TableFunctionSet::BeginDrag()
{
}
-
+ //-------------------------------------------------------------------------------
void TableFunctionSet::CreateAnchor()
{
m_pTableControl->m_nAnchor = m_pTableControl->m_nCurRow;
}
-
- void TableFunctionSet::DestroyAnchor()
- {
+ //-------------------------------------------------------------------------------
+ void TableFunctionSet::DestroyAnchor()
+ {
m_pTableControl->m_nAnchor = -1;
- }
-
- BOOL TableFunctionSet::SetCursorAtPoint(const Point& rPoint, BOOL bDontSelectAtCursor)
- {
+ }
+ //-------------------------------------------------------------------------------
+ BOOL TableFunctionSet::SetCursorAtPoint(const Point& rPoint, BOOL bDontSelectAtCursor)
+ {
BOOL bHandled = FALSE;
Rectangle rCells;
//curRow is the row where the mouse click happened, m_nCurRow is the last selected row, before the mouse click
@@ -1886,9 +2250,6 @@ namespace svt { namespace table
{
//selecting region,
int diff = m_pTableControl->m_nCurRow - curRow;
- //bool isAlreadySelected = m_pTableControl->isRowSelected(m_pTableControl->m_nRowSelected, m_pTableControl->m_nAnchor);
- /* if(!isAlreadySelected && m_nCurrentRow != m_pTableControl->m_nCurRow)
- m_pTableControl->m_nRowSelected.push_back(m_nAnchor);*/
//selected region lies above the last selection
if( diff >= 0)
{
@@ -1924,9 +2285,7 @@ namespace svt { namespace table
else
{
if(m_pTableControl->m_nRowSelected.empty())
- {
m_pTableControl->m_nRowSelected.push_back(curRow);
- }
else
{
if(m_pTableControl->m_pSelEngine->GetSelectionMode()==SINGLE_SELECTION)
@@ -1943,14 +2302,14 @@ namespace svt { namespace table
}
if(m_pTableControl->m_nRowSelected.size()>1 && m_pTableControl->m_pSelEngine->GetSelectionMode()!=SINGLE_SELECTION)
m_pTableControl->m_pSelEngine->AddAlways(TRUE);
- m_pTableControl->invalidateSelectedRow(curRow,rCells);
+ m_pTableControl->invalidateSelectedRegion(curRow, curRow, rCells);
bHandled = TRUE;
}
m_pTableControl->m_nCurRow = curRow;
m_pTableControl->ensureVisible(m_pTableControl->m_nCurColumn,m_pTableControl->m_nCurRow,false);
return bHandled;
}
-
+ //-------------------------------------------------------------------------------
BOOL TableFunctionSet::IsSelectionAtPoint( const Point& rPoint )
{
m_pTableControl->m_pSelEngine->AddAlways(FALSE);
@@ -1965,7 +2324,7 @@ namespace svt { namespace table
return selected;
}
}
-
+ //-------------------------------------------------------------------------------
void TableFunctionSet::DeselectAtPoint( const Point& rPoint )
{
(void)rPoint;
@@ -1978,21 +2337,22 @@ namespace svt { namespace table
if(*it == m_nCurrentRow)
{
pos = i;
- m_pTableControl->invalidateSelectedRow(*it,rCells);
+ m_pTableControl->invalidateSelectedRegion(*it, *it, rCells);
}
++i;
}
m_pTableControl->m_nRowSelected.erase(m_pTableControl->m_nRowSelected.begin()+pos);
}
+ //-------------------------------------------------------------------------------
void TableFunctionSet::DeselectAll()
{
if(!m_pTableControl->m_nRowSelected.empty())
{
Rectangle rCells;
for(std::vector<RowPos>::iterator it=m_pTableControl->m_nRowSelected.begin();
- it!=m_pTableControl->m_nRowSelected.end();++it)
+ it!=m_pTableControl->m_nRowSelected.end();++it)
{
- m_pTableControl->invalidateSelectedRow(*it,rCells);
+ m_pTableControl->invalidateSelectedRegion(*it, *it, rCells);
}
m_pTableControl->m_nRowSelected.clear();
}
diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx
index dc875cd137fe..053766d92841 100644
--- a/svtools/source/table/tablecontrol_impl.hxx
+++ b/svtools/source/table/tablecontrol_impl.hxx
@@ -39,6 +39,7 @@
#include <vector>
#include <vcl/seleng.hxx>
+
class ScrollBar;
class ScrollBarBox;
@@ -62,60 +63,64 @@ namespace svt { namespace table
friend class TableRowGeometry;
friend class TableColumnGeometry;
friend class SuspendInvariants;
- friend class TableFunctionSet;
+ friend class TableFunctionSet;
private:
/// the control whose impl-instance we implemnt
- TableControl& m_rAntiImpl;
+ TableControl& m_rAntiImpl;
/// the model of the table control
- PTableModel m_pModel;
+ PTableModel m_pModel;
/// the input handler to use, usually the input handler as provided by ->m_pModel
- PTableInputHandler m_pInputHandler;
+ PTableInputHandler m_pInputHandler;
/// the widths of the single columns, measured in pixel
- ArrayOfLong m_aColumnWidthsPixel;
+ 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;
+ ArrayOfLong m_aAccColumnWidthsPixel;
+
+ ArrayOfLong m_aVisibleColumnWidthsPixel;
/// the height of a single row in the table, measured in pixels
- long m_nRowHeightPixel;
+ long m_nRowHeightPixel;
/// the height of the column header row in the table, measured in pixels
- long m_nColHeaderHeightPixel;
+ long m_nColHeaderHeightPixel;
/// the width of the row header column in the table, measured in pixels
- long m_nRowHeaderWidthPixel;
+ long m_nRowHeaderWidthPixel;
/// the number of columns in the table control. Cached model value.
- TableSize m_nColumnCount;
+ TableSize m_nColumnCount;
/// the number of rows in the table control. Cached model value.
- TableSize m_nRowCount;
+ TableSize m_nRowCount;
- ColPos m_nCurColumn;
- RowPos m_nCurRow;
- ColPos m_nLeftColumn;
- RowPos m_nTopRow;
+ ColPos m_nCurColumn;
+ RowPos m_nCurRow;
+ ColPos m_nLeftColumn;
+ RowPos m_nTopRow;
- sal_Int32 m_nCursorHidden;
+ sal_Int32 m_nCursorHidden;
/** the window to contain all data content, including header bars
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;
+ TableDataWindow* m_pDataWindow;
/// the vertical scrollbar, if any
- ScrollBar* m_pVScroll;
+ ScrollBar* m_pVScroll;
/// the horizontal scrollbar, if any
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;
-
-
+ 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;
#if DBG_UTIL
#define INV_SCROLL_POSITION 1
@@ -146,7 +151,6 @@ namespace svt { namespace table
inline const TableControl& getAntiImpl() const { return m_rAntiImpl; }
inline TableControl& getAntiImpl() { return m_rAntiImpl; }
- void setCellContent(CellEntryType* pCellEntryType);
public:
TableControl_Impl( TableControl& _rAntiImpl );
@@ -181,53 +185,44 @@ 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*/
- RowPos getCurrentRow (const Point& rPoint);
-
- void setCursorAtCurrentCell(const Point& rPoint);
- /** proves whether the vector with the selected rows contains the current row*/
- BOOL isRowSelected(::std::vector<RowPos> selectedRows, RowPos current);
- /** returns the position of the current row in the selecttion vector */
- int getRowSelectedNumber(::std::vector<RowPos> selectedRows, RowPos current);
- /** _rCellRect contains the region, which should be invalidate after some action e.g. selectiong row*/
- void invalidateSelectedRegion(RowPos _nPrevRow, RowPos _nCurRow, Rectangle& _rCellRect );
- /** _rCellRect contains the region, which should be invalidate after some action e.g. selectiong row*/
- //vielleicht kann man mit den anderen verschmelzen, mit einer Überprüfung ob prev==curr?
- void invalidateSelectedRow( 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(RowPos _nRowStart, Rectangle& _rCellRect );
- //virtual void DoubleClick();
-
+ /** 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*/
+ 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 bool isClickInVisibleArea(const Point& rPoint);
- virtual SelectionEngine* getSelEngine();
-
- TableDataWindow* getDataWindow();
- /** 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
- find room in the control.
-
- 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;
-
- /** 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;
+ 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();
private:
/** toggles the cursor visibility
@@ -312,10 +307,30 @@ namespace svt { namespace table
column range were reached.
*/
TableSize impl_ni_ScrollColumns( TableSize _nRowDelta );
+ /** 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
+ find room in the control.
+
+ 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;
+
+ /** 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;
+
+ void impl_ni_getAccVisibleColWidths();
+ void impl_updateLeftColumn();
DECL_LINK( OnScroll, ScrollBar* );
};
- //see seleng.hxx, seleng.cxx, FunctionSet overwritables, part of selection engine
+ //see seleng.hxx, seleng.cxx, FunctionSet overridables, part of selection engine
class TableFunctionSet : public FunctionSet
{
friend class TableDataWindow;
diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx
index 246710488b42..e2e1ce5353fe 100644
--- a/svtools/source/table/tabledatawindow.cxx
+++ b/svtools/source/table/tabledatawindow.cxx
@@ -30,6 +30,7 @@
#include "svtools/table/tablecontrol.hxx"
#include "svtools/table/tabledatawindow.hxx"
#include "tablecontrol_impl.hxx"
+#include <vcl/help.hxx>
//........................................................................
namespace svt { namespace table
@@ -44,10 +45,12 @@ namespace svt { namespace table
TableDataWindow::TableDataWindow( TableControl_Impl& _rTableControl )
:Window( &_rTableControl.getAntiImpl() )
,m_rTableControl ( _rTableControl )
+ ,m_nRowAlreadySelected( -1 )
{
- Color backgroundColor = m_rTableControl.getAntiImpl().GetSettings().GetStyleSettings().GetFieldColor();
- SetBackground( backgroundColor );
- SetControlBackground( backgroundColor );
+ // by default, use the background as determined by the style settings
+ const Color aWindowColor( GetSettings().GetStyleSettings().GetFieldColor() );
+ SetBackground( Wallpaper( aWindowColor ) );
+ SetFillColor( aWindowColor );
}
//--------------------------------------------------------------------
@@ -55,28 +58,115 @@ namespace svt { namespace table
{
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 )
{
+ Point aPoint = rMEvt.GetPosPixel();
if ( !m_rTableControl.getInputHandler()->MouseMove( m_rTableControl, rMEvt ) )
- Window::MouseMove( rMEvt );
+ {
+ if(m_rTableControl.getCurrentRow(aPoint)>=0 && m_rTableControl.isTooltipActive() )
+ {
+ SetPointer(POINTER_ARROW);
+ rtl::OUString& rHelpText = m_rTableControl.setTooltip(aPoint);
+ Help::EnableBalloonHelp();
+ Window::SetHelpText( rHelpText.getStr());
+ }
+ else if(m_rTableControl.getCurrentRow(aPoint) == -1)
+ {
+ if(Help::IsBalloonHelpEnabled())
+ Help::DisableBalloonHelp();
+ m_rTableControl.resizeColumn(aPoint);
+ }
+ else
+ {
+ if(Help::IsBalloonHelpEnabled())
+ Help::DisableBalloonHelp();
+ Window::MouseMove( rMEvt );
+ }
+ }
}
+ //--------------------------------------------------------------------
void TableDataWindow::MouseButtonDown( const MouseEvent& rMEvt )
{
+ Point aPoint = rMEvt.GetPosPixel();
+ RowPos nCurRow = m_rTableControl.getCurrentRow(aPoint);
if ( !m_rTableControl.getInputHandler()->MouseButtonDown( m_rTableControl, rMEvt ) )
Window::MouseButtonDown( rMEvt );
else
- m_aMouseButtonDownHdl.Call( (MouseEvent*) &rMEvt);
+ {
+ if(nCurRow >= 0 && m_rTableControl.getSelEngine()->GetSelectionMode() != NO_SELECTION)
+ {
+ if( m_nRowAlreadySelected != nCurRow )
+ {
+ m_nRowAlreadySelected = nCurRow;
+ 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 );
- else
- m_aMouseButtonUpHdl.Call( (MouseEvent*) &rMEvt);
+ m_aMouseButtonUpHdl.Call((MouseEvent*) &rMEvt);
m_rTableControl.getAntiImpl().GetFocus();
}
-
+ //--------------------------------------------------------------------
+ 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;
+ if ( rNEvt.GetType() == EVENT_COMMAND )
+ {
+ const CommandEvent& rCEvt = *rNEvt.GetCommandEvent();
+ if ( rCEvt.GetCommand() == COMMAND_WHEEL )
+ {
+ const CommandWheelData* pData = rCEvt.GetWheelData();
+ if( !pData->GetModifier() && ( pData->GetMode() == COMMAND_WHEEL_SCROLL ) )
+ {
+ nDone = HandleScrollCommand( rCEvt, m_rTableControl.getHorzScrollbar(), m_rTableControl.getVertScrollbar() );
+ }
+ }
+ }
+ return nDone ? nDone : Window::Notify( rNEvt );
+ }
//........................................................................
} } // namespace svt::table
//........................................................................
diff --git a/svtools/source/table/tablegeometry.cxx b/svtools/source/table/tablegeometry.cxx
index 58bdb531c921..d60de9e6438f 100644
--- a/svtools/source/table/tablegeometry.cxx
+++ b/svtools/source/table/tablegeometry.cxx
@@ -49,8 +49,8 @@ namespace svt { namespace table
{
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?" );
+ //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;
}
@@ -87,8 +87,8 @@ namespace svt { namespace table
{
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?" );
+/* 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;
}
diff --git a/svtools/source/toolpanel/drawerlayouter.cxx b/svtools/source/toolpanel/drawerlayouter.cxx
new file mode 100644
index 000000000000..040f33045fff
--- /dev/null
+++ b/svtools/source/toolpanel/drawerlayouter.cxx
@@ -0,0 +1,305 @@
+/*************************************************************************
+ * 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 "svtools/toolpanel/drawerlayouter.hxx"
+#include "toolpaneldrawer.hxx"
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+#include <comphelper/accimplaccess.hxx>
+#include <tools/diagnose_ex.h>
+
+//......................................................................................................................
+namespace svt
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::accessibility::XAccessible;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= DrawerDeckLayouter
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ DrawerDeckLayouter::DrawerDeckLayouter( ::Window& i_rParentWindow, IToolPanelDeck& i_rPanels )
+ :m_rParentWindow( i_rParentWindow )
+ ,m_rPanelDeck( i_rPanels )
+ ,m_aDrawers()
+ ,m_aLastKnownActivePanel()
+ {
+ m_rPanelDeck.AddListener( *this );
+
+ // simulate PanelInserted events for the panels which are already there
+ for ( size_t i=0; i<m_rPanelDeck.GetPanelCount(); ++i )
+ PanelInserted( m_rPanelDeck.GetPanel( i ), i );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ DrawerDeckLayouter::~DrawerDeckLayouter()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ IMPLEMENT_IREFERENCE( DrawerDeckLayouter )
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle DrawerDeckLayouter::Layout( const Rectangle& i_rDeckPlayground )
+ {
+ const size_t nPanelCount( m_rPanelDeck.GetPanelCount() );
+ if ( nPanelCount == 0 )
+ return i_rDeckPlayground;
+
+ const int nWidth( i_rDeckPlayground.GetWidth() );
+ ::boost::optional< size_t > aActivePanel( m_rPanelDeck.GetActivePanel() );
+ if ( !aActivePanel )
+ aActivePanel = m_aLastKnownActivePanel;
+
+ // arrange the title bars which are *above* the active panel (or *all* if there is no active panel), plus
+ // the title bar of the active panel itself
+ Point aUpperDrawerPos( i_rDeckPlayground.TopLeft() );
+ const size_t nUpperBound = !!aActivePanel ? *aActivePanel : nPanelCount - 1;
+ for ( size_t i=0; i<=nUpperBound; ++i )
+ {
+ sal_uInt32 nDrawerHeight = m_aDrawers[i]->GetPreferredHeightPixel();
+ m_aDrawers[i]->SetPosSizePixel(
+ aUpperDrawerPos, Size( nWidth, nDrawerHeight ) );
+ aUpperDrawerPos.Move( 0, nDrawerHeight );
+ }
+
+ // arrange title bars which are below the active panel (or *none* if there is no active panel)
+ Point aLowerDrawerPos( i_rDeckPlayground.BottomLeft() );
+ for ( size_t j = nPanelCount - 1; j > nUpperBound; --j )
+ {
+ sal_uInt32 nDrawerHeight = m_aDrawers[j]->GetPreferredHeightPixel();
+ m_aDrawers[j]->SetPosSizePixel(
+ Point( aLowerDrawerPos.X(), aLowerDrawerPos.Y() - nDrawerHeight + 1 ),
+ Size( nWidth, nDrawerHeight )
+ );
+ aLowerDrawerPos.Move( 0, -nDrawerHeight );
+ }
+
+ // fincally calculate the rectangle for the active panel
+ return Rectangle(
+ aUpperDrawerPos,
+ Size( nWidth, aLowerDrawerPos.Y() - aUpperDrawerPos.Y() + 1 )
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DrawerDeckLayouter::Destroy()
+ {
+ while ( !m_aDrawers.empty() )
+ impl_removeDrawer( 0 );
+ m_rPanelDeck.RemoveListener( *this );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DrawerDeckLayouter::SetFocusToPanelSelector()
+ {
+ const size_t nPanelCount( m_rPanelDeck.GetPanelCount() );
+ if ( !nPanelCount )
+ // nothing to focus
+ return;
+ ::boost::optional< size_t > aActivePanel( m_rPanelDeck.GetActivePanel() );
+ if ( !aActivePanel )
+ aActivePanel = 0;
+ ENSURE_OR_RETURN_VOID( *aActivePanel < m_aDrawers.size(), "DrawerDeckLayouter::SetFocusToPanelSelector: invalid active panel, or inconsistent drawers!" );
+ m_aDrawers[ *aActivePanel ]->GrabFocus();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ size_t DrawerDeckLayouter::GetAccessibleChildCount() const
+ {
+ return m_aDrawers.size();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessible > DrawerDeckLayouter::GetAccessibleChild( const size_t i_nChildIndex, const Reference< XAccessible >& i_rParentAccessible )
+ {
+ ENSURE_OR_RETURN( i_nChildIndex < m_aDrawers.size(), "illegal index", NULL );
+
+ const PToolPanelDrawer pDrawer( m_aDrawers[ i_nChildIndex ] );
+
+ Reference< XAccessible > xItemAccessible = pDrawer->GetAccessible( FALSE );
+ if ( !xItemAccessible.is() )
+ {
+ xItemAccessible = pDrawer->GetAccessible( TRUE );
+ ENSURE_OR_RETURN( xItemAccessible.is(), "illegal accessible provided by the drawer implementation!", NULL );
+ OSL_VERIFY( ::comphelper::OAccessibleImplementationAccess::setAccessibleParent( xItemAccessible->getAccessibleContext(),
+ i_rParentAccessible ) );
+ }
+
+ return xItemAccessible;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DrawerDeckLayouter::PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition )
+ {
+ OSL_PRECOND( i_nPosition <= m_aDrawers.size(), "DrawerDeckLayouter::PanelInserted: inconsistency!" );
+
+ PToolPanelDrawer pDrawer( new ToolPanelDrawer( m_rParentWindow, i_pPanel->GetDisplayName() ) );
+ pDrawer->SetSmartHelpId( i_pPanel->GetHelpID() );
+ // proper Z-Order
+ if ( i_nPosition == 0 )
+ {
+ pDrawer->SetZOrder( NULL, WINDOW_ZORDER_FIRST );
+ }
+ else
+ {
+ const PToolPanelDrawer pFirstDrawer( m_aDrawers[ i_nPosition - 1 ] );
+ pDrawer->SetZOrder( pFirstDrawer.get(), WINDOW_ZORDER_BEHIND );
+ }
+
+ pDrawer->Show();
+ pDrawer->AddEventListener( LINK( this, DrawerDeckLayouter, OnWindowEvent ) );
+ m_aDrawers.insert( m_aDrawers.begin() + i_nPosition, pDrawer );
+ impl_triggerRearrange();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DrawerDeckLayouter::PanelRemoved( const size_t i_nPosition )
+ {
+ impl_removeDrawer( i_nPosition );
+ impl_triggerRearrange();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DrawerDeckLayouter::impl_triggerRearrange() const
+ {
+ // this is somewhat hacky, it assumes that the parent of our panels is a tool panel deck, which, in its
+ // Resize implementation, rearrances all elements.
+ m_rParentWindow.Resize();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DrawerDeckLayouter::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
+ {
+ if ( !!i_rOldActive )
+ {
+ OSL_ENSURE( *i_rOldActive < m_aDrawers.size(), "DrawerDeckLayouter::ActivePanelChanged: illegal old index!" );
+ m_aDrawers[ *i_rOldActive ]->SetExpanded( false );
+ }
+
+ if ( !!i_rNewActive )
+ {
+ OSL_ENSURE( *i_rNewActive < m_aDrawers.size(), "DrawerDeckLayouter::ActivePanelChanged: illegal new index!" );
+ m_aDrawers[ *i_rNewActive ]->SetExpanded( true );
+ }
+
+ impl_triggerRearrange();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DrawerDeckLayouter::LayouterChanged( const PDeckLayouter& i_rNewLayouter )
+ {
+ // not interested in
+ (void)i_rNewLayouter;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ size_t DrawerDeckLayouter::impl_getPanelPositionFromWindow( const Window* i_pDrawerWindow ) const
+ {
+ for ( ::std::vector< PToolPanelDrawer >::const_iterator drawerPos = m_aDrawers.begin();
+ drawerPos != m_aDrawers.end();
+ ++drawerPos
+ )
+ {
+ if ( drawerPos->get() == i_pDrawerWindow )
+ return drawerPos - m_aDrawers.begin();
+ }
+ return m_aDrawers.size();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DrawerDeckLayouter::impl_removeDrawer( const size_t i_nPosition )
+ {
+ OSL_PRECOND( i_nPosition < m_aDrawers.size(), "DrawerDeckLayouter::impl_removeDrawer: invalid panel position!" );
+ m_aDrawers[ i_nPosition ]->RemoveEventListener( LINK( this, DrawerDeckLayouter, OnWindowEvent ) );
+ OSL_ENSURE( m_aDrawers[ i_nPosition ].unique(), "DrawerDeckLayouter::impl_removeDrawer: somebody else is still holding a reference!" );
+ m_aDrawers.erase( m_aDrawers.begin() + i_nPosition );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ IMPL_LINK( DrawerDeckLayouter, OnWindowEvent, VclSimpleEvent*, i_pEvent )
+ {
+ const VclWindowEvent* pWindowEvent = PTR_CAST( VclWindowEvent, i_pEvent );
+ ENSURE_OR_RETURN( pWindowEvent, "no WindowEvent", 0L );
+
+ bool bActivatePanel = false;
+ switch ( pWindowEvent->GetId() )
+ {
+ case VCLEVENT_WINDOW_MOUSEBUTTONUP:
+ {
+ const MouseEvent* pMouseEvent = static_cast< const MouseEvent* >( pWindowEvent->GetData() );
+ ENSURE_OR_RETURN( pMouseEvent, "no mouse event with MouseButtonUp", 0L );
+ if ( pMouseEvent->GetButtons() == MOUSE_LEFT )
+ {
+ bActivatePanel = true;
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_KEYINPUT:
+ {
+ const KeyEvent* pKeyEvent = static_cast< const KeyEvent* >( pWindowEvent->GetData() );
+ ENSURE_OR_RETURN( pKeyEvent, "no key event with KeyInput", 0L );
+ const KeyCode& rKeyCode( pKeyEvent->GetKeyCode() );
+ if ( ( rKeyCode.GetModifier() == 0 ) && ( rKeyCode.GetCode() == KEY_RETURN ) )
+ {
+ bActivatePanel = true;
+ }
+ }
+ break;
+ }
+ if ( bActivatePanel )
+ {
+ const size_t nPanelPos = impl_getPanelPositionFromWindow( pWindowEvent->GetWindow() );
+ if ( nPanelPos != m_rPanelDeck.GetActivePanel() )
+ {
+ m_rPanelDeck.ActivatePanel( nPanelPos );
+ }
+ else
+ {
+ PToolPanel pPanel( m_rPanelDeck.GetPanel( nPanelPos ) );
+ pPanel->GrabFocus();
+ }
+ return 1L;
+ }
+ return 0L;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DrawerDeckLayouter::Dying()
+ {
+ Destroy();
+ }
+
+//......................................................................................................................
+} // namespace svt
+//......................................................................................................................
diff --git a/svtools/source/toolpanel/dummypanel.cxx b/svtools/source/toolpanel/dummypanel.cxx
new file mode 100644
index 000000000000..20f140a6e610
--- /dev/null
+++ b/svtools/source/toolpanel/dummypanel.cxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ * 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 "dummypanel.hxx"
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::accessibility::XAccessible;
+
+ //====================================================================
+ //= DummyPanel
+ //====================================================================
+ //--------------------------------------------------------------------
+ DummyPanel::DummyPanel()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ DummyPanel::~DummyPanel()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ IMPLEMENT_IREFERENCE( DummyPanel )
+
+ //--------------------------------------------------------------------
+ void DummyPanel::Activate( Window& )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ void DummyPanel::Deactivate()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ void DummyPanel::SetSizePixel( const Size& )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString DummyPanel::GetDisplayName() const
+ {
+ return ::rtl::OUString();
+ }
+
+ //--------------------------------------------------------------------
+ Image DummyPanel::GetImage() const
+ {
+ return Image();
+ }
+
+ //--------------------------------------------------------------------
+ SmartId DummyPanel::GetHelpID() const
+ {
+ return SmartId();
+ }
+
+ //--------------------------------------------------------------------
+ void DummyPanel::GrabFocus()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ void DummyPanel::Dispose()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessible > DummyPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible )
+ {
+ (void)i_rParentAccessible;
+ return NULL;
+ }
+
+//........................................................................
+} // namespace svt
+//........................................................................
diff --git a/svtools/source/toolpanel/dummypanel.hxx b/svtools/source/toolpanel/dummypanel.hxx
new file mode 100644
index 000000000000..adb98e52077e
--- /dev/null
+++ b/svtools/source/toolpanel/dummypanel.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 DUMMYPANEL_HXX
+#define DUMMYPANEL_HXX
+
+#include "svtools/toolpanel/toolpanel.hxx"
+#include "svtools/toolpanel/refbase.hxx"
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //====================================================================
+ //= DummyPanel
+ //====================================================================
+ /// is a dummy implementation of the IToolPanel interface
+ class DummyPanel :public RefBase
+ ,public IToolPanel
+ {
+ public:
+ DummyPanel();
+ ~DummyPanel();
+
+ // IToolPanel
+ virtual ::rtl::OUString GetDisplayName() const;
+ virtual Image GetImage() const;
+ virtual SmartId GetHelpID() const;
+ virtual void Activate( Window& i_rParentWindow );
+ virtual void Deactivate();
+ virtual void SetSizePixel( const Size& i_rPanelWindowSize );
+ virtual void GrabFocus();
+ virtual void Dispose();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ CreatePanelAccessible(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible
+ );
+
+ DECLARE_IREFERENCE()
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // DUMMYPANEL_HXX
diff --git a/svtools/source/toolpanel/makefile.mk b/svtools/source/toolpanel/makefile.mk
new file mode 100755
index 000000000000..58282056f529
--- /dev/null
+++ b/svtools/source/toolpanel/makefile.mk
@@ -0,0 +1,68 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.16 $
+#
+# 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=svtools
+TARGET=toolpanel
+
+# --- Settings -----------------------------------------------------
+
+ENABLE_EXCEPTIONS=TRUE
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/svt.pmk
+
+# --- Files --------------------------------------------------------
+
+SRS1NAME=$(TARGET)
+SRC1FILES=\
+ toolpanel.src
+
+SLOFILES=\
+ $(SLO)$/drawerlayouter.obj \
+ $(SLO)$/dummypanel.obj \
+ $(SLO)$/paneldecklisteners.obj \
+ $(SLO)$/paneltabbar.obj \
+ $(SLO)$/paneltabbarpeer.obj \
+ $(SLO)$/refbase.obj \
+ $(SLO)$/tabbargeometry.obj \
+ $(SLO)$/tablayouter.obj \
+ $(SLO)$/toolpanel.obj \
+ $(SLO)$/toolpanelcollection.obj \
+ $(SLO)$/toolpaneldrawer.obj \
+ $(SLO)$/toolpaneldrawerpeer.obj \
+ $(SLO)$/toolpaneldeck.obj \
+ $(SLO)$/toolpaneldeckpeer.obj \
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/svtools/source/toolpanel/paneldecklisteners.cxx b/svtools/source/toolpanel/paneldecklisteners.cxx
new file mode 100755
index 000000000000..32ba9b5c6a24
--- /dev/null
+++ b/svtools/source/toolpanel/paneldecklisteners.cxx
@@ -0,0 +1,137 @@
+/*************************************************************************
+ * 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 "paneldecklisteners.hxx"
+#include "svtools/toolpanel/toolpaneldeck.hxx"
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //====================================================================
+ //= PanelDeckListeners
+ //====================================================================
+ //--------------------------------------------------------------------
+ PanelDeckListeners::PanelDeckListeners()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ PanelDeckListeners::~PanelDeckListeners()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ void PanelDeckListeners::PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition )
+ {
+ ::std::vector< IToolPanelDeckListener* > aListeners( m_aListeners );
+ for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = aListeners.begin();
+ loop != aListeners.end();
+ ++loop
+ )
+ {
+ (*loop)->PanelInserted( i_pPanel, i_nPosition );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void PanelDeckListeners::PanelRemoved( const size_t i_nPosition )
+ {
+ ::std::vector< IToolPanelDeckListener* > aListeners( m_aListeners );
+ for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = aListeners.begin();
+ loop != aListeners.end();
+ ++loop
+ )
+ {
+ (*loop)->PanelRemoved( i_nPosition );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void PanelDeckListeners::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
+ {
+ ::std::vector< IToolPanelDeckListener* > aListeners( m_aListeners );
+ for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = aListeners.begin();
+ loop != aListeners.end();
+ ++loop
+ )
+ {
+ (*loop)->ActivePanelChanged( i_rOldActive, i_rNewActive );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void PanelDeckListeners::LayouterChanged( const PDeckLayouter& i_rNewLayouter )
+ {
+ ::std::vector< IToolPanelDeckListener* > aListeners( m_aListeners );
+ for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = aListeners.begin();
+ loop != aListeners.end();
+ ++loop
+ )
+ {
+ (*loop)->LayouterChanged( i_rNewLayouter );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void PanelDeckListeners::Dying()
+ {
+ while ( !m_aListeners.empty() )
+ {
+ IToolPanelDeckListener* pListener( *m_aListeners.begin() );
+ m_aListeners.erase( m_aListeners.begin() );
+ pListener->Dying();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void PanelDeckListeners::AddListener( IToolPanelDeckListener& i_rListener )
+ {
+ m_aListeners.push_back( &i_rListener );
+ }
+
+ //--------------------------------------------------------------------
+ void PanelDeckListeners::RemoveListener( IToolPanelDeckListener& i_rListener )
+ {
+ for ( ::std::vector< IToolPanelDeckListener* >::iterator lookup = m_aListeners.begin();
+ lookup != m_aListeners.end();
+ ++lookup
+ )
+ {
+ if ( *lookup == &i_rListener )
+ {
+ m_aListeners.erase( lookup );
+ return;
+ }
+ }
+ }
+
+//........................................................................
+} // namespace svt
+//........................................................................
diff --git a/svtools/source/toolpanel/paneldecklisteners.hxx b/svtools/source/toolpanel/paneldecklisteners.hxx
new file mode 100755
index 000000000000..bc7e2ae7db88
--- /dev/null
+++ b/svtools/source/toolpanel/paneldecklisteners.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ * 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 PANELDECKLISTENERS_HXX
+#define PANELDECKLISTENERS_HXX
+
+#include "svtools/toolpanel/toolpaneldeck.hxx"
+
+#include <boost/optional.hpp>
+#include <vector>
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ class IToolPanelDeckListener;
+
+ //====================================================================
+ //= PanelDeckListeners
+ //====================================================================
+ /** implements a container for IToolPanelDeckListeners
+ */
+ class PanelDeckListeners
+ {
+ public:
+ PanelDeckListeners();
+ ~PanelDeckListeners();
+
+ // IToolPanelDeckListener equivalents, forward the events to all registered listeners
+ void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition );
+ void PanelRemoved( const size_t i_nPosition );
+ void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
+ void LayouterChanged( const PDeckLayouter& i_rNewLayouter );
+ void Dying();
+
+ // listener maintainance
+ void AddListener( IToolPanelDeckListener& i_rListener );
+ void RemoveListener( IToolPanelDeckListener& i_rListener );
+
+ private:
+ ::std::vector< IToolPanelDeckListener* > m_aListeners;
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // PANELDECKLISTENERS_HXX
diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx
new file mode 100755
index 000000000000..38aee00c8f55
--- /dev/null
+++ b/svtools/source/toolpanel/paneltabbar.cxx
@@ -0,0 +1,1356 @@
+/*************************************************************************
+ * 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 "svtools/toolpanel/paneltabbar.hxx"
+#include "svtools/toolpanel/toolpaneldeck.hxx"
+#include "svtools/svtdata.hxx"
+#include "svtools/svtools.hrc"
+
+#include "tabitemdescriptor.hxx"
+#include "paneltabbarpeer.hxx"
+#include "tabbargeometry.hxx"
+
+#include <vcl/button.hxx>
+#include <vcl/help.hxx>
+#include <vcl/virdev.hxx>
+#include <tools/diagnose_ex.h>
+
+#include <boost/optional.hpp>
+#include <vector>
+
+// space around an item
+#define ITEM_OUTER_SPACE 2 * 3
+// spacing before and after an item's text
+#define ITEM_TEXT_FLOW_SPACE 5
+// space between item icon and icon text
+#define ITEM_ICON_TEXT_DISTANCE 4
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::awt::XWindowPeer;
+
+ typedef sal_uInt16 ItemFlags;
+
+ #define ITEM_STATE_NORMAL 0x00
+ #define ITEM_STATE_ACTIVE 0x01
+ #define ITEM_STATE_HOVERED 0x02
+ #define ITEM_STATE_FOCUSED 0x04
+ #define ITEM_POSITION_FIRST 0x08
+ #define ITEM_POSITION_LAST 0x10
+
+ //==================================================================================================================
+ //= helper
+ //==================================================================================================================
+ namespace
+ {
+ ControlState lcl_ItemToControlState( const ItemFlags i_nItemFlags )
+ {
+ ControlState nState = CTRL_STATE_ENABLED;
+ if ( i_nItemFlags & ITEM_STATE_FOCUSED ) nState |= CTRL_STATE_FOCUSED | CTRL_STATE_PRESSED;
+ if ( i_nItemFlags & ITEM_STATE_HOVERED ) nState |= CTRL_STATE_ROLLOVER;
+ if ( i_nItemFlags & ITEM_STATE_ACTIVE ) nState |= CTRL_STATE_SELECTED;
+ return nState;
+ }
+ }
+
+ //==================================================================================================================
+ //= ITabBarRenderer
+ //==================================================================================================================
+ class SAL_NO_VTABLE ITabBarRenderer
+ {
+ public:
+ /** fills the background of our target device
+ */
+ virtual void renderBackground() const = 0;
+ virtual Rectangle calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const = 0;
+ virtual void preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const = 0;
+ virtual void postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const = 0;
+
+ // TODO: postRenderItem takes the "real" window, i.e. effectively the tab bar. This is because
+ // DrawSelectionBackground needs to be applied after everything else is painted, and is available at the Window
+ // class, but not at the OutputDevice. This makes the API somewhat weird, as we're now mixing operations on the
+ // target device, done in a normalized geometry, with operations on the window, done in a transformed geometry.
+ // So, we should get rid of postRenderItem completely.
+ };
+ typedef ::boost::shared_ptr< ITabBarRenderer > PTabBarRenderer;
+
+ //==================================================================================================================
+ //= VCLItemRenderer - declaration
+ //==================================================================================================================
+ class VCLItemRenderer : public ITabBarRenderer
+ {
+ public:
+ VCLItemRenderer( OutputDevice& i_rTargetDevice )
+ :m_rTargetDevice( i_rTargetDevice )
+ {
+ }
+
+ // ITabBarRenderer
+ virtual void renderBackground() const;
+ virtual Rectangle calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const;
+ virtual void preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const;
+ virtual void postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const;
+
+ protected:
+ OutputDevice& getTargetDevice() const { return m_rTargetDevice; }
+
+ private:
+ OutputDevice& m_rTargetDevice;
+ };
+
+ //==================================================================================================================
+ //= VCLItemRenderer - implementation
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ void VCLItemRenderer::renderBackground() const
+ {
+ getTargetDevice().DrawRect( Rectangle( Point(), getTargetDevice().GetOutputSizePixel() ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle VCLItemRenderer::calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const
+ {
+ (void)i_nItemFlags;
+ // no decorations at all
+ return i_rContentArea;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void VCLItemRenderer::preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const
+ {
+ (void)i_rContentRect;
+ (void)i_nItemFlags;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void VCLItemRenderer::postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const
+ {
+ const bool bActive = ( ( i_nItemFlags & ITEM_STATE_ACTIVE ) != 0 );
+ const bool bHovered = ( ( i_nItemFlags & ITEM_STATE_HOVERED ) != 0 );
+ const bool bFocused = ( ( i_nItemFlags & ITEM_STATE_FOCUSED ) != 0 );
+ if ( bActive || bHovered || bFocused )
+ {
+ Rectangle aSelectionRect( i_rItemRect );
+ aSelectionRect.Left() += ITEM_OUTER_SPACE / 2;
+ aSelectionRect.Top() += ITEM_OUTER_SPACE / 2;
+ aSelectionRect.Right() -= ITEM_OUTER_SPACE / 2;
+ aSelectionRect.Bottom() -= ITEM_OUTER_SPACE / 2;
+ i_rActualWindow.DrawSelectionBackground(
+ aSelectionRect,
+ ( bHovered || bFocused ) ? ( bActive ? 1 : 2 ) : 0 /* hilight */,
+ bActive /* check */,
+ TRUE /* border */,
+ FALSE /* ext border only */,
+ 0 /* corner radius */,
+ NULL,
+ NULL
+ );
+ }
+ }
+
+ //==================================================================================================================
+ //= NWFToolboxItemRenderer - declaration
+ //==================================================================================================================
+ class NWFToolboxItemRenderer : public ITabBarRenderer
+ {
+ public:
+ NWFToolboxItemRenderer( OutputDevice& i_rTargetDevice )
+ :m_rTargetDevice( i_rTargetDevice )
+ {
+ }
+
+ // ITabBarRenderer
+ virtual void renderBackground() const;
+ virtual Rectangle calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const;
+ virtual void preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const;
+ virtual void postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const;
+
+ protected:
+ OutputDevice& getTargetDevice() const { return m_rTargetDevice; }
+
+ private:
+ OutputDevice& m_rTargetDevice;
+ };
+
+ //==================================================================================================================
+ //= NWFToolboxItemRenderer - implementation
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ void NWFToolboxItemRenderer::renderBackground() const
+ {
+ getTargetDevice().DrawRect( Rectangle( Point(), getTargetDevice().GetOutputSizePixel() ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle NWFToolboxItemRenderer::calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const
+ {
+ // don't ask GetNativeControlRegion, this will not deliver proper results in all cases.
+ // Instead, simply assume that both the content and the bounding region are the same.
+// const ControlState nState( lcl_ItemToControlState( i_nItemFlags );
+// const ImplControlValue aControlValue;
+// bool bNativeOK = m_rTargetWindow.GetNativeControlRegion(
+// CTRL_TOOLBAR, PART_BUTTON,
+// i_rContentArea, nState,
+// aControlValue, ::rtl::OUString(),
+// aBoundingRegion, aContentRegion
+// );
+ (void)i_nItemFlags;
+ return Rectangle(
+ Point( i_rContentArea.Left() - 1, i_rContentArea.Top() - 1 ),
+ Size( i_rContentArea.GetWidth() + 2, i_rContentArea.GetHeight() + 2 )
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void NWFToolboxItemRenderer::preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const
+ {
+ const ControlState nState = lcl_ItemToControlState( i_nItemFlags );
+
+ ImplControlValue aControlValue;
+ aControlValue.setTristateVal( ( i_nItemFlags & ITEM_STATE_ACTIVE ) ? BUTTONVALUE_ON : BUTTONVALUE_OFF );
+
+ bool bNativeOK = getTargetDevice().DrawNativeControl( CTRL_TOOLBAR, PART_BUTTON, i_rContentRect, nState, aControlValue, rtl::OUString() );
+ (void)bNativeOK;
+ OSL_ENSURE( bNativeOK, "NWFToolboxItemRenderer::preRenderItem: inconsistent NWF implementation!" );
+ // IsNativeControlSupported returned true, previously, otherwise we would not be here ...
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void NWFToolboxItemRenderer::postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const
+ {
+ (void)i_rActualWindow;
+ (void)i_rItemRect;
+ (void)i_nItemFlags;
+ }
+
+ //==================================================================================================================
+ //= NWFTabItemRenderer - declaration
+ //==================================================================================================================
+ class NWFTabItemRenderer : public ITabBarRenderer
+ {
+ public:
+ NWFTabItemRenderer( OutputDevice& i_rTargetDevice )
+ :m_rTargetDevice( i_rTargetDevice )
+ {
+ }
+
+ // ITabBarRenderer
+ virtual void renderBackground() const;
+ virtual Rectangle calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const;
+ virtual void preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const;
+ virtual void postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const;
+
+ protected:
+ OutputDevice& getTargetDevice() const { return m_rTargetDevice; }
+
+ private:
+ OutputDevice& m_rTargetDevice;
+ };
+
+ //==================================================================================================================
+ //= NWFTabItemRenderer - implementation
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ void NWFTabItemRenderer::renderBackground() const
+ {
+ Rectangle aBackground( Point(), getTargetDevice().GetOutputSizePixel() );
+ getTargetDevice().DrawRect( aBackground );
+
+ aBackground.Top() = aBackground.Bottom();
+ getTargetDevice().DrawNativeControl( CTRL_TAB_PANE, PART_ENTIRE_CONTROL, aBackground,
+ CTRL_STATE_ENABLED, ImplControlValue(), ::rtl::OUString() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle NWFTabItemRenderer::calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const
+ {
+ const ControlState nState( lcl_ItemToControlState( i_nItemFlags ) );
+
+ TabitemValue tiValue;
+ ImplControlValue aControlValue( (void*)(&tiValue) );
+
+ Region aBoundingRegion, aContentRegion;
+ bool bNativeOK = getTargetDevice().GetNativeControlRegion(
+ CTRL_TAB_ITEM, PART_ENTIRE_CONTROL,
+ i_rContentArea, nState,
+ aControlValue, ::rtl::OUString(),
+ aBoundingRegion, aContentRegion
+ );
+ (void)bNativeOK;
+ OSL_ENSURE( bNativeOK, "NWFTabItemRenderer::calculateDecorations: GetNativeControlRegion not implemented for CTRL_TAB_ITEM?!" );
+
+ return aBoundingRegion.GetBoundRect();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void NWFTabItemRenderer::preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const
+ {
+ const ControlState nState = lcl_ItemToControlState( i_nItemFlags );
+
+ TabitemValue tiValue;
+ if ( i_nItemFlags & ITEM_POSITION_FIRST )
+ tiValue.mnAlignment |= TABITEM_FIRST_IN_GROUP;
+ if ( i_nItemFlags & ITEM_POSITION_LAST )
+ tiValue.mnAlignment |= TABITEM_LAST_IN_GROUP;
+
+ ImplControlValue aControlValue( (void *)(&tiValue) );
+
+ bool bNativeOK = getTargetDevice().DrawNativeControl( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL, i_rContentRect, nState, aControlValue, rtl::OUString() );
+ (void)bNativeOK;
+ OSL_ENSURE( bNativeOK, "NWFTabItemRenderer::preRenderItem: inconsistent NWF implementation!" );
+ // IsNativeControlSupported returned true, previously, otherwise we would not be here ...
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void NWFTabItemRenderer::postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const
+ {
+ (void)i_rActualWindow;
+ (void)i_rItemRect;
+ (void)i_nItemFlags;
+ }
+
+ //==================================================================================================================
+ //= PanelTabBar_Impl
+ //==================================================================================================================
+ class PanelTabBar_Impl : public IToolPanelDeckListener
+ {
+ public:
+ PanelTabBar_Impl( PanelTabBar& i_rTabBar, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent );
+
+ ~PanelTabBar_Impl()
+ {
+ m_rPanelDeck.RemoveListener( *this );
+ }
+
+ // IToolPanelDeckListener
+ virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition )
+ {
+ (void)i_pPanel;
+ (void)i_nPosition;
+ m_bItemsDirty = true;
+ m_rTabBar.Invalidate();
+
+ Relayout();
+ }
+
+ virtual void PanelRemoved( const size_t i_nPosition )
+ {
+ m_bItemsDirty = true;
+ m_rTabBar.Invalidate();
+
+ if ( i_nPosition < m_nScrollPosition )
+ --m_nScrollPosition;
+
+ Relayout();
+ }
+
+ virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
+ virtual void LayouterChanged( const PDeckLayouter& i_rNewLayouter );
+ virtual void Dying();
+
+ void UpdateScrollButtons()
+ {
+ m_aScrollBack.Enable( m_nScrollPosition > 0 );
+ m_aScrollForward.Enable( m_nScrollPosition < m_aItems.size() - 1 );
+ }
+
+ void Relayout();
+ void EnsureItemsCache();
+ ::boost::optional< size_t > FindItemForPoint( const Point& i_rPoint ) const;
+ void DrawItem( const size_t i_nItemIndex, const Rectangle& i_rBoundaries ) const;
+ void InvalidateItem( const size_t i_nItemIndex, const ItemFlags i_nAdditionalItemFlags = 0 ) const;
+ void CopyFromRenderDevice( const Rectangle& i_rLogicalRect ) const;
+ Rectangle GetActualLogicalItemRect( const Rectangle& i_rLogicalItemRect ) const;
+ Rectangle GetItemScreenRect( const size_t i_nItemPos ) const;
+
+ void FocusItem( const ::boost::optional< size_t >& i_rItemPos );
+
+ inline bool IsVertical() const
+ {
+ return ( ( m_eTabAlignment == TABS_LEFT )
+ || ( m_eTabAlignment == TABS_RIGHT )
+ );
+ }
+
+ protected:
+ DECL_LINK( OnScroll, const PushButton* );
+
+ void impl_calcItemRects();
+ Size impl_calculateItemContentSize( const PToolPanel& i_pPanel, const TabItemContent i_eItemContent ) const;
+ void impl_renderItemContent( const PToolPanel& i_pPanel, const Rectangle& i_rContentArea, const TabItemContent i_eItemContent ) const;
+ ItemFlags impl_getItemFlags( const size_t i_nItemIndex ) const;
+
+ public:
+ PanelTabBar& m_rTabBar;
+ TabBarGeometry m_aGeometry;
+ NormalizedArea m_aNormalizer;
+ TabAlignment m_eTabAlignment;
+ IToolPanelDeck& m_rPanelDeck;
+
+ VirtualDevice m_aRenderDevice;
+ PTabBarRenderer m_pRenderer;
+
+ ::boost::optional< size_t > m_aHoveredItem;
+ ::boost::optional< size_t > m_aFocusedItem;
+ bool m_bMouseButtonDown;
+
+ ItemDescriptors m_aItems;
+ bool m_bItemsDirty;
+
+ PushButton m_aScrollBack;
+ PushButton m_aScrollForward;
+
+ size_t m_nScrollPosition;
+ };
+
+ //==================================================================================================================
+ //= helper
+ //==================================================================================================================
+ namespace
+ {
+ //--------------------------------------------------------------------------------------------------------------
+ #if OSL_DEBUG_LEVEL > 0
+ static void lcl_checkConsistency( const PanelTabBar_Impl& i_rImpl )
+ {
+ if ( !i_rImpl.m_bItemsDirty )
+ {
+ if ( i_rImpl.m_rPanelDeck.GetPanelCount() != i_rImpl.m_aItems.size() )
+ {
+ OSL_ENSURE( false, "lcl_checkConsistency: inconsistent array sizes!" );
+ return;
+ }
+ for ( size_t i = 0; i < i_rImpl.m_rPanelDeck.GetPanelCount(); ++i )
+ {
+ if ( i_rImpl.m_rPanelDeck.GetPanel( i ).get() != i_rImpl.m_aItems[i].pPanel.get() )
+ {
+ OSL_ENSURE( false, "lcl_checkConsistency: array elements are inconsistent!" );
+ return;
+ }
+ }
+ }
+ }
+
+ #define DBG_CHECK( data ) \
+ lcl_checkConsistency( data );
+ #else
+ #define DBG_CHECK( data ) \
+ (void)data;
+ #endif
+
+ //--------------------------------------------------------------------------------------------------------------
+ class ClipItemRegion
+ {
+ public:
+ ClipItemRegion( const PanelTabBar_Impl& i_rImpl )
+ :m_rDevice( i_rImpl.m_rTabBar )
+ {
+ m_rDevice.Push( PUSH_CLIPREGION );
+ m_rDevice.SetClipRegion( i_rImpl.m_aNormalizer.getTransformed( i_rImpl.m_aGeometry.getItemsRect(), i_rImpl.m_eTabAlignment ) );
+ }
+
+ ~ClipItemRegion()
+ {
+ m_rDevice.Pop();
+ }
+
+ private:
+ OutputDevice& m_rDevice;
+ };
+ }
+
+ //==================================================================================================================
+ //= PanelTabBar_Impl - implementation
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ PanelTabBar_Impl::PanelTabBar_Impl( PanelTabBar& i_rTabBar, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent )
+ :m_rTabBar( i_rTabBar )
+ ,m_aGeometry( i_eItemContent )
+ ,m_aNormalizer()
+ ,m_eTabAlignment( i_eAlignment )
+ ,m_rPanelDeck( i_rPanelDeck )
+ ,m_aRenderDevice( i_rTabBar )
+ ,m_pRenderer()
+ ,m_aHoveredItem()
+ ,m_aFocusedItem()
+ ,m_bMouseButtonDown( false )
+ ,m_aItems()
+ ,m_bItemsDirty( true )
+ ,m_aScrollBack( &i_rTabBar, WB_BEVELBUTTON )
+ ,m_aScrollForward( &i_rTabBar, WB_BEVELBUTTON )
+ ,m_nScrollPosition( 0 )
+ {
+#ifdef WNT
+ if ( m_aRenderDevice.IsNativeControlSupported( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL ) )
+ // this mode requires the NWF framework to be able to render those items onto a virtual
+ // device. For some frameworks (some GTK themes, in particular), this is known to fail.
+ // So, be on the safe side for the moment.
+ m_pRenderer.reset( new NWFTabItemRenderer( m_aRenderDevice ) );
+ else
+#endif
+ if ( m_aRenderDevice.IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) )
+ m_pRenderer.reset( new NWFToolboxItemRenderer( m_aRenderDevice ) );
+ else
+ m_pRenderer.reset( new VCLItemRenderer( m_aRenderDevice ) );
+
+ m_aRenderDevice.SetLineColor();
+
+ m_rPanelDeck.AddListener( *this );
+
+ m_aScrollBack.SetSymbol( IsVertical() ? SYMBOL_ARROW_UP : SYMBOL_ARROW_LEFT );
+ m_aScrollBack.Show();
+ m_aScrollBack.SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) );
+ m_aScrollBack.SetAccessibleDescription( String( SvtResId( STR_SVT_TOOL_PANEL_BUTTON_FWD ) ) );
+ m_aScrollBack.SetAccessibleName( m_aScrollBack.GetAccessibleDescription() );
+
+ m_aScrollForward.SetSymbol( IsVertical() ? SYMBOL_ARROW_DOWN : SYMBOL_ARROW_RIGHT );
+ m_aScrollForward.Show();
+ m_aScrollForward.SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) );
+ m_aScrollForward.SetAccessibleDescription( String( SvtResId( STR_SVT_TOOL_PANEL_BUTTON_BACK ) ) );
+ m_aScrollForward.SetAccessibleName( m_aScrollForward.GetAccessibleDescription() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar_Impl::impl_calcItemRects()
+ {
+ m_aItems.resize(0);
+
+ Point aCompletePos( m_aGeometry.getFirstItemPosition() );
+ Point aIconOnlyPos( aCompletePos );
+ Point aTextOnlyPos( aCompletePos );
+
+ for ( size_t i = 0;
+ i < m_rPanelDeck.GetPanelCount();
+ ++i
+ )
+ {
+ PToolPanel pPanel( m_rPanelDeck.GetPanel( i ) );
+
+ ItemDescriptor aItem;
+ aItem.pPanel = pPanel;
+
+ Rectangle aContentArea;
+
+ const Size aCompleteSize( impl_calculateItemContentSize( pPanel, TABITEM_IMAGE_AND_TEXT ) );
+ const Size aIconOnlySize( impl_calculateItemContentSize( pPanel, TABITEM_IMAGE_ONLY ) );
+ const Size aTextOnlySize( impl_calculateItemContentSize( pPanel, TABITEM_TEXT_ONLY ) );
+
+ // TODO: have one method calculating all sizes?
+
+ // remember the three areas
+ aItem.aCompleteArea = Rectangle( aCompletePos, aCompleteSize );
+ aItem.aIconOnlyArea = Rectangle( aIconOnlyPos, aIconOnlySize );
+ aItem.aTextOnlyArea = Rectangle( aTextOnlyPos, aTextOnlySize );
+
+ m_aItems.push_back( aItem );
+
+ aCompletePos = aItem.aCompleteArea.TopRight();
+ aIconOnlyPos = aItem.aIconOnlyArea.TopRight();
+ aTextOnlyPos = aItem.aTextOnlyArea.TopRight();
+ }
+
+ m_bItemsDirty = false;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Size PanelTabBar_Impl::impl_calculateItemContentSize( const PToolPanel& i_pPanel, const TabItemContent i_eItemContent ) const
+ {
+ // calculate the size needed for the content
+ OSL_ENSURE( i_eItemContent != TABITEM_AUTO, "PanelTabBar_Impl::impl_calculateItemContentSize: illegal TabItemContent value!" );
+
+ const Image aImage( i_pPanel->GetImage() );
+ const bool bUseImage = !!aImage && ( i_eItemContent != TABITEM_TEXT_ONLY );
+
+ const ::rtl::OUString sItemText( i_pPanel->GetDisplayName() );
+ const bool bUseText = ( sItemText.getLength() != 0 ) && ( i_eItemContent != TABITEM_IMAGE_ONLY );
+
+ Size aItemContentSize;
+ if ( bUseImage )
+ {
+ aItemContentSize = aImage.GetSizePixel();
+ }
+
+ if ( bUseText )
+ {
+ if ( bUseImage )
+ aItemContentSize.Width() += ITEM_ICON_TEXT_DISTANCE;
+
+ // add space for text
+ const Size aTextSize( m_rTabBar.GetCtrlTextWidth( sItemText ), m_rTabBar.GetTextHeight() );
+ aItemContentSize.Width() += aTextSize.Width();
+ aItemContentSize.Height() = ::std::max( aItemContentSize.Height(), aTextSize.Height() );
+
+ aItemContentSize.Width() += 2 * ITEM_TEXT_FLOW_SPACE;
+ }
+
+ if ( !bUseImage && !bUseText )
+ {
+ // have a minimal size - this is pure heuristics, but if it doesn't suit your needs, then give your panels
+ // a name and or image! :)
+ aItemContentSize = Size( 16, 16 );
+ }
+
+ aItemContentSize.Width() += 2 * ITEM_OUTER_SPACE;
+ aItemContentSize.Height() += 2 * ITEM_OUTER_SPACE;
+
+ return aItemContentSize;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar_Impl::impl_renderItemContent( const PToolPanel& i_pPanel, const Rectangle& i_rContentArea, const TabItemContent i_eItemContent ) const
+ {
+ OSL_ENSURE( i_eItemContent != TABITEM_AUTO, "PanelTabBar_Impl::impl_renderItemContent: illegal TabItemContent value!" );
+
+ Rectangle aRenderArea( i_rContentArea );
+ if ( IsVertical() )
+ {
+ aRenderArea.Top() += ITEM_OUTER_SPACE;
+ }
+ else
+ {
+ aRenderArea.Left() += ITEM_OUTER_SPACE;
+ }
+
+ // draw the image
+ const Image aItemImage( i_pPanel->GetImage() );
+ const Size aImageSize( aItemImage.GetSizePixel() );
+ const bool bUseImage = !!aItemImage && ( i_eItemContent != TABITEM_TEXT_ONLY );
+
+ if ( bUseImage )
+ {
+ Point aImagePos;
+ if ( IsVertical() )
+ {
+ aImagePos.X() = aRenderArea.Left() + ( aRenderArea.GetWidth() - aImageSize.Width() ) / 2;
+ aImagePos.Y() = aRenderArea.Top();
+ }
+ else
+ {
+ aImagePos.X() = aRenderArea.Left();
+ aImagePos.Y() = aRenderArea.Top() + ( aRenderArea.GetHeight() - aImageSize.Height() ) / 2;
+ }
+ m_rTabBar.DrawImage( aImagePos, aItemImage );
+ }
+
+ const ::rtl::OUString sItemText( i_pPanel->GetDisplayName() );
+ const bool bUseText = ( sItemText.getLength() != 0 ) && ( i_eItemContent != TABITEM_IMAGE_ONLY );
+
+ if ( bUseText )
+ {
+ if ( IsVertical() )
+ {
+ if ( bUseImage )
+ aRenderArea.Top() += aImageSize.Height() + ITEM_ICON_TEXT_DISTANCE;
+ aRenderArea.Top() += ITEM_TEXT_FLOW_SPACE;
+ }
+ else
+ {
+ if ( bUseImage )
+ aRenderArea.Left() += aImageSize.Width() + ITEM_ICON_TEXT_DISTANCE;
+ aRenderArea.Left() += ITEM_TEXT_FLOW_SPACE;
+ }
+
+ // draw the text
+ const Size aTextSize( m_rTabBar.GetCtrlTextWidth( sItemText ), m_rTabBar.GetTextHeight() );
+ Point aTextPos( aRenderArea.TopLeft() );
+ if ( IsVertical() )
+ {
+ m_rTabBar.Push( PUSH_FONT );
+
+ Font aFont( m_rTabBar.GetFont() );
+ aFont.SetOrientation( 2700 );
+ aFont.SetVertical( TRUE );
+ m_rTabBar.SetFont( aFont );
+
+ aTextPos.X() += aTextSize.Height();
+ aTextPos.X() += ( aRenderArea.GetWidth() - aTextSize.Height() ) / 2;
+ }
+ else
+ {
+ aTextPos.Y() += ( aRenderArea.GetHeight() - aTextSize.Height() ) / 2;
+ }
+
+ m_rTabBar.DrawText( aTextPos, sItemText );
+
+ if ( IsVertical() )
+ {
+ m_rTabBar.Pop();
+ }
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar_Impl::CopyFromRenderDevice( const Rectangle& i_rLogicalRect ) const
+ {
+ BitmapEx aBitmap( m_aRenderDevice.GetBitmapEx(
+ i_rLogicalRect.TopLeft(),
+ Size(
+ i_rLogicalRect.GetSize().Width(),
+ i_rLogicalRect.GetSize().Height()
+ )
+ ) );
+ if ( IsVertical() )
+ {
+ aBitmap.Rotate( 2700, COL_BLACK );
+ if ( m_eTabAlignment == TABS_LEFT )
+ aBitmap.Mirror( BMP_MIRROR_HORZ );
+ }
+ else if ( m_eTabAlignment == TABS_BOTTOM )
+ {
+ aBitmap.Mirror( BMP_MIRROR_VERT );
+ }
+
+ const Rectangle aActualRect( m_aNormalizer.getTransformed( i_rLogicalRect, m_eTabAlignment ) );
+ m_rTabBar.DrawBitmapEx( aActualRect.TopLeft(), aBitmap );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar_Impl::InvalidateItem( const size_t i_nItemIndex, const ItemFlags i_nAdditionalItemFlags ) const
+ {
+ const ItemDescriptor& rItem( m_aItems[ i_nItemIndex ] );
+ const ItemFlags nItemFlags( impl_getItemFlags( i_nItemIndex ) | i_nAdditionalItemFlags );
+
+ const Rectangle aNormalizedContent( GetActualLogicalItemRect( rItem.GetCurrentRect() ) );
+ const Rectangle aNormalizedBounds( m_pRenderer->calculateDecorations( aNormalizedContent, nItemFlags ) );
+
+ const Rectangle aActualBounds = m_aNormalizer.getTransformed( aNormalizedBounds, m_eTabAlignment );
+ m_rTabBar.Invalidate( aActualBounds );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ItemFlags PanelTabBar_Impl::impl_getItemFlags( const size_t i_nItemIndex ) const
+ {
+ ItemFlags nItemFlags( ITEM_STATE_NORMAL );
+ if ( m_aHoveredItem == i_nItemIndex )
+ {
+ nItemFlags |= ITEM_STATE_HOVERED;
+ if ( m_bMouseButtonDown )
+ nItemFlags |= ITEM_STATE_ACTIVE;
+ }
+
+ if ( m_rPanelDeck.GetActivePanel() == i_nItemIndex )
+ nItemFlags |= ITEM_STATE_ACTIVE;
+
+ if ( m_aFocusedItem == i_nItemIndex )
+ nItemFlags |= ITEM_STATE_FOCUSED;
+
+ if ( 0 == i_nItemIndex )
+ nItemFlags |= ITEM_POSITION_FIRST;
+
+ if ( m_rPanelDeck.GetPanelCount() - 1 == i_nItemIndex )
+ nItemFlags |= ITEM_POSITION_LAST;
+
+ return nItemFlags;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar_Impl::DrawItem( const size_t i_nItemIndex, const Rectangle& i_rBoundaries ) const
+ {
+ const ItemDescriptor& rItem( m_aItems[ i_nItemIndex ] );
+ const ItemFlags nItemFlags( impl_getItemFlags( i_nItemIndex ) );
+
+ // the normalized bounding and content rect
+ const Rectangle aNormalizedContent( GetActualLogicalItemRect( rItem.GetCurrentRect() ) );
+ const Rectangle aNormalizedBounds( m_pRenderer->calculateDecorations( aNormalizedContent, nItemFlags ) );
+
+ // check whether the item actually overlaps with the painting area
+ if ( !i_rBoundaries.IsEmpty() )
+ {
+ const Rectangle aItemRect( GetActualLogicalItemRect( rItem.GetCurrentRect() ) );
+ if ( !aItemRect.IsOver( i_rBoundaries ) )
+ return;
+ }
+
+ m_rTabBar.SetUpdateMode( FALSE );
+
+ // the aligned bounding and content rect
+ const Rectangle aActualBounds = m_aNormalizer.getTransformed( aNormalizedBounds, m_eTabAlignment );
+ const Rectangle aActualContent = m_aNormalizer.getTransformed( aNormalizedContent, m_eTabAlignment );
+
+ // render item "background" layer
+ m_pRenderer->preRenderItem( aNormalizedContent, nItemFlags );
+
+ // copy from the virtual device to ourself
+ CopyFromRenderDevice( aNormalizedBounds );
+
+ // render the actual item content
+ impl_renderItemContent( rItem.pPanel, aActualContent, rItem.eContent );
+
+ // render item "foreground" layer
+ m_pRenderer->postRenderItem( m_rTabBar, aActualBounds, nItemFlags );
+
+ m_rTabBar.SetUpdateMode( TRUE );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar_Impl::EnsureItemsCache()
+ {
+ if ( m_bItemsDirty == false )
+ {
+ DBG_CHECK( *this );
+ return;
+ }
+ impl_calcItemRects();
+ OSL_POSTCOND( m_bItemsDirty == false, "PanelTabBar_Impl::EnsureItemsCache: cache still dirty!" );
+ DBG_CHECK( *this );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar_Impl::Relayout()
+ {
+ EnsureItemsCache();
+
+ const Size aOutputSize( m_rTabBar.GetOutputSizePixel() );
+ m_aNormalizer = NormalizedArea( Rectangle( Point(), aOutputSize ), IsVertical() );
+ const Size aLogicalOutputSize( m_aNormalizer.getReferenceSize() );
+
+ // forward actual output size to our render device
+ m_aRenderDevice.SetOutputSizePixel( aLogicalOutputSize );
+
+ // re-calculate the size of the scroll buttons and of the items
+ m_aGeometry.relayout( aLogicalOutputSize, m_aItems );
+
+ if ( m_aGeometry.getButtonBackRect().IsEmpty() )
+ {
+ m_aScrollBack.Hide();
+ }
+ else
+ {
+ const Rectangle aButtonBack( m_aNormalizer.getTransformed( m_aGeometry.getButtonBackRect(), m_eTabAlignment ) );
+ m_aScrollBack.SetPosSizePixel( aButtonBack.TopLeft(), aButtonBack.GetSize() );
+ m_aScrollBack.Show();
+ }
+
+ if ( m_aGeometry.getButtonForwardRect().IsEmpty() )
+ {
+ m_aScrollForward.Hide();
+ }
+ else
+ {
+ const Rectangle aButtonForward( m_aNormalizer.getTransformed( m_aGeometry.getButtonForwardRect(), m_eTabAlignment ) );
+ m_aScrollForward.SetPosSizePixel( aButtonForward.TopLeft(), aButtonForward.GetSize() );
+ m_aScrollForward.Show();
+ }
+
+ UpdateScrollButtons();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::boost::optional< size_t > PanelTabBar_Impl::FindItemForPoint( const Point& i_rPoint ) const
+ {
+ Point aPoint( IsVertical() ? i_rPoint.Y() : i_rPoint.X(), IsVertical() ? i_rPoint.X() : i_rPoint.Y() );
+
+ if ( !m_aGeometry.getItemsRect().IsInside( aPoint ) )
+ return ::boost::optional< size_t >();
+
+ size_t i=0;
+ for ( ItemDescriptors::const_iterator item = m_aItems.begin();
+ item != m_aItems.end();
+ ++item, ++i
+ )
+ {
+ Rectangle aItemRect( GetActualLogicalItemRect( item->GetCurrentRect() ) );
+ if ( aItemRect.IsInside( aPoint ) )
+ {
+ return ::boost::optional< size_t >( i );
+ }
+ }
+ return ::boost::optional< size_t >();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle PanelTabBar_Impl::GetItemScreenRect( const size_t i_nItemPos ) const
+ {
+ ENSURE_OR_RETURN( i_nItemPos < m_aItems.size(), "PanelTabBar_Impl::GetItemScreenRect: invalid item pos!", Rectangle() );
+ const ItemDescriptor& rItem( m_aItems[ i_nItemPos ] );
+ const Rectangle aItemRect( m_aNormalizer.getTransformed(
+ GetActualLogicalItemRect( rItem.GetCurrentRect() ),
+ m_eTabAlignment ) );
+
+ const Rectangle aTabBarRect( m_rTabBar.GetWindowExtentsRelative( NULL ) );
+ return Rectangle(
+ Point( aTabBarRect.Left() + aItemRect.Left(), aTabBarRect.Top() + aItemRect.Top() ),
+ aItemRect.GetSize()
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar_Impl::FocusItem( const ::boost::optional< size_t >& i_rItemPos )
+ {
+ // reset old focus item
+ if ( !!m_aFocusedItem )
+ InvalidateItem( *m_aFocusedItem );
+ m_aFocusedItem.reset();
+
+ // mark the active icon as focused
+ if ( !!i_rItemPos )
+ {
+ m_aFocusedItem = i_rItemPos;
+ InvalidateItem( *m_aFocusedItem );
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ IMPL_LINK( PanelTabBar_Impl, OnScroll, const PushButton*, i_pButton )
+ {
+ if ( i_pButton == &m_aScrollBack )
+ {
+ OSL_ENSURE( m_nScrollPosition > 0, "PanelTabBar_Impl::OnScroll: inconsistency!" );
+ --m_nScrollPosition;
+ m_rTabBar.Invalidate();
+ }
+ else if ( i_pButton == &m_aScrollForward )
+ {
+ OSL_ENSURE( m_nScrollPosition < m_aItems.size() - 1, "PanelTabBar_Impl::OnScroll: inconsistency!" );
+ ++m_nScrollPosition;
+ m_rTabBar.Invalidate();
+ }
+
+ UpdateScrollButtons();
+
+ return 0L;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle PanelTabBar_Impl::GetActualLogicalItemRect( const Rectangle& i_rLogicalItemRect ) const
+ {
+ // care for the offset imposed by our geometry, i.e. whether or not we have scroll buttons
+ Rectangle aItemRect( i_rLogicalItemRect );
+ aItemRect.Move( m_aGeometry.getItemsRect().Left() - m_aGeometry.getButtonBackRect().Left(), 0 );
+
+ // care for the current scroll position
+ OSL_ENSURE( m_nScrollPosition < m_aItems.size(), "GetActualLogicalItemRect: invalid scroll position!" );
+ if ( ( m_nScrollPosition > 0 ) && ( m_nScrollPosition < m_aItems.size() ) )
+ {
+ long nOffsetX = m_aItems[ m_nScrollPosition ].GetCurrentRect().Left() - m_aItems[ 0 ].GetCurrentRect().Left();
+ long nOffsetY = m_aItems[ m_nScrollPosition ].GetCurrentRect().Top() - m_aItems[ 0 ].GetCurrentRect().Top();
+ aItemRect.Move( -nOffsetX, -nOffsetY );
+ }
+
+ return aItemRect;
+ }
+
+ //==================================================================================================================
+ //= PanelTabBar_Impl
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
+ {
+ EnsureItemsCache();
+
+ if ( !!i_rOldActive )
+ InvalidateItem( *i_rOldActive, ITEM_STATE_ACTIVE );
+ if ( !!i_rNewActive )
+ InvalidateItem( *i_rNewActive );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar_Impl::LayouterChanged( const PDeckLayouter& i_rNewLayouter )
+ {
+ // not interested in
+ (void)i_rNewLayouter;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar_Impl::Dying()
+ {
+ // not interested in - the notifier is a member of this instance here, so we're dying ourself at the moment
+ }
+
+ //==================================================================================================================
+ //= PanelTabBar
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ PanelTabBar::PanelTabBar( Window& i_rParentWindow, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent )
+ :Control( &i_rParentWindow, 0 )
+ ,m_pImpl( new PanelTabBar_Impl( *this, i_rPanelDeck, i_eAlignment, i_eItemContent ) )
+ {
+ DBG_CHECK( *m_pImpl );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ PanelTabBar::~PanelTabBar()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ TabItemContent PanelTabBar::GetTabItemContent() const
+ {
+ return m_pImpl->m_aGeometry.getItemContent();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar::SetTabItemContent( const TabItemContent& i_eItemContent )
+ {
+ m_pImpl->m_aGeometry.setItemContent( i_eItemContent );
+ m_pImpl->Relayout();
+ Invalidate();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ IToolPanelDeck& PanelTabBar::GetPanelDeck() const
+ {
+ DBG_CHECK( *m_pImpl );
+ return m_pImpl->m_rPanelDeck;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Size PanelTabBar::GetOptimalSize( WindowSizeType i_eType ) const
+ {
+ m_pImpl->EnsureItemsCache();
+ Size aOptimalSize( m_pImpl->m_aGeometry.getOptimalSize( m_pImpl->m_aItems, i_eType == WINDOWSIZE_MINIMUM ) );
+ if ( m_pImpl->IsVertical() )
+ ::std::swap( aOptimalSize.Width(), aOptimalSize.Height() );
+ return aOptimalSize;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar::Resize()
+ {
+ Control::Resize();
+ m_pImpl->Relayout();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar::Paint( const Rectangle& i_rRect )
+ {
+ m_pImpl->EnsureItemsCache();
+
+ // background
+ const Rectangle aNormalizedPaintArea( m_pImpl->m_aNormalizer.getNormalized( i_rRect, m_pImpl->m_eTabAlignment ) );
+ m_pImpl->m_aRenderDevice.Push( PUSH_CLIPREGION );
+ m_pImpl->m_aRenderDevice.SetClipRegion( aNormalizedPaintArea );
+ m_pImpl->m_pRenderer->renderBackground();
+ m_pImpl->m_aRenderDevice.Pop();
+ m_pImpl->CopyFromRenderDevice( aNormalizedPaintArea );
+
+ // ensure the items really paint into their own playground only
+ ClipItemRegion aClipItems( *m_pImpl );
+
+ const Rectangle aLogicalPaintRect( m_pImpl->m_aNormalizer.getNormalized( i_rRect, m_pImpl->m_eTabAlignment ) );
+
+ const ::boost::optional< size_t > aActivePanel( m_pImpl->m_rPanelDeck.GetActivePanel() );
+ const ::boost::optional< size_t > aHoveredPanel( m_pImpl->m_aHoveredItem );
+
+ // items:
+ // 1. paint all non-active, non-hovered items
+ size_t i=0;
+ for ( ItemDescriptors::const_iterator item = m_pImpl->m_aItems.begin();
+ item != m_pImpl->m_aItems.end();
+ ++item, ++i
+ )
+ {
+ if ( i == aActivePanel )
+ continue;
+
+ if ( aHoveredPanel == i )
+ continue;
+
+ m_pImpl->DrawItem( i, aLogicalPaintRect );
+ }
+
+ // 2. paint the item which is hovered, /without/ the mouse button pressed down
+ if ( !!aHoveredPanel && !m_pImpl->m_bMouseButtonDown )
+ m_pImpl->DrawItem( *aHoveredPanel, aLogicalPaintRect );
+
+ // 3. paint the active item
+ if ( !!aActivePanel )
+ m_pImpl->DrawItem( *aActivePanel, aLogicalPaintRect );
+
+ // 4. paint the item which is hovered, /with/ the mouse button pressed down
+ if ( !!aHoveredPanel && m_pImpl->m_bMouseButtonDown )
+ m_pImpl->DrawItem( *aHoveredPanel, aLogicalPaintRect );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar::MouseMove( const MouseEvent& i_rMouseEvent )
+ {
+ m_pImpl->EnsureItemsCache();
+
+ ::boost::optional< size_t > aOldItem( m_pImpl->m_aHoveredItem );
+ ::boost::optional< size_t > aNewItem( m_pImpl->FindItemForPoint( i_rMouseEvent.GetPosPixel() ) );
+
+ if ( i_rMouseEvent.IsLeaveWindow() )
+ aNewItem.reset();
+
+ if ( aOldItem != aNewItem )
+ {
+ if ( !!aOldItem )
+ m_pImpl->InvalidateItem( *aOldItem );
+
+ m_pImpl->m_aHoveredItem = aNewItem;
+
+ if ( !!aNewItem )
+ m_pImpl->InvalidateItem( *aNewItem );
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar::MouseButtonDown( const MouseEvent& i_rMouseEvent )
+ {
+ Control::MouseButtonDown( i_rMouseEvent );
+
+ if ( !i_rMouseEvent.IsLeft() )
+ return;
+
+ m_pImpl->EnsureItemsCache();
+
+ ::boost::optional< size_t > aHitItem( m_pImpl->FindItemForPoint( i_rMouseEvent.GetPosPixel() ) );
+ if ( !aHitItem )
+ return;
+
+ CaptureMouse();
+ m_pImpl->m_bMouseButtonDown = true;
+
+ m_pImpl->InvalidateItem( *aHitItem );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar::MouseButtonUp( const MouseEvent& i_rMouseEvent )
+ {
+ Control::MouseButtonUp( i_rMouseEvent );
+
+ if ( m_pImpl->m_bMouseButtonDown )
+ {
+ ::boost::optional< size_t > aHitItem( m_pImpl->FindItemForPoint( i_rMouseEvent.GetPosPixel() ) );
+ if ( !!aHitItem )
+ {
+ // re-draw that item now that we're not in mouse-down mode anymore
+ m_pImpl->InvalidateItem( *aHitItem );
+ // activate the respective panel
+ m_pImpl->m_rPanelDeck.ActivatePanel( *aHitItem );
+ }
+
+ OSL_ENSURE( IsMouseCaptured(), "PanelTabBar::MouseButtonUp: inconsistency!" );
+ if ( IsMouseCaptured() )
+ ReleaseMouse();
+ m_pImpl->m_bMouseButtonDown = false;
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar::RequestHelp( const HelpEvent& i_rHelpEvent )
+ {
+ m_pImpl->EnsureItemsCache();
+
+ ::boost::optional< size_t > aHelpItem( m_pImpl->FindItemForPoint( ScreenToOutputPixel( i_rHelpEvent.GetMousePosPixel() ) ) );
+ if ( !aHelpItem )
+ return;
+
+ const ItemDescriptor& rItem( m_pImpl->m_aItems[ *aHelpItem ] );
+ if ( rItem.eContent != TABITEM_IMAGE_ONLY )
+ // if the text is displayed for the item, we do not need to show it as tooltip
+ return;
+
+ const ::rtl::OUString sItemText( rItem.pPanel->GetDisplayName() );
+ if ( i_rHelpEvent.GetMode() == HELPMODE_BALLOON )
+ Help::ShowBalloon( this, OutputToScreenPixel( rItem.GetCurrentRect().Center() ), rItem.GetCurrentRect(), sItemText );
+ else
+ Help::ShowQuickHelp( this, rItem.GetCurrentRect(), sItemText );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar::GetFocus()
+ {
+ Control::GetFocus();
+ if ( !m_pImpl->m_aFocusedItem )
+ m_pImpl->FocusItem( m_pImpl->m_rPanelDeck.GetActivePanel() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar::LoseFocus()
+ {
+ Control::LoseFocus();
+
+ if ( !!m_pImpl->m_aFocusedItem )
+ {
+ m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem );
+ }
+
+ m_pImpl->m_aFocusedItem.reset();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ class KeyInputHandler
+ {
+ public:
+ KeyInputHandler( Control& i_rControl, const KeyEvent& i_rKeyEvent )
+ :m_rControl( i_rControl )
+ ,m_rKeyEvent( i_rKeyEvent )
+ ,m_bHandled( false )
+ {
+ }
+
+ ~KeyInputHandler()
+ {
+ if ( !m_bHandled )
+ m_rControl.Control::KeyInput( m_rKeyEvent );
+ }
+
+ void setHandled()
+ {
+ m_bHandled = true;
+ }
+
+ private:
+ Control& m_rControl;
+ const KeyEvent& m_rKeyEvent;
+ bool m_bHandled;
+ };
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar::KeyInput( const KeyEvent& i_rKeyEvent )
+ {
+ KeyInputHandler aKeyInputHandler( *this, i_rKeyEvent );
+
+ const KeyCode& rKeyCode( i_rKeyEvent.GetKeyCode() );
+ if ( rKeyCode.GetModifier() != 0 )
+ // only interested in mere key presses
+ return;
+
+ // if there are less than 2 panels, we cannot travel them ...
+ const size_t nPanelCount( m_pImpl->m_rPanelDeck.GetPanelCount() );
+ if ( nPanelCount < 2 )
+ return;
+
+ OSL_PRECOND( !!m_pImpl->m_aFocusedItem, "PanelTabBar::KeyInput: we should have a focused item here!" );
+ // if we get KeyInput events, we should have the focus. In this case, m_aFocusedItem should not be empty,
+ // except if there are no panels, but then we bail out of this method here earlier ...
+
+ bool bFocusNext = false;
+ bool bFocusPrev = false;
+
+ switch ( rKeyCode.GetCode() )
+ {
+ case KEY_UP: bFocusPrev = true; break;
+ case KEY_DOWN: bFocusNext = true; break;
+ case KEY_LEFT:
+ if ( IsRTLEnabled() )
+ bFocusNext = true;
+ else
+ bFocusPrev = true;
+ break;
+ case KEY_RIGHT:
+ if ( IsRTLEnabled() )
+ bFocusPrev = true;
+ else
+ bFocusNext = true;
+ break;
+ case KEY_RETURN:
+ m_pImpl->m_rPanelDeck.ActivatePanel( *m_pImpl->m_aFocusedItem );
+ break;
+ }
+
+ if ( !bFocusNext && !bFocusPrev )
+ return;
+
+ m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem );
+ if ( bFocusNext )
+ {
+ m_pImpl->m_aFocusedItem.reset( ( *m_pImpl->m_aFocusedItem + 1 ) % nPanelCount );
+ }
+ else
+ {
+ m_pImpl->m_aFocusedItem.reset( ( *m_pImpl->m_aFocusedItem + nPanelCount - 1 ) % nPanelCount );
+ }
+ m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem );
+
+ // don't delegate to base class
+ aKeyInputHandler.setHandled();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar::DataChanged( const DataChangedEvent& i_rDataChanedEvent )
+ {
+ Control::DataChanged( i_rDataChanedEvent );
+
+ if ( ( i_rDataChanedEvent.GetType() == DATACHANGED_SETTINGS )
+ && ( ( i_rDataChanedEvent.GetFlags() & SETTINGS_STYLE ) != 0 )
+ )
+ {
+ Invalidate();
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool PanelTabBar::IsVertical() const
+ {
+ return m_pImpl->IsVertical();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ PushButton& PanelTabBar::GetScrollButton( const bool i_bForward )
+ {
+ return i_bForward ? m_pImpl->m_aScrollForward : m_pImpl->m_aScrollBack;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::boost::optional< size_t > PanelTabBar::GetFocusedPanelItem() const
+ {
+ return m_pImpl->m_aFocusedItem;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar::FocusPanelItem( const size_t i_nItemPos )
+ {
+ ENSURE_OR_RETURN_VOID( i_nItemPos < m_pImpl->m_rPanelDeck.GetPanelCount(), "PanelTabBar::FocusPanelItem: illegal item pos!" );
+
+ if ( !HasChildPathFocus() )
+ GrabFocus();
+
+ m_pImpl->FocusItem( i_nItemPos );
+ OSL_POSTCOND( !!m_pImpl->m_aFocusedItem, "PanelTabBar::FocusPanelItem: have the focus, but no focused item?" );
+ if ( !!m_pImpl->m_aFocusedItem )
+ m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem );
+ m_pImpl->m_aFocusedItem.reset( i_nItemPos );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle PanelTabBar::GetItemScreenRect( const size_t i_nItemPos ) const
+ {
+ return m_pImpl->GetItemScreenRect( i_nItemPos );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XWindowPeer > PanelTabBar::GetComponentInterface( BOOL i_bCreate )
+ {
+ Reference< XWindowPeer > xWindowPeer( Control::GetComponentInterface( FALSE ) );
+ if ( !xWindowPeer.is() && i_bCreate )
+ {
+ xWindowPeer.set( new PanelTabBarPeer( *this ) );
+ SetComponentInterface( xWindowPeer );
+ }
+ return xWindowPeer;
+ }
+
+//........................................................................
+} // namespace svt
+//........................................................................
diff --git a/svtools/source/toolpanel/paneltabbarpeer.cxx b/svtools/source/toolpanel/paneltabbarpeer.cxx
new file mode 100644
index 000000000000..d8329109ffb4
--- /dev/null
+++ b/svtools/source/toolpanel/paneltabbarpeer.cxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ * 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 "paneltabbarpeer.hxx"
+#include "svtools/toolpanel/paneltabbar.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/DisposedException.hpp>
+/** === end UNO includes === **/
+
+#include <tools/diagnose_ex.h>
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ /** === 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::accessibility::XAccessibleContext;
+ using ::com::sun::star::lang::DisposedException;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= PanelTabBarPeer
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ PanelTabBarPeer::PanelTabBarPeer( PanelTabBar& i_rTabBar )
+ :VCLXWindow()
+ ,m_pTabBar( &i_rTabBar )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ PanelTabBarPeer::~PanelTabBarPeer()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessibleContext > PanelTabBarPeer::CreateAccessibleContext()
+ {
+ ::vos::OGuard aSolarGuard( GetMutex() );
+ if ( m_pTabBar == NULL )
+ throw DisposedException( ::rtl::OUString(), *this );
+
+
+
+ Window* pAccessibleParent( m_pTabBar->GetAccessibleParentWindow() );
+ ENSURE_OR_RETURN( pAccessibleParent != NULL, "no accessible parent => no accessible context", NULL );
+ Reference< XAccessible > xAccessibleParent( pAccessibleParent->GetAccessible(), UNO_SET_THROW );
+ return m_aAccessibleFactory.getFactory().createAccessibleToolPanelTabBar( xAccessibleParent, m_pTabBar->GetPanelDeck(), *m_pTabBar );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL PanelTabBarPeer::dispose() throw(RuntimeException)
+ {
+ {
+ ::vos::OGuard aSolarGuard( GetMutex() );
+ m_pTabBar = NULL;
+ }
+ VCLXWindow::dispose();
+ }
+
+//........................................................................
+} // namespace svt
+//........................................................................
diff --git a/svtools/source/toolpanel/paneltabbarpeer.hxx b/svtools/source/toolpanel/paneltabbarpeer.hxx
new file mode 100644
index 000000000000..7c2e5188d994
--- /dev/null
+++ b/svtools/source/toolpanel/paneltabbarpeer.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ * 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 SVT_PANELTABBARPEER_HXX
+#define SVT_PANELTABBARPEER_HXX
+
+#include "svtaccessiblefactory.hxx"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+#include <toolkit/awt/vclxwindow.hxx>
+
+//......................................................................................................................
+namespace svt
+{
+//......................................................................................................................
+
+ class PanelTabBar;
+ //====================================================================
+ //= PanelTabBarPeer
+ //====================================================================
+ class PanelTabBarPeer : public VCLXWindow
+ {
+ public:
+ PanelTabBarPeer( PanelTabBar& i_rTabBar );
+
+ protected:
+ ~PanelTabBarPeer();
+
+ // VCLXWindow overridables
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext();
+
+ // XComponent
+ void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+
+ private:
+ AccessibleFactoryAccess m_aAccessibleFactory;
+ PanelTabBar* m_pTabBar;
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_PANELTABBARPEER_HXX
diff --git a/svtools/source/toolpanel/refbase.cxx b/svtools/source/toolpanel/refbase.cxx
new file mode 100644
index 000000000000..f41aa2d9bb9c
--- /dev/null
+++ b/svtools/source/toolpanel/refbase.cxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ * 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 "svtools/toolpanel/refbase.hxx"
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //====================================================================
+ //= RefBase
+ //====================================================================
+ //--------------------------------------------------------------------
+ oslInterlockedCount SAL_CALL RefBase::acquire()
+ {
+ return osl_incrementInterlockedCount( &m_refCount );
+ }
+
+ //--------------------------------------------------------------------
+ oslInterlockedCount SAL_CALL RefBase::release()
+ {
+ oslInterlockedCount newCount = osl_decrementInterlockedCount( &m_refCount );
+ if ( 0 == newCount )
+ delete this;
+ return newCount;
+ }
+
+//........................................................................
+} // namespace svt
+//........................................................................
diff --git a/svtools/source/toolpanel/tabbargeometry.cxx b/svtools/source/toolpanel/tabbargeometry.cxx
new file mode 100644
index 000000000000..45c40cee6ef2
--- /dev/null
+++ b/svtools/source/toolpanel/tabbargeometry.cxx
@@ -0,0 +1,328 @@
+/*************************************************************************
+ * 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 "tabbargeometry.hxx"
+
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/numeric/ftools.hxx>
+
+#include <vcl/window.hxx>
+
+#include <algorithm>
+
+// the width (or height, depending on alignment) of the scroll buttons
+#define BUTTON_FLOW_WIDTH 20
+// the space between the scroll buttons and the items
+#define BUTTON_FLOW_SPACE 2
+// outer space to apply between the tab bar borders and any content. Note that those refer to a "normalized" geometry,
+// i.e. if the tab bar were aligned at the top
+#define OUTER_SPACE_LEFT 2
+#define OUTER_SPACE_TOP 4
+#define OUTER_SPACE_RIGHT 4
+#define OUTER_SPACE_BOTTOM 2
+
+// outer space to apply between the area for the items, and the actual items. They refer to a normalized geometry.
+#define ITEMS_INSET_LEFT 4
+#define ITEMS_INSET_TOP 3
+#define ITEMS_INSET_RIGHT 4
+#define ITEMS_INSET_BOTTOM 0
+
+//......................................................................................................................
+namespace svt
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= helper
+ //==================================================================================================================
+ namespace
+ {
+ //--------------------------------------------------------------------------------------------------------------
+ static void lcl_transform( Rectangle& io_rRect, const ::basegfx::B2DHomMatrix& i_rTransformation )
+ {
+ ::basegfx::B2DRange aRect( io_rRect.Left(), io_rRect.Top(), io_rRect.Right(), io_rRect.Bottom() );
+ aRect.transform( i_rTransformation );
+ io_rRect.Left() = long( aRect.getMinX() );
+ io_rRect.Top() = long( aRect.getMinY() );
+ io_rRect.Right() = long( aRect.getMaxX() );
+ io_rRect.Bottom() = long( aRect.getMaxY() );
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ /** transforms the given, possible rotated playground,
+ */
+ void lcl_rotate( const Rectangle& i_rReference, Rectangle& io_rArea, const bool i_bRight )
+ {
+ // step 1: move the to-be-upper-left corner (left/bottom) of the rectangle to (0,0)
+ ::basegfx::B2DHomMatrix aTransformation;
+ aTransformation.translate(
+ i_bRight ? -i_rReference.Left() : -i_rReference.Right(),
+ i_bRight ? -i_rReference.Bottom() : -i_rReference.Top()
+ );
+
+ // step 2: rotate by -90 degrees
+ aTransformation.rotate( i_bRight ? +F_PI2 : -F_PI2 );
+ // note:
+ // on the screen, the ordinate goes top-down, while basegfx calculates in a system where the
+ // ordinate goes bottom-up; thus the "wrong" sign before F_PI2 here
+
+ // step 3: move back to original coordinates
+ aTransformation.translate( i_rReference.Left(), i_rReference.Top() );
+
+ // apply transformation
+ lcl_transform( io_rArea, aTransformation );
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void lcl_mirrorHorizontally( const Rectangle& i_rReferenceArea, Rectangle& io_rArea )
+ {
+ io_rArea.Left() = i_rReferenceArea.Left() + i_rReferenceArea.Right() - io_rArea.Left();
+ io_rArea.Right() = i_rReferenceArea.Left() + i_rReferenceArea.Right() - io_rArea.Right();
+ ::std::swap( io_rArea.Left(), io_rArea.Right() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void lcl_mirrorVertically( const Rectangle& i_rReferenceArea, Rectangle& io_rArea )
+ {
+ io_rArea.Top() = i_rReferenceArea.Top() + i_rReferenceArea.Bottom() - io_rArea.Top();
+ io_rArea.Bottom() = i_rReferenceArea.Top() + i_rReferenceArea.Bottom() - io_rArea.Bottom();
+ ::std::swap( io_rArea.Top(), io_rArea.Bottom() );
+ }
+
+ //==================================================================================================================
+ //= NormalizedArea
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ NormalizedArea::NormalizedArea()
+ :m_aReference()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ NormalizedArea::NormalizedArea( const Rectangle& i_rReference, const bool i_bIsVertical )
+ :m_aReference( i_bIsVertical ? Rectangle( i_rReference.TopLeft(), Size( i_rReference.GetHeight(), i_rReference.GetWidth() ) ) : i_rReference )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle NormalizedArea::getTransformed( const Rectangle& i_rArea, const TabAlignment i_eTargetAlignment ) const
+ {
+ Rectangle aResult( i_rArea );
+
+ if ( ( i_eTargetAlignment == TABS_RIGHT )
+ || ( i_eTargetAlignment == TABS_LEFT )
+ )
+ {
+ lcl_rotate( m_aReference, aResult, true );
+
+ if ( i_eTargetAlignment == TABS_LEFT )
+ {
+ Rectangle aReference( m_aReference );
+ aReference.Transpose();
+ lcl_mirrorHorizontally( aReference, aResult );
+ }
+ }
+ else
+ if ( i_eTargetAlignment == TABS_BOTTOM )
+ {
+ lcl_mirrorVertically( m_aReference, aResult );
+ }
+
+ return aResult;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle NormalizedArea::getNormalized( const Rectangle& i_rArea, const TabAlignment i_eTargetAlignment ) const
+ {
+ Rectangle aResult( i_rArea );
+
+ if ( ( i_eTargetAlignment == TABS_RIGHT )
+ || ( i_eTargetAlignment == TABS_LEFT )
+ )
+ {
+ Rectangle aReference( m_aReference );
+ lcl_rotate( m_aReference, aReference, true );
+
+ if ( i_eTargetAlignment == TABS_LEFT )
+ {
+ lcl_mirrorHorizontally( aReference, aResult );
+ }
+
+ lcl_rotate( aReference, aResult, false );
+ }
+ else
+ if ( i_eTargetAlignment == TABS_BOTTOM )
+ {
+ lcl_mirrorVertically( m_aReference, aResult );
+ }
+ return aResult;
+ }
+
+ //==================================================================================================================
+ //= TabBarGeometry
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ TabBarGeometry::TabBarGeometry( const TabItemContent i_eItemContent )
+ :m_eTabItemContent( i_eItemContent )
+ ,m_aItemsInset()
+ ,m_aButtonBackRect()
+ ,m_aItemsRect()
+ ,m_aButtonForwardRect()
+ {
+ m_aItemsInset.Left() = ITEMS_INSET_LEFT;
+ m_aItemsInset.Top() = ITEMS_INSET_TOP;
+ m_aItemsInset.Right() = ITEMS_INSET_RIGHT;
+ m_aItemsInset.Bottom() = ITEMS_INSET_BOTTOM;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ TabBarGeometry::~TabBarGeometry()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool TabBarGeometry::impl_fitItems( ItemDescriptors& io_rItems ) const
+ {
+ if ( io_rItems.empty() )
+ // nothing to do, "no items" perfectly fit into any space we have ...
+ return true;
+
+ // the available size
+ Size aOutputSize( getItemsRect().GetSize() );
+ // shrunk by the outer space
+ aOutputSize.Width() -= m_aItemsInset.Right();
+ aOutputSize.Height() -= m_aItemsInset.Bottom();
+ const Rectangle aFitInto( Point( 0, 0 ), aOutputSize );
+
+ TabItemContent eItemContent( getItemContent() );
+ if ( eItemContent == TABITEM_AUTO )
+ {
+ // the "content modes" to try
+ TabItemContent eTryThis[] =
+ {
+ TABITEM_IMAGE_ONLY, // assumed to have the smallest rects
+ TABITEM_TEXT_ONLY,
+ TABITEM_IMAGE_AND_TEXT // assumed to have the largest rects
+ };
+
+
+ // determine which of the different version fits
+ eItemContent = eTryThis[0];
+ size_t nTryIndex = 2;
+ while ( nTryIndex > 0 )
+ {
+ const Point aBottomRight( io_rItems.rbegin()->GetRect( eTryThis[ nTryIndex ] ).BottomRight() );
+ if ( aFitInto.IsInside( aBottomRight ) )
+ {
+ eItemContent = eTryThis[ nTryIndex ];
+ break;
+ }
+ --nTryIndex;
+ }
+ }
+
+ // propagate to the items
+ for ( ItemDescriptors::iterator item = io_rItems.begin();
+ item != io_rItems.end();
+ ++item
+ )
+ {
+ item->eContent = eItemContent;
+ }
+
+ const ItemDescriptor& rLastItem( *io_rItems.rbegin() );
+ const Point aLastItemBottomRight( rLastItem.GetCurrentRect().BottomRight() );
+ return aFitInto.Left() <= aLastItemBottomRight.X()
+ && aFitInto.Right() >= aLastItemBottomRight.X();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Size TabBarGeometry::getOptimalSize( ItemDescriptors& io_rItems, const bool i_bMinimalSize ) const
+ {
+ if ( io_rItems.empty() )
+ return Size(
+ m_aItemsInset.Left() + m_aItemsInset.Right(),
+ m_aItemsInset.Top() + m_aItemsInset.Bottom()
+ );
+
+ // the rect of the last item
+ const Rectangle& rLastItemRect( i_bMinimalSize ? io_rItems.rbegin()->aIconOnlyArea : io_rItems.rbegin()->aCompleteArea );
+ return Size(
+ rLastItemRect.Left() + 1 + m_aItemsInset.Right(),
+ rLastItemRect.Top() + 1 + rLastItemRect.Bottom() + m_aItemsInset.Bottom()
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TabBarGeometry::relayout( const Size& i_rActualOutputSize, ItemDescriptors& io_rItems )
+ {
+ // assume all items fit
+ Point aButtonBackPos( OUTER_SPACE_LEFT, OUTER_SPACE_TOP );
+ m_aButtonBackRect = Rectangle( aButtonBackPos, Size( 1, 1 ) );
+ m_aButtonBackRect.SetEmpty();
+
+ Point aButtonForwardPos( i_rActualOutputSize.Width(), OUTER_SPACE_TOP );
+ m_aButtonForwardRect = Rectangle( aButtonForwardPos, Size( 1, 1 ) );
+ m_aButtonForwardRect.SetEmpty();
+
+ Point aItemsPos( OUTER_SPACE_LEFT, 0 );
+ Size aItemsSize( i_rActualOutputSize.Width() - OUTER_SPACE_LEFT - OUTER_SPACE_RIGHT, i_rActualOutputSize.Height() );
+ m_aItemsRect = Rectangle( aItemsPos, aItemsSize );
+
+ if ( !impl_fitItems( io_rItems ) )
+ {
+ // assumption was wrong, the items do not fit => calculate rects for the scroll buttons
+ const Size aButtonSize( BUTTON_FLOW_WIDTH, i_rActualOutputSize.Height() - OUTER_SPACE_TOP - OUTER_SPACE_BOTTOM );
+
+ aButtonBackPos = Point( OUTER_SPACE_LEFT, OUTER_SPACE_TOP );
+ m_aButtonBackRect = Rectangle( aButtonBackPos, aButtonSize );
+
+ aButtonForwardPos = Point( i_rActualOutputSize.Width() - BUTTON_FLOW_WIDTH - OUTER_SPACE_RIGHT, OUTER_SPACE_TOP );
+ m_aButtonForwardRect = Rectangle( aButtonForwardPos, aButtonSize );
+
+ aItemsPos.X() = aButtonBackPos.X() + aButtonSize.Width() + BUTTON_FLOW_SPACE;
+ aItemsSize.Width() = aButtonForwardPos.X() - BUTTON_FLOW_SPACE - aItemsPos.X();
+ m_aItemsRect = Rectangle( aItemsPos, aItemsSize );
+
+ // fit items, again. In the TABITEM_AUTO case, the smaller playground for the items might lead to another
+ // item content.
+ impl_fitItems( io_rItems );
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Point TabBarGeometry::getFirstItemPosition() const
+ {
+ return Point( m_aItemsInset.Left(), m_aItemsInset.Top() );
+ }
+
+//......................................................................................................................
+} // namespace svt
+//......................................................................................................................
diff --git a/svtools/source/toolpanel/tabbargeometry.hxx b/svtools/source/toolpanel/tabbargeometry.hxx
new file mode 100644
index 000000000000..059d69a3e233
--- /dev/null
+++ b/svtools/source/toolpanel/tabbargeometry.hxx
@@ -0,0 +1,137 @@
+/*************************************************************************
+ * 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 TABBARGEOMETRY_HXX
+#define TABBARGEOMETRY_HXX
+
+#include "svtools/toolpanel/tabalignment.hxx"
+
+#include "tabitemdescriptor.hxx"
+
+#include <tools/gen.hxx>
+#include <tools/svborder.hxx>
+
+//......................................................................................................................
+namespace svt
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= NormalizedArea
+ //==================================================================================================================
+ /** a rectangle which automatically translates between unrotated and rotated geometry.
+
+ It can be operated as if it were an unrotated area, but is able to provide corrdinates of rotated objects,
+ relative to its playground.
+ */
+ class NormalizedArea
+ {
+ public:
+ NormalizedArea();
+ NormalizedArea( const Rectangle& i_rReference, const bool i_bIsVertical );
+
+ /** transforms a rectangle, relative to our playground, into a coordinate system defined by the given alignment
+ @param i_rArea
+ the area which is to be transformed.
+ */
+ Rectangle getTransformed(
+ const Rectangle& i_rArea,
+ const TabAlignment i_eTargetAlignment
+ ) const;
+
+ /** normalizes an already transformed rectangle
+ @param i_rArea
+ the area which is to be normalized.
+ */
+ Rectangle getNormalized(
+ const Rectangle& i_rArea,
+ const TabAlignment i_eTargetAlignment
+ ) const;
+
+
+ Size getReferenceSize() const { return m_aReference.GetSize(); }
+ const Rectangle&
+ getReference() const { return m_aReference; }
+
+ private:
+ // the normalized reference area
+ Rectangle m_aReference;
+ };
+
+ //==================================================================================================================
+ //= TabBarGeometry
+ //==================================================================================================================
+ class TabBarGeometry_Impl;
+ class TabBarGeometry
+ {
+ public:
+ TabBarGeometry( const TabItemContent i_eItemContent );
+ ~TabBarGeometry();
+
+ // retrieves the rectangle to be occupied by the button for scrolling backward through the items
+ const Rectangle& getButtonBackRect() const { return m_aButtonBackRect; }
+ // retrieves the rectangle to be occupied by the items
+ const Rectangle& getItemsRect() const { return m_aItemsRect; }
+ // retrieves the rectangle to be occupied by the button for scrolling forward through the items
+ const Rectangle& getButtonForwardRect() const { return m_aButtonForwardRect; }
+
+ inline TabItemContent
+ getItemContent() const { return m_eTabItemContent; }
+ inline void setItemContent( const TabItemContent i_eItemContent ) { m_eTabItemContent = i_eItemContent; }
+
+ /** adjusts the sizes of the buttons and the item's playground, plus the sizes of the items
+ */
+ void relayout( const Size& i_rActualOutputSize, ItemDescriptors& io_rItems );
+
+ /** calculates the optimal size of the tab bar, depending on the item's sizes
+ */
+ Size getOptimalSize( ItemDescriptors& io_rItems, const bool i_bMinimalSize ) const;
+
+ /** retrieves the position where the first item should start, relative to the item rect
+ */
+ Point getFirstItemPosition() const;
+
+ private:
+ bool impl_fitItems( ItemDescriptors& io_rItems ) const;
+
+ private:
+ /// specifies the content to be displayed in the tab items
+ TabItemContent m_eTabItemContent;
+ /// specifies the inset to be used in the items area, depends on the actual alignment
+ SvBorder m_aItemsInset;
+ // the (logical) rectangle to be used for the "back" button, empty if the button is not needed
+ Rectangle m_aButtonBackRect;
+ // the (logical) rectangle to be used for the items
+ Rectangle m_aItemsRect;
+ // the (logical) rectangle to be used for the "forward" button, empty if the button is not needed
+ Rectangle m_aButtonForwardRect;
+ };
+
+//......................................................................................................................
+} // namespace svt
+//......................................................................................................................
+
+#endif // TABBARGEOMETRY_HXX
diff --git a/svtools/source/toolpanel/tabitemdescriptor.hxx b/svtools/source/toolpanel/tabitemdescriptor.hxx
new file mode 100644
index 000000000000..8005816b0fe2
--- /dev/null
+++ b/svtools/source/toolpanel/tabitemdescriptor.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ * 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 TABITEMDESCRIPTOR_HXX
+#define TABITEMDESCRIPTOR_HXX
+
+#include "svtools/toolpanel/toolpanel.hxx"
+#include "svtools/toolpanel/tabitemcontent.hxx"
+
+#include <tools/gen.hxx>
+#include <osl/diagnose.h>
+
+#include <vector>
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //==================================================================================================================
+ //= ItemDescriptor
+ //==================================================================================================================
+ struct ItemDescriptor
+ {
+ PToolPanel pPanel;
+ Rectangle aCompleteArea; // bounding area if the both text and icon are to be rendererd
+ Rectangle aIconOnlyArea; // bounding area if the icon is to be rendererd
+ Rectangle aTextOnlyArea; // bounding area if the text is to be rendererd
+ TabItemContent eContent;
+ // content to be used for this particular item. Might differ from item content which has been set
+ // up for the complete control, in case not the complete content fits into the available space.
+
+ ItemDescriptor()
+ :pPanel()
+ ,aCompleteArea()
+ ,aIconOnlyArea()
+ ,aTextOnlyArea()
+ ,eContent( TABITEM_IMAGE_AND_TEXT )
+ {
+ }
+
+ const Rectangle& GetRect( const TabItemContent i_eItemContent ) const
+ {
+ OSL_ENSURE( i_eItemContent != TABITEM_AUTO, "ItemDescriptor::GetRect: illegal value!" );
+
+ return ( i_eItemContent == TABITEM_IMAGE_AND_TEXT )
+ ? aCompleteArea
+ : ( ( i_eItemContent == TABITEM_TEXT_ONLY )
+ ? aTextOnlyArea
+ : aIconOnlyArea
+ );
+ }
+
+ const Rectangle& GetCurrentRect() const
+ {
+ return GetRect( eContent );
+ }
+ };
+
+ typedef ::std::vector< ItemDescriptor > ItemDescriptors;
+
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // TABITEMDESCRIPTOR_HXX
diff --git a/svtools/source/toolpanel/tablayouter.cxx b/svtools/source/toolpanel/tablayouter.cxx
new file mode 100755
index 000000000000..f68bbc1bbd0f
--- /dev/null
+++ b/svtools/source/toolpanel/tablayouter.cxx
@@ -0,0 +1,262 @@
+/*************************************************************************
+ * 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 "svtools/toolpanel/tablayouter.hxx"
+#include "svtools/toolpanel/toolpaneldeck.hxx"
+#include "svtools/toolpanel/paneltabbar.hxx"
+#include "svtaccessiblefactory.hxx"
+
+#include <tools/gen.hxx>
+#include <tools/diagnose_ex.h>
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::accessibility::XAccessible;
+
+ //====================================================================
+ //= TabDeckLayouter_Data
+ //====================================================================
+ struct TabDeckLayouter_Data
+ {
+ TabAlignment eAlignment;
+ IToolPanelDeck& rPanels;
+ ::std::auto_ptr< PanelTabBar > pTabBar;
+ AccessibleFactoryAccess aAccessibleFactory;
+
+ TabDeckLayouter_Data( Window& i_rParent, IToolPanelDeck& i_rPanels,
+ const TabAlignment i_eAlignment, const TabItemContent i_eItemContent )
+ :eAlignment( i_eAlignment )
+ ,rPanels( i_rPanels )
+ ,pTabBar( new PanelTabBar( i_rParent, i_rPanels, i_eAlignment, i_eItemContent ) )
+ {
+ pTabBar->Show();
+ }
+ };
+
+ //====================================================================
+ //= helper
+ //====================================================================
+ namespace
+ {
+ static bool lcl_isVerticalTabBar( const TabAlignment i_eAlignment )
+ {
+ return ( i_eAlignment == TABS_RIGHT )
+ || ( i_eAlignment == TABS_LEFT );
+ }
+
+ static bool lcl_checkDisposed( const TabDeckLayouter_Data& i_rData )
+ {
+ if ( !i_rData.pTabBar.get() )
+ {
+ OSL_ENSURE( false, "lcl_checkDisposed: already disposed!" );
+ return true;
+ }
+ return false;
+ }
+ }
+
+ //====================================================================
+ //= TabDeckLayouter
+ //====================================================================
+ //--------------------------------------------------------------------
+ TabDeckLayouter::TabDeckLayouter( Window& i_rParent, IToolPanelDeck& i_rPanels,
+ const TabAlignment i_eAlignment, const TabItemContent i_eItemContent )
+ :m_pData( new TabDeckLayouter_Data( i_rParent, i_rPanels, i_eAlignment, i_eItemContent ) )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ TabDeckLayouter::~TabDeckLayouter()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ IMPLEMENT_IREFERENCE( TabDeckLayouter )
+
+ //--------------------------------------------------------------------
+ TabItemContent TabDeckLayouter::GetTabItemContent() const
+ {
+ if ( lcl_checkDisposed( *m_pData ) )
+ return TABITEM_IMAGE_AND_TEXT;
+ return m_pData->pTabBar->GetTabItemContent();
+ }
+
+ //--------------------------------------------------------------------
+ void TabDeckLayouter::SetTabItemContent( const TabItemContent& i_eItemContent )
+ {
+ if ( lcl_checkDisposed( *m_pData ) )
+ return;
+ m_pData->pTabBar->SetTabItemContent( i_eItemContent );
+ }
+
+ //--------------------------------------------------------------------
+ TabAlignment TabDeckLayouter::GetTabAlignment() const
+ {
+ if ( lcl_checkDisposed( *m_pData ) )
+ return TABS_RIGHT;
+ return m_pData->eAlignment;
+ }
+
+ //--------------------------------------------------------------------
+ ::boost::optional< size_t > TabDeckLayouter::GetFocusedPanelItem() const
+ {
+ if ( lcl_checkDisposed( *m_pData ) )
+ return ::boost::optional< size_t >();
+ return m_pData->pTabBar->GetFocusedPanelItem();
+ }
+
+ //--------------------------------------------------------------------
+ void TabDeckLayouter::FocusPanelItem( const size_t i_nItemPos )
+ {
+ if ( lcl_checkDisposed( *m_pData ) )
+ return;
+ m_pData->pTabBar->FocusPanelItem( i_nItemPos );
+ }
+
+ //--------------------------------------------------------------------
+ bool TabDeckLayouter::IsPanelSelectorEnabled() const
+ {
+ if ( lcl_checkDisposed( *m_pData ) )
+ return false;
+ return m_pData->pTabBar->IsEnabled();
+ }
+
+ //--------------------------------------------------------------------
+ bool TabDeckLayouter::IsPanelSelectorVisible() const
+ {
+ if ( lcl_checkDisposed( *m_pData ) )
+ return false;
+ return m_pData->pTabBar->IsVisible();
+ }
+
+ //--------------------------------------------------------------------
+ Rectangle TabDeckLayouter::GetItemScreenRect( const size_t i_nItemPos ) const
+ {
+ if ( lcl_checkDisposed( *m_pData ) )
+ return Rectangle();
+ return m_pData->pTabBar->GetItemScreenRect( i_nItemPos );
+ }
+
+ //--------------------------------------------------------------------
+ Rectangle TabDeckLayouter::Layout( const Rectangle& i_rDeckPlayground )
+ {
+ if ( lcl_checkDisposed( *m_pData ) )
+ return i_rDeckPlayground;
+
+ const Size aPreferredSize( m_pData->pTabBar->GetOptimalSize( WINDOWSIZE_PREFERRED ) );
+ if ( lcl_isVerticalTabBar( m_pData->eAlignment ) )
+ {
+ Size aTabBarSize = ( aPreferredSize.Width() < i_rDeckPlayground.GetWidth() )
+ ? aPreferredSize
+ : m_pData->pTabBar->GetOptimalSize( WINDOWSIZE_MINIMUM );
+ aTabBarSize.Height() = i_rDeckPlayground.GetHeight();
+
+ Rectangle aPanelRect( i_rDeckPlayground );
+ if ( m_pData->eAlignment == TABS_RIGHT )
+ {
+ aPanelRect.Right() -= aTabBarSize.Width();
+ Point aTabBarTopLeft( aPanelRect.TopRight() );
+ aTabBarTopLeft.X() += 1;
+ m_pData->pTabBar->SetPosSizePixel( aTabBarTopLeft, aTabBarSize );
+ }
+ else
+ {
+ m_pData->pTabBar->SetPosSizePixel( aPanelRect.TopLeft(), aTabBarSize );
+ aPanelRect.Left() += aTabBarSize.Width();
+ }
+ if ( aPanelRect.Left() >= aPanelRect.Right() )
+ aPanelRect = Rectangle();
+
+ return aPanelRect;
+ }
+
+ Size aTabBarSize = ( aPreferredSize.Height() < i_rDeckPlayground.GetHeight() )
+ ? aPreferredSize
+ : m_pData->pTabBar->GetOptimalSize( WINDOWSIZE_MINIMUM );
+ aTabBarSize.Width() = i_rDeckPlayground.GetWidth();
+
+ Rectangle aPanelRect( i_rDeckPlayground );
+ if ( m_pData->eAlignment == TABS_TOP )
+ {
+ m_pData->pTabBar->SetPosSizePixel( aPanelRect.TopLeft(), aTabBarSize );
+ aPanelRect.Top() += aTabBarSize.Height();
+ }
+ else
+ {
+ aPanelRect.Bottom() -= aTabBarSize.Height();
+ Point aTabBarTopLeft( aPanelRect.BottomLeft() );
+ aTabBarTopLeft.Y() -= 1;
+ m_pData->pTabBar->SetPosSizePixel( aTabBarTopLeft, aTabBarSize );
+ }
+ if ( aPanelRect.Top() >= aPanelRect.Bottom() )
+ aPanelRect = Rectangle();
+
+ return aPanelRect;
+ }
+
+ //--------------------------------------------------------------------
+ void TabDeckLayouter::Destroy()
+ {
+ m_pData->pTabBar.reset();
+ }
+
+ //--------------------------------------------------------------------
+ void TabDeckLayouter::SetFocusToPanelSelector()
+ {
+ if ( lcl_checkDisposed( *m_pData ) )
+ return;
+ m_pData->pTabBar->GrabFocus();
+ }
+
+ //--------------------------------------------------------------------
+ size_t TabDeckLayouter::GetAccessibleChildCount() const
+ {
+ if ( lcl_checkDisposed( *m_pData ) )
+ return 0;
+
+ return 1;
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessible > TabDeckLayouter::GetAccessibleChild( const size_t i_nChildIndex, const Reference< XAccessible >& i_rParentAccessible )
+ {
+ (void)i_nChildIndex;
+ (void)i_rParentAccessible;
+ if ( lcl_checkDisposed( *m_pData ) )
+ return NULL;
+
+ return m_pData->pTabBar->GetAccessible( TRUE );
+ }
+
+//........................................................................
+} // namespace svt
+//........................................................................
diff --git a/svtools/source/toolpanel/toolpanel.cxx b/svtools/source/toolpanel/toolpanel.cxx
new file mode 100644
index 000000000000..f7b999494563
--- /dev/null
+++ b/svtools/source/toolpanel/toolpanel.cxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ * 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 "svtools/toolpanel/toolpanel.hxx"
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //====================================================================
+ //= ToolPanelBase
+ //====================================================================
+ //--------------------------------------------------------------------
+ ToolPanelBase::ToolPanelBase()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ ToolPanelBase::~ToolPanelBase()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ IMPLEMENT_IREFERENCE( ToolPanelBase )
+
+//........................................................................
+} // namespace svt
+//........................................................................
diff --git a/svtools/source/dialogs/logindlg.hrc b/svtools/source/toolpanel/toolpanel.src
index 7baf6010f531..5908a8fbcf98 100644
--- a/svtools/source/dialogs/logindlg.hrc
+++ b/svtools/source/toolpanel/toolpanel.src
@@ -1,5 +1,4 @@
/*************************************************************************
- *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
@@ -25,33 +24,34 @@
*
************************************************************************/
+#include "svtools/svtools.hrc"
-#ifndef _SVTOOLS_LOGINDLG_HRC_
-#define _SVTOOLS_LOGINDLG_HRC_
+String STR_SVT_TOOL_PANEL_BUTTON_FWD
+{
+ Text [ en-US ] = "Tab Panel Scroll Button, backward";
+};
-//============================================================================
-#define INFO_LOGIN_ERROR 10
-#define GB_LOGIN_ERROR 11
+String STR_SVT_TOOL_PANEL_BUTTON_BACK
+{
+ Text [ en-US ] = "Tab Panel Scroll Button, forward";
+};
-#define INFO_LOGIN_REQUEST 20
-#define FT_LOGIN_PATH 21
-#define ED_LOGIN_PATH 22
-#define INFO_LOGIN_PATH 23
-#define BTN_LOGIN_PATH 24
-#define FT_LOGIN_USERNAME 25
-#define ED_LOGIN_USERNAME 26
-#define INFO_LOGIN_USERNAME 27
-#define FT_LOGIN_PASSWORD 28
-#define ED_LOGIN_PASSWORD 29
-#define FT_LOGIN_ACCOUNT 30
-#define ED_LOGIN_ACCOUNT 31
-#define CB_LOGIN_SAVEPASSWORD 32
-#define GB_LOGIN_LOGIN 33
+Image IMG_TRIANGLE_RIGHT
+{
+ ImageBitmap = Bitmap { File = "triangle_right.png"; };
+};
-#define BTN_LOGIN_OK 50
-#define BTN_LOGIN_CANCEL 51
-#define BTN_LOGIN_HELP 52
+Image IMG_TRIANGLE_RIGHT_HC
+{
+ ImageBitmap = Bitmap { File = "triangle_right_hc.png"; };
+};
-#define STR_LOGIN_AT 60
+Image IMG_TRIANGLE_DOWN
+{
+ ImageBitmap = Bitmap { File = "triangle_down.png"; };
+};
-#endif // _SVTOOLS_LOGINDLG_HRC_
+Image IMG_TRIANGLE_DOWN_HC
+{
+ ImageBitmap = Bitmap { File = "plus.png"; } ;
+};
diff --git a/svtools/source/toolpanel/toolpanelcollection.cxx b/svtools/source/toolpanel/toolpanelcollection.cxx
new file mode 100644
index 000000000000..baefbd92400f
--- /dev/null
+++ b/svtools/source/toolpanel/toolpanelcollection.cxx
@@ -0,0 +1,193 @@
+/*************************************************************************
+ * 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 "toolpanelcollection.hxx"
+#include "paneldecklisteners.hxx"
+
+#include <tools/diagnose_ex.h>
+
+#include <vector>
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //====================================================================
+ //= ToolPanelCollection_Data
+ //====================================================================
+ struct ToolPanelCollection_Data
+ {
+ ::std::vector< PToolPanel > aPanels;
+ ::boost::optional< size_t > aActivePanel;
+ PanelDeckListeners aListeners;
+ };
+
+ //====================================================================
+ //= ToolPanelCollection
+ //====================================================================
+ //--------------------------------------------------------------------
+ ToolPanelCollection::ToolPanelCollection()
+ :m_pData( new ToolPanelCollection_Data )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ ToolPanelCollection::~ToolPanelCollection()
+ {
+ m_pData->aListeners.Dying();
+ }
+
+ //--------------------------------------------------------------------
+ size_t ToolPanelCollection::GetPanelCount() const
+ {
+ return m_pData->aPanels.size();
+ }
+
+ //--------------------------------------------------------------------
+ ::boost::optional< size_t > ToolPanelCollection::GetActivePanel() const
+ {
+ return m_pData->aActivePanel;
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelCollection::ActivatePanel( const ::boost::optional< size_t >& i_rPanel )
+ {
+ if ( !!i_rPanel )
+ {
+ OSL_ENSURE( *i_rPanel < GetPanelCount(), "ToolPanelCollection::ActivatePanel: illegal panel no.!" );
+ if ( *i_rPanel >= GetPanelCount() )
+ return;
+ }
+
+ if ( m_pData->aActivePanel == i_rPanel )
+ return;
+
+ const ::boost::optional< size_t > aOldPanel( m_pData->aActivePanel );
+ m_pData->aActivePanel = i_rPanel;
+
+ // notify listeners
+ m_pData->aListeners.ActivePanelChanged( aOldPanel, m_pData->aActivePanel );
+ }
+
+ //--------------------------------------------------------------------
+ PToolPanel ToolPanelCollection::GetPanel( const size_t i_nPos ) const
+ {
+ OSL_ENSURE( i_nPos < m_pData->aPanels.size(), "ToolPanelCollection::GetPanel: illegal position!" );
+ if ( i_nPos >= m_pData->aPanels.size() )
+ return PToolPanel();
+ return m_pData->aPanels[ i_nPos ];
+ }
+
+ //--------------------------------------------------------------------
+ size_t ToolPanelCollection::InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition )
+ {
+ OSL_ENSURE( i_pPanel.get(), "ToolPanelCollection::InsertPanel: illegal panel!" );
+ if ( !i_pPanel.get() )
+ return 0;
+
+ // insert
+ const size_t position = i_nPosition < m_pData->aPanels.size() ? i_nPosition : m_pData->aPanels.size();
+ m_pData->aPanels.insert( m_pData->aPanels.begin() + position, i_pPanel );
+
+ // update active panel
+ if ( !!m_pData->aActivePanel )
+ {
+ if ( i_nPosition <= *m_pData->aActivePanel )
+ ++*m_pData->aActivePanel;
+ }
+
+ // notifications
+ m_pData->aListeners.PanelInserted( i_pPanel, i_nPosition );
+
+ return position;
+ }
+
+ //--------------------------------------------------------------------
+ PToolPanel ToolPanelCollection::RemovePanel( const size_t i_nPosition )
+ {
+ OSL_ENSURE( i_nPosition < m_pData->aPanels.size(), "ToolPanelCollection::RemovePanel: illegal position!" );
+ if ( i_nPosition >= m_pData->aPanels.size() )
+ return NULL;
+
+ // if the active panel is going to be removed, activate another one (before the actual removal)
+ if ( m_pData->aActivePanel == i_nPosition )
+ {
+ const ::boost::optional< size_t > aOldActive( m_pData->aActivePanel );
+
+ if ( i_nPosition + 1 < GetPanelCount() )
+ {
+ ++*m_pData->aActivePanel;
+ }
+ else if ( i_nPosition > 0 )
+ {
+ --*m_pData->aActivePanel;
+ }
+ else
+ {
+ m_pData->aActivePanel.reset();
+ }
+
+ m_pData->aListeners.ActivePanelChanged( aOldActive, m_pData->aActivePanel );
+ }
+
+ // remember the removed panel for the aller
+ PToolPanel pRemovedPanel( m_pData->aPanels[ i_nPosition ] );
+
+ // actually remove
+ m_pData->aPanels.erase( m_pData->aPanels.begin() + i_nPosition );
+
+ if ( !!m_pData->aActivePanel )
+ {
+ if ( i_nPosition < *m_pData->aActivePanel )
+ {
+ --*m_pData->aActivePanel;
+ }
+ }
+
+ // notify removed panel
+ m_pData->aListeners.PanelRemoved( i_nPosition );
+
+ return pRemovedPanel;
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelCollection::AddListener( IToolPanelDeckListener& i_rListener )
+ {
+ m_pData->aListeners.AddListener( i_rListener );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelCollection::RemoveListener( IToolPanelDeckListener& i_rListener )
+ {
+ m_pData->aListeners.RemoveListener( i_rListener );
+ }
+
+//........................................................................
+} // namespace svt
+//........................................................................
diff --git a/svtools/source/toolpanel/toolpanelcollection.hxx b/svtools/source/toolpanel/toolpanelcollection.hxx
new file mode 100644
index 000000000000..2bdba38546c9
--- /dev/null
+++ b/svtools/source/toolpanel/toolpanelcollection.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ * 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 TOOLPANELCOLLECTION_HXX
+#define TOOLPANELCOLLECTION_HXX
+
+#include "svtools/toolpanel/toolpaneldeck.hxx"
+
+#include <memory>
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ struct ToolPanelCollection_Data;
+
+ //====================================================================
+ //= ToolPanelCollection
+ //====================================================================
+ class ToolPanelCollection : public IToolPanelDeck
+ {
+ public:
+ ToolPanelCollection();
+ ~ToolPanelCollection();
+
+ // IToolPanelDeck
+ virtual size_t GetPanelCount() const;
+ virtual PToolPanel GetPanel( const size_t i_nPos ) const;
+ virtual ::boost::optional< size_t >
+ GetActivePanel() const;
+ virtual void ActivatePanel( const ::boost::optional< size_t >& i_rPanel );
+ virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition );
+ virtual PToolPanel RemovePanel( const size_t i_nPosition );
+ virtual void AddListener( IToolPanelDeckListener& i_rListener );
+ virtual void RemoveListener( IToolPanelDeckListener& i_rListener );
+
+ private:
+ ::std::auto_ptr< ToolPanelCollection_Data > m_pData;
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // TOOLPANELCOLLECTION_HXX
diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx
new file mode 100755
index 000000000000..e157090bbf0e
--- /dev/null
+++ b/svtools/source/toolpanel/toolpaneldeck.cxx
@@ -0,0 +1,560 @@
+/*************************************************************************
+ * 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 "dummypanel.hxx"
+#include "toolpanelcollection.hxx"
+#include "paneldecklisteners.hxx"
+#include "toolpaneldeckpeer.hxx"
+#include "svtools/toolpanel/toolpaneldeck.hxx"
+#include "svtools/toolpanel/tablayouter.hxx"
+#include "svtools/toolpanel/drawerlayouter.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+/** === end UNO includes === **/
+
+#include <tools/diagnose_ex.h>
+
+#include <boost/optional.hpp>
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::accessibility::XAccessible;
+ using ::com::sun::star::awt::XWindowPeer;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ /** === end UNO using === **/
+ namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole;
+
+ enum DeckAction
+ {
+ /// activates the first panel
+ ACTION_ACTIVATE_FIRST,
+ // activates the panel after the currently active panel
+ ACTION_ACTIVATE_NEXT,
+ // activates the panel before the currently active panel
+ ACTION_ACTIVATE_PREV,
+ // activates the last panel
+ ACTION_ACTIVATE_LAST,
+
+ // toggles the focus between the active panel and the panel selector
+ ACTION_TOGGLE_FOCUS,
+ };
+
+ //====================================================================
+ //= ToolPanelDeck_Impl
+ //====================================================================
+ class ToolPanelDeck_Impl : public IToolPanelDeckListener
+ {
+ public:
+ ToolPanelDeck_Impl( ToolPanelDeck& i_rDeck )
+ :m_rDeck( i_rDeck )
+ ,m_aPanelAnchor( &i_rDeck, WB_DIALOGCONTROL | WB_CHILDDLGCTRL )
+ ,m_aPanels()
+ ,m_pDummyPanel( new DummyPanel )
+ ,m_pLayouter()
+ ,m_bInDtor( false )
+ ,m_pAccessibleParent( NULL )
+ {
+ m_aPanels.AddListener( *this );
+ m_aPanelAnchor.Show();
+ m_aPanelAnchor.SetAccessibleRole( AccessibleRole::PANEL );
+ }
+
+ ~ToolPanelDeck_Impl()
+ {
+ m_bInDtor = true;
+ }
+
+ PDeckLayouter GetLayouter() const { return m_pLayouter; }
+ void SetLayouter( const PDeckLayouter& i_pNewLayouter );
+
+ Window& GetPanelWindowAnchor() { return m_aPanelAnchor; }
+ const Window& GetPanelWindowAnchor() const { return m_aPanelAnchor; }
+
+ bool IsDead() const { return m_bInDtor; }
+
+ /// notifies our listeners that we're going to die. Only to be called from with our anti-impl's destructor
+ void NotifyDying()
+ {
+ m_aPanels.RemoveListener( *this );
+ m_aListeners.Dying();
+ }
+
+ // IToolPanelDeck equivalents
+ size_t GetPanelCount() const;
+ PToolPanel GetPanel( const size_t i_nPos ) const;
+ ::boost::optional< size_t >
+ GetActivePanel() const;
+ void ActivatePanel( const ::boost::optional< size_t >& i_rPanel );
+ size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition );
+ PToolPanel RemovePanel( const size_t i_nPosition );
+ void AddListener( IToolPanelDeckListener& i_rListener );
+ void RemoveListener( IToolPanelDeckListener& i_rListener );
+
+ /// re-layouts everything
+ void LayoutAll() { ImplDoLayout(); }
+
+ void DoAction( const DeckAction i_eAction );
+
+ bool FocusActivePanel();
+
+ void SetAccessibleParentWindow( Window* i_pAccessibleParent );
+ Window* GetAccessibleParentWindow() const { return m_pAccessibleParent; }
+
+ protected:
+ // IToolPanelDeckListener
+ virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition );
+ virtual void PanelRemoved( const size_t i_nPosition );
+ virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
+ virtual void LayouterChanged( const PDeckLayouter& i_rNewLayouter );
+ virtual void Dying();
+
+ private:
+ void ImplDoLayout();
+ PToolPanel GetActiveOrDummyPanel_Impl();
+
+ private:
+ ToolPanelDeck& m_rDeck;
+ Window m_aPanelAnchor;
+ ToolPanelCollection m_aPanels;
+ PToolPanel m_pDummyPanel;
+ PanelDeckListeners m_aListeners;
+ PDeckLayouter m_pLayouter;
+ bool m_bInDtor;
+ Window* m_pAccessibleParent;
+ };
+
+ //--------------------------------------------------------------------
+ PToolPanel ToolPanelDeck_Impl::GetActiveOrDummyPanel_Impl()
+ {
+ ::boost::optional< size_t > aActivePanel( m_aPanels.GetActivePanel() );
+ if ( !aActivePanel )
+ return m_pDummyPanel;
+ return m_aPanels.GetPanel( *aActivePanel );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::SetLayouter( const PDeckLayouter& i_pNewLayouter )
+ {
+ ENSURE_OR_RETURN_VOID( i_pNewLayouter.get(), "invalid layouter" );
+
+ if ( m_pLayouter.get() )
+ m_pLayouter->Destroy();
+
+ m_pLayouter = i_pNewLayouter;
+
+ ImplDoLayout();
+
+ m_aListeners.LayouterChanged( m_pLayouter );
+ }
+
+ //--------------------------------------------------------------------
+ size_t ToolPanelDeck_Impl::GetPanelCount() const
+ {
+ return m_aPanels.GetPanelCount();
+ }
+
+ //--------------------------------------------------------------------
+ PToolPanel ToolPanelDeck_Impl::GetPanel( const size_t i_nPos ) const
+ {
+ return m_aPanels.GetPanel( i_nPos );
+ }
+
+ //--------------------------------------------------------------------
+ ::boost::optional< size_t > ToolPanelDeck_Impl::GetActivePanel() const
+ {
+ return m_aPanels.GetActivePanel();
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::ActivatePanel( const ::boost::optional< size_t >& i_rPanel )
+ {
+ m_aPanels.ActivatePanel( i_rPanel );
+ }
+
+ //--------------------------------------------------------------------
+ size_t ToolPanelDeck_Impl::InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition )
+ {
+ return m_aPanels.InsertPanel( i_pPanel, i_nPosition );
+ }
+
+ //--------------------------------------------------------------------
+ PToolPanel ToolPanelDeck_Impl::RemovePanel( const size_t i_nPosition )
+ {
+ return m_aPanels.RemovePanel( i_nPosition );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::ImplDoLayout()
+ {
+ const Rectangle aDeckPlayground( Point(), m_rDeck.GetOutputSizePixel() );
+
+ // ask the layouter what is left for our panel, and position the panel container window appropriately
+ Rectangle aPlaygroundArea( aDeckPlayground );
+ OSL_ENSURE( m_pLayouter.get(), "ToolPanelDeck_Impl::ImplDoLayout: no layouter!" );
+ if ( m_pLayouter.get() )
+ {
+ aPlaygroundArea = m_pLayouter->Layout( aDeckPlayground );
+ }
+ m_aPanelAnchor.SetPosSizePixel( aPlaygroundArea.TopLeft(), aPlaygroundArea.GetSize() );
+
+ // position the active panel
+ const PToolPanel pActive( GetActiveOrDummyPanel_Impl() );
+ pActive->SetSizePixel( m_aPanelAnchor.GetOutputSizePixel() );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::AddListener( IToolPanelDeckListener& i_rListener )
+ {
+ m_aListeners.AddListener( i_rListener );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::RemoveListener( IToolPanelDeckListener& i_rListener )
+ {
+ m_aListeners.RemoveListener( i_rListener );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::DoAction( const DeckAction i_eAction )
+ {
+ const size_t nPanelCount( m_aPanels.GetPanelCount() );
+ ::boost::optional< size_t > aActivatePanel;
+ ::boost::optional< size_t > aCurrentPanel( GetActivePanel() );
+
+ switch ( i_eAction )
+ {
+ case ACTION_ACTIVATE_FIRST:
+ if ( nPanelCount > 0 )
+ aActivatePanel = 0;
+ break;
+ case ACTION_ACTIVATE_PREV:
+ if ( !aCurrentPanel && ( nPanelCount > 0 ) )
+ aActivatePanel = nPanelCount - 1;
+ else
+ if ( !!aCurrentPanel && ( *aCurrentPanel > 0 ) )
+ aActivatePanel = *aCurrentPanel - 1;
+ break;
+ case ACTION_ACTIVATE_NEXT:
+ if ( !aCurrentPanel && ( nPanelCount > 0 ) )
+ aActivatePanel = 0;
+ else
+ if ( !!aCurrentPanel && ( *aCurrentPanel < nPanelCount - 1 ) )
+ aActivatePanel = *aCurrentPanel + 1;
+ break;
+ case ACTION_ACTIVATE_LAST:
+ if ( nPanelCount > 0 )
+ aActivatePanel = nPanelCount - 1;
+ break;
+ case ACTION_TOGGLE_FOCUS:
+ {
+ PToolPanel pActivePanel( GetActiveOrDummyPanel_Impl() );
+ if ( !m_aPanelAnchor.HasChildPathFocus() )
+ pActivePanel->GrabFocus();
+ else
+ GetLayouter()->SetFocusToPanelSelector();
+ }
+ break;
+ }
+
+ if ( !!aActivatePanel )
+ {
+ ActivatePanel( aActivatePanel );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ bool ToolPanelDeck_Impl::FocusActivePanel()
+ {
+ ::boost::optional< size_t > aActivePanel( m_aPanels.GetActivePanel() );
+ if ( !aActivePanel )
+ return false;
+
+ PToolPanel pActivePanel( m_aPanels.GetPanel( *aActivePanel ) );
+ pActivePanel->GrabFocus();
+ return true;
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition )
+ {
+ // multiplex to our own listeners
+ m_aListeners.PanelInserted( i_pPanel, i_nPosition );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::PanelRemoved( const size_t i_nPosition )
+ {
+ // multiplex to our own listeners
+ m_aListeners.PanelRemoved( i_nPosition );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
+ {
+ // hide the old panel
+ if ( !!i_rOldActive )
+ {
+ const PToolPanel pOldActive( m_aPanels.GetPanel( *i_rOldActive ) );
+ pOldActive->Deactivate();
+ }
+
+ // position and show the new panel
+ const PToolPanel pNewActive( !i_rNewActive ? m_pDummyPanel : m_aPanels.GetPanel( *i_rNewActive ) );
+ pNewActive->Activate( m_aPanelAnchor );
+ pNewActive->GrabFocus();
+
+ // resize the panel (cannot guarantee it has ever been resized before
+ pNewActive->SetSizePixel( m_aPanelAnchor.GetOutputSizePixel() );
+
+ // multiplex to our own listeners
+ m_aListeners.ActivePanelChanged( i_rOldActive, i_rNewActive );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::LayouterChanged( const PDeckLayouter& i_rNewLayouter )
+ {
+ // not interested in
+ (void)i_rNewLayouter;
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::Dying()
+ {
+ // not interested in. Since the ToolPanelCollection is our member, this just means we ourself
+ // are dying, and we already sent this notification in our dtor.
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::SetAccessibleParentWindow( Window* i_pAccessibleParent )
+ {
+ m_pAccessibleParent = i_pAccessibleParent;
+ }
+
+ //====================================================================
+ //= ToolPanelDeck
+ //====================================================================
+ //--------------------------------------------------------------------
+ ToolPanelDeck::ToolPanelDeck( Window& i_rParent, const WinBits i_nStyle )
+ :Control( &i_rParent, i_nStyle )
+ ,m_pImpl( new ToolPanelDeck_Impl( *this ) )
+ {
+ // use a default layouter
+// SetLayouter( PDeckLayouter( new TabDeckLayouter( *this, *this, TABS_RIGHT, TABITEM_IMAGE_AND_TEXT ) ) );
+ SetLayouter( PDeckLayouter( new DrawerDeckLayouter( *this, *this ) ) );
+ }
+
+ //--------------------------------------------------------------------
+ ToolPanelDeck::~ToolPanelDeck()
+ {
+ m_pImpl->NotifyDying();
+ GetLayouter()->Destroy();
+
+ Hide();
+ for ( size_t i=0; i<GetPanelCount(); ++i )
+ {
+ PToolPanel pPanel( GetPanel( i ) );
+ pPanel->Dispose();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ size_t ToolPanelDeck::GetPanelCount() const
+ {
+ return m_pImpl->GetPanelCount();
+ }
+
+ //--------------------------------------------------------------------
+ PToolPanel ToolPanelDeck::GetPanel( const size_t i_nPos ) const
+ {
+ return m_pImpl->GetPanel( i_nPos );
+ }
+
+ //--------------------------------------------------------------------
+ ::boost::optional< size_t > ToolPanelDeck::GetActivePanel() const
+ {
+ return m_pImpl->GetActivePanel();
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck::ActivatePanel( const ::boost::optional< size_t >& i_rPanel )
+ {
+ m_pImpl->ActivatePanel( i_rPanel );
+ }
+
+ //--------------------------------------------------------------------
+ size_t ToolPanelDeck::InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition )
+ {
+ return m_pImpl->InsertPanel( i_pPanel, i_nPosition );
+ }
+
+ //--------------------------------------------------------------------
+ PToolPanel ToolPanelDeck::RemovePanel( const size_t i_nPosition )
+ {
+ return m_pImpl->RemovePanel( i_nPosition );
+ }
+
+ //--------------------------------------------------------------------
+ PDeckLayouter ToolPanelDeck::GetLayouter() const
+ {
+ return m_pImpl->GetLayouter();
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck::SetLayouter( const PDeckLayouter& i_pNewLayouter )
+ {
+ return m_pImpl->SetLayouter( i_pNewLayouter );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck::AddListener( IToolPanelDeckListener& i_rListener )
+ {
+ m_pImpl->AddListener( i_rListener );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck::RemoveListener( IToolPanelDeckListener& i_rListener )
+ {
+ m_pImpl->RemoveListener( i_rListener );
+ }
+
+ //--------------------------------------------------------------------
+ Window& ToolPanelDeck::GetPanelWindowAnchor()
+ {
+ return m_pImpl->GetPanelWindowAnchor();
+ }
+
+ //--------------------------------------------------------------------
+ const Window& ToolPanelDeck::GetPanelWindowAnchor() const
+ {
+ return m_pImpl->GetPanelWindowAnchor();
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck::Resize()
+ {
+ Control::Resize();
+ m_pImpl->LayoutAll();
+ }
+
+ //--------------------------------------------------------------------
+ long ToolPanelDeck::Notify( NotifyEvent& i_rNotifyEvent )
+ {
+ bool bHandled = false;
+ if ( i_rNotifyEvent.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pEvent = i_rNotifyEvent.GetKeyEvent();
+ const KeyCode& rKeyCode = pEvent->GetKeyCode();
+ if ( rKeyCode.GetModifier() == KEY_MOD1 )
+ {
+ bHandled = true;
+ switch ( rKeyCode.GetCode() )
+ {
+ case KEY_HOME:
+ m_pImpl->DoAction( ACTION_ACTIVATE_FIRST );
+ break;
+ case KEY_PAGEUP:
+ m_pImpl->DoAction( ACTION_ACTIVATE_PREV );
+ break;
+ case KEY_PAGEDOWN:
+ m_pImpl->DoAction( ACTION_ACTIVATE_NEXT );
+ break;
+ case KEY_END:
+ m_pImpl->DoAction( ACTION_ACTIVATE_LAST );
+ break;
+ default:
+ bHandled = false;
+ break;
+ }
+ }
+ else if ( rKeyCode.GetModifier() == ( KEY_MOD1 | KEY_SHIFT ) )
+ {
+ if ( rKeyCode.GetCode() == KEY_E )
+ {
+ m_pImpl->DoAction( ACTION_TOGGLE_FOCUS );
+ bHandled = true;
+ }
+ }
+ }
+
+ if ( bHandled )
+ return 1;
+
+ return Control::Notify( i_rNotifyEvent );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck::GetFocus()
+ {
+ Control::GetFocus();
+ if ( m_pImpl->IsDead() )
+ return;
+ if ( !m_pImpl->FocusActivePanel() )
+ {
+ PDeckLayouter pLayouter( GetLayouter() );
+ ENSURE_OR_RETURN_VOID( pLayouter.get(), "ToolPanelDeck::GetFocus: no layouter?!" );
+ pLayouter->SetFocusToPanelSelector();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck::SetAccessibleParentWindow( Window* i_pAccessibleParent )
+ {
+ m_pImpl->SetAccessibleParentWindow( i_pAccessibleParent );
+ }
+
+ //--------------------------------------------------------------------
+ Window* ToolPanelDeck::GetAccessibleParentWindow() const
+ {
+ Window* pAccessibleParent( m_pImpl->GetAccessibleParentWindow() );
+ if ( !pAccessibleParent )
+ pAccessibleParent = Window::GetAccessibleParentWindow();
+ return pAccessibleParent;
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XWindowPeer > ToolPanelDeck::GetComponentInterface( BOOL i_bCreate )
+ {
+ Reference< XWindowPeer > xWindowPeer( Control::GetComponentInterface( FALSE ) );
+ if ( !xWindowPeer.is() && i_bCreate )
+ {
+ xWindowPeer.set( new ToolPanelDeckPeer( *this ) );
+ SetComponentInterface( xWindowPeer );
+ }
+ return xWindowPeer;
+ }
+
+//........................................................................
+} // namespace svt
+//........................................................................
diff --git a/svtools/source/toolpanel/toolpaneldeckpeer.cxx b/svtools/source/toolpanel/toolpaneldeckpeer.cxx
new file mode 100755
index 000000000000..0a84a90b4fb3
--- /dev/null
+++ b/svtools/source/toolpanel/toolpaneldeckpeer.cxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ * 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 "toolpaneldeckpeer.hxx"
+#include "svtools/toolpanel/toolpaneldeck.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/DisposedException.hpp>
+/** === end UNO includes === **/
+
+#include <tools/diagnose_ex.h>
+
+//......................................................................................................................
+namespace svt
+{
+//......................................................................................................................
+
+ /** === 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::accessibility::XAccessibleContext;
+ using ::com::sun::star::lang::DisposedException;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= ToolPanelDeckPeer
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ ToolPanelDeckPeer::ToolPanelDeckPeer( ToolPanelDeck& i_rDeck )
+ :VCLXWindow()
+ ,m_pDeck( &i_rDeck )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ToolPanelDeckPeer::~ToolPanelDeckPeer()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessibleContext > ToolPanelDeckPeer::CreateAccessibleContext()
+ {
+ ::vos::OGuard aSolarGuard( GetMutex() );
+ if ( m_pDeck == NULL )
+ throw DisposedException( ::rtl::OUString(), *this );
+
+ Window* pAccessibleParent( m_pDeck->GetAccessibleParentWindow() );
+ ENSURE_OR_RETURN( pAccessibleParent != NULL, "no accessible parent => no accessible context", NULL );
+ Reference< XAccessible > xAccessibleParent( pAccessibleParent->GetAccessible(), UNO_SET_THROW );
+ return m_aAccessibleFactory.getFactory().createAccessibleToolPanelDeck( xAccessibleParent, *m_pDeck );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL ToolPanelDeckPeer::dispose() throw(RuntimeException)
+ {
+ {
+ ::vos::OGuard aSolarGuard( GetMutex() );
+ m_pDeck = NULL;
+ }
+ VCLXWindow::dispose();
+ }
+
+//......................................................................................................................
+} // namespace svt
+//......................................................................................................................
diff --git a/svtools/source/toolpanel/toolpaneldeckpeer.hxx b/svtools/source/toolpanel/toolpaneldeckpeer.hxx
new file mode 100755
index 000000000000..4b6607ecbd05
--- /dev/null
+++ b/svtools/source/toolpanel/toolpaneldeckpeer.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ * 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 SVT_TOOLPANELDECKPEER_HXX
+#define SVT_TOOLPANELDECKPEER_HXX
+
+#include "svtaccessiblefactory.hxx"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+#include <toolkit/awt/vclxwindow.hxx>
+
+//......................................................................................................................
+namespace svt
+{
+//......................................................................................................................
+
+ class ToolPanelDeck;
+ //==================================================================================================================
+ //= ToolPanelDeckPeer
+ //==================================================================================================================
+ class ToolPanelDeckPeer : public VCLXWindow
+ {
+ public:
+ ToolPanelDeckPeer( ToolPanelDeck& i_rDeck );
+
+ protected:
+ ~ToolPanelDeckPeer();
+
+ // VCLXWindow overridables
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext();
+
+ // XComponent
+ void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+
+ private:
+ AccessibleFactoryAccess m_aAccessibleFactory;
+ ToolPanelDeck* m_pDeck;
+ };
+
+//......................................................................................................................
+} // namespace svt
+//......................................................................................................................
+
+#endif // SVT_TOOLPANELDECKPEER_HXX
diff --git a/svtools/source/toolpanel/toolpaneldrawer.cxx b/svtools/source/toolpanel/toolpaneldrawer.cxx
new file mode 100644
index 000000000000..851556bc7874
--- /dev/null
+++ b/svtools/source/toolpanel/toolpaneldrawer.cxx
@@ -0,0 +1,373 @@
+/*************************************************************************
+ * 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 "toolpaneldrawer.hxx"
+#include "toolpaneldrawerpeer.hxx"
+#include "svtools/svtdata.hxx"
+#include "svtools/svtools.hrc"
+
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+
+#include <vcl/lineinfo.hxx>
+#include <vcl/image.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/vclevent.hxx>
+
+//......................................................................................................................
+namespace svt
+{
+//......................................................................................................................
+
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::awt::XWindowPeer;
+ namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole;
+
+ static const int s_nIndentationWidth = 16;
+
+ //==================================================================================================================
+ //= DrawerVisualization
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ DrawerVisualization::DrawerVisualization( ToolPanelDrawer& i_rParent )
+ :Window( &i_rParent )
+ ,m_rDrawer( i_rParent )
+ {
+ SetMouseTransparent( TRUE );
+ Show();
+ SetAccessibleRole( AccessibleRole::LABEL );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ DrawerVisualization::~DrawerVisualization()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DrawerVisualization::Paint( const Rectangle& i_rBoundingBox )
+ {
+ Window::Paint( i_rBoundingBox );
+ m_rDrawer.Paint();
+ }
+
+ //==================================================================================================================
+ //= ToolPanelDrawer
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ ToolPanelDrawer::ToolPanelDrawer( Window& i_rParent, const ::rtl::OUString& i_rTitle )
+ :Window( &i_rParent, WB_TABSTOP )
+ ,m_pPaintDevice( new VirtualDevice( *this ) )
+ ,m_aVisualization( *this )
+ ,m_bFocused( false )
+ ,m_bExpanded( false )
+ {
+ EnableMapMode( FALSE );
+ SetBackground( Wallpaper() );
+ SetPointer( POINTER_REFHAND );
+
+ SetAccessibleRole( AccessibleRole::LIST_ITEM );
+
+ SetText( i_rTitle );
+ SetAccessibleName( i_rTitle );
+ SetAccessibleDescription( i_rTitle );
+
+ m_aVisualization.SetAccessibleName( i_rTitle );
+ m_aVisualization.SetAccessibleDescription( i_rTitle );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ToolPanelDrawer::~ToolPanelDrawer()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ long ToolPanelDrawer::GetPreferredHeightPixel() const
+ {
+ Rectangle aTitleBarBox( impl_calcTitleBarBox( impl_calcTextBoundingBox() ) );
+ return aTitleBarBox.GetHeight();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanelDrawer::Paint()
+ {
+ m_pPaintDevice->SetMapMode( GetMapMode() );
+ m_pPaintDevice->SetOutputSize( GetOutputSizePixel() );
+ m_pPaintDevice->SetSettings( GetSettings() );
+ m_pPaintDevice->SetDrawMode( GetDrawMode() );
+
+ const Rectangle aTextBox( impl_calcTextBoundingBox() );
+ impl_paintBackground( impl_calcTitleBarBox( aTextBox ) );
+
+ Rectangle aFocusBox( impl_paintExpansionIndicator( aTextBox ) );
+
+ m_pPaintDevice->DrawText( aTextBox, GetText(), impl_getTextStyle() );
+
+ aFocusBox.Union( aTextBox );
+ aFocusBox.Left() += 2;
+ impl_paintFocusIndicator( aFocusBox );
+
+ m_aVisualization.DrawOutDev(
+ Point(), GetOutputSizePixel(),
+ Point(), GetOutputSizePixel(),
+ *m_pPaintDevice
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle ToolPanelDrawer::impl_paintExpansionIndicator( const Rectangle& i_rTextBox )
+ {
+ Rectangle aExpansionIndicatorArea;
+
+ Image aImage( impl_getExpansionIndicator() );
+ const int nHeight( aImage.GetSizePixel().Height() );
+ if ( nHeight > 0 )
+ {
+ Point aPosition(
+ 0,
+ i_rTextBox.Top() + ( GetTextHeight() - nHeight ) / 2
+ );
+ m_pPaintDevice->DrawImage( aPosition, aImage );
+
+ aExpansionIndicatorArea = Rectangle( aPosition, aImage.GetSizePixel() );
+ }
+
+ return aExpansionIndicatorArea;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Image ToolPanelDrawer::impl_getExpansionIndicator() const
+ {
+ const bool bHighContrastMode( GetSettings().GetStyleSettings().GetHighContrastMode() != 0 );
+ USHORT nResourceId = 0;
+ if ( m_bExpanded )
+ if ( bHighContrastMode )
+ nResourceId = IMG_TRIANGLE_DOWN_HC;
+ else
+ nResourceId = IMG_TRIANGLE_DOWN;
+ else
+ if ( bHighContrastMode )
+ nResourceId = IMG_TRIANGLE_RIGHT_HC;
+ else
+ nResourceId = IMG_TRIANGLE_RIGHT;
+ return Image( SvtResId( nResourceId ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ USHORT ToolPanelDrawer::impl_getTextStyle() const
+ {
+ const USHORT nBasicStyle = TEXT_DRAW_LEFT
+ | TEXT_DRAW_TOP
+ | TEXT_DRAW_WORDBREAK;
+
+ if ( IsEnabled() )
+ return nBasicStyle;
+
+ return nBasicStyle | TEXT_DRAW_DISABLE;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanelDrawer::impl_paintBackground( const Rectangle& i_rTitleBarBox )
+ {
+ m_pPaintDevice->SetFillColor( GetSettings().GetStyleSettings().GetDialogColor() );
+ m_pPaintDevice->DrawRect( i_rTitleBarBox );
+
+ m_pPaintDevice->SetFillColor();
+ m_pPaintDevice->SetLineColor( GetSettings().GetStyleSettings().GetLightColor() );
+ m_pPaintDevice->DrawLine( i_rTitleBarBox.TopLeft(), i_rTitleBarBox.TopRight() );
+ m_pPaintDevice->DrawLine( i_rTitleBarBox.TopLeft(), i_rTitleBarBox.BottomLeft() );
+
+ m_pPaintDevice->SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() );
+ m_pPaintDevice->DrawLine( i_rTitleBarBox.BottomLeft(), i_rTitleBarBox.BottomRight() );
+ m_pPaintDevice->DrawLine( i_rTitleBarBox.TopRight(), i_rTitleBarBox.BottomRight() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanelDrawer::impl_paintFocusIndicator( const Rectangle& i_rTextBox )
+ {
+ if ( m_bFocused )
+ {
+ const Rectangle aTextPixelBox( m_pPaintDevice->LogicToPixel( i_rTextBox ) );
+
+ m_pPaintDevice->EnableMapMode( FALSE );
+ m_pPaintDevice->SetFillColor();
+
+ Rectangle aBox( i_rTextBox );
+ aBox.Top() -= 1;
+ aBox.Bottom() += 1;
+
+ m_pPaintDevice->DrawRect( aTextPixelBox );
+
+ LineInfo aDottedStyle( LINE_DASH );
+ aDottedStyle.SetDashCount( 0 );
+ aDottedStyle.SetDotCount( 1 );
+ aDottedStyle.SetDotLen( 1 );
+ aDottedStyle.SetDistance( 1 );
+
+ m_pPaintDevice->SetLineColor( COL_BLACK );
+ m_pPaintDevice->DrawPolyLine( Polygon( aTextPixelBox ), aDottedStyle );
+ m_pPaintDevice->EnableMapMode( FALSE );
+ }
+ else
+ HideFocus();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanelDrawer::GetFocus()
+ {
+ m_bFocused = true;
+ Invalidate();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanelDrawer::LoseFocus()
+ {
+ m_bFocused = false;
+ Invalidate();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanelDrawer::Resize()
+ {
+ Window::Resize();
+ m_aVisualization.SetPosSizePixel( Point(), GetOutputSizePixel() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanelDrawer::MouseButtonDown( const MouseEvent& i_rMouseEvent )
+ {
+ // consume this event, and do not forward to the base class - it would sent a NotifyEvent, which in turn, when
+ // we live in a DockingWindow, would start undocking
+ (void)i_rMouseEvent;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanelDrawer::DataChanged( const DataChangedEvent& i_rEvent )
+ {
+ Window::DataChanged( i_rEvent );
+
+ switch ( i_rEvent.GetType() )
+ {
+ case DATACHANGED_SETTINGS:
+ if ( ( i_rEvent.GetFlags() & SETTINGS_STYLE ) == 0 )
+ break;
+ SetSettings( Application::GetSettings() );
+ m_pPaintDevice.reset( new VirtualDevice( *this ) );
+
+ // fall through.
+
+ case DATACHANGED_FONTS:
+ case DATACHANGED_FONTSUBSTITUTION:
+ {
+ const StyleSettings& rStyleSettings( GetSettings().GetStyleSettings() );
+
+ // Font.
+ Font aFont = rStyleSettings.GetAppFont();
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+ SetZoomedPointFont( aFont );
+
+ // Color.
+ Color aColor;
+ if ( IsControlForeground() )
+ aColor = GetControlForeground();
+ else
+ aColor = rStyleSettings.GetButtonTextColor();
+ SetTextColor( aColor );
+ SetTextFillColor();
+
+ Invalidate();
+ }
+ break;
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XWindowPeer > ToolPanelDrawer::GetComponentInterface( BOOL i_bCreate )
+ {
+ Reference< XWindowPeer > xWindowPeer( Window::GetComponentInterface( FALSE ) );
+ if ( !xWindowPeer.is() && i_bCreate )
+ {
+ xWindowPeer.set( new ToolPanelDrawerPeer() );
+ SetComponentInterface( xWindowPeer );
+ }
+ return xWindowPeer;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle ToolPanelDrawer::impl_calcTextBoundingBox() const
+ {
+ Font aFont( GetFont() );
+ if ( m_bExpanded )
+ aFont.SetWeight( m_bExpanded ? WEIGHT_BOLD : WEIGHT_NORMAL );
+ m_pPaintDevice->SetFont( aFont );
+
+ int nAvailableWidth = m_pPaintDevice->GetTextWidth( GetText() );
+
+ Rectangle aTextBox(
+ Point(),
+ Size(
+ nAvailableWidth,
+ GetSettings().GetStyleSettings().GetTitleHeight()
+ )
+ );
+ aTextBox.Top() += ( aTextBox.GetHeight() - GetTextHeight() ) / 2;
+ aTextBox.Left() += s_nIndentationWidth;
+ aTextBox.Right() -= 1;
+
+ aTextBox = m_pPaintDevice->GetTextRect( aTextBox, GetText(), impl_getTextStyle() );
+ return aTextBox;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle ToolPanelDrawer::impl_calcTitleBarBox( const Rectangle& i_rTextBox ) const
+ {
+ Rectangle aTitleBarBox( i_rTextBox );
+ aTitleBarBox.Bottom() += aTitleBarBox.Top();
+ aTitleBarBox.Top() = 0;
+ aTitleBarBox.Left() = 0;
+
+ const long nWidth = GetOutputSizePixel().Width();
+ if ( aTitleBarBox.GetWidth() < nWidth )
+ aTitleBarBox.Right() = nWidth - 1;
+
+ return aTitleBarBox;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanelDrawer::SetExpanded( const bool i_bExpanded )
+ {
+ if ( m_bExpanded != i_bExpanded )
+ {
+ m_bExpanded = i_bExpanded;
+ CallEventListeners( m_bExpanded ? VCLEVENT_ITEM_EXPANDED : VCLEVENT_ITEM_COLLAPSED );
+ Invalidate();
+ }
+ }
+
+//......................................................................................................................
+} // namespace svt
+//......................................................................................................................
diff --git a/svtools/source/toolpanel/toolpaneldrawer.hxx b/svtools/source/toolpanel/toolpaneldrawer.hxx
new file mode 100644
index 000000000000..a465a0a6c9e1
--- /dev/null
+++ b/svtools/source/toolpanel/toolpaneldrawer.hxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ * 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 <vcl/window.hxx>
+#include <vcl/virdev.hxx>
+
+//......................................................................................................................
+namespace svt
+{
+//......................................................................................................................
+
+ class ToolPanelDrawer;
+ //==================================================================================================================
+ //= DrawerVisualization
+ //==================================================================================================================
+ /** serves a single purpose - let ZoomText read the drawers ...
+
+ Strange enough, ZoomText does not read the drawers when they get the focus (in none of the combinations
+ of AccessibleRoles I tried), except when it does have an AccessibleChild with the role LABEL. To "inject"
+ such a child into the A11Y hierarchy, we use this window here.
+
+ (We could also inject the A11Y component on the A11Y level only, but this would mean additional code. With
+ this approach here, VCL/toolkit will take care of creating and maintaining the A11Y component for us.)
+ */
+ class DrawerVisualization : public Window
+ {
+ public:
+ DrawerVisualization( ToolPanelDrawer& i_rParent );
+ ~DrawerVisualization();
+
+ protected:
+ // Window overridables
+ virtual void Paint( const Rectangle& i_rBoundingBox );
+
+ private:
+ ToolPanelDrawer& m_rDrawer;
+ };
+
+ //==================================================================================================================
+ //= ToolPanelDrawer
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ class ToolPanelDrawer : public Window
+ {
+ public:
+ ToolPanelDrawer( Window& i_rParent, const ::rtl::OUString& i_rTitle );
+ ~ToolPanelDrawer();
+
+ long GetPreferredHeightPixel() const;
+ void SetExpanded( const bool i_bExpanded );
+ bool IsExpanded() const { return m_bExpanded; }
+
+ void Paint();
+
+ protected:
+ // Window overridables
+ virtual void GetFocus();
+ virtual void LoseFocus();
+ virtual void Resize();
+ virtual void DataChanged( const DataChangedEvent& i_rEvent );
+ virtual void MouseButtonDown( const MouseEvent& i_rMouseEvent );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >
+ GetComponentInterface( BOOL i_bCreate );
+
+ private:
+ Rectangle impl_calcTextBoundingBox() const;
+ Rectangle impl_calcTitleBarBox( const Rectangle& i_rTextBox ) const;
+ void impl_paintBackground( const Rectangle& i_rTitleBarBox );
+ USHORT impl_getTextStyle() const;
+ void impl_paintFocusIndicator( const Rectangle& i_rTextBox );
+ Rectangle impl_paintExpansionIndicator( const Rectangle& i_rTextBox );
+ Image impl_getExpansionIndicator() const;
+
+ // don't expose SetText. Our text is used as AccessibleName/Desc, and those are not expected to change.
+ using Window::SetText;
+ using Window::Paint;
+
+ private:
+ ::std::auto_ptr< VirtualDevice > m_pPaintDevice;
+ DrawerVisualization m_aVisualization;
+ bool m_bFocused;
+ bool m_bExpanded;
+ };
+
+//......................................................................................................................
+} // namespace svt
+//......................................................................................................................
diff --git a/svtools/source/toolpanel/toolpaneldrawerpeer.cxx b/svtools/source/toolpanel/toolpaneldrawerpeer.cxx
new file mode 100644
index 000000000000..959527330897
--- /dev/null
+++ b/svtools/source/toolpanel/toolpaneldrawerpeer.cxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ * 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 "toolpaneldrawerpeer.hxx"
+#include "toolpaneldrawer.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+/** === end UNO includes === **/
+
+#include <tools/diagnose_ex.h>
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <vcl/vclevent.hxx>
+
+//......................................................................................................................
+namespace svt
+{
+//......................................................................................................................
+
+ /** === 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::accessibility::XAccessibleContext;
+ /** === end UNO using === **/
+ namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType;
+ namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId;
+
+ //==================================================================================================================
+ //= ToolPanelDrawerContext
+ //==================================================================================================================
+ class ToolPanelDrawerContext : public VCLXAccessibleComponent
+ {
+ public:
+ ToolPanelDrawerContext( VCLXWindow& i_rWindow )
+ :VCLXAccessibleComponent( &i_rWindow )
+ {
+ }
+
+ virtual void ProcessWindowEvent( const VclWindowEvent& i_rVclWindowEvent );
+ virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet );
+
+ protected:
+ ~ToolPanelDrawerContext()
+ {
+ }
+ };
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanelDrawerContext::ProcessWindowEvent( const VclWindowEvent& i_rVclWindowEvent )
+ {
+ VCLXAccessibleComponent::ProcessWindowEvent( i_rVclWindowEvent );
+
+ switch ( i_rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_ITEM_EXPANDED:
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, Any(), makeAny( AccessibleStateType::EXPANDED ) );
+ break;
+ case VCLEVENT_ITEM_COLLAPSED:
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, makeAny( AccessibleStateType::EXPANDED ), Any() );
+ break;
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanelDrawerContext::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet )
+ {
+ VCLXAccessibleComponent::FillAccessibleStateSet( i_rStateSet );
+ if ( !GetWindow() )
+ return;
+
+ i_rStateSet.AddState( AccessibleStateType::EXPANDABLE );
+ i_rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+
+ const ToolPanelDrawer* pDrawer( dynamic_cast< const ToolPanelDrawer* > ( GetWindow() ) );
+ ENSURE_OR_RETURN_VOID( pDrawer, "ToolPanelDrawerContext::FillAccessibleStateSet: illegal window!" );
+ if ( pDrawer->IsExpanded() )
+ i_rStateSet.AddState( AccessibleStateType::EXPANDED );
+
+ if ( pDrawer->HasChildPathFocus() )
+ i_rStateSet.AddState( AccessibleStateType::FOCUSED );
+ }
+
+ //==================================================================================================================
+ //= ToolPanelDrawerPeer
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ ToolPanelDrawerPeer::ToolPanelDrawerPeer()
+ :VCLXWindow()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ToolPanelDrawerPeer::~ToolPanelDrawerPeer()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessibleContext > ToolPanelDrawerPeer::CreateAccessibleContext()
+ {
+ ::vos::OGuard aSolarGuard( GetMutex() );
+ return new ToolPanelDrawerContext( *this );
+ }
+
+//......................................................................................................................
+} // namespace svt
+//......................................................................................................................
diff --git a/svtools/source/toolpanel/toolpaneldrawerpeer.hxx b/svtools/source/toolpanel/toolpaneldrawerpeer.hxx
new file mode 100644
index 000000000000..5fcf0ac0ae7c
--- /dev/null
+++ b/svtools/source/toolpanel/toolpaneldrawerpeer.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ * 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 SVT_TOOLPANELDRAWERPEER_HXX
+#define SVT_TOOLPANELDRAWERPEER_HXX
+
+#include <toolkit/awt/vclxwindow.hxx>
+
+//......................................................................................................................
+namespace svt
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= ToolPanelDrawerPeer
+ //==================================================================================================================
+ class ToolPanelDrawerPeer : public VCLXWindow
+ {
+ public:
+ ToolPanelDrawerPeer();
+
+ protected:
+ ~ToolPanelDrawerPeer();
+
+ // VCLXWindow overridables
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext();
+ };
+
+//......................................................................................................................
+} // namespace svt
+//......................................................................................................................
+
+#endif // SVT_TOOLPANELDRAWERPEER_HXX
diff --git a/svtools/source/uno/makefile.mk b/svtools/source/uno/makefile.mk
index 7bfe37624947..7c1c44006047 100644
--- a/svtools/source/uno/makefile.mk
+++ b/svtools/source/uno/makefile.mk
@@ -38,9 +38,6 @@ ENABLE_EXCEPTIONS=TRUE
# --- Files --------------------------------------------------------
-SRS1NAME= uno
-SRC1FILES= unoifac2.src
-
SLOFILES= \
$(SLO)$/addrtempuno.obj \
$(SLO)$/contextmenuhelper.obj \
@@ -55,7 +52,9 @@ SLOFILES= \
$(SLO)$/unoevent.obj \
$(SLO)$/unoiface.obj \
$(SLO)$/unoimap.obj \
- $(SLO)$/svtxgridcontrol.obj
+ $(SLO)$/svtxgridcontrol.obj \
+ $(SLO)$/popupwindowcontroller.obj \
+ $(SLO)$/popupmenucontrollerbase.obj
# --- Targets ------------------------------------------------------
diff --git a/svtools/source/uno/miscservices.cxx b/svtools/source/uno/miscservices.cxx
index 433c1e1acbcb..e16a1ecb56dc 100644
--- a/svtools/source/uno/miscservices.cxx
+++ b/svtools/source/uno/miscservices.cxx
@@ -38,10 +38,13 @@
#include <uno/mapping.hxx>
#include "provider.hxx"
#include "renderer.hxx"
+#include "unowizard.hxx"
#include <com/sun/star/registry/XRegistryKey.hpp>
#include "comphelper/servicedecl.hxx"
+#include "cppuhelper/implementationentry.hxx"
+
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::registry;
using namespace ::com::sun::star::lang;
@@ -67,6 +70,20 @@ extern sdecl::ServiceDecl const serviceDecl;
Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& ); \
}
+namespace
+{
+ static struct ::cppu::ImplementationEntry s_aServiceEntries[] =
+ {
+ {
+ ::svt::uno::Wizard::Create,
+ ::svt::uno::Wizard::getImplementationName_static,
+ ::svt::uno::Wizard::getSupportedServiceNames_static,
+ ::cppu::createSingleComponentFactory, NULL, 0
+ },
+ { 0, 0, 0, 0, 0, 0 }
+ };
+}
+
// -------------------------------------------------------------------------------------
DECLARE_CREATEINSTANCE_NAMESPACE( svt, OAddressBookSourceDialogUno )
@@ -126,9 +143,9 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo (
xNewKey->createKey( aServices.getConstArray()[ i ] );
if ( !component_writeInfoHelper( reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), reinterpret_cast< registry::XRegistryKey* >( _pRegistryKey ), serviceDecl ) )
- return false;
+ return false;
- return sal_True;
+ return ::cppu::component_writeInfoHelper( pServiceManager, _pRegistryKey, s_aServiceEntries );
}
return sal_False;
}
@@ -185,6 +202,8 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory (
else
{
pResult = component_getFactoryHelper( pImplementationName, reinterpret_cast< lang::XMultiServiceFactory * >( _pServiceManager ),reinterpret_cast< registry::XRegistryKey* >( pRegistryKey ), serviceDecl );
+ if ( !pResult )
+ pResult = ::cppu::component_getFactoryHelper( pImplementationName, _pServiceManager, pRegistryKey, s_aServiceEntries );
}
if ( xFactory.is() )
diff --git a/svtools/source/uno/popupmenucontrollerbase.cxx b/svtools/source/uno/popupmenucontrollerbase.cxx
new file mode 100644
index 000000000000..ac75a1b9a24b
--- /dev/null
+++ b/svtools/source/uno/popupmenucontrollerbase.cxx
@@ -0,0 +1,420 @@
+/*************************************************************************
+ *
+ * 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"
+
+//_________________________________________________________________________________________________________________
+// my own includes
+//_________________________________________________________________________________________________________________
+#include "svtools/popupmenucontrollerbase.hxx"
+
+
+//_________________________________________________________________________________________________________________
+// interface includes
+//_________________________________________________________________________________________________________________
+#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/awt/MenuItemStyle.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/awt/XMenuExtended.hpp>
+
+//_________________________________________________________________________________________________________________
+// includes of other projects
+//_________________________________________________________________________________________________________________
+
+#ifndef _VCL_MENU_HXX_
+#include <vcl/menu.hxx>
+#endif
+#include <vcl/svapp.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/logfile.hxx>
+#include <vos/mutex.hxx>
+
+//_________________________________________________________________________________________________________________
+// Defines
+//_________________________________________________________________________________________________________________
+//
+
+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::frame;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::util;
+
+namespace svt
+{
+
+struct PopupMenuControllerBaseDispatchInfo
+{
+ Reference< XDispatch > mxDispatch;
+ const URL maURL;
+ const Sequence< PropertyValue > maArgs;
+
+ PopupMenuControllerBaseDispatchInfo( const Reference< XDispatch >& xDispatch, const URL& rURL, const Sequence< PropertyValue >& rArgs )
+ : mxDispatch( xDispatch ), maURL( rURL ), maArgs( rArgs ) {}
+};
+
+PopupMenuControllerBase::PopupMenuControllerBase( const Reference< XMultiServiceFactory >& xServiceManager ) :
+ ::comphelper::OBaseMutex(),
+ PopupMenuControllerBaseType(m_aMutex),
+ m_bInitialized( false ),
+ m_xServiceManager( xServiceManager )
+{
+ if ( m_xServiceManager.is() )
+ m_xURLTransformer.set( m_xServiceManager->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))),UNO_QUERY );
+}
+
+PopupMenuControllerBase::~PopupMenuControllerBase()
+{
+}
+
+// protected function
+void PopupMenuControllerBase::throwIfDisposed() throw ( RuntimeException )
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ throw com::sun::star::lang::DisposedException();
+}
+
+// protected function
+void PopupMenuControllerBase::resetPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu )
+{
+ VCLXPopupMenu* pPopupMenu = 0;
+ if ( rPopupMenu.is() && rPopupMenu->getItemCount() > 0 )
+ {
+ pPopupMenu = (VCLXPopupMenu *)VCLXMenu::GetImplementation( rPopupMenu );
+ if ( pPopupMenu )
+ {
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+
+ PopupMenu* pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu();
+ pVCLPopupMenu->Clear();
+ }
+ }
+}
+
+void SAL_CALL PopupMenuControllerBase::disposing()
+{
+ // Reset our members and set disposed flag
+ osl::MutexGuard aLock( m_aMutex );
+ m_xFrame.clear();
+ m_xDispatch.clear();
+ m_xPopupMenu.clear();
+ m_xServiceManager.clear();
+}
+
+// XServiceInfo
+
+sal_Bool SAL_CALL PopupMenuControllerBase::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException)
+{
+ const Sequence< rtl::OUString > aSNL( getSupportedServiceNames() );
+ const rtl::OUString * pArray = aSNL.getConstArray();
+
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return true;
+
+ return false;
+}
+
+// XEventListener
+void SAL_CALL PopupMenuControllerBase::disposing( const EventObject& ) throw ( RuntimeException )
+{
+ osl::MutexGuard aLock( m_aMutex );
+ m_xFrame.clear();
+ m_xDispatch.clear();
+ m_xPopupMenu.clear();
+}
+
+// XMenuListener
+void SAL_CALL PopupMenuControllerBase::highlight( const awt::MenuEvent& ) throw (RuntimeException)
+{
+}
+
+void PopupMenuControllerBase::impl_select(const Reference< XDispatch >& _xDispatch,const URL& aURL)
+{
+ Sequence<PropertyValue> aArgs;
+ OSL_ENSURE(_xDispatch.is(),"PopupMenuControllerBase::impl_select: No dispatch");
+ if ( _xDispatch.is() )
+ _xDispatch->dispatch( aURL, aArgs );
+}
+
+void SAL_CALL PopupMenuControllerBase::select( const awt::MenuEvent& rEvent ) throw (RuntimeException)
+{
+ throwIfDisposed();
+
+ osl::MutexGuard aLock( m_aMutex );
+
+ Reference< awt::XMenuExtended > xExtMenu( m_xPopupMenu, UNO_QUERY );
+ if( xExtMenu.is() )
+ {
+ Sequence<PropertyValue> aArgs;
+ dispatchCommand( xExtMenu->getCommand( rEvent.MenuId ), aArgs );
+ }
+}
+
+void PopupMenuControllerBase::dispatchCommand( const ::rtl::OUString& sCommandURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs )
+{
+ osl::MutexGuard aLock( m_aMutex );
+
+ throwIfDisposed();
+
+ try
+ {
+ Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY_THROW );
+ URL aURL;
+ aURL.Complete = sCommandURL;
+ m_xURLTransformer->parseStrict( aURL );
+
+ Reference< XDispatch > xDispatch( xDispatchProvider->queryDispatch( aURL, OUString(), 0 ), UNO_QUERY_THROW );
+
+ Application::PostUserEvent( STATIC_LINK(0, PopupMenuControllerBase, ExecuteHdl_Impl), new PopupMenuControllerBaseDispatchInfo( xDispatch, aURL, rArgs ) );
+
+ }
+ catch( Exception& )
+ {
+ }
+
+}
+
+IMPL_STATIC_LINK_NOINSTANCE( PopupMenuControllerBase, ExecuteHdl_Impl, PopupMenuControllerBaseDispatchInfo*, pDispatchInfo )
+{
+ pDispatchInfo->mxDispatch->dispatch( pDispatchInfo->maURL, pDispatchInfo->maArgs );
+ delete pDispatchInfo;
+ return 0;
+}
+
+void SAL_CALL PopupMenuControllerBase::activate( const awt::MenuEvent& ) throw (RuntimeException)
+{
+}
+
+void SAL_CALL PopupMenuControllerBase::deactivate( const awt::MenuEvent& ) throw (RuntimeException)
+{
+}
+
+void SAL_CALL PopupMenuControllerBase::updatePopupMenu() throw ( ::com::sun::star::uno::RuntimeException )
+{
+ osl::ClearableMutexGuard aLock( m_aMutex );
+ throwIfDisposed();
+ aLock.clear();
+
+ updateCommand( m_aCommandURL );
+}
+
+void SAL_CALL PopupMenuControllerBase::updateCommand( const rtl::OUString& rCommandURL )
+{
+ osl::ClearableMutexGuard aLock( m_aMutex );
+ Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY );
+ Reference< XDispatch > xDispatch( m_xDispatch );
+ URL aTargetURL;
+ aTargetURL.Complete = rCommandURL;
+ m_xURLTransformer->parseStrict( aTargetURL );
+ aLock.clear();
+
+ // Add/remove status listener to get a status update once
+ if ( xDispatch.is() )
+ {
+ xDispatch->addStatusListener( xStatusListener, aTargetURL );
+ xDispatch->removeStatusListener( xStatusListener, aTargetURL );
+ }
+}
+
+
+// XDispatchProvider
+Reference< XDispatch > SAL_CALL
+PopupMenuControllerBase::queryDispatch(
+ const URL& /*aURL*/,
+ const rtl::OUString& /*sTarget*/,
+ sal_Int32 /*nFlags*/ )
+throw( RuntimeException )
+{
+ // must be implemented by subclass
+ osl::MutexGuard aLock( m_aMutex );
+ throwIfDisposed();
+
+ return Reference< XDispatch >();
+}
+
+Sequence< Reference< XDispatch > > SAL_CALL PopupMenuControllerBase::queryDispatches( const Sequence< DispatchDescriptor >& lDescriptor ) throw( RuntimeException )
+{
+ // Create return list - which must have same size then the given descriptor
+ // It's not allowed to pack it!
+ osl::ClearableMutexGuard aLock( m_aMutex );
+ throwIfDisposed();
+ aLock.clear();
+
+ sal_Int32 nCount = lDescriptor.getLength();
+ uno::Sequence< uno::Reference< frame::XDispatch > > lDispatcher( nCount );
+
+ // Step over all descriptors and try to get any dispatcher for it.
+ for( sal_Int32 i=0; i<nCount; ++i )
+ {
+ lDispatcher[i] = queryDispatch( lDescriptor[i].FeatureURL ,
+ lDescriptor[i].FrameName ,
+ lDescriptor[i].SearchFlags );
+ }
+
+ return lDispatcher;
+}
+
+// XDispatch
+void SAL_CALL
+PopupMenuControllerBase::dispatch(
+ const URL& /*aURL*/,
+ const Sequence< PropertyValue >& /*seqProperties*/ )
+throw( ::com::sun::star::uno::RuntimeException )
+{
+ // must be implemented by subclass
+ osl::MutexGuard aLock( m_aMutex );
+ throwIfDisposed();
+}
+
+void SAL_CALL
+PopupMenuControllerBase::addStatusListener(
+ const Reference< XStatusListener >& xControl,
+ const URL& aURL )
+throw( ::com::sun::star::uno::RuntimeException )
+{
+ osl::ResettableMutexGuard aLock( m_aMutex );
+ throwIfDisposed();
+ aLock.clear();
+
+ bool bStatusUpdate( false );
+ rBHelper.addListener( ::getCppuType( &xControl ), xControl );
+
+ aLock.reset();
+ if ( aURL.Complete.indexOf( m_aBaseURL ) == 0 )
+ bStatusUpdate = true;
+ aLock.clear();
+
+ if ( bStatusUpdate )
+ {
+ // Dummy update for popup menu controllers
+ FeatureStateEvent aEvent;
+ aEvent.FeatureURL = aURL;
+ aEvent.IsEnabled = sal_True;
+ aEvent.Requery = sal_False;
+ aEvent.State = Any();
+ xControl->statusChanged( aEvent );
+ }
+}
+
+void SAL_CALL PopupMenuControllerBase::removeStatusListener(
+ const Reference< XStatusListener >& xControl,
+ const URL& /*aURL*/ )
+throw( ::com::sun::star::uno::RuntimeException )
+{
+ rBHelper.removeListener( ::getCppuType( &xControl ), xControl );
+}
+
+::rtl::OUString PopupMenuControllerBase::determineBaseURL( const ::rtl::OUString& aURL )
+{
+ // Just use the main part of the URL for popup menu controllers
+ sal_Int32 nQueryPart( 0 );
+ sal_Int32 nSchemePart( 0 );
+ rtl::OUString aMainURL( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.popup:" ));
+
+ nSchemePart = aURL.indexOf( ':' );
+ if (( nSchemePart > 0 ) &&
+ ( aURL.getLength() > ( nSchemePart+1 )))
+ {
+ nQueryPart = aURL.indexOf( '?', nSchemePart );
+ if ( nQueryPart > 0 )
+ aMainURL += aURL.copy( nSchemePart, nQueryPart-nSchemePart );
+ else if ( nQueryPart == -1 )
+ aMainURL += aURL.copy( nSchemePart+1 );
+ }
+
+ return aMainURL;
+}
+
+// XInitialization
+void SAL_CALL PopupMenuControllerBase::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
+{
+ osl::MutexGuard aLock( m_aMutex );
+
+ sal_Bool bInitalized( m_bInitialized );
+ if ( !bInitalized )
+ {
+ PropertyValue aPropValue;
+ rtl::OUString aCommandURL;
+ Reference< XFrame > xFrame;
+
+ for ( int i = 0; i < aArguments.getLength(); i++ )
+ {
+ if ( aArguments[i] >>= aPropValue )
+ {
+ if ( aPropValue.Name.equalsAscii( "Frame" ))
+ aPropValue.Value >>= xFrame;
+ else if ( aPropValue.Name.equalsAscii( "CommandURL" ))
+ aPropValue.Value >>= aCommandURL;
+ }
+ }
+
+ if ( xFrame.is() && aCommandURL.getLength() )
+ {
+ m_xFrame = xFrame;
+ m_aCommandURL = aCommandURL;
+ m_aBaseURL = determineBaseURL( aCommandURL );
+ m_bInitialized = true;
+ }
+ }
+}
+// XPopupMenuController
+void SAL_CALL PopupMenuControllerBase::setPopupMenu( const Reference< awt::XPopupMenu >& xPopupMenu ) throw ( RuntimeException )
+{
+ osl::MutexGuard aLock( m_aMutex );
+ throwIfDisposed();
+
+ if ( m_xFrame.is() && !m_xPopupMenu.is() )
+ {
+ // Create popup menu on demand
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+
+ m_xPopupMenu = xPopupMenu;
+ m_xPopupMenu->addMenuListener( Reference< awt::XMenuListener >( (OWeakObject*)this, UNO_QUERY ));
+
+ Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
+
+ URL aTargetURL;
+ aTargetURL.Complete = m_aCommandURL;
+ m_xURLTransformer->parseStrict( aTargetURL );
+ m_xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
+
+ impl_setPopupMenu();
+
+ updatePopupMenu();
+ }
+}
+void PopupMenuControllerBase::impl_setPopupMenu()
+{
+}
+}
diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx
new file mode 100644
index 000000000000..4fbaff23714d
--- /dev/null
+++ b/svtools/source/uno/popupwindowcontroller.cxx
@@ -0,0 +1,258 @@
+/*************************************************************************
+ *
+ * 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 <toolkit/helper/vclunohelper.hxx>
+
+#include <vcl/toolbox.hxx>
+#include <vcl/svapp.hxx>
+
+#include "svtools/popupwindowcontroller.hxx"
+#include "svtools/toolbarmenu.hxx"
+
+using rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+
+
+namespace svt
+{
+
+class PopupWindowControllerImpl
+{
+public:
+ PopupWindowControllerImpl();
+ ~PopupWindowControllerImpl();
+
+ void SetPopupWindow( ::Window* pPopupWindow, ToolBox* pToolBox );
+
+ DECL_LINK( WindowEventListener, VclSimpleEvent* );
+ DECL_STATIC_LINK( PopupWindowControllerImpl, AsyncDeleteWindowHdl, Window* );
+
+private:
+ ::Window* mpPopupWindow;
+ ToolBox* mpToolBox;
+};
+
+PopupWindowControllerImpl::PopupWindowControllerImpl()
+: mpPopupWindow( 0 )
+, mpToolBox( 0 )
+{
+}
+
+PopupWindowControllerImpl::~PopupWindowControllerImpl()
+{
+ if( mpPopupWindow )
+ SetPopupWindow(0,0);
+}
+
+void PopupWindowControllerImpl::SetPopupWindow( ::Window* pPopupWindow, ToolBox* pToolBox )
+{
+ if( mpPopupWindow )
+ {
+ mpPopupWindow->RemoveEventListener( LINK( this, PopupWindowControllerImpl, WindowEventListener ) );
+ Application::PostUserEvent( STATIC_LINK( this, PopupWindowControllerImpl, AsyncDeleteWindowHdl ), mpPopupWindow );
+ }
+ mpPopupWindow = pPopupWindow;
+ mpToolBox = pToolBox;
+
+ if( mpPopupWindow )
+ {
+ mpPopupWindow->AddEventListener( LINK( this, PopupWindowControllerImpl, WindowEventListener ));
+ }
+}
+
+IMPL_LINK( PopupWindowControllerImpl, WindowEventListener, VclSimpleEvent*, pEvent )
+{
+ VclWindowEvent* pWindowEvent = dynamic_cast< VclWindowEvent* >( pEvent );
+ if( pWindowEvent )
+ {
+ switch( pWindowEvent->GetId() )
+ {
+ case VCLEVENT_WINDOW_CLOSE:
+ case VCLEVENT_WINDOW_ENDPOPUPMODE:
+ SetPopupWindow(0,0);
+ break;
+
+ case VCLEVENT_WINDOW_SHOW:
+ {
+ if( mpPopupWindow )
+ {
+ if( mpToolBox )
+ mpToolBox->CallEventListeners( VCLEVENT_DROPDOWN_OPEN, (void*)mpPopupWindow );
+ mpPopupWindow->CallEventListeners( VCLEVENT_WINDOW_GETFOCUS, 0 );
+
+ svtools::ToolbarMenu* pToolbarMenu = dynamic_cast< svtools::ToolbarMenu* >( mpPopupWindow );
+ if( pToolbarMenu )
+ pToolbarMenu->highlightFirstEntry();
+ break;
+ }
+ break;
+ }
+ case VCLEVENT_WINDOW_HIDE:
+ {
+ if( mpPopupWindow )
+ {
+ mpPopupWindow->CallEventListeners( VCLEVENT_WINDOW_LOSEFOCUS, 0 );
+ if( mpToolBox )
+ mpToolBox->CallEventListeners( VCLEVENT_DROPDOWN_CLOSE, (void*)mpPopupWindow );
+ }
+ break;
+ }
+ }
+ }
+ return 1;
+}
+
+//--------------------------------------------------------------------
+
+IMPL_STATIC_LINK( PopupWindowControllerImpl, AsyncDeleteWindowHdl, Window*, pWindow )
+{
+ (void)*pThis;
+ delete pWindow;
+ return 0;
+}
+
+//========================================================================
+// class PopupWindowController
+//========================================================================
+
+PopupWindowController::PopupWindowController( const Reference< lang::XMultiServiceFactory >& rServiceManager,
+ const Reference< frame::XFrame >& xFrame,
+ const OUString& aCommandURL )
+: svt::ToolboxController( rServiceManager, xFrame, aCommandURL )
+, mpImpl( new PopupWindowControllerImpl() )
+{
+}
+
+PopupWindowController::~PopupWindowController()
+{
+}
+
+// XInterface
+Any SAL_CALL PopupWindowController::queryInterface( const Type& aType )
+throw (RuntimeException)
+{
+ Any a( ToolboxController::queryInterface( aType ) );
+ if ( a.hasValue() )
+ return a;
+
+ return ::cppu::queryInterface( aType, static_cast< lang::XServiceInfo* >( this ));
+}
+
+void SAL_CALL PopupWindowController::acquire() throw ()
+{
+ ToolboxController::acquire();
+}
+
+void SAL_CALL PopupWindowController::release() throw ()
+{
+ ToolboxController::release();
+}
+
+// XServiceInfo
+sal_Bool SAL_CALL PopupWindowController::supportsService( const OUString& ServiceName ) throw(RuntimeException)
+{
+ const Sequence< OUString > aSNL( getSupportedServiceNames() );
+ const OUString * pArray = aSNL.getConstArray();
+
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return true;
+
+ return false;
+}
+
+// XInitialization
+void SAL_CALL PopupWindowController::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ svt::ToolboxController::initialize( aArguments );
+ if( m_aCommandURL.getLength() )
+ addStatusListener( m_aCommandURL );
+}
+
+// XComponent
+void SAL_CALL PopupWindowController::dispose() throw (RuntimeException)
+{
+ if( m_aCommandURL.getLength() )
+ removeStatusListener( m_aCommandURL );
+
+ svt::ToolboxController::dispose();
+}
+
+
+// XStatusListener
+void SAL_CALL PopupWindowController::statusChanged( const frame::FeatureStateEvent& rEvent ) throw ( RuntimeException )
+{
+ svt::ToolboxController::statusChanged(rEvent);
+ enable( rEvent.IsEnabled );
+}
+
+// XToolbarController
+void SAL_CALL PopupWindowController::execute( sal_Int16 KeyModifier ) throw (RuntimeException)
+{
+ svt::ToolboxController::execute( KeyModifier );
+}
+
+void SAL_CALL PopupWindowController::click() throw (RuntimeException)
+{
+ svt::ToolboxController::click();
+}
+
+void SAL_CALL PopupWindowController::doubleClick() throw (RuntimeException)
+{
+ svt::ToolboxController::doubleClick();
+}
+
+Reference< awt::XWindow > SAL_CALL PopupWindowController::createPopupWindow() throw (RuntimeException)
+{
+ ToolBox* pToolBox = dynamic_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) );
+ if( pToolBox )
+ {
+ ::Window* pItemWindow = pToolBox->GetItemWindow( pToolBox->GetDownItemId() );
+ ::Window* pWin = createPopupWindow( pItemWindow ? pItemWindow : pToolBox );
+ if( pWin )
+ {
+ pWin->EnableDocking(true);
+ mpImpl->SetPopupWindow(pWin,pToolBox);
+ ::Window::GetDockingManager()->StartPopupMode( pToolBox, pWin, FLOATWIN_POPUPMODE_NOFOCUSCLOSE|FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE |FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE );
+ }
+ }
+ return Reference< awt::XWindow >();
+}
+
+Reference< awt::XWindow > SAL_CALL PopupWindowController::createItemWindow( const Reference< awt::XWindow >& /*Parent*/ )
+ throw (RuntimeException)
+{
+ return Reference< awt::XWindow >();
+}
+
+}
+
diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx
index 80c31e65d4f1..f5bc837f60b0 100755
--- a/svtools/source/uno/svtxgridcontrol.cxx
+++ b/svtools/source/uno/svtxgridcontrol.cxx
@@ -28,6 +28,7 @@
#include "precompiled_svtools.hxx"
#include "svtxgridcontrol.hxx"
+#include "accessibletableimp.hxx"
#include <com/sun/star/view/SelectionType.hpp>
#include "svtools/table/gridtablerenderer.hxx"
#include "svtools/table/defaultinputhandler.hxx"
@@ -37,12 +38,17 @@
#include <rtl/ref.hxx>
#include <tools/debug.hxx>
#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;
@@ -63,22 +69,25 @@ SVTXGridControl::SVTXGridControl()
m_bHasColumnHeaders(false),
m_bHasRowHeaders(false),
m_bVScroll(false),
- m_bHScroll(false)
+ m_bHScroll(false),
+ m_bUpdate(false),
+ m_nSelectedRowCount(0),
+ m_aSelectionListeners( *this )
{
}
//--------------------------------------------------------------------
SVTXGridControl::~SVTXGridControl()
{
- DELETEZ(m_pTableModel);
}
::com::sun::star::uno::Any SVTXGridControl::queryInterface( 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::grid::XGridControl*, this ),
- SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridDataListener*, this ),
- SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
+ 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 ));
}
@@ -90,36 +99,26 @@ IMPL_XTYPEPROVIDER_START( SVTXGridControl )
VCLXWindow::getTypes()
IMPL_XTYPEPROVIDER_END
-::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL SVTXGridControl::getColumnModel( ) throw (::com::sun::star::uno::RuntimeException)
-{
- return NULL;
-}
-void SAL_CALL SVTXGridControl::setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException)
-{
- (void)model;
-}
-::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL SVTXGridControl::getDataModel( ) throw (::com::sun::star::uno::RuntimeException)
-{
- return NULL;
-}
-void SAL_CALL SVTXGridControl::setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException)
-{
- (void)model;
-}
sal_Int32 SAL_CALL SVTXGridControl::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
{
TableControl* pTable = (TableControl*)GetWindow();
return pTable->GetCurrentRow( Point(x,y) );
}
+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)
+{
+ TableControl* pTable = (TableControl*)GetWindow();
+ pTable->setTooltip(text, columns);
+}
+
void SAL_CALL SVTXGridControl::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
{
- (void)listener;
+ 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)
{
- (void) listener;
+ m_aSelectionListeners.removeInterface(listener);
}
void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const Any& aValue) throw(RuntimeException)
@@ -127,9 +126,20 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
::vos::OGuard aGuard( GetMutex() );
TableControl* pTable = (TableControl*)GetWindow();
-
switch( GetPropertyId( PropertyName ) )
{
+ 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() );
+ else
+ pTable->getDataWindow()->SetBackground();
+ }
+ break;
+
case BASEPROPERTY_GRID_SELECTIONMODE:
{
SelectionType eSelectionType;
@@ -155,6 +165,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
if( aValue >>= bHScroll )
{
m_bHScroll = bHScroll;
+ m_pTableModel->setHorizontalScrollbarVisibility(bHScroll);
}
break;
}
@@ -164,9 +175,11 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
if( aValue >>= bVScroll )
{
m_bVScroll = bVScroll;
+ m_pTableModel->setVerticalScrollbarVisibility(bVScroll);
}
break;
}
+
case BASEPROPERTY_GRID_SHOWROWHEADER:
{
sal_Bool rowHeader = true;
@@ -176,6 +189,66 @@ 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);
+ }
+ break;
+ }
+ case BASEPROPERTY_GRID_LINE_COLOR:
+ {
+ sal_Int32 colorLine = 0xFFFFFF;
+ if( aValue >>= colorLine )
+ {
+ m_pTableModel->setLineColor(colorLine);
+ }
+ break;
+ }
+ case BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND:
+ {
+ sal_Int32 colorEvenRow = 0xFFFFFF;
+ if( aValue >>= colorEvenRow )
+ {
+ m_pTableModel->setEvenRowBackgroundColor(colorEvenRow);
+ }
+ break;
+ }
+ case BASEPROPERTY_GRID_ROW_BACKGROUND:
+ {
+ sal_Int32 colorBackground = 0xFFFFFF;
+ if( aValue >>= colorBackground )
+ {
+ m_pTableModel->setOddRowBackgroundColor(colorBackground);
+ }
+ break;
+ }
+ case BASEPROPERTY_TEXTCOLOR:
+ {
+ sal_Int32 colorText = 0x000000;
+ if( aValue >>= colorText )
+ {
+ m_pTableModel->setTextColor(colorText);
+ }
+ 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;
+ }
+ }
+ break;
+ }
case BASEPROPERTY_GRID_SHOWCOLUMNHEADER:
{
@@ -188,40 +261,97 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
}
case BASEPROPERTY_GRID_DATAMODEL:
{
- m_xDataModel = Reference< XGridDataModel >( aValue, UNO_QUERY );
- Sequence<Sequence< ::rtl::OUString > > cellData = m_xDataModel->getData();
- Sequence<rtl::OUString> rowData(0);
- std::vector< std::vector< rtl::OUString > > aCellContent(0);
- for(int i = 0; i< m_xDataModel->getRowCount();++i)
{
- rowData = cellData[i];
- std::vector<rtl::OUString> newRow(
- comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rowData));
- if(newRow.size() < (unsigned)m_pTableModel->getColumnCount())
- newRow.resize( m_pTableModel->getColumnCount(),rtl::OUString::createFromAscii(""));
- aCellContent.push_back(newRow);
+ 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());
}
- m_pTableModel->setCellContent(aCellContent);
- 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);
break;
}
case BASEPROPERTY_GRID_COLUMNMODEL:
{
m_xColumnModel = Reference< XGridColumnModel >( aValue, UNO_QUERY );
- Sequence<Reference< XGridColumn > > columns = m_xColumnModel->getColumns();
- std::vector<Reference< XGridColumn > > aNewColumns(
- comphelper::sequenceToContainer<std::vector<Reference< XGridColumn > > >(columns));
- /* if(m_pTable->GetColumnCount().size()>0)
- m_pTable->GetColumnName.clear();*/
- for ( ::svt::table::ColPos col = 0; col < m_xColumnModel->getColumnCount(); ++col )
+ if(m_xColumnModel != NULL)
{
- UnoControlTableColumn* tableColumn = new UnoControlTableColumn(aNewColumns[col]);
- m_pTableModel->getColumnModel().push_back((PColumnModel)tableColumn);
+ 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);
+
break;
}
default:
@@ -281,17 +411,21 @@ void SVTXGridControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
BASEPROPERTY_GRID_SHOWCOLUMNHEADER,
BASEPROPERTY_GRID_DATAMODEL,
BASEPROPERTY_GRID_COLUMNMODEL,
- BASEPROPERTY_GRID_SELECTIONMODE,
+ BASEPROPERTY_GRID_SELECTIONMODE,
+ BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND,
+ BASEPROPERTY_GRID_HEADER_BACKGROUND,
+ BASEPROPERTY_GRID_LINE_COLOR,
+ BASEPROPERTY_GRID_ROW_BACKGROUND,
0);
VCLXWindow::ImplGetPropertyIds( rIds, true );
}
void SAL_CALL SVTXGridControl::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aGuard( GetMutex() );
TableControl* pTable = (TableControl*)GetWindow();
if ( pTable )
{
pTable->SetModel(PTableModel(m_pTableModel));
- //m_pTable->SetPosSizePixel( Point( nPosX, nPosY ), Size(nWidth, nHeight) );
pTable->Show( bVisible );
}
}
@@ -303,17 +437,34 @@ void SAL_CALL SVTXGridControl::setFocus() throw(::com::sun::star::uno::RuntimeEx
}
void SAL_CALL SVTXGridControl::rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
{
- std::vector<OUString> aNewRow(
- comphelper::sequenceToContainer< std::vector<rtl::OUString > >(Event.rowData));
- if(aNewRow.size()< (unsigned)m_pTableModel->getColumnCount())
- aNewRow.resize(m_pTableModel->getColumnCount(),rtl::OUString::createFromAscii(""));
- m_pTableModel->getCellContent().push_back(aNewRow);
+ ::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);
+ }
+
+ }
+ 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->getRowHeaderName().size());
+ m_pTableModel->setRowCount(m_pTableModel->getCellContent().size());
TableControl* pTable = (TableControl*)GetWindow();
- pTable->InvalidateDataWindow(m_pTableModel->getRowHeaderName().size()-1, false);
- //pTable->GrabFocus();
+ pTable->InvalidateDataWindow(m_pTableModel->getCellContent().size()-1, 0, false);
if(pTable->isAccessibleAlive())
{
pTable->commitGridControlEvent(TABLE_MODEL_CHANGED,
@@ -334,12 +485,16 @@ void SAL_CALL SVTXGridControl::rowAdded(const ::com::sun::star::awt::grid::GridD
void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aGuard( GetMutex() );
+
TableControl* pTable = (TableControl*)GetWindow();
- //unsigned int rows =m_pImpl->aCellContent.size()-1;
if(Event.index == -1)
{
+ if(!isSelectionEmpty())
+ deselectAllRows();
if(m_pTableModel->hasRowHeaders())
m_pTableModel->getRowHeaderName().clear();
+ pTable->clearSelection();
m_pTableModel->getCellContent().clear();
if(pTable->isAccessibleAlive())
{
@@ -348,76 +503,248 @@ void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::Gri
Any());
}
}
- else
+ else if(Event.index >= 0 && Event.index < m_pTableModel->getRowCount())
{
- pTable->removeSelectedRow(Event.index);
- if(m_pTableModel->getCellContent().size()>1)
- {
- if(m_pTableModel->hasRowHeaders())
- m_pTableModel->getRowHeaderName().erase(m_pTableModel->getRowHeaderName().begin()+Event.index);
- m_pTableModel->getCellContent().erase(m_pTableModel->getCellContent().begin()+Event.index);
-
- }
- else
+ if(isSelectedIndex(Event.index))
{
- if(m_pTableModel->hasRowHeaders())
- m_pTableModel->getRowHeaderName().clear();
- m_pTableModel->getCellContent().clear();
- //m_pImpl->nRowCount=0;
+ 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 );
}
- //pTable->InvalidateDataWindow(Event.index, true);
m_pTableModel->setRowCount(m_pTableModel->getCellContent().size());
- pTable->InvalidateDataWindow(Event.index, true);
+ 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());
- //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());
- //}
}
- //pTable->Invalidate();
}
+void SAL_CALL SVTXGridControl::columnChanged(const ::com::sun::star::awt::grid::GridColumnEvent& Event ) throw (::com::sun::star::uno::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();
+}
void SAL_CALL SVTXGridControl::dataChanged(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
{
- (void) Event;
+ ::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);
+ }
}
- void SAL_CALL SVTXGridControl::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException)
- {
+void SAL_CALL SVTXGridControl::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException)
+{
VCLXWindow::disposing( Source );
- }
+}
::sal_Int32 SAL_CALL SVTXGridControl::getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException)
{
- return 0;
+ 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)
{
- return 0;
+ 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));
+ }
}
-void SAL_CALL SVTXGridControl::insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL SVTXGridControl::selectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException)
{
- (void)length;
- (void)start;
+ 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 );
+ }
+ }
}
-void SAL_CALL SVTXGridControl::removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL SVTXGridControl::selectAllRows() throw (::com::sun::star::uno::RuntimeException)
{
- (void)end;
- (void)start;
+ 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 );
+ }
+}
+
+void SAL_CALL SVTXGridControl::deselectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) 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 );
+}
+
+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 );
}
::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL SVTXGridControl::getSelection() throw (::com::sun::star::uno::RuntimeException)
@@ -435,21 +762,138 @@ void SAL_CALL SVTXGridControl::removeIndexIntervall(::sal_Int32 start, ::sal_Int
::sal_Bool SAL_CALL SVTXGridControl::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException)
{
- return sal_False;
+ TableControl* pTable = (TableControl*)GetWindow();
+ std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
+ if(selectedRows.empty())
+ return sal_True;
+ else
+ return sal_False;
}
::sal_Bool SAL_CALL SVTXGridControl::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
{
- (void)index;
- return sal_False;
+ TableControl* pTable = (TableControl*)GetWindow();
+ std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
+ return std::find(selectedRows.begin(),selectedRows.end(), index) != selectedRows.end();
}
-void SAL_CALL SVTXGridControl::selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL SVTXGridControl::selectRow(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
{
- (void)y;
+ 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 );
+ }
}
void SAL_CALL SVTXGridControl::selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException)
{
(void)x;
}
+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 );
+
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_TABLEROW_SELECT:
+ {
+ TableControl* pTable = (TableControl*)GetWindow();
+
+ if( pTable )
+ {
+ if ( m_aSelectionListeners.getLength() )
+ {
+ ImplCallItemListeners();
+ }
+ }
+ }
+ break;
+
+ default:
+ VCLXWindow::ProcessWindowEvent( rVclWindowEvent );
+ break;
+ }
+}
+
+void SVTXGridControl::ImplCallItemListeners()
+{
+ TableControl* pTable = (TableControl*) GetWindow();
+ if ( pTable && m_aSelectionListeners.getLength() )
+ {
+ ::std::vector<sal_Int32> selRows = pTable->GetSelectedRows();
+ ::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.Range = diff;
+ }
+ //selected row changed
+ else if(diff == 0 && actSelRowCount != 0)
+ {
+ aEvent.Row = selRows[actSelRowCount-1];
+ aEvent.Action = com::sun::star::awt::grid::SelectionEventType(2);
+ aEvent.Range = 0;
+ }
+ else
+ {
+ //selection changed: multiple row deselected, only 1 row is selected
+ if(actSelRowCount == 1)
+ {
+ aEvent.Row = selRows[actSelRowCount-1];
+ aEvent.Action = com::sun::star::awt::grid::SelectionEventType(2);
+ }
+ //row is deselected
+ else
+ {
+ aEvent.Row = pTable->GetCurrentRow();
+ aEvent.Action = com::sun::star::awt::grid::SelectionEventType(1);
+ }
+ aEvent.Range = 0;
+ }
+ m_nSelectedRowCount=actSelRowCount;
+ m_aSelectionListeners.selectionChanged( aEvent );
+ }
+}
diff --git a/svtools/source/uno/svtxgridcontrol.hxx b/svtools/source/uno/svtxgridcontrol.hxx
index 8e6931d0d805..b15507e4614f 100755
--- a/svtools/source/uno/svtxgridcontrol.hxx
+++ b/svtools/source/uno/svtxgridcontrol.hxx
@@ -32,58 +32,68 @@
#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 <toolkit/awt/vclxwindow.hxx>
#include <toolkit/awt/vclxwindows.hxx>
#include <cppuhelper/typeprovider.hxx>
-#include <cppuhelper/implbase2.hxx>
-//#include <toolkit/helper/listenermultiplexer.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <toolkit/helper/listenermultiplexer.hxx>
using namespace ::svt::table;
-class SVTXGridControl : public ::cppu::ImplInheritanceHelper2< VCLXWindow, ::com::sun::star::awt::grid::XGridControl,
- ::com::sun::star::awt::grid::XGridDataListener>
+class SVTXGridControl : public ::cppu::ImplInheritanceHelper3< VCLXWindow, ::com::sun::star::awt::grid::XGridControl,
+ ::com::sun::star::awt::grid::XGridDataListener, ::com::sun::star::awt::grid::XGridColumnListener>
{
private:
- UnoControlTableModel* m_pTableModel;
+ ::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;
+
+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);
+
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(); }
+ ::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(); }
// ::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::grid::XGridControl
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL getColumnModel( ) throw (::com::sun::star::uno::RuntimeException);
- void SAL_CALL setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL getDataModel( ) throw (::com::sun::star::uno::RuntimeException);
- void SAL_CALL setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException);
-
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 insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) 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 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 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);
@@ -93,11 +103,15 @@ public:
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);
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_
diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx
index 387b7813b1cd..22e37817eaf5 100644
--- a/svtools/source/uno/toolboxcontroller.cxx
+++ b/svtools/source/uno/toolboxcontroller.cxx
@@ -39,6 +39,14 @@
#include <svtools/miscopt.hxx>
#include <toolkit/unohlp.hxx>
#include <vcl/toolbox.hxx>
+//shizhobo
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+const int TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE = 1;
+const int TOOLBARCONTROLLER_PROPCOUNT = 1;
+const rtl::OUString TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIABLE( RTL_CONSTASCII_USTRINGPARAM( "SupportsVisiable" ));
+//end
+
+using ::rtl::OUString;
using namespace ::cppu;
using namespace ::com::sun::star::awt;
@@ -51,17 +59,38 @@ using namespace ::com::sun::star::frame;
namespace svt
{
+
+struct DispatchInfo
+{
+ Reference< XDispatch > mxDispatch;
+ const URL maURL;
+ const Sequence< PropertyValue > maArgs;
+
+ DispatchInfo( const Reference< XDispatch >& xDispatch, const URL& rURL, const Sequence< PropertyValue >& rArgs )
+ : mxDispatch( xDispatch ), maURL( rURL ), maArgs( rArgs ) {}
+};
+
struct ToolboxController_Impl
{
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xParentWindow;
::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xUrlTransformer;
+ rtl::OUString m_sModuleName;
+ sal_uInt16 m_nToolBoxId;
+
+ DECL_STATIC_LINK( ToolboxController_Impl, ExecuteHdl_Impl, DispatchInfo* );
+
+ ToolboxController_Impl()
+ : m_nToolBoxId( SAL_MAX_UINT16 )
+ {}
};
ToolboxController::ToolboxController(
+
const Reference< XMultiServiceFactory >& rServiceManager,
const Reference< XFrame >& xFrame,
const ::rtl::OUString& aCommandURL ) :
- OWeakObject()
+ OPropertyContainer(GetBroadcastHelper())
+ , OWeakObject()
, m_bInitialized( sal_False )
, m_bDisposed( sal_False )
, m_xFrame(xFrame)
@@ -69,6 +98,10 @@ ToolboxController::ToolboxController(
, m_aCommandURL( aCommandURL )
, m_aListenerContainer( m_aMutex )
{
+ //registger Propertyh by shizhoubo
+ registerProperty(TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIABLE, TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE, com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY,
+ &m_bSupportVisiable, getCppuType(&m_bSupportVisiable));
+
m_pImpl = new ToolboxController_Impl;
try
@@ -83,11 +116,16 @@ ToolboxController::ToolboxController(
}
ToolboxController::ToolboxController() :
- OWeakObject()
+ OPropertyContainer(GetBroadcastHelper())
+ , OWeakObject()
, m_bInitialized( sal_False )
, m_bDisposed( sal_False )
, m_aListenerContainer( m_aMutex )
{
+ //registger Propertyh by shizhoubo
+ registerProperty(TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIABLE, TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE, com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY,
+ &m_bSupportVisiable, getCppuType(&m_bSupportVisiable));
+
m_pImpl = new ToolboxController_Impl;
}
@@ -143,11 +181,16 @@ throw ( RuntimeException )
static_cast< XInitialization* >( this ),
static_cast< XComponent* >( this ),
static_cast< XUpdatable* >( this ));
-
- if ( a.hasValue() )
- return a;
-
- return OWeakObject::queryInterface( rType );
+ if ( !a.hasValue())
+ {
+ a = ::cppu::queryInterface(rType
+ ,static_cast<XPropertySet*>(this)
+ ,static_cast<XMultiPropertySet*>(this)
+ ,static_cast<XFastPropertySet*>(this));
+ if (!a.hasValue())
+ return OWeakObject::queryInterface( rType );
+ }
+ return a;
}
void SAL_CALL ToolboxController::acquire() throw ()
@@ -163,11 +206,6 @@ void SAL_CALL ToolboxController::release() throw ()
void SAL_CALL ToolboxController::initialize( const Sequence< Any >& aArguments )
throw ( Exception, RuntimeException )
{
- const rtl::OUString aFrameName( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
- const rtl::OUString aCommandURLName( RTL_CONSTASCII_USTRINGPARAM( "CommandURL" ));
- const rtl::OUString aServiceManagerName( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" ));
- const rtl::OUString aParentWindow( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" ));
-
bool bInitialized( true );
{
@@ -183,20 +221,23 @@ throw ( Exception, RuntimeException )
{
vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
m_bInitialized = sal_True;
-
+ //shizhoubo add
+ m_bSupportVisiable = sal_False;
PropertyValue aPropValue;
for ( int i = 0; i < aArguments.getLength(); i++ )
{
if ( aArguments[i] >>= aPropValue )
{
- if ( aPropValue.Name.equalsAscii( "Frame" ))
+ if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Frame") ))
m_xFrame.set(aPropValue.Value,UNO_QUERY);
- else if ( aPropValue.Name.equalsAscii( "CommandURL" ))
+ else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("CommandURL") ))
aPropValue.Value >>= m_aCommandURL;
- else if ( aPropValue.Name.equalsAscii( "ServiceManager" ))
+ else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ServiceManager") ))
m_xServiceManager.set(aPropValue.Value,UNO_QUERY);
- else if ( aPropValue.Name.equalsAscii( "ParentWindow" ))
+ else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ParentWindow") ))
m_pImpl->m_xParentWindow.set(aPropValue.Value,UNO_QUERY);
+ else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ModuleName" ) ) )
+ aPropValue.Value >>= m_pImpl->m_sModuleName;
}
}
@@ -701,4 +742,142 @@ Reference< ::com::sun::star::awt::XWindow > ToolboxController::getParent() const
{
return m_pImpl->m_xParentWindow;
}
+
+const rtl::OUString& ToolboxController::getModuleName() const
+{
+ return m_pImpl->m_sModuleName;
+}
+
+void ToolboxController::dispatchCommand( const OUString& sCommandURL, const Sequence< PropertyValue >& rArgs )
+{
+ try
+ {
+ Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY_THROW );
+ URL aURL;
+ aURL.Complete = sCommandURL;
+ getURLTransformer()->parseStrict( aURL );
+
+ Reference< XDispatch > xDispatch( xDispatchProvider->queryDispatch( aURL, OUString(), 0 ), UNO_QUERY_THROW );
+
+ Application::PostUserEvent( STATIC_LINK(0, ToolboxController_Impl, ExecuteHdl_Impl), new DispatchInfo( xDispatch, aURL, rArgs ) );
+
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+//
+//-------------------------------------------------------------------------
+// XPropertySet by shizhoubo
+com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL ToolboxController::getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException)
+{
+ Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+//-------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper& ToolboxController::getInfoHelper()
+{
+ return *const_cast<ToolboxController*>(this)->getArrayHelper();
+}
+//OPropertyArrayUsageHelper by shizhoubo
+//------------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper* ToolboxController::createArrayHelper( ) const
+{
+ com::sun::star::uno::Sequence< Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+}
+//shizhoubo for supportsvisiable
+void ToolboxController::setSupportVisiableProperty(sal_Bool bValue)
+{
+ m_bSupportVisiable = bValue;
+}
+//OPropertySetHelper by shizhoubo
+sal_Bool SAL_CALL ToolboxController::convertFastPropertyValue( com::sun::star::uno::Any& aConvertedValue ,
+ com::sun::star::uno::Any& aOldValue ,
+ sal_Int32 nHandle ,
+ const com::sun::star::uno::Any& aValue ) throw( com::sun::star::lang::IllegalArgumentException )
+{
+ switch (nHandle)
+ {
+ case TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE:
+ {
+ sal_Bool aNewValue;
+ aValue >>= aNewValue;
+ if (aNewValue != m_bSupportVisiable)
+ {
+ aConvertedValue <<= aNewValue;
+ aOldValue <<= m_bSupportVisiable;
+ return sal_True;
+ }
+ return sal_False;
+ }
+ }
+ return OPropertyContainer::convertFastPropertyValue(aConvertedValue, aOldValue, nHandle, aValue);
+}
+
+void SAL_CALL ToolboxController::setFastPropertyValue_NoBroadcast(
+ sal_Int32 nHandle,
+ const com::sun::star::uno::Any& aValue )
+throw( com::sun::star::uno::Exception)
+{
+ OPropertyContainer::setFastPropertyValue_NoBroadcast(nHandle, aValue);
+ if (TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE == nHandle)
+ {
+ sal_Bool rValue(sal_False);
+ if (( aValue >>= rValue ) && m_bInitialized)
+ this->setSupportVisiableProperty( rValue );
+ }
+}
+
+//--------------------------------------------------------------------
+
+IMPL_STATIC_LINK_NOINSTANCE( ToolboxController_Impl, ExecuteHdl_Impl, DispatchInfo*, pDispatchInfo )
+{
+ pDispatchInfo->mxDispatch->dispatch( pDispatchInfo->maURL, pDispatchInfo->maArgs );
+ delete pDispatchInfo;
+ return 0;
+}
+
+void ToolboxController::enable( bool bEnable )
+{
+ ToolBox* pToolBox = 0;
+ sal_uInt16 nItemId = 0;
+ if( getToolboxId( nItemId, &pToolBox ) )
+ {
+ pToolBox->EnableItem( nItemId, bEnable ? TRUE : FALSE );
+ }
+}
+
+bool ToolboxController::getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox )
+{
+ if( (m_pImpl->m_nToolBoxId != SAL_MAX_UINT16) && (ppToolBox == 0) )
+ return m_pImpl->m_nToolBoxId;
+
+ ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) );
+
+ if( (m_pImpl->m_nToolBoxId == SAL_MAX_UINT16) && pToolBox )
+ {
+ const sal_uInt16 nCount = pToolBox->GetItemCount();
+ for ( sal_uInt16 nPos = 0; nPos < nCount; ++nPos )
+ {
+ const sal_uInt16 nItemId = pToolBox->GetItemId( nPos );
+ if ( pToolBox->GetItemCommand( nItemId ) == String( m_aCommandURL ) )
+ {
+ m_pImpl->m_nToolBoxId = nItemId;
+ break;
+ }
+ }
+ }
+
+ if( ppToolBox )
+ *ppToolBox = pToolBox;
+
+ rItemId = m_pImpl->m_nToolBoxId;
+
+ return (rItemId != SAL_MAX_UINT16) && (( ppToolBox == 0) || (*ppToolBox != 0) );
+}
+//end
+
} // svt
diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx
index a46b9605a00d..7fb1a007960f 100644
--- a/svtools/source/uno/treecontrolpeer.cxx
+++ b/svtools/source/uno/treecontrolpeer.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/view/SelectionType.hpp>
#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
#include <com/sun/star/awt/tree/XMutableTreeNode.hpp>
#include <treecontrolpeer.hxx>
@@ -208,7 +209,9 @@ void TreeControlPeer::removeEntry( UnoTreeListEntry* pEntry )
{
TreeNodeMap::iterator aIter( mpTreeNodeMap->find( pEntry->mxNode ) );
if( aIter != mpTreeNodeMap->end() )
+ {
mpTreeNodeMap->erase( aIter );
+ }
}
}
@@ -280,14 +283,14 @@ UnoTreeListEntry* TreeControlPeer::createEntry( const Reference< XTreeNode >& xN
pEntry->AddItem( pUnoItem );
+ mpTreeImpl->insert( pEntry, pParent, nPos );
+
if( msDefaultExpandedGraphicURL.getLength() )
mpTreeImpl->SetExpandedEntryBmp( pEntry, maDefaultExpandedImage );
if( msDefaultCollapsedGraphicURL.getLength() )
mpTreeImpl->SetCollapsedEntryBmp( pEntry, maDefaultCollapsedImage );
- mpTreeImpl->insert( pEntry, pParent, nPos );
-
updateEntry( pEntry );
}
return pEntry;
@@ -915,6 +918,19 @@ Reference< XTreeNode > SAL_CALL TreeControlPeer::getClosestNodeForLocation( sal_
// -------------------------------------------------------------------
+awt::Rectangle SAL_CALL TreeControlPeer::getNodeRect( const Reference< XTreeNode >& i_Node ) throw (IllegalArgumentException, RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow();
+ UnoTreeListEntry* pEntry = getEntry( i_Node, true );
+
+ ::Rectangle aEntryRect( rTree.GetFocusRect( pEntry, rTree.GetEntryPosition( pEntry ).Y() ) );
+ return VCLUnoHelper::ConvertToAWTRect( aEntryRect );
+}
+
+// -------------------------------------------------------------------
+
sal_Bool SAL_CALL TreeControlPeer::isEditing( ) throw (RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
diff --git a/svtools/source/uno/treecontrolpeer.hxx b/svtools/source/uno/treecontrolpeer.hxx
index 015e131321f8..336830804a6f 100644
--- a/svtools/source/uno/treecontrolpeer.hxx
+++ b/svtools/source/uno/treecontrolpeer.hxx
@@ -91,6 +91,7 @@ public:
virtual void SAL_CALL removeTreeExpansionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeExpansionListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getNodeForLocation( ::sal_Int32 x, ::sal_Int32 y ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getClosestNodeForLocation( ::sal_Int32 x, ::sal_Int32 y ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getNodeRect( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL isEditing( ) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL stopEditing( ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL cancelEditing( ) throw (::com::sun::star::uno::RuntimeException);
diff --git a/svtools/source/uno/unocontroltablemodel.cxx b/svtools/source/uno/unocontroltablemodel.cxx
index febb187fb289..d239ee3c740d 100644
--- a/svtools/source/uno/unocontroltablemodel.cxx
+++ b/svtools/source/uno/unocontroltablemodel.cxx
@@ -42,21 +42,32 @@
using ::rtl::OUString;
using namespace ::svt::table;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::awt::grid;
//--------------------------------------------------------------------
UnoControlTableColumn::UnoControlTableColumn(Reference<XGridColumn> m_xGridColumn)
:m_nID( 0 )
,m_sName()
- ,m_bIsResizable( false )
- ,m_nWidth( 10 * 100 ) // 1 cm
- ,m_nMinWidth( 0 ) // no min width
- ,m_nMaxWidth( 0 ) // no max width
+ ,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))
{
- //m_nID = m_xGridColumn->getIdentifier();
- //m_nWidth = m_xGridColumn->getColumnWidth();
- m_sName = m_xGridColumn->getTitle();
}
//--------------------------------------------------------------------
@@ -68,11 +79,7 @@ using namespace ::com::sun::star::awt::grid;
//--------------------------------------------------------------------
bool UnoControlTableColumn::setID( const ColumnID _nID )
{
- // TODO: conflict check
-
m_nID = _nID;
- // TODO: notifications?
-
return true;
}
@@ -86,9 +93,7 @@ using namespace ::com::sun::star::awt::grid;
void UnoControlTableColumn::setName( const String& _rName )
{
m_sName = _rName;
- // TODO: notifications?
}
-
//--------------------------------------------------------------------
bool UnoControlTableColumn::isResizable() const
{
@@ -99,7 +104,6 @@ using namespace ::com::sun::star::awt::grid;
void UnoControlTableColumn::setResizable( bool _bResizable )
{
m_bIsResizable = _bResizable;
- // TODO: notifications?
}
//--------------------------------------------------------------------
@@ -112,7 +116,6 @@ using namespace ::com::sun::star::awt::grid;
void UnoControlTableColumn::setWidth( TableMetrics _nWidth )
{
m_nWidth = _nWidth;
- // TODO: notifications?
}
//--------------------------------------------------------------------
@@ -125,7 +128,6 @@ using namespace ::com::sun::star::awt::grid;
void UnoControlTableColumn::setMinWidth( TableMetrics _nMinWidth )
{
m_nMinWidth = _nMinWidth;
- // TODO: notifications?
}
//--------------------------------------------------------------------
@@ -138,7 +140,28 @@ using namespace ::com::sun::star::awt::grid;
void UnoControlTableColumn::setMaxWidth( TableMetrics _nMaxWidth )
{
m_nMaxWidth = _nMaxWidth;
- // TODO: notifications?
+ }
+ //--------------------------------------------------------------------
+ TableMetrics UnoControlTableColumn::getPreferredWidth() const
+ {
+ return m_nPrefWidth;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableColumn::setPreferredWidth( TableMetrics _nPrefWidth )
+ {
+ m_nPrefWidth = _nPrefWidth;
+ }
+ //--------------------------------------------------------------------
+ ::com::sun::star::style::HorizontalAlignment UnoControlTableColumn::getHorizontalAlign()
+ {
+ return m_xHorizontalAlign;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableColumn::setHorizontalAlign( com::sun::star::style::HorizontalAlignment _align )
+ {
+ m_xHorizontalAlign = _align;
}
//====================================================================
@@ -146,30 +169,46 @@ using namespace ::com::sun::star::awt::grid;
//====================================================================
struct UnoControlTableModel_Impl
{
- ::std::vector< PColumnModel >& aColumns;
+ ::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<rtl::OUString> >& aCellContent;
+ 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;
UnoControlTableModel_Impl()
- :aColumns ( *(new std::vector< PColumnModel> (0)))
- ,nRowCount ( 0 )
+ :aColumns ( )
+ ,nRowCount ( 0 )
,bHasColumnHeaders ( false )
,bHasRowHeaders ( false )
+ ,bVScroll ( false )
+ ,bHScroll ( false )
,pRenderer ( )
,pInputHandler ( )
- ,nRowHeight ( 4 * 100 ) // 40 mm
- ,nColumnHeaderHeight( 5 * 100 ) // 50 mm
- ,nRowHeaderWidth ( 10 * 100 ) // 50 mm
- ,aRowHeadersTitle ( *(new std::vector<rtl::OUString>(0)))
- ,aCellContent ( *(new std::vector<std::vector<OUString> >(0)))
+ ,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))
{
}
};
@@ -196,7 +235,6 @@ using namespace ::com::sun::star::awt::grid;
//--------------------------------------------------------------------
TableSize UnoControlTableModel::getColumnCount() const
{
- //m_pImpl->aColumns.resize( m_xColumnModel->getColumnCount());
return (TableSize)m_pImpl->aColumns.size();
}
@@ -250,7 +288,6 @@ using namespace ::com::sun::star::awt::grid;
void UnoControlTableModel::addTableModelListener( const PTableModelListener& listener )
{
(void) listener;
- //listener->onTableModelChanged(PTableModel(this));
// TODO
DBG_ERROR( "DefaultTableModel::addTableModelListener: not yet implemented!" );
}
@@ -321,6 +358,17 @@ using namespace ::com::sun::star::awt::grid;
DBG_ASSERT( hasRowHeaders(), "DefaultTableModel::getRowHeaderWidth: invalid call!" );
return m_pImpl->nRowHeaderWidth;
}
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setColumnHeaderHeight(TableMetrics _nHeight)
+ {
+ m_pImpl->nColumnHeaderHeight = _nHeight;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setRowHeaderWidth(TableMetrics _nWidth)
+ {
+ m_pImpl->nRowHeaderWidth = _nWidth;
+ }
//--------------------------------------------------------------------
void UnoControlTableModel::SetTitleHeight( TableMetrics _nHeight )
@@ -341,7 +389,7 @@ using namespace ::com::sun::star::awt::grid;
//--------------------------------------------------------------------
ScrollbarVisibility UnoControlTableModel::getVerticalScrollbarVisibility(int overAllHeight, int actHeight) const
{
- if(overAllHeight>=actHeight)// && !m_bVScroll)
+ if(overAllHeight>=actHeight && !m_pImpl->bVScroll)
return ScrollbarShowNever;
else
return ScrollbarShowAlways;
@@ -350,59 +398,116 @@ using namespace ::com::sun::star::awt::grid;
//--------------------------------------------------------------------
ScrollbarVisibility UnoControlTableModel::getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const
{
- if(overAllWidth>=actWidth)// && !m_bHScroll)
+ if(overAllWidth>=actWidth && !m_pImpl->bHScroll)
return ScrollbarShowNever;
else
return ScrollbarShowAlways;
}
//--------------------------------------------------------------------
- void UnoControlTableModel::setCellContent(std::vector<std::vector<rtl::OUString> > cellContent)
+ void UnoControlTableModel::setVerticalScrollbarVisibility(bool _bVScroll) const
{
- //if(cellContent.empty())
- //{
- // unsigned int i = m_pImpl->aColumns.size();
- // std::vector<rtl::OUString>& emptyCells;
- // while(i!=0)
- // {
- // cellContent.push_back(emptyCells);
- // --i;
- // }
- //}
- //std::vector<rtl::OUString> cCC;
- //for(::std::vector<std::vector<rtl::OUString> >::iterator iter = cellContent.begin(); iter!= cellContent.end();++iter)
- //{
- // cCC = *iter;
- // m_pImpl->aCellContent.push_back(cCC);
- //}
- m_pImpl->aCellContent.swap( cellContent );
+ m_pImpl->bVScroll = _bVScroll;
}
- std::vector<std::vector<rtl::OUString> >& UnoControlTableModel::getCellContent()
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setHorizontalScrollbarVisibility(bool _bHScroll) const
{
- return m_pImpl->aCellContent;
+ m_pImpl->bHScroll = _bHScroll;
+ }
+ //--------------------------------------------------------------------
+ bool UnoControlTableModel::hasVerticalScrollbar()
+ {
+ return m_pImpl->bVScroll;
+ }
+ //--------------------------------------------------------------------
+ bool UnoControlTableModel::hasHorizontalScrollbar()
+ {
+ return m_pImpl->bHScroll;
+ }
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setCellContent(const std::vector<std::vector< Any > >& cellContent)
+ {
+ m_pImpl->aCellContent = cellContent;
}
+ std::vector<std::vector< Any > >& UnoControlTableModel::getCellContent()
+ {
+ return m_pImpl->aCellContent;
+ }
//--------------------------------------------------------------------
- void UnoControlTableModel::setRowHeaderName(std::vector<rtl::OUString> cellColumnContent)
+ void UnoControlTableModel::setRowHeaderName(const std::vector<rtl::OUString>& cellColumnContent)
{
- if(cellColumnContent.empty())
- {
- unsigned int i = m_pImpl->aColumns.size();
- while(i!=0)
- {
- cellColumnContent.push_back(rtl::OUString::createFromAscii(""));
- --i;
- }
- }
- for(::std::vector<rtl::OUString>::iterator iter = cellColumnContent.begin(); iter!= cellColumnContent.end();++iter)
- {
- rtl::OUString s = *iter;
- m_pImpl->aRowHeadersTitle.push_back(*iter);
- }
+ m_pImpl->aRowHeadersTitle = cellColumnContent;
}
std::vector<rtl::OUString>& UnoControlTableModel::getRowHeaderName()
{
return m_pImpl->aRowHeadersTitle;
}
+ //--------------------------------------------------------------------
+ ::com::sun::star::util::Color UnoControlTableModel::getLineColor()
+ {
+ return m_pImpl->m_xLineColor;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setLineColor( ::com::sun::star::util::Color _rColor )
+ {
+ m_pImpl->m_xLineColor = _rColor;
+ }
+ //--------------------------------------------------------------------
+ ::com::sun::star::util::Color UnoControlTableModel::getHeaderBackgroundColor()
+ {
+ return m_pImpl->m_xHeaderColor;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setHeaderBackgroundColor( ::com::sun::star::util::Color _rColor )
+ {
+ m_pImpl->m_xHeaderColor = _rColor;
+ }
+ //--------------------------------------------------------------------
+ ::com::sun::star::util::Color UnoControlTableModel::getTextColor()
+ {
+ return m_pImpl->m_xTextColor;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setTextColor( ::com::sun::star::util::Color _rColor )
+ {
+ m_pImpl->m_xTextColor = _rColor;
+ }
+ //--------------------------------------------------------------------
+ ::com::sun::star::util::Color UnoControlTableModel::getOddRowBackgroundColor()
+ {
+ return m_pImpl->m_xRowColor1;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setOddRowBackgroundColor( ::com::sun::star::util::Color _rColor )
+ {
+ m_pImpl->m_xRowColor1 = _rColor;
+ }
+ //--------------------------------------------------------------------
+ ::com::sun::star::util::Color UnoControlTableModel::getEvenRowBackgroundColor()
+ {
+ return m_pImpl->m_xRowColor2;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setEvenRowBackgroundColor( ::com::sun::star::util::Color _rColor )
+ {
+ m_pImpl->m_xRowColor2 = _rColor;
+ }
+ //--------------------------------------------------------------------
+ ::com::sun::star::style::VerticalAlignment UnoControlTableModel::getVerticalAlign()
+ {
+ return m_pImpl->m_xVerticalAlign;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setVerticalAlign( com::sun::star::style::VerticalAlignment _xAlign )
+ {
+ m_pImpl->m_xVerticalAlign = _xAlign;
+ }
diff --git a/svtools/source/uno/unocontroltablemodel.hxx b/svtools/source/uno/unocontroltablemodel.hxx
index 5be4ff2a16f7..c00642448f79 100644
--- a/svtools/source/uno/unocontroltablemodel.hxx
+++ b/svtools/source/uno/unocontroltablemodel.hxx
@@ -41,7 +41,9 @@
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/implbase2.hxx>
#include <com/sun/star/awt/grid/XGridColumn.hpp>
-//#include <toolkit/helper/listenermultiplexer.hxx>
+#include <com/sun/star/util/Color.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/style/HorizontalAlignment.hpp>
using namespace ::svt::table;
@@ -49,7 +51,7 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt::grid;
class UnoControlTableColumn : public IColumnModel
- {
+{
private:
ColumnID m_nID;
String m_sName;
@@ -57,9 +59,12 @@ class UnoControlTableColumn : public IColumnModel
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;
@@ -74,12 +79,16 @@ class UnoControlTableColumn : public IColumnModel
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;
+struct UnoControlTableModel_Impl;
- class UnoControlTableModel : public ITableModel
- {
+class UnoControlTableModel : public ITableModel
+{
private:
UnoControlTableModel_Impl* m_pImpl;
@@ -91,6 +100,10 @@ class UnoControlTableColumn : public IColumnModel
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(); }
@@ -107,23 +120,21 @@ class UnoControlTableColumn : public IColumnModel
/// retrieves the width of a column, in 1/100th millimeters
inline TableMetrics GetColumnWidth( ColPos _nColumn );
- // TODO: setters and getters for ID, Name, Resizable, MinWidth, MaxWidth
-
public:
// ITableModel overridables
virtual TableSize getColumnCount() const;
virtual TableSize getRowCount() const;
- virtual void setColumnCount(TableSize _nColCount);
+ 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 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 std::vector<PColumnModel>& getColumnModel();
virtual PColumnModel getColumnModelByID( ColumnID id );
virtual PTableRenderer getRenderer() const;
virtual PTableInputHandler getInputHandler() const;
@@ -132,19 +143,35 @@ class UnoControlTableColumn : public IColumnModel
virtual TableMetrics getRowHeaderWidth() const;
virtual ScrollbarVisibility getVerticalScrollbarVisibility(int overAllHeight, int actHeight) const;
virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const;
- virtual void setCellContent(std::vector<std::vector<rtl::OUString> > cellContent);
- virtual std::vector<std::vector<rtl::OUString> >& getCellContent();
- virtual void setRowHeaderName(std::vector<rtl::OUString> cellColumnContent);
- virtual std::vector<rtl::OUString>& getRowHeaderName();
- };
-
- inline void UnoControlTableModel::SetColumnWidth( ColPos _nColumn, TableMetrics _nWidth100thMM )
- {
+ 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 );
- }
+}
- inline TableMetrics UnoControlTableModel::GetColumnWidth( ColPos _nColumn )
- {
- return getColumnModel( _nColumn )->getWidth();
- }
+inline TableMetrics UnoControlTableModel::GetColumnWidth( ColPos _nColumn )
+{
+ return getColumnModel( _nColumn )->getWidth();
+}
#endif // _UNOCONTROL_TABLEMODEL_HXX_
diff --git a/svtools/source/uno/unoifac2.src b/svtools/source/uno/unoifac2.src
deleted file mode 100644
index 406701ca4fc1..000000000000
--- a/svtools/source/uno/unoifac2.src
+++ /dev/null
@@ -1,107 +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 _SVT_UNO_UNOIFAC_HRC_
-#include <unoifac2.hrc>
-#endif
-
-
-Menu RID_CONTEXTMENU
-{
- ItemList =
- {
- MenuItem
- {
- Identifier = RID_OPEN_LINK ;
- HelpId = HID_TEXTCPNT_OPEN_LINK ;
- Text [ en-US ] = "~Open";
- };
- MenuItem
- {
- Identifier = RID_OPEN_LINK_NEW ;
- HelpId = HID_TEXTCPNT_OPEN_LINK_NEW ;
- Text [ en-US ] = "Open in New ~Window";
- };
- MenuItem
- {
- Identifier = RID_DOWNLOAD ;
- HelpId = HID_TEXTCPNT_DOWNLOAD ;
- Text [ en-US ] = "~Download...";
- };
- MenuItem
- {
- Separator = TRUE;
- };
- MenuItem
- {
- Identifier = RID_ADD_BOOKMARK ;
- HelpId = HID_TEXTCPNT_ADD_BOOKMARK ;
- Text [ en-US ] = "Add ~Link";
- };
- MenuItem
- {
- Separator = TRUE;
- };
- MenuItem
- {
- Identifier = RID_COPY_LINK ;
- HelpId = HID_TEXTCPNT_COPY_LINK ;
- Text [ en-US ] = "Cop~y Link" ;
- };
- };
-};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/svtools/source/uno/unowizard.hxx b/svtools/source/uno/unowizard.hxx
new file mode 100644
index 000000000000..ceb8fac14eb6
--- /dev/null
+++ b/svtools/source/uno/unowizard.hxx
@@ -0,0 +1,117 @@
+/*************************************************************************
+ * 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 SVT_UNO_WIZARD_HXX
+#define SVT_UNO_WIZARD_HXX
+
+#include "svtools/genericunodialog.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/ui/dialogs/XWizard.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/ui/dialogs/XWizardController.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/componentcontext.hxx>
+
+//......................................................................................................................
+namespace svt { namespace uno
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= Wizard - declaration
+ //==================================================================================================================
+ typedef ::cppu::ImplInheritanceHelper1 < ::svt::OGenericUnoDialog
+ , ::com::sun::star::ui::dialogs::XWizard
+ > Wizard_Base;
+ class Wizard;
+ typedef ::comphelper::OPropertyArrayUsageHelper< Wizard > Wizard_PBase;
+ class Wizard : public Wizard_Base
+ , public Wizard_PBase
+ {
+ public:
+ Wizard( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext );
+
+ // ::com::sun::star::lang::XServiceInfo - static version
+ static ::rtl::OUString SAL_CALL getImplementationName_static() throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static() throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext );
+
+ protected:
+ // ::com::sun::star::lang::XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+
+ // ::com::sun::star::ui::dialogs::XWizard
+ virtual ::rtl::OUString SAL_CALL getHelpURL() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setHelpURL( const ::rtl::OUString& _helpurl ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getDialogWindow() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage > SAL_CALL getCurrentPage( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL enableButton( ::sal_Int16 WizardButton, ::sal_Bool Enable ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDefaultButton( ::sal_Int16 WizardButton ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL travelNext( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL travelPrevious( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL enablePage( ::sal_Int16 PageID, ::sal_Bool Enable ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::util::InvalidStateException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateTravelUI( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL advanceTo( ::sal_Int16 PageId ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL goBackTo( ::sal_Int16 PageId ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL activatePath( ::sal_Int16 PathIndex, ::sal_Bool Final ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::util::InvalidStateException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::ui::dialogs::XExecutableDialog
+ virtual void SAL_CALL setTitle( const ::rtl::OUString& aTitle ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int16 SAL_CALL execute( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::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);
+
+ protected:
+ ~Wizard();
+
+ protected:
+ virtual Dialog* createDialog( Window* _pParent );
+ virtual void destroyDialog();
+
+ private:
+ ::comphelper::ComponentContext m_aContext;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int16 > > m_aWizardSteps;
+ ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController > m_xController;
+ ::rtl::OUString m_sHelpURL;
+ };
+
+//......................................................................................................................
+} } // namespace svt::uno
+//......................................................................................................................
+
+#endif // SVT_UNO_WIZARD_HXX
diff --git a/canvas/source/java/perftest/makefile.mk b/svtools/source/uno/wizard/makefile.mk
index 787a42adfb74..521496fc5d48 100644
--- a/canvas/source/java/perftest/makefile.mk
+++ b/svtools/source/uno/wizard/makefile.mk
@@ -25,31 +25,24 @@
#
#*************************************************************************
-# Builds the Java Canvas implementation.
+PRJ=../../..
-PRJNAME = canvas
-PRJ = ../../..
-TARGET = PerfTest
-PACKAGE = test
+PRJNAME=svtools
+TARGET=unowiz
+ENABLE_EXCEPTIONS=TRUE
# --- Settings -----------------------------------------------------
-.INCLUDE: settings.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/svt.pmk
-JAVAFILES = \
- PerfTest.java
+# --- Files --------------------------------------------------------
-JARFILES = jurt.jar unoil.jar ridl.jar juh.jar java_uno.jar
-JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
-
-JARTARGET = $(TARGET).jar
-JARCOMPRESS = TRUE
-#JARCLASSDIRS = $(PACKAGE)
-CUSTOMMANIFESTFILE = manifest
+SLOFILES= \
+ $(SLO)$/unowizard.obj \
+ $(SLO)$/wizardshell.obj \
+ $(SLO)$/wizardpagecontroller.obj
# --- Targets ------------------------------------------------------
-.INCLUDE: target.mk
-
-#dist: $(JAVA_FILES:b:+".class")
-# +jar -cvfm $(CLASSDIR)/PerfTest.jar $(JARMANIFEST) $(JAVACLASSFILES)
+.INCLUDE : target.mk
diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx
new file mode 100644
index 000000000000..9440c0e69f26
--- /dev/null
+++ b/svtools/source/uno/wizard/unowizard.cxx
@@ -0,0 +1,452 @@
+/*************************************************************************
+ * 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 "../unowizard.hxx"
+#include "wizardshell.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/ucb/AlreadyInitializedException.hpp>
+#include <com/sun/star/ui/dialogs/XWizardController.hpp>
+#include <com/sun/star/ui/dialogs/WizardButton.hpp>
+/** === end UNO includes === **/
+
+#include <tools/diagnose_ex.h>
+#include <rtl/strbuf.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+//......................................................................................................................
+namespace svt { namespace uno
+{
+//......................................................................................................................
+
+ /** === 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::lang::XServiceInfo;
+ using ::com::sun::star::ui::dialogs::XWizard;
+ using ::com::sun::star::lang::XInitialization;
+ using ::com::sun::star::beans::XPropertySetInfo;
+ using ::com::sun::star::uno::XComponentContext;
+ using ::com::sun::star::beans::Property;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::ucb::AlreadyInitializedException;
+ using ::com::sun::star::ui::dialogs::XWizardController;
+ using ::com::sun::star::ui::dialogs::XWizardPage;
+ using ::com::sun::star::container::NoSuchElementException;
+ using ::com::sun::star::util::InvalidStateException;
+ using ::com::sun::star::awt::XWindow;
+ /** === end UNO using === **/
+ namespace WizardButton = ::com::sun::star::ui::dialogs::WizardButton;
+
+ //------------------------------------------------------------------------------------------------------------------
+ namespace
+ {
+ sal_uInt32 lcl_convertWizardButtonToWZB( const sal_Int16 i_nWizardButton )
+ {
+ switch ( i_nWizardButton )
+ {
+ case WizardButton::NONE: return WZB_NONE;
+ case WizardButton::NEXT: return WZB_NEXT;
+ case WizardButton::PREVIOUS: return WZB_PREVIOUS;
+ case WizardButton::FINISH: return WZB_FINISH;
+ case WizardButton::CANCEL: return WZB_CANCEL;
+ case WizardButton::HELP: return WZB_HELP;
+ }
+ OSL_ENSURE( false, "lcl_convertWizardButtonToWZB: invalid WizardButton constant!" );
+ return WZB_NONE;
+ }
+ }
+
+ //==================================================================================================================
+ //= Wizard - implementation
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ Wizard::Wizard( const Reference< XComponentContext >& _rxContext )
+ :Wizard_Base( _rxContext )
+ ,m_aContext( _rxContext )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ Wizard::~Wizard()
+ {
+ // we do this here cause the base class' call to destroyDialog won't reach us anymore : we're within an dtor,
+ // so this virtual-method-call the base class does does not work, we're already dead then ...
+ if ( m_pDialog )
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( m_pDialog )
+ destroyDialog();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XInterface > SAL_CALL Wizard::Create( const Reference< XComponentContext >& _rxContext )
+ {
+ return *(new Wizard( _rxContext ) );
+ }
+
+ //--------------------------------------------------------------------
+ namespace
+ {
+ static void lcl_checkPaths( const Sequence< Sequence< sal_Int16 > >& i_rPaths, const Reference< XInterface >& i_rContext )
+ {
+ // need at least one path
+ if ( i_rPaths.getLength() == 0 )
+ throw IllegalArgumentException( ::rtl::OUString(), i_rContext, 2 );
+
+ // each path must be of length 1, at least
+ for ( sal_Int32 i = 0; i < i_rPaths.getLength(); ++i )
+ {
+ if ( i_rPaths[i].getLength() == 0 )
+ throw IllegalArgumentException( ::rtl::OUString(), i_rContext, 2 );
+
+ // page IDs must be in ascending order
+ sal_Int16 nPreviousPageID = i_rPaths[i][0];
+ for ( sal_Int32 j=1; j<i_rPaths[i].getLength(); ++j )
+ {
+ if ( i_rPaths[i][j] <= nPreviousPageID )
+ {
+ ::rtl::OStringBuffer message;
+ message.append( "Path " );
+ message.append( i );
+ message.append( ": invalid page ID sequence - each page ID must be greater than the previous one." );
+ throw IllegalArgumentException(
+ ::rtl::OStringToOUString( message.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US ),
+ i_rContext, 2 );
+ }
+ nPreviousPageID = i_rPaths[i][j];
+ }
+ }
+
+ // if we have one path, that's okay
+ if ( i_rPaths.getLength() == 1 )
+ return;
+
+ // if we have multiple paths, they must start with the same page id
+ const sal_Int16 nFirstPageId = i_rPaths[0][0];
+ for ( sal_Int32 i = 0; i < i_rPaths.getLength(); ++i )
+ {
+ if ( i_rPaths[i][0] != nFirstPageId )
+ throw IllegalArgumentException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "All paths must start with the same page id." ) ),
+ i_rContext, 2 );
+ }
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL Wizard::initialize( const Sequence< Any >& i_Arguments ) throw (Exception, RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( m_bInitialized )
+ throw AlreadyInitializedException( ::rtl::OUString(), *this );
+
+ if ( i_Arguments.getLength() != 2 )
+ throw IllegalArgumentException( ::rtl::OUString(), *this, -1 );
+
+ // the second argument must be a XWizardController, for each constructor
+ m_xController.set( i_Arguments[1], UNO_QUERY );
+ if ( !m_xController.is() )
+ throw IllegalArgumentException( ::rtl::OUString(), *this, 2 );
+
+ // the first arg is either a single path (short[]), or multiple paths (short[][])
+ Sequence< sal_Int16 > aSinglePath;
+ i_Arguments[0] >>= aSinglePath;
+ Sequence< Sequence< sal_Int16 > > aMultiplePaths;
+ i_Arguments[0] >>= aMultiplePaths;
+
+ if ( !aMultiplePaths.getLength() )
+ {
+ aMultiplePaths.realloc(1);
+ aMultiplePaths[0] = aSinglePath;
+ }
+ lcl_checkPaths( aMultiplePaths, *this );
+ // if we survived this, the paths are valid, and we're done here ...
+ m_aWizardSteps = aMultiplePaths;
+
+ m_bInitialized = true;
+ }
+
+ //--------------------------------------------------------------------
+ Dialog* Wizard::createDialog( Window* i_pParent )
+ {
+ WizardShell* pDialog( new WizardShell( i_pParent, this, m_xController, m_aWizardSteps ) );
+ pDialog->SetSmartHelpId( SmartId( m_sHelpURL ) );
+ pDialog->setTitleBase( m_sTitle );
+ return pDialog;
+ }
+
+ //--------------------------------------------------------------------
+ void Wizard::destroyDialog()
+ {
+ if ( m_pDialog )
+ m_sHelpURL = m_pDialog->GetSmartHelpId().GetStr();
+
+ Wizard_Base::destroyDialog();
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL Wizard::getImplementationName_static() throw(RuntimeException)
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.uno.Wizard" ) );
+ }
+
+ //--------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL Wizard::getSupportedServiceNames_static() throw(RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aServices(1);
+ aServices[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.Wizard" ) );
+ return aServices;
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL Wizard::getImplementationName() throw(RuntimeException)
+ {
+ return getImplementationName_static();
+ }
+
+ //--------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL Wizard::getSupportedServiceNames() throw(RuntimeException)
+ {
+ return getSupportedServiceNames_static();
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XPropertySetInfo > SAL_CALL Wizard::getPropertySetInfo() throw(RuntimeException)
+ {
+ return createPropertySetInfo( getInfoHelper() );
+ }
+
+ //--------------------------------------------------------------------
+ ::cppu::IPropertyArrayHelper& SAL_CALL Wizard::getInfoHelper()
+ {
+ return *const_cast< Wizard* >( this )->getArrayHelper();
+ }
+
+ //--------------------------------------------------------------------
+ ::cppu::IPropertyArrayHelper* Wizard::createArrayHelper( ) const
+ {
+ Sequence< Property > aProps;
+ describeProperties( aProps );
+ return new ::cppu::OPropertyArrayHelper( aProps );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL Wizard::getHelpURL() throw (RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !m_pDialog )
+ return m_sHelpURL;
+
+ const SmartId aSmartId( m_pDialog->GetSmartHelpId() );
+ return aSmartId.GetStr();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL Wizard::setHelpURL( const ::rtl::OUString& i_HelpURL ) throw (RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !m_pDialog )
+ m_sHelpURL = i_HelpURL;
+ else
+ m_pDialog->SetSmartHelpId( SmartId( i_HelpURL ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XWindow > SAL_CALL Wizard::getDialogWindow() throw (RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ ENSURE_OR_RETURN( m_pDialog, "Wizard::getDialogWindow: illegal call (execution did not start, yet)!", NULL );
+ return Reference< XWindow >( m_pDialog->GetComponentInterface(), UNO_QUERY );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL Wizard::enableButton( ::sal_Int16 i_WizardButton, ::sal_Bool i_Enable ) throw (RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::enableButtons: invalid dialog implementation!" );
+
+ pWizardImpl->enableButtons( lcl_convertWizardButtonToWZB( i_WizardButton ), i_Enable );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL Wizard::setDefaultButton( ::sal_Int16 i_WizardButton ) throw (RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::setDefaultButton: invalid dialog implementation!" );
+
+ pWizardImpl->defaultButton( lcl_convertWizardButtonToWZB( i_WizardButton ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool SAL_CALL Wizard::travelNext( ) throw (RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::travelNext: invalid dialog implementation!" );
+
+ return pWizardImpl->travelNext();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool SAL_CALL Wizard::travelPrevious( ) throw (RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::travelPrevious: invalid dialog implementation!" );
+
+ return pWizardImpl->travelPrevious();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL Wizard::enablePage( ::sal_Int16 i_PageID, ::sal_Bool i_Enable ) throw (NoSuchElementException, InvalidStateException, RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::enablePage: invalid dialog implementation!" );
+
+ if ( !pWizardImpl->knowsPage( i_PageID ) )
+ throw NoSuchElementException( ::rtl::OUString(), *this );
+
+ if ( i_PageID == pWizardImpl->getCurrentPage() )
+ throw InvalidStateException( ::rtl::OUString(), *this );
+
+ pWizardImpl->enablePage( i_PageID, i_Enable );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL Wizard::updateTravelUI( ) throw (RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::updateTravelUI: invalid dialog implementation!" );
+
+ pWizardImpl->updateTravelUI();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL Wizard::advanceTo( ::sal_Int16 i_PageId ) throw (RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::advanceTo: invalid dialog implementation!" );
+
+ return pWizardImpl->advanceTo( i_PageId );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL Wizard::goBackTo( ::sal_Int16 i_PageId ) throw (RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::goBackTo: invalid dialog implementation!" );
+
+ return pWizardImpl->goBackTo( i_PageId );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XWizardPage > SAL_CALL Wizard::getCurrentPage( ) throw (RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::getCurrentPage: invalid dialog implementation!" );
+
+ return pWizardImpl->getCurrentWizardPage();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL Wizard::activatePath( ::sal_Int16 i_PathIndex, ::sal_Bool i_Final ) throw (NoSuchElementException, InvalidStateException, RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( ( i_PathIndex < 0 ) || ( i_PathIndex >= m_aWizardSteps.getLength() ) )
+ throw NoSuchElementException( ::rtl::OUString(), *this );
+
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::activatePath: invalid dialog implementation!" );
+
+ pWizardImpl->activatePath( i_PathIndex, i_Final );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL Wizard::setTitle( const ::rtl::OUString& i_Title ) throw (RuntimeException)
+ {
+ // simply disambiguate
+ Wizard_Base::OGenericUnoDialog::setTitle( i_Title );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int16 SAL_CALL Wizard::execute( ) throw (RuntimeException)
+ {
+ return Wizard_Base::OGenericUnoDialog::execute();
+ }
+
+//......................................................................................................................
+} } // namespace svt::uno
+//......................................................................................................................
diff --git a/svtools/source/uno/wizard/wizardpagecontroller.cxx b/svtools/source/uno/wizard/wizardpagecontroller.cxx
new file mode 100644
index 000000000000..d6f7029b477c
--- /dev/null
+++ b/svtools/source/uno/wizard/wizardpagecontroller.cxx
@@ -0,0 +1,190 @@
+/*************************************************************************
+ * 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 "wizardpagecontroller.hxx"
+#include "wizardshell.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+/** === end UNO includes === **/
+
+#include <toolkit/helper/vclunohelper.hxx>
+#include <tools/diagnose_ex.h>
+
+//......................................................................................................................
+namespace svt { namespace uno
+{
+//......................................................................................................................
+
+ /** === 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::ui::dialogs::XWizardController;
+ using ::com::sun::star::awt::XWindow;
+ using ::com::sun::star::lang::XComponent;
+ using ::com::sun::star::awt::XControl;
+ /** === end UNO using === **/
+ using namespace ::com::sun::star;
+
+ //==================================================================================================================
+ //= WizardPageController
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ WizardPageController::WizardPageController( WizardShell& i_rParent, const Reference< XWizardController >& i_rController,
+ const sal_Int16 i_nPageId )
+ :m_xController( i_rController )
+ ,m_xWizardPage()
+ ,m_nPageId( i_nPageId )
+ {
+ ENSURE_OR_THROW( m_xController.is(), "no controller" );
+ try
+ {
+ m_xWizardPage.set( m_xController->createPage(
+ Reference< XWindow >( i_rParent.GetComponentInterface( TRUE ), UNO_QUERY_THROW ),
+ m_nPageId
+ ), UNO_SET_THROW );
+
+ Reference< XWindow > xPageWindow( m_xWizardPage->getWindow(), UNO_SET_THROW );
+ xPageWindow->setVisible( sal_True );
+
+ TabPage* pTabPage( getTabPage() );
+ if ( pTabPage )
+ pTabPage->SetStyle( pTabPage->GetStyle() | WB_CHILDDLGCTRL | WB_DIALOGCONTROL );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ WizardPageController::~WizardPageController()
+ {
+ try
+ {
+ if ( m_xWizardPage.is() )
+ m_xWizardPage->dispose();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ TabPage* WizardPageController::getTabPage() const
+ {
+ ENSURE_OR_RETURN( m_xWizardPage.is(), "WizardPageController::getTabPage: no external wizard page!", NULL );
+ try
+ {
+ Reference< XWindow > xPageWindow( m_xWizardPage->getWindow(), UNO_SET_THROW );
+ Window* pPageWindow = VCLUnoHelper::GetWindow( xPageWindow );
+ if ( pPageWindow == NULL )
+ {
+ // windows created via the XContainerWindowProvider might be controls, not real windows, so resolve
+ // that one indirection
+ const Reference< XControl > xPageControl( m_xWizardPage->getWindow(), UNO_QUERY_THROW );
+ xPageWindow.set( xPageControl->getPeer(), UNO_QUERY_THROW );
+ pPageWindow = VCLUnoHelper::GetWindow( xPageWindow );
+ }
+
+ OSL_ENSURE( pPageWindow != NULL, "WizardPageController::getTabPage: unable to find the Window implementation for the page's window!" );
+ return dynamic_cast< TabPage* >( pPageWindow );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return NULL;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void WizardPageController::initializePage()
+ {
+ if ( !m_xWizardPage.is() )
+ return;
+
+ try
+ {
+ m_xWizardPage->activatePage();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool WizardPageController::commitPage( WizardTypes::CommitPageReason i_eReason )
+ {
+ if ( !m_xWizardPage.is() )
+ return sal_True;
+
+ try
+ {
+ return m_xWizardPage->commitPage( WizardShell::convertCommitReasonToTravelType( i_eReason ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return sal_True;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool WizardPageController::canAdvance() const
+ {
+ if ( !m_xWizardPage.is() )
+ return true;
+
+ try
+ {
+ return m_xWizardPage->canAdvance();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return true;
+ }
+
+//......................................................................................................................
+} } // namespace svt::uno
+//......................................................................................................................
diff --git a/svtools/source/uno/wizard/wizardpagecontroller.hxx b/svtools/source/uno/wizard/wizardpagecontroller.hxx
new file mode 100644
index 000000000000..9de04d2f0dd4
--- /dev/null
+++ b/svtools/source/uno/wizard/wizardpagecontroller.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ * 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 SVT_UNOWIZ_WIZARDPAGECONTROLLER_HXX
+#define SVT_UNOWIZ_WIZARDPAGECONTROLLER_HXX
+
+#include "svtools/wizardmachine.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/ui/dialogs/XWizardController.hpp>
+/** === end UNO includes === **/
+
+//......................................................................................................................
+namespace svt { namespace uno
+{
+//......................................................................................................................
+
+ class WizardShell;
+
+ //==================================================================================================================
+ //= WizardPageController
+ //==================================================================================================================
+ class WizardPageController : public IWizardPageController
+ {
+ public:
+ WizardPageController(
+ WizardShell& i_rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController >& i_rController,
+ const sal_Int16 i_nPageId
+ );
+ ~WizardPageController();
+
+ // IWizardPageController overridables
+ virtual void initializePage();
+ virtual sal_Bool commitPage( WizardTypes::CommitPageReason _eReason );
+ virtual bool canAdvance() const;
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage >&
+ getWizardPage() const { return m_xWizardPage; }
+ TabPage* getTabPage() const;
+
+ private:
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController > m_xController;
+ ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage > m_xWizardPage;
+ const sal_Int16 m_nPageId;
+ };
+
+//......................................................................................................................
+} } // namespace svt::uno
+//......................................................................................................................
+
+#endif // SVT_UNOWIZ_WIZARDPAGECONTROLLER_HXX
diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx
new file mode 100644
index 000000000000..7737b214ac1f
--- /dev/null
+++ b/svtools/source/uno/wizard/wizardshell.cxx
@@ -0,0 +1,279 @@
+/*************************************************************************
+ * 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 "wizardshell.hxx"
+#include "wizardpagecontroller.hxx"
+
+#include <tools/diagnose_ex.h>
+
+/** === begin UNO includes === **/
+#include <com/sun/star/ui/dialogs/WizardTravelType.hpp>
+/** === end UNO includes === **/
+
+#include <vcl/msgbox.hxx>
+
+//......................................................................................................................
+namespace svt { namespace uno
+{
+//......................................................................................................................
+
+ /** === 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::ui::dialogs::XWizardController;
+ using ::com::sun::star::ui::dialogs::XWizard;
+ using ::com::sun::star::ui::dialogs::XWizardPage;
+ /** === end UNO using === **/
+ namespace WizardTravelType = ::com::sun::star::ui::dialogs::WizardTravelType;
+
+ //==================================================================================================================
+ namespace
+ {
+ //--------------------------------------------------------------------------------------------------------------
+ sal_Int16 lcl_determineFirstPageID( const Sequence< Sequence< sal_Int16 > >& i_rPaths )
+ {
+ ENSURE_OR_THROW( ( i_rPaths.getLength() > 0 ) && ( i_rPaths[0].getLength() > 0 ), "illegal paths" );
+ return i_rPaths[0][0];
+ }
+ }
+
+ //==================================================================================================================
+ //= WizardShell
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ WizardShell::WizardShell( Window* i_pParent, const Reference< XWizard >& i_rWizard, const Reference< XWizardController >& i_rController,
+ const Sequence< Sequence< sal_Int16 > >& i_rPaths )
+ :WizardShell_Base( i_pParent, WB_MOVEABLE | WB_CLOSEABLE )
+ ,m_xWizard( i_rWizard )
+ ,m_xController( i_rController )
+ ,m_nFirstPageID( lcl_determineFirstPageID( i_rPaths ) )
+ {
+ ENSURE_OR_THROW( m_xWizard.is() && m_xController.is(), "invalid wizard/controller" );
+
+ // declare the paths
+ for ( sal_Int32 i=0; i<i_rPaths.getLength(); ++i )
+ {
+ const Sequence< sal_Int16 >& rPath( i_rPaths[i] );
+ WizardPath aPath( rPath.getLength() );
+ for ( sal_Int32 j=0; j<rPath.getLength(); ++j )
+ aPath[j] = impl_pageIdToState( rPath[j] );
+ declarePath( i, aPath );
+ }
+
+ // create the first page, to know the page size
+ TabPage* pStartPage = GetOrCreatePage( impl_pageIdToState( i_rPaths[0][0] ) );
+ SetPageSizePixel( pStartPage->GetSizePixel() );
+
+ // some defaults
+ ShowButtonFixedLine( true );
+ SetRoadmapInteractive( true );
+ enableAutomaticNextButtonState();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ WizardShell::~WizardShell()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ short WizardShell::Execute()
+ {
+ ActivatePage();
+ return WizardShell_Base::Execute();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Int16 WizardShell::convertCommitReasonToTravelType( const CommitPageReason i_eReason )
+ {
+ switch ( i_eReason )
+ {
+ case WizardTypes::eTravelForward:
+ return WizardTravelType::FORWARD;
+
+ case WizardTypes::eTravelBackward:
+ return WizardTravelType::BACKWARD;
+
+ case WizardTypes::eFinish:
+ return WizardTravelType::FINISH;
+
+ default:
+ break;
+ }
+ OSL_ENSURE( false, "WizardShell::convertCommitReasonToTravelType: unsupported CommitPageReason!" );
+ return WizardTravelType::FINISH;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void WizardShell::enterState( WizardState i_nState )
+ {
+ WizardShell_Base::enterState( i_nState );
+
+ if ( !m_xController.is() )
+ return;
+
+ try
+ {
+ m_xController->onActivatePage( impl_stateToPageId( i_nState ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool WizardShell::leaveState( WizardState i_nState )
+ {
+ if ( !WizardShell_Base::leaveState( i_nState ) )
+ return sal_False;
+
+ if ( !m_xController.is() )
+ return sal_True;
+
+ try
+ {
+ m_xController->onDeactivatePage( impl_stateToPageId( i_nState ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return sal_True;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ PWizardPageController WizardShell::impl_getController( TabPage* i_pPage ) const
+ {
+ Page2ControllerMap::const_iterator pos = m_aPageControllers.find( i_pPage );
+ ENSURE_OR_RETURN( pos != m_aPageControllers.end(), "WizardShell::impl_getController: no controller for this page!", PWizardPageController() );
+ return pos->second;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XWizardPage > WizardShell::getCurrentWizardPage() const
+ {
+ const WizardState eState = getCurrentState();
+
+ PWizardPageController pController( impl_getController( GetPage( eState ) ) );
+ ENSURE_OR_RETURN( pController, "WizardShell::getCurrentWizardPage: invalid page/controller!", NULL );
+
+ return pController->getWizardPage();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void WizardShell::enablePage( const sal_Int16 i_nPageID, const sal_Bool i_bEnable )
+ {
+ enableState( impl_pageIdToState( i_nPageID ), i_bEnable );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ TabPage* WizardShell::createPage( WizardState i_nState )
+ {
+ ENSURE_OR_RETURN( m_xController.is(), "WizardShell::createPage: no WizardController!", NULL );
+
+ ::boost::shared_ptr< WizardPageController > pController( new WizardPageController( *this, m_xController, impl_stateToPageId( i_nState ) ) );
+ TabPage* pPage = pController->getTabPage();
+ OSL_ENSURE( pPage != NULL, "WizardShell::createPage: illegal tab page!" );
+ if ( pPage == NULL )
+ {
+ // fallback for ill-behaved clients: empty page
+ pPage = new TabPage( this, 0 );
+ pPage->SetSizePixel( LogicToPixel( Size( 280, 185 ), MAP_APPFONT ) );
+ }
+
+ m_aPageControllers[ pPage ] = pController;
+ return pPage;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ IWizardPageController* WizardShell::getPageController( TabPage* i_pCurrentPage ) const
+ {
+ return impl_getController( i_pCurrentPage ).get();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ String WizardShell::getStateDisplayName( WizardState i_nState ) const
+ {
+ try
+ {
+ if ( m_xController.is() )
+ return m_xController->getPageTitle( impl_stateToPageId( i_nState ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ // fallback for ill-behaved clients: the numeric state
+ return String::CreateFromInt32( i_nState );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool WizardShell::canAdvance() const
+ {
+ try
+ {
+ if ( m_xController.is() && !m_xController->canAdvance() )
+ return false;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return WizardShell_Base::canAdvance();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool WizardShell::onFinish()
+ {
+ try
+ {
+ if ( m_xController.is() && !m_xController->confirmFinish() )
+ return sal_False;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return WizardShell_Base::onFinish();
+ }
+
+//......................................................................................................................
+} } // namespace svt::uno
+//......................................................................................................................
diff --git a/svtools/source/uno/wizard/wizardshell.hxx b/svtools/source/uno/wizard/wizardshell.hxx
new file mode 100644
index 000000000000..338b4f38dc4a
--- /dev/null
+++ b/svtools/source/uno/wizard/wizardshell.hxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ * 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 SVT_UNO_WIZARD_SHELL
+#define SVT_UNO_WIZARD_SHELL
+
+/** === begin UNO includes === **/
+#include <com/sun/star/ui/dialogs/XWizardController.hpp>
+#include <com/sun/star/ui/dialogs/XWizard.hpp>
+/** === end UNO includes === **/
+
+#include <svtools/roadmapwizard.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <map>
+
+//......................................................................................................................
+namespace svt { namespace uno
+{
+//......................................................................................................................
+
+ class WizardPageController;
+ typedef ::boost::shared_ptr< WizardPageController > PWizardPageController;
+
+ //==================================================================================================================
+ //= WizardShell
+ //==================================================================================================================
+ typedef ::svt::RoadmapWizard WizardShell_Base;
+ class WizardShell : public WizardShell_Base
+ {
+ public:
+ WizardShell(
+ Window* _pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizard >& i_rWizard,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController >& i_rController,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int16 > >& i_rPaths
+ );
+ virtual ~WizardShell();
+
+ // Dialog overridables
+ virtual short Execute();
+
+ // OWizardMachine overridables
+ virtual TabPage* createPage( WizardState i_nState );
+ virtual void enterState( WizardState i_nState );
+ virtual sal_Bool leaveState( WizardState i_nState );
+ virtual String getStateDisplayName( WizardState i_nState ) const;
+ virtual bool canAdvance() const;
+ virtual sal_Bool onFinish();
+ virtual IWizardPageController*
+ getPageController( TabPage* _pCurrentPage ) const;
+
+ // attribute access
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizard >&
+ getWizard() const { return m_xWizard; }
+
+ static sal_Int16 convertCommitReasonToTravelType( const CommitPageReason i_eReason );
+
+ // operations
+ sal_Bool advanceTo( const sal_Int16 i_nPageId )
+ {
+ return skipUntil( impl_pageIdToState( i_nPageId ) );
+ }
+ sal_Bool goBackTo( const sal_Int16 i_nPageId )
+ {
+ return skipBackwardUntil( impl_pageIdToState( i_nPageId ) );
+ }
+ sal_Bool travelNext() { return WizardShell_Base::travelNext(); }
+ sal_Bool travelPrevious() { return WizardShell_Base::travelPrevious(); }
+
+ void activatePath( const sal_Int16 i_nPathID, const sal_Bool i_bFinal )
+ {
+ WizardShell_Base::activatePath( PathId( i_nPathID ), i_bFinal );
+ }
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage >
+ getCurrentWizardPage() const;
+
+ sal_Int16 getCurrentPage() const
+ {
+ return impl_stateToPageId( getCurrentState() );
+ }
+
+ void enablePage( const sal_Int16 i_PageID, const sal_Bool i_Enable );
+
+ bool knowsPage( const sal_Int16 i_nPageID ) const
+ {
+ return knowsState( impl_pageIdToState( i_nPageID ) );
+ }
+
+ private:
+ sal_Int16 impl_stateToPageId( const WizardTypes::WizardState i_nState ) const
+ {
+ return static_cast< sal_Int16 >( i_nState + m_nFirstPageID );
+ }
+
+ WizardState impl_pageIdToState( const sal_Int16 i_nPageId ) const
+ {
+ return static_cast< WizardState >( i_nPageId - m_nFirstPageID );
+ }
+
+ PWizardPageController impl_getController( TabPage* i_pPage ) const;
+
+ // prevent outside access to some base class members
+ using WizardShell_Base::skip;
+ using WizardShell_Base::skipUntil;
+ using WizardShell_Base::skipBackwardUntil;
+ using WizardShell_Base::getCurrentState;
+ using WizardShell_Base::activatePath;
+
+ private:
+ typedef ::std::map< TabPage*, PWizardPageController > Page2ControllerMap;
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizard > m_xWizard;
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController > m_xController;
+ const sal_Int16 m_nFirstPageID;
+ Page2ControllerMap m_aPageControllers;
+ };
+
+//......................................................................................................................
+} } // namespace svt::uno
+//......................................................................................................................
+
+#endif // SVT_UNO_WIZARD_SHELL
diff --git a/svtools/util/makefile.mk b/svtools/util/makefile.mk
index c51a514c78f5..4978666e633f 100644
--- a/svtools/util/makefile.mk
+++ b/svtools/util/makefile.mk
@@ -47,30 +47,32 @@ LIB2TARGET= $(LB)$/svtool.lib
LIB2FILES= $(LB)$/_svt.lib
.ENDIF
-LIB1TARGET= $(SLB)$/svt.lib
+LIB1TARGET= $(SLB)/svt.lib
LIB1FILES= \
- $(SLB)$/browse.lib \
- $(SLB)$/config.lib \
- $(SLB)$/svcontnr.lib \
- $(SLB)$/ctrl.lib \
- $(SLB)$/dialogs.lib \
- $(SLB)$/edit.lib \
- $(SLB)$/filter.lib \
- $(SLB)$/filter.uno.lib \
+ $(SLB)/browse.lib \
+ $(SLB)/config.lib \
+ $(SLB)/svcontnr.lib \
+ $(SLB)/ctrl.lib \
+ $(SLB)/dialogs.lib \
+ $(SLB)/edit.lib \
+ $(SLB)/filter.lib \
+ $(SLB)/filter.uno.lib \
$(SLB)$/graphic.lib \
- $(SLB)$/igif.lib \
- $(SLB)$/jpeg.lib \
- $(SLB)$/ixpm.lib \
- $(SLB)$/ixbm.lib \
- $(SLB)$/wmf.lib \
- $(SLB)$/java.lib \
- $(SLB)$/misc.lib \
- $(SLB)$/plugapp.lib \
- $(SLB)$/svhtml.lib \
- $(SLB)$/svrtf.lib \
- $(SLB)$/table.lib \
- $(SLB)$/unoiface.lib \
- $(SLB)$/urlobj.lib
+ $(SLB)/igif.lib \
+ $(SLB)/jpeg.lib \
+ $(SLB)/ixpm.lib \
+ $(SLB)/ixbm.lib \
+ $(SLB)/wmf.lib \
+ $(SLB)/java.lib \
+ $(SLB)/misc.lib \
+ $(SLB)/plugapp.lib \
+ $(SLB)/svhtml.lib \
+ $(SLB)/svrtf.lib \
+ $(SLB)/table.lib \
+ $(SLB)/unoiface.lib \
+ $(SLB)/unowiz.lib \
+ $(SLB)/urlobj.lib \
+ $(SLB)/toolpanel.lib
# generation of resourcen-lib ----------------------------------------
@@ -83,8 +85,8 @@ RESLIB1SRSFILES= \
$(SRS)$/dialogs.srs \
$(SRS)$/plugapp.srs \
$(SRS)$/svcontnr.srs \
- $(SRS)$/uno.srs \
$(SRS)$/browse.srs \
+ $(SRS)$/toolpanel.srs \
$(SRS)$/javaerror.srs
# build the shared library --------------------------------------------------
diff --git a/svtools/workben/toolpanel/makefile.mk b/svtools/workben/toolpanel/makefile.mk
new file mode 100644
index 000000000000..e64e3cd8eccd
--- /dev/null
+++ b/svtools/workben/toolpanel/makefile.mk
@@ -0,0 +1,110 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.16 $
+#
+# 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=svtools
+TARGET=toolpaneltest
+TARGETTYPE=GUI
+LIBTARGET=NO
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= toolpaneltest.cxx
+
+OBJFILES= $(OBJ)$/toolpaneltest.obj
+
+APP1TARGET= $(TARGET)
+APP1OBJS= $(OBJFILES)
+APP1STDLIBS=\
+ $(VCLLIB) \
+ $(UCBHELPERLIB) \
+ $(SALLIB) \
+ $(TOOLSLIB) \
+ $(COMPHELPERLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(BASEGFXLIB) \
+ $(SVTOOLLIB) \
+
+APP1RAPTH=BRAND
+
+.IF "$(GUI)"!="UNX"
+APP1DEF= $(MISC)$/$(TARGET).def
+.ENDIF
+
+.IF "$(COM)"=="GCC"
+ADDOPTFILES=$(OBJ)$/toolpaneltest.obj
+add_cflagscxx="-frtti -fexceptions"
+.ENDIF
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+
+# ------------------------------------------------------------------
+# MAC
+# ------------------------------------------------------------------
+
+.IF "$(GUI)" == "MAC"
+
+$(MISC)$/$(TARGET).def: makefile
+ echo Kein Def-File fuer Applikationen auf Mac
+.ENDIF
+
+
+# ------------------------------------------------------------------
+# Windows
+# ------------------------------------------------------------------
+
+.IF "$(GUI)" == "WIN"
+
+$(MISC)$/$(TARGET).def: makefile
+ echo NAME $(TARGET) >$@
+ echo DESCRIPTION 'ToolPanel - Testprogramm' >>$@
+ echo EXETYPE WINDOWS >>$@
+ echo STUB 'winSTUB.EXE' >>$@
+ echo PROTMODE >>$@
+ echo CODE PRELOAD MOVEABLE DISCARDABLE >>$@
+ echo DATA PRELOAD MOVEABLE MULTIPLE >>$@
+ echo HEAPSIZE 8192 >>$@
+ echo STACKSIZE 32768 >>$@
+
+.ENDIF
+
diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx
new file mode 100755
index 000000000000..6d044cee7c93
--- /dev/null
+++ b/svtools/workben/toolpanel/toolpaneltest.cxx
@@ -0,0 +1,880 @@
+/*************************************************************************
+* 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.
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+
+#include "ctrlbox.hxx"
+#include "svtools/toolpanel/toolpaneldeck.hxx"
+#include "svtools/toolpanel/tablayouter.hxx"
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <comphelper/processfactory.hxx>
+#include <cppuhelper/bootstrap.hxx>
+#include <cppuhelper/servicefactory.hxx>
+#include <tools/diagnose_ex.h>
+#include <ucbhelper/contentbroker.hxx>
+#include <vcl/button.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/help.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/tabctrl.hxx>
+#include <vcl/taskpanelist.hxx>
+#include <vcl/wrkwin.hxx>
+
+namespace svt { namespace toolpanel
+{
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::uno::XComponentContext;
+using ::com::sun::star::accessibility::XAccessible;
+
+//=============================================================================
+//= PanelDemo
+//=============================================================================
+class PanelDemo : public Application
+{
+public:
+ virtual void Main();
+
+private:
+ static Reference< XMultiServiceFactory > createApplicationServiceManager();
+};
+
+//=============================================================================
+//= ColoredPanelWindow
+//=============================================================================
+class ColoredPanelWindow : public Window
+{
+public:
+ ColoredPanelWindow( Window& i_rParent, const Color& i_rColor, const String& i_rTitle )
+ :Window( &i_rParent )
+ ,m_aEdit( this, WB_BORDER )
+ ,m_aTabControl( this )
+ ,m_sTitle( i_rTitle )
+ {
+ SetLineColor();
+ SetFillColor( i_rColor );
+
+ m_aEdit.Show();
+ m_aTabControl.Show();
+
+ const sal_Char* pTabTitles[] =
+ {
+ "This", "is a", "Tab", "Control", "intended", "for", "comparison"
+ };
+ for ( size_t i=0; i < sizeof( pTabTitles ) / sizeof( pTabTitles[0] ); ++i )
+ {
+ String sText( String::CreateFromAscii( pTabTitles[i] ) );
+ m_aTabControl.InsertPage( i + 1, sText );
+ }
+ }
+
+ virtual void Paint( const Rectangle& /*i_rRect*/ )
+ {
+ const Size aOutputSize( GetOutputSizePixel() );
+ const Rectangle aTitleRect( Point( 10, 10 ), Size( aOutputSize.Width() - 20, 20 ) );
+ DrawRect( aTitleRect );
+ SetTextColor( GetFillColor().IsDark() ? COL_WHITE : COL_BLACK );
+ DrawText( aTitleRect, m_sTitle, TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER );
+ }
+
+ virtual void GetFocus()
+ {
+ m_aEdit.GrabFocus();
+ }
+
+ virtual void Resize()
+ {
+ const Size aOutputSize( GetOutputSizePixel() );
+ m_aEdit.SetPosSizePixel(
+ Point( 20, 40 ),
+ Size( aOutputSize.Width() - 40, 20 )
+ );
+ m_aTabControl.SetPosSizePixel(
+ Point( 20, 70 ),
+ Size( aOutputSize.Width() - 40, 150 )
+ );
+ }
+
+private:
+ Edit m_aEdit;
+ TabControl m_aTabControl;
+ String m_sTitle;
+};
+
+//=============================================================================
+//= ColoredPanel
+//=============================================================================
+class ColoredPanel : public IToolPanel
+{
+public:
+ ColoredPanel( Window& i_rParent, const Color& i_rColor, const sal_Char* i_pAsciiPanelName );
+ ColoredPanel( Window& i_rParent, const Color& i_rColor, const String& i_rPanelName );
+ ~ColoredPanel();
+
+ // IToolPanel
+ virtual ::rtl::OUString GetDisplayName() const;
+ virtual Image GetImage() const;
+ virtual SmartId GetHelpID() const;
+ virtual void Activate( Window& i_rParentWindow );
+ virtual void Deactivate();
+ virtual void SetSizePixel( const Size& i_rPanelWindowSize );
+ virtual void GrabFocus();
+ virtual void Dispose();
+ virtual Reference< XAccessible > CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible );
+
+ // IReference
+ virtual oslInterlockedCount SAL_CALL acquire();
+ virtual oslInterlockedCount SAL_CALL release();
+
+private:
+ oslInterlockedCount m_refCount;
+ ::std::auto_ptr< ColoredPanelWindow >
+ m_pWindow;
+ ::rtl::OUString m_aPanelName;
+ BitmapEx m_aPanelIcon;
+};
+
+//=============================================================================
+//= ColoredPanel
+//=============================================================================
+//-----------------------------------------------------------------------------
+ColoredPanel::ColoredPanel( Window& i_rParent, const Color& i_rColor, const sal_Char* i_pAsciiPanelName )
+ :m_refCount(0)
+ ,m_pWindow( new ColoredPanelWindow( i_rParent, i_rColor, ::rtl::OUString::createFromAscii( i_pAsciiPanelName ) ) )
+ ,m_aPanelName( ::rtl::OUString::createFromAscii( i_pAsciiPanelName ) )
+ ,m_aPanelIcon()
+{
+ Bitmap aBitmap( Size( 16, 16 ), 8 );
+ m_aPanelIcon = BitmapEx( aBitmap );
+ m_aPanelIcon.Erase( i_rColor );
+}
+
+//-----------------------------------------------------------------------------
+ColoredPanel::ColoredPanel( Window& i_rParent, const Color& i_rColor, const String& i_rPanelName )
+ :m_refCount(0)
+ ,m_pWindow( new ColoredPanelWindow( i_rParent, i_rColor, i_rPanelName ) )
+ ,m_aPanelName( i_rPanelName )
+ ,m_aPanelIcon()
+{
+ Bitmap aBitmap( Size( 16, 16 ), 8 );
+ m_aPanelIcon = BitmapEx( aBitmap );
+ m_aPanelIcon.Erase( i_rColor );
+}
+
+//-----------------------------------------------------------------------------
+ColoredPanel::~ColoredPanel()
+{
+}
+
+//-----------------------------------------------------------------------------
+oslInterlockedCount SAL_CALL ColoredPanel::acquire()
+{
+ return osl_incrementInterlockedCount( &m_refCount );
+}
+
+//-----------------------------------------------------------------------------
+oslInterlockedCount SAL_CALL ColoredPanel::release()
+{
+ oslInterlockedCount newCount = osl_decrementInterlockedCount( &m_refCount );
+ if ( 0 == newCount )
+ delete this;
+ return newCount;
+}
+
+//-----------------------------------------------------------------------------
+void ColoredPanel::Activate( Window& i_rParentWindow )
+{
+ ENSURE_OR_RETURN_VOID( m_pWindow.get(), "disposed!" );
+ OSL_ENSURE( &i_rParentWindow == m_pWindow->GetParent(), "ColoredPanel::Activate: unexpected new parent window!" );
+ // the documentation of IToolPanel::Activate says it is guaranteed that the parent window is
+ // always the same ...
+ m_pWindow->SetPosSizePixel( Point(), i_rParentWindow.GetSizePixel() );
+ m_pWindow->Show();
+}
+
+//-----------------------------------------------------------------------------
+void ColoredPanel::Deactivate()
+{
+ ENSURE_OR_RETURN_VOID( m_pWindow.get(), "disposed!" );
+ m_pWindow->Hide();
+}
+
+//-----------------------------------------------------------------------------
+void ColoredPanel::SetSizePixel( const Size& i_rPanelWindowSize )
+{
+ ENSURE_OR_RETURN_VOID( m_pWindow.get(), "disposed!" );
+ m_pWindow->SetSizePixel( i_rPanelWindowSize );
+}
+
+//-----------------------------------------------------------------------------
+void ColoredPanel::GrabFocus()
+{
+ ENSURE_OR_RETURN_VOID( m_pWindow.get(), "disposed!" );
+ m_pWindow->GrabFocus();
+}
+
+//-----------------------------------------------------------------------------
+void ColoredPanel::Dispose()
+{
+ ENSURE_OR_RETURN_VOID( m_pWindow.get(), "disposed!" );
+ m_pWindow.reset();
+}
+
+//-----------------------------------------------------------------------------
+Reference< XAccessible > ColoredPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible )
+{
+ ENSURE_OR_RETURN( m_pWindow.get(), "disposed!", NULL );
+ (void)i_rParentAccessible;
+ return m_pWindow->GetAccessible();
+}
+
+//-----------------------------------------------------------------------------
+::rtl::OUString ColoredPanel::GetDisplayName() const
+{
+ return m_aPanelName;
+}
+
+//-----------------------------------------------------------------------------
+Image ColoredPanel::GetImage() const
+{
+ return Image( m_aPanelIcon );
+}
+
+//-----------------------------------------------------------------------------
+SmartId ColoredPanel::GetHelpID() const
+{
+ return SmartId();
+}
+
+//=============================================================================
+//= OptionsWindow
+//=============================================================================
+class PanelDemoMainWindow;
+class OptionsWindow :public Window
+ ,public ::svt::IToolPanelDeckListener
+{
+public:
+ OptionsWindow( PanelDemoMainWindow& i_rParent );
+ ~OptionsWindow();
+
+ // Window overridables
+ virtual void Resize();
+ virtual void GetFocus();
+ virtual void StateChanged( StateChangedType i_nStateChange );
+
+ // IToolPanelDeckListener
+ virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition );
+ virtual void PanelRemoved( const size_t i_nPosition );
+ virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
+ virtual void LayouterChanged( const PDeckLayouter& i_rNewLayouter );
+ virtual void Dying();
+
+private:
+ DECL_LINK( OnRadioToggled, RadioButton* );
+ DECL_LINK( OnListEntrySelected, ListBox* );
+ DECL_LINK( OnListEntryDoubleClicked, ListBox* );
+ DECL_LINK( OnButtonClicked, PushButton* );
+ DECL_LINK( OnEditModified, Edit* );
+
+ void impl_initPanelList();
+ void impl_updateRemoveButton();
+ void impl_updateInsertButton();
+
+private:
+ FixedLine m_aAlignmentHeader;
+ RadioButton m_aAlignLeft;
+ RadioButton m_aAlignRight;
+ RadioButton m_aAlignTop;
+ RadioButton m_aAlignBottom;
+ FixedLine m_aTabItemContent;
+ RadioButton m_aImagesAndText;
+ RadioButton m_aImagesOnly;
+ RadioButton m_aTextOnly;
+ RadioButton m_aAutomaticContent;
+
+ FixedLine m_aPanelsHeader;
+ ListBox m_aPanelList;
+ PushButton m_aRemovePanel;
+ ColorListBox m_aColors;
+ Edit m_aNewPanelName;
+ PushButton m_aInsertPanel;
+};
+
+//=============================================================================
+//= PanelDemoMainWindow
+//=============================================================================
+class PanelDemoMainWindow : public WorkWindow
+{
+public:
+ PanelDemoMainWindow();
+ ~PanelDemoMainWindow();
+
+ // window overridables
+ virtual void Resize();
+
+public:
+ // operations
+ void AlignTabs( const ::svt::TabAlignment i_eAlignment );
+ void SetTabItemContent( const TabItemContent i_eItemContent );
+
+ // member access
+ IToolPanelDeck& GetToolPanelDeck();
+ PToolPanel CreateToolPanel( const Color& i_rColor, const String& i_rPanelName );
+
+protected:
+ virtual void GetFocus();
+
+private:
+ ToolPanelDeck m_aToolPanelDeck;
+ OptionsWindow m_aDemoOptions;
+};
+
+//=============================================================================
+//= PanelDemoMainWindow - implementation
+//=============================================================================
+//-----------------------------------------------------------------------------
+OptionsWindow::OptionsWindow( PanelDemoMainWindow& i_rParent )
+ :Window( &i_rParent, WB_BORDER | WB_DIALOGCONTROL )
+ ,m_aAlignmentHeader( this )
+ ,m_aAlignLeft( this, WB_GROUP )
+ ,m_aAlignRight( this, 0 )
+ ,m_aAlignTop( this, 0 )
+ ,m_aAlignBottom( this, 0 )
+ ,m_aTabItemContent( this )
+ ,m_aImagesAndText( this )
+ ,m_aImagesOnly( this )
+ ,m_aTextOnly( this )
+ ,m_aAutomaticContent( this )
+ ,m_aPanelsHeader( this )
+ ,m_aPanelList( this )
+ ,m_aRemovePanel( this )
+ ,m_aColors( this, WB_DROPDOWN )
+ ,m_aNewPanelName( this, WB_BORDER )
+ ,m_aInsertPanel( this )
+{
+ SetBorderStyle( WINDOW_BORDER_MONO );
+
+ m_aColors.InsertEntry( Color( COL_BLACK ), String( RTL_CONSTASCII_USTRINGPARAM( "Black" ) ) );
+ m_aColors.InsertEntry( Color( COL_BLUE ), String( RTL_CONSTASCII_USTRINGPARAM( "Blue" ) ) );
+ m_aColors.InsertEntry( Color( COL_GREEN ), String( RTL_CONSTASCII_USTRINGPARAM( "Green" ) ) );
+ m_aColors.InsertEntry( Color( COL_CYAN ), String( RTL_CONSTASCII_USTRINGPARAM( "Cyan" ) ) );
+ m_aColors.InsertEntry( Color( COL_RED ), String( RTL_CONSTASCII_USTRINGPARAM( "Red" ) ) );
+ m_aColors.InsertEntry( Color( COL_MAGENTA ), String( RTL_CONSTASCII_USTRINGPARAM( "Magenta" ) ) );
+ m_aColors.InsertEntry( Color( COL_BROWN ), String( RTL_CONSTASCII_USTRINGPARAM( "Brown" ) ) );
+ m_aColors.InsertEntry( Color( COL_GRAY ), String( RTL_CONSTASCII_USTRINGPARAM( "Gray" ) ) );
+ m_aColors.InsertEntry( Color( COL_LIGHTGRAY ), String( RTL_CONSTASCII_USTRINGPARAM( "Light Gray" ) ) );
+ m_aColors.InsertEntry( Color( COL_LIGHTBLUE ), String( RTL_CONSTASCII_USTRINGPARAM( "Light Blue" ) ) );
+ m_aColors.InsertEntry( Color( COL_LIGHTGREEN ), String( RTL_CONSTASCII_USTRINGPARAM( "Light Green" ) ) );
+ m_aColors.InsertEntry( Color( COL_LIGHTCYAN ), String( RTL_CONSTASCII_USTRINGPARAM( "Light Cyan" ) ) );
+ m_aColors.InsertEntry( Color( COL_LIGHTRED ), String( RTL_CONSTASCII_USTRINGPARAM( "Light Red" ) ) );
+ m_aColors.InsertEntry( Color( COL_LIGHTMAGENTA ), String( RTL_CONSTASCII_USTRINGPARAM( "Light Magenta" ) ) );
+ m_aColors.InsertEntry( Color( COL_YELLOW ), String( RTL_CONSTASCII_USTRINGPARAM( "Yellow" ) ) );
+ m_aColors.InsertEntry( Color( COL_WHITE ), String( RTL_CONSTASCII_USTRINGPARAM( "White" ) ) );
+ m_aColors.SetDropDownLineCount( 16 );
+
+ Window* pControls[] =
+ {
+ &m_aAlignmentHeader, &m_aAlignLeft, &m_aAlignRight, &m_aAlignTop, &m_aAlignBottom, &m_aTabItemContent,
+ &m_aImagesAndText, &m_aImagesOnly, &m_aTextOnly, &m_aAutomaticContent, &m_aPanelsHeader, &m_aPanelList,
+ &m_aRemovePanel, &m_aColors, &m_aNewPanelName, &m_aInsertPanel
+ };
+ const sal_Char* pTexts[] =
+ {
+ "Tab Bar Alignment", "Left", "Right", "Top", "Bottom", "Tab Items", "Images and Text", "Images only",
+ "Text only", "Automatic", "Panels", "", "Remove Panel", "", "", "Insert Panel"
+ };
+ for ( size_t i=0; i < sizeof( pControls ) / sizeof( pControls[0] ); ++i )
+ {
+ const WindowType eWindowType = pControls[i]->GetType();
+
+ pControls[i]->SetText( String::CreateFromAscii( pTexts[i] ) );
+ pControls[i]->Show();
+
+ if ( eWindowType == WINDOW_RADIOBUTTON )
+ static_cast< RadioButton* >( pControls[i] )->SetToggleHdl( LINK( this, OptionsWindow, OnRadioToggled ) );
+
+ if ( eWindowType == WINDOW_LISTBOX )
+ {
+ static_cast< ListBox* >( pControls[i] )->SetSelectHdl( LINK( this, OptionsWindow, OnListEntrySelected ) );
+ static_cast< ListBox* >( pControls[i] )->SetDoubleClickHdl( LINK( this, OptionsWindow, OnListEntryDoubleClicked ) );
+ }
+
+ if ( eWindowType == WINDOW_PUSHBUTTON )
+ {
+ static_cast< PushButton* >( pControls[i] )->SetClickHdl( LINK( this, OptionsWindow, OnButtonClicked ) );
+ }
+
+ if ( eWindowType == WINDOW_EDIT )
+ {
+ static_cast< Edit* >( pControls[i] )->SetModifyHdl( LINK( this, OptionsWindow, OnEditModified ) );
+ }
+ }
+
+ m_aAlignRight.Check();
+ m_aImagesAndText.Check();
+
+ Show();
+}
+
+//-----------------------------------------------------------------------------
+OptionsWindow::~OptionsWindow()
+{
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::impl_updateInsertButton()
+{
+ m_aInsertPanel.Enable( ( m_aColors.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) && ( m_aNewPanelName.GetText().Len() > 0 ) );
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::impl_updateRemoveButton()
+{
+ m_aRemovePanel.Enable( m_aPanelList.GetSelectEntryCount() > 0 );
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::impl_initPanelList()
+{
+ m_aPanelList.Clear();
+
+ PanelDemoMainWindow& rController( dynamic_cast< PanelDemoMainWindow& >( *GetParent() ) );
+ IToolPanelDeck& rPanelDeck( rController.GetToolPanelDeck() );
+
+ for ( size_t i=0; i<rPanelDeck.GetPanelCount(); ++i )
+ {
+ PToolPanel pPanel = rPanelDeck.GetPanel( i );
+ m_aPanelList.InsertEntry( pPanel->GetDisplayName(), pPanel->GetImage() );
+ }
+ ActivePanelChanged( ::boost::optional< size_t >(), rPanelDeck.GetActivePanel() );
+
+ impl_updateRemoveButton();
+ impl_updateInsertButton();
+
+ rPanelDeck.AddListener( *this );
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::StateChanged( StateChangedType i_nStateChange )
+{
+ Window::StateChanged( i_nStateChange );
+
+ if ( i_nStateChange == STATE_CHANGE_INITSHOW )
+ {
+ impl_initPanelList();
+ }
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::GetFocus()
+{
+ Window::GetFocus();
+ RadioButton* pRadios[] =
+ {
+ &m_aAlignLeft, &m_aAlignRight, &m_aAlignTop, &m_aAlignBottom
+ };
+ for ( size_t i=0; i < sizeof( pRadios ) / sizeof( pRadios[0] ); ++i )
+ {
+ if ( pRadios[i]->IsChecked() )
+ {
+ pRadios[i]->GrabFocus();
+ break;
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::Resize()
+{
+ Window::Resize();
+
+ const Size aOutputSize( GetOutputSizePixel() );
+
+ const Size aSpacing( LogicToPixel( Size( 3, 3 ), MAP_APPFONT ) );
+ const long nIndent( LogicToPixel( Size( 6, 9 ), MAP_APPFONT ).Width() );
+ const long nFixedLineHeight( LogicToPixel( Size( 0, 8 ), MAP_APPFONT ).Height() );
+ const long nEditLineHeight( LogicToPixel( Size( 0, 12 ), MAP_APPFONT ).Height() );
+ const long nButtonLineHeight( LogicToPixel( Size( 0, 14 ), MAP_APPFONT ).Height() );
+
+ const long nSuperordinateWidth = aOutputSize.Width() - 2 * aSpacing.Width();
+ const long nSuperordinateX = aSpacing.Width();
+
+ const long nSubordinateWidth = aOutputSize.Width() - 2 * aSpacing.Width() - nIndent;
+ const long nSubordinateX = aSpacing.Width() + nIndent;
+
+ Point aItemPos( nSuperordinateX, aSpacing.Height() );
+
+ struct ControlRow
+ {
+ Window* pWindow;
+ bool bSubordinate;
+ size_t nRows;
+
+ ControlRow( Window& i_rWindow, const bool i_bSubordinate, const size_t i_nRows = 1 )
+ :pWindow( &i_rWindow )
+ ,bSubordinate( i_bSubordinate )
+ ,nRows( i_nRows )
+ {
+ }
+ };
+ ControlRow aControlRows[] =
+ {
+ ControlRow( m_aAlignmentHeader, false ),
+ ControlRow( m_aAlignLeft, true ),
+ ControlRow( m_aAlignRight, true ),
+ ControlRow( m_aAlignTop, true ),
+ ControlRow( m_aAlignBottom, true ),
+ ControlRow( m_aTabItemContent, false ),
+ ControlRow( m_aImagesAndText, true ),
+ ControlRow( m_aImagesOnly, true ),
+ ControlRow( m_aTextOnly, true ),
+ ControlRow( m_aAutomaticContent, true ),
+ ControlRow( m_aPanelsHeader, false ),
+ ControlRow( m_aPanelList, true, 6 ),
+ ControlRow( m_aRemovePanel, true ),
+ ControlRow( m_aColors, true ),
+ ControlRow( m_aNewPanelName, true ),
+ ControlRow( m_aInsertPanel, true )
+ };
+ bool bPreviousWasSubordinate = false;
+ for ( size_t i=0; i < sizeof( aControlRows ) / sizeof( aControlRows[0] ); ++i )
+ {
+ aItemPos.X() = ( aControlRows[i].bSubordinate ) ? nSubordinateX : nSuperordinateX;
+
+ if ( bPreviousWasSubordinate && !aControlRows[i].bSubordinate )
+ aItemPos.Y() += aSpacing.Height();
+ bPreviousWasSubordinate = aControlRows[i].bSubordinate;
+
+ // height depends on the window type
+ const WindowType eWindowType = aControlRows[i].pWindow->GetType();
+ long nControlHeight( nFixedLineHeight );
+ if ( ( eWindowType == WINDOW_EDIT )
+ || ( eWindowType == WINDOW_LISTBOX )
+ )
+ {
+ nControlHeight = nEditLineHeight;
+ }
+ else
+ if ( ( eWindowType == WINDOW_PUSHBUTTON )
+ )
+ {
+ nControlHeight = nButtonLineHeight;
+ }
+
+ Size aControlSize(
+ aControlRows[i].bSubordinate ? nSubordinateWidth : nSuperordinateWidth,
+ nControlHeight * aControlRows[i].nRows
+ );
+ aControlRows[i].pWindow->SetPosSizePixel( aItemPos, aControlSize );
+
+ aItemPos.Move( 0, aControlSize.Height() + aSpacing.Height() );
+ }
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition )
+{
+ m_aPanelList.InsertEntry( i_pPanel->GetDisplayName(), i_pPanel->GetImage(), USHORT( i_nPosition ) );
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::PanelRemoved( const size_t i_nPosition )
+{
+ m_aPanelList.RemoveEntry( USHORT( i_nPosition ) );
+ impl_updateRemoveButton();
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
+{
+ (void)i_rOldActive;
+
+ if ( !i_rNewActive )
+ m_aPanelList.SetNoSelection();
+ else
+ m_aPanelList.SelectEntryPos( USHORT( *i_rNewActive ) );
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::LayouterChanged( const PDeckLayouter& i_rNewLayouter )
+{
+ (void)i_rNewLayouter;
+ // not interested in
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::Dying()
+{
+ // not interested in
+}
+
+//-----------------------------------------------------------------------------
+IMPL_LINK( OptionsWindow, OnListEntrySelected, ListBox*, i_pListBox )
+{
+ if ( i_pListBox == &m_aColors )
+ {
+ m_aNewPanelName.SetText( m_aColors.GetEntry( m_aColors.GetSelectEntryPos() ) );
+ impl_updateInsertButton();
+ }
+ else if ( i_pListBox == &m_aPanelList )
+ {
+ impl_updateRemoveButton();
+ }
+ return 0L;
+}
+
+//-----------------------------------------------------------------------------
+IMPL_LINK( OptionsWindow, OnListEntryDoubleClicked, ListBox*, i_pListBox )
+{
+ PanelDemoMainWindow& rController( dynamic_cast< PanelDemoMainWindow& >( *GetParent() ) );
+
+ if ( i_pListBox == &m_aPanelList )
+ {
+ size_t nActivatePanel = size_t( m_aPanelList.GetSelectEntryPos() );
+ rController.GetToolPanelDeck().ActivatePanel( nActivatePanel );
+ }
+
+ return 0L;
+}
+
+//-----------------------------------------------------------------------------
+IMPL_LINK( OptionsWindow, OnEditModified, Edit*, i_pEdit )
+{
+ if ( i_pEdit && &m_aNewPanelName )
+ {
+ impl_updateInsertButton();
+ }
+
+ return 0L;
+}
+
+//-----------------------------------------------------------------------------
+IMPL_LINK( OptionsWindow, OnButtonClicked, PushButton*, i_pPushButton )
+{
+ PanelDemoMainWindow& rController( dynamic_cast< PanelDemoMainWindow& >( *GetParent() ) );
+
+ if ( i_pPushButton == &m_aRemovePanel )
+ {
+ rController.GetToolPanelDeck().RemovePanel( size_t( m_aPanelList.GetSelectEntryPos() ) );
+ }
+ else if ( i_pPushButton == &m_aInsertPanel )
+ {
+ PToolPanel pNewPanel( rController.CreateToolPanel( m_aColors.GetEntryColor( m_aColors.GetSelectEntryPos() ), m_aNewPanelName.GetText() ) );
+
+ ::boost::optional< size_t > aActivePanel( rController.GetToolPanelDeck().GetActivePanel() );
+ size_t nNewPanelPos = !aActivePanel ? rController.GetToolPanelDeck().GetPanelCount() : *aActivePanel + 1;
+
+ rController.GetToolPanelDeck().InsertPanel( pNewPanel, nNewPanelPos );
+ }
+ return 0L;
+}
+
+//-----------------------------------------------------------------------------
+IMPL_LINK( OptionsWindow, OnRadioToggled, RadioButton*, i_pRadioButton )
+{
+ PanelDemoMainWindow& rController( dynamic_cast< PanelDemoMainWindow& >( *GetParent() ) );
+
+ if ( i_pRadioButton->IsChecked() )
+ {
+ if ( i_pRadioButton == &m_aAlignLeft )
+ {
+ rController.AlignTabs( TABS_LEFT );
+ }
+ else if ( i_pRadioButton == &m_aAlignRight )
+ {
+ rController.AlignTabs( TABS_RIGHT );
+ }
+ else if ( i_pRadioButton == &m_aAlignTop )
+ {
+ rController.AlignTabs( TABS_TOP );
+ }
+ else if ( i_pRadioButton == &m_aAlignBottom )
+ {
+ rController.AlignTabs( TABS_BOTTOM );
+ }
+ else if ( i_pRadioButton == &m_aImagesAndText )
+ {
+ rController.SetTabItemContent( TABITEM_IMAGE_AND_TEXT );
+ }
+ else if ( i_pRadioButton == &m_aImagesOnly )
+ {
+ rController.SetTabItemContent( TABITEM_IMAGE_ONLY );
+ }
+ else if ( i_pRadioButton == &m_aTextOnly )
+ {
+ rController.SetTabItemContent( TABITEM_TEXT_ONLY );
+ }
+ else if ( i_pRadioButton == &m_aAutomaticContent )
+ {
+ rController.SetTabItemContent( TABITEM_AUTO );
+ }
+ }
+ return 0L;
+}
+//=============================================================================
+//= PanelDemoMainWindow - implementation
+//=============================================================================
+//-----------------------------------------------------------------------------
+PanelDemoMainWindow::PanelDemoMainWindow()
+ :WorkWindow( NULL, WB_APP | WB_STDWORK | WB_CLIPCHILDREN )
+ ,m_aToolPanelDeck( *this, WB_BORDER )
+ ,m_aDemoOptions( *this )
+{
+ m_aToolPanelDeck.SetPosSizePixel( Point( 20, 20 ), Size( 500, 300 ) );
+ m_aToolPanelDeck.SetBorderStyle( WINDOW_BORDER_MONO );
+
+ m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck.GetPanelWindowAnchor(), Color( COL_RED ), "Red" ) ), m_aToolPanelDeck.GetPanelCount() );
+ m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck.GetPanelWindowAnchor(), Color( COL_GREEN ), "Some flavor of Green" ) ), m_aToolPanelDeck.GetPanelCount() );
+ m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck.GetPanelWindowAnchor(), RGB_COLORDATA( 255, 255, 0 ), "Yellow is ugly" ) ), m_aToolPanelDeck.GetPanelCount() );
+ m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck.GetPanelWindowAnchor(), RGB_COLORDATA( 0, 0, 128 ), "Blue is the Color" ) ), m_aToolPanelDeck.GetPanelCount() );
+
+ m_aToolPanelDeck.ActivatePanel( size_t( 0 ) );
+ m_aToolPanelDeck.Show();
+
+ SetText( String::CreateFromAscii( "ToolPanelDeck Demo Application" ) );
+ Show();
+
+ Help::EnableQuickHelp();
+
+ GetSystemWindow()->GetTaskPaneList()->AddWindow( &m_aToolPanelDeck );
+ GetSystemWindow()->GetTaskPaneList()->AddWindow( &m_aDemoOptions );
+}
+
+//-----------------------------------------------------------------------------
+PanelDemoMainWindow::~PanelDemoMainWindow()
+{
+ GetSystemWindow()->GetTaskPaneList()->RemoveWindow( &m_aDemoOptions );
+ GetSystemWindow()->GetTaskPaneList()->RemoveWindow( &m_aToolPanelDeck );
+}
+
+//-----------------------------------------------------------------------------
+void PanelDemoMainWindow::GetFocus()
+{
+ WorkWindow::GetFocus();
+ m_aToolPanelDeck.GrabFocus();
+}
+
+//-----------------------------------------------------------------------------
+void PanelDemoMainWindow::Resize()
+{
+ WorkWindow::Resize();
+ Size aSize( GetOutputSizePixel() );
+ aSize.Width() -= 240;
+ aSize.Height() -= 40;
+ m_aToolPanelDeck.SetPosSizePixel( Point( 20, 20 ), aSize );
+
+ m_aDemoOptions.SetPosSizePixel(
+ Point( 20 + aSize.Width(), 20 ),
+ Size( 200, aSize.Height() )
+ );
+}
+
+//-----------------------------------------------------------------------------
+void PanelDemoMainWindow::AlignTabs( const ::svt::TabAlignment i_eAlignment )
+{
+ TabItemContent eCurrentItemContent( TABITEM_IMAGE_AND_TEXT );
+ TabDeckLayouter* pLayouter = dynamic_cast< TabDeckLayouter* >( m_aToolPanelDeck.GetLayouter().get() );
+ OSL_ENSURE( pLayouter, "PanelDemoMainWindow::AlignTabs: wrong layouter!" );
+ if ( pLayouter )
+ eCurrentItemContent = pLayouter->GetTabItemContent();
+
+ m_aToolPanelDeck.SetLayouter( PDeckLayouter( new TabDeckLayouter( m_aToolPanelDeck, m_aToolPanelDeck, i_eAlignment, eCurrentItemContent ) ) );
+}
+
+//-----------------------------------------------------------------------------
+void PanelDemoMainWindow::SetTabItemContent( const TabItemContent i_eItemContent )
+{
+ TabDeckLayouter* pLayouter = dynamic_cast< TabDeckLayouter* >( m_aToolPanelDeck.GetLayouter().get() );
+ OSL_ENSURE( pLayouter, "PanelDemoMainWindow::SetTabItemContent: wrong layouter!" );
+ // we currently use tab layouters only ...
+ if ( !pLayouter )
+ return;
+
+ pLayouter->SetTabItemContent( i_eItemContent );
+}
+
+//-----------------------------------------------------------------------------
+IToolPanelDeck& PanelDemoMainWindow::GetToolPanelDeck()
+{
+ return m_aToolPanelDeck;
+}
+
+//-----------------------------------------------------------------------------
+PToolPanel PanelDemoMainWindow::CreateToolPanel( const Color& i_rColor, const String& i_rPanelName )
+{
+ return PToolPanel( new ColoredPanel( m_aToolPanelDeck.GetPanelWindowAnchor(), i_rColor, i_rPanelName ) );
+}
+
+//=============================================================================
+//= PanelDemo
+//=============================================================================
+//-----------------------------------------------------------------------------
+Reference< XMultiServiceFactory > PanelDemo::createApplicationServiceManager()
+{
+ Reference< XMultiServiceFactory > xMS;
+ try
+ {
+ Reference< XComponentContext > xComponentContext = ::cppu::defaultBootstrap_InitialComponentContext();
+ if ( xComponentContext.is() )
+ xMS = xMS.query( xComponentContext->getServiceManager() );
+ }
+ catch( const ::com::sun::star::uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return xMS;
+}
+
+//-----------------------------------------------------------------------------
+void __EXPORT PanelDemo::Main()
+{
+ // create service factory
+ Reference< XMultiServiceFactory > xSMgr = createApplicationServiceManager();
+ ::comphelper::setProcessServiceFactory( xSMgr );
+
+ // initialize the UCB
+ Sequence< Any > aArgs(2);
+ aArgs[0] <<= rtl::OUString::createFromAscii( "Local" );
+ aArgs[1] <<= rtl::OUString::createFromAscii( "Office" );
+ ::ucbhelper::ContentBroker::initialize( xSMgr, aArgs );
+
+ // run the application
+ PanelDemoMainWindow aWindow;
+ Execute();
+}
+
+PanelDemo aTheApplication;
+
+} } // namespace ::svt::toolpanel
diff --git a/svtools/workben/unodialog/makefile.mk b/svtools/workben/unodialog/makefile.mk
index e9adb63d9b09..f18feffce5c3 100644
--- a/svtools/workben/unodialog/makefile.mk
+++ b/svtools/workben/unodialog/makefile.mk
@@ -56,7 +56,7 @@ SLOFILES= $(SLO)$/unodialogsample.obj \
# --- library -----------------------------------
SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
-SHL1VERSIONMAP=$(TARGET).map
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
SHL1STDLIBS= \
$(CPPULIB) \
diff --git a/svtools/workben/unodialog/roadmapskeleton.cxx b/svtools/workben/unodialog/roadmapskeleton.cxx
index f261f219c3fd..e3ed06707f14 100644
--- a/svtools/workben/unodialog/roadmapskeleton.cxx
+++ b/svtools/workben/unodialog/roadmapskeleton.cxx
@@ -103,9 +103,9 @@ namespace udlg
}
//--------------------------------------------------------------------
- sal_Bool RoadmapSkeletonDialog::onFinish( sal_Int32 _nResult )
+ sal_Bool RoadmapSkeletonDialog::onFinish()
{
- return RoadmapSkeletonDialog_Base::onFinish( _nResult );
+ return RoadmapSkeletonDialog_Base::onFinish();
}
//........................................................................
diff --git a/svtools/workben/unodialog/roadmapskeleton.hxx b/svtools/workben/unodialog/roadmapskeleton.hxx
index 216c940b842a..8859390c4b58 100644
--- a/svtools/workben/unodialog/roadmapskeleton.hxx
+++ b/svtools/workben/unodialog/roadmapskeleton.hxx
@@ -52,7 +52,7 @@ namespace udlg
virtual sal_Bool prepareLeaveCurrentState( CommitPageReason _eReason );
virtual sal_Bool leaveState( WizardState _nState );
virtual WizardState determineNextState( WizardState _nCurrentState ) const;
- virtual sal_Bool onFinish( sal_Int32 _nResult );
+ virtual sal_Bool onFinish();
private:
::comphelper::ComponentContext m_aContext;
diff --git a/svtools/workben/unodialog/udlg.map b/svtools/workben/unodialog/udlg.map
deleted file mode 100644
index 276f9673d067..000000000000
--- a/svtools/workben/unodialog/udlg.map
+++ /dev/null
@@ -1,8 +0,0 @@
-UDLG_1_0 {
- global:
- component_getImplementationEnvironment;
- component_writeInfo;
- component_getFactory;
- local:
- *;
-};
diff --git a/toolkit/inc/toolkit/awt/vclxsystemdependentwindow.hxx b/toolkit/inc/toolkit/awt/vclxsystemdependentwindow.hxx
index 5448bfaff320..73bd100c2bb7 100644
--- a/toolkit/inc/toolkit/awt/vclxsystemdependentwindow.hxx
+++ b/toolkit/inc/toolkit/awt/vclxsystemdependentwindow.hxx
@@ -40,8 +40,8 @@
// class VCLXSystemDependendtWindow
// ----------------------------------------------------
-class VCLXSystemDependentWindow : public ::com::sun::star::awt::XSystemDependentWindowPeer,
- public VCLXWindow
+class TOOLKIT_DLLPUBLIC VCLXSystemDependentWindow : public ::com::sun::star::awt::XSystemDependentWindowPeer,
+ public VCLXWindow
{
public:
VCLXSystemDependentWindow();
diff --git a/toolkit/inc/toolkit/awt/vclxwindow.hxx b/toolkit/inc/toolkit/awt/vclxwindow.hxx
index 97f36850dff9..6ad3c3ab6076 100644
--- a/toolkit/inc/toolkit/awt/vclxwindow.hxx
+++ b/toolkit/inc/toolkit/awt/vclxwindow.hxx
@@ -51,6 +51,7 @@
#include <stdarg.h>
#include <list>
+#include <boost/function.hpp>
class Window;
class VclSimpleEvent;
@@ -114,6 +115,23 @@ protected:
::cppu::OInterfaceContainerHelper& GetTopWindowListeners();
public:
+ typedef ::boost::function0< void > Callback;
+
+protected:
+ /** executes the given callback asynchronously
+
+ At the moment the callback is called, the Solar Mutex is not locked. In particular, this implies that
+ you cannot rely on |this| not being disposed. However, you *can* rely on |this| being still alive (i.e.
+ having a ref count > 0).
+
+ As a consequence, this can be used for doing listener notifications, using event multiplexers. Those multiplexers
+ care for the disposed state themself, and are alive as long as |this| is alive.
+ */
+ void ImplExecuteAsyncWithoutSolarLock(
+ const Callback& i_callback
+ );
+
+public:
VCLXWindow( bool bWithDefaultProps = false );
~VCLXWindow();
diff --git a/toolkit/inc/toolkit/awt/vclxwindows.hxx b/toolkit/inc/toolkit/awt/vclxwindows.hxx
index c334e4d9af65..ca3267bffb5e 100644
--- a/toolkit/inc/toolkit/awt/vclxwindows.hxx
+++ b/toolkit/inc/toolkit/awt/vclxwindows.hxx
@@ -75,7 +75,7 @@
#include <com/sun/star/awt/XFixedHyperlink.hpp>
#include <com/sun/star/awt/XFixedText.hpp>
#include <com/sun/star/awt/XControlContainer.hpp>
-#include <com/sun/star/awt/XDialog.hpp>
+#include <com/sun/star/awt/XDialog2.hpp>
#include <com/sun/star/awt/XRadioButton.hpp>
#include <com/sun/star/awt/XCurrencyField.hpp>
#include <com/sun/star/awt/XPatternField.hpp>
@@ -83,7 +83,9 @@
#include <com/sun/star/awt/XComboBox.hpp>
#include <com/sun/star/awt/XCheckBox.hpp>
#include <com/sun/star/awt/XImageConsumer.hpp>
+#include <com/sun/star/awt/XItemListListener.hpp>
#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/implbase2.hxx>
#include "toolkit/awt/vclxwindow.hxx"
@@ -388,7 +390,7 @@ public:
// ----------------------------------------------------
// class VCLXDialog
// ----------------------------------------------------
-class VCLXDialog : public ::com::sun::star::awt::XDialog,
+class VCLXDialog : public ::com::sun::star::awt::XDialog2,
public VCLXTopWindow
{
public:
@@ -404,6 +406,10 @@ public:
::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::XDialog2
+ virtual void SAL_CALL endDialog( ::sal_Int32 Result ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setHelpId( ::sal_Int32 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);
@@ -677,9 +683,12 @@ public:
// ----------------------------------------------------
// class VCLXListBox
// ----------------------------------------------------
-class VCLXListBox : public ::com::sun::star::awt::XListBox,
- public ::com::sun::star::awt::XTextLayoutConstrains,
- public VCLXWindow
+typedef ::cppu::ImplInheritanceHelper3 < VCLXWindow
+ , ::com::sun::star::awt::XListBox
+ , ::com::sun::star::awt::XTextLayoutConstrains
+ , ::com::sun::star::awt::XItemListListener
+ > VCLXListBox_Base;
+class VCLXListBox : public VCLXListBox_Base
{
private:
ActionListenerMultiplexer maActionListeners;
@@ -694,16 +703,6 @@ protected:
public:
VCLXListBox();
- // ::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);
- void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
- void SAL_CALL release() throw() { OWeakObject::release(); }
-
- // ::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::lang::XComponent
void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
@@ -744,6 +743,16 @@ public:
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);
+ // XItemListListener
+ virtual void SAL_CALL listItemInserted( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL listItemRemoved( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL listItemModified( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL allItemsRemoved( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL itemListChanged( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& i_rEvent ) throw (::com::sun::star::uno::RuntimeException);
+
static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
};
diff --git a/toolkit/inc/toolkit/controls/dialogcontrol.hxx b/toolkit/inc/toolkit/controls/dialogcontrol.hxx
index b6a0e66b2430..0c5731d3f923 100644
--- a/toolkit/inc/toolkit/controls/dialogcontrol.hxx
+++ b/toolkit/inc/toolkit/controls/dialogcontrol.hxx
@@ -36,7 +36,7 @@
#include <com/sun/star/util/XChangesListener.hpp>
#include <com/sun/star/util/XModifyListener.hpp>
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
-#include <com/sun/star/awt/XDialog.hpp>
+#include <com/sun/star/awt/XDialog2.hpp>
#include <com/sun/star/resource/XStringResourceResolver.hpp>
#include <cppuhelper/implbase6.hxx>
#include <cppuhelper/implbase5.hxx>
@@ -186,7 +186,7 @@ protected:
// ----------------------------------------------------
typedef ::cppu::ImplHelper6 < ::com::sun::star::container::XContainerListener
, ::com::sun::star::awt::XTopWindow
- , ::com::sun::star::awt::XDialog
+ , ::com::sun::star::awt::XDialog2
, ::com::sun::star::util::XChangesListener
, ::com::sun::star::util::XModifyListener
, ::com::sun::star::awt::XWindowListener
@@ -272,6 +272,10 @@ public:
void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) 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( ::sal_Int32 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);
diff --git a/toolkit/inc/toolkit/controls/roadmapcontrol.hxx b/toolkit/inc/toolkit/controls/roadmapcontrol.hxx
index 7ac858a6a7b7..46f31947b276 100644
--- a/toolkit/inc/toolkit/controls/roadmapcontrol.hxx
+++ b/toolkit/inc/toolkit/controls/roadmapcontrol.hxx
@@ -132,15 +132,9 @@ namespace toolkit{
// ::com::sun::star::io::XPersistObject
::rtl::OUString SAL_CALL getServiceName() 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::lang::XServiceInfo
DECLIMPL_SERVICEINFO_DERIVED( UnoControlRoadmapModel, UnoControlModel, szServiceName2_UnoControlRoadmapModel )
-// void ImplPropertyChanged( sal_uInt16 nPropId );
-
sal_Int32 SAL_CALL getCount() throw (RuntimeException);
virtual Any SAL_CALL getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException );
diff --git a/toolkit/inc/toolkit/controls/unocontrol.hxx b/toolkit/inc/toolkit/controls/unocontrol.hxx
index 578b5070e8e8..0515abe27128 100644
--- a/toolkit/inc/toolkit/controls/unocontrol.hxx
+++ b/toolkit/inc/toolkit/controls/unocontrol.hxx
@@ -38,6 +38,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/awt/XUnitConversion.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <cppuhelper/weakagg.hxx>
#include <osl/mutex.hxx>
@@ -46,7 +47,7 @@
#include <cppuhelper/propshlp.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <cppuhelper/weakref.hxx>
-#include <cppuhelper/implbase7.hxx>
+#include <cppuhelper/implbase8.hxx>
#include <com/sun/star/util/XModeChangeBroadcaster.hpp>
#include <com/sun/star/awt/XVclWindowPeer.hpp>
@@ -73,13 +74,14 @@ struct UnoControl_Data;
// ----------------------------------------------------
// class UnoControl
// ----------------------------------------------------
-typedef ::cppu::WeakAggImplHelper7 < ::com::sun::star::awt::XControl
+typedef ::cppu::WeakAggImplHelper8 < ::com::sun::star::awt::XControl
, ::com::sun::star::awt::XWindow2
, ::com::sun::star::awt::XView
, ::com::sun::star::beans::XPropertiesChangeListener
, ::com::sun::star::lang::XServiceInfo
, ::com::sun::star::accessibility::XAccessible
, ::com::sun::star::util::XModeChangeBroadcaster
+ , ::com::sun::star::awt::XUnitConversion
> UnoControl_Base;
class TOOLKIT_DLLPUBLIC UnoControl : public UnoControl_Base
@@ -119,7 +121,7 @@ protected:
::osl::Mutex& GetMutex() { return maMutex; }
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > getParentPeer() const;
- void updateFromModel();
+ virtual void updateFromModel();
void peerCreated();
bool ImplCheckLocalize( ::rtl::OUString& _rPossiblyLocalizable );
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > ImplGetCompatiblePeer( sal_Bool bAcceptExistingPeer );
@@ -220,6 +222,12 @@ public:
virtual void SAL_CALL addModeChangeApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeApproveListener >& _rxListener ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeModeChangeApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeApproveListener >& _rxListener ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+ // XUnitConversion
+ virtual ::com::sun::star::awt::Point SAL_CALL convertPointToLogic( const ::com::sun::star::awt::Point& Point, ::sal_Int16 TargetUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL convertPointToPixel( const ::com::sun::star::awt::Point& aPoint, ::sal_Int16 SourceUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL convertSizeToLogic( const ::com::sun::star::awt::Size& aSize, ::sal_Int16 TargetUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL convertSizeToPixel( const ::com::sun::star::awt::Size& aSize, ::sal_Int16 SourceUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
private:
// ::com::sun::star::beans::XPropertiesChangeListener
void SAL_CALL propertiesChange( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& evt ) throw(::com::sun::star::uno::RuntimeException);
diff --git a/toolkit/inc/toolkit/controls/unocontrolmodel.hxx b/toolkit/inc/toolkit/controls/unocontrolmodel.hxx
index 2de5e36aa02c..71decdfcb2c9 100644
--- a/toolkit/inc/toolkit/controls/unocontrolmodel.hxx
+++ b/toolkit/inc/toolkit/controls/unocontrolmodel.hxx
@@ -53,17 +53,17 @@ class ImplPropertyTable;
// class UnoControlModel
// ----------------------------------------------------
-class 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
+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
{
private:
ImplPropertyTable* mpData;
@@ -74,7 +74,6 @@ protected:
void ImplRegisterProperties( const std::list< sal_uInt16 > &rIds );
void ImplRegisterProperty( sal_uInt16 nPropId, const ::com::sun::star::uno::Any& rDefault );
::com::sun::star::uno::Sequence<sal_Int32> ImplGetPropertyIds() const;
- virtual void ImplPropertyChanged( sal_uInt16 nPropId );
virtual ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
sal_Bool ImplHasProperty( sal_uInt16 nPropId ) const;
diff --git a/toolkit/inc/toolkit/controls/unocontrols.hxx b/toolkit/inc/toolkit/controls/unocontrols.hxx
index a4015dfd3b44..88449418c70a 100644
--- a/toolkit/inc/toolkit/controls/unocontrols.hxx
+++ b/toolkit/inc/toolkit/controls/unocontrols.hxx
@@ -51,6 +51,7 @@
#include <com/sun/star/awt/XCurrencyField.hpp>
#include <com/sun/star/awt/XPatternField.hpp>
#include <com/sun/star/awt/XProgressBar.hpp>
+#include <com/sun/star/awt/XItemList.hpp>
#include <com/sun/star/graphic/XGraphicObject.hpp>
#include <toolkit/controls/unocontrolmodel.hxx>
#include <toolkit/controls/unocontrolbase.hxx>
@@ -58,12 +59,17 @@
#include <toolkit/helper/servicenames.hxx>
#include <vcl/imgcons.hxx>
#include <vcl/bitmapex.hxx>
+#include <cppuhelper/implbase5.hxx>
#include <cppuhelper/implbase4.hxx>
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/implbase1.hxx>
#include <comphelper/uno3.hxx>
#include <list>
+#include <vector>
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/optional.hpp>
#define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
#define UNO_NAME_GRAPHOBJ_URLPKGPREFIX "vnd.sun.star.Package:"
@@ -751,19 +757,18 @@ public:
// ----------------------------------------------------
// class UnoControlListBoxModel
// ----------------------------------------------------
-class UnoControlListBoxModel : public UnoControlModel
+struct UnoControlListBoxModel_Data;
+typedef ::cppu::AggImplInheritanceHelper1 < UnoControlModel
+ , ::com::sun::star::awt::XItemList
+ > UnoControlListBoxModel_Base;
+class UnoControlListBoxModel :public UnoControlListBoxModel_Base
{
-protected:
- ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
- ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
-
public:
UnoControlListBoxModel();
- UnoControlListBoxModel( const UnoControlListBoxModel& rModel ) : UnoControlModel( rModel ) {;}
+ UnoControlListBoxModel( const UnoControlListBoxModel& i_rSource );
UnoControlModel* Clone() const { return new UnoControlListBoxModel( *this ); }
- void ImplPropertyChanged( sal_uInt16 nPropId );
virtual void ImplNormalizePropertySequence(
const sal_Int32 _nCount, /// the number of entries in the arrays
sal_Int32* _pHandles, /// the handles of the properties to set
@@ -780,41 +785,87 @@ public:
// ::com::sun::star::lang::XServiceInfo
DECLIMPL_SERVICEINFO_DERIVED( UnoControlListBoxModel, UnoControlModel, szServiceName2_UnoControlListBoxModel )
+ // ::com::sun::star::awt::XItemList
+ virtual ::sal_Int32 SAL_CALL getItemCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertItem( ::sal_Int32 Position, const ::rtl::OUString& ItemText, const ::rtl::OUString& ItemImageURL ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertItemText( ::sal_Int32 Position, const ::rtl::OUString& ItemText ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertItemImage( ::sal_Int32 Position, const ::rtl::OUString& ItemImageURL ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeItem( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeAllItems( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setItemText( ::sal_Int32 Position, const ::rtl::OUString& ItemText ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setItemImage( ::sal_Int32 Position, const ::rtl::OUString& ItemImageURL ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setItemTextAndImage( ::sal_Int32 Position, const ::rtl::OUString& ItemText, const ::rtl::OUString& ItemImageURL ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setItemData( ::sal_Int32 Position, const ::com::sun::star::uno::Any& DataValue ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getItemText( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getItemImage( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::beans::Pair< ::rtl::OUString, ::rtl::OUString > SAL_CALL getItemTextAndImage( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getItemData( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Pair< ::rtl::OUString, ::rtl::OUString > > SAL_CALL getAllItems( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addItemListListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeItemListListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListListener >& Listener ) 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);
+
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+private:
+ void impl_notifyItemListEvent_nolck(
+ const sal_Int32 i_nItemPosition,
+ const ::boost::optional< ::rtl::OUString >& i_rItemText,
+ const ::boost::optional< ::rtl::OUString >& i_rItemImageURL,
+ void ( SAL_CALL ::com::sun::star::awt::XItemListListener::*NotificationMethod )( const ::com::sun::star::awt::ItemListEvent& )
+ );
+
+ void impl_handleInsert(
+ const sal_Int32 i_nItemPosition,
+ const ::boost::optional< ::rtl::OUString >& i_rItemText,
+ const ::boost::optional< ::rtl::OUString >& i_rItemImageURL,
+ ::osl::ClearableMutexGuard& i_rClearBeforeNotify
+ );
+
+ void impl_handleRemove(
+ const sal_Int32 i_nItemPosition,
+ ::osl::ClearableMutexGuard& i_rClearBeforeNotify
+ );
+
+ void impl_handleModify(
+ const sal_Int32 i_nItemPosition,
+ const ::boost::optional< ::rtl::OUString >& i_rItemText,
+ const ::boost::optional< ::rtl::OUString >& i_rItemImageURL,
+ ::osl::ClearableMutexGuard& i_rClearBeforeNotify
+ );
+
+ void impl_getStringItemList( ::std::vector< ::rtl::OUString >& o_rStringItems ) const;
+ void impl_setStringItemList_nolck( const ::std::vector< ::rtl::OUString >& i_rStringItems );
+
+private:
+ ::boost::scoped_ptr< UnoControlListBoxModel_Data > m_pData;
+ ::cppu::OInterfaceContainerHelper m_aItemListListeners;
};
// ----------------------------------------------------
// class UnoListBoxControl
// ----------------------------------------------------
-class UnoListBoxControl : public UnoControlBase,
- public ::com::sun::star::awt::XListBox,
- public ::com::sun::star::awt::XItemListener,
- public ::com::sun::star::awt::XLayoutConstrains,
- public ::com::sun::star::awt::XTextLayoutConstrains
+typedef ::cppu::AggImplInheritanceHelper5 < UnoControlBase
+ , ::com::sun::star::awt::XListBox
+ , ::com::sun::star::awt::XItemListener
+ , ::com::sun::star::awt::XLayoutConstrains
+ , ::com::sun::star::awt::XTextLayoutConstrains
+ , ::com::sun::star::awt::XItemListListener
+ > UnoListBoxControl_Base;
+class UnoListBoxControl : public UnoListBoxControl_Base
{
-private:
- ActionListenerMultiplexer maActionListeners;
- ItemListenerMultiplexer maItemListeners;
-
public:
-
UnoListBoxControl();
::rtl::OUString GetComponentServiceName();
- void ImplUpdateSelectedItemsProperty();
- void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal );
-
- ::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); }
- ::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 dispose( ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); }
- // ::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::XListBox
void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
@@ -851,9 +902,27 @@ public:
::com::sun::star::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException);
+ // XUnoControl
+ sal_Bool SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model) throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XItemListListener
+ virtual void SAL_CALL listItemInserted( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL listItemRemoved( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL listItemModified( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL allItemsRemoved( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL itemListChanged( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
+
// ::com::sun::star::lang::XServiceInfo
DECLIMPL_SERVICEINFO_DERIVED( UnoListBoxControl, UnoControlBase, szServiceName2_UnoControlListBox )
+protected:
+ void ImplUpdateSelectedItemsProperty();
+ virtual void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal );
+ virtual void updateFromModel();
+
+private:
+ ActionListenerMultiplexer maActionListeners;
+ ItemListenerMultiplexer maItemListeners;
};
// ----------------------------------------------------
diff --git a/toolkit/inc/toolkit/helper/listenermultiplexer.hxx b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
index 65e555f9d799..b9fb82c3d4bb 100644
--- a/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
+++ b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
@@ -54,7 +54,7 @@
#include <osl/mutex.hxx>
#include <toolkit/helper/mutexhelper.hxx>
#include <toolkit/helper/macros.hxx>
-
+#include <com/sun/star/awt/grid/XGridSelectionListener.hpp>
// ----------------------------------------------------
// class ListenerMultiplexerBase
// ----------------------------------------------------
@@ -244,8 +244,12 @@ DECL_LISTENERMULTIPLEXER_START_DLLPUB( TreeEditListenerMultiplexer, ::com::sun::
virtual void SAL_CALL nodeEdited( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node, const ::rtl::OUString& NewText ) throw (::com::sun::star::uno::RuntimeException);
DECL_LISTENERMULTIPLEXER_END
-
-
+// ----------------------------------------------------
+// class SelectionListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener )
+ void SAL_CALL selectionChanged( const ::com::sun::star::awt::grid::GridSelectionEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
#endif // _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_
diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx
index d9adc182f4d7..f8a1a703799c 100644
--- a/toolkit/inc/toolkit/helper/property.hxx
+++ b/toolkit/inc/toolkit/helper/property.hxx
@@ -196,6 +196,12 @@ 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_MULTISELECTION_SIMPLEMODE 152
+#define BASEPROPERTY_ITEM_SEPARATOR_POS 153
// 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 70f18f91fb09..96d9d5810cc0 100644
--- a/toolkit/inc/toolkit/helper/servicenames.hxx
+++ b/toolkit/inc/toolkit/helper/servicenames.hxx
@@ -98,8 +98,10 @@ 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_UnoSimpleAnimationControl[], szServiceName_UnoSimpleAnimationControlModel[];
-extern const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[], szServiceName_UnoThrobberControlModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControl[], szServiceName2_UnoSimpleAnimationControl[];
+extern const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControlModel[], szServiceName2_UnoSimpleAnimationControlModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[], szServiceName2_UnoThrobberControl[];
+extern const sal_Char __FAR_DATA szServiceName_UnoThrobberControlModel[], szServiceName2_UnoThrobberControlModel[];
extern const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlink[], szServiceName_UnoControlFixedHyperlinkModel[];
// ExtUnoWrapper:
diff --git a/toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx b/toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx
index 2a42d05b72fd..5b5cb3021fc9 100644
--- a/toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx
+++ b/toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx
@@ -28,6 +28,7 @@
#ifndef _TOOLKIT_HELPER_UNOPROPERTYARRAYHELPER_HXX_
#define _TOOLKIT_HELPER_UNOPROPERTYARRAYHELPER_HXX_
+#include <toolkit/dllapi.h>
#include <cppuhelper/propshlp.hxx>
#include <tools/table.hxx>
@@ -37,7 +38,7 @@
// ----------------------------------------------------
// class UnoPropertyArrayHelper
// ----------------------------------------------------
-class UnoPropertyArrayHelper : public ::cppu::IPropertyArrayHelper
+class TOOLKIT_DLLPUBLIC UnoPropertyArrayHelper : public ::cppu::IPropertyArrayHelper
{
private:
Table maIDs;
diff --git a/toolkit/prj/d.lst b/toolkit/prj/d.lst
index 0c62a083b330..375485c96e4d 100644
--- a/toolkit/prj/d.lst
+++ b/toolkit/prj/d.lst
@@ -24,6 +24,7 @@ mkdir: %_DEST%\inc%_EXT%\toolkit\controls
..\inc\toolkit\awt\vclxtopwindow.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxtopwindow.hxx
..\inc\toolkit\awt\vclxtoolkit.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxtoolkit.hxx
..\inc\toolkit\awt\vclxwindow.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxwindow.hxx
+..\inc\toolkit\awt\vclxsystemdependentwindow.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxsystemdependentwindow.hxx
..\source\awt\vclxdialog.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxdialog.hxx
..\inc\toolkit\awt\vclxwindows.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxwindows.hxx
..\inc\toolkit\awt\vclxmenu.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxmenu.hxx
@@ -47,6 +48,7 @@ mkdir: %_DEST%\inc%_EXT%\toolkit\controls
..\inc\toolkit\helper\formpdfexport.hxx %_DEST%\inc%_EXT%\toolkit\helper/formpdfexport.hxx
..\inc\toolkit\helper\accessiblefactory.hxx %_DEST%\inc%_EXT%\toolkit\helper\accessiblefactory.hxx
..\inc\toolkit\helper\fixedhyperbase.hxx %_DEST%\inc%_EXT%\toolkit\helper\fixedhyperbase.hxx
+..\inc\toolkit\helper\unopropertyarrayhelper.hxx %_DEST%\inc%_EXT%\toolkit\helper\unopropertyarrayhelper.hxx
..\inc\toolkit\helper\vclunohelper.hxx %_DEST%\inc%_EXT%\toolkit\unohlp.hxx
..\inc\toolkit\dllapi.h %_DEST%\inc%_EXT%\toolkit\dllapi.h
diff --git a/toolkit/qa/unoapi/Test.java b/toolkit/qa/unoapi/Test.java
new file mode 100644
index 000000000000..f27d882314d2
--- /dev/null
+++ b/toolkit/qa/unoapi/Test.java
@@ -0,0 +1,51 @@
+/*************************************************************************
+* 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 org.openoffice.toolkit.qa.unoapi;
+
+import org.openoffice.Runner;
+import org.openoffice.test.OfficeConnection;
+import static org.junit.Assert.*;
+
+public final class Test {
+ @org.junit.Before public void setUp() throws Exception {
+ connection.setUp();
+ }
+
+ @org.junit.After public void tearDown()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ connection.tearDown();
+ }
+
+ @org.junit.Test public void test() {
+ assertTrue(
+ Runner.run(
+ "-sce", "toolkit.sce", "-xcl", "knownissues.xcl", "-tdoc",
+ "testdocuments", "-cs", connection.getDescription()));
+ }
+
+ private final OfficeConnection connection = new OfficeConnection();
+}
diff --git a/toolkit/qa/unoapi/knownissues.xcl b/toolkit/qa/unoapi/knownissues.xcl
index ef954f00eeeb..429d7693c833 100644
--- a/toolkit/qa/unoapi/knownissues.xcl
+++ b/toolkit/qa/unoapi/knownissues.xcl
@@ -90,11 +90,6 @@ toolkit.AccessibleRadioButton
toolkit.AccessibleToolBox
# -> disabled in toolkit.sce
-### i80788 ###
-toolkit.Toolkit
-toolkit.UnoControlDialog
-# -> disabled in toolkit.sce
-
### i86011 ###
toolkit.UnoControlFileControl
# -> disabled in toolkit.sce
@@ -239,4 +234,19 @@ toolkit.AccessibleScrollBar::com::sun::star::accessibility::XAccessibleComponent
toolkit.UnoScrollBarControl::com::sun::star::awt::XScrollBar
### i94344 ###
-toolkit.AccessibleTabPage::com::sun::star::accessibility::XAccessibleText \ No newline at end of file
+toolkit.AccessibleTabPage::com::sun::star::accessibility::XAccessibleText
+
+### i109643 ###
+toolkit.AccessibleMenu::com::sun::star::accessibility::XAccessibleValue
+toolkit.AccessibleMenuBar::com::sun::star::accessibility::XAccessibleEventBroadcaster
+toolkit.AccessibleMenuBar::com::sun::star::accessibility::XAccessibleSelection
+
+### i111076 ###
+toolkit.Toolkit::com::sun::star::awt::XDataTransferProviderAccess
+
+### i111113 ###
+toolkit.AccessibleStatusBarItem::com::sun::star::accessibility::XAccessibleComponent
+toolkit.AccessibleStatusBarItem::com::sun::star::accessibility::XAccessibleContext
+
+### i111195 ###
+toolkit.AccessibleScrollBar::com::sun::star::accessibility::XAccessibleValue
diff --git a/toolkit/qa/unoapi/makefile.mk b/toolkit/qa/unoapi/makefile.mk
index a24f81d7c6ef..9517601c3917 100644
--- a/toolkit/qa/unoapi/makefile.mk
+++ b/toolkit/qa/unoapi/makefile.mk
@@ -1,7 +1,6 @@
#*************************************************************************
-#
# 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
@@ -22,22 +21,28 @@
# version 3 along with OpenOffice.org. If not, see
# <http://www.openoffice.org/license.html>
# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
+#***********************************************************************/
-PRJ=..$/..
+.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
+nothing .PHONY:
+.ELSE
-PRJNAME=toolkit
-TARGET=qa_unoapi
+PRJ = ../..
+PRJNAME = toolkit
+TARGET = qa_unoapi
-.INCLUDE: settings.mk
+.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 : UNOAPI_TEST
+ALLTAR : javatest
-UNOAPI_TEST:
- +$(SOLARENV)$/bin$/checkapi -sce toolkit.sce -xcl knownissues.xcl -tdoc $(PWD)$/testdocuments
- @echo =======================================================================
- @echo In case you noticed a failures of toolkit.AccessibleToolBoxItem make sure that the object bar is configured as text and not as icons
- @echo =======================================================================
+.END
diff --git a/toolkit/qa/unoapi/toolkit.sce b/toolkit/qa/unoapi/toolkit.sce
index dad24165e2d2..5a148feee573 100644
--- a/toolkit/qa/unoapi/toolkit.sce
+++ b/toolkit/qa/unoapi/toolkit.sce
@@ -8,17 +8,17 @@
#i86110 -o toolkit.AccessibleList
#i86110 -o toolkit.AccessibleListBox
#i86110 -o toolkit.AccessibleListItem
--o toolkit.AccessibleMenu
--o toolkit.AccessibleMenuBar
+#i111047# -o toolkit.AccessibleMenu
+#i111047# -o toolkit.AccessibleMenuBar
#i86009 -o toolkit.AccessibleMenuItem
--o toolkit.AccessibleMenuSeparator
+#i111047# -o toolkit.AccessibleMenuSeparator
#i52607 -o toolkit.AccessiblePopupMenu
#i86107,i86110 -o toolkit.AccessibleRadioButton
-o toolkit.AccessibleScrollBar
--o toolkit.AccessibleStatusBar
+#i111225 -o toolkit.AccessibleStatusBar
-o toolkit.AccessibleStatusBarItem
--o toolkit.AccessibleTabControl
--o toolkit.AccessibleTabPage
+#i109643 -o toolkit.AccessibleTabControl
+#i109643 -o toolkit.AccessibleTabPage
#i86287 -o toolkit.AccessibleToolBox
#i88605 -o toolkit.AccessibleToolBoxItem
-o toolkit.AccessibleWindow
@@ -26,7 +26,7 @@
-o toolkit.MutableTreeNode
-o toolkit.TabController
-o toolkit.TabControllerModel
-#i80788 -o toolkit.Toolkit
+-o toolkit.Toolkit
-o toolkit.UnoControlButton
-o toolkit.UnoControlButtonModel
-o toolkit.UnoControlCheckBox
@@ -39,7 +39,7 @@
-o toolkit.UnoControlCurrencyFieldModel
-o toolkit.UnoControlDateField
-o toolkit.UnoControlDateFieldModel
-#i80788 -o toolkit.UnoControlDialog
+#allegedly was i80788, but still broken: -o toolkit.UnoControlDialog
-o toolkit.UnoControlDialogModel
-o toolkit.UnoControlEdit
-o toolkit.UnoControlEditModel
diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx
index 1992a8d721a6..5e44df58318e 100644
--- a/toolkit/source/awt/vclxmenu.cxx
+++ b/toolkit/source/awt/vclxmenu.cxx
@@ -37,11 +37,13 @@
#include <cppuhelper/typeprovider.hxx>
#include <rtl/memory.h>
#include <rtl/uuid.h>
+#include <vos/mutex.hxx>
#include <vcl/menu.hxx>
#include <vcl/keycod.hxx>
#include <vcl/image.hxx>
#include <vcl/mnemonic.hxx>
+#include <vcl/svapp.hxx>
#include <com/sun/star/awt/KeyModifier.hpp>
@@ -416,6 +418,7 @@ void VCLXMenu::removeMenuListener( const ::com::sun::star::uno::Reference< ::com
void VCLXMenu::insertItem( sal_Int16 nItemId, const ::rtl::OUString& aText, sal_Int16 nItemStyle, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu )
@@ -424,6 +427,7 @@ void VCLXMenu::insertItem( sal_Int16 nItemId, const ::rtl::OUString& aText, sal_
void VCLXMenu::removeItem( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
sal_Int32 nItemCount = (sal_Int32)mpMenu->GetItemCount();
@@ -438,6 +442,7 @@ void VCLXMenu::removeItem( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::
sal_Int16 VCLXMenu::getItemCount( ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
return mpMenu ? mpMenu->GetItemCount() : 0;
@@ -445,6 +450,7 @@ sal_Int16 VCLXMenu::getItemCount( ) throw(::com::sun::star::uno::RuntimeExcepti
sal_Int16 VCLXMenu::getItemId( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
return mpMenu ? mpMenu->GetItemId( nPos ) : 0;
@@ -452,6 +458,7 @@ sal_Int16 VCLXMenu::getItemId( sal_Int16 nPos ) throw(::com::sun::star::uno::Run
sal_Int16 VCLXMenu::getItemPos( sal_Int16 nId ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
return mpMenu ? mpMenu->GetItemPos( nId ) : 0;
@@ -459,6 +466,7 @@ sal_Int16 VCLXMenu::getItemPos( sal_Int16 nId ) throw(::com::sun::star::uno::Run
void VCLXMenu::enableItem( sal_Int16 nItemId, sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu )
@@ -467,6 +475,7 @@ void VCLXMenu::enableItem( sal_Int16 nItemId, sal_Bool bEnable ) throw(::com::su
sal_Bool VCLXMenu::isItemEnabled( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
return mpMenu ? mpMenu->IsItemEnabled( nItemId ) : sal_False;
@@ -474,6 +483,7 @@ sal_Bool VCLXMenu::isItemEnabled( sal_Int16 nItemId ) throw(::com::sun::star::un
void VCLXMenu::setItemText( sal_Int16 nItemId, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu )
@@ -482,6 +492,7 @@ void VCLXMenu::setItemText( sal_Int16 nItemId, const ::rtl::OUString& aText ) th
::rtl::OUString VCLXMenu::getItemText( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
::rtl::OUString aItemText;
@@ -492,6 +503,7 @@ void VCLXMenu::setItemText( sal_Int16 nItemId, const ::rtl::OUString& aText ) th
void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& rxPopupMenu ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
VCLXMenu* pVCLMenu = VCLXMenu::GetImplementation( rxPopupMenu );
@@ -510,6 +522,7 @@ void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Ref
::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > VCLXMenu::getPopupMenu( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > aRef;
@@ -533,6 +546,7 @@ void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Ref
// ::com::sun::star::awt::XPopupMenu
void VCLXMenu::insertSeparator( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu )
@@ -541,6 +555,7 @@ void VCLXMenu::insertSeparator( sal_Int16 nPos ) throw(::com::sun::star::uno::Ru
void VCLXMenu::setDefaultItem( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu )
@@ -549,6 +564,7 @@ void VCLXMenu::setDefaultItem( sal_Int16 nItemId ) throw(::com::sun::star::uno::
sal_Int16 VCLXMenu::getDefaultItem( ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
return mpMenu ? mpMenu->GetDefaultItem() : 0;
@@ -556,6 +572,7 @@ sal_Int16 VCLXMenu::getDefaultItem( ) throw(::com::sun::star::uno::RuntimeExcep
void VCLXMenu::checkItem( sal_Int16 nItemId, sal_Bool bCheck ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu )
@@ -564,6 +581,7 @@ void VCLXMenu::checkItem( sal_Int16 nItemId, sal_Bool bCheck ) throw(::com::sun:
sal_Bool VCLXMenu::isItemChecked( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
return mpMenu ? mpMenu->IsItemChecked( nItemId ) : sal_False;
@@ -571,6 +589,7 @@ sal_Bool VCLXMenu::isItemChecked( sal_Int16 nItemId ) throw(::com::sun::star::un
sal_Int16 VCLXMenu::execute( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rxWindowPeer, const ::com::sun::star::awt::Rectangle& rArea, sal_Int16 nFlags ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
sal_Int16 nRet = 0;
@@ -582,6 +601,7 @@ sal_Int16 VCLXMenu::execute( const ::com::sun::star::uno::Reference< ::com::sun:
void SAL_CALL VCLXMenu::setCommand( sal_Int16 nItemId, const ::rtl::OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu )
@@ -590,6 +610,7 @@ void SAL_CALL VCLXMenu::setCommand( sal_Int16 nItemId, const ::rtl::OUString& aC
::rtl::OUString SAL_CALL VCLXMenu::getCommand( sal_Int16 nItemId ) throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
::rtl::OUString aItemCommand;
@@ -600,6 +621,7 @@ void SAL_CALL VCLXMenu::setCommand( sal_Int16 nItemId, const ::rtl::OUString& aC
void SAL_CALL VCLXMenu::setHelpCommand( sal_Int16 nItemId, const ::rtl::OUString& aHelp ) throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu )
@@ -608,6 +630,7 @@ void SAL_CALL VCLXMenu::setHelpCommand( sal_Int16 nItemId, const ::rtl::OUString
::rtl::OUString SAL_CALL VCLXMenu::getHelpCommand( sal_Int16 nItemId ) throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
::rtl::OUString aHelpCommand;
@@ -708,12 +731,14 @@ namespace
::sal_Bool SAL_CALL VCLXMenu::isPopupMenu( ) throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
return IsPopupMenu();
}
void SAL_CALL VCLXMenu::clear( ) throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu )
mpMenu->Clear();
@@ -724,6 +749,7 @@ void SAL_CALL VCLXMenu::clear( ) throw (::com::sun::star::uno::RuntimeException
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
::com::sun::star::awt::MenuItemType aMenuItemType =
@@ -740,6 +766,7 @@ throw ( ::com::sun::star::container::NoSuchElementException,
void SAL_CALL VCLXMenu::hideDisabledEntries( ::sal_Bool bHide )
throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu )
{
@@ -761,6 +788,7 @@ throw (::com::sun::star::uno::RuntimeException)
::sal_Bool SAL_CALL VCLXMenu::isInExecute( )
throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu && IsPopupMenu() )
@@ -773,6 +801,7 @@ throw (::com::sun::star::uno::RuntimeException)
void SAL_CALL VCLXMenu::endExecute()
throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu && IsPopupMenu() )
@@ -783,6 +812,7 @@ throw (::com::sun::star::uno::RuntimeException)
void SAL_CALL VCLXMenu::setLogo( const ::com::sun::star::awt::MenuLogo& aMenuLogo )
throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu )
@@ -807,6 +837,7 @@ throw (::com::sun::star::uno::RuntimeException)
::com::sun::star::awt::MenuLogo SAL_CALL VCLXMenu::getLogo( )
throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
::com::sun::star::awt::MenuLogo aAWTMenuLogo;
@@ -827,6 +858,7 @@ throw (::com::sun::star::uno::RuntimeException)
void SAL_CALL VCLXMenu::enableAutoMnemonics( ::sal_Bool bEnable )
throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu )
{
@@ -843,6 +875,7 @@ void SAL_CALL VCLXMenu::setAcceleratorKeyEvent( ::sal_Int16 nItemId,
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu && IsPopupMenu() )
@@ -858,6 +891,7 @@ throw ( ::com::sun::star::container::NoSuchElementException,
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
::com::sun::star::awt::KeyEvent aKeyEvent;
@@ -876,6 +910,7 @@ void SAL_CALL VCLXMenu::setHelpText( ::sal_Int16 nItemId, const ::rtl::OUString&
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu && IsPopupMenu() )
@@ -890,6 +925,7 @@ throw ( ::com::sun::star::container::NoSuchElementException,
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
rtl::OUString sHelpText;
@@ -907,6 +943,7 @@ void SAL_CALL VCLXMenu::setTipHelpText( ::sal_Int16 nItemId, const ::rtl::OUStri
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu && IsPopupMenu() )
@@ -921,6 +958,7 @@ throw ( ::com::sun::star::container::NoSuchElementException,
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
rtl::OUString sTipHelpText;
@@ -939,6 +977,7 @@ void SAL_CALL VCLXMenu::setItemImage(
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu && IsPopupMenu() )
@@ -954,6 +993,7 @@ throw ( ::com::sun::star::container::NoSuchElementException,
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > rxGraphic;
@@ -973,6 +1013,7 @@ void SAL_CALL VCLXMenu::setItemImageAngle( ::sal_Int16 nItemId, ::sal_Int32 nAng
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu && IsPopupMenu() )
@@ -987,6 +1028,7 @@ throw ( ::com::sun::star::container::NoSuchElementException,
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
::sal_Int32 nItemImageAngle( 0 );
@@ -1003,6 +1045,7 @@ void SAL_CALL VCLXMenu::setItemImageMirrorMode( ::sal_Int16 nItemId, ::sal_Bool
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu && IsPopupMenu() )
@@ -1017,6 +1060,7 @@ throw ( ::com::sun::star::container::NoSuchElementException,
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
sal_Bool bMirrorMode( sal_False );
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 2eeafa73d2d2..f85e29c21099 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -632,7 +632,15 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
// Wenn die Component einen Parent braucht, dann NULL zurueckgeben,
// spaeter mal ::com::sun::star::uno::Exception...
sal_Bool bException = sal_True;
- if ( ( nType == WINDOW_DIALOG ) || ( nType == WINDOW_MODALDIALOG ) || ( nType == WINDOW_MODELESSDIALOG ) )
+ if ( ( nType == WINDOW_DIALOG )
+ || ( nType == WINDOW_MODALDIALOG )
+ || ( nType == WINDOW_MODELESSDIALOG )
+ || ( nType == WINDOW_MESSBOX )
+ || ( nType == WINDOW_INFOBOX )
+ || ( nType == WINDOW_WARNINGBOX )
+ || ( nType == WINDOW_ERRORBOX )
+ || ( nType == WINDOW_QUERYBOX )
+ )
bException = sal_False;
else if ( ( nType == WINDOW_WINDOW ) ||
( nType == WINDOW_WORKWINDOW ) ||
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index 248571819067..dd4d56586b03 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -67,6 +67,8 @@
#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <boost/bind.hpp>
+
using namespace ::com::sun::star;
using ::com::sun::star::uno::Reference;
@@ -109,117 +111,15 @@ namespace
m_rFlag = false;
}
};
-
- //................................................................
- //. MouseEventType
- //................................................................
- enum MouseEventType
- {
- META_FIRST_MOUSE_EVENT = 0,
-
- EVENT_MOUSE_PRESSED = 0,
- EVENT_MOUSE_RELEASED = 1,
- EVENT_MOUSE_ENTERED = 2,
- EVENT_MOUSE_EXITED = 3,
-
- META_LAST_MOUSE_EVENT = 3
- };
-
- //................................................................
- //. PlainEventType
- //................................................................
- enum PlainEventType
- {
- META_FIRST_PLAIN_EVENT = 4,
-
- EVENT_WINDOW_ENABLED = 4,
- EVENT_WINDOW_DISABLED = 5,
-
- META_LAST_PLAIN_EVENT = 5
- };
-
-#if OSL_DEBUG_LEVEL > 0
- static void checkEventDefinitions()
- {
- OSL_ENSURE( (int)META_LAST_MOUSE_EVENT < (int)META_FIRST_PLAIN_EVENT, "checkEventDefinitions: invalid event definitions!" );
- }
- #define DBG_CHECK_EVENTS() checkEventDefinitions()
-#else
- #define DBG_CHECK_EVENTS()
-#endif
-
- //................................................................
- //. AnyWindowEvent
- //................................................................
- struct AnyWindowEvent : public ::comphelper::AnyEvent
- {
- private:
- awt::MouseEvent m_aMouseEvent;
- lang::EventObject m_aPlainEvent;
-
- sal_Int32 m_nEventType;
-
- public:
- AnyWindowEvent( const awt::MouseEvent& _rEvent, MouseEventType _nType )
- :comphelper::AnyEvent()
- ,m_aMouseEvent( _rEvent )
- ,m_nEventType( static_cast< sal_Int32 >( _nType ) )
- {
- DBG_CHECK_EVENTS();
- }
-
- AnyWindowEvent( const lang::EventObject& _rEvent, PlainEventType _nType )
- :comphelper::AnyEvent()
- ,m_aPlainEvent( _rEvent )
- ,m_nEventType( static_cast< sal_Int32 >( _nType ) )
- {
- DBG_CHECK_EVENTS();
- }
-
- bool isMouseEvent() const
- {
- return ( META_FIRST_MOUSE_EVENT <= m_nEventType ) && ( m_nEventType <= META_LAST_MOUSE_EVENT );
- }
-
- bool isPlainEvent() const
- {
- return ( META_FIRST_PLAIN_EVENT <= m_nEventType ) && ( m_nEventType <= META_LAST_PLAIN_EVENT );
- }
-
- const awt::MouseEvent& getMouseEvent() const
- {
- OSL_ENSURE( isMouseEvent(), "AnyWindowEvent::getMouseEvent: no mouse event!" );
- return m_aMouseEvent;
- }
-
- MouseEventType getMouseEventType() const
- {
- OSL_ENSURE( isMouseEvent(), "AnyWindowEvent::getMouseEventType: no mouse event!" );
- return static_cast< MouseEventType >( m_nEventType );
- }
-
- const lang::EventObject& getPlainEvent() const
- {
- OSL_ENSURE( isPlainEvent(), "AnyWindowEvent::getPlainEvent: no plain event!" );
- return m_aPlainEvent;
- }
-
- PlainEventType getPlainEventType() const
- {
- OSL_ENSURE( isPlainEvent(), "AnyWindowEvent::getPlainEventType: no mouse event!" );
- return static_cast< PlainEventType >( m_nEventType );
- }
- };
}
//====================================================================
//= VCLXWindowImpl
//====================================================================
-class SAL_DLLPRIVATE VCLXWindowImpl : public ::comphelper::IEventProcessor
+class SAL_DLLPRIVATE VCLXWindowImpl
{
private:
- typedef ::std::vector< ::rtl::Reference< ::comphelper::AnyEvent > >
- EventArray;
+ typedef ::std::vector< VCLXWindow::Callback > CallbackArray;
private:
VCLXWindow& mrAntiImpl;
@@ -243,8 +143,8 @@ private:
VclContainerListenerMultiplexer maContainerListeners;
TopWindowListenerMultiplexer maTopWindowListeners;
- EventArray maEvents;
- ULONG mnEventId;
+ CallbackArray maCallbackEvents;
+ ULONG mnCallbackEventId;
public:
bool mbDisposing : 1;
@@ -285,13 +185,9 @@ public:
void setDirectVisible( sal_Bool bDirectVisible ) { mbDirectVisible = bDirectVisible; }
sal_Bool isDirectVisible() { return mbDirectVisible; }
- /** asynchronously notifies a mouse event to the VCLXWindow's XMouseListeners
- */
- void notifyMouseEvent( const awt::MouseEvent& _rMouseEvent, MouseEventType _nType );
-
- /** asynchronously notifies an event described by an EventObject to the respective listeners
+ /** impl-version of VCLXWindow::ImplExecuteAsyncWithoutSolarLock
*/
- void notifyPlainEvent( const lang::EventObject& _rPlainEvent, PlainEventType _nType );
+ void callBackAsync( const VCLXWindow::Callback& i_callback );
/** notifies the object that its VCLXWindow is being disposed
*/
@@ -322,21 +218,10 @@ protected:
virtual void SAL_CALL acquire();
virtual void SAL_CALL release();
- // IEventProcessor
- virtual void processEvent( const ::comphelper::AnyEvent& _rEvent );
-
private:
- DECL_LINK( OnProcessEvent, void* );
+ DECL_LINK( OnProcessCallbacks, void* );
private:
- /** notifies an arbitrary event
- @param _rEvent
- the event to notify
- */
- void impl_notifyAnyEvent(
- const ::rtl::Reference< ::comphelper::AnyEvent >& _rEvent
- );
-
private:
/** determines whether the instance is already disposed
@precond
@@ -373,7 +258,7 @@ VCLXWindowImpl::VCLXWindowImpl( VCLXWindow& _rAntiImpl, ::vos::IMutex& _rMutex,
,maPaintListeners( _rAntiImpl )
,maContainerListeners( _rAntiImpl )
,maTopWindowListeners( _rAntiImpl )
- ,mnEventId( 0 )
+ ,mnCallbackEventId( 0 )
,mbDisposing( false )
,mbDesignMode( false )
,mbSynthesizingVCLEvent( false )
@@ -394,9 +279,10 @@ VCLXWindowImpl::~VCLXWindowImpl()
void VCLXWindowImpl::disposing()
{
::vos::OGuard aGuard( mrMutex );
- if ( mnEventId )
- Application::RemoveUserEvent( mnEventId );
- mnEventId = 0;
+ if ( mnCallbackEventId )
+ Application::RemoveUserEvent( mnCallbackEventId );
+ mnCallbackEventId = 0;
+
mbDisposed= true;
::com::sun::star::lang::EventObject aEvent;
@@ -415,54 +301,48 @@ void VCLXWindowImpl::disposing()
}
//--------------------------------------------------------------------
-void VCLXWindowImpl::impl_notifyAnyEvent( const ::rtl::Reference< ::comphelper::AnyEvent >& _rEvent )
+void VCLXWindowImpl::callBackAsync( const VCLXWindow::Callback& i_callback )
{
- maEvents.push_back( _rEvent );
- if ( !mnEventId )
- mnEventId = Application::PostUserEvent( LINK( this, VCLXWindowImpl, OnProcessEvent ) );
-}
-
-//--------------------------------------------------------------------
-void VCLXWindowImpl::notifyMouseEvent( const awt::MouseEvent& _rMouseEvent, MouseEventType _nType )
-{
- ::vos::OClearableGuard aGuard( mrMutex );
- if ( maMouseListeners.getLength() )
- impl_notifyAnyEvent( new AnyWindowEvent( _rMouseEvent, _nType ) );
+ DBG_TESTSOLARMUTEX();
+ maCallbackEvents.push_back( i_callback );
+ if ( !mnCallbackEventId )
+ {
+ // ensure our VCLXWindow is not destroyed while the event is underway
+ mrAntiImpl.acquire();
+ mnCallbackEventId = Application::PostUserEvent( LINK( this, VCLXWindowImpl, OnProcessCallbacks ) );
+ }
}
-//--------------------------------------------------------------------
-void VCLXWindowImpl::notifyPlainEvent( const lang::EventObject& _rPlainEvent, PlainEventType _nType )
+//----------------------------------------------------------------------------------------------------------------------
+IMPL_LINK( VCLXWindowImpl, OnProcessCallbacks, void*, EMPTYARG )
{
- ::vos::OClearableGuard aGuard( mrMutex );
- if ( maWindow2Listeners.getLength() )
- impl_notifyAnyEvent( new AnyWindowEvent( _rPlainEvent, _nType ) );
-}
+ const Reference< uno::XInterface > xKeepAlive( mrAntiImpl );
-//--------------------------------------------------------------------
-IMPL_LINK( VCLXWindowImpl, OnProcessEvent, void*, EMPTYARG )
-{
- // work on a copy of the events array
- EventArray aEventsCopy;
+ // work on a copy of the callback array
+ CallbackArray aCallbacksCopy;
{
::vos::OGuard aGuard( mrMutex );
- aEventsCopy = maEvents;
- maEvents.clear();
+ aCallbacksCopy = maCallbackEvents;
+ maCallbackEvents.clear();
- if ( !mnEventId )
+ // we acquired our VCLXWindow once before posting the event, release this one ref now
+ mrAntiImpl.release();
+
+ if ( !mnCallbackEventId )
// we were disposed while waiting for the mutex to lock
return 1L;
- mnEventId = 0;
+ mnCallbackEventId = 0;
}
{
::toolkit::ReleaseSolarMutex aReleaseSolar;
- for ( EventArray::const_iterator loop = aEventsCopy.begin();
- loop != aEventsCopy.end();
+ for ( CallbackArray::const_iterator loop = aCallbacksCopy.begin();
+ loop != aCallbacksCopy.end();
++loop
)
{
- processEvent( *(*loop) );
+ (*loop)();
}
}
@@ -470,59 +350,6 @@ IMPL_LINK( VCLXWindowImpl, OnProcessEvent, void*, EMPTYARG )
}
//--------------------------------------------------------------------
-void VCLXWindowImpl::processEvent( const ::comphelper::AnyEvent& _rEvent )
-{
- ::vos::OGuard aGuard( mrMutex );
- if ( impl_isDisposed() )
- // while we were waiting for our mutex, another thread disposed us
- return;
-
- const AnyWindowEvent& rEventDescriptor( static_cast< const AnyWindowEvent& >( _rEvent ) );
- if ( rEventDescriptor.isMouseEvent() )
- {
- const awt::MouseEvent& rEvent( rEventDescriptor.getMouseEvent() );
- switch ( rEventDescriptor.getMouseEventType() )
- {
- case EVENT_MOUSE_PRESSED:
- maMouseListeners.mousePressed( rEvent );
- break;
- case EVENT_MOUSE_RELEASED:
- maMouseListeners.mouseReleased( rEvent );
- break;
- case EVENT_MOUSE_ENTERED:
- maMouseListeners.mouseEntered( rEvent );
- break;
- case EVENT_MOUSE_EXITED:
- maMouseListeners.mouseExited( rEvent );
- break;
- default:
- DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (1)?" );
- break;
- }
- }
- else if ( rEventDescriptor.isPlainEvent() )
- {
- const lang::EventObject& rEvent( rEventDescriptor.getPlainEvent() );
- switch ( rEventDescriptor.getPlainEventType() )
- {
- case EVENT_WINDOW_ENABLED:
- maWindow2Listeners.notifyEach( &XWindowListener2::windowEnabled, rEvent );
- break;
- case EVENT_WINDOW_DISABLED:
- maWindow2Listeners.notifyEach( &XWindowListener2::windowDisabled, rEvent );
- break;
- default:
- DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (2)?" );
- break;
- }
- }
- else
- {
- DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (3)?" );
- }
-}
-
-//--------------------------------------------------------------------
void SAL_CALL VCLXWindowImpl::acquire()
{
mrAntiImpl.acquire();
@@ -581,6 +408,13 @@ VCLXWindow::~VCLXWindow()
}
}
+//----------------------------------------------------------------------------------------------------------------------
+void VCLXWindow::ImplExecuteAsyncWithoutSolarLock( const Callback& i_callback )
+{
+ mpImpl->callBackAsync( i_callback );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
::toolkit::IAccessibleFactory& VCLXWindow::getAccessibleFactory()
{
return mpImpl->getAccessibleFactory().getFactory();
@@ -641,6 +475,28 @@ IMPL_LINK( VCLXWindow, WindowEventListener, VclSimpleEvent*, pEvent )
return 0;
}
+namespace
+{
+ struct CallWindow2Listener
+ {
+ CallWindow2Listener( ::cppu::OInterfaceContainerHelper& i_rWindow2Listeners, const bool i_bEnabled, const EventObject& i_rEvent )
+ :m_rWindow2Listeners( i_rWindow2Listeners )
+ ,m_bEnabled( i_bEnabled )
+ ,m_aEvent( i_rEvent )
+ {
+ }
+
+ void operator()()
+ {
+ m_rWindow2Listeners.notifyEach( m_bEnabled ? &XWindowListener2::windowEnabled : &XWindowListener2::windowDisabled, m_aEvent );
+ }
+
+ ::cppu::OInterfaceContainerHelper& m_rWindow2Listeners;
+ const bool m_bEnabled;
+ const EventObject m_aEvent;
+ };
+}
+
void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
{
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xThis( (::cppu::OWeakObject*)this );
@@ -650,10 +506,12 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
case VCLEVENT_WINDOW_ENABLED:
case VCLEVENT_WINDOW_DISABLED:
{
- bool bEnabled = ( VCLEVENT_WINDOW_ENABLED == rVclWindowEvent.GetId() );
- EventObject aEvent( *this );
- mpImpl->notifyPlainEvent( aEvent,
- bEnabled ? EVENT_WINDOW_ENABLED : EVENT_WINDOW_DISABLED );
+ Callback aCallback = CallWindow2Listener(
+ mpImpl->getWindow2Listeners(),
+ ( VCLEVENT_WINDOW_ENABLED == rVclWindowEvent.GetId() ),
+ EventObject( *this )
+ );
+ ImplExecuteAsyncWithoutSolarLock( aCallback );
}
break;
@@ -884,7 +742,13 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
MouseEvent aMEvt( aWhere, 1, MOUSE_SIMPLECLICK, MOUSE_LEFT, 0 );
awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( aMEvt, *this ) );
aEvent.PopupTrigger = sal_True;
- mpImpl->notifyMouseEvent( aEvent, EVENT_MOUSE_PRESSED );
+
+ Callback aCallback = ::boost::bind(
+ &MouseListenerMultiplexer::mousePressed,
+ &mpImpl->getMouseListeners(),
+ aEvent
+ );
+ ImplExecuteAsyncWithoutSolarLock( aCallback );
}
}
break;
@@ -894,10 +758,13 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
if ( mpImpl->getMouseListeners().getLength() && ( pMouseEvt->IsEnterWindow() || pMouseEvt->IsLeaveWindow() ) )
{
awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *pMouseEvt, *this ) );
- mpImpl->notifyMouseEvent(
- aEvent,
- pMouseEvt->IsEnterWindow() ? EVENT_MOUSE_ENTERED : EVENT_MOUSE_EXITED
+
+ Callback aCallback = ::boost::bind(
+ pMouseEvt->IsEnterWindow() ? &MouseListenerMultiplexer::mouseEntered : &MouseListenerMultiplexer::mouseExited,
+ &mpImpl->getMouseListeners(),
+ aEvent
);
+ ImplExecuteAsyncWithoutSolarLock( aCallback );
}
if ( mpImpl->getMouseMotionListeners().getLength() && !pMouseEvt->IsEnterWindow() && !pMouseEvt->IsLeaveWindow() )
@@ -916,7 +783,12 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
if ( mpImpl->getMouseListeners().getLength() )
{
awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *(MouseEvent*)rVclWindowEvent.GetData(), *this ) );
- mpImpl->notifyMouseEvent( aEvent, EVENT_MOUSE_PRESSED );
+ Callback aCallback = ::boost::bind(
+ &MouseListenerMultiplexer::mousePressed,
+ &mpImpl->getMouseListeners(),
+ aEvent
+ );
+ ImplExecuteAsyncWithoutSolarLock( aCallback );
}
}
break;
@@ -925,7 +797,12 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
if ( mpImpl->getMouseListeners().getLength() )
{
awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *(MouseEvent*)rVclWindowEvent.GetData(), *this ) );
- mpImpl->notifyMouseEvent( aEvent, EVENT_MOUSE_RELEASED );
+ Callback aCallback = ::boost::bind(
+ &MouseListenerMultiplexer::mouseReleased,
+ &mpImpl->getMouseListeners(),
+ aEvent
+ );
+ ImplExecuteAsyncWithoutSolarLock( aCallback );
}
}
break;
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index e2fc78421d5e..26e84905ee01 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -29,7 +29,7 @@
#include "precompiled_toolkit.hxx"
#include <toolkit/awt/vclxwindows.hxx>
#include <com/sun/star/awt/ScrollBarOrientation.hpp>
-#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
#include <toolkit/helper/vclunohelper.hxx>
#include <toolkit/helper/macros.hxx>
#include <toolkit/helper/property.hxx>
@@ -43,6 +43,9 @@
#include <com/sun/star/system/XSystemShellExecute.hpp>
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
#include <com/sun/star/awt/ImageScaleMode.hpp>
+#include <com/sun/star/awt/XItemList.hpp>
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/processfactory.hxx>
#ifndef _SV_BUTTON_HXX
@@ -58,12 +61,20 @@
#include <vcl/scrbar.hxx>
#include <vcl/svapp.hxx>
#include <vcl/tabpage.hxx>
-#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+
+#include <boost/bind.hpp>
+#include <boost/function.hpp>
using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::makeAny;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::lang::EventObject;
+using ::com::sun::star::awt::ItemListEvent;
+using ::com::sun::star::awt::XItemList;
using ::com::sun::star::graphic::XGraphic;
+using ::com::sun::star::graphic::XGraphicProvider;
using namespace ::com::sun::star;
using namespace ::com::sun::star::awt::VisualEffect;
@@ -626,7 +637,13 @@ void VCLXButton::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
::com::sun::star::awt::ActionEvent aEvent;
aEvent.Source = (::cppu::OWeakObject*)this;
aEvent.ActionCommand = maActionCommand;
- maActionListeners.actionPerformed( aEvent );
+
+ Callback aCallback = ::boost::bind(
+ &ActionListenerMultiplexer::actionPerformed,
+ &maActionListeners,
+ aEvent
+ );
+ ImplExecuteAsyncWithoutSolarLock( aCallback );
}
}
break;
@@ -1529,6 +1546,8 @@ void VCLXListBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
BASEPROPERTY_HELPURL,
BASEPROPERTY_LINECOUNT,
BASEPROPERTY_MULTISELECTION,
+ BASEPROPERTY_MULTISELECTION_SIMPLEMODE,
+ BASEPROPERTY_ITEM_SEPARATOR_POS,
BASEPROPERTY_PRINTABLE,
BASEPROPERTY_SELECTEDITEMS,
BASEPROPERTY_STRINGITEMLIST,
@@ -1550,22 +1569,6 @@ VCLXListBox::VCLXListBox()
{
}
-// ::com::sun::star::uno::XInterface
-::com::sun::star::uno::Any VCLXListBox::queryInterface( 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::XListBox*, this ),
- SAL_STATIC_CAST( ::com::sun::star::awt::XTextLayoutConstrains*, this ) );
- return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
-}
-
-// ::com::sun::star::lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( VCLXListBox )
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XListBox>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains>* ) NULL ),
- VCLXWindow::getTypes()
-IMPL_XTYPEPROVIDER_END
-
void VCLXListBox::dispose() throw(::com::sun::star::uno::RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
@@ -1914,6 +1917,13 @@ void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com:
sal_uInt16 nPropType = GetPropertyId( PropertyName );
switch ( nPropType )
{
+ case BASEPROPERTY_ITEM_SEPARATOR_POS:
+ {
+ sal_Int16 nSeparatorPos(0);
+ if ( Value >>= nSeparatorPos )
+ pListBox->SetSeparatorPos( nSeparatorPos );
+ }
+ break;
case BASEPROPERTY_READONLY:
{
sal_Bool b = sal_Bool();
@@ -1928,6 +1938,9 @@ void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com:
pListBox->EnableMultiSelection( b );
}
break;
+ case BASEPROPERTY_MULTISELECTION_SIMPLEMODE:
+ ::toolkit::adjustBooleanWindowStyle( Value, pListBox, WB_SIMPLEMODE, sal_False );
+ break;
case BASEPROPERTY_LINECOUNT:
{
sal_Int16 n = sal_Int16();
@@ -1982,6 +1995,9 @@ void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com:
sal_uInt16 nPropType = GetPropertyId( PropertyName );
switch ( nPropType )
{
+ case BASEPROPERTY_ITEM_SEPARATOR_POS:
+ aProp <<= sal_Int16( pListBox->GetSeparatorPos() );
+ break;
case BASEPROPERTY_READONLY:
{
aProp <<= (sal_Bool) pListBox->IsReadOnly();
@@ -1992,6 +2008,11 @@ void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com:
aProp <<= (sal_Bool) pListBox->IsMultiSelectionEnabled();
}
break;
+ case BASEPROPERTY_MULTISELECTION_SIMPLEMODE:
+ {
+ aProp <<= (sal_Bool)( ( pListBox->GetStyle() & WB_SIMPLEMODE ) == 0 );
+ }
+ break;
case BASEPROPERTY_LINECOUNT:
{
aProp <<= (sal_Int16) pListBox->GetDropDownLineCount();
@@ -2096,6 +2117,114 @@ void VCLXListBox::ImplCallItemListeners()
}
}
+namespace
+{
+ Image lcl_getImageFromURL( const ::rtl::OUString& i_rImageURL )
+ {
+ if ( !i_rImageURL.getLength() )
+ return Image();
+
+ try
+ {
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ Reference< XGraphicProvider > xProvider;
+ if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
+ {
+ ::comphelper::NamedValueCollection aMediaProperties;
+ aMediaProperties.put( "URL", i_rImageURL );
+ Reference< XGraphic > xGraphic = xProvider->queryGraphic( aMediaProperties.getPropertyValues() );
+ return Image( xGraphic );
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return Image();
+ }
+}
+
+void SAL_CALL VCLXListBox::listItemInserted( const ItemListEvent& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
+
+ ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemInserted: no ListBox?!" );
+ ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition <= sal_Int32( pListBox->GetEntryCount() ) ),
+ "VCLXListBox::listItemInserted: illegal (inconsistent) item position!" );
+ pListBox->InsertEntry(
+ i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString(),
+ i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : Image(),
+ i_rEvent.ItemPosition );
+}
+
+void SAL_CALL VCLXListBox::listItemRemoved( const ItemListEvent& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
+
+ ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemRemoved: no ListBox?!" );
+ ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pListBox->GetEntryCount() ) ),
+ "VCLXListBox::listItemRemoved: illegal (inconsistent) item position!" );
+
+ pListBox->RemoveEntry( i_rEvent.ItemPosition );
+}
+
+void SAL_CALL VCLXListBox::listItemModified( const ItemListEvent& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
+
+ ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" );
+ ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pListBox->GetEntryCount() ) ),
+ "VCLXListBox::listItemModified: illegal (inconsistent) item position!" );
+
+ // VCL's ListBox does not support changing an entry's text or image, so remove and re-insert
+
+ const ::rtl::OUString sNewText = i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString( pListBox->GetEntry( i_rEvent.ItemPosition ) );
+ const Image aNewImage( i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : pListBox->GetEntryImage( i_rEvent.ItemPosition ) );
+
+ pListBox->RemoveEntry( i_rEvent.ItemPosition );
+ pListBox->InsertEntry( sNewText, aNewImage, i_rEvent.ItemPosition );
+}
+
+void SAL_CALL VCLXListBox::allItemsRemoved( const EventObject& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
+ ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" );
+
+ pListBox->Clear();
+
+ (void)i_rEvent;
+}
+
+void SAL_CALL VCLXListBox::itemListChanged( const EventObject& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
+ ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" );
+
+ pListBox->Clear();
+
+ Reference< XItemList > xItemList( i_rEvent.Source, uno::UNO_QUERY_THROW );
+ uno::Sequence< beans::Pair< ::rtl::OUString, ::rtl::OUString > > aItems = xItemList->getAllItems();
+ for ( sal_Int32 i=0; i<aItems.getLength(); ++i )
+ {
+ pListBox->InsertEntry( aItems[i].First, lcl_getImageFromURL( aItems[i].Second ) );
+ }
+}
+
+void SAL_CALL VCLXListBox::disposing( const EventObject& i_rEvent ) throw (RuntimeException)
+{
+ // just disambiguate
+ VCLXWindow::disposing( i_rEvent );
+}
// ----------------------------------------------------
// class VCLXMessageBox
@@ -2205,16 +2334,36 @@ VCLXDialog::~VCLXDialog()
::com::sun::star::uno::Any VCLXDialog::queryInterface( 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::XDialog2*, this ),
SAL_STATIC_CAST( ::com::sun::star::awt::XDialog*, this ) );
return (aRet.hasValue() ? aRet : VCLXTopWindow::queryInterface( rType ));
}
// ::com::sun::star::lang::XTypeProvider
IMPL_XTYPEPROVIDER_START( VCLXDialog )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog2>* ) NULL ),
getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog>* ) NULL ),
VCLXTopWindow::getTypes()
IMPL_XTYPEPROVIDER_END
+void SAL_CALL VCLXDialog::endDialog( ::sal_Int32 i_result ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Dialog* pDialog = dynamic_cast< Dialog* >( GetWindow() );
+ if ( pDialog )
+ pDialog->EndDialog( i_result );
+}
+
+void SAL_CALL VCLXDialog::setHelpId( ::sal_Int32 i_id ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ pWindow->SetHelpId( i_id );
+}
+
void VCLXDialog::setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
@@ -2261,11 +2410,7 @@ sal_Int16 VCLXDialog::execute() throw(::com::sun::star::uno::RuntimeException)
void VCLXDialog::endExecute() throw(::com::sun::star::uno::RuntimeException)
{
- ::vos::OGuard aGuard( GetMutex() );
-
- Dialog* pDlg = (Dialog*) GetWindow();
- if ( pDlg )
- pDlg->EndDialog( 0 );
+ endDialog(0);
}
void SAL_CALL VCLXDialog::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException)
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
index db9634fb44a1..405356c2b7ac 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -43,6 +43,9 @@
#include "toolkit/controls/tkscrollbar.hxx"
#endif
#include <toolkit/controls/stdtabcontroller.hxx>
+#include <toolkit/controls/tksimpleanimation.hxx>
+#include <toolkit/controls/tkthrobber.hxx>
+
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/awt/WindowAttribute.hpp>
#include <com/sun/star/resource/XStringResourceResolver.hpp>
@@ -453,6 +456,10 @@ Reference< XInterface > UnoControlDialogModel::createInstance( const ::rtl::OUSt
pNewModel = new OGeometryControlModel< UnoTreeModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName_GridControlModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoGridModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoSimpleAnimationControlModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoSimpleAnimationControlModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoThrobberControlModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoThrobberControlModel >;
if ( !pNewModel )
{
@@ -492,7 +499,7 @@ Sequence< ::rtl::OUString > UnoControlDialogModel::getAvailableServiceNames() th
static Sequence< ::rtl::OUString >* pNamesSeq = NULL;
if ( !pNamesSeq )
{
- pNamesSeq = new Sequence< ::rtl::OUString >( 21 );
+ pNamesSeq = new Sequence< ::rtl::OUString >( 24 );
::rtl::OUString* pNames = pNamesSeq->getArray();
pNames[0] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEditModel );
pNames[1] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedFieldModel );
@@ -515,8 +522,9 @@ Sequence< ::rtl::OUString > UnoControlDialogModel::getAvailableServiceNames() th
pNames[18] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedLineModel );
pNames[19] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRoadmapModel );
pNames[20] = ::rtl::OUString::createFromAscii( szServiceName_TreeControlModel );
- pNames[20] = ::rtl::OUString::createFromAscii( szServiceName_GridControlModel );
-
+ pNames[21] = ::rtl::OUString::createFromAscii( szServiceName_GridControlModel );
+ pNames[22] = ::rtl::OUString::createFromAscii( szServiceName2_UnoSimpleAnimationControlModel );
+ pNames[23] = ::rtl::OUString::createFromAscii( szServiceName2_UnoThrobberControlModel );
}
return *pNamesSeq;
}
@@ -1975,6 +1983,20 @@ void UnoDialogControl::ImplUpdateResourceResolver()
}
}
+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( ::sal_Int32 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() );
@@ -2081,24 +2103,24 @@ throw (RuntimeException)
::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl )
{
-
-
- ::rtl::OUString ret;
-
::rtl::OUString baseLocation;
::rtl::OUString url;
rbase >>= baseLocation;
rUrl >>= url;
+ ::rtl::OUString absoluteURL( url );
if ( url.getLength() > 0 )
{
INetURLObject urlObj(baseLocation);
urlObj.removeSegment();
baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE );
- ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, ret );
+
+ ::rtl::OUString testAbsoluteURL;
+ if ( ::osl::FileBase::E_None == ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, testAbsoluteURL ) )
+ absoluteURL = testAbsoluteURL;
}
- return ret;
+ return absoluteURL;
}
diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
index fdf91d6a6593..011f3502cdd8 100644
--- a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
+++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
@@ -30,6 +30,7 @@
#include "defaultgridcolumnmodel.hxx"
#include <comphelper/sequence.hxx>
#include <toolkit/helper/servicenames.hxx>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
#include <rtl/ref.hxx>
using ::rtl::OUString;
@@ -38,8 +39,7 @@ 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 COLUMNSELECTIONALLOWED ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ColumnSelectionAllowed" ))
+using namespace ::com::sun::star::style;
namespace toolkit
{
@@ -48,8 +48,10 @@ namespace toolkit
// class DefaultGridColumnModel
///////////////////////////////////////////////////////////////////////
-DefaultGridColumnModel::DefaultGridColumnModel()
+DefaultGridColumnModel::DefaultGridColumnModel(const Reference< XMultiServiceFactory >& xFactory)
: columns(std::vector< Reference< XGridColumn > >())
+ ,m_nColumnHeaderHeight(0)
+ ,m_xFactory(xFactory)
{
}
@@ -61,71 +63,6 @@ DefaultGridColumnModel::~DefaultGridColumnModel()
//---------------------------------------------------------------------
-void DefaultGridColumnModel::broadcast( broadcast_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_added: pListener->columnAdded(aEvent); break;
- case column_removed: pListener->columnRemoved(aEvent); break;
- case column_changed: pListener->columnChanged(aEvent); break;
- }
- }
- }
-}
-
-//---------------------------------------------------------------------
-
-void DefaultGridColumnModel::broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue )
-{
- Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- GridColumnEvent aEvent( xSource, name, oldValue, newValue, 0, NULL );
- broadcast( column_changed, aEvent);
-}
-
-//---------------------------------------------------------------------
-
-void DefaultGridColumnModel::broadcast_add( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn )
-{
- Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- GridColumnEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, rColumn );
- broadcast( column_added, aEvent);
-}
-
-//---------------------------------------------------------------------
-
-void DefaultGridColumnModel::broadcast_remove( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn )
-{
- Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- GridColumnEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, rColumn );
- broadcast( column_changed, aEvent);
-}
-
-//---------------------------------------------------------------------
-// XDefaultGridColumnModel
-//---------------------------------------------------------------------
-::sal_Bool SAL_CALL DefaultGridColumnModel::getColumnSelectionAllowed() throw (::com::sun::star::uno::RuntimeException)
-{
- return selectionAllowed;
-}
-
-//---------------------------------------------------------------------
-
-void SAL_CALL DefaultGridColumnModel::setColumnSelectionAllowed(::sal_Bool value) throw (::com::sun::star::uno::RuntimeException)
-{
- sal_Bool oldValue = selectionAllowed;
- selectionAllowed = value;
- broadcast_changed( COLUMNSELECTIONALLOWED, Any(oldValue) , Any(selectionAllowed));
-}
-
-//---------------------------------------------------------------------
-
::sal_Int32 SAL_CALL DefaultGridColumnModel::getColumnCount() throw (::com::sun::star::uno::RuntimeException)
{
return columns.size();
@@ -136,11 +73,10 @@ void SAL_CALL DefaultGridColumnModel::setColumnSelectionAllowed(::sal_Bool value
::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() );
-
- columns.push_back(column);
-
+ Reference<XGridColumn> xColumn(column);
+ columns.push_back(xColumn);
sal_Int32 index = columns.size() - 1;
- broadcast_add(index, column );
+ xColumn->setIndex(index);
return index;
}
@@ -156,23 +92,48 @@ void SAL_CALL DefaultGridColumnModel::setColumnSelectionAllowed(::sal_Bool value
::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()))
+ {
return columns[index];
+ }
else
return Reference< XGridColumn >();
}
-
-void SAL_CALL DefaultGridColumnModel::addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException)
+//---------------------------------------------------------------------
+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)
{
- BrdcstHelper.addListener( XGridColumnListener::static_type(), xListener );
+ return m_nColumnHeaderHeight;
}
//---------------------------------------------------------------------
+void SAL_CALL DefaultGridColumnModel::setDefaultColumns(sal_Int32 rowElements) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-void SAL_CALL DefaultGridColumnModel::removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException)
+ for(sal_Int32 i=0;i<rowElements;i++)
+ {
+ Reference<XGridColumn> xColumn( m_xFactory->createInstance ( OUString::createFromAscii( "com.sun.star.awt.grid.GridColumn" ) ), UNO_QUERY );
+ columns.push_back(xColumn);
+ xColumn->setIndex(i);
+ }
+}
+::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)
{
- BrdcstHelper.removeListener( XGridColumnListener::static_type(), xListener );
+ 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
//---------------------------------------------------------------------
@@ -232,8 +193,8 @@ sal_Bool SAL_CALL DefaultGridColumnModel::supportsService( const ::rtl::OUString
}
-Reference< XInterface > SAL_CALL DefaultGridColumnModel_CreateInstance( const Reference< XMultiServiceFactory >& )
+Reference< XInterface > SAL_CALL DefaultGridColumnModel_CreateInstance( const Reference< XMultiServiceFactory >& _rFactory)
{
- return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridColumnModel );
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridColumnModel( _rFactory ) );
}
diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx
index 896427ce3e2b..8b8c8bfc795c 100644
--- a/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx
+++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx
@@ -29,7 +29,7 @@
#include "precompiled_toolkit.hxx"
#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/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>
@@ -38,6 +38,9 @@
#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>
using ::rtl::OUString;
using namespace ::com::sun::star;
@@ -49,45 +52,49 @@ using namespace ::com::sun::star::lang;
namespace toolkit
{
-enum broadcast_type { column_added, column_removed, column_changed};
+//enum broadcast_type { column_added, column_removed, column_changed};
class DefaultGridColumnModel : public ::cppu::WeakImplHelper2< XGridColumnModel, XServiceInfo >,
public MutexAndBroadcastHelper
{
public:
- DefaultGridColumnModel();
+ DefaultGridColumnModel(const Reference< XMultiServiceFactory >& xFactory);
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_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::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 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 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 (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);
private:
- void broadcast( broadcast_type eType, const GridColumnEvent& aEvent );
- void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue );
+ /*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 );
+ void broadcast_remove( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn );*/
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;
};
}
diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.cxx b/toolkit/source/controls/grid/defaultgriddatamodel.cxx
index 70c79e0bcbfa..7ffafdf0ddb6 100644
--- a/toolkit/source/controls/grid/defaultgriddatamodel.cxx
+++ b/toolkit/source/controls/grid/defaultgriddatamodel.cxx
@@ -41,6 +41,9 @@ 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" ))
namespace toolkit
{
@@ -51,7 +54,8 @@ namespace toolkit
DefaultGridDataModel::DefaultGridDataModel()
: rowHeight(0),
- rowHeaders(std::vector< ::rtl::OUString >())
+ rowHeaders(std::vector< ::rtl::OUString >()),
+ m_nRowHeaderWidth(10)
{
}
@@ -61,7 +65,7 @@ DefaultGridDataModel::~DefaultGridDataModel()
{
}
-void DefaultGridDataModel::broadcast( broadcast_type eType, const GridDataEvent& aEvent )
+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 )
@@ -82,25 +86,27 @@ void DefaultGridDataModel::broadcast( broadcast_type eType, const GridDataEvent&
//---------------------------------------------------------------------
-void DefaultGridDataModel::broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue )
+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, 0, ::rtl::OUString(), Sequence< ::rtl::OUString>() );
+ GridDataEvent aEvent( xSource, name, oldValue, newValue, index, ::rtl::OUString(), Sequence< Any >());
broadcast( data_changed, aEvent);
}
//---------------------------------------------------------------------
-void DefaultGridDataModel::broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData )
+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, rowData );
+ GridDataEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, headerName, (const ::com::sun::star::uno::Sequence< Any >&)rowData );
broadcast( row_added, aEvent);
}
//---------------------------------------------------------------------
-void DefaultGridDataModel::broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData )
+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 );
@@ -124,7 +130,7 @@ void SAL_CALL DefaultGridDataModel::setRowHeight(::sal_Int32 value) throw (::com
sal_Int32 oldValue = rowHeight;
rowHeight = value;
- broadcast_changed( ROWHEIGHT, Any(oldValue), Any(value) );
+ broadcast_changed( ROWHEIGHT, 0, Any(oldValue), Any(value));
}
//---------------------------------------------------------------------
@@ -160,24 +166,26 @@ void SAL_CALL DefaultGridDataModel::setRowHeaders(const ::com::sun::star::uno::S
i++;
}
- broadcast_changed( ROWHEADERS, Any(oldValue), Any(comphelper::containerToSequence(rowHeaders)) );
+ broadcast_changed( ROWHEADERS, 0, Any(oldValue), Any(comphelper::containerToSequence(rowHeaders)) );
}
//---------------------------------------------------------------------
-void SAL_CALL DefaultGridDataModel::addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rRowdata) throw (::com::sun::star::uno::RuntimeException)
+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);
-
// store row data
- std::vector< rtl::OUString > newRow(
- comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rRowdata));
+ std::vector< Any > newRow;
+ for ( int i = 0; i < rRowdata.getLength();i++)
+ {
+ newRow.push_back(rRowdata[i]);
+ }
data.push_back( newRow );
- broadcast_add( data.size()-1, headername, rRowdata);
+ broadcast_add( data.size()-1, headername, comphelper::containerToSequence(newRow));
}
@@ -187,16 +195,10 @@ void SAL_CALL DefaultGridDataModel::removeRow(::sal_Int32 index) throw (::com::s
{
if ( index >= 0 && index <= getRowCount()-1)
{
- /* if(Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->isSelectedIndex( index ))
- {
- ::com::sun::star::uno::Sequence<::sal_Int32> selectedRows = Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getSelection();
- selectedRow.erase(selectedRows.begin()+index);
- }*/
-
::rtl::OUString headerName( (::rtl::OUString) rowHeaders[index] );
rowHeaders.erase(rowHeaders.begin() + index);
- Sequence< ::rtl::OUString >& rowData ( (Sequence< ::rtl::OUString >&)data[index] );
+ Sequence< Any >& rowData ( (Sequence< Any >&)data[index] );
data.erase(data.begin() + index);
broadcast_remove( index, headerName, rowData);
}
@@ -204,19 +206,19 @@ void SAL_CALL DefaultGridDataModel::removeRow(::sal_Int32 index) throw (::com::s
return;
}
//---------------------------------------------------------------------
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL DefaultGridDataModel::getData() throw (::com::sun::star::uno::RuntimeException)
+::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< ::rtl::OUString > >::iterator iterator;
- std::vector< Sequence< ::rtl::OUString > > dummyContainer(0);
+ std::vector< std::vector< Any > >::iterator iterator;
+ std::vector< Sequence< Any > > dummyContainer(0);
for(iterator = data.begin(); iterator != data.end(); iterator++)
{
- Sequence< ::rtl::OUString > cols(comphelper::containerToSequence(*iterator));
+ Sequence< Any > cols(comphelper::containerToSequence(*iterator));
dummyContainer.push_back( cols );
}
- Sequence< Sequence< ::rtl::OUString > > dataSequence(comphelper::containerToSequence(dummyContainer));
+ Sequence< Sequence< Any > > dataSequence(comphelper::containerToSequence(dummyContainer));
return dataSequence;
}
@@ -234,14 +236,52 @@ void SAL_CALL DefaultGridDataModel::removeDataListener( const Reference< XGridDa
{
BrdcstHelper.removeListener( XGridDataListener::static_type(), xListener );
}
-
+//---------------------------------------------------------------------
void SAL_CALL DefaultGridDataModel::removeAll() throw (RuntimeException)
{
rowHeaders.clear();
data.clear();
broadcast_remove( -1, ::rtl::OUString(), 0);
}
-
+//---------------------------------------------------------------------
+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())
+ {
+ data[row][column] = value;
+ Sequence< Any >dataSeq(comphelper::containerToSequence(data[row]));
+ broadcast_changed( CELLUPDATED, row, Any(column), value );
+ }
+ }
+}
+//---------------------------------------------------------------------
+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())
+ {
+ 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) );
+ }
+ }
+}
//---------------------------------------------------------------------
// XComponent
//---------------------------------------------------------------------
@@ -302,6 +342,5 @@ sal_Bool SAL_CALL DefaultGridDataModel::supportsService( const ::rtl::OUString&
Reference< XInterface > SAL_CALL DefaultGridDataModel_CreateInstance( const Reference< XMultiServiceFactory >& )
{
- return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridDataModel );
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridDataModel() );
}
-
diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.hxx b/toolkit/source/controls/grid/defaultgriddatamodel.hxx
index 1aebc07bc2a8..ea11a8a9a00a 100644
--- a/toolkit/source/controls/grid/defaultgriddatamodel.hxx
+++ b/toolkit/source/controls/grid/defaultgriddatamodel.hxx
@@ -30,6 +30,7 @@
#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/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
@@ -64,13 +65,16 @@ public:
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< ::rtl::OUString > > SAL_CALL getData() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & data) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeRow(::sal_Int32 index) 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);
@@ -83,14 +87,15 @@ public:
private:
- void broadcast( broadcast_type eType, const GridDataEvent& aEvent );
- void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue );
- void broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData );
- void broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData );
+ 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);
sal_Int32 rowHeight;
- std::vector< std::vector < ::rtl::OUString > > data;
+ std::vector< std::vector < Any > > data;
std::vector< ::rtl::OUString > rowHeaders;
+ sal_Int32 m_nRowHeaderWidth;
};
}
diff --git a/toolkit/source/controls/grid/gridcolumn.cxx b/toolkit/source/controls/grid/gridcolumn.cxx
index 39c4960351d3..6720d639f5c1 100644
--- a/toolkit/source/controls/grid/gridcolumn.cxx
+++ b/toolkit/source/controls/grid/gridcolumn.cxx
@@ -38,6 +38,16 @@ 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
{
@@ -48,6 +58,13 @@ namespace toolkit
GridColumn::GridColumn()
: identifier(Any())
+,index(0)
+,columnWidth(4)
+,preferredWidth(0)
+,maxWidth(0)
+,minWidth(0)
+,bResizeable(true)
+,horizontalAlign(HorizontalAlignment(0))
{
}
@@ -59,6 +76,39 @@ 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;
+ }
+ }
+ }
+}
+
+//---------------------------------------------------------------------
+
+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
//---------------------------------------------------------------------
@@ -79,6 +129,7 @@ void SAL_CALL GridColumn::setIdentifier(const ::com::sun::star::uno::Any & value
::sal_Int32 SAL_CALL GridColumn::getColumnWidth() throw (::com::sun::star::uno::RuntimeException)
{
+ broadcast_changed(UPDATE, Any(columnWidth), Any());
return columnWidth;
}
@@ -87,6 +138,50 @@ void SAL_CALL GridColumn::setIdentifier(const ::com::sun::star::uno::Any & value
void SAL_CALL GridColumn::setColumnWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
{
columnWidth = value;
+ broadcast_changed(COLWIDTH, Any(columnWidth),Any(value));
+}
+//--------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL GridColumn::getPreferredWidth() throw (::com::sun::star::uno::RuntimeException)
+{
+ broadcast_changed(UPDATE, Any(preferredWidth), Any());
+ return preferredWidth;
+}
+
+//--------------------------------------------------------------------
+
+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::getMaxWidth() throw (::com::sun::star::uno::RuntimeException)
+{
+ return maxWidth;
+}
+
+//--------------------------------------------------------------------
+
+void SAL_CALL GridColumn::setMaxWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
+{
+ maxWidth = value;
+ broadcast_changed(MAXWIDTH, Any(maxWidth),Any(value));
+}
+//--------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL GridColumn::getMinWidth() throw (::com::sun::star::uno::RuntimeException)
+{
+ return minWidth;
+}
+
+//--------------------------------------------------------------------
+
+void SAL_CALL GridColumn::setMinWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
+{
+ minWidth = value;
+ broadcast_changed(MINWIDTH, Any(minWidth),Any(value));
}
//--------------------------------------------------------------------
@@ -101,6 +196,45 @@ void SAL_CALL GridColumn::setColumnWidth(::sal_Int32 value) throw (::com::sun::s
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)
+{
+ return bResizeable;
+}
+
+//--------------------------------------------------------------------
+
+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::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 );
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL GridColumn::removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.removeListener( XGridColumnListener::static_type(), xListener );
}
//---------------------------------------------------------------------
@@ -109,22 +243,30 @@ void SAL_CALL GridColumn::setTitle(const ::rtl::OUString & value) throw (::com::
void SAL_CALL GridColumn::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 );
}
//---------------------------------------------------------------------
void SAL_CALL GridColumn::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
{
- (void) xListener;
+ BrdcstHelper.addListener( XEventListener::static_type(), xListener );
}
//---------------------------------------------------------------------
void SAL_CALL GridColumn::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
{
- (void) xListener;
+ BrdcstHelper.removeListener( XEventListener::static_type(), xListener );
+}
+void SAL_CALL GridColumn::setIndex(sal_Int32 _nIndex) throw (::com::sun::star::uno::RuntimeException)
+{
+ index = _nIndex;
}
-
//---------------------------------------------------------------------
// XServiceInfo
//---------------------------------------------------------------------
diff --git a/toolkit/source/controls/grid/gridcolumn.hxx b/toolkit/source/controls/grid/gridcolumn.hxx
index 7f6d104127ec..38d43d55a07b 100644
--- a/toolkit/source/controls/grid/gridcolumn.hxx
+++ b/toolkit/source/controls/grid/gridcolumn.hxx
@@ -28,6 +28,8 @@
// 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>
@@ -36,6 +38,7 @@
#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;
@@ -47,6 +50,7 @@ using namespace ::com::sun::star::lang;
namespace toolkit
{
+enum broadcast_column_type { column_attribute_changed};
class GridColumn : public ::cppu::WeakImplHelper2< XGridColumn, XServiceInfo >,
public MutexAndBroadcastHelper
{
@@ -59,9 +63,21 @@ public:
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 ::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 ::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);
@@ -72,11 +88,20 @@ public:
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 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;
};
}
diff --git a/toolkit/source/controls/grid/gridcontrol.cxx b/toolkit/source/controls/grid/gridcontrol.cxx
index f19648ab0af2..5125c1349ade 100644
--- a/toolkit/source/controls/grid/gridcontrol.cxx
+++ b/toolkit/source/controls/grid/gridcontrol.cxx
@@ -33,6 +33,7 @@
#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/XGridColumnModel.hpp>
#include <com/sun/star/awt/grid/ScrollBarMode.hpp>
#include <toolkit/helper/unopropertyarrayhelper.hxx>
#include <toolkit/helper/property.hxx>
@@ -68,12 +69,21 @@ UnoGridModel::UnoGridModel()
ImplRegisterProperty( BASEPROPERTY_SIZEABLE ); // resizeable
ImplRegisterProperty( BASEPROPERTY_HSCROLL );
ImplRegisterProperty( BASEPROPERTY_VSCROLL );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
ImplRegisterProperty( BASEPROPERTY_GRID_SHOWROWHEADER );
ImplRegisterProperty( BASEPROPERTY_GRID_SHOWCOLUMNHEADER );
ImplRegisterProperty( BASEPROPERTY_GRID_DATAMODEL );
ImplRegisterProperty( BASEPROPERTY_GRID_COLUMNMODEL );
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_GRID_LINE_COLOR );
+ ImplRegisterProperty( BASEPROPERTY_GRID_ROW_BACKGROUND );
}
UnoGridModel::UnoGridModel( const UnoGridModel& rModel )
@@ -99,6 +109,22 @@ Any UnoGridModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_GridControl ) );
case BASEPROPERTY_GRID_SELECTIONMODE:
return uno::makeAny( SelectionType(1) );
+ case BASEPROPERTY_GRID_SHOWROWHEADER:
+ return uno::makeAny( (sal_Bool)sal_False );
+ 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) );
+ case BASEPROPERTY_GRID_HEADER_BACKGROUND:
+ return uno::makeAny( com::sun::star::util::Color(0xFFFFFF) );
+ 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) );
default:
return UnoControlModel::ImplGetDefaultValue( nPropId );
}
@@ -128,7 +154,8 @@ Reference< XPropertySetInfo > UnoGridModel::getPropertySetInfo( ) throw(Runtime
// class UnoGridControl
// ----------------------------------------------------
UnoGridControl::UnoGridControl()
-: mSelectionMode(SelectionType(1))
+: mSelectionMode(SelectionType(1)),
+ m_aSelectionListeners( *this )
{
}
@@ -139,6 +166,9 @@ OUString UnoGridControl::GetComponentServiceName()
void SAL_CALL UnoGridControl::dispose( ) throw(RuntimeException)
{
+ lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ m_aSelectionListeners.disposeAndClear( aEvt );
UnoControl::dispose();
}
@@ -147,63 +177,39 @@ void UnoGridControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolk
UnoControlBase::createPeer( rxToolkit, rParentPeer );
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 );
- xGridDataModel->addDataListener(xListener);
+ if(xGridDataModel != NULL)
+ xGridDataModel->addDataListener(xListener);
+ Reference<XGridColumnModel> xGridColumnModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "ColumnModel" )), UNO_QUERY_THROW );
+ if(xGridColumnModel != NULL)
+ {
+ for(int i = 0;i<xGridColumnModel->getColumnCount();i++)
+ {
+ xGridColumnModel->getColumn(i)->addColumnListener(xColListener);
+ }
+ }
}
// -------------------------------------------------------------------
// XGridControl
-// -------------------------------------------------------------------
-
-::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL UnoGridControl::getColumnModel() throw (::com::sun::star::uno::RuntimeException)
-{
- Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
- Reference<XGridColumnModel> xGridColumnModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "ColumnModel" )), UNO_QUERY_THROW );
-
- return xGridColumnModel;
-}
-
-void SAL_CALL UnoGridControl::setColumnModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > & model) throw (::com::sun::star::uno::RuntimeException)
-{
- Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
- xPropSet->setPropertyValue(OUString::createFromAscii( "ColumnModel" ), Any (model));
-}
-
-::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL UnoGridControl::getDataModel() throw (::com::sun::star::uno::RuntimeException)
-{
- Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
- Reference<XGridDataModel> xGridDataModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "GridDataModel" )), UNO_QUERY_THROW );
-
- return xGridDataModel;
-}
-
-void SAL_CALL UnoGridControl::setDataModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > & model) throw (::com::sun::star::uno::RuntimeException)
-{
- Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
- xPropSet->setPropertyValue(OUString::createFromAscii( "GridDataModel" ), Any(model));
-}
::sal_Int32 UnoGridControl::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
{
- return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getItemIndexAtPoint( x, y );
+ Reference< XGridControl > xGrid ( getPeer(), UNO_QUERY_THROW );
+ return xGrid->getItemIndexAtPoint( x, y );
}
-/*
-void SAL_CALL UnoGridControl::addMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException)
+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)
{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->addMouseListener( listener );
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->setToolTip( text, columns );
}
-
-void SAL_CALL UnoGridControl::removeMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException)
-{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->removeMouseListener( listener );
-}
-*/
// -------------------------------------------------------------------
// XGridSelection
// -------------------------------------------------------------------
@@ -218,16 +224,24 @@ void SAL_CALL UnoGridControl::removeMouseListener(const ::com::sun::star::uno::R
return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getMaxSelectionIndex();
}
-void SAL_CALL UnoGridControl::insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL UnoGridControl::selectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException)
{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->insertIndexIntervall( start, length);
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectRows( rangeOfRows);
}
-void SAL_CALL UnoGridControl::removeIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException)
+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)
{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->removeIndexIntervall( start, length );
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->deselectRows( rangeOfRows);
}
+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();
@@ -250,14 +264,14 @@ void SAL_CALL UnoGridControl::selectRow(::sal_Int32 y) throw (::com::sun::star::
void SAL_CALL UnoGridControl::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->addSelectionListener( listener );
+ 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)
{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->removeSelectionListener( listener );
-}
+ m_aSelectionListeners.removeInterface( listener );
}
+}//namespace toolkit
Reference< XInterface > SAL_CALL GridControl_CreateInstance( const Reference< XMultiServiceFactory >& )
{
diff --git a/toolkit/source/controls/grid/gridcontrol.hxx b/toolkit/source/controls/grid/gridcontrol.hxx
index 4195a1f624e5..0c8ddb1c02b6 100644
--- a/toolkit/source/controls/grid/gridcontrol.hxx
+++ b/toolkit/source/controls/grid/gridcontrol.hxx
@@ -30,10 +30,11 @@
#include <com/sun/star/awt/grid/XGridControl.hpp>
#include <com/sun/star/view/SelectionType.hpp>
-#include <toolkit/controls/unocontrols.hxx>
+#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>
@@ -87,20 +88,18 @@ public:
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);
// ::com::sun::star::awt::grid::XGridControl
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL getColumnModel() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setColumnModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > & model) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL getDataModel() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setDataModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > & model) 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 addMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException);
- //virtual void SAL_CALL removeMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) 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);
// ::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 insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeIndexIntervall(::sal_Int32 start, ::sal_Int32 length) 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 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 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);
@@ -114,6 +113,7 @@ public:
using UnoControl::getPeer;
private:
::com::sun::star::view::SelectionType mSelectionMode;
+ SelectionListenerMultiplexer m_aSelectionListeners;
};
} // toolkit
diff --git a/toolkit/source/controls/tksimpleanimation.cxx b/toolkit/source/controls/tksimpleanimation.cxx
index 9c32ba500407..3d89bf59af82 100644
--- a/toolkit/source/controls/tksimpleanimation.cxx
+++ b/toolkit/source/controls/tksimpleanimation.cxx
@@ -109,8 +109,9 @@ namespace toolkit
throw( uno::RuntimeException )
{
uno::Sequence< ::rtl::OUString > aServices( UnoControlModel::getSupportedServiceNames() );
- aServices.realloc( aServices.getLength() + 1 );
- aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoSimpleAnimationControlModel );
+ aServices.realloc( aServices.getLength() + 2 );
+ aServices[ aServices.getLength() - 2 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoSimpleAnimationControlModel );
+ aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName2_UnoSimpleAnimationControlModel );
return aServices;
}
diff --git a/toolkit/source/controls/tkthrobber.cxx b/toolkit/source/controls/tkthrobber.cxx
index 978d3183fe23..1dc83f860e34 100644
--- a/toolkit/source/controls/tkthrobber.cxx
+++ b/toolkit/source/controls/tkthrobber.cxx
@@ -46,8 +46,13 @@ namespace toolkit
//--------------------------------------------------------------------
UnoThrobberControlModel::UnoThrobberControlModel()
{
- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
}
//--------------------------------------------------------------------
@@ -63,6 +68,8 @@ namespace toolkit
{
case BASEPROPERTY_DEFAULTCONTROL:
return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControl ) );
+ case BASEPROPERTY_BORDER:
+ return uno::makeAny( (sal_Int16) 0 );
default:
return UnoControlModel::ImplGetDefaultValue( nPropId );
}
@@ -100,8 +107,9 @@ namespace toolkit
throw( uno::RuntimeException )
{
uno::Sequence< ::rtl::OUString > aServices( UnoControlModel::getSupportedServiceNames() );
- aServices.realloc( aServices.getLength() + 1 );
- aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControlModel );
+ aServices.realloc( aServices.getLength() + 2 );
+ aServices[ aServices.getLength() - 2 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControlModel );
+ aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName2_UnoThrobberControlModel );
return aServices;
}
@@ -151,8 +159,9 @@ namespace toolkit
throw( uno::RuntimeException )
{
uno::Sequence< ::rtl::OUString > aServices( UnoControlBase::getSupportedServiceNames() );
- aServices.realloc( aServices.getLength() + 1 );
- aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControl );
+ aServices.realloc( aServices.getLength() + 2 );
+ aServices[ aServices.getLength() - 2 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControl );
+ aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName2_UnoThrobberControl );
return aServices;
}
diff --git a/toolkit/source/controls/tree/treecontrol.cxx b/toolkit/source/controls/tree/treecontrol.cxx
index 5655e4e10abc..8606792fdf2f 100644
--- a/toolkit/source/controls/tree/treecontrol.cxx
+++ b/toolkit/source/controls/tree/treecontrol.cxx
@@ -67,6 +67,7 @@ UnoTreeModel::UnoTreeModel()
ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
ImplRegisterProperty( BASEPROPERTY_HELPURL );
ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
ImplRegisterProperty( BASEPROPERTY_TREE_SELECTIONTYPE );
ImplRegisterProperty( BASEPROPERTY_TREE_EDITABLE );
ImplRegisterProperty( BASEPROPERTY_TREE_DATAMODEL );
@@ -361,6 +362,13 @@ Reference< XTreeNode > SAL_CALL UnoTreeControl::getClosestNodeForLocation( sal_I
// -------------------------------------------------------------------
+awt::Rectangle SAL_CALL UnoTreeControl::getNodeRect( const Reference< XTreeNode >& Node ) throw (IllegalArgumentException, RuntimeException)
+{
+ return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->getNodeRect( Node );
+}
+
+// -------------------------------------------------------------------
+
sal_Bool SAL_CALL UnoTreeControl::isEditing( ) throw (RuntimeException)
{
return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->isEditing();
diff --git a/toolkit/source/controls/tree/treecontrol.hxx b/toolkit/source/controls/tree/treecontrol.hxx
index 0cae86616aa4..e646664c4a64 100644
--- a/toolkit/source/controls/tree/treecontrol.hxx
+++ b/toolkit/source/controls/tree/treecontrol.hxx
@@ -114,6 +114,7 @@ public:
virtual void SAL_CALL removeTreeExpansionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeExpansionListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getNodeForLocation( ::sal_Int32 x, ::sal_Int32 y ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getClosestNodeForLocation( ::sal_Int32 x, ::sal_Int32 y ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getNodeRect( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL isEditing( ) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL stopEditing( ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL cancelEditing( ) throw (::com::sun::star::uno::RuntimeException);
diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx
index 1abe0b34004f..d91077823495 100644
--- a/toolkit/source/controls/unocontrol.cxx
+++ b/toolkit/source/controls/unocontrol.cxx
@@ -1535,3 +1535,55 @@ void SAL_CALL UnoControl::removeModeChangeApproveListener( const Reference< XMod
throw NoSupportException( );
}
+//----------------------------------------------------------------------------------------------------------------------
+awt::Point SAL_CALL UnoControl::convertPointToLogic( const awt::Point& i_Point, ::sal_Int16 i_TargetUnit ) throw (IllegalArgumentException, RuntimeException)
+{
+ Reference< XUnitConversion > xPeerConversion;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ xPeerConversion = xPeerConversion.query( getPeer() );
+ }
+ if ( xPeerConversion.is() )
+ return xPeerConversion->convertPointToLogic( i_Point, i_TargetUnit );
+ return awt::Point( );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+awt::Point SAL_CALL UnoControl::convertPointToPixel( const awt::Point& i_Point, ::sal_Int16 i_SourceUnit ) throw (IllegalArgumentException, RuntimeException)
+{
+ Reference< XUnitConversion > xPeerConversion;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ xPeerConversion = xPeerConversion.query( getPeer() );
+ }
+ if ( xPeerConversion.is() )
+ return xPeerConversion->convertPointToPixel( i_Point, i_SourceUnit );
+ return awt::Point( );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+awt::Size SAL_CALL UnoControl::convertSizeToLogic( const awt::Size& i_Size, ::sal_Int16 i_TargetUnit ) throw (IllegalArgumentException, RuntimeException)
+{
+ Reference< XUnitConversion > xPeerConversion;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ xPeerConversion = xPeerConversion.query( getPeer() );
+ }
+ if ( xPeerConversion.is() )
+ return xPeerConversion->convertSizeToLogic( i_Size, i_TargetUnit );
+ return awt::Size( );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+awt::Size SAL_CALL UnoControl::convertSizeToPixel( const awt::Size& i_Size, ::sal_Int16 i_SourceUnit ) throw (IllegalArgumentException, RuntimeException)
+{
+ Reference< XUnitConversion > xPeerConversion;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ xPeerConversion = xPeerConversion.query( getPeer() );
+ }
+ if ( xPeerConversion.is() )
+ return xPeerConversion->convertSizeToPixel( i_Size, i_SourceUnit );
+ return awt::Size( );
+}
+
diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx
index 29b683a5ed40..91d202409e86 100644
--- a/toolkit/source/controls/unocontrolmodel.cxx
+++ b/toolkit/source/controls/unocontrolmodel.cxx
@@ -216,10 +216,6 @@ sal_Bool UnoControlModel::ImplHasProperty( sal_uInt16 nPropId ) const
return mpData->Get( nPropId ) ? sal_True : sal_False;
}
-void UnoControlModel::ImplPropertyChanged( sal_uInt16 )
-{
-}
-
::com::sun::star::uno::Any UnoControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
{
::com::sun::star::uno::Any aDefault;
@@ -267,6 +263,7 @@ void UnoControlModel::ImplPropertyChanged( sal_uInt16 )
aDefault <<= Reference< awt::XDevice >();
break;
+ case BASEPROPERTY_ITEM_SEPARATOR_POS:
case BASEPROPERTY_VERTICALALIGN:
case BASEPROPERTY_BORDERCOLOR:
case BASEPROPERTY_SYMBOL_COLOR:
@@ -342,6 +339,7 @@ void UnoControlModel::ImplPropertyChanged( sal_uInt16 )
case BASEPROPERTY_HARDLINEBREAKS:
case BASEPROPERTY_NOLABEL: aDefault <<= (sal_Bool) sal_False; break;
+ case BASEPROPERTY_MULTISELECTION_SIMPLEMODE:
case BASEPROPERTY_HIDEINACTIVESELECTION:
case BASEPROPERTY_ENFORCE_FORMAT:
case BASEPROPERTY_AUTOCOMPLETE:
@@ -1259,22 +1257,13 @@ sal_Bool UnoControlModel::convertFastPropertyValue( Any & rConvertedValue, Any &
void UnoControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
// Fehlt: Die gefakten Einzelproperties des FontDescriptors...
ImplControlProperty* pProp = mpData->Get( nPropId );
- if ( pProp )
- {
- DBG_ASSERT( ( rValue.getValueType().getTypeClass() != ::com::sun::star::uno::TypeClass_VOID ) || ( GetPropertyAttribs( (sal_uInt16)nPropId ) & ::com::sun::star::beans::PropertyAttribute::MAYBEVOID ), "Property darf nicht VOID sein!" );
- ImplPropertyChanged( (sal_uInt16)nPropId );
- pProp->SetValue( rValue );
- }
- else
- {
- // exception...
- DBG_ERROR( "SetPropertyValues: Invalid Property!" );
- }
+ ENSURE_OR_RETURN_VOID( pProp, "UnoControlModel::setFastPropertyValue_NoBroadcast: invalid property id!" );
+
+ DBG_ASSERT( ( rValue.getValueType().getTypeClass() != ::com::sun::star::uno::TypeClass_VOID ) || ( GetPropertyAttribs( (sal_uInt16)nPropId ) & ::com::sun::star::beans::PropertyAttribute::MAYBEVOID ), "Property darf nicht VOID sein!" );
+ pProp->SetValue( rValue );
}
void UnoControlModel::getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nPropId ) const
diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx
index ae9e59d045e7..cfb71111e3dc 100644
--- a/toolkit/source/controls/unocontrols.cxx
+++ b/toolkit/source/controls/unocontrols.cxx
@@ -73,8 +73,11 @@
#include <tools/time.hxx>
#include <algorithm>
+#include <functional>
using namespace ::com::sun::star;
+using ::com::sun::star::graphic::XGraphic;
+using ::com::sun::star::uno::Reference;
using namespace ::toolkit;
@@ -1841,19 +1844,130 @@ sal_Bool UnoGroupBoxControl::isTransparent() throw(uno::RuntimeException)
return sal_True;
}
-// ----------------------------------------------------
-// class UnoControlListBoxModel
-// ----------------------------------------------------
+// =====================================================================================================================
+// = UnoControlListBoxModel_Data
+// =====================================================================================================================
+struct ListItem
+{
+ ::rtl::OUString ItemText;
+ ::rtl::OUString ItemImageURL;
+ Any ItemData;
+
+ ListItem()
+ :ItemText()
+ ,ItemImageURL()
+ ,ItemData()
+ {
+ }
+
+ ListItem( const ::rtl::OUString& i_rItemText )
+ :ItemText( i_rItemText )
+ ,ItemImageURL()
+ ,ItemData()
+ {
+ }
+};
+
+typedef beans::Pair< ::rtl::OUString, ::rtl::OUString > UnoListItem;
+
+struct StripItemData : public ::std::unary_function< ListItem, UnoListItem >
+{
+ UnoListItem operator()( const ListItem& i_rItem )
+ {
+ return UnoListItem( i_rItem.ItemText, i_rItem.ItemImageURL );
+ }
+};
+
+struct UnoControlListBoxModel_Data
+{
+ UnoControlListBoxModel_Data( UnoControlListBoxModel& i_rAntiImpl )
+ :m_bSettingLegacyProperty( false )
+ ,m_rAntiImpl( i_rAntiImpl )
+ ,m_aListItems()
+ {
+ }
+
+ sal_Int32 getItemCount() const { return sal_Int32( m_aListItems.size() ); }
+
+ const ListItem& getItem( const sal_Int32 i_nIndex ) const
+ {
+ if ( ( i_nIndex < 0 ) || ( i_nIndex >= sal_Int32( m_aListItems.size() ) ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), m_rAntiImpl );
+ return m_aListItems[ i_nIndex ];
+ }
+
+ ListItem& getItem( const sal_Int32 i_nIndex )
+ {
+ return const_cast< ListItem& >( static_cast< const UnoControlListBoxModel_Data* >( this )->getItem( i_nIndex ) );
+ }
+
+ ListItem& insertItem( const sal_Int32 i_nIndex )
+ {
+ if ( ( i_nIndex < 0 ) || ( i_nIndex > sal_Int32( m_aListItems.size() ) ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), m_rAntiImpl );
+ return *m_aListItems.insert( m_aListItems.begin() + i_nIndex, ListItem() );
+ }
+
+ Sequence< UnoListItem > getAllItems() const
+ {
+ Sequence< UnoListItem > aItems( sal_Int32( m_aListItems.size() ) );
+ ::std::transform( m_aListItems.begin(), m_aListItems.end(), aItems.getArray(), StripItemData() );
+ return aItems;
+ }
+
+ void setAllItems( const ::std::vector< ListItem >& i_rItems )
+ {
+ m_aListItems = i_rItems;
+ }
+
+ void removeItem( const sal_Int32 i_nIndex )
+ {
+ if ( ( i_nIndex < 0 ) || ( i_nIndex >= sal_Int32( m_aListItems.size() ) ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), m_rAntiImpl );
+ m_aListItems.erase( m_aListItems.begin() + i_nIndex );
+ }
+
+ void removeAllItems()
+ {
+ ::std::vector< ListItem > aEmpty;
+ m_aListItems.swap( aEmpty );
+ }
+
+public:
+ bool m_bSettingLegacyProperty;
+
+private:
+ UnoControlListBoxModel& m_rAntiImpl;
+ ::std::vector< ListItem > m_aListItems;
+};
+
+// =====================================================================================================================
+// = UnoControlListBoxModel
+// =====================================================================================================================
+// ---------------------------------------------------------------------------------------------------------------------
UnoControlListBoxModel::UnoControlListBoxModel()
+ :UnoControlListBoxModel_Base()
+ ,m_pData( new UnoControlListBoxModel_Data( *this ) )
+ ,m_aItemListListeners( GetMutex() )
{
UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXListBox );
}
+// ---------------------------------------------------------------------------------------------------------------------
+UnoControlListBoxModel::UnoControlListBoxModel( const UnoControlListBoxModel& i_rSource )
+ :UnoControlListBoxModel_Base( i_rSource )
+ ,m_pData( new UnoControlListBoxModel_Data( *this ) )
+ ,m_aItemListListeners( GetMutex() )
+{
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
::rtl::OUString UnoControlListBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
{
return ::rtl::OUString::createFromAscii( szServiceName_UnoControlListBoxModel );
}
+// ---------------------------------------------------------------------------------------------------------------------
uno::Any UnoControlListBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
{
if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
@@ -1865,6 +1979,7 @@ uno::Any UnoControlListBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
return UnoControlModel::ImplGetDefaultValue( nPropId );
}
+// ---------------------------------------------------------------------------------------------------------------------
::cppu::IPropertyArrayHelper& UnoControlListBoxModel::getInfoHelper()
{
static UnoPropertyArrayHelper* pHelper = NULL;
@@ -1876,6 +1991,7 @@ uno::Any UnoControlListBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
return *pHelper;
}
+// ---------------------------------------------------------------------------------------------------------------------
// beans::XMultiPropertySet
uno::Reference< beans::XPropertySetInfo > UnoControlListBoxModel::getPropertySetInfo( ) throw(uno::RuntimeException)
{
@@ -1883,19 +1999,61 @@ uno::Reference< beans::XPropertySetInfo > UnoControlListBoxModel::getPropertySet
return xInfo;
}
-void UnoControlListBoxModel::ImplPropertyChanged( sal_uInt16 nPropId )
+// ---------------------------------------------------------------------------------------------------------------------
+namespace
+{
+ struct CreateListItem : public ::std::unary_function< ::rtl::OUString, ListItem >
+ {
+ ListItem operator()( const ::rtl::OUString& i_rItemText )
+ {
+ return ListItem( i_rItemText );
+ }
+ };
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const uno::Any& rValue ) throw (uno::Exception)
{
- if ( nPropId == BASEPROPERTY_STRINGITEMLIST )
+ UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
+
+ if ( nHandle == BASEPROPERTY_STRINGITEMLIST )
{
+ // reset selection
uno::Sequence<sal_Int16> aSeq;
uno::Any aAny;
aAny <<= aSeq;
setPropertyValue( GetPropertyName( BASEPROPERTY_SELECTEDITEMS ), aAny );
- }
- UnoControlModel::ImplPropertyChanged( nPropId );
+ if ( !m_pData->m_bSettingLegacyProperty )
+ {
+ // synchronize the legacy StringItemList property with our list items
+ Sequence< ::rtl::OUString > aStringItemList;
+ Any aPropValue;
+ getFastPropertyValue( aPropValue, BASEPROPERTY_STRINGITEMLIST );
+ OSL_VERIFY( aPropValue >>= aStringItemList );
+
+ ::std::vector< ListItem > aItems( aStringItemList.getLength() );
+ ::std::transform(
+ aStringItemList.getConstArray(),
+ aStringItemList.getConstArray() + aStringItemList.getLength(),
+ aItems.begin(),
+ CreateListItem()
+ );
+ m_pData->setAllItems( aItems );
+
+ // since an XItemListListener does not have a "all items modified" or some such method,
+ // we simulate this by notifying removal of all items, followed by insertion of all new
+ // items
+ lang::EventObject aEvent;
+ aEvent.Source = *this;
+ m_aItemListListeners.notifyEach( &XItemListListener::itemListChanged, aEvent );
+ // TODO: OPropertySetHelper calls into this method with the mutex locked ...
+ // which is wrong for the above notifications ...
+ }
+ }
}
+// ---------------------------------------------------------------------------------------------------------------------
void UnoControlListBoxModel::ImplNormalizePropertySequence( const sal_Int32 _nCount, sal_Int32* _pHandles,
uno::Any* _pValues, sal_Int32* _pValidHandles ) const SAL_THROW(())
{
@@ -1906,12 +2064,327 @@ void UnoControlListBoxModel::ImplNormalizePropertySequence( const sal_Int32 _nCo
UnoControlModel::ImplNormalizePropertySequence( _nCount, _pHandles, _pValues, _pValidHandles );
}
+// ---------------------------------------------------------------------------------------------------------------------
+::sal_Int32 SAL_CALL UnoControlListBoxModel::getItemCount() throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+ return m_pData->getItemCount();
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::insertItem( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemText, const ::rtl::OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // SYNCHRONIZED ----->
+ ListItem& rItem( m_pData->insertItem( i_nPosition ) );
+ rItem.ItemText = i_rItemText;
+ rItem.ItemImageURL = i_rItemImageURL;
+
+ impl_handleInsert( i_nPosition, i_rItemText, i_rItemImageURL, aGuard );
+ // <----- SYNCHRONIZED
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::insertItemText( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemText ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // SYNCHRONIZED ----->
+ ListItem& rItem( m_pData->insertItem( i_nPosition ) );
+ rItem.ItemText = i_rItemText;
+
+ impl_handleInsert( i_nPosition, i_rItemText, ::boost::optional< ::rtl::OUString >(), aGuard );
+ // <----- SYNCHRONIZED
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::insertItemImage( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // SYNCHRONIZED ----->
+ ListItem& rItem( m_pData->insertItem( i_nPosition ) );
+ rItem.ItemImageURL = i_rItemImageURL;
+
+ impl_handleInsert( i_nPosition, ::boost::optional< ::rtl::OUString >(), i_rItemImageURL, aGuard );
+ // <----- SYNCHRONIZED
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::removeItem( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // SYNCHRONIZED ----->
+ m_pData->removeItem( i_nPosition );
+
+ impl_handleRemove( i_nPosition, aGuard );
+ // <----- SYNCHRONIZED
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::removeAllItems( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // SYNCHRONIZED ----->
+ m_pData->removeAllItems();
+
+ impl_handleRemove( -1, aGuard );
+ // <----- SYNCHRONIZED
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::setItemText( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemText ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // SYNCHRONIZED ----->
+ ListItem& rItem( m_pData->getItem( i_nPosition ) );
+ rItem.ItemText = i_rItemText;
+
+ impl_handleModify( i_nPosition, i_rItemText, ::boost::optional< ::rtl::OUString >(), aGuard );
+ // <----- SYNCHRONIZED
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::setItemImage( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // SYNCHRONIZED ----->
+ ListItem& rItem( m_pData->getItem( i_nPosition ) );
+ rItem.ItemImageURL = i_rItemImageURL;
+
+ impl_handleModify( i_nPosition, ::boost::optional< ::rtl::OUString >(), i_rItemImageURL, aGuard );
+ // <----- SYNCHRONIZED
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::setItemTextAndImage( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemText, const ::rtl::OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // SYNCHRONIZED ----->
+ ListItem& rItem( m_pData->getItem( i_nPosition ) );
+ rItem.ItemText = i_rItemText;
+ rItem.ItemImageURL = i_rItemImageURL;
+
+ impl_handleModify( i_nPosition, i_rItemText, i_rItemImageURL, aGuard );
+ // <----- SYNCHRONIZED
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::setItemData( ::sal_Int32 i_nPosition, const Any& i_rDataValue ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ ListItem& rItem( m_pData->getItem( i_nPosition ) );
+ rItem.ItemData = i_rDataValue;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+::rtl::OUString SAL_CALL UnoControlListBoxModel::getItemText( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+ const ListItem& rItem( m_pData->getItem( i_nPosition ) );
+ return rItem.ItemText;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+::rtl::OUString SAL_CALL UnoControlListBoxModel::getItemImage( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+ const ListItem& rItem( m_pData->getItem( i_nPosition ) );
+ return rItem.ItemImageURL;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+beans::Pair< ::rtl::OUString, ::rtl::OUString > SAL_CALL UnoControlListBoxModel::getItemTextAndImage( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+ const ListItem& rItem( m_pData->getItem( i_nPosition ) );
+ return beans::Pair< ::rtl::OUString, ::rtl::OUString >( rItem.ItemText, rItem.ItemImageURL );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+Any SAL_CALL UnoControlListBoxModel::getItemData( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ const ListItem& rItem( m_pData->getItem( i_nPosition ) );
+ return rItem.ItemData;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+Sequence< beans::Pair< ::rtl::OUString, ::rtl::OUString > > SAL_CALL UnoControlListBoxModel::getAllItems( ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+ return m_pData->getAllItems();
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::addItemListListener( const uno::Reference< awt::XItemListListener >& i_Listener ) throw (uno::RuntimeException)
+{
+ if ( i_Listener.is() )
+ m_aItemListListeners.addInterface( i_Listener );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::removeItemListListener( const uno::Reference< awt::XItemListListener >& i_Listener ) throw (uno::RuntimeException)
+{
+ if ( i_Listener.is() )
+ m_aItemListListeners.removeInterface( i_Listener );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void UnoControlListBoxModel::impl_getStringItemList( ::std::vector< ::rtl::OUString >& o_rStringItems ) const
+{
+ Sequence< ::rtl::OUString > aStringItemList;
+ Any aPropValue;
+ getFastPropertyValue( aPropValue, BASEPROPERTY_STRINGITEMLIST );
+ OSL_VERIFY( aPropValue >>= aStringItemList );
+
+ o_rStringItems.resize( size_t( aStringItemList.getLength() ) );
+ ::std::copy(
+ aStringItemList.getConstArray(),
+ aStringItemList.getConstArray() + aStringItemList.getLength(),
+ o_rStringItems.begin()
+ );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void UnoControlListBoxModel::impl_setStringItemList_nolck( const ::std::vector< ::rtl::OUString >& i_rStringItems )
+{
+ Sequence< ::rtl::OUString > aStringItems( i_rStringItems.size() );
+ ::std::copy(
+ i_rStringItems.begin(),
+ i_rStringItems.end(),
+ aStringItems.getArray()
+ );
+ m_pData->m_bSettingLegacyProperty = true;
+ try
+ {
+ setFastPropertyValue( BASEPROPERTY_STRINGITEMLIST, uno::makeAny( aStringItems ) );
+ }
+ catch( const Exception& )
+ {
+ m_pData->m_bSettingLegacyProperty = false;
+ throw;
+ }
+ m_pData->m_bSettingLegacyProperty = false;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void UnoControlListBoxModel::impl_handleInsert( const sal_Int32 i_nItemPosition, const ::boost::optional< ::rtl::OUString >& i_rItemText,
+ const ::boost::optional< ::rtl::OUString >& i_rItemImageURL, ::osl::ClearableMutexGuard& i_rClearBeforeNotify )
+{
+ // SYNCHRONIZED ----->
+ // sync with legacy StringItemList property
+ ::std::vector< ::rtl::OUString > aStringItems;
+ impl_getStringItemList( aStringItems );
+ OSL_ENSURE( size_t( i_nItemPosition ) <= aStringItems.size(), "UnoControlListBoxModel::impl_handleInsert" );
+ if ( size_t( i_nItemPosition ) <= aStringItems.size() )
+ {
+ const ::rtl::OUString sItemText( !!i_rItemText ? *i_rItemText : ::rtl::OUString() );
+ aStringItems.insert( aStringItems.begin() + i_nItemPosition, sItemText );
+ }
+
+ i_rClearBeforeNotify.clear();
+ // <----- SYNCHRONIZED
+ impl_setStringItemList_nolck( aStringItems );
+
+ // notify ItemListListeners
+ impl_notifyItemListEvent_nolck( i_nItemPosition, i_rItemText, i_rItemImageURL, &XItemListListener::listItemInserted );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void UnoControlListBoxModel::impl_handleRemove( const sal_Int32 i_nItemPosition, ::osl::ClearableMutexGuard& i_rClearBeforeNotify )
+{
+ // SYNCHRONIZED ----->
+ const bool bAllItems = ( i_nItemPosition < 0 );
+ // sync with legacy StringItemList property
+ ::std::vector< ::rtl::OUString > aStringItems;
+ impl_getStringItemList( aStringItems );
+ if ( !bAllItems )
+ {
+ OSL_ENSURE( size_t( i_nItemPosition ) < aStringItems.size(), "UnoControlListBoxModel::impl_handleRemove" );
+ if ( size_t( i_nItemPosition ) < aStringItems.size() )
+ {
+ aStringItems.erase( aStringItems.begin() + i_nItemPosition );
+ }
+ }
+ else
+ {
+ aStringItems.resize(0);
+ }
+
+ i_rClearBeforeNotify.clear();
+ // <----- SYNCHRONIZED
+ impl_setStringItemList_nolck( aStringItems );
+
+ // notify ItemListListeners
+ if ( bAllItems )
+ {
+ EventObject aEvent( *this );
+ m_aItemListListeners.notifyEach( &XItemListListener::allItemsRemoved, aEvent );
+ }
+ else
+ {
+ impl_notifyItemListEvent_nolck( i_nItemPosition, ::boost::optional< ::rtl::OUString >(), ::boost::optional< ::rtl::OUString >(),
+ &XItemListListener::listItemRemoved );
+ }
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void UnoControlListBoxModel::impl_handleModify( const sal_Int32 i_nItemPosition, const ::boost::optional< ::rtl::OUString >& i_rItemText,
+ const ::boost::optional< ::rtl::OUString >& i_rItemImageURL, ::osl::ClearableMutexGuard& i_rClearBeforeNotify )
+{
+ // SYNCHRONIZED ----->
+ if ( !!i_rItemText )
+ {
+ // sync with legacy StringItemList property
+ ::std::vector< ::rtl::OUString > aStringItems;
+ impl_getStringItemList( aStringItems );
+ OSL_ENSURE( size_t( i_nItemPosition ) < aStringItems.size(), "UnoControlListBoxModel::impl_handleModify" );
+ if ( size_t( i_nItemPosition ) < aStringItems.size() )
+ {
+ aStringItems[ i_nItemPosition] = *i_rItemText;
+ }
+
+ i_rClearBeforeNotify.clear();
+ // <----- SYNCHRONIZED
+ impl_setStringItemList_nolck( aStringItems );
+ }
+ else
+ {
+ i_rClearBeforeNotify.clear();
+ // <----- SYNCHRONIZED
+ }
+
+ // notify ItemListListeners
+ impl_notifyItemListEvent_nolck( i_nItemPosition, i_rItemText, i_rItemImageURL, &XItemListListener::listItemModified );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void UnoControlListBoxModel::impl_notifyItemListEvent_nolck( const sal_Int32 i_nItemPosition, const ::boost::optional< ::rtl::OUString >& i_rItemText,
+ const ::boost::optional< ::rtl::OUString >& i_rItemImageURL,
+ void ( SAL_CALL XItemListListener::*NotificationMethod )( const ItemListEvent& ) )
+{
+ ItemListEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.ItemPosition = i_nItemPosition;
+ if ( !!i_rItemText )
+ {
+ aEvent.ItemText.IsPresent = sal_True;
+ aEvent.ItemText.Value = *i_rItemText;
+ }
+ if ( !!i_rItemImageURL )
+ {
+ aEvent.ItemImageURL.IsPresent = sal_True;
+ aEvent.ItemImageURL.Value = *i_rItemImageURL;
+ }
+
+ m_aItemListListeners.notifyEach( NotificationMethod, aEvent );
+}
+
// ----------------------------------------------------
// class UnoListBoxControl
// ----------------------------------------------------
UnoListBoxControl::UnoListBoxControl()
- : maActionListeners( *this ),
- maItemListeners( *this )
+ :maActionListeners( *this )
+ ,maItemListeners( *this )
{
maComponentInfos.nWidth = 100;
maComponentInfos.nHeight = 12;
@@ -1922,27 +2395,6 @@ UnoListBoxControl::UnoListBoxControl()
return ::rtl::OUString::createFromAscii( "listbox" );
}
-// uno::XInterface
-uno::Any UnoListBoxControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
-{
- uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( awt::XListBox*, this ),
- SAL_STATIC_CAST( awt::XItemListener*, this ),
- SAL_STATIC_CAST( lang::XEventListener*, SAL_STATIC_CAST( awt::XItemListener*, this ) ),
- SAL_STATIC_CAST( awt::XLayoutConstrains*, this ),
- SAL_STATIC_CAST( awt::XTextLayoutConstrains*, this ) );
- return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType ));
-}
-
-// lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( UnoListBoxControl )
- getCppuType( ( uno::Reference< awt::XListBox>* ) NULL ),
- getCppuType( ( uno::Reference< awt::XItemListener>* ) NULL ),
- getCppuType( ( uno::Reference< awt::XLayoutConstrains>* ) NULL ),
- getCppuType( ( uno::Reference< awt::XTextLayoutConstrains>* ) NULL ),
- UnoControlBase::getTypes()
-IMPL_XTYPEPROVIDER_END
-
void UnoListBoxControl::dispose() throw(uno::RuntimeException)
{
lang::EventObject aEvt;
@@ -1966,24 +2418,32 @@ void UnoListBoxControl::ImplUpdateSelectedItemsProperty()
}
}
-void UnoListBoxControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal )
+void UnoListBoxControl::updateFromModel()
{
- UnoControl::ImplSetPeerProperty( rPropName, rVal );
+ UnoControlBase::updateFromModel();
- // Wenn die SelectedItems vor der StringItemList gesetzt werden,
- // hat das keine Auswirkung...
+ Reference< XItemListListener > xItemListListener( getPeer(), UNO_QUERY );
+ ENSURE_OR_RETURN_VOID( xItemListListener.is(), "UnoListBoxControl::updateFromModel: a peer which is no ItemListListener?!" );
+
+ EventObject aEvent( getModel() );
+ xItemListListener->itemListChanged( aEvent );
+
+ // notify the change of the SelectedItems property, again. While our base class, in updateFromModel,
+ // already did this, our peer(s) can only legitimately set the selection after they have the string
+ // item list, which we just notified with the itemListChanged call.
+ const ::rtl::OUString sSelectedItemsPropName( GetPropertyName( BASEPROPERTY_SELECTEDITEMS ) );
+ ImplSetPeerProperty( sSelectedItemsPropName, ImplGetPropertyValue( sSelectedItemsPropName ) );
+}
+
+void UnoListBoxControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal )
+{
if ( rPropName == GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) )
- {
- ::rtl::OUString aSelPropName = GetPropertyName( BASEPROPERTY_SELECTEDITEMS );
- uno::Any aVal = ImplGetPropertyValue( aSelPropName );
- if ( !( aVal.getValueType().getTypeClass() == uno::TypeClass_VOID ) )
- {
- uno::Reference< awt::XVclWindowPeer > xW( getPeer(), uno::UNO_QUERY );
- if (xW.is())
- // same comment as in UnoControl::ImplSetPeerProperty - see there
- xW->setProperty( aSelPropName, aVal );
- }
- }
+ // do not forward this to our peer. We are a XItemListListener at our model, and changes in the string item
+ // list (which is a legacy property) will, later, arrive as changes in the ItemList. Those latter changes
+ // will be forwarded to the peer, which will update itself accordingly.
+ return;
+
+ UnoControl::ImplSetPeerProperty( rPropName, rVal );
}
void UnoListBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
@@ -2281,6 +2741,66 @@ void UnoListBoxControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines
Impl_getColumnsAndLines( nCols, nLines );
}
+sal_Bool SAL_CALL UnoListBoxControl::setModel( const uno::Reference< awt::XControlModel >& i_rModel ) throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ const Reference< XItemList > xOldItems( getModel(), UNO_QUERY );
+ OSL_ENSURE( xOldItems.is() || !getModel().is(), "UnoListBoxControl::setModel: illegal old model!" );
+ const Reference< XItemList > xNewItems( i_rModel, UNO_QUERY );
+ OSL_ENSURE( xNewItems.is() || !i_rModel.is(), "UnoListBoxControl::setModel: illegal new model!" );
+
+ if ( !UnoListBoxControl_Base::setModel( i_rModel ) )
+ return sal_False;
+
+ if ( xOldItems.is() )
+ xOldItems->removeItemListListener( this );
+ if ( xNewItems.is() )
+ xNewItems->addItemListListener( this );
+
+ return sal_True;
+}
+
+void SAL_CALL UnoListBoxControl::listItemInserted( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException)
+{
+ const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
+ OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::listItemInserted: invalid peer!" );
+ if ( xPeerListener.is() )
+ xPeerListener->listItemInserted( i_rEvent );
+}
+
+void SAL_CALL UnoListBoxControl::listItemRemoved( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException)
+{
+ const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
+ OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::listItemRemoved: invalid peer!" );
+ if ( xPeerListener.is() )
+ xPeerListener->listItemRemoved( i_rEvent );
+}
+
+void SAL_CALL UnoListBoxControl::listItemModified( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException)
+{
+ const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
+ OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::listItemModified: invalid peer!" );
+ if ( xPeerListener.is() )
+ xPeerListener->listItemModified( i_rEvent );
+}
+
+void SAL_CALL UnoListBoxControl::allItemsRemoved( const lang::EventObject& i_rEvent ) throw (uno::RuntimeException)
+{
+ const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
+ OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::allItemsRemoved: invalid peer!" );
+ if ( xPeerListener.is() )
+ xPeerListener->allItemsRemoved( i_rEvent );
+}
+
+void SAL_CALL UnoListBoxControl::itemListChanged( const lang::EventObject& i_rEvent ) throw (uno::RuntimeException)
+{
+ const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
+ OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::itemListChanged: invalid peer!" );
+ if ( xPeerListener.is() )
+ xPeerListener->itemListChanged( i_rEvent );
+}
+
// ----------------------------------------------------
// class UnoControlComboBoxModel
// ----------------------------------------------------
diff --git a/toolkit/source/helper/listenermultiplexer.cxx b/toolkit/source/helper/listenermultiplexer.cxx
index fcfd6214780e..9b8df60521ae 100644
--- a/toolkit/source/helper/listenermultiplexer.cxx
+++ b/toolkit/source/helper/listenermultiplexer.cxx
@@ -206,3 +206,8 @@ IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeExpansionListenerMultiplexer, ::com
// ----------------------------------------------------
IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeEditListenerMultiplexer, ::com::sun::star::awt::tree::XTreeEditListener )
+// ----------------------------------------------------
+// class SelectionListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener, selectionChanged, ::com::sun::star::awt::grid::GridSelectionEvent )
diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx
index 7ede81d485d7..3a83465a3218 100644
--- a/toolkit/source/helper/property.cxx
+++ b/toolkit/source/helper/property.cxx
@@ -191,6 +191,7 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
DECL_PROP_2 ( "ImageAlign", IMAGEALIGN, sal_Int16, BOUND, MAYBEDEFAULT),
DECL_PROP_2 ( "ImagePosition", IMAGEPOSITION, sal_Int16, BOUND, MAYBEDEFAULT),
DECL_PROP_2 ( "ImageURL", IMAGEURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "ItemSeparatorPos", ITEM_SEPARATOR_POS, sal_Int16, BOUND, MAYBEDEFAULT, MAYBEVOID ),
DECL_PROP_2 ( "Label", LABEL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
DECL_PROP_3 ( "LineColor", LINECOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
DECL_PROP_2 ( "LineCount", LINECOUNT, sal_Int16, BOUND, MAYBEDEFAULT ),
@@ -203,6 +204,7 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
DECL_PROP_1 ( "MouseTransparent", MOUSETRANSPARENT, bool, BOUND ),
DECL_PROP_2 ( "MultiLine", MULTILINE, bool, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "MultiSelection", MULTISELECTION, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "MultiSelectionSimpleMode", MULTISELECTION_SIMPLEMODE, bool, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "NativeWidgetLook", NATIVE_WIDGET_LOOK, bool, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "NoLabel", NOLABEL, bool, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "Orientation", ORIENTATION, sal_Int32, BOUND, MAYBEDEFAULT ),
@@ -222,7 +224,7 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
DECL_DEP_PROP_3 ( "ScrollValue", SCROLLVALUE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
DECL_PROP_2 ( "ScrollValueMax", SCROLLVALUE_MAX, sal_Int32, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "ScrollValueMin", SCROLLVALUE_MIN, sal_Int32, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "SelectedItems", SELECTEDITEMS, Sequence<sal_Int16>, BOUND, MAYBEDEFAULT ),
+ DECL_DEP_PROP_2 ( "SelectedItems", SELECTEDITEMS, Sequence<sal_Int16>, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "ShowThousandsSeparator", NUMSHOWTHOUSANDSEP, bool, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "Sizeable", SIZEABLE, bool, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "Spin", SPIN, bool, BOUND, MAYBEDEFAULT ),
@@ -281,8 +283,12 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
DECL_PROP_3 ( "ColumnModel", GRID_COLUMNMODEL, Reference< ::com::sun::star::awt::grid::XGridColumnModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
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 ( "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 )
+ };
pPropertyInfos = aImplPropertyInfos;
nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo );
}
diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx
index 7d1dcaeb2762..aedf4024f2b9 100644
--- a/toolkit/source/helper/registerservices.cxx
+++ b/toolkit/source/helper/registerservices.cxx
@@ -284,10 +284,10 @@ TOOLKIT_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void* _pServiceManager,
registerServices( xRegistryKey, "TreeControl", szServiceName_TreeControl );
registerServices( xRegistryKey, "TreeControlModel", szServiceName_TreeControlModel );
registerServices( xRegistryKey, "MutableTreeDataModel", szServiceName_MutableTreeDataModel );
- registerServices( xRegistryKey, "UnoSimpleAnimationControlModel", szServiceName_UnoSimpleAnimationControlModel );
- registerServices( xRegistryKey, "UnoSimpleAnimationControl", szServiceName_UnoSimpleAnimationControl );
- registerServices( xRegistryKey, "UnoThrobberControlModel", szServiceName_UnoThrobberControlModel );
- registerServices( xRegistryKey, "UnoThrobberControl", szServiceName_UnoThrobberControl );
+ registerServices( xRegistryKey, "UnoSimpleAnimationControlModel", szServiceName_UnoSimpleAnimationControlModel, szServiceName2_UnoSimpleAnimationControlModel );
+ registerServices( xRegistryKey, "UnoSimpleAnimationControl", szServiceName_UnoSimpleAnimationControl, szServiceName2_UnoSimpleAnimationControl );
+ registerServices( xRegistryKey, "UnoThrobberControlModel", szServiceName_UnoThrobberControlModel, szServiceName2_UnoThrobberControlModel );
+ registerServices( xRegistryKey, "UnoThrobberControl", szServiceName_UnoThrobberControl, szServiceName2_UnoThrobberControl );
registerServices( xRegistryKey, "UnoFixedHyperlinkControl", szServiceName_UnoControlFixedHyperlink );
registerServices( xRegistryKey, "UnoControlFixedHyperlinkModel", szServiceName_UnoControlFixedHyperlinkModel );
registerServices( xRegistryKey, "GridControl", szServiceName_GridControl );
@@ -371,10 +371,10 @@ TOOLKIT_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* sImplemen
CHECKANDCREATEFACTORY( TreeControl, szServiceName_TreeControl, NULL )
CHECKANDCREATEFACTORY( TreeControlModel, szServiceName_TreeControlModel, NULL )
CHECKANDCREATEFACTORY( MutableTreeDataModel, szServiceName_MutableTreeDataModel, NULL )
- CHECKANDCREATEFACTORY( UnoSimpleAnimationControlModel, szServiceName_UnoSimpleAnimationControlModel, NULL )
- CHECKANDCREATEFACTORY( UnoSimpleAnimationControl, szServiceName_UnoSimpleAnimationControl, NULL )
- CHECKANDCREATEFACTORY( UnoThrobberControlModel, szServiceName_UnoThrobberControlModel, NULL )
- CHECKANDCREATEFACTORY( UnoThrobberControl, szServiceName_UnoThrobberControl, 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 )
CHECKANDCREATEFACTORY( UnoFixedHyperlinkControl, szServiceName_UnoControlFixedHyperlink, NULL )
CHECKANDCREATEFACTORY( UnoControlFixedHyperlinkModel, szServiceName_UnoControlFixedHyperlinkModel, NULL )
CHECKANDCREATEFACTORY( GridControl, szServiceName_GridControl, NULL );
diff --git a/toolkit/source/helper/servicenames.cxx b/toolkit/source/helper/servicenames.cxx
index 1885387561cb..6a376391f46d 100644
--- a/toolkit/source/helper/servicenames.cxx
+++ b/toolkit/source/helper/servicenames.cxx
@@ -92,10 +92,10 @@ const sal_Char __FAR_DATA szServiceName_UnoSpinButtonModel[] = "com.sun.star.awt
const sal_Char __FAR_DATA szServiceName_TreeControl[] = "com.sun.star.awt.tree.TreeControl";
const sal_Char __FAR_DATA szServiceName_TreeControlModel[] = "com.sun.star.awt.tree.TreeControlModel";
const sal_Char __FAR_DATA szServiceName_MutableTreeDataModel[] = "com.sun.star.awt.tree.MutableTreeDataModel";
-const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControlModel[] = "com.sun.star.awt.UnoSimpleAnimationControlModel";
-const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControl[] = "com.sun.star.awt.UnoSimpleAnimationControl";
-const sal_Char __FAR_DATA szServiceName_UnoThrobberControlModel[] = "com.sun.star.awt.UnoThrobberControlModel";
-const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[] = "com.sun.star.awt.UnoThrobberControl";
+const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControlModel[] = "com.sun.star.awt.UnoSimpleAnimationControlModel", szServiceName2_UnoSimpleAnimationControlModel[] = "com.sun.star.awt.UnoControlSimpleAnimationModel";
+const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControl[] = "com.sun.star.awt.UnoSimpleAnimationControl", szServiceName2_UnoSimpleAnimationControl[] = "com.sun.star.awt.UnoControlSimpleAnimation";
+const sal_Char __FAR_DATA szServiceName_UnoThrobberControlModel[] = "com.sun.star.awt.UnoThrobberControlModel", szServiceName2_UnoThrobberControlModel[] = "com.sun.star.awt.UnoControlThrobberModel";
+const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[] = "com.sun.star.awt.UnoThrobberControl", szServiceName2_UnoThrobberControl[] = "com.sun.star.awt.UnoControlThrobber";
const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlink[] = "com.sun.star.awt.UnoControlFixedHyperlink";
const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlinkModel[] = "com.sun.star.awt.UnoControlFixedHyperlinkModel";
const sal_Char __FAR_DATA szServiceName_GridControl[] = "com.sun.star.awt.grid.UnoControlGrid";
diff --git a/toolkit/source/layout/core/box-base.cxx b/toolkit/source/layout/core/box-base.cxx
index dbe9163e2117..d203e63ce2ed 100644
--- a/toolkit/source/layout/core/box-base.cxx
+++ b/toolkit/source/layout/core/box-base.cxx
@@ -104,15 +104,16 @@ Box_Base::addChild (uno::Reference <awt::XLayoutConstrains> const& xChild)
}
Box_Base::ChildData*
-Box_Base::removeChildData( std::list< ChildData* > lst, css::uno::Reference< css::awt::XLayoutConstrains > const& xChild )
+Box_Base::removeChildData( std::list< ChildData* >& lst, css::uno::Reference< css::awt::XLayoutConstrains > const& xChild )
{
for ( std::list< ChildData* >::iterator it = lst.begin();
it != lst.end(); it++ )
{
if ( (*it)->mxChild == xChild )
{
+ ChildData* pRet = *it;
lst.erase( it );
- return *it;
+ return pRet;
}
}
return 0;
diff --git a/toolkit/source/layout/core/box-base.hxx b/toolkit/source/layout/core/box-base.hxx
index 4f50f55bf5c4..685e0e35e8b6 100644
--- a/toolkit/source/layout/core/box-base.hxx
+++ b/toolkit/source/layout/core/box-base.hxx
@@ -62,7 +62,7 @@ protected:
virtual ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ) = 0;
virtual ChildProps *createChildProps( ChildData* pData ) = 0;
- ChildData *removeChildData( std::list< ChildData *>, css::uno::Reference< css::awt::XLayoutConstrains > const& Child );
+ ChildData *removeChildData( std::list< ChildData *>&, css::uno::Reference< css::awt::XLayoutConstrains > const& Child );
public:
void AddChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child);
diff --git a/toolkit/src2xml/include.lst b/toolkit/src2xml/include.lst
index a93449625585..2bf5fced6fd3 100644
--- a/toolkit/src2xml/include.lst
+++ b/toolkit/src2xml/include.lst
@@ -106,7 +106,6 @@
../../basic/unxlngi6.pro/inc
../../boost/unxlngi6.pro/inc
../../XmlSearch/unxlngi6.pro/inc
-../../fondu/unxlngi6.pro/inc
../../forms/inc
../../forms/source/inc
../../forms/source/solar/inc
diff --git a/tools/Library_tl.mk b/tools/Library_tl.mk
index 2fc00ec68a8b..48abccd4bf85 100644
--- a/tools/Library_tl.mk
+++ b/tools/Library_tl.mk
@@ -90,6 +90,7 @@ $(eval $(call gb_Library_add_exception_objects,tl,\
tools/source/generic/poly2 \
tools/source/generic/svborder \
tools/source/generic/toolsin \
+ tools/source/generic/svlibrary \
tools/source/inet/inetmime \
tools/source/inet/inetmsg \
tools/source/inet/inetstrm \
diff --git a/tools/bootstrp/makefile.mk b/tools/bootstrp/makefile.mk
index 1d16ed2aeec2..3db493cbe162 100644
--- a/tools/bootstrp/makefile.mk
+++ b/tools/bootstrp/makefile.mk
@@ -38,6 +38,10 @@ LIBTARGET=NO
CDEFS+=-D_TOOLS_STRINGLIST
+.IF "$(HAVE_GETOPT)" == "YES"
+CDEFS += -DHAVE_GETOPT
+.ENDIF
+
# --- Files --------------------------------------------------------
OBJFILES= \
@@ -71,6 +75,11 @@ APP2TARGET= rscdep
APP2OBJS= $(OBJ)$/rscdep.obj
APP2LIBS= $(LB)$/$(TARGET).lib $(LB)$/$(TARGET1).lib
APP2STDLIBS= $(SALLIB) $(VOSLIB) $(TOOLSLIB) $(BASEGFXLIB) $(UCBHELPERLIB) $(CPPULIB) $(COMPHELPERLIB) $(I18NISOLANGLIB) $(CPPUHELPERLIB) $(SALHELPERLIB)
+.IF "$(HAVE_GETOPT)" != "YES"
+.IF "$(OS)"=="WNT"
+APP2STDLIBS+=gnu_getopt.lib
+.ENDIF
+.ENDIF
APP2RPATH= NONE
APP2RPATH= NONE
APP2RPATH= NONE
diff --git a/tools/bootstrp/rscdep.cxx b/tools/bootstrp/rscdep.cxx
index 35968654b5cd..37edfc6a8c18 100644
--- a/tools/bootstrp/rscdep.cxx
+++ b/tools/bootstrp/rscdep.cxx
@@ -36,6 +36,7 @@
#include <string.h>
#include "bootstrp/prj.hxx"
+#include "sal/main.h"
#include <tools/string.hxx>
#include <tools/list.hxx>
@@ -44,6 +45,16 @@
#include "cppdep.hxx"
+#if defined WNT
+#if !defined HAVE_GETOPT
+#define __STDC__ 1
+#define __GNU_LIBRARY__
+#include <external/glibc/getopt.h>
+#else
+#include <getopt.h>
+#endif
+#endif
+
class RscHrcDep : public CppDep
{
public:
@@ -69,21 +80,7 @@ void RscHrcDep::Execute()
//static String aDelim;
-/* poor man's getopt() */
-int simple_getopt(char *argv[], const char *optstring);
-#if defined(WNT) || defined(OS2)
-static char *optarg = NULL;
-static int optind = 1;
-static int optopt = 0;
-static int opterr = 0;
-#endif
-
-
-int
-#ifdef WNT
-_cdecl
-#endif
-main( int argc, char **argv )
+SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
{
int c;
char aBuf[255];
@@ -183,7 +180,7 @@ main( int argc, char **argv )
while( 1 )
{
- c = simple_getopt( argv,
+ c = getopt( argc, argv,
"_abcdefghi:jklmnopqrstuvwxyzABCDEFGHI:JKLMNOPQRSTUVWXYZ1234567890/-+=.\\()\"");
if ( c == -1 )
break;
@@ -300,41 +297,3 @@ main( int argc, char **argv )
return 0;
}
-/* my very simple minded implementation of getopt()
- * it's too sad that getopt() is not available everywhere
- * note: this is not a full POSIX conforming getopt()
- */
-int simple_getopt(char *argv[], const char *optstring)
-{
- char *arg = argv[optind];
-
- /* skip all response file arguments */
- if ( arg ) {
- while ( *arg == '@' )
- arg = argv[++optind];
-
- if ( arg[0] == '-' && arg[1] != '\0' ) {
- const char *popt;
- int c = arg[1];
- if ( (popt = strchr(optstring, c)) == NULL ) {
- optopt = c;
- if ( opterr )
- fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt);
- return '?';
- }
- if ( *(++popt) == ':') {
- if ( arg[2] != '\0' ) {
- optarg = ++arg;
- } else {
- optarg = argv[++optind];
- }
- } else {
- optarg = NULL;
- }
- ++optind;
- return c;
- }
- }
- return -1;
-}
-
diff --git a/tools/inc/tools/color.hxx b/tools/inc/tools/color.hxx
index 56d596453740..a99ad1dd11c4 100644
--- a/tools/inc/tools/color.hxx
+++ b/tools/inc/tools/color.hxx
@@ -78,7 +78,7 @@ typedef UINT32 ColorData;
#define COL_YELLOW RGB_COLORDATA( 0xFF, 0xFF, 0x00 )
#define COL_WHITE RGB_COLORDATA( 0xFF, 0xFF, 0xFF )
#define COL_TRANSPARENT TRGB_COLORDATA( 0xFF, 0xFF, 0xFF, 0xFF )
-#define COL_AUTO (UINT32)0xFFFFFFFF
+#define COL_AUTO (ColorData)0xFFFFFFFF
#define COL_AUTHOR1_DARK RGB_COLORDATA(198, 146, 0)
#define COL_AUTHOR1_NORMAL RGB_COLORDATA(255, 255, 158)
#define COL_AUTHOR1_LIGHT RGB_COLORDATA(255, 255, 195)
diff --git a/tools/inc/tools/debug.hxx b/tools/inc/tools/debug.hxx
index e764ed2fc79a..b8aa1c8b59fe 100644
--- a/tools/inc/tools/debug.hxx
+++ b/tools/inc/tools/debug.hxx
@@ -125,19 +125,18 @@ struct DbgDataType
#define DBG_FUNC_SAVEDATA 5
#define DBG_FUNC_SETPRINTMSGBOX 6
#define DBG_FUNC_SETPRINTWINDOW 7
-#define DBG_FUNC_SETPRINTSHELL 8
-#define DBG_FUNC_SETPRINTTESTTOOL 9
-#define DBG_FUNC_MEMTEST 10
-#define DBG_FUNC_XTORINFO 11
-#define DBG_FUNC_MEMINFO 12
-#define DBG_FUNC_COREDUMP 13
-#define DBG_FUNC_ALLERROROUT 14
-#define DBG_FUNC_SETTESTSOLARMUTEX 15
-#define DBG_FUNC_TESTSOLARMUTEX 16
-#define DBG_FUNC_PRINTFILE 17
-#define DBG_FUNC_GETPRINTMSGBOX 18
-#define DBG_FUNC_FILTERMESSAGE 19 // new for #i38967
-#define DBG_FUNC_UPDATEOSLHOOK 20
+#define DBG_FUNC_SETPRINTTESTTOOL 8
+#define DBG_FUNC_MEMTEST 9
+#define DBG_FUNC_XTORINFO 10
+#define DBG_FUNC_MEMINFO 11
+#define DBG_FUNC_COREDUMP 12
+#define DBG_FUNC_ALLERROROUT 13
+#define DBG_FUNC_SETTESTSOLARMUTEX 14
+#define DBG_FUNC_TESTSOLARMUTEX 15
+#define DBG_FUNC_PRINTFILE 16
+#define DBG_FUNC_GETPRINTMSGBOX 17
+#define DBG_FUNC_FILTERMESSAGE 18 // new for #i38967
+#define DBG_FUNC_UPDATEOSLHOOK 19
TOOLS_DLLPUBLIC void* DbgFunc( USHORT nAction, void* pData = NULL );
@@ -176,11 +175,6 @@ inline void DbgSetPrintWindow( DbgPrintLine pProc )
DbgFunc( DBG_FUNC_SETPRINTWINDOW, (void*)(long)pProc );
}
-inline void DbgSetPrintShell( DbgPrintLine pProc )
-{
- DbgFunc( DBG_FUNC_SETPRINTSHELL, (void*)(long)pProc );
-}
-
inline void DbgSetPrintTestTool( DbgPrintLine pProc )
{
DbgFunc( DBG_FUNC_SETPRINTTESTTOOL, (void*)(long)pProc );
@@ -344,6 +338,7 @@ void DbgPrintStackTree( void* p );
TOOLS_DLLPUBLIC void DbgOut( const sal_Char* pMsg, USHORT nOutType = DBG_OUT_TRACE,
const sal_Char* pFile = NULL, USHORT nLine = 0 );
+TOOLS_DLLPUBLIC void DbgPrintShell(char const * message);
TOOLS_DLLPUBLIC void DbgOutTypef( USHORT nOutType, const sal_Char* pFStr, ... );
TOOLS_DLLPUBLIC void DbgOutf( const sal_Char* pFStr, ... );
TOOLS_DLLPUBLIC void ImpDbgOutfBuf( sal_Char* pBuf, const sal_Char* pFStr, ... );
diff --git a/tools/inc/tools/diagnose_ex.h b/tools/inc/tools/diagnose_ex.h
index fac739b32583..b244d11dc305 100644
--- a/tools/inc/tools/diagnose_ex.h
+++ b/tools/inc/tools/diagnose_ex.h
@@ -130,6 +130,17 @@
#define ENSURE_OR_RETURN_FALSE(c, m) \
ENSURE_OR_RETURN(c, m, false)
+/** This macro asserts the given condition (in debug mode), and
+ returns afterwards, without return value "void".
+ */
+#define ENSURE_OR_RETURN_VOID( c, m ) \
+ if( !(c) ) \
+ { \
+ OSL_ENSURE( c, m ); \
+ return; \
+ }
+
+
/** This macro asserts the given condition (in debug mode), and
returns afterwards, without return value "void".
@@ -141,6 +152,24 @@
return; \
}
+/** asserts a given condition (in debug mode), and continues the most-inner
+ loop if the condition is not met
+*/
+#define ENSURE_OR_CONTINUE( c, m ) \
+ if ( !(c) ) \
+ { \
+ OSL_ENSURE( false, m ); \
+ continue; \
+ }
+/** asserts a given condition (in debug mode), and continues the most-inner
+ loop if the condition is not met
+*/
+#define ENSURE_OR_BREAK( c, m ) \
+ if ( !(c) ) \
+ { \
+ OSL_ENSURE( false, m ); \
+ break; \
+ }
#endif // TOOLS_DIAGNOSE_EX_H
diff --git a/tools/inc/tools/gen.hxx b/tools/inc/tools/gen.hxx
index 85da22126b77..308cc02165ce 100644
--- a/tools/inc/tools/gen.hxx
+++ b/tools/inc/tools/gen.hxx
@@ -420,6 +420,7 @@ public:
Point Center() const;
void Move( long nHorzMove, long nVertMove );
+ inline void Transpose();
inline void SetPos( const Point& rPoint );
void SetSize( const Size& rSize );
inline Size GetSize() const;
@@ -578,6 +579,20 @@ inline void Rectangle::Move( long nHorzMove, long nVertMove )
nBottom += nVertMove;
}
+void Rectangle::Transpose()
+{
+ if ( !IsEmpty() )
+ {
+ long swap( nLeft );
+ nLeft = nTop;
+ nTop = swap;
+
+ swap = nRight;
+ nRight = nBottom;
+ nBottom = swap;
+ }
+}
+
inline void Rectangle::SetPos( const Point& rPoint )
{
if ( nRight != RECT_EMPTY )
diff --git a/tools/inc/tools/postextstl.h b/tools/inc/tools/postextstl.h
new file mode 100644
index 000000000000..81a21e25c15b
--- /dev/null
+++ b/tools/inc/tools/postextstl.h
@@ -0,0 +1,36 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#ifdef std_was_redefined_as_stlport
+// put things back the way they were
+# define std std_was_redefined_as_stlport
+# undef _STLP_OUTERMOST_HEADER_ID
+// force config to be re-read
+# undef _STLP_NOTHROW_INHERENTLY
+# undef _STLP_CONFIG_H
+# include <stddef.h>
+#endif
diff --git a/tools/inc/tools/preextstl.h b/tools/inc/tools/preextstl.h
new file mode 100644
index 000000000000..27aed38686f0
--- /dev/null
+++ b/tools/inc/tools/preextstl.h
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+//1. Force inclusion of a std:: using header to ensure the stlport define
+//of std as "stlport"
+#include <algorithm>
+#if defined(ADAPT_EXT_STL)
+//2. Force inclusion of stlport headers to get their stlport:: definitions
+# include <ostream>
+# include <istream>
+# include <fstream>
+# include <iostream>
+# include <vector>
+# include <list>
+# include <map>
+//3. Now force inclusion of native headers to get their std:: definitions
+# if defined(std)
+# define std_was_redefined_as_stlport std
+# undef std
+# define _STLP_OUTERMOST_HEADER_ID 0xdeadbeaf
+# if defined(_GNUC__)
+# pragma GCC visibility push(default)
+# endif
+# include _STLP_NATIVE_HEADER(exception_defines.h)
+# include _STLP_NATIVE_HEADER(limits)
+# include _STLP_NATIVE_HEADER(memory)
+# include _STLP_NATIVE_HEADER(exception)
+# include _STLP_NATIVE_HEADER(iosfwd)
+# include _STLP_NATIVE_HEADER(algorithm)
+# include _STLP_NATIVE_HEADER(string)
+# include _STLP_NATIVE_HEADER(streambuf)
+# include _STLP_NATIVE_HEADER(ios)
+# include _STLP_NATIVE_HEADER(locale)
+# include _STLP_NATIVE_HEADER(stdexcept)
+# include _STLP_NATIVE_HEADER(ostream)
+# include _STLP_NATIVE_HEADER(istream)
+# include _STLP_NATIVE_HEADER(iostream)
+# include _STLP_NATIVE_HEADER(vector)
+# include _STLP_NATIVE_HEADER(list)
+# include _STLP_NATIVE_HEADER(map)
+# if defined(_GNUC__)
+# pragma GCC visibility pop
+# endif
+# endif
+#endif
+//ext_std resolves to the std that external c++ libs, e.g. Graphite were built
+//against regardless of whether that is stlport or system stl
+namespace ext_std = std;
diff --git a/tools/inc/tools/solar.h b/tools/inc/tools/solar.h
index 1d248853f895..096d34d05b9e 100644
--- a/tools/inc/tools/solar.h
+++ b/tools/inc/tools/solar.h
@@ -122,23 +122,13 @@ typedef BYTE SVBT64[8];
#ifdef __cplusplus
inline BYTE SVBT8ToByte ( const SVBT8 p ) { return p[0]; }
-#if defined OSL_LITENDIAN && SAL_TYPES_ALIGNMENT2 == 1
-inline USHORT SVBT16ToShort( const SVBT16 p ) { return *(USHORT*)p; }
-#else
inline USHORT SVBT16ToShort( const SVBT16 p ) { return (USHORT)p[0]
+ ((USHORT)p[1] << 8); }
-#endif
-#if defined OSL_LITENDIAN && SAL_TYPES_ALIGNMENT4 == 1
-inline sal_uInt32 SVBT32ToUInt32 ( const SVBT32 p ) { return *(sal_uInt32*)p; }
-#else
inline sal_uInt32 SVBT32ToUInt32 ( const SVBT32 p ) { return (sal_uInt32)p[0]
+ ((sal_uInt32)p[1] << 8)
+ ((sal_uInt32)p[2] << 16)
+ ((sal_uInt32)p[3] << 24); }
-#endif
-#if defined OSL_LITENDIAN && SAL_TYPES_ALIGNMENT8 == 1
-inline double SVBT64ToDouble( const SVBT64 p ) { return *(double*)p; }
-#elif defined OSL_LITENDIAN
+#if defined OSL_LITENDIAN
inline double SVBT64ToDouble( const SVBT64 p ) { double n;
((BYTE*)&n)[0] = p[0];
((BYTE*)&n)[1] = p[1];
@@ -163,23 +153,13 @@ inline double SVBT64ToDouble( const SVBT64 p ) { double n;
#endif
inline void ByteToSVBT8 ( BYTE n, SVBT8 p ) { p[0] = n; }
-#if defined OSL_LITENDIAN && SAL_TYPES_ALIGNMENT2 == 1
-inline void ShortToSVBT16( USHORT n, SVBT16 p ) { *(USHORT*)p = n; }
-#else
inline void ShortToSVBT16( USHORT n, SVBT16 p ) { p[0] = (BYTE) n;
p[1] = (BYTE)(n >> 8); }
-#endif
-#if defined OSL_LITENDIAN && SAL_TYPES_ALIGNMENT4 == 1
-inline void UInt32ToSVBT32 ( sal_uInt32 n, SVBT32 p ) { *(sal_uInt32*)p = n; }
-#else
inline void UInt32ToSVBT32 ( sal_uInt32 n, SVBT32 p ) { p[0] = (BYTE) n;
p[1] = (BYTE)(n >> 8);
p[2] = (BYTE)(n >> 16);
p[3] = (BYTE)(n >> 24); }
-#endif
-#if defined OSL_LITENDIAN && SAL_TYPES_ALIGNMENT8 == 1
-inline void DoubleToSVBT64( double n, SVBT64 p ) { *(double*)p = n; }
-#elif defined OSL_LITENDIAN
+#if defined OSL_LITENDIAN
inline void DoubleToSVBT64( double n, SVBT64 p ) { p[0] = ((BYTE*)&n)[0];
p[1] = ((BYTE*)&n)[1];
p[2] = ((BYTE*)&n)[2];
@@ -384,6 +364,8 @@ template<typename T> inline T Abs(T a) { return (a>=0?a:-a); }
#define __DLLEXTENSION "lm.so"
#elif defined LINUX && defined HPPA
#define __DLLEXTENSION "lh.so"
+#elif defined LINUX && defined AXP
+ #define __DLLEXTENSION "ll.so"
#elif defined LINUX
#error unknown plattform
#elif defined FREEBSD && defined X86
diff --git a/tools/inc/tools/svborder.hxx b/tools/inc/tools/svborder.hxx
index 9523a71a060f..a0509bcc89be 100644
--- a/tools/inc/tools/svborder.hxx
+++ b/tools/inc/tools/svborder.hxx
@@ -49,6 +49,14 @@ public:
}
BOOL operator != ( const SvBorder & rObj ) const
{ return !(*this == rObj); }
+ SvBorder & operator = ( const SvBorder & rBorder )
+ {
+ Left() = rBorder.Left();
+ Top() = rBorder.Top();
+ Right() = rBorder.Right();
+ Bottom() = rBorder.Bottom();
+ return *this;
+ }
SvBorder & operator += ( const SvBorder & rBorder )
{
Left() += rBorder.Left();
diff --git a/svtools/source/uno/unoifac2.hrc b/tools/inc/tools/svlibrary.hxx
index a31d07e0bd27..fa8ff7c8068b 100644
--- a/svtools/source/uno/unoifac2.hrc
+++ b/tools/inc/tools/svlibrary.hxx
@@ -24,29 +24,19 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+#ifndef _SVLIBRARY_HXX
+#define _SVLIBRARY_HXX
-#ifndef _SVT_UNO_UNOIFAC_HRC_
-#define _SVT_UNO_UNOIFAC_HRC_
+#include "tools/toolsdllapi.h"
+#include <osl/module.hxx>
+#include <rtl/ustring.hxx>
-#ifndef _SOLAR_HRC
-#include <svl/solar.hrc>
-#endif
-
-//! Um den Überblick über alle benutzten HelpID's zu behalten sind diese
-//! zentral in <helpid.hrc>
-#ifndef _SVT_HELPID_HRC
-#include <svtools/helpid.hrc>
-#endif
-
-// RID's fuer das Kontextmenu der Textkomponente
-#define RID_CONTEXTMENU (RID_APP_START + 1024)
-#define RID_OPEN_LINK (RID_APP_START + 10)
-#define RID_OPEN_LINK_NEW (RID_APP_START + 11)
-#define RID_DOWNLOAD (RID_APP_START + 12)
-#define RID_ADD_BOOKMARK (RID_APP_START + 13)
-#define RID_COPY_LINK (RID_APP_START + 14)
-
+class TOOLS_DLLPUBLIC SvLibrary
+{
+public:
+ static bool LoadModule( osl::Module&, const rtl::OUString& rLibName, ::oslGenericFunction baseModule, ::sal_Int32 mode = SAL_LOADMODULE_DEFAULT );
+};
#endif
diff --git a/tools/inc/tools/urlobj.hxx b/tools/inc/tools/urlobj.hxx
index 86a8114ab0b8..17d52432e206 100644
--- a/tools/inc/tools/urlobj.hxx
+++ b/tools/inc/tools/urlobj.hxx
@@ -125,22 +125,21 @@ enum INetProtocol
INET_PROT_DATA = 15,
INET_PROT_CID = 16,
INET_PROT_OUT = 17,
- INET_PROT_VND_SUN_STAR_WFS = 18,
- INET_PROT_VND_SUN_STAR_HIER = 19,
- INET_PROT_VIM = 20,
- INET_PROT_UNO = 21,
- INET_PROT_COMPONENT = 22,
- INET_PROT_VND_SUN_STAR_PKG = 23,
- INET_PROT_LDAP = 24,
- INET_PROT_DB = 25,
- INET_PROT_VND_SUN_STAR_CMD = 26,
- INET_PROT_VND_SUN_STAR_ODMA = 27,
- INET_PROT_TELNET = 28,
- INET_PROT_VND_SUN_STAR_EXPAND = 29,
- INET_PROT_VND_SUN_STAR_TDOC = 30,
- INET_PROT_GENERIC = 31,
- INET_PROT_SMB = 32,
- INET_PROT_END = 33
+ INET_PROT_VND_SUN_STAR_HIER = 18,
+ INET_PROT_VIM = 19,
+ INET_PROT_UNO = 20,
+ INET_PROT_COMPONENT = 21,
+ INET_PROT_VND_SUN_STAR_PKG = 22,
+ INET_PROT_LDAP = 23,
+ INET_PROT_DB = 24,
+ INET_PROT_VND_SUN_STAR_CMD = 25,
+ INET_PROT_VND_SUN_STAR_ODMA = 26,
+ INET_PROT_TELNET = 27,
+ INET_PROT_VND_SUN_STAR_EXPAND = 28,
+ INET_PROT_VND_SUN_STAR_TDOC = 29,
+ INET_PROT_GENERIC = 30,
+ INET_PROT_SMB = 31,
+ INET_PROT_END = 32
};
//============================================================================
diff --git a/tools/inc/tools/wintypes.hxx b/tools/inc/tools/wintypes.hxx
index 8f13af8fd842..7d6296b76e8c 100644
--- a/tools/inc/tools/wintypes.hxx
+++ b/tools/inc/tools/wintypes.hxx
@@ -215,6 +215,7 @@ typedef sal_Int64 WinBits;
// Window-Bits for CheckBox
#define WB_CBLINESTYLE ((WinBits)SAL_CONST_INT64(0x2000000000))
+#define WB_EARLYTOGGLE ((WinBits)SAL_CONST_INT64(0x4000000000))
// Window-Bits for Edit
#define WB_PASSWORD ((WinBits)0x01000000)
diff --git a/tools/qa/makefile.mk b/tools/qa/makefile.mk
index 66ed19e20737..abaea848c1db 100644
--- a/tools/qa/makefile.mk
+++ b/tools/qa/makefile.mk
@@ -32,6 +32,7 @@ ENABLE_EXCEPTIONS = TRUE
.INCLUDE: settings.mk
+CFLAGSCXX += $(CPPUNIT_CFLAGS)
DLLPRE = # no leading "lib" on .so files
SHL1TARGET = test_pathutils
diff --git a/tools/source/debug/debug.cxx b/tools/source/debug/debug.cxx
index 62f36e662ea9..e17457c60525 100644
--- a/tools/source/debug/debug.cxx
+++ b/tools/source/debug/debug.cxx
@@ -151,7 +151,6 @@ struct DebugData
USHORT bInit;
DbgPrintLine pDbgPrintMsgBox;
DbgPrintLine pDbgPrintWindow;
- DbgPrintLine pDbgPrintShell;
DbgPrintLine pDbgPrintTestTool;
::std::vector< DbgPrintLine >
aDbgPrintUserChannels;
@@ -166,7 +165,6 @@ struct DebugData
:bInit( FALSE )
,pDbgPrintMsgBox( FALSE )
,pDbgPrintWindow( NULL )
- ,pDbgPrintShell( NULL )
,pDbgPrintTestTool( NULL )
,pProfList( NULL )
,pXtorList( NULL )
@@ -1037,9 +1035,7 @@ static void DebugDeInit()
pData->aDbgData.nTestFlags &= (DBG_TEST_MEM | DBG_TEST_PROFILING);
pData->aDbgPrintUserChannels.clear();
pData->pDbgPrintTestTool = NULL;
- pData->pDbgPrintShell = NULL;
pData->pDbgPrintWindow = NULL;
- pData->pDbgPrintShell = NULL;
pData->pOldDebugMessageFunc = NULL;
ImplDbgDeInitLock();
}
@@ -1199,10 +1195,6 @@ void* DbgFunc( USHORT nAction, void* pParam )
pDebugData->pDbgPrintWindow = (DbgPrintLine)(long)pParam;
break;
- case DBG_FUNC_SETPRINTSHELL:
- pDebugData->pDbgPrintShell = (DbgPrintLine)(long)pParam;
- break;
-
case DBG_FUNC_SETPRINTTESTTOOL:
pDebugData->pDbgPrintTestTool = (DbgPrintLine)(long)pParam;
break;
@@ -1739,14 +1731,6 @@ void DbgOut( const sal_Char* pMsg, USHORT nDbgOut, const sal_Char* pFile, USHORT
if ( pData->pDbgPrintMsgBox )
pData->pDbgPrintMsgBox( aBufOut );
else
- nOut = DBG_OUT_SHELL;
- }
-
- if ( nOut == DBG_OUT_SHELL )
- {
- if ( pData->pDbgPrintShell )
- pData->pDbgPrintShell( aBufOut );
- else
nOut = DBG_OUT_WINDOW;
}
@@ -1758,14 +1742,28 @@ void DbgOut( const sal_Char* pMsg, USHORT nDbgOut, const sal_Char* pFile, USHORT
nOut = DBG_OUT_FILE;
}
- if ( nOut == DBG_OUT_FILE )
+ switch ( nOut )
+ {
+ case DBG_OUT_SHELL:
+ DbgPrintShell( aBufOut );
+ break;
+ case DBG_OUT_FILE:
ImplDbgPrintFile( aBufOut );
+ break;
+ }
ImplDbgUnlock();
bIn = FALSE;
}
+void DbgPrintShell(char const * message) {
+ fprintf(stderr, "%s\n", message);
+#if defined WNT
+ OutputDebugStringA(message);
+#endif
+}
+
// -----------------------------------------------------------------------
void DbgOutTypef( USHORT nDbgOut, const sal_Char* pFStr, ... )
diff --git a/tools/source/fsys/tdir.cxx b/tools/source/fsys/tdir.cxx
index 429835d35ab3..b6bf48a8cdf9 100644
--- a/tools/source/fsys/tdir.cxx
+++ b/tools/source/fsys/tdir.cxx
@@ -266,7 +266,7 @@ void Dir::Construct( DirEntryKind nKindFlags )
strcpy( pBuffer, aTStr.GetBuffer() );
CharLowerBuff( pBuffer, aTStr.Len() );
aNameMask = WildCard( String(pBuffer, osl_getThreadTextEncoding()), ';' );
- delete pBuffer;
+ delete [] pBuffer;
}
#else
aNameMask = WildCard( CutName(), ';' );
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index 07c532e60dd7..a6d7bc6fd04e 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -191,11 +191,6 @@ using namespace com::sun;
name = *(escaped / alphanum / "!" / "$" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / ":" / ";" / "=" / "?" / "@" / "_" / "~"
- ; prvate (see RFC 1738, RFC 2396)
- vnd-sun-star-wfs-url = "VND.SUN.STAR.WFS://" [host / "LOCALHOST"] ["/" segment *("/" segment)]
- segment = *pchar
-
-
; private
vnd-sun-star-hier-url = "VND.SUN.STAR.HIER:" ["//"reg_name] *("/" *pchar)
reg_name = 1*(escaped / alphanum / "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / ":" / ";" / "=" / "@" / "_" / "~")
@@ -403,8 +398,6 @@ static INetURLObject::SchemeInfo const aSchemeInfoMap[INET_PROT_END]
false, false },
{ "out", "out://", 0, true, false, false, false, false, false,
false, false },
- { "vnd.sun.star.wfs", "vnd.sun.star.wfs://", 0, true, false, false,
- false, true, true, true, false },
{ "vnd.sun.star.hier", "vnd.sun.star.hier:", 0, true, false, false,
false, false, false, true, false },
{ "vim", "vim://", 0, true, true, false, true, false, false, true,
@@ -429,7 +422,7 @@ static INetURLObject::SchemeInfo const aSchemeInfoMap[INET_PROT_END]
false, false, false, false, false },
{ "vnd.sun.star.tdoc", "vnd.sun.star.tdoc:", 0, false, false, false,
false, false, false, true, false },
- { "", "", 0, false, false, false, false, false, false, false, false },
+ { "", "", 0, false, false, false, false, true, true, true, false },
{ "smb", "smb://", 139, true, true, false, true, true, true, true,
true } };
@@ -1338,7 +1331,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef,
if (pHostPortBegin)
{
sal_Unicode const * pPort = pHostPortEnd;
- if (getSchemeInfo().m_bPort && pHostPortBegin < pHostPortEnd)
+ if ( getSchemeInfo().m_bPort && pHostPortBegin < pHostPortEnd )
{
sal_Unicode const * p1 = pHostPortEnd - 1;
while (p1 > pHostPortBegin && INetMIME::isDigit(*p1))
@@ -1350,7 +1343,6 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef,
switch (m_eScheme)
{
case INET_PROT_FILE:
- case INET_PROT_VND_SUN_STAR_WFS:
// If the host equals "LOCALHOST" (unencoded and ignoring
// case), turn it into an empty host:
if (INetMIME::equalIgnoreCase(pHostPortBegin, pPort,
@@ -1367,7 +1359,6 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef,
return false;
}
break;
-
default:
if (pHostPortBegin == pPort)
{
@@ -1609,7 +1600,23 @@ bool INetURLObject::convertRelToAbs(rtl::OUString const & rTheRelURIRef,
STATE_DONE };
rtl::OUStringBuffer aSynAbsURIRef;
- aSynAbsURIRef.appendAscii(getSchemeInfo().m_pScheme);
+ // make sure that the scheme is copied for generic schemes: getSchemeInfo().m_pScheme
+ // is empty ("") in that case, so take the scheme from m_aAbsURIRef
+ if (m_eScheme != INET_PROT_GENERIC)
+ {
+ aSynAbsURIRef.appendAscii(getSchemeInfo().m_pScheme);
+ }
+ else
+ {
+ sal_Unicode const * pSchemeBegin
+ = m_aAbsURIRef.getStr();
+ sal_Unicode const * pSchemeEnd = pSchemeBegin;
+ while (pSchemeEnd[0] != ':')
+ {
+ ++pSchemeEnd;
+ }
+ aSynAbsURIRef.append(pSchemeBegin, pSchemeEnd - pSchemeBegin);
+ }
aSynAbsURIRef.append(sal_Unicode(':'));
sal_Char cEscapePrefix = getEscapePrefix();
@@ -2162,11 +2169,7 @@ INetURLObject::getPrefix(sal_Unicode const *& rBegin,
{ "vnd.sun.star.tdoc:", 0, INET_PROT_VND_SUN_STAR_TDOC,
PrefixInfo::OFFICIAL },
{ "vnd.sun.star.webdav:", 0, INET_PROT_VND_SUN_STAR_WEBDAV,
- PrefixInfo::OFFICIAL },
- { "vnd.sun.star.wfs:", 0, INET_PROT_VND_SUN_STAR_WFS,
- PrefixInfo::OFFICIAL },
- { "wfs:", "vnd.sun.star.wfs:", INET_PROT_VND_SUN_STAR_WFS,
- PrefixInfo::ALIAS } };
+ PrefixInfo::OFFICIAL } };
PrefixInfo const * pFirst = aMap + 1;
PrefixInfo const * pLast = aMap + sizeof aMap / sizeof (PrefixInfo) - 1;
PrefixInfo const * pMatch = 0;
@@ -2889,7 +2892,6 @@ bool INetURLObject::setHost(rtl::OUString const & rTheHost, bool bOctets,
switch (m_eScheme)
{
case INET_PROT_FILE:
- case INET_PROT_VND_SUN_STAR_WFS:
{
rtl::OUString sTemp(aSynHost);
if (sTemp.equalsIgnoreAsciiCaseAsciiL(
@@ -2985,7 +2987,6 @@ bool INetURLObject::parsePath(INetProtocol eScheme,
break;
case INET_PROT_FILE:
- case INET_PROT_VND_SUN_STAR_WFS:
{
if (bSkippedInitialSlash)
aTheSynPath.append(sal_Unicode('/'));
@@ -3398,7 +3399,6 @@ bool INetURLObject::parsePath(INetProtocol eScheme,
if (aTheSynPath.getLength() == 0)
return false;
break;
-
default:
OSL_ASSERT(false);
break;
@@ -3825,7 +3825,27 @@ INetURLObject::getAbbreviated(
OSL_ENSURE(rStringWidth.is(), "specification violation");
sal_Char cEscapePrefix = getEscapePrefix();
rtl::OUStringBuffer aBuffer;
- aBuffer.appendAscii(getSchemeInfo().m_pScheme);
+ // make sure that the scheme is copied for generic schemes: getSchemeInfo().m_pScheme
+ // is empty ("") in that case, so take the scheme from m_aAbsURIRef
+ if (m_eScheme != INET_PROT_GENERIC)
+ {
+ aBuffer.appendAscii(getSchemeInfo().m_pScheme);
+ }
+ else
+ {
+ if (m_aAbsURIRef)
+ {
+ sal_Unicode const * pSchemeBegin
+ = m_aAbsURIRef.getStr();
+ sal_Unicode const * pSchemeEnd = pSchemeBegin;
+
+ while (pSchemeEnd[0] != ':')
+ {
+ ++pSchemeEnd;
+ }
+ aBuffer.append(pSchemeBegin, pSchemeEnd - pSchemeBegin);
+ }
+ }
aBuffer.append(static_cast< sal_Unicode >(':'));
bool bAuthority = getSchemeInfo().m_bAuthority;
sal_Unicode const * pCoreBegin
@@ -4007,7 +4027,6 @@ bool INetURLObject::operator ==(INetURLObject const & rObject) const
switch (m_eScheme)
{
case INET_PROT_FILE:
- case INET_PROT_VND_SUN_STAR_WFS:
{
// If the URL paths of two file URLs only differ in that one has a
// final '/' and the other has not, take the two paths as
@@ -4162,7 +4181,6 @@ bool INetURLObject::ConcatData(INetProtocol eTheScheme,
switch (m_eScheme)
{
case INET_PROT_FILE:
- case INET_PROT_VND_SUN_STAR_WFS:
{
rtl::OUString sTemp(aSynHost);
if (sTemp.equalsIgnoreAsciiCaseAsciiL(
diff --git a/tools/source/generic/makefile.mk b/tools/source/generic/makefile.mk
index 5cdaa02065ae..07bab82f32b0 100644
--- a/tools/source/generic/makefile.mk
+++ b/tools/source/generic/makefile.mk
@@ -37,9 +37,10 @@ TARGET=gen
# --- Files --------------------------------------------------------
-EXCEPTIONSFILES = $(SLO)$/poly.obj $(OBJ)$/poly.obj
+EXCEPTIONSFILES = $(SLO)$/poly.obj $(OBJ)$/poly.obj $(SLO)$/svlibrary.obj
SLOFILES= $(SLO)$/toolsin.obj \
+ $(SLO)$/svlibrary.obj \
$(SLO)$/b3dtrans.obj \
$(SLO)$/link.obj \
$(SLO)$/bigint.obj \
diff --git a/tools/source/generic/svlibrary.cxx b/tools/source/generic/svlibrary.cxx
new file mode 100644
index 000000000000..6ebfd0086b5c
--- /dev/null
+++ b/tools/source/generic/svlibrary.cxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * 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_tools.hxx"
+
+#include <tools/svlibrary.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/util/XMacroExpander.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <comphelper/processfactory.hxx>
+#include <tools/string.hxx>
+#include <rtl/uri.hxx>
+
+using namespace com::sun::star;
+
+static uno::Sequence< rtl::OUString > GetMultiPaths_Impl()
+{
+ uno::Sequence< rtl::OUString > aRes;
+ uno::Sequence< rtl::OUString > aInternalPaths;
+ uno::Sequence< rtl::OUString > aUserPaths;
+
+ bool bSuccess = true;
+ uno::Reference< lang::XMultiServiceFactory > xMgr( comphelper::getProcessServiceFactory() );
+ if (xMgr.is())
+ {
+ try
+ {
+ String aInternal;
+ aInternal.AppendAscii("Libraries");
+ String aUser;
+ aUser.AppendAscii("Libraries");
+ aInternal .AppendAscii( "_internal" );
+ aUser .AppendAscii( "_user" );
+
+ uno::Reference< beans::XPropertySet > xPathSettings( xMgr->createInstance(
+ rtl::OUString::createFromAscii( "com.sun.star.util.PathSettings" ) ), uno::UNO_QUERY_THROW );
+ xPathSettings->getPropertyValue( aInternal ) >>= aInternalPaths;
+ xPathSettings->getPropertyValue( aUser ) >>= aUserPaths;
+ }
+ catch (uno::Exception &)
+ {
+ bSuccess = false;
+ }
+ }
+ if (bSuccess)
+ {
+ sal_Int32 nMaxEntries = aInternalPaths.getLength() + aUserPaths.getLength();
+ aRes.realloc( nMaxEntries );
+ rtl::OUString *pRes = aRes.getArray();
+ sal_Int32 nCount = 0; // number of actually added entries
+ for (int i = 0; i < 2; ++i)
+ {
+ const uno::Sequence< rtl::OUString > &rPathSeq = i == 0 ? aUserPaths : aInternalPaths;
+ const rtl::OUString *pPathSeq = rPathSeq.getConstArray();
+ for (sal_Int32 k = 0; k < rPathSeq.getLength(); ++k)
+ {
+ const bool bAddUser = (&rPathSeq == &aUserPaths);
+ const bool bAddInternal = (&rPathSeq == &aInternalPaths);
+ if ((bAddUser || bAddInternal) && pPathSeq[k].getLength() > 0)
+ pRes[ nCount++ ] = pPathSeq[k];
+ }
+ }
+ aRes.realloc( nCount );
+ }
+
+ return aRes;
+}
+
+bool SvLibrary::LoadModule( osl::Module& rModule, const rtl::OUString& rLibName, ::oslGenericFunction baseModule, ::sal_Int32 mode )
+{
+ static uno::Sequence < rtl::OUString > aPaths = GetMultiPaths_Impl();
+ bool bLoaded = false;
+
+ for (sal_Int32 n=0; n<aPaths.getLength(); n++)
+ {
+ rtl::OUString aMod = aPaths[n];
+ if ( aPaths[n].indexOfAsciiL("vnd.sun.star.expand",19) == 0)
+ {
+ uno::Reference< uno::XComponentContext > xComponentContext = comphelper::getProcessComponentContext();
+ uno::Reference< util::XMacroExpander > xMacroExpander;
+ xComponentContext->getValueByName(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.util.theMacroExpander") ) )
+ >>= xMacroExpander;
+
+ aMod = aMod.copy( sizeof("vnd.sun.star.expand:") -1 );
+ aMod = ::rtl::Uri::decode( aMod, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
+ aMod = xMacroExpander->expandMacros( aMod );
+ }
+
+ aMod += ::rtl::OUString( sal_Unicode('/') );
+ aMod += rLibName;
+ bLoaded = rModule.load( aMod, mode );
+ if ( bLoaded )
+ break;
+ }
+
+ if (!bLoaded )
+ bLoaded = rModule.loadRelative( baseModule, rLibName, mode );
+
+ return bLoaded;
+}
diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx
index 8a3504a417c0..88ccb2113e0d 100644
--- a/tools/source/stream/strmunx.cxx
+++ b/tools/source/stream/strmunx.cxx
@@ -91,7 +91,7 @@ InternalStreamLock::InternalStreamLock(
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "locked %s", aFileName.GetBuffer() );
if( m_nStartPos || m_nEndPos )
- fprintf(stderr, " [ %d ... %d ]", m_nStartPos, m_nEndPos );
+ fprintf(stderr, " [ %ld ... %ld ]", m_nStartPos, m_nEndPos );
fprintf( stderr, "\n" );
#endif
}
@@ -103,7 +103,7 @@ InternalStreamLock::~InternalStreamLock()
ByteString aFileName(m_pStream->GetFileName(), osl_getThreadTextEncoding());
fprintf( stderr, "unlocked %s", aFileName.GetBuffer() );
if( m_nStartPos || m_nEndPos )
- fprintf(stderr, " [ %d ... %d ]", m_nStartPos, m_nEndPos );
+ fprintf(stderr, " [ %ld ... %ld ]", m_nStartPos, m_nEndPos );
fprintf( stderr, "\n" );
#endif
}
@@ -209,7 +209,7 @@ static sal_uInt32 GetSvError( int nErrno )
{ 0, SVSTREAM_OK },
{ EACCES, SVSTREAM_ACCESS_DENIED },
{ EBADF, SVSTREAM_INVALID_HANDLE },
-#if defined( RS6000 ) || defined( ALPHA ) || defined( HP9000 ) || defined( NETBSD ) || defined(FREEBSD) || defined(MACOSX)
+#if defined( RS6000 ) || defined( ALPHA ) || defined( HP9000 ) || defined( NETBSD ) || defined(FREEBSD) || defined(MACOSX) || defined(__FreeBSD_kernel__)
{ EDEADLK, SVSTREAM_LOCKING_VIOLATION },
#else
{ EDEADLOCK, SVSTREAM_LOCKING_VIOLATION },
@@ -223,7 +223,7 @@ static sal_uInt32 GetSvError( int nErrno )
{ EAGAIN, SVSTREAM_LOCKING_VIOLATION },
{ EISDIR, SVSTREAM_PATH_NOT_FOUND },
{ ELOOP, SVSTREAM_PATH_NOT_FOUND },
-#if ! defined( RS6000 ) && ! defined( ALPHA ) && ! defined( NETBSD ) && ! defined (FREEBSD) && ! defined (MACOSX)
+#if ! defined( RS6000 ) && ! defined( ALPHA ) && ! defined( NETBSD ) && ! defined (FREEBSD) && ! defined (MACOSX) && ! defined(__FreeBSD_kernel__)
{ EMULTIHOP, SVSTREAM_PATH_NOT_FOUND },
{ ENOLINK, SVSTREAM_PATH_NOT_FOUND },
#endif
@@ -514,7 +514,7 @@ sal_Bool SvFileStream::LockRange( sal_Size nByteOffset, sal_Size nBytes )
if( ! InternalStreamLock::LockFile( nByteOffset, nByteOffset+nBytes, this ) )
{
#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "InternalLock on %s [ %d ... %d ] failed\n",
+ fprintf( stderr, "InternalLock on %s [ %ld ... %ld ] failed\n",
ByteString(aFilename, osl_getThreadTextEncoding()).GetBuffer(), nByteOffset, nByteOffset+nBytes );
#endif
return sal_False;
diff --git a/tools/test/export.map b/tools/test/export.map
index 709047ae63e5..7321bbca16ad 100644
--- a/tools/test/export.map
+++ b/tools/test/export.map
@@ -25,7 +25,7 @@
#
#*************************************************************************
-UDK_3.1 {
+UDK_3_0_0 {
global:
registerAllTestFunction;
diff --git a/tools/test/makefile.mk b/tools/test/makefile.mk
index 5dea8ce6f960..ab2cfd8e6676 100644
--- a/tools/test/makefile.mk
+++ b/tools/test/makefile.mk
@@ -36,6 +36,8 @@ ENABLE_EXCEPTIONS=TRUE
.INCLUDE : settings.mk
+CFLAGSCXX += $(CPPUNIT_CFLAGS)
+
# --- Common ----------------------------------------------------------
SHL1OBJS= \
diff --git a/tools/workben/urltest.cxx b/tools/workben/urltest.cxx
index 694698297680..0930dfcc5239 100644
--- a/tools/workben/urltest.cxx
+++ b/tools/workben/urltest.cxx
@@ -523,6 +523,8 @@ main()
/*TODO "vnd.sun.star.wfs:///c|/xyz/",*/
/*TODO "vnd.sun.star.wfs://xxx/yyy?zzz",*/
"vnd.sun.star.wfs:///x/y/z",
+ "vnd.sun.star.generic:///x/y/z",
+ "vnd.sun.star.generic://host:34/x/y/z"
/*TODO "wfs://",*/
/*TODO "wfs://LocalHost",*/
/*TODO "wfs:///c|/xyz/",*/
@@ -533,13 +535,21 @@ main()
INetURLObject aUrl(aTest[i]);
if (aUrl.HasError())
printf("BAD %s\n", aTest[i]);
- else if (aUrl.GetMainURL(INetURLObject::DECODE_TO_IURI).
- equalsAscii(aTest[i]) != sal_True)
+ else
{
+ if (aUrl.GetProtocol() != INET_PROT_GENERIC) {
+ printf("BAD PROTOCOL %i -> %i\n",
+ aUrl.GetProtocol(),
+ INET_PROT_GENERIC);
+ }
+ if (aUrl.GetMainURL(INetURLObject::DECODE_TO_IURI).
+ equalsAscii(aTest[i]) != sal_True)
+ {
String sTest(aUrl.GetMainURL(INetURLObject::DECODE_TO_IURI));
printf("BAD %s -> %s\n",
aTest[i],
ByteString(sTest, RTL_TEXTENCODING_ASCII_US).GetBuffer());
+ }
}
}
}
diff --git a/transex3/java/jpropex/build.xml b/transex3/java/jpropex/build.xml
new file mode 100755
index 000000000000..d74fb3975d0f
--- /dev/null
+++ b/transex3/java/jpropex/build.xml
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project name="jpropex" default="main" basedir=".">
+
+ <!-- ================================================================= -->
+ <!-- settings -->
+ <!-- ================================================================= -->
+
+ <!-- name of this sub target used in recursive builds -->
+ <property name="target" value="jpropex"/>
+
+ <!-- name of jar file created, without .jar extension -->
+ <property name="jarname" value="jpropex"/>
+
+ <!-- relative path to project directory -->
+ <property name="prj" value="."/>
+
+ <!-- build output directory -->
+ <property name="out" value="build"/>
+
+ <!-- build directories -->
+ <property name="build.dir" value="${out}"/>
+ <property name="build.class" value="${build.dir}/class/jpropex"/>
+ <property name="build.misc" value="${build.dir}/misc/jpropex"/>
+
+ <!-- start of java source code package structure -->
+ <property name="java.dir" value="java"/>
+
+ <!-- define how to handle CLASSPATH environment -->
+ <property name="build.sysclasspath" value="ignore"/>
+
+ <!-- classpath settings for compile and javadoc tasks -->
+ <path id="classpath">
+ <pathelement location="."/>
+ <pathelement location="${build.class}"/>
+ </path>
+
+ <!-- name to display in documentation -->
+ <!-- <property name="docname" value="l10n converter"/> -->
+
+ <!-- set "modern" java compiler -->
+ <property name="build.compiler" value="modern"/>
+
+ <!-- set wether we want to compile with debug information -->
+ <property name="debug" value="on"/>
+
+ <!-- set wether we want to compile with optimisation -->
+ <property name="optimize" value="off"/>
+
+ <!-- set wether we want to compile with or without deprecation -->
+ <property name="deprecation" value="on"/>
+
+ <target name="info">
+ <echo message="--------------------"/>
+ <echo message="${target}"/>
+ <echo message="--------------------"/>
+ </target>
+
+ <!-- ================================================================= -->
+ <!-- custom targets -->
+ <!-- ================================================================= -->
+
+ <!-- the main target, called in recursive builds -->
+ <target name="main" depends="info,prepare,compile,jar"/>
+
+ <!-- prepare output directories -->
+ <target name="prepare">
+ <mkdir dir="${build.dir}"/>
+ <mkdir dir="${build.class}"/>
+ <mkdir dir="${build.misc}"/>
+ </target>
+
+
+ <target name="res" depends="prepare">
+ <copy todir="${build.class}">
+ <fileset dir="${java.dir}">
+ <include name="**/*.properties"/>
+ <include name="**/*.css"/>
+ <include name="**/*.dtd"/>
+ <include name="**/*.form"/>
+ <include name="**/*.gif "/>
+ <include name="**/*.htm"/>
+ <include name="**/*.html"/>
+ <include name="**/*.js"/>
+ <include name="**/*.mod"/>
+ <include name="**/*.sql"/>
+ <include name="**/*.xml"/>
+ <include name="**/*.xsl"/>
+ <include name="**/*.map"/>
+
+ </fileset>
+ </copy>
+ </target>
+
+
+ <target name="compile" depends="prepare,res">
+ <javac destdir="${build.class}"
+ debug="${debug}"
+ deprecation="${deprication}"
+ optimize="${optimize}"
+ classpathref="classpath">
+ <src path="${java.dir}"/>
+ <include name="**/*.java"/>
+ </javac>
+ </target>
+
+ <!-- clean up -->
+ <target name="clean" depends="prepare">
+ <delete includeEmptyDirs="true">
+ <fileset dir="${build.class}">
+ <patternset>
+ <include name="${package}/**/*.class"/>
+ </patternset>
+ </fileset>
+ </delete>
+ </target>
+
+ <!-- create jar file -->
+ <target name="jar" depends="prepare,compile" if="build.class">
+ <jar jarfile="${build.class}/${jarname}.jar"
+ basedir="${build.class}"
+ manifest="${jarname}.MF">
+ <include name="**/*.class"/>
+ <include name="**/*.properties"/>
+ <include name="**/*.css"/>
+ <include name="**/*.dtd"/>
+ <include name="**/*.form"/>
+ <include name="**/*.gif "/>
+ <include name="**/*.htm"/>
+ <include name="**/*.html"/>
+ <include name="**/*.js"/>
+ <include name="**/*.mod"/>
+ <include name="**/*.sql"/>
+ <include name="**/*.xml"/>
+ <include name="**/*.xsl"/>
+ <include name="**/*.map"/>
+ </jar>
+ </target>
+
+ <target name="test" depends="prepare">
+ </target>
+
+</project>
+
diff --git a/transex3/java/jpropex/java/JPropEx.java b/transex3/java/jpropex/java/JPropEx.java
new file mode 100644
index 000000000000..20175febe5d5
--- /dev/null
+++ b/transex3/java/jpropex/java/JPropEx.java
@@ -0,0 +1,400 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+
+import java.util.*;
+import java.io.*;
+
+public class JPropEx
+{
+ private String inputFileArg;
+ private String outputFileArg;
+ private String pathPrefixArg;
+ private String pathPostfixArg;
+ private String projectArg;
+ private String rootArg;
+ private Vector forcedLangsArg;
+ private Vector langsArg;
+ private String inputSdfFileArg;
+ private boolean isQuiet = false;
+ private final String resourceType = "javaproperties";
+ private final String sourceLanguage = "en-US";
+ //private SdfData data;
+
+ public JPropEx()
+ {
+ //data = new SdfData();
+ }
+
+ public JPropEx( String args[] )
+ {
+ super();
+ parseArguments( args );
+ testArguments();
+ if( inputSdfFileArg != null && inputSdfFileArg.length() > 0 )
+ merge();
+ else
+ extract();
+ }
+
+ private String getSimpleArg( String[] args , int x )
+ {
+ if( x < args.length ) x++;
+ else
+ {
+ System.err.println("ERROR: Missing arg for "+args[ x ]+"\n");
+ help();
+ }
+ return args[ x ];
+ }
+ private Vector getComplexArg( String[] args , int x )
+ {
+ if( x < args.length ) x++;
+ else
+ {
+ System.err.println("ERROR: Missing arg for "+args[ x ]+"\n");
+ help();
+ }
+ String value = args[ x ];
+ Vector values = new Vector( Arrays.asList( value.split(",") ) );
+ return values;
+ }
+
+ private void help()
+ {
+ System.out.println("jpropex extract / merge java properties files");
+ System.exit( -1 );
+ }
+
+ private void extract()
+ {
+ SdfData data = new SdfData();
+ java.util.Properties prop = loadProp( inputFileArg );
+
+ // Get a prototype that already contains the most common settings
+ SdfEntity dolly = prepareSdfObj();
+ String key;
+ SdfEntity currentStr;
+ String value;
+ for( Enumeration e = prop.propertyNames() ; e.hasMoreElements() ; )
+ {
+ key = (String) e.nextElement();
+ currentStr = (SdfEntity) dolly.clone();
+ // Set the new LID and the string text
+ currentStr.setLid( key );
+ value = prop.getProperty( key , "" );
+ //if( value.equals("") ) System.err.println("Warning: in file "+inputFileArg+" the string with the key "+key+" has a empty string!");
+ currentStr.setText( (prop.getProperty( key )).replaceAll("\t" , " " ) ); // TODO: Quoting!!!!
+ data.add( currentStr );
+ }
+ data.write( outputFileArg );
+ }
+
+ private SdfEntity prepareSdfObj()
+ {
+ String path = makeAbs( inputFileArg );
+ path = path.replace( rootArg + "/" , "" );
+ path = path.replace("/","\\");
+ return new SdfEntity( projectArg , path , "" /* dummy1 */ , resourceType , "", "" , "" , "" , "" /* dummy2 */ ,
+ sourceLanguage , "", "" , "" , "" , "2002-02-02 02:02:02" );
+ }
+
+ private void merge()
+ {
+ SdfData data = getSdfData();
+ if( inputFileArg.startsWith("@") )
+ {
+ // Read files
+ Vector fileList = readFileList( inputFileArg );
+ for( Enumeration e = fileList.elements(); e.hasMoreElements(); )
+ mergeFile( (String) e.nextElement() , data );
+ }
+ else
+ {
+ // Single file
+ mergeFile( inputFileArg , data );
+ }
+ }
+
+ private Vector readFileList( String filename )
+ {
+ Vector lines = new Vector();
+ try
+ {
+ BufferedReader in = new BufferedReader( new FileReader( filename.substring( 1 ) ) );
+ while( in.ready() )
+ lines.add( in.readLine() );
+ }
+ catch( IOException e )
+ {
+ System.out.println("ERROR: Can't open file '"+filename.substring( 1 )+"'");
+ System.exit( -1 );
+ }
+ return lines;
+ }
+
+ private void mergeFile( String filename , SdfData data )
+ {
+ java.util.Properties sourceProp = loadProp( filename );
+ Vector langs = getLanguages( data );
+ HashMap props = new HashMap();
+ // Create a properties object for every language
+ for( Enumeration e = langs.elements(); e.hasMoreElements();)
+ {
+
+ props.put( (String)e.nextElement() , new java.util.Properties() );
+ }
+ // Get a prototype that already contains the most common settings
+
+ SdfEntity dolly = prepareSdfObj();
+ String key;
+ String sourceString;
+ SdfEntity curStr;
+ SdfEntity curEntity;
+ SdfEntity mergedEntity;
+ String curLang;
+ for( Enumeration e = sourceProp.propertyNames() ; e.hasMoreElements() ; ) // For all property keys
+ {
+ key = (String) e.nextElement();
+ sourceString = sourceProp.getProperty( key );
+ curStr = (SdfEntity) dolly.clone();
+ curStr.setLid( key );
+ for( Enumeration lang = langs.elements(); lang.hasMoreElements(); ) // merge in every language
+ {
+ curEntity = (SdfEntity) curStr.clone();
+ curLang = (String) lang.nextElement();
+ curEntity.setLangid( curLang );
+ mergedEntity = data.get( curEntity );
+ if( mergedEntity == null )
+ {
+ // if case there is not translation the fallback to the en-US source string
+ ( (java.util.Properties) props.get( curLang )).setProperty( curEntity.getLid() , sourceString );
+ }
+ else
+ {
+ // Set the merged text from the sdf file
+ ( (java.util.Properties) props.get( curLang )).setProperty( mergedEntity.getLid() , mergedEntity.getText() ); // TODO: Quoting ???
+ }
+ }
+
+ }
+ // Now write them out
+ String lang;
+ for( Iterator i = props.keySet().iterator() ; i.hasNext() ; )
+ {
+ lang = (String) i.next();
+ writeSinglePropertiesFile( filename , (java.util.Properties) props.get( lang ) , lang );
+ }
+ }
+ private void writeSinglePropertiesFile( String filename , java.util.Properties prop , String lang )
+ {
+ // Prepare path to file
+ int filenameIdx = filename.lastIndexOf( "/" ) > 0 ? filename.lastIndexOf( "/" )+1 : 0 ;
+ String path = new String();
+ String name = new String();
+ if( pathPrefixArg != null && pathPrefixArg.length()>0 && pathPostfixArg != null && pathPostfixArg.length()>0 )
+ {
+ path = new StringBuffer().append( pathPrefixArg ).append( "/" ).append( lang ).append( "/" ).append( pathPostfixArg ).append( "/" ).toString();
+ name = new StringBuffer().append( filename.substring( filenameIdx , filename.lastIndexOf( ".properties" ) ) )
+ .append( "_" ).append( lang.replaceAll("-","_") ).append( ".properties" ).toString();
+ }
+ else if( outputFileArg != null && outputFileArg.length()>0 )
+ {
+ name = outputFileArg;
+ name += new StringBuffer().append( inputFileArg.substring( filenameIdx , filename.lastIndexOf( ".properties" ) ) )
+ .append( "_" ).append( lang.replaceAll("-","_") ).append( ".properties" ).toString();
+
+ //name = outputFileArg;
+ }
+ else
+ {
+ System.err.println("ERROR: No outputfile specified .. either -o or -x -y !");
+ System.exit( -1 );
+ }
+
+ File dir = new File( path );
+ try
+ {
+ if( !dir.exists() && path.length()>0 )
+ {
+ if( !dir.mkdirs() )
+ {
+ System.out.println("ERROR: Can't create directory '"+path+"' !!!");
+ System.exit( -1 );
+ }
+ }
+ }
+ catch( SecurityException e )
+ {
+ System.out.println("ERROR: Can't create directory '"+path+"'!!!Wrong Permissions?");
+ System.exit( -1 );
+ }
+ path += name;
+ // Write the properties file
+ System.out.println("DBG: Writing to "+path);
+ try{
+ BufferedOutputStream out = new BufferedOutputStream( new FileOutputStream( path ) );
+ if( prop == null )
+ System.out.println("DBG: prop == null!!!");
+ prop.store( out , "" ); // Legal headers?
+ }
+ catch( IOException e )
+ {
+ System.out.println("ERROR: Can't write file '"+path+"' !!!!");
+ System.exit( -1 );
+ }
+ }
+
+ private SdfData getSdfData()
+ {
+ SdfData data = new SdfData( inputSdfFileArg );
+ data.read();
+ return data;
+ }
+ private Vector getLanguages( SdfData data )
+ {
+ Vector langs = new Vector();
+
+ if( ((String)langsArg.get( 0 )).equalsIgnoreCase( "all" ) ) // for "-l all" use all languages found in the -m sdf file
+ langs.addAll( data.getLanguages() );
+ else
+ langs.addAll( langsArg ); // use the langs giving by -l
+
+ if( forcedLangsArg != null )
+ langs.addAll( forcedLangsArg );
+
+ return removeDupes( langs );
+ }
+ private Vector removeDupes( Vector vec )
+ {
+ Collection coll = new LinkedHashSet( vec );
+ return new Vector( coll );
+ }
+ private java.util.Properties loadProp( String filename )
+ {
+ java.util.Properties prop = new java.util.Properties();
+ try
+ {
+ prop.load( new BufferedInputStream( new NoLocalizeFilter( new FileInputStream( filename ) ) ) );
+ }
+ catch( IOException e )
+ {
+ System.err.println("ERROR: Can't read file '"+filename+"'!!!");
+ }
+ return prop;
+ }
+ private void parseArguments( String[] args )
+ {
+
+ if( args.length == 0 )
+ {
+ System.out.println("ERROR: No args???");
+ help();
+ System.exit( -1 );
+ }
+ for( int x = 0; x < args.length ; x++ )
+ {
+ if( args[ x ].equalsIgnoreCase("-i") )
+ {
+ // Input resource file
+ inputFileArg = getSimpleArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-o") )
+ {
+ // Output sdf file
+ outputFileArg = getSimpleArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-x") )
+ {
+ // path prefix
+ pathPrefixArg = getSimpleArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-y") )
+ {
+ // path postfix
+ pathPostfixArg = getSimpleArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-p") )
+ {
+ // project
+ projectArg = getSimpleArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-r") )
+ {
+ // root
+ rootArg = getSimpleArg( args , x );
+ rootArg = makeAbs( rootArg );
+ }
+ else if( args[ x ].equalsIgnoreCase("-lf") )
+ {
+ // forced langs
+ forcedLangsArg = getComplexArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-l") )
+ {
+ // langs
+ langsArg = getComplexArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-m") )
+ {
+ // input sdf file
+ inputSdfFileArg = getSimpleArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-qq") )
+ {
+ isQuiet = true;
+ }
+ }
+ }
+ private String makeAbs( String path )
+ {
+ File file;
+ try
+ {
+ file = new File( path );
+ return file.getCanonicalPath();
+ }catch( IOException e )
+ {
+ e.printStackTrace();
+ System.exit( -1 );
+ }
+ return null;
+ }
+ private boolean testArguments()
+ {
+ // nice merge
+ if( inputSdfFileArg != null && inputSdfFileArg.length()>0 )
+ // nice merge
+ return projectArg != null && rootArg != null && inputFileArg != null && pathPrefixArg != null && pathPostfixArg != null && langsArg != null &&
+ projectArg.length()>0 && rootArg.length()>0 && inputFileArg.length()>0 && pathPrefixArg.length()>0 && pathPostfixArg.length()>0 && langsArg.size()>0 ;
+ else
+ // nice extract
+ return projectArg != null && rootArg != null && inputFileArg != null && outputFileArg != null && langsArg != null &&
+ projectArg.length()>0 && rootArg.length()>0 && inputFileArg.length()>0 && outputFileArg.length()>0 && langsArg.size()>0;
+ }
+
+}
diff --git a/transex3/java/jpropex/java/Main.java b/transex3/java/jpropex/java/Main.java
new file mode 100644
index 000000000000..23dc477ddec3
--- /dev/null
+++ b/transex3/java/jpropex/java/Main.java
@@ -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.
+ *
+ ************************************************************************/
+
+
+class Main
+{
+
+ public static void main( String args[] )
+ {
+ JPropEx jpropex = new JPropEx( args );
+ //jpropex.init();
+ }
+}
+
diff --git a/transex3/java/jpropex/java/NoLocalizeFilter.java b/transex3/java/jpropex/java/NoLocalizeFilter.java
new file mode 100644
index 000000000000..c1e62fc951a8
--- /dev/null
+++ b/transex3/java/jpropex/java/NoLocalizeFilter.java
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+
+import java.io.*;
+import java.util.regex.*;
+
+// exit if the sequence x-no-localize is found in stream!
+public class NoLocalizeFilter extends FilterInputStream
+{
+ InputStream in;
+// Pattern p = Pattern.compile("[\\s]*#[\\s]*x-no-translate");
+
+ public NoLocalizeFilter( InputStream in ) {
+ super(in);
+ this.in = in;
+ }
+ public int read(byte[] b, int off, int len) throws IOException
+ {
+ String search = new String( b );
+// Matcher m = p.matcher( search );
+ if( search.contains("x-no-translate" ) ) // TODO: fixme!
+ {
+// System.out.println("found x-no-translate");
+ in.close();
+ close();
+ System.exit( 0 );
+ }
+ return in.read( b , off , len );
+ }
+}
diff --git a/transex3/java/jpropex/java/OrderedHashMap.java b/transex3/java/jpropex/java/OrderedHashMap.java
new file mode 100644
index 000000000000..a462d598b307
--- /dev/null
+++ b/transex3/java/jpropex/java/OrderedHashMap.java
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+
+import java.util.*;
+
+// LinkedHashMap implrementation
+public class OrderedHashMap
+{
+ private HashMap hm = new HashMap();
+ private LinkedList list = new LinkedList();
+
+ public Iterator iterator() { return list.iterator(); }
+
+ public boolean isEmpty() { return hm.isEmpty(); }
+ public Object get( Object key ) { return hm.get( key ); }
+ public Object get( int index ) { return hm.get( list.get( index ) ); }
+ public Iterator keys() { return list.iterator(); }
+ public Object add( Object key , Object value )
+ {
+ list.add( key );
+ return hm.put( key, value );
+ }
+ public Object add( int index , Object key , Object value )
+ {
+ list.add( index , key );
+ return hm.put( key, value );
+ }
+ public Object remove( Object key )
+ {
+ list.remove( list.indexOf( key ) );
+ return hm.remove( key );
+ }
+ public void move( int idxFrom , int idxTo )
+ {
+ Object key = list.get( idxFrom );
+ list.remove( idxFrom );
+ list.add( idxTo , key );
+ }
+ public void move( Object key , int idxTo )
+ {
+ move( list.indexOf( key ) , idxTo );
+ }
+ public int size()
+ {
+ return hm.size();
+ }
+ public Enumeration elements()
+ {
+ return new OHMenum( this );
+ }
+}
+
+final class OHMenum implements Enumeration
+{
+ OrderedHashMap ohm;
+ int index = 0;
+
+ private OHMenum(){};
+ public OHMenum( OrderedHashMap ohm ){
+ this.ohm = ohm ;
+ }
+
+ public boolean hasMoreElements()
+ {
+ return index < ohm.size();
+ }
+ public Object nextElement()
+ {
+ return ohm.get( index++ );
+ }
+}
diff --git a/transex3/java/jpropex/java/SdfData.java b/transex3/java/jpropex/java/SdfData.java
new file mode 100644
index 000000000000..60f218c0ae15
--- /dev/null
+++ b/transex3/java/jpropex/java/SdfData.java
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+
+import java.util.*;
+import java.io.*;
+
+public class SdfData
+{
+ private String filename;
+ private OrderedHashMap ohm;
+ private LinkedHashSet languagesFound;
+
+ public SdfData()
+ {
+ languagesFound = new LinkedHashSet();
+ ohm = new OrderedHashMap();
+ languagesFound = new LinkedHashSet();
+ }
+ public SdfData( String filename ){
+ this();
+ this.filename = filename;
+ }
+
+ public LinkedHashSet getLanguages()
+ {
+ return languagesFound;
+ }
+ public SdfEntity get( SdfEntity obj )
+ {
+ return (SdfEntity) ohm.get( (String)obj.getId() );
+ }
+ public SdfEntity get( String key ){
+ return (SdfEntity) ohm.get( key );
+ }
+ public void add( SdfEntity obj )
+ {
+ ohm.add( obj.getId() , obj );
+ }
+
+ public void read()
+ {
+ BufferedReader in;
+ try
+ {
+ in = new BufferedReader( new FileReader( filename ) );
+ SdfEntity entity;
+ while( in.ready() )
+ {
+ String line = in.readLine();
+ if( line.length() > 0 )
+ {
+ entity = new SdfEntity( line );
+ ohm.add( entity.getId() , entity ); // test if is valid
+ languagesFound.add( entity.getLangid() );
+ }
+ }
+ in.close();
+ }
+ catch( IOException e )
+ {
+ System.out.println("Error: reading file " + filename);
+ System.exit( -1 );
+ }
+ }
+ public void write( String filename )
+ {
+ FileWriter out;
+ try
+ {
+ out = new FileWriter( filename , true ); // Always append
+ for( Enumeration e = ohm.elements(); e.hasMoreElements(); )
+ {
+ out.write( ( (SdfEntity) e.nextElement() ).toString() + "\n" );
+ }
+ out.close();
+ }
+ catch( IOException e )
+ {
+ System.out.println("Error: Can't write to file " + filename);
+ System.exit( -1 );
+ }
+ }
+}
diff --git a/transex3/java/jpropex/java/SdfEntity.java b/transex3/java/jpropex/java/SdfEntity.java
new file mode 100644
index 000000000000..e2c1606ee7c2
--- /dev/null
+++ b/transex3/java/jpropex/java/SdfEntity.java
@@ -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.
+ *
+ ************************************************************************/
+
+
+public class SdfEntity implements Cloneable{
+ private String project = new String("");
+ private String source_file = new String("");
+ private String dummy1 = new String("");
+ private String resource_type= new String("");
+ private String gid = new String("");
+ private String lid = new String("");
+ private String helpid = new String("");
+ private String platform = new String("");
+ private String dummy2 = new String("");
+ private String langid = new String("");
+ private String text = new String("");
+ private String helptext = new String("");
+ private String quickhelptext= new String("");
+ private String title = new String("");
+ private String date = new String("");
+
+ public static int PROJECT_POS = 0;
+ public static int SOURCE_FILE_POS = 1;
+ public static int DUMMY1_POS = 2;
+ public static int RESOURCE_TYPE_POS = 3;
+ public static int GID_POS = 4;
+ public static int LID_POS = 5;
+ public static int HELPID_POS = 6;
+ public static int PLATFORM_POS = 7;
+ public static int DUMMY2_POS = 8;
+ public static int LANGID_POS = 9;
+ public static int TEXT_POS = 10;
+ public static int HELPTEXT_POS = 11;
+ public static int QUICKHELPTEXT_POS = 12;
+ public static int TITLE_POS = 13;
+ public static int DATE_POS = 14;
+
+ public Object clone()
+ {
+ try
+ {
+ return super.clone();
+ }
+ catch( CloneNotSupportedException e )
+ {
+ System.out.println("ERROR: Can not clone, soemthing is broken here ....");
+ System.exit( -1 );
+ }
+ return null; // dummy
+ }
+
+ public SdfEntity( String line ){
+ // isValid?
+ setProperties( line ) ;
+ }
+ public SdfEntity(String project, String source_file, String dummy1, String resource_type, String gid, String lid, String helpid, String platform, String dummy2, String langid, String text, String helptext, String quickhelptext, String title , String date) {
+ super();
+ this.project = project;
+ this.source_file = source_file;
+ this.dummy1 = dummy1;
+ this.resource_type = resource_type;
+ this.gid = gid;
+ this.lid = lid;
+ this.helpid = helpid;
+ this.platform = platform;
+ this.dummy2 = dummy2;
+ this.langid = langid;
+ this.text = text;
+ this.helptext = helptext;
+ this.quickhelptext = quickhelptext;
+ this.title = title;
+ this.date = date;
+ }
+
+ public void setProperties( String line ){
+
+ String[] splitted = line.split("\t");
+
+ setProject( splitted[ SdfEntity.PROJECT_POS ] );
+ setSource_file( splitted[ SdfEntity.SOURCE_FILE_POS ] );
+ setDummy1( splitted[ SdfEntity.DUMMY1_POS ] );
+ setResource_type( splitted[ SdfEntity.RESOURCE_TYPE_POS ] );
+ setGid( splitted[ SdfEntity.GID_POS ] );
+ setLid( splitted[ SdfEntity.LID_POS ] );
+ setHelpid( splitted[ SdfEntity.HELPID_POS ] );
+ setPlatform( splitted[ SdfEntity.PLATFORM_POS ] );
+ setDummy2( splitted[ SdfEntity.DUMMY2_POS ] );
+ setLangid( splitted[ SdfEntity.LANGID_POS ] );
+ setText( splitted[ SdfEntity.TEXT_POS ] );
+ setHelptext( splitted[ SdfEntity.HELPTEXT_POS ] );
+ setQuickhelptext( splitted[ SdfEntity.QUICKHELPTEXT_POS ] );
+ setTitle( splitted[ SdfEntity.TITLE_POS ] );
+ setDate( splitted[ SdfEntity.DATE_POS ] );
+ }
+
+ public String getFileId(){
+ return project+"\\"+source_file;
+ }
+ public String getResourcePath(){
+ return source_file.substring(0 , source_file.lastIndexOf( "\\" )-1 );
+ }
+ public String toString(){
+ return project+"\t"+source_file+"\t"+dummy1+"\t"+resource_type+"\t"+gid+"\t"
+ +lid+"\t"+helpid+"\t"+platform+"\t"+dummy2+"\t"+langid+"\t"
+ +text+"\t"+helptext+"\t"+quickhelptext+"\t"+title+"\t"+date;
+ }
+ public String getId(){
+ return project+gid+lid+source_file+resource_type+platform+helpid;
+ }
+
+ public String getDummy1() {
+ return dummy1;
+ }
+
+ public void setDummy1(String dummy1) {
+ this.dummy1 = dummy1;
+ }
+
+ public String getPlatform() {
+ return platform;
+ }
+
+ public void setPlatform(String platform) {
+ this.platform = platform;
+ }
+
+ public String getDummy2() {
+ return dummy2;
+ }
+
+ public void setDummy2(String dummy2) {
+ this.dummy2 = dummy2;
+ }
+
+ public String getGid() {
+ return gid;
+ }
+
+ public void setGid(String gid) {
+ this.gid = gid;
+ }
+
+ public String getHelpid() {
+ return helpid;
+ }
+
+ public void setHelpid(String helpid) {
+ this.helpid = helpid;
+ }
+
+ public String getHelptext() {
+ return helptext;
+ }
+
+ public void setHelptext(String helptext) {
+ this.helptext = helptext;
+ }
+
+ public String getLangid() {
+ return langid;
+ }
+
+ public void setLangid(String langid) {
+ this.langid = langid;
+ }
+
+ public String getLid() {
+ return lid;
+ }
+
+ public void setLid(String lid) {
+ this.lid = lid;
+ }
+
+ public String getProject() {
+ return project;
+ }
+
+ public void setProject(String project) {
+ this.project = project;
+ }
+
+ public String getQuickhelptext() {
+ return quickhelptext;
+ }
+
+ public void setQuickhelptext(String quickhelptext) {
+ this.quickhelptext = quickhelptext;
+ }
+
+ public String getResource_type() {
+ return resource_type;
+ }
+
+ public void setResource_type(String resource_type) {
+ this.resource_type = resource_type;
+ }
+
+ public String getSource_file() {
+ return source_file;
+ }
+
+ public void setSource_file(String source_file) {
+ this.source_file = source_file;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+ public String getDate() {
+ return date;
+ }
+ public void setDate(String date) {
+ this.date = date;
+ }
+
+
+}
diff --git a/transex3/java/jpropex/jpropex b/transex3/java/jpropex/jpropex
new file mode 100755
index 000000000000..2d62d13b093e
--- /dev/null
+++ b/transex3/java/jpropex/jpropex
@@ -0,0 +1,10 @@
+#!/bin/sh
+if [ x${SOLARENV}x = xx ]; then
+ echo No environment found, please use 'configure' or 'setsolar'
+ exit 1
+fi
+if [ x${JAVA_HOME}x = xx ]; then
+ echo No Java found!
+ exit 1
+fi
+exec java -DSOLARSRC=${SOLARSRC} -DWORK_STAMP=${WORK_STAMP} -DUSE_SHELL= -jar ${SOLARVER}/${INPATH}/bin${UPDMINOREXT}/jpropex.jar "$@"
diff --git a/transex3/java/jpropex/jpropex.MF b/transex3/java/jpropex/jpropex.MF
new file mode 100755
index 000000000000..3e22e7e9bfbf
--- /dev/null
+++ b/transex3/java/jpropex/jpropex.MF
@@ -0,0 +1 @@
+Main-Class: Main
diff --git a/transex3/java/jpropex/makefile.mk b/transex3/java/jpropex/makefile.mk
new file mode 100755
index 000000000000..f86d2c830025
--- /dev/null
+++ b/transex3/java/jpropex/makefile.mk
@@ -0,0 +1,36 @@
+#*************************************************************************
+#
+# 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=transex3
+TARGET=jpropex
+
+.INCLUDE : ant.mk
+
+ALLTAR : ANTBUILD
+
diff --git a/ucbhelper/inc/ucbhelper/configureucb.hxx b/ucbhelper/inc/ucbhelper/configureucb.hxx
deleted file mode 100644
index 2e70467a4e9f..000000000000
--- a/ucbhelper/inc/ucbhelper/configureucb.hxx
+++ /dev/null
@@ -1,201 +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 _UCBHELPER_CONFIGUREUCB_HXX_
-#define _UCBHELPER_CONFIGUREUCB_HXX_
-
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/RuntimeException.hpp>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <rtl/ustring.hxx>
-
-#include <vector>
-#include "ucbhelper/ucbhelperdllapi.h"
-
-namespace com { namespace sun { namespace star {
- namespace lang { class XMultiServiceFactory; }
- namespace ucb {
- class XContentProvider;
- class XContentProviderManager;
- }
- namespace uno { class Any; }
-} } }
-
-namespace ucbhelper {
-
-//============================================================================
-/** Information about a registered content provider, passed from
- <method>configureUcb</method> to <method>unconfigureUcb</method> (and from
- <method>registerAtUcb</method> to <method>deregisterFromUcb</method>).
- */
-struct ContentProviderRegistrationInfo
-{
- /** The registered content provider (or null if registration failed).
- */
- com::sun::star::uno::Reference< com::sun::star::ucb::XContentProvider >
- m_xProvider;
-
- /** The arguments the content provider was instantiated with.
- */
- rtl::OUString m_aArguments;
-
- /** The URL template the content provider is registered on.
- */
- rtl::OUString m_aTemplate;
-};
- //@@@ if registerucb.hxx were exported, too, this might better reside in
- // there...
-
-typedef std::vector< ContentProviderRegistrationInfo >
- ContentProviderRegistrationInfoList;
-
-//============================================================================
-/** Information about a content provider, passed to
- <method>configureUcb</method>.
- */
-struct ContentProviderData
-{
- /** The UNO service name to use to instanciate the content provider.
- */
- rtl::OUString ServiceName;
-
- /** The URL template to use to instanciate the content provider.
- */
- rtl::OUString URLTemplate;
-
- /** The arguments to use to instanciate the content provider.
- */
- rtl::OUString Arguments;
-
- ContentProviderData() {};
- ContentProviderData( const rtl::OUString & rService,
- const rtl::OUString & rTemplate,
- const rtl::OUString & rArgs )
- : ServiceName( rService ), URLTemplate( rTemplate ), Arguments( rArgs ) {}
-};
-
-typedef std::vector< ContentProviderData > ContentProviderDataList;
-
-//============================================================================
-/** Configure a (newly instantiated) Universal Content Broker.
-
- @descr This function tries to register at the given content provider
- manager all the content provider services listed under a given key in the
- configuration database.
-
- @param rManager A content provider manager (normally, this would be a
- newly intantiated UCB).
-
- @param rServiceFactory A service factory through which to obtain the
- various services required.
-
- @param rData A list containing the data for the content providers for
- the UCB to configure.
-
- @pInfos If not null, an entry will be added to this vector for every
- content provider that is registered (sucessfully or not).
-
- @return True if the UCB has successfuly been configured (though not all
- content providers have necessarily been registered due to individual
- problems).
- */
-bool
-configureUcb(
- com::sun::star::uno::Reference<
- com::sun::star::ucb::XContentProviderManager > const &
- rManager,
- com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory > const &
- rServiceFactory,
- ContentProviderDataList const & rData,
- ContentProviderRegistrationInfoList * pInfos)
- throw (com::sun::star::uno::RuntimeException);
-
-
-//============================================================================
-/** Configure a (newly instantiated) Universal Content Broker.
-
- @descr This function tries to register at the given content provider
- manager all the content provider services listed under a given key in the
- configuration database.
-
- @param rManager A content provider manager (normally, this would be a
- newly intantiated UCB).
-
- @param rServiceFactory A service factory through which to obtain the
- various services required.
-
- @param rArguments A sequence of at least two strings: the primary and
- secondary key addressing a chosen UCB configuration in the configuration
- database. The sequence can be longer, in which case the excess elements
- must be strings that form key/value pairs. These key/value pairs will be
- used to replace placeholders in the data from the configuration database
- with (dynamic) values. This is a (rather unstructured) sequence of
- <type>Any<type/>s, since normally this parameter will simply be forwarded
- by the UCB's <method>initialize<method/> method, which has a parameter of
- the same type.
-
- @pInfos If not null, an entry will be added to this vector for every
- content provider that is registered (sucessfully or not).
-
- @return True if the UCB has successfuly been configured (though not all
- content providers have necessarily been registered due to individual
- problems).
- */
-UCBHELPER_DLLPUBLIC bool
-configureUcb(
- com::sun::star::uno::Reference<
- com::sun::star::ucb::XContentProviderManager > const &
- rManager,
- com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory > const &
- rServiceFactory,
- com::sun::star::uno::Sequence< com::sun::star::uno::Any > const &
- rArguments,
- std::vector< ContentProviderRegistrationInfo > * pInfos)
- throw (com::sun::star::uno::RuntimeException);
-
-//============================================================================
-/** Undo the configuration of a Universal Content Broker.
-
- @descr This function is the reverse of <method>configureUcb</method>.
-
- @param rManager A content provider manager.
-
- @param rInfos Information about all the registered content providers.
- */
-void
-unconfigureUcb(
- com::sun::star::uno::Reference<
- com::sun::star::ucb::XContentProviderManager > const &
- rManager,
- std::vector< ContentProviderRegistrationInfo > const & rInfos)
- throw (com::sun::star::uno::RuntimeException);
-
-}
-
-#endif // _UCBHELPER_CONFIGUREUCB_HXX_
diff --git a/ucbhelper/inc/ucbhelper/contentbroker.hxx b/ucbhelper/inc/ucbhelper/contentbroker.hxx
index eea72cc689e0..54139d3ffdea 100644
--- a/ucbhelper/inc/ucbhelper/contentbroker.hxx
+++ b/ucbhelper/inc/ucbhelper/contentbroker.hxx
@@ -41,7 +41,7 @@ namespace com { namespace sun { namespace star { namespace ucb {
class XContentProviderManager;
class XCommandProcessor;
} } } }
-#include <ucbhelper/configureucb.hxx>
+#include <ucbhelper/registerucb.hxx>
#include "ucbhelper/ucbhelperdllapi.h"
namespace ucbhelper
diff --git a/ucbhelper/inc/ucbhelper/propertyvalueset.hxx b/ucbhelper/inc/ucbhelper/propertyvalueset.hxx
index ed02a80f571f..82d440df0c02 100644
--- a/ucbhelper/inc/ucbhelper/propertyvalueset.hxx
+++ b/ucbhelper/inc/ucbhelper/propertyvalueset.hxx
@@ -32,6 +32,7 @@
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/sdbc/XColumnLocate.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/beans/Property.hpp>
#include <cppuhelper/weak.hxx>
#include "osl/mutex.hxx"
@@ -43,7 +44,6 @@ namespace com { namespace sun { namespace star { namespace script {
} } } }
namespace com { namespace sun { namespace star { namespace beans {
- struct Property;
struct PropertyValue;
class XPropertySet;
} } } }
@@ -205,175 +205,205 @@ public:
*/
sal_Int32 getLength() const;
- /**
- * This method appends a string to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendString ( const ::com::sun::star::beans::Property& rProp,
- const ::rtl::OUString& rValue );
-
- /**
- * This method appends a boolean to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendBoolean ( const ::com::sun::star::beans::Property& rProp,
- sal_Bool bValue );
-
- /**
- * This method appends a byte to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendByte ( const ::com::sun::star::beans::Property& rProp,
- sal_Int8 nValue );
-
- /**
- * This method appends a short to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendShort ( const ::com::sun::star::beans::Property& rProp,
- sal_Int16 nValue );
-
- /**
- * This method appends an int to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendInt ( const ::com::sun::star::beans::Property& rProp,
- sal_Int32 nValue );
-
- /**
- * This method appends a long to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendLong ( const ::com::sun::star::beans::Property& rProp,
- sal_Int64 nValue );
-
- /**
- * This method appends a float to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendFloat ( const ::com::sun::star::beans::Property& rProp,
- float nValue );
-
- /**
- * This method appends a double to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendDouble ( const ::com::sun::star::beans::Property& rProp,
- double nValue );
-
- /**
- * This method appends a byte sequence to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendBytes ( const ::com::sun::star::beans::Property& rProp,
- const ::com::sun::star::uno::Sequence<
- sal_Int8 >& rValue );
-
- /**
- * This method appends a date to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendDate ( const ::com::sun::star::beans::Property& rProp,
- const ::com::sun::star::util::Date& rValue );
-
- /**
- * This method appends a time to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendTime ( const ::com::sun::star::beans::Property& rProp,
- const ::com::sun::star::util::Time& rValue );
-
- /**
- * This method appends a timestamp to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendTimestamp( const ::com::sun::star::beans::Property& rProp,
- const ::com::sun::star::util::DateTime& rValue );
-
- /**
- * This method appends a binary stream to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendBinaryStream ( const ::com::sun::star::beans::Property& rProp,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::io::XInputStream >&
- rValue );
-
- /**
- * This method appends a character stream to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendCharacterStream( const ::com::sun::star::beans::Property& rProp,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::io::XInputStream >&
- rValue );
-
- /**
- * This method appends an object ( any ) to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendObject ( const ::com::sun::star::beans::Property& rProp,
- const ::com::sun::star::uno::Any& rValue );
-
- /**
- * This method appends a ref to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendRef ( const ::com::sun::star::beans::Property& rProp,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::sdbc::XRef >& rValue );
-
- /**
- * This method appends a blob to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendBlob ( const ::com::sun::star::beans::Property& rProp,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::sdbc::XBlob >& rValue );
-
- /**
- * This method appends a clob to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendClob ( const ::com::sun::star::beans::Property& rProp,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::sdbc::XClob >& rValue );
-
- /**
- * This method appends an array to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendArray ( const ::com::sun::star::beans::Property& rProp,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::sdbc::XArray >& rValue );
-
- /**
- * This method appends a void value ( a "hole" ) to the value set. This
- * is useful, since void values indicate errors, like non-existing
- * property (-values) etc.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendVoid ( const ::com::sun::star::beans::Property& rProp );
+ void appendString( const ::rtl::OUString& rPropName, const ::rtl::OUString& rValue );
+ void appendString( const sal_Char* pAsciiPropName, const ::rtl::OUString& rValue )
+ {
+ appendString( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
+ }
+ void appendString( const ::com::sun::star::beans::Property& rProp, const ::rtl::OUString& rValue )
+ {
+ appendString( rProp.Name, rValue );
+ }
+
+ void appendBoolean( const ::rtl::OUString& rPropName, sal_Bool bValue );
+ void appendBoolean( const sal_Char* pAsciiPropName, sal_Bool bValue )
+ {
+ appendBoolean( ::rtl::OUString::createFromAscii( pAsciiPropName ), bValue );
+ }
+ void appendBoolean( const ::com::sun::star::beans::Property& rProp, sal_Bool bValue )
+ {
+ appendBoolean( rProp.Name, bValue );
+ }
+
+ void appendByte( const ::rtl::OUString& rPropName, sal_Int8 nValue );
+ void appendByte( const sal_Char* pAsciiPropName, sal_Int8 nValue )
+ {
+ appendByte( ::rtl::OUString::createFromAscii( pAsciiPropName ), nValue );
+ }
+ void appendByte( const ::com::sun::star::beans::Property& rProp, sal_Int8 nValue )
+ {
+ appendByte( rProp.Name, nValue );
+ }
+
+ void appendShort( const ::rtl::OUString& rPropName, sal_Int16 nValue );
+ void appendShort( const sal_Char* pAsciiPropName, sal_Int16 nValue )
+ {
+ appendShort( ::rtl::OUString::createFromAscii( pAsciiPropName ), nValue );
+ }
+ void appendShort( const ::com::sun::star::beans::Property& rProp, sal_Int16 nValue )
+ {
+ appendShort( rProp.Name, nValue );
+ }
+
+ void appendInt( const ::rtl::OUString& rPropName, sal_Int32 nValue );
+ void appendInt( const sal_Char* pAsciiPropName, sal_Int32 nValue )
+ {
+ appendInt( ::rtl::OUString::createFromAscii( pAsciiPropName ), nValue );
+ }
+ void appendInt( const ::com::sun::star::beans::Property& rProp, sal_Int32 nValue )
+ {
+ appendInt( rProp.Name, nValue );
+ }
+
+ void appendLong( const ::rtl::OUString& rPropName, sal_Int64 nValue );
+ void appendLong( const sal_Char* pAsciiPropName, sal_Int64 nValue )
+ {
+ appendLong( ::rtl::OUString::createFromAscii( pAsciiPropName ), nValue );
+ }
+ void appendLong( const ::com::sun::star::beans::Property& rProp, sal_Int64 nValue )
+ {
+ appendLong( rProp.Name, nValue );
+ }
+
+ void appendFloat( const ::rtl::OUString& rPropName, float nValue );
+ void appendFloat( const sal_Char* pAsciiPropName, float nValue )
+ {
+ appendFloat( ::rtl::OUString::createFromAscii( pAsciiPropName ), nValue );
+ }
+ void appendFloat( const ::com::sun::star::beans::Property& rProp, float nValue )
+ {
+ appendFloat( rProp.Name, nValue );
+ }
+
+ void appendDouble( const ::rtl::OUString& rPropName, double nValue );
+ void appendDouble( const sal_Char* pAsciiPropName, double nValue )
+ {
+ appendDouble( ::rtl::OUString::createFromAscii( pAsciiPropName ), nValue );
+ }
+ void appendDouble( const ::com::sun::star::beans::Property& rProp, double nValue )
+ {
+ appendDouble( rProp.Name, nValue );
+ }
+
+ void appendBytes( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Sequence< sal_Int8 >& rValue );
+ void appendBytes( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Sequence< sal_Int8 >& rValue )
+ {
+ appendBytes( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
+ }
+ void appendBytes( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Sequence< sal_Int8 >& rValue )
+ {
+ appendBytes( rProp.Name, rValue );
+ }
+
+ void appendDate( const ::rtl::OUString& rPropName, const ::com::sun::star::util::Date& rValue );
+ void appendDate( const sal_Char* pAsciiPropName, const ::com::sun::star::util::Date& rValue )
+ {
+ appendDate( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
+ }
+ void appendDate( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::util::Date& rValue )
+ {
+ appendDate( rProp.Name, rValue );
+ }
+
+ void appendTime( const ::rtl::OUString& rPropName, const ::com::sun::star::util::Time& rValue );
+ void appendTime( const sal_Char* pAsciiPropName, const ::com::sun::star::util::Time& rValue )
+ {
+ appendTime( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
+ }
+ void appendTime( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::util::Time& rValue )
+ {
+ appendTime( rProp.Name, rValue );
+ }
+
+ void appendTimestamp( const ::rtl::OUString& rPropName, const ::com::sun::star::util::DateTime& rValue );
+ void appendTimestamp( const sal_Char* pAsciiPropName, const ::com::sun::star::util::DateTime& rValue )
+ {
+ appendTimestamp( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
+ }
+ void appendTimestamp( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::util::DateTime& rValue )
+ {
+ appendTimestamp( rProp.Name, rValue );
+ }
+
+ void appendBinaryStream( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rValue );
+ void appendBinaryStream( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rValue )
+ {
+ appendBinaryStream( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
+ }
+ void appendBinaryStream( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rValue )
+ {
+ appendBinaryStream( rProp.Name, rValue );
+ }
+
+ void appendCharacterStream( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rValue );
+ void appendCharacterStream( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rValue )
+ {
+ appendCharacterStream( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
+ }
+ void appendCharacterStream( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rValue )
+ {
+ appendCharacterStream( rProp.Name, rValue );
+ }
+
+ void appendObject( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rValue );
+ void appendObject( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Any& rValue )
+ {
+ appendObject( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
+ }
+ void appendObject( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Any& rValue )
+ {
+ appendObject( rProp.Name, rValue );
+ }
+
+ void appendRef( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& rValue );
+ void appendRef( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& rValue )
+ {
+ appendRef( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
+ }
+ void appendRef( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& rValue )
+ {
+ appendRef( rProp.Name, rValue );
+ }
+
+ void appendBlob( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& rValue );
+ void appendBlob( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& rValue )
+ {
+ appendBlob( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
+ }
+ void appendBlob( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& rValue )
+ {
+ appendBlob( rProp.Name, rValue );
+ }
+
+ void appendClob( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& rValue );
+ void appendClob( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& rValue )
+ {
+ appendClob( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
+ }
+ void appendClob( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& rValue )
+ {
+ appendClob( rProp.Name, rValue );
+ }
+
+ void appendArray( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& rValue );
+ void appendArray( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& rValue )
+ {
+ appendArray( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
+ }
+ void appendArray( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& rValue )
+ {
+ appendArray( rProp.Name, rValue );
+ }
+
+ void appendVoid( const ::rtl::OUString& rPropName );
+ void appendVoid( const sal_Char* pAsciiPropName)
+ {
+ appendVoid( ::rtl::OUString::createFromAscii( pAsciiPropName ) );
+ }
+ void appendVoid( const ::com::sun::star::beans::Property& rProp )
+ {
+ appendVoid( rProp.Name );
+ }
/**
* This method tries to append all property values contained in a
diff --git a/ucbhelper/inc/ucbhelper/registerucb.hxx b/ucbhelper/inc/ucbhelper/registerucb.hxx
new file mode 100644
index 000000000000..e2427248dce2
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/registerucb.hxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+*
+* 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 _UCBHELPER_REGISTERUCB_HXX_
+#define _UCBHELPER_REGISTERUCB_HXX_
+
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#include <com/sun/star/ucb/XContentProviderManager.hpp>
+#include <vector>
+
+#include "ucbhelper/ucbhelperdllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace lang { class XMultiServiceFactory; }
+} } }
+
+namespace rtl { class OUString; }
+
+namespace ucbhelper {
+
+//============================================================================
+/** Information about a registered content provider.
+ */
+struct ContentProviderRegistrationInfo
+{
+ /** The registered content provider (or null if registration failed).
+ */
+ com::sun::star::uno::Reference< com::sun::star::ucb::XContentProvider >
+ m_xProvider;
+
+ /** The arguments the content provider was instantiated with.
+ */
+ rtl::OUString m_aArguments;
+
+ /** The URL template the content provider is registered on.
+ */
+ rtl::OUString m_aTemplate;
+};
+
+typedef std::vector< ContentProviderRegistrationInfo >
+ ContentProviderRegistrationInfoList;
+
+//============================================================================
+/** Information about a content provider, passed to
+ <method>configureUcb</method>.
+ */
+struct ContentProviderData
+{
+ /** The UNO service name to use to instanciate the content provider.
+ */
+ rtl::OUString ServiceName;
+
+ /** The URL template to use to instanciate the content provider.
+ */
+ rtl::OUString URLTemplate;
+
+ /** The arguments to use to instanciate the content provider.
+ */
+ rtl::OUString Arguments;
+
+ ContentProviderData() {};
+ ContentProviderData( const rtl::OUString & rService,
+ const rtl::OUString & rTemplate,
+ const rtl::OUString & rArgs )
+ : ServiceName( rService ), URLTemplate( rTemplate ), Arguments( rArgs ) {}
+};
+
+typedef std::vector< ContentProviderData > ContentProviderDataList;
+//============================================================================
+/** Register a content provider at a Universal Content Broker.
+
+ @param rManager A content provider manager (normally, this would be a
+ UCB). May be null, which is only useful if the content provider is an
+ <type>XParamterizedContentProvider</type>s.
+
+ @param rServiceFactory A factory through which to obtain the required
+ services.
+
+ @param rName The service name of the content provider.
+
+ @param rArguments Any arguments to instantiate the content provider with.
+
+ @param rTemplate The URL template to register the content provider on.
+
+ @param pInfo If not null, this output parameter is filled with
+ information about the (atemptively) registered provider.
+ */
+
+UCBHELPER_DLLPUBLIC bool registerAtUcb(
+ com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentProviderManager > const &
+ rManager,
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > const &
+ rServiceFactory,
+ rtl::OUString const & rName,
+ rtl::OUString const & rArguments,
+ rtl::OUString const & rTemplate,
+ ContentProviderRegistrationInfo * pInfo)
+ throw (com::sun::star::uno::RuntimeException);
+
+}
+#endif // _UCBHELPER_REGISTERUCB_HXX_
diff --git a/ucbhelper/prj/build.lst b/ucbhelper/prj/build.lst
index 3f49d69c987f..bbd01df9022a 100644
--- a/ucbhelper/prj/build.lst
+++ b/ucbhelper/prj/build.lst
@@ -1,6 +1,7 @@
-uh ucbhelper : offuh sal cppu cppuhelper salhelper NULL
-uh ucbhelper usr1 - all uh_mkout NULL
-uh ucbhelper\inc nmake - all uh_inc NULL
-uh ucbhelper\source\client nmake - all uh_client uh_inc NULL
-uh ucbhelper\source\provider nmake - all uh_provider uh_inc NULL
-uh ucbhelper\util nmake - all uh_util uh_client uh_provider NULL
+uh ucbhelper : offuh sal cppu cppuhelper salhelper NULL
+uh ucbhelper usr1 - all uh_mkout NULL
+uh ucbhelper\inc nmake - all uh_inc NULL
+uh ucbhelper\source\client nmake - all uh_client uh_inc NULL
+uh ucbhelper\source\provider nmake - all uh_provider uh_inc NULL
+uh ucbhelper\util nmake - all uh_util uh_client uh_provider NULL
+uh ucbhelper\workben\myucp nmake - all uh_wb_myucp uh_util NULL
diff --git a/ucbhelper/prj/d.lst b/ucbhelper/prj/d.lst
index 64da268b6143..21a46483789b 100644
--- a/ucbhelper/prj/d.lst
+++ b/ucbhelper/prj/d.lst
@@ -9,7 +9,7 @@
mkdir: %_DEST%\inc%_EXT%\ucbhelper
..\inc\ucbhelper\configurationkeys.hxx %_DEST%\inc%_EXT%\ucbhelper\configurationkeys.hxx
-..\inc\ucbhelper\configureucb.hxx %_DEST%\inc%_EXT%\ucbhelper\configureucb.hxx
+..\inc\ucbhelper\registerucb.hxx %_DEST%\inc%_EXT%\ucbhelper\registerucb.hxx
..\inc\ucbhelper\content.hxx %_DEST%\inc%_EXT%\ucbhelper\content.hxx
..\inc\ucbhelper\contentbroker.hxx %_DEST%\inc%_EXT%\ucbhelper\contentbroker.hxx
..\inc\ucbhelper\commandenvironment.hxx %_DEST%\inc%_EXT%\ucbhelper\commandenvironment.hxx
diff --git a/ucbhelper/source/client/contentbroker.cxx b/ucbhelper/source/client/contentbroker.cxx
index 7e0e7f3657ca..408ff6af0dee 100644
--- a/ucbhelper/source/client/contentbroker.cxx
+++ b/ucbhelper/source/client/contentbroker.cxx
@@ -298,14 +298,18 @@ bool ContentBroker_Impl::initialize()
if ( m_xProviderMgr.is() )
{
- if ( !configureUcb( m_xProviderMgr,
- m_xSMgr,
- m_aProvData,
- 0 ) )
+ ContentProviderDataList::const_iterator aEnd(m_aProvData.end());
+ for (ContentProviderDataList::const_iterator aIt(m_aProvData.begin());
+ aIt != aEnd; ++aIt)
{
- OSL_ENSURE( false, "Failed to configure UCB!" );
- return false;
+ registerAtUcb(m_xProviderMgr,
+ m_xSMgr,
+ aIt->ServiceName,
+ aIt->Arguments,
+ aIt->URLTemplate,
+ 0);
}
+
}
}
}
diff --git a/ucbhelper/source/provider/makefile.mk b/ucbhelper/source/provider/makefile.mk
index db06a5df131c..5999192f7bdb 100644
--- a/ucbhelper/source/provider/makefile.mk
+++ b/ucbhelper/source/provider/makefile.mk
@@ -43,7 +43,6 @@ ENABLE_EXCEPTIONS=TRUE
.IF "$(header)" == ""
SLOFILES=\
- $(SLO)$/configureucb.obj \
$(SLO)$/contentidentifier.obj \
$(SLO)$/providerhelper.obj \
$(SLO)$/contenthelper.obj \
@@ -53,7 +52,6 @@ SLOFILES=\
$(SLO)$/resultsetmetadata.obj \
$(SLO)$/resultset.obj \
$(SLO)$/resultsethelper.obj \
- $(SLO)$/provconf.obj \
$(SLO)$/commandenvironmentproxy.obj \
$(SLO)$/interactionrequest.obj \
$(SLO)$/simpleinteractionrequest.obj \
diff --git a/ucbhelper/source/provider/propertyvalueset.cxx b/ucbhelper/source/provider/propertyvalueset.cxx
index 5d9cfe31cf87..1c857ca467f0 100644
--- a/ucbhelper/source/provider/propertyvalueset.cxx
+++ b/ucbhelper/source/provider/propertyvalueset.cxx
@@ -89,7 +89,8 @@ const sal_uInt32 OBJECT_VALUE_SET = 0x00040000;
struct PropertyValue
{
- Property aProperty;
+ ::rtl::OUString
+ sPropertyName;
sal_uInt32 nPropsSet;
sal_uInt32 nOrigValue;
@@ -240,12 +241,12 @@ class PropertyValues : public PropertyValuesVector {};
_member_name_, \
getCppuType( static_cast< const _type_ * >( 0 ) ) )
-#define SETVALUE_IMPL( _property_, _type_name_, _member_name_, _value_ ) \
+#define SETVALUE_IMPL( _prop_name_, _type_name_, _member_name_, _value_ ) \
\
osl::MutexGuard aGuard( m_aMutex ); \
\
ucbhelper_impl::PropertyValue aNewValue; \
- aNewValue.aProperty = _property_; \
+ aNewValue.sPropertyName = _prop_name_; \
aNewValue.nPropsSet = _type_name_; \
aNewValue.nOrigValue = _type_name_; \
aNewValue._member_name_ = _value_; \
@@ -642,7 +643,7 @@ sal_Int32 SAL_CALL PropertyValueSet::findColumn( const OUString& columnName )
sal_Int32 nCount = m_pValues->size();
for ( sal_Int32 n = 0; n < nCount; ++n )
{
- if ( (*m_pValues)[ n ].aProperty.Name.equals( columnName ) )
+ if ( (*m_pValues)[ n ].sPropertyName.equals( columnName ) )
return sal_Int32( n + 1 ); // Index is 1-based.
}
}
@@ -682,144 +683,144 @@ sal_Int32 PropertyValueSet::getLength() const
}
//=========================================================================
-void PropertyValueSet::appendString( const Property& rProp,
+void PropertyValueSet::appendString( const ::rtl::OUString& rPropName,
const OUString& rValue )
{
- SETVALUE_IMPL( rProp, STRING_VALUE_SET, aString, rValue );
+ SETVALUE_IMPL( rPropName, STRING_VALUE_SET, aString, rValue );
}
//=========================================================================
-void PropertyValueSet::appendBoolean( const Property& rProp,
+void PropertyValueSet::appendBoolean( const ::rtl::OUString& rPropName,
sal_Bool bValue )
{
- SETVALUE_IMPL( rProp, BOOLEAN_VALUE_SET, bBoolean, bValue );
+ SETVALUE_IMPL( rPropName, BOOLEAN_VALUE_SET, bBoolean, bValue );
}
//=========================================================================
-void PropertyValueSet::appendByte( const Property& rProp,
+void PropertyValueSet::appendByte( const ::rtl::OUString& rPropName,
sal_Int8 nValue )
{
- SETVALUE_IMPL( rProp, BYTE_VALUE_SET, nByte, nValue );
+ SETVALUE_IMPL( rPropName, BYTE_VALUE_SET, nByte, nValue );
}
//=========================================================================
-void PropertyValueSet::appendShort( const Property& rProp,
+void PropertyValueSet::appendShort( const ::rtl::OUString& rPropName,
sal_Int16 nValue )
{
- SETVALUE_IMPL( rProp, SHORT_VALUE_SET, nShort, nValue );
+ SETVALUE_IMPL( rPropName, SHORT_VALUE_SET, nShort, nValue );
}
//=========================================================================
-void PropertyValueSet::appendInt( const Property& rProp,
+void PropertyValueSet::appendInt( const ::rtl::OUString& rPropName,
sal_Int32 nValue )
{
- SETVALUE_IMPL( rProp, INT_VALUE_SET, nInt, nValue );
+ SETVALUE_IMPL( rPropName, INT_VALUE_SET, nInt, nValue );
}
//=========================================================================
-void PropertyValueSet::appendLong( const Property& rProp,
+void PropertyValueSet::appendLong( const ::rtl::OUString& rPropName,
sal_Int64 nValue )
{
- SETVALUE_IMPL( rProp, LONG_VALUE_SET, nLong, nValue );
+ SETVALUE_IMPL( rPropName, LONG_VALUE_SET, nLong, nValue );
}
//=========================================================================
-void PropertyValueSet::appendFloat( const Property& rProp,
+void PropertyValueSet::appendFloat( const ::rtl::OUString& rPropName,
float nValue )
{
- SETVALUE_IMPL( rProp, FLOAT_VALUE_SET, nFloat, nValue );
+ SETVALUE_IMPL( rPropName, FLOAT_VALUE_SET, nFloat, nValue );
}
//=========================================================================
-void PropertyValueSet::appendDouble( const Property& rProp,
+void PropertyValueSet::appendDouble( const ::rtl::OUString& rPropName,
double nValue )
{
- SETVALUE_IMPL( rProp, DOUBLE_VALUE_SET, nDouble, nValue );
+ SETVALUE_IMPL( rPropName, DOUBLE_VALUE_SET, nDouble, nValue );
}
//=========================================================================
-void PropertyValueSet::appendBytes( const Property& rProp,
+void PropertyValueSet::appendBytes( const ::rtl::OUString& rPropName,
const Sequence< sal_Int8 >& rValue )
{
- SETVALUE_IMPL( rProp, BYTES_VALUE_SET, aBytes, rValue );
+ SETVALUE_IMPL( rPropName, BYTES_VALUE_SET, aBytes, rValue );
}
//=========================================================================
-void PropertyValueSet::appendDate( const Property& rProp,
+void PropertyValueSet::appendDate( const ::rtl::OUString& rPropName,
const Date& rValue )
{
- SETVALUE_IMPL( rProp, DATE_VALUE_SET, aDate, rValue );
+ SETVALUE_IMPL( rPropName, DATE_VALUE_SET, aDate, rValue );
}
//=========================================================================
-void PropertyValueSet::appendTime( const Property& rProp,
+void PropertyValueSet::appendTime( const ::rtl::OUString& rPropName,
const Time& rValue )
{
- SETVALUE_IMPL( rProp, TIME_VALUE_SET, aTime, rValue );
+ SETVALUE_IMPL( rPropName, TIME_VALUE_SET, aTime, rValue );
}
//=========================================================================
-void PropertyValueSet::appendTimestamp( const Property& rProp,
+void PropertyValueSet::appendTimestamp( const ::rtl::OUString& rPropName,
const DateTime& rValue )
{
- SETVALUE_IMPL( rProp, TIMESTAMP_VALUE_SET, aTimestamp, rValue );
+ SETVALUE_IMPL( rPropName, TIMESTAMP_VALUE_SET, aTimestamp, rValue );
}
//=========================================================================
void PropertyValueSet::appendBinaryStream(
- const Property& rProp,
+ const ::rtl::OUString& rPropName,
const Reference< XInputStream >& rValue )
{
- SETVALUE_IMPL( rProp, BINARYSTREAM_VALUE_SET, xBinaryStream, rValue );
+ SETVALUE_IMPL( rPropName, BINARYSTREAM_VALUE_SET, xBinaryStream, rValue );
}
//=========================================================================
void PropertyValueSet::appendCharacterStream(
- const Property& rProp,
+ const ::rtl::OUString& rPropName,
const Reference< XInputStream >& rValue )
{
- SETVALUE_IMPL( rProp, CHARACTERSTREAM_VALUE_SET, xCharacterStream, rValue );
+ SETVALUE_IMPL( rPropName, CHARACTERSTREAM_VALUE_SET, xCharacterStream, rValue );
}
//=========================================================================
-void PropertyValueSet::appendObject( const Property& rProp,
+void PropertyValueSet::appendObject( const ::rtl::OUString& rPropName,
const Any& rValue )
{
- SETVALUE_IMPL( rProp, OBJECT_VALUE_SET, aObject, rValue );
+ SETVALUE_IMPL( rPropName, OBJECT_VALUE_SET, aObject, rValue );
}
//=========================================================================
-void PropertyValueSet::appendRef( const Property& rProp,
+void PropertyValueSet::appendRef( const ::rtl::OUString& rPropName,
const Reference< XRef >& rValue )
{
- SETVALUE_IMPL( rProp, REF_VALUE_SET, xRef, rValue );
+ SETVALUE_IMPL( rPropName, REF_VALUE_SET, xRef, rValue );
}
//=========================================================================
-void PropertyValueSet::appendBlob( const Property& rProp,
+void PropertyValueSet::appendBlob( const ::rtl::OUString& rPropName,
const Reference< XBlob >& rValue )
{
- SETVALUE_IMPL( rProp, BLOB_VALUE_SET, xBlob, rValue );
+ SETVALUE_IMPL( rPropName, BLOB_VALUE_SET, xBlob, rValue );
}
//=========================================================================
-void PropertyValueSet::appendClob( const Property& rProp,
+void PropertyValueSet::appendClob( const ::rtl::OUString& rPropName,
const Reference< XClob >& rValue )
{
- SETVALUE_IMPL( rProp, CLOB_VALUE_SET, xClob, rValue );
+ SETVALUE_IMPL( rPropName, CLOB_VALUE_SET, xClob, rValue );
}
//=========================================================================
-void PropertyValueSet::appendArray( const Property& rProp,
+void PropertyValueSet::appendArray( const ::rtl::OUString& rPropName,
const Reference< XArray >& rValue )
{
- SETVALUE_IMPL( rProp, ARRAY_VALUE_SET, xArray, rValue );
+ SETVALUE_IMPL( rPropName, ARRAY_VALUE_SET, xArray, rValue );
}
//=========================================================================
-void PropertyValueSet::appendVoid( const Property& rProp )
+void PropertyValueSet::appendVoid( const ::rtl::OUString& rPropName )
{
- SETVALUE_IMPL( rProp, NO_VALUE_SET, aObject, Any() );
+ SETVALUE_IMPL( rPropName, NO_VALUE_SET, aObject, Any() );
}
//=========================================================================
diff --git a/ucbhelper/source/provider/registerucb.cxx b/ucbhelper/source/provider/registerucb.cxx
index 0a749c9ccb5c..e6ccaf4743a8 100644
--- a/ucbhelper/source/provider/registerucb.cxx
+++ b/ucbhelper/source/provider/registerucb.cxx
@@ -27,7 +27,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_ucbhelper.hxx"
-#include <registerucb.hxx>
+#include <ucbhelper/registerucb.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/ucb/XContentProviderManager.hpp>
#include <com/sun/star/ucb/XParameterizedContentProvider.hpp>
@@ -35,7 +35,6 @@
#include <com/sun/star/uno/RuntimeException.hpp>
#include "osl/diagnose.h"
-#include <ucbhelper/configureucb.hxx>
using namespace com::sun::star;
@@ -162,41 +161,4 @@ registerAtUcb(
return bSuccess;
}
-//============================================================================
-//
-// deregisterFromUcb
-//
-//============================================================================
-
-void
-deregisterFromUcb(
- uno::Reference< ucb::XContentProviderManager > const & rManager,
- ContentProviderRegistrationInfo const & rInfo)
- throw (uno::RuntimeException)
-{
- uno::Reference< ucb::XContentProvider >
- xProvider(rInfo.m_xProvider);
- uno::Reference< ucb::XParameterizedContentProvider >
- xParameterized(xProvider, uno::UNO_QUERY);
- if (xParameterized.is())
- {
- uno::Reference< ucb::XContentProvider > xInstance;
- try
- {
- xInstance
- = xParameterized->deregisterInstance(rInfo.m_aTemplate,
- rInfo.m_aArguments);
- }
- catch (lang::IllegalArgumentException const &) {}
-
- if (xInstance.is())
- xProvider = xInstance;
- }
-
- if (rManager.is())
- rManager->deregisterContentProvider(xProvider, rInfo.m_aTemplate);
- //@@@ if this fails, a roll-back of deregisterInstance() is
- // missing
-}
-
}
diff --git a/ucbhelper/source/provider/registerucb.hxx b/ucbhelper/source/provider/registerucb.hxx
deleted file mode 100644
index f17321c76cd5..000000000000
--- a/ucbhelper/source/provider/registerucb.hxx
+++ /dev/null
@@ -1,96 +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 _UCBHELPER_REGISTERUCB_HXX_
-#define _UCBHELPER_REGISTERUCB_HXX_
-
-#include <com/sun/star/uno/RuntimeException.hpp>
-#include <com/sun/star/uno/Reference.h>
-
-namespace com { namespace sun { namespace star {
- namespace lang { class XMultiServiceFactory; }
- namespace ucb { class XContentProviderManager; }
-} } }
-namespace rtl { class OUString; }
-
-namespace ucbhelper {
-
-struct ContentProviderRegistrationInfo;
-
-//============================================================================
-/** Register a content provider at a Universal Content Broker.
-
- @param rManager A content provider manager (normally, this would be a
- UCB). May be null, which is only useful if the content provider is an
- <type>XParamterizedContentProvider</type>s.
-
- @param rServiceFactory A factory through which to obtain the required
- services.
-
- @param rName The service name of the content provider.
-
- @param rArguments Any arguments to instantiate the content provider with.
-
- @param rTemplate The URL template to register the content provider on.
-
- @param pInfo If not null, this output parameter is filled with
- information about the (atemptively) registered provider.
- */
-bool
-registerAtUcb(
- com::sun::star::uno::Reference<
- com::sun::star::ucb::XContentProviderManager > const &
- rManager,
- com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory > const &
- rServiceFactory,
- rtl::OUString const & rName,
- rtl::OUString const & rArguments,
- rtl::OUString const & rTemplate,
- ContentProviderRegistrationInfo * pInfo)
- throw (com::sun::star::uno::RuntimeException);
-
-//============================================================================
-/** Deregister a content provider from a Universal Content Broker.
-
- @param rManager A content provider manager (normally, this would be a
- UCB). May be null, which is only useful if the content provider is an
- <type>XParamterizedContentProvider</type>s.
-
- @param rInfo Information about the content provider to deregister.
- */
-void
-deregisterFromUcb(
- com::sun::star::uno::Reference<
- com::sun::star::ucb::XContentProviderManager > const &
- rManager,
- ContentProviderRegistrationInfo const & rInfo)
- throw (com::sun::star::uno::RuntimeException);
-
-}
-
-#endif // _UCBHELPER_REGISTERUCB_HXX_
diff --git a/ucbhelper/source/provider/simpleauthenticationrequest.cxx b/ucbhelper/source/provider/simpleauthenticationrequest.cxx
index f292fdf5fc06..8fc94cf88438 100644
--- a/ucbhelper/source/provider/simpleauthenticationrequest.cxx
+++ b/ucbhelper/source/provider/simpleauthenticationrequest.cxx
@@ -67,7 +67,7 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest(
sal_True,
sal_True,
aRequest.HasAccount,
- sal_False,
+ sal_True,
sal_False );
}
//=========================================================================
@@ -149,7 +149,7 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest(
eUserNameType == ENTITY_MODIFY,
ePasswordType == ENTITY_MODIFY,
eAccountType == ENTITY_MODIFY,
- sal_False,
+ sal_True,
sal_False );
}
@@ -200,22 +200,23 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest(
//=========================================================================
void SimpleAuthenticationRequest::initialize(
- const ucb::URLAuthenticationRequest & rRequest,
- sal_Bool bCanSetRealm,
- sal_Bool bCanSetUserName,
- sal_Bool bCanSetPassword,
- sal_Bool bCanSetAccount,
- sal_Bool bAllowPersistentStoring,
- sal_Bool bAllowUseSystemCredentials )
+ const ucb::URLAuthenticationRequest & rRequest,
+ sal_Bool bCanSetRealm,
+ sal_Bool bCanSetUserName,
+ sal_Bool bCanSetPassword,
+ sal_Bool bCanSetAccount,
+ sal_Bool bAllowPersistentStoring,
+ sal_Bool bAllowUseSystemCredentials )
{
setRequest( uno::makeAny( rRequest ) );
// Fill continuations...
- uno::Sequence< ucb::RememberAuthentication > aRememberModes( bAllowPersistentStoring ? 3 : 2 );
+ uno::Sequence< ucb::RememberAuthentication > aRememberModes(
+ bAllowPersistentStoring ? 3 : 2 );
aRememberModes[ 0 ] = ucb::RememberAuthentication_NO;
aRememberModes[ 1 ] = ucb::RememberAuthentication_SESSION;
if (bAllowPersistentStoring)
- aRememberModes[ 1 ] = ucb::RememberAuthentication_PERSISTENT;
+ aRememberModes[ 2 ] = ucb::RememberAuthentication_PERSISTENT;
m_xAuthSupplier
= new InteractionSupplyAuthentication(
diff --git a/ucbhelper/workben/myucp/exports.map b/ucbhelper/workben/myucp/exports.map
deleted file mode 100644
index f4ed78b9e970..000000000000
--- a/ucbhelper/workben/myucp/exports.map
+++ /dev/null
@@ -1,8 +0,0 @@
-UDK_3_0_0 {
- global:
- component_getImplementationEnvironment;
- component_writeInfo;
- component_getFactory;
- local:
- *;
-};
diff --git a/ucbhelper/workben/myucp/makefile.mk b/ucbhelper/workben/myucp/makefile.mk
index 0d7f273fe877..6fbad4e8a953 100644
--- a/ucbhelper/workben/myucp/makefile.mk
+++ b/ucbhelper/workben/myucp/makefile.mk
@@ -46,6 +46,7 @@ NO_BSYMBOLIC=TRUE
# --- Settings ---------------------------------------------------------
.INCLUDE: settings.mk
+.INCLUDE : ../../version.mk
# --- General -----------------------------------------------------
@@ -68,7 +69,7 @@ LIB1OBJFILES=$(SLOFILES)
SHL1TARGET=$(TARGET)
SHL1IMPLIB=i$(TARGET)
-SHL1VERSIONMAP=exports.map
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
# @@@ Add additional libs here.
SHL1STDLIBS=\
diff --git a/unotools/inc/unotools/configmgr.hxx b/unotools/inc/unotools/configmgr.hxx
index 82af190aab4f..c26ff5245739 100644
--- a/unotools/inc/unotools/configmgr.hxx
+++ b/unotools/inc/unotools/configmgr.hxx
@@ -99,7 +99,8 @@ namespace utl
PRODUCTXMLFILEFORMATVERSION,
WRITERCOMPATIBILITYVERSIONOOO11,
OPENSOURCECONTEXT,
- ABOUTBOXPRODUCTVERSION
+ ABOUTBOXPRODUCTVERSION,
+ OOOVENDOR
};
//direct readonly access to some special configuration elements
static com::sun::star::uno::Any GetDirectConfigProperty(ConfigProperty eProp);
diff --git a/unotools/inc/unotools/confignode.hxx b/unotools/inc/unotools/confignode.hxx
index 8745508375a1..57b5f5bd2afb 100644
--- a/unotools/inc/unotools/confignode.hxx
+++ b/unotools/inc/unotools/confignode.hxx
@@ -35,6 +35,11 @@
#include <com/sun/star/util/XChangesBatch.hpp>
#include <unotools/eventlisteneradapter.hxx>
+namespace comphelper
+{
+ class ComponentContext;
+}
+
//........................................................................
namespace utl
{
@@ -59,19 +64,23 @@ namespace utl
m_xReplaceAccess; /// replacing child values
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
m_xContainerAccess; /// modifying set nodes (optional interface of our UNO object)
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
- m_xProvider; /// the configuration provider which supplied the nodes of the hierarchy we're a part of
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ m_xDummy;
sal_Bool m_bEscapeNames; /// escape names before accessing children ?
::rtl::OUString
m_sCompletePath;
OConfigurationNode insertNode(const ::rtl::OUString& _rName,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xNode) const throw();
+
protected:
/// constructs a node object with an interface representing a node
OConfigurationNode(
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxNode,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxProvider);
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxNode
+ );
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >&
+ getUNONode() const { return m_xDirectAccess; }
public:
/// constructs an empty and invalid node object
@@ -88,6 +97,9 @@ namespace utl
/// returns the local name of the node
::rtl::OUString getLocalName() const;
+ /// returns the fully qualified path of the node
+ ::rtl::OUString getNodePath() const;
+
/** open a sub node
@param _rPath access path of the to-be-opened sub node. May be a hierarchical path.
*/
@@ -186,14 +198,6 @@ namespace utl
*/
sal_Bool getEscape() const { return m_bEscapeNames; }
- /** clone the object, creating a new hierarchy where the root represents the same node as the object
- where this method is called does.<p/>
- The new hierarchy does not share any updates with the one the object is a part of, i.e. any changes made
- in the existing hierarchy are not visible to the newly created one until committed (and vice versa).
- @param _rRoot out parameter. upon return, contains the object representing the root of the new hierarchy.
- */
- OConfigurationTreeRoot cloneAsRoot() const throw();
-
/// invalidate the object
virtual void clear() throw();
@@ -246,22 +250,23 @@ namespace utl
/** ctor<p/>
*/
OConfigurationTreeRoot(
- const ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesBatch >& _rxRootNode,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxProvider);
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesBatch >& _rxRootNode
+ );
/** ctor for a readonly node
*/
OConfigurationTreeRoot(
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxRootNode,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxProvider);
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxRootNode
+ );
public:
- /// modes to used when creating a top-level node object
+ /// modes to use when creating a top-level node object
enum CREATION_MODE
{
- CM_READONLY, /// open the node (i.e. sub tree) for read access only
- CM_UPDATABLE, /// open the node (i.e. sub tree) for read and write access
- CM_PREFER_UPDATABLE /// open the node (i.e. sub tree) for read and write access, if this fails, open it for read acces
+ /// open the node (i.e. sub tree) for read access only
+ CM_READONLY,
+ /// open the node (i.e. sub tree) for read and write access, fall back to read-only if write access is not possible
+ CM_UPDATABLE
};
public:
@@ -270,6 +275,22 @@ namespace utl
*/
OConfigurationTreeRoot() :OConfigurationNode() { }
+ /** creates a configuration tree for the given path in the given mode
+ */
+ OConfigurationTreeRoot(
+ const ::comphelper::ComponentContext& i_rContext,
+ const sal_Char* i_pAsciiNodePath,
+ const bool i_bUpdatable
+ );
+
+ /** creates a configuration tree for the given path in the given mode
+ */
+ OConfigurationTreeRoot(
+ const ::comphelper::ComponentContext& i_rContext,
+ const ::rtl::OUString& i_rNodePath,
+ const bool i_bUpdatable
+ );
+
/// copy ctor
OConfigurationTreeRoot(const OConfigurationTreeRoot& _rSource)
:OConfigurationNode(_rSource), m_xCommitter(_rSource.m_xCommitter) { }
@@ -293,7 +314,7 @@ namespace utl
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxConfProvider,
const ::rtl::OUString& _rPath,
sal_Int32 _nDepth = -1,
- CREATION_MODE _eMode = CM_PREFER_UPDATABLE,
+ CREATION_MODE _eMode = CM_UPDATABLE,
sal_Bool _bLazyWrite = sal_True
);
@@ -310,7 +331,7 @@ namespace utl
@param _eMode specifies which privileges should be applied when retrieving the node
*/
static OConfigurationTreeRoot createWithServiceFactory(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
- const ::rtl::OUString& _rPath, sal_Int32 _nDepth = -1, CREATION_MODE _eMode = CM_PREFER_UPDATABLE, sal_Bool _bLazyWrite = sal_True);
+ const ::rtl::OUString& _rPath, sal_Int32 _nDepth = -1, CREATION_MODE _eMode = CM_UPDATABLE, sal_Bool _bLazyWrite = sal_True);
/** tolerant version of the <member>createWithServiceFactory</member>
@@ -319,7 +340,7 @@ namespace utl
given node path does not exist) are still asserted.</p>
*/
static OConfigurationTreeRoot tryCreateWithServiceFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
- const ::rtl::OUString& _rPath, sal_Int32 _nDepth = -1, CREATION_MODE _eMode = CM_PREFER_UPDATABLE, sal_Bool _bLazyWrite = sal_True );
+ const ::rtl::OUString& _rPath, sal_Int32 _nDepth = -1, CREATION_MODE _eMode = CM_UPDATABLE, sal_Bool _bLazyWrite = sal_True );
/** commit all changes made on the subtree the object is the root for<p/>
All changes made on any <type>OConfigurationNode</type> object retrieved (maybe indirect) from this root
diff --git a/unotools/inc/unotools/lingucfg.hxx b/unotools/inc/unotools/lingucfg.hxx
index 720a2efb381c..9a26bdd73021 100644
--- a/unotools/inc/unotools/lingucfg.hxx
+++ b/unotools/inc/unotools/lingucfg.hxx
@@ -230,8 +230,10 @@ public:
::rtl::OUString GetSpellAndGrammarDialogImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const;
::rtl::OUString GetSpellAndGrammarContextSuggestionImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const;
::rtl::OUString GetSpellAndGrammarContextDictionaryImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const;
+ ::rtl::OUString GetThesaurusDialogImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const;
+ ::rtl::OUString GetSynonymsContextImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const;
- bool HasAnyVendorImages() const;
+ bool HasVendorImages( const char *pImageName ) const;
bool HasGrammarChecker() const;
};
diff --git a/unotools/source/config/configmgr.cxx b/unotools/source/config/configmgr.cxx
index 5f16733b5249..0df6d49afe59 100644
--- a/unotools/source/config/configmgr.cxx
+++ b/unotools/source/config/configmgr.cxx
@@ -70,6 +70,8 @@ namespace
: public rtl::Static< ::rtl::OUString, ProductVersion > {};
struct AboutBoxProductVersion
: public rtl::Static< ::rtl::OUString, AboutBoxProductVersion > {};
+ struct OOOVendor
+ : public rtl::Static< ::rtl::OUString, OOOVendor > {};
struct ProductExtension
: public rtl::Static< ::rtl::OUString, ProductExtension > {};
struct XMLFileFormatName
@@ -433,6 +435,14 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp)
return aRet;
}
+ rtl::OUString &rOOOVendor = OOOVendor::get();
+ if ( eProp == OOOVENDOR && rOOOVendor.getLength() )
+ {
+ aRet <<= rOOOVendor;
+ return aRet;
+ }
+
+
rtl::OUString &rProductExtension = ProductExtension::get();
if ( eProp == PRODUCTEXTENSION && rProductExtension.getLength() )
{
@@ -493,6 +503,7 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp)
case PRODUCTXMLFILEFORMATNAME :
case PRODUCTXMLFILEFORMATVERSION:
case OPENSOURCECONTEXT:
+ case OOOVENDOR:
case ABOUTBOXPRODUCTVERSION: sPath += C2U("Setup/Product"); break;
case DEFAULTCURRENCY: sPath += C2U("Setup/L10N"); break;
@@ -526,6 +537,7 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp)
case PRODUCTNAME: sProperty = C2U("ooName"); break;
case PRODUCTVERSION: sProperty = C2U("ooSetupVersion"); break;
case ABOUTBOXPRODUCTVERSION: sProperty = C2U("ooSetupVersionAboutBox"); break;
+ case OOOVENDOR: sProperty = C2U("ooVendor"); break;
case PRODUCTEXTENSION: sProperty = C2U("ooSetupExtension"); break;
case PRODUCTXMLFILEFORMATNAME: sProperty = C2U("ooXMLFileFormatName"); break;
case PRODUCTXMLFILEFORMATVERSION: sProperty = C2U("ooXMLFileFormatVersion"); break;
@@ -565,6 +577,9 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp)
if ( eProp == PRODUCTVERSION )
aRet >>= rProductVersion;
+ if( eProp == OOOVENDOR )
+ aRet >>= rOOOVendor;
+
if ( eProp == ABOUTBOXPRODUCTVERSION )
{
aRet >>= rAboutBoxProductVersion;
diff --git a/unotools/source/config/confignode.cxx b/unotools/source/config/confignode.cxx
index 802a63782cf9..181c7ca46c8f 100644
--- a/unotools/source/config/confignode.cxx
+++ b/unotools/source/config/confignode.cxx
@@ -40,6 +40,8 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/container/XNamed.hpp>
#include <comphelper/extract.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/namedvaluecollection.hxx>
#include <rtl/string.hxx>
#if OSL_DEBUG_LEVEL > 0
#include <rtl/strbuf.hxx>
@@ -60,9 +62,8 @@ namespace utl
//= OConfigurationNode
//========================================================================
//------------------------------------------------------------------------
- OConfigurationNode::OConfigurationNode(const Reference< XInterface >& _rxNode, const Reference< XMultiServiceFactory >& _rxProvider)
- :m_xProvider(_rxProvider)
- ,m_bEscapeNames(sal_False)
+ OConfigurationNode::OConfigurationNode(const Reference< XInterface >& _rxNode )
+ :m_bEscapeNames(sal_False)
{
OSL_ENSURE(_rxNode.is(), "OConfigurationNode::OConfigurationNode: invalid node interface!");
if (_rxNode.is())
@@ -98,7 +99,6 @@ namespace utl
,m_xDirectAccess(_rSource.m_xDirectAccess)
,m_xReplaceAccess(_rSource.m_xReplaceAccess)
,m_xContainerAccess(_rSource.m_xContainerAccess)
- ,m_xProvider(_rSource.m_xProvider)
,m_bEscapeNames(_rSource.m_bEscapeNames)
,m_sCompletePath(_rSource.m_sCompletePath)
{
@@ -116,7 +116,6 @@ namespace utl
m_xDirectAccess = _rSource.m_xDirectAccess;
m_xContainerAccess = _rSource.m_xContainerAccess;
m_xReplaceAccess = _rSource.m_xReplaceAccess;
- m_xProvider = _rSource.m_xProvider;
m_bEscapeNames = _rSource.m_bEscapeNames;
m_sCompletePath = _rSource.m_sCompletePath;
@@ -153,6 +152,22 @@ namespace utl
}
//------------------------------------------------------------------------
+ ::rtl::OUString OConfigurationNode::getNodePath() const
+ {
+ ::rtl::OUString sNodePath;
+ try
+ {
+ Reference< XHierarchicalName > xNamed( m_xDirectAccess, UNO_QUERY_THROW );
+ sNodePath = xNamed->getHierarchicalName();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return sNodePath;
+ }
+
+ //------------------------------------------------------------------------
::rtl::OUString OConfigurationNode::normalizeName(const ::rtl::OUString& _rName, NAMEORIGIN _eOrigin) const
{
::rtl::OUString sName(_rName);
@@ -244,7 +259,7 @@ namespace utl
::rtl::OUString sName = normalizeName(_rName, NO_CALLER);
m_xContainerAccess->insertByName(sName, makeAny(_xNode));
// if we're here, all was ok ...
- return OConfigurationNode(_xNode, m_xProvider);
+ return OConfigurationNode( _xNode );
}
catch(const Exception&)
{
@@ -308,7 +323,7 @@ namespace utl
OSL_ENSURE(sal_False, "OConfigurationNode::openNode: could not open the node!");
}
if (xNode.is())
- return OConfigurationNode(xNode, m_xProvider);
+ return OConfigurationNode( xNode );
}
catch(NoSuchElementException& e)
{
@@ -470,60 +485,112 @@ namespace utl
}
//------------------------------------------------------------------------
- OConfigurationTreeRoot OConfigurationNode::cloneAsRoot() const throw()
+ void OConfigurationNode::clear() throw()
{
- OSL_ENSURE(m_xHierarchyAccess.is(), "OConfigurationNode::cloneAsRoot: object is invalid!");
- if (m_xHierarchyAccess.is())
+ m_xHierarchyAccess.clear();
+ m_xDirectAccess.clear();
+ m_xReplaceAccess.clear();
+ m_xContainerAccess.clear();
+ }
+
+ //========================================================================
+ //= helper
+ //========================================================================
+ namespace
+ {
+ //--------------------------------------------------------------------
+ static const ::rtl::OUString& lcl_getProviderServiceName( )
{
- // first get the complete path of the node we represent
- ::rtl::OUString sCompletePath;
- Reference< XHierarchicalName > xNodeNameAccess(m_xHierarchyAccess, UNO_QUERY);
- if (xNodeNameAccess.is())
+ static ::rtl::OUString s_sProviderServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) );
+ return s_sProviderServiceName;
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XMultiServiceFactory > lcl_getConfigProvider( const ::comphelper::ComponentContext& i_rContext )
+ {
+ try
{
- try
- {
- sCompletePath = xNodeNameAccess->getHierarchicalName();
- OSL_ENSURE(sCompletePath.getLength(), "OConfigurationNode::cloneAsRoot: invalid path retrieved!");
- }
- catch(Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
+ Reference< XMultiServiceFactory > xProvider( i_rContext.createComponent( lcl_getProviderServiceName() ), UNO_QUERY_THROW );
+ return xProvider;
+ }
+ catch ( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
}
+ return NULL;
+ }
- // then create a new tree root object with that path and our provider
- OSL_ENSURE(m_xProvider.is(), "OConfigurationNode::cloneAsRoot: have an invalid provider!");
- if (sCompletePath.getLength() && m_xProvider.is())
+ //--------------------------------------------------------------------
+ Reference< XInterface > lcl_createConfigurationRoot( const Reference< XMultiServiceFactory >& i_rxConfigProvider,
+ const ::rtl::OUString& i_rNodePath, const bool i_bUpdatable, const sal_Int32 i_nDepth, const bool i_bLazyWrite )
+ {
+ ENSURE_OR_RETURN( i_rxConfigProvider.is(), "invalid provider", NULL );
+ try
{
- return OConfigurationTreeRoot::createWithProvider(m_xProvider, sCompletePath, -1, isReadonly() ? OConfigurationTreeRoot::CM_READONLY : OConfigurationTreeRoot::CM_PREFER_UPDATABLE);
+ ::comphelper::NamedValueCollection aArgs;
+ aArgs.put( "nodepath", i_rNodePath );
+ aArgs.put( "lazywrite", i_bLazyWrite );
+ aArgs.put( "depth", i_nDepth );
+
+ ::rtl::OUString sAccessService = ::rtl::OUString::createFromAscii(
+ i_bUpdatable
+ ? "com.sun.star.configuration.ConfigurationUpdateAccess"
+ : "com.sun.star.configuration.ConfigurationAccess" );
+
+ Reference< XInterface > xRoot(
+ i_rxConfigProvider->createInstanceWithArguments( sAccessService, aArgs.getWrappedPropertyValues() ),
+ UNO_SET_THROW
+ );
+ return xRoot;
}
+ catch ( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return NULL;
}
- return OConfigurationTreeRoot();
+ }
+ //========================================================================
+ //= OConfigurationTreeRoot
+ //========================================================================
+ //------------------------------------------------------------------------
+ OConfigurationTreeRoot::OConfigurationTreeRoot( const Reference< XChangesBatch >& _rxRootNode )
+ :OConfigurationNode( _rxRootNode.get() )
+ ,m_xCommitter(_rxRootNode)
+ {
}
//------------------------------------------------------------------------
- void OConfigurationNode::clear() throw()
+ OConfigurationTreeRoot::OConfigurationTreeRoot( const Reference< XInterface >& _rxRootNode )
+ :OConfigurationNode( _rxRootNode )
+ ,m_xCommitter( _rxRootNode, UNO_QUERY )
{
- m_xHierarchyAccess.clear();
- m_xDirectAccess.clear();
- m_xReplaceAccess.clear();
- m_xContainerAccess.clear();
}
- //========================================================================
- //= OConfigurationTreeRoot
- //========================================================================
//------------------------------------------------------------------------
- OConfigurationTreeRoot::OConfigurationTreeRoot(const Reference< XChangesBatch >& _rxRootNode, const Reference< XMultiServiceFactory >& _rxProvider)
- :OConfigurationNode(_rxRootNode.get(), _rxProvider)
- ,m_xCommitter(_rxRootNode)
+ OConfigurationTreeRoot::OConfigurationTreeRoot( const ::comphelper::ComponentContext& i_rContext, const sal_Char* i_pAsciiNodePath, const bool i_bUpdatable )
+ :OConfigurationNode( lcl_createConfigurationRoot( lcl_getConfigProvider( i_rContext.getLegacyServiceFactory() ),
+ ::rtl::OUString::createFromAscii( i_pAsciiNodePath ), i_bUpdatable, -1, false ).get() )
+ ,m_xCommitter()
{
+ if ( i_bUpdatable )
+ {
+ m_xCommitter.set( getUNONode(), UNO_QUERY );
+ OSL_ENSURE( m_xCommitter.is(), "OConfigurationTreeRoot::OConfigurationTreeRoot: could not create an updatable node!" );
+ }
}
//------------------------------------------------------------------------
- OConfigurationTreeRoot::OConfigurationTreeRoot(const Reference< XInterface >& _rxRootNode, const Reference< XMultiServiceFactory >& _rxProvider)
- :OConfigurationNode(_rxRootNode.get(), _rxProvider)
+ OConfigurationTreeRoot::OConfigurationTreeRoot( const ::comphelper::ComponentContext& i_rContext, const ::rtl::OUString& i_rNodePath, const bool i_bUpdatable )
+ :OConfigurationNode( lcl_createConfigurationRoot( lcl_getConfigProvider( i_rContext.getLegacyServiceFactory() ),
+ i_rNodePath, i_bUpdatable, -1, false ).get() )
+ ,m_xCommitter()
{
+ if ( i_bUpdatable )
+ {
+ m_xCommitter.set( getUNONode(), UNO_QUERY );
+ OSL_ENSURE( m_xCommitter.is(), "OConfigurationTreeRoot::OConfigurationTreeRoot: could not create an updatable node!" );
+ }
}
//------------------------------------------------------------------------
@@ -555,117 +622,20 @@ namespace utl
return sal_False;
}
- namespace
- {
- static const ::rtl::OUString& lcl_getProviderServiceName( )
- {
- static ::rtl::OUString s_sProviderServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) );
- return s_sProviderServiceName;
- }
- }
-
//------------------------------------------------------------------------
OConfigurationTreeRoot OConfigurationTreeRoot::createWithProvider(const Reference< XMultiServiceFactory >& _rxConfProvider, const ::rtl::OUString& _rPath, sal_Int32 _nDepth, CREATION_MODE _eMode, sal_Bool _bLazyWrite)
{
- OSL_ENSURE(_rxConfProvider.is(), "OConfigurationTreeRoot::createWithProvider: invalid provider!");
-
-#ifdef DBG_UTIL
- if (_rxConfProvider.is())
- {
- try
- {
- Reference< XServiceInfo > xSI(_rxConfProvider, UNO_QUERY);
- if (!xSI.is())
- {
- OSL_ENSURE(sal_False, "OConfigurationTreeRoot::createWithProvider: no XServiceInfo interface on the provider!");
- }
- else
- {
- OSL_ENSURE(xSI->supportsService( lcl_getProviderServiceName( ) ),
- "OConfigurationTreeRoot::createWithProvider: sure this is a provider? Missing the ConfigurationProvider service!");
- }
- }
- catch(const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-#endif
-
- sal_Bool bTryAgain(sal_False);
- do
- {
- if (_rxConfProvider.is())
- {
- try
- {
- Sequence< Any > aCreationArgs(3);
- aCreationArgs[0] = makeAny(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), 0, makeAny(_rPath), PropertyState_DIRECT_VALUE));
- aCreationArgs[1] = makeAny(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("depth")), 0, makeAny((sal_Int32)_nDepth), PropertyState_DIRECT_VALUE));
- aCreationArgs[2] = makeAny(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("lazywrite")), 0, ::cppu::bool2any(_bLazyWrite), PropertyState_DIRECT_VALUE));
-
- ::rtl::OUString sAccessService = ::rtl::OUString::createFromAscii(CM_READONLY == _eMode
- ? "com.sun.star.configuration.ConfigurationAccess"
- : "com.sun.star.configuration.ConfigurationUpdateAccess");
-
- Reference< XInterface > xRoot = _rxConfProvider->createInstanceWithArguments(sAccessService, aCreationArgs);
- if (!xRoot.is())
- {
- OSL_ENSURE(sal_False, "OConfigurationTreeRoot::createWithProvider: could not create the node access!");
- }
- else if (CM_READONLY == _eMode)
- {
- return OConfigurationTreeRoot(xRoot, _rxConfProvider);
- }
- else
- { // get the changes batch interface
- Reference< XChangesBatch > xCommitter(xRoot, UNO_QUERY);
- if (xCommitter.is())
- return OConfigurationTreeRoot(xCommitter, _rxConfProvider);
- else
- OSL_ENSURE(sal_False, "OConfigurationTreeRoot::createWithProvider: invalid root object (missing interface XChangesBatch)!");
-
- // dispose the object if it is already created, but unusable
- Reference< XComponent > xComp(xRoot, UNO_QUERY);
- if (xComp.is())
- try { xComp->dispose(); } catch(Exception&) { }
- }
- }
- catch(const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- bTryAgain = CM_PREFER_UPDATABLE == _eMode;
- if (bTryAgain)
- _eMode = CM_READONLY;
- }
- while (bTryAgain);
-
+ Reference< XInterface > xRoot( lcl_createConfigurationRoot(
+ _rxConfProvider, _rPath, _eMode != CM_READONLY, _nDepth, _bLazyWrite ) );
+ if ( xRoot.is() )
+ return OConfigurationTreeRoot( xRoot );
return OConfigurationTreeRoot();
}
//------------------------------------------------------------------------
- OConfigurationTreeRoot OConfigurationTreeRoot::createWithServiceFactory(const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rPath, sal_Int32 _nDepth, CREATION_MODE _eMode, sal_Bool _bLazyWrite)
+ OConfigurationTreeRoot OConfigurationTreeRoot::createWithServiceFactory( const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rPath, sal_Int32 _nDepth, CREATION_MODE _eMode, sal_Bool _bLazyWrite )
{
- OSL_ENSURE(_rxORB.is(), "OConfigurationTreeRoot::createWithServiceFactory: invalid service factory!");
- if (_rxORB.is())
- {
- try
- {
- Reference< XInterface > xProvider = _rxORB->createInstance( lcl_getProviderServiceName( ) );
- OSL_ENSURE(xProvider.is(), "OConfigurationTreeRoot::createWithServiceFactory: could not instantiate the config provider service!");
- Reference< XMultiServiceFactory > xProviderAsFac(xProvider, UNO_QUERY);
- OSL_ENSURE(xProviderAsFac.is() || !xProvider.is(), "OConfigurationTreeRoot::createWithServiceFactory: the provider is missing an interface!");
- if (xProviderAsFac.is())
- return createWithProvider(xProviderAsFac, _rPath, _nDepth, _eMode, _bLazyWrite);
- }
- catch(const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- return OConfigurationTreeRoot();
+ return createWithProvider( lcl_getConfigProvider( _rxORB ), _rPath, _nDepth, _eMode, _bLazyWrite );
}
//------------------------------------------------------------------------
@@ -681,9 +651,9 @@ namespace utl
if ( xConfigFactory.is() )
return createWithProvider( xConfigFactory, _rPath, _nDepth, _eMode, _bLazyWrite );
}
- catch(Exception&)
+ catch(const Exception&)
{
- // silent this, 'cause the contract of this method states "no assertions"
+ // silence this, 'cause the contract of this method states "no assertions"
}
}
return OConfigurationTreeRoot();
diff --git a/unotools/source/config/configvaluecontainer.cxx b/unotools/source/config/configvaluecontainer.cxx
index c04f29428bf5..653305f92f74 100644
--- a/unotools/source/config/configvaluecontainer.cxx
+++ b/unotools/source/config/configvaluecontainer.cxx
@@ -331,7 +331,7 @@ namespace utl
m_pImpl->xORB,
_rConfigLocation,
_nLevels,
- ( _nAccessFlags & CVC_UPDATE_ACCESS ) ? OConfigurationTreeRoot::CM_PREFER_UPDATABLE : OConfigurationTreeRoot::CM_READONLY,
+ ( _nAccessFlags & CVC_UPDATE_ACCESS ) ? OConfigurationTreeRoot::CM_UPDATABLE : OConfigurationTreeRoot::CM_READONLY,
( _nAccessFlags & CVC_IMMEDIATE_UPDATE ) ? sal_False : sal_True
);
#ifdef DBG_UTIL
diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx
index 35e0fb8af223..39233f022534 100644
--- a/unotools/source/config/lingucfg.cxx
+++ b/unotools/source/config/lingucfg.cxx
@@ -1406,21 +1406,72 @@ rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextDictionaryImage(
}
-bool SvtLinguConfig::HasAnyVendorImages() const
+::rtl::OUString SvtLinguConfig::GetThesaurusDialogImage(
+ const ::rtl::OUString &rServiceImplName,
+ bool bHighContrast ) const
{
- bool bRes = false;
- try
+ rtl::OUString aRes;
+ if (rServiceImplName.getLength() > 0)
{
- uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("Images") ), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("VendorImages") ), uno::UNO_QUERY_THROW );
+ rtl::OUString aImageName( A2OU( bHighContrast ? "ThesaurusDialogImage_HC" : "ThesaurusDialogImage" ));
+ rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) );
+ aRes = aPath;
+ }
+ return aRes;
+}
- uno::Sequence< rtl::OUString > aElementNames( xNA->getElementNames() );
- bRes = aElementNames.getLength() > 0;
+
+::rtl::OUString SvtLinguConfig::GetSynonymsContextImage(
+ const ::rtl::OUString &rServiceImplName,
+ bool bHighContrast ) const
+{
+ rtl::OUString aRes;
+ if (rServiceImplName.getLength() > 0)
+ {
+ rtl::OUString aImageName( A2OU( bHighContrast ? "SynonymsContextMenuImage_HC" : "SynonymsContextMenuImage" ));
+ rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) );
+ aRes = aPath;
}
- catch (uno::Exception &)
+ return aRes;
+}
+
+
+bool SvtLinguConfig::HasVendorImages( const char *pImageName ) const
+{
+ bool bRes = false;
+ if (pImageName)
{
- DBG_ASSERT( 0, "exception caught. HasAnyVendorImages failed" );
+ try
+ {
+ uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
+ xNA.set( xNA->getByName( A2OU("Images") ), uno::UNO_QUERY_THROW );
+ xNA.set( xNA->getByName( A2OU("VendorImages") ), uno::UNO_QUERY_THROW );
+
+ uno::Sequence< rtl::OUString > aElementNames( xNA->getElementNames() );
+ sal_Int32 nVendors = aElementNames.getLength();
+ const rtl::OUString *pVendor = aElementNames.getConstArray();
+ for (sal_Int32 i = 0; i < nVendors; ++i)
+ {
+ uno::Reference< container::XNameAccess > xNA2( xNA->getByName( pVendor[i] ), uno::UNO_QUERY_THROW );
+ uno::Sequence< rtl::OUString > aPropNames( xNA2->getElementNames() );
+ sal_Int32 nProps = aPropNames.getLength();
+ const rtl::OUString *pPropNames = aPropNames.getConstArray();
+ for (sal_Int32 k = 0; k < nProps; ++k)
+ {
+ // for a quicker check we ignore the HC image names here
+ const OUString &rName = pPropNames[k];
+ if (rName.equalsAscii( pImageName ))
+ {
+ bRes = true;
+ break;
+ }
+ }
+ }
+ }
+ catch (uno::Exception &)
+ {
+ DBG_ASSERT( 0, "exception caught. HasVendorImages failed" );
+ }
}
return bRes;
}
diff --git a/unotools/source/i18n/transliterationwrapper.cxx b/unotools/source/i18n/transliterationwrapper.cxx
index 062e34286d4b..a10a52802e19 100644
--- a/unotools/source/i18n/transliterationwrapper.cxx
+++ b/unotools/source/i18n/transliterationwrapper.cxx
@@ -31,11 +31,12 @@
#include <unotools/transliterationwrapper.hxx>
#include <tools/debug.hxx>
#include <i18npool/mslangid.hxx>
-#ifndef _COMPHELPER_COMPONENTFACTORY_HXX_
#include <comphelper/componentfactory.hxx>
-#endif
+
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
#define TRANSLIT_LIBRARYNAME "i18n"
#define TRANSLIT_SERVICENAME "com.sun.star.i18n.Transliteration"
@@ -147,7 +148,10 @@ sal_Bool TransliterationWrapper::needLanguageForTheMode() const
{
return TransliterationModules_UPPERCASE_LOWERCASE == nType ||
TransliterationModules_LOWERCASE_UPPERCASE == nType ||
- TransliterationModules_IGNORE_CASE == nType;
+ TransliterationModules_IGNORE_CASE == nType ||
+ (sal_uInt32) TransliterationModulesExtra::SENTENCE_CASE == (sal_uInt32) nType ||
+ (sal_uInt32) TransliterationModulesExtra::TITLE_CASE == (sal_uInt32) nType ||
+ (sal_uInt32) TransliterationModulesExtra::TOGGLE_CASE == (sal_uInt32) nType;
}
@@ -165,14 +169,32 @@ void TransliterationWrapper::loadModuleIfNeeded( sal_uInt16 nLang )
sal_Bool bLoad = bFirstCall;
bFirstCall = sal_False;
- if( nLanguage != nLang )
+ if( static_cast< sal_Int32 >(nType) == TransliterationModulesExtra::SENTENCE_CASE )
{
- setLanguageLocaleImpl( nLang );
- if( !bLoad )
- bLoad = needLanguageForTheMode();
+ if( bLoad )
+ loadModuleByImplName(String::CreateFromAscii("SENTENCE_CASE"), nLang);
+ }
+ else if( static_cast< sal_Int32 >(nType) == TransliterationModulesExtra::TITLE_CASE )
+ {
+ if( bLoad )
+ loadModuleByImplName(String::CreateFromAscii("TITLE_CASE"), nLang);
+ }
+ else if( static_cast< sal_Int32 >(nType) == TransliterationModulesExtra::TOGGLE_CASE )
+ {
+ if( bLoad )
+ loadModuleByImplName(String::CreateFromAscii("TOGGLE_CASE"), nLang);
+ }
+ else
+ {
+ if( nLanguage != nLang )
+ {
+ setLanguageLocaleImpl( nLang );
+ if( !bLoad )
+ bLoad = needLanguageForTheMode();
+ }
+ if( bLoad )
+ loadModuleImpl();
}
- if( bLoad )
- loadModuleImpl();
}
diff --git a/unotools/source/misc/desktopterminationobserver.cxx b/unotools/source/misc/desktopterminationobserver.cxx
index 23d5089f545e..3900449f03c9 100644
--- a/unotools/source/misc/desktopterminationobserver.cxx
+++ b/unotools/source/misc/desktopterminationobserver.cxx
@@ -211,12 +211,6 @@ namespace utl
void DesktopTerminationObserver::revokeTerminationListener( ITerminationListener* _pListener )
{
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if ( getListenerAdminData().bAlreadyTerminated )
- {
- _pListener->notifyTermination();
- return;
- }
-
Listeners& rListeners = getListenerAdminData().aListeners;
for ( Listeners::iterator lookup = rListeners.begin();
lookup != rListeners.end();
diff --git a/unotools/source/misc/fontcvt.cxx b/unotools/source/misc/fontcvt.cxx
index 1a31272a483c..2bb682e4915b 100644
--- a/unotools/source/misc/fontcvt.cxx
+++ b/unotools/source/misc/fontcvt.cxx
@@ -295,18 +295,18 @@ static const sal_Unicode aWingDings2Tab[224] =
// F050
0xe52f, 0xe530, 0xe531, 0xe532,
0xe533, 0xe534, 0xe535, 0xe536,
- 0xe537, 0xe538, 0xe539, 0xe53a,
+ 0xe537, 0x203D, 0x203D, 0x203D,
0xe53b, 0xe53c, 0xe53d, 0xe53e,
// F060
0xe53f, 0xe540, 0xe541, 0xe542,
0xe543, 0xe544, 0xe545, 0xe546,
- 0xe547, 0xe548, 0xe549, 0xe54a,
- 0xe54b, 0xe54c, 0xe54d, 0xe54e,
+ 0xe547, 0x24EA, 0x2460, 0x2461,
+ 0x2462, 0x2463, 0x2464, 0x2465,
// F070
- 0xe54e, 0xe54f, 0xe550, 0xe551,
- 0xe552, 0xe553, 0xe554, 0xe555,
- 0xe556, 0xe557, 0xe558, 0xe559,
- 0xe55a, 0xe55b, 0xe55c, 0,
+ 0x2466, 0x2467, 0x2468, 0x2469,
+ 0xE453, 0x278A, 0x278B, 0x278C,
+ 0x278D, 0x278E, 0x278F, 0x2790,
+ 0x2791, 0x2792, 0x2793, 0,
// F080
0x2609, 0x25cb, 0x263d, 0x263e,
0xe55d, 0xe55e, 0xe55f, 0xe560,
@@ -343,7 +343,7 @@ static const sal_Unicode aWingDings2Tab[224] =
0xe5c1, 0xe5c2, 0xe5c3, 0xe5c4,
0xe5c5, 0xe5c6, 0xe5c7, 0xe5c8,
// F0f0
- 0xe5c9, 0xe5ca, 0xe5cb, 0xe5cc,
+ 0xe5c9, 0x2022, 0xe5cb, 0xe5cc,
0xe5cd, 0xe5ce, 0xe5cf, 0xe5d0,
0x203b, 0x2042, 0, 0,
0, 0, 0, 0
diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx
index 4a3532b44659..c1c222755599 100644
--- a/unotools/source/misc/fontdefs.cxx
+++ b/unotools/source/misc/fontdefs.cxx
@@ -37,6 +37,7 @@ struct ImplLocalizedFontName
const sal_Unicode* mpLocalizedNames;
};
+// TODO: where did the 0,0 delimiters come from? A single 0 should suffice...
static sal_Unicode const aBatang[] = { 0xBC14, 0xD0D5, 0, 0 };
static sal_Unicode const aBatangChe[] = { 0xBC14, 0xD0D5, 0xCCB4, 0, 0 };
static sal_Unicode const aGungsuh[] = { 0xAD81, 0xC11C, 0, 0 };
@@ -72,6 +73,8 @@ static sal_Unicode const aMSGothic[] = { 'm','s', 0x30B4, 0x30B7, 0x30C3,
static sal_Unicode const aMSPGothic[] = { 'm','s','p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 };
static sal_Unicode const aMSMincho[] = { 'm', 's', 0x660E, 0x671D, 0 };
static sal_Unicode const aMSPMincho[] = { 'm','s','p', 0x660E, 0x671D, 0 };
+static sal_Unicode const aMSYaHei[] = { 0x5FAE, 0x8F6F, 0x96C5, 0x9ED1, 0 };
+static sal_Unicode const aMSJhengHei[] = { 0x5FAE, 0x8EDF, 0x6B63, 0x9ED1, 0x9AD4, 0 };
static sal_Unicode const aMeiryo[] = { 0x30e1, 0x30a4, 0x30ea, 0x30aa, 0 };
static sal_Unicode const aHGMinchoL[] = { 'h','g', 0x660E, 0x671D, 'l', 0, 0 };
static sal_Unicode const aHGGothicB[] = { 'h','g', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 0 };
@@ -180,7 +183,6 @@ static sal_Unicode const aHiraginoKakuGothicProN[] = { 0x30D2, 0x30E9, 0x30AE,
static sal_Unicode const aHiraginoMaruGothicPro[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o',0};
static sal_Unicode const aHiraginoMaruGothicProN[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o','n',0};
-
static ImplLocalizedFontName aImplLocalizedNamesList[] =
{
{ "batang", aBatang },
@@ -216,6 +218,8 @@ static ImplLocalizedFontName aImplLocalizedNamesList[] =
{ "mspgothic", aMSPGothic },
{ "msmincho", aMSMincho },
{ "mspmincho", aMSPMincho },
+{ "microsoftjhenghei", aMSJhengHei },
+{ "microsoftyahei", aMSYaHei },
{ "meiryo", aMeiryo },
{ "hgminchol", aHGMinchoL },
{ "hggothicb", aHGGothicB },
@@ -513,8 +517,6 @@ void AddTokenFontName( String& rName, const String& rNewToken )
ImplAppendFontToken( rName, rNewToken );
}
-
-
// =======================================================================
String GetSubsFontName( const String& rName, ULONG nFlags )
diff --git a/vcl/aqua/inc/salframe.h b/vcl/aqua/inc/salframe.h
index fd783270875e..c2ded3267f45 100644
--- a/vcl/aqua/inc/salframe.h
+++ b/vcl/aqua/inc/salframe.h
@@ -184,6 +184,8 @@ public:
NSView* getView() const { return mpView; }
unsigned int getStyleMask() const { return mnStyleMask; }
+ void getResolution( long& o_rDPIX, long& o_rDPIY );
+
// actually the follwing methods do the same thing: flipping y coordinates
// but having two of them makes clearer what the coordinate system
// is supposed to be before and after
diff --git a/vcl/aqua/inc/salframeview.h b/vcl/aqua/inc/salframeview.h
index 498c9679e97c..0174c1a68832 100755
--- a/vcl/aqua/inc/salframeview.h
+++ b/vcl/aqua/inc/salframeview.h
@@ -108,6 +108,7 @@
-(MacOSBOOL)sendKeyToFrameDirect: (USHORT)nKeyCode character: (sal_Unicode)aChar modifiers: (unsigned int)nMod;
-(MacOSBOOL)sendSingleCharacter:(NSEvent*)pEvent;
-(MacOSBOOL)handleKeyDownException:(NSEvent*)pEvent;
+-(void)clearLastEvent;
/*
text action methods
*/
diff --git a/vcl/aqua/inc/salgdi.h b/vcl/aqua/inc/salgdi.h
index d83067cb64b8..1948018806e1 100644
--- a/vcl/aqua/inc/salgdi.h
+++ b/vcl/aqua/inc/salgdi.h
@@ -191,7 +191,7 @@ public:
virtual sal_Bool drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry );
virtual sal_Bool drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry );
virtual sal_Bool drawPolyPolygonBezier( ULONG nPoly, const ULONG* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry );
- virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin);
+ virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin );
// CopyArea --> No RasterOp, but ClipRegion
virtual void copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth,
@@ -230,15 +230,15 @@ public:
CGPoint* makeCGptArray(ULONG nPoints, const SalPoint* pPtAry);
// native widget rendering methods that require mirroring
virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside );
+ const Point& aPos, BOOL& rIsInside );
virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ ControlState nState, const ImplControlValue& aValue,
const rtl::OUString& aCaption );
virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const rtl::OUString& aCaption );
+ const rtl::OUString& aCaption );
virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, const rtl::OUString& aCaption,
+ const ImplControlValue& aValue, const rtl::OUString& aCaption,
Region &rNativeBoundingRegion, Region &rNativeContentRegion );
// get device resolution
diff --git a/vcl/aqua/inc/salinst.h b/vcl/aqua/inc/salinst.h
index 8a44f7ef3304..0bceb99d1d0e 100644
--- a/vcl/aqua/inc/salinst.h
+++ b/vcl/aqua/inc/salinst.h
@@ -32,6 +32,7 @@
#include "vos/mutex.hxx"
#include "vos/thread.hxx"
#include "vcl/salinst.hxx"
+#include "osl/conditn.h"
#include "aquavcltypes.h"
@@ -96,6 +97,7 @@ public:
int mnActivePrintJobs;
std::list< SalUserEvent > maUserEvents;
oslMutex maUserEventListMutex;
+ oslCondition maWaitingYieldCond;
typedef std::list<const ApplicationEvent*> AppEventList;
static AppEventList aAppEventList;
diff --git a/vcl/aqua/source/a11y/aqua11yfactory.mm b/vcl/aqua/source/a11y/aqua11yfactory.mm
index eb745ea24aa5..7732ce202cd2 100644
--- a/vcl/aqua/source/a11y/aqua11yfactory.mm
+++ b/vcl/aqua/source/a11y/aqua11yfactory.mm
@@ -48,6 +48,7 @@
#include "aqua11ywrappersplitter.h"
#include "aqua11ywrappertabgroup.h"
#include "aqua11ywrappertoolbar.h"
+#include "aqua11ytablewrapper.h"
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
using namespace ::com::sun::star::accessibility;
@@ -142,6 +143,8 @@ static bool enabled = false;
aWrapper = [ [ AquaA11yWrapperList alloc ] initWithAccessibleContext: rxAccessibleContext ];
} else if ( [ nativeRole isEqualToString: NSAccessibilitySplitterRole ] ) {
aWrapper = [ [ AquaA11yWrapperSplitter alloc ] initWithAccessibleContext: rxAccessibleContext ];
+ } else if ( [ nativeRole isEqualToString: NSAccessibilityTableRole ] ) {
+ aWrapper = [ [ AquaA11yTableWrapper alloc ] initWithAccessibleContext: rxAccessibleContext ];
} else {
aWrapper = [ [ AquaA11yWrapper alloc ] initWithAccessibleContext: rxAccessibleContext ];
}
diff --git a/vcl/aqua/source/a11y/aqua11ytablewrapper.h b/vcl/aqua/source/a11y/aqua11ytablewrapper.h
index 8753365377e3..7bf3e44a2945 100644
--- a/vcl/aqua/source/a11y/aqua11ytablewrapper.h
+++ b/vcl/aqua/source/a11y/aqua11ytablewrapper.h
@@ -30,9 +30,15 @@
#include "aqua11ywrapper.h"
-@interface AquaA11yTableWrapper : NSObject
+#define MAXIMUM_ACCESSIBLE_TABLE_CELLS 1000
+
+@interface AquaA11yTableWrapper : AquaA11yWrapper
{
}
-+(id)childrenAttributeForElement:(AquaA11yWrapper *)wrapper;
++(id)childrenAttributeForElement:(AquaA11yTableWrapper *)wrapper;
++(void)addAttributeNamesTo: (NSMutableArray *)attributeNames object: (AquaA11yWrapper*)pObject;
+
+-(id)rowsAttribute;
+-(id)columnsAttribute;
@end
#endif // _SV_AQUA11TABLEWRAPPER_H
diff --git a/vcl/aqua/source/a11y/aqua11ytablewrapper.mm b/vcl/aqua/source/a11y/aqua11ytablewrapper.mm
index 08205ac8a66b..98454ab8d57b 100644
--- a/vcl/aqua/source/a11y/aqua11ytablewrapper.mm
+++ b/vcl/aqua/source/a11y/aqua11ytablewrapper.mm
@@ -35,38 +35,120 @@ using namespace ::com::sun::star::accessibility;
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::uno;
-@implementation AquaA11yTableWrapper : NSObject
+@implementation AquaA11yTableWrapper : AquaA11yWrapper
-+(id)childrenAttributeForElement:(AquaA11yWrapper *)wrapper
++(id)childrenAttributeForElement:(AquaA11yTableWrapper *)wrapper
{
- try
+ XAccessibleTable * accessibleTable = [ wrapper accessibleTable ];
+ NSArray* pResult = nil;
+ if( accessibleTable )
{
NSMutableArray * cells = [ [ NSMutableArray alloc ] init ];
- XAccessibleComponent * accessibleComponent = [ wrapper accessibleComponent ];
- XAccessibleTable * accessibleTable = [ wrapper accessibleTable ];
- // find out which cells are actually visible by determining the top-left-cell and the bottom-right-cell
- Size tableSize = accessibleComponent -> getSize();
- Point point;
- point.X = 0;
- point.Y = 0;
- Reference < XAccessible > rAccessibleTopLeft = accessibleComponent -> getAccessibleAtPoint ( point );
- point.X = tableSize.Width - 1;
- point.Y = tableSize.Height - 1;
- Reference < XAccessible > rAccessibleBottomRight = accessibleComponent -> getAccessibleAtPoint ( point );
- if ( rAccessibleTopLeft.is() && rAccessibleBottomRight.is() )
+ try
{
- sal_Int32 idxTopLeft = rAccessibleTopLeft -> getAccessibleContext() -> getAccessibleIndexInParent();
- sal_Int32 idxBottomRight = rAccessibleBottomRight -> getAccessibleContext() -> getAccessibleIndexInParent();
- sal_Int32 rowTopLeft = accessibleTable -> getAccessibleRow ( idxTopLeft );
- sal_Int32 columnTopLeft = accessibleTable -> getAccessibleColumn ( idxTopLeft );
- sal_Int32 rowBottomRight = accessibleTable -> getAccessibleRow ( idxBottomRight );
- sal_Int32 columnBottomRight = accessibleTable -> getAccessibleColumn ( idxBottomRight );
- // create an array containing the visible cells
- for ( sal_Int32 rowCount = rowTopLeft; rowCount <= rowBottomRight; rowCount++ )
+ sal_Int32 nRows = accessibleTable->getAccessibleRowCount();
+ sal_Int32 nCols = accessibleTable->getAccessibleColumnCount();
+
+ if( nRows * nCols < MAXIMUM_ACCESSIBLE_TABLE_CELLS )
{
- for ( sal_Int32 columnCount = columnTopLeft; columnCount <= columnBottomRight; columnCount++ )
+ // make all children visible to the hierarchy
+ for ( sal_Int32 rowCount = 0; rowCount < nRows; rowCount++ )
{
- Reference < XAccessible > rAccessibleCell = accessibleTable -> getAccessibleCellAt ( rowCount, columnCount );
+ for ( sal_Int32 columnCount = 0; columnCount < nCols; columnCount++ )
+ {
+ Reference < XAccessible > rAccessibleCell = accessibleTable -> getAccessibleCellAt ( rowCount, columnCount );
+ if ( rAccessibleCell.is() )
+ {
+ id cell_wrapper = [ AquaA11yFactory wrapperForAccessibleContext: rAccessibleCell -> getAccessibleContext() ];
+ [ cells addObject: cell_wrapper ];
+ [ cell_wrapper release ];
+ }
+ }
+ }
+ }
+ else
+ {
+ XAccessibleComponent * accessibleComponent = [ wrapper accessibleComponent ];
+ // find out which cells are actually visible by determining the top-left-cell and the bottom-right-cell
+ Size tableSize = accessibleComponent -> getSize();
+ Point point;
+ point.X = 0;
+ point.Y = 0;
+ Reference < XAccessible > rAccessibleTopLeft = accessibleComponent -> getAccessibleAtPoint ( point );
+ point.X = tableSize.Width - 1;
+ point.Y = tableSize.Height - 1;
+ Reference < XAccessible > rAccessibleBottomRight = accessibleComponent -> getAccessibleAtPoint ( point );
+ if ( rAccessibleTopLeft.is() && rAccessibleBottomRight.is() )
+ {
+ sal_Int32 idxTopLeft = rAccessibleTopLeft -> getAccessibleContext() -> getAccessibleIndexInParent();
+ sal_Int32 idxBottomRight = rAccessibleBottomRight -> getAccessibleContext() -> getAccessibleIndexInParent();
+ sal_Int32 rowTopLeft = accessibleTable -> getAccessibleRow ( idxTopLeft );
+ sal_Int32 columnTopLeft = accessibleTable -> getAccessibleColumn ( idxTopLeft );
+ sal_Int32 rowBottomRight = accessibleTable -> getAccessibleRow ( idxBottomRight );
+ sal_Int32 columnBottomRight = accessibleTable -> getAccessibleColumn ( idxBottomRight );
+ // create an array containing the visible cells
+ for ( sal_Int32 rowCount = rowTopLeft; rowCount <= rowBottomRight; rowCount++ )
+ {
+ for ( sal_Int32 columnCount = columnTopLeft; columnCount <= columnBottomRight; columnCount++ )
+ {
+ Reference < XAccessible > rAccessibleCell = accessibleTable -> getAccessibleCellAt ( rowCount, columnCount );
+ if ( rAccessibleCell.is() )
+ {
+ id cell_wrapper = [ AquaA11yFactory wrapperForAccessibleContext: rAccessibleCell -> getAccessibleContext() ];
+ [ cells addObject: cell_wrapper ];
+ [ cell_wrapper release ];
+ }
+ }
+ }
+ }
+ }
+ pResult = NSAccessibilityUnignoredChildren( cells );
+ }
+ catch (const Exception &e)
+ {
+ }
+ [cells autorelease];
+ }
+
+ return pResult;
+}
+
++(void)addAttributeNamesTo: (NSMutableArray *)attributeNames object: (AquaA11yWrapper*)pObject
+{
+ XAccessibleTable * accessibleTable = [ pObject accessibleTable ];
+ if( accessibleTable )
+ {
+ sal_Int32 nRows = accessibleTable->getAccessibleRowCount();
+ sal_Int32 nCols = accessibleTable->getAccessibleColumnCount();
+
+
+ if( nRows*nCols < MAXIMUM_ACCESSIBLE_TABLE_CELLS )
+ {
+ [ attributeNames addObject: NSAccessibilityRowsAttribute ];
+ [ attributeNames addObject: NSAccessibilityColumnsAttribute ];
+ }
+ }
+}
+
+-(id)rowsAttribute
+{
+ NSArray* pResult = nil;
+
+ XAccessibleTable * accessibleTable = [ self accessibleTable ];
+ if( accessibleTable )
+ {
+ sal_Int32 nRows = accessibleTable->getAccessibleRowCount();
+ sal_Int32 nCols = accessibleTable->getAccessibleColumnCount();
+ if( nRows * nCols < MAXIMUM_ACCESSIBLE_TABLE_CELLS )
+ {
+ NSMutableArray * cells = [ [ NSMutableArray alloc ] init ];
+ try
+ {
+ // find out number of rows
+ sal_Int32 nRows = accessibleTable->getAccessibleRowCount();
+ for( sal_Int32 n = 0; n < nRows; n++ )
+ {
+ Reference < XAccessible > rAccessibleCell = accessibleTable -> getAccessibleCellAt ( n, 0 );
if ( rAccessibleCell.is() )
{
id cell_wrapper = [ AquaA11yFactory wrapperForAccessibleContext: rAccessibleCell -> getAccessibleContext() ];
@@ -74,16 +156,56 @@ using namespace ::com::sun::star::uno;
[ cell_wrapper release ];
}
}
+ pResult = NSAccessibilityUnignoredChildren( cells );
+ }
+ catch (const Exception &e)
+ {
+ pResult = nil;
}
+ [ cells autorelease ];
}
- [ cells autorelease ];
- return NSAccessibilityUnignoredChildren( cells );
}
- catch (const Exception &e)
+
+ return pResult;
+}
+
+-(id)columnsAttribute
+{
+ NSArray* pResult = nil;
+
+ XAccessibleTable * accessibleTable = [ self accessibleTable ];
+
+ if( accessibleTable )
{
- // TODO: Log
- return nil;
+ sal_Int32 nRows = accessibleTable->getAccessibleRowCount();
+ sal_Int32 nCols = accessibleTable->getAccessibleColumnCount();
+ if( nRows * nCols < MAXIMUM_ACCESSIBLE_TABLE_CELLS )
+ {
+ NSMutableArray * cells = [ [ NSMutableArray alloc ] init ];
+ try
+ {
+ // find out number of columns
+ for( sal_Int32 n = 0; n < nCols; n++ )
+ {
+ Reference < XAccessible > rAccessibleCell = accessibleTable -> getAccessibleCellAt ( 0, n );
+ if ( rAccessibleCell.is() )
+ {
+ id cell_wrapper = [ AquaA11yFactory wrapperForAccessibleContext: rAccessibleCell -> getAccessibleContext() ];
+ [ cells addObject: cell_wrapper ];
+ [ cell_wrapper release ];
+ }
+ }
+ pResult = NSAccessibilityUnignoredChildren( cells );
+ }
+ catch (const Exception &e)
+ {
+ pResult = nil;
+ }
+ [ cells autorelease ];
+ }
}
+
+ return pResult;
}
@end
diff --git a/vcl/aqua/source/a11y/aqua11ywrapper.mm b/vcl/aqua/source/a11y/aqua11ywrapper.mm
index 959746d533dc..e86676e725f2 100644
--- a/vcl/aqua/source/a11y/aqua11ywrapper.mm
+++ b/vcl/aqua/source/a11y/aqua11ywrapper.mm
@@ -29,6 +29,8 @@
#include "precompiled_vcl.hxx"
#include "salinst.h"
+#include "saldata.hxx"
+
#include "aqua11ywrapper.h"
#include "aqua11yactionwrapper.h"
#include "aqua11ycomponentwrapper.h"
@@ -41,6 +43,7 @@
#include "aqua11yfocuslistener.hxx"
#include "aqua11yfocustracker.hxx"
#include "aqua11yrolehelper.h"
+
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
@@ -217,7 +220,8 @@ static MacOSBOOL isPopupMenuOpen = NO;
-(id)roleAttribute {
if ( mActsAsRadioGroup ) {
return NSAccessibilityRadioGroupRole;
- } else {
+ }
+ else {
return [ AquaA11yRoleHelper getNativeRoleFrom: [ self accessibleContext ] ];
}
}
@@ -323,8 +327,10 @@ static MacOSBOOL isPopupMenuOpen = NO;
}
}
return children;
- } else if ( [ self accessibleTable ] != nil ) {
- return [ AquaA11yTableWrapper childrenAttributeForElement: self ];
+ } else if ( [ self accessibleTable ] != nil )
+ {
+ AquaA11yTableWrapper* pTable = [self isKindOfClass: [AquaA11yTableWrapper class]] ? (AquaA11yTableWrapper*)self : nil;
+ return [ AquaA11yTableWrapper childrenAttributeForElement: pTable ];
} else {
try {
NSMutableArray * children = [ [ NSMutableArray alloc ] init ];
@@ -663,6 +669,7 @@ static MacOSBOOL isPopupMenuOpen = NO;
if ( isPopupMenuOpen ) {
return nil;
}
+
id value = nil;
// if we are no longer in the wrapper repository, we have been disposed
AquaA11yWrapper * theWrapper = [ AquaA11yFactory wrapperForAccessibleContext: [ self accessibleContext ] createIfNotExists: NO ];
@@ -717,6 +724,7 @@ static MacOSBOOL isPopupMenuOpen = NO;
NSString * nativeSubrole = nil;
NSString * title = nil;
NSMutableArray * attributeNames = nil;
+ sal_Int32 nAccessibleChildren = 0;
try {
// Default Attributes
attributeNames = [ NSMutableArray arrayWithObjects:
@@ -737,8 +745,9 @@ static MacOSBOOL isPopupMenuOpen = NO;
}
try
{
- if ( [ self accessibleContext ] -> getAccessibleChildCount() > 0 ) {
- [ attributeNames addObject: NSAccessibilityChildrenAttribute ];
+ nAccessibleChildren = [ self accessibleContext ] -> getAccessibleChildCount();
+ if ( nAccessibleChildren > 0 ) {
+ [ attributeNames addObject: NSAccessibilityChildrenAttribute ];
}
}
catch( DisposedException& ) {}
@@ -754,6 +763,9 @@ static MacOSBOOL isPopupMenuOpen = NO;
[ attributeNames addObject: NSAccessibilityServesAsTitleForUIElementsAttribute ];
}
// Special Attributes depending on interface
+ if( [self accessibleContext ] -> getAccessibleRole() == AccessibleRole::TABLE )
+ [AquaA11yTableWrapper addAttributeNamesTo: attributeNames object: self];
+
if ( [ self accessibleText ] != nil ) {
[ AquaA11yTextWrapper addAttributeNamesTo: attributeNames ];
}
@@ -953,14 +965,15 @@ static MacOSBOOL isPopupMenuOpen = NO;
return hit;
}
-Reference < XAccessibleContext > hitTestRunner ( Point point, Reference < XAccessibleContext > rxAccessibleContext ) {
+Reference < XAccessibleContext > hitTestRunner ( com::sun::star::awt::Point point,
+ Reference < XAccessibleContext > rxAccessibleContext ) {
Reference < XAccessibleContext > hitChild;
Reference < XAccessibleContext > emptyReference;
try {
Reference < XAccessibleComponent > rxAccessibleComponent ( rxAccessibleContext, UNO_QUERY );
if ( rxAccessibleComponent.is() ) {
- Point location = rxAccessibleComponent -> getLocationOnScreen();
- Point hitPoint ( point.X - location.X , point.Y - location.Y);
+ com::sun::star::awt::Point location = rxAccessibleComponent -> getLocationOnScreen();
+ com::sun::star::awt::Point hitPoint ( point.X - location.X , point.Y - location.Y);
Reference < XAccessible > rxAccessible = rxAccessibleComponent -> getAccessibleAtPoint ( hitPoint );
if ( rxAccessible.is() && rxAccessible -> getAccessibleContext().is() ) {
if ( rxAccessible -> getAccessibleContext() -> getAccessibleChildCount() > 0 ) {
@@ -999,7 +1012,7 @@ Reference < XAccessibleContext > hitTestRunner ( Point point, Reference < XAcces
}
Reference < XAccessibleContext > hitChild;
NSRect screenRect = [ [ NSScreen mainScreen ] frame ];
- Point hitPoint ( static_cast<long>(point.x) , static_cast<long>(screenRect.size.height - point.y) );
+ com::sun::star::awt::Point hitPoint ( static_cast<long>(point.x) , static_cast<long>(screenRect.size.height - point.y) );
// check child windows first
NSWindow * window = (NSWindow *) [ self accessibilityAttributeValue: NSAccessibilityWindowAttribute ];
NSArray * childWindows = [ window childWindows ];
diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx
index 62c59e78c963..b8a2261ed9db 100644
--- a/vcl/aqua/source/app/salinst.cxx
+++ b/vcl/aqua/source/app/salinst.cxx
@@ -474,6 +474,7 @@ AquaSalInstance::AquaSalInstance()
mbWaitingYield = false;
maUserEventListMutex = osl_createMutex();
mnActivePrintJobs = 0;
+ maWaitingYieldCond = osl_createCondition();
}
// -----------------------------------------------------------------------
@@ -484,6 +485,7 @@ AquaSalInstance::~AquaSalInstance()
mpSalYieldMutex->release();
delete mpSalYieldMutex;
osl_destroyMutex( maUserEventListMutex );
+ osl_destroyCondition( maWaitingYieldCond );
}
// -----------------------------------------------------------------------
@@ -713,6 +715,7 @@ void AquaSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents )
if( aEvent.mpFrame && AquaSalFrame::isAlive( aEvent.mpFrame ) )
{
aEvent.mpFrame->CallCallback( aEvent.mnType, aEvent.mpData );
+ osl_setCondition( maWaitingYieldCond );
// return if only one event is asked for
if( ! bHandleAllCurrentEvents )
return;
@@ -785,6 +788,18 @@ void AquaSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents )
(*it)->maInvalidRect.SetEmpty();
}
}
+ osl_setCondition( maWaitingYieldCond );
+ }
+ else if( bWait )
+ {
+ // #i103162#
+ // wait until any thread (most likely the main thread)
+ // has dispatched an event, cop out at 200 ms
+ osl_resetCondition( maWaitingYieldCond );
+ TimeValue aVal = { 0, 200000000 };
+ ULONG nCount = ReleaseYieldMutex();
+ osl_waitCondition( maWaitingYieldCond, &aVal );
+ AcquireYieldMutex( nCount );
}
// we get some apple events way too early
diff --git a/vcl/aqua/source/dtrans/aqua_clipboard.cxx b/vcl/aqua/source/dtrans/aqua_clipboard.cxx
index d3a4e9bc604c..52fb13e1e11f 100644
--- a/vcl/aqua/source/dtrans/aqua_clipboard.cxx
+++ b/vcl/aqua/source/dtrans/aqua_clipboard.cxx
@@ -189,6 +189,10 @@ void SAL_CALL AquaClipboard::setContents(const Reference<XTransferable>& xTransf
const Reference<XClipboardOwner>& xClipboardOwner)
throw( RuntimeException )
{
+ NSArray* types = xTransferable.is() ?
+ mpDataFlavorMapper->flavorSequenceToTypesArray(xTransferable->getTransferDataFlavors()) :
+ [NSArray array];
+
ClearableMutexGuard aGuard(m_aMutex);
Reference<XClipboardOwner> oldOwner(mXClipboardOwner);
@@ -197,11 +201,10 @@ void SAL_CALL AquaClipboard::setContents(const Reference<XTransferable>& xTransf
Reference<XTransferable> oldContent(mXClipboardContent);
mXClipboardContent = xTransferable;
- NSArray* types = mXClipboardContent.is() ?
- mpDataFlavorMapper->flavorSequenceToTypesArray(mXClipboardContent->getTransferDataFlavors()) :
- [NSArray array];
mPasteboardChangeCount = [mPasteboard declareTypes: types owner: mEventListener];
+ aGuard.clear();
+
// if we are already the owner of the clipboard
// then fire lost ownership event
if (oldOwner.is())
@@ -253,7 +256,7 @@ void SAL_CALL AquaClipboard::removeClipboardListener(const Reference< XClipboard
void AquaClipboard::applicationDidBecomeActive(NSNotification* aNotification)
{
- MutexGuard aGuard(m_aMutex);
+ ClearableMutexGuard aGuard(m_aMutex);
int currentPboardChgCount = [mPasteboard changeCount];
@@ -270,6 +273,8 @@ void AquaClipboard::applicationDidBecomeActive(NSNotification* aNotification)
Reference<XTransferable> oldContent(mXClipboardContent);
mXClipboardContent = Reference<XTransferable>();
+ aGuard.clear();
+
if (oldOwner.is())
{
fireLostClipboardOwnershipEvent(oldOwner, oldContent);
diff --git a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm
index 74c66ab1401d..d00fc9a6cd0e 100644
--- a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm
+++ b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm
@@ -318,6 +318,12 @@ class ControllerProperties
double fScaleX = double(aLogicSize.Width())/double(aPageSize.aSize.Width());
double fScaleY = double(aLogicSize.Height())/double(aPageSize.aSize.Height());
double fScale = (fScaleX < fScaleY) ? fScaleX : fScaleY;
+ // #i104784# if we render the page too small then rounding issues result in
+ // layout artifacts looking really bad. So scale the page unto a device that is not
+ // full page size but not too small either. This also results in much better visual
+ // quality of the preview, e.g. when its height approaches the number of text lines
+ if( fScale < 0.1 )
+ fScale = 0.1;
aMtf.WindStart();
aMtf.Scale( fScale, fScale );
aMtf.WindStart();
@@ -358,9 +364,10 @@ class ControllerProperties
NSSize aMargins = [mpPreviewBox contentViewMargins];
aPreviewFrame.origin.x = 0;
aPreviewFrame.origin.y = 34;
+ aPreviewFrame.size.width -= 2*(aMargins.width+1);
aPreviewFrame.size.height -= 61;
mpPreview = [[NSImageView alloc] initWithFrame: aPreviewFrame];
- [mpPreview setImageScaling: NSScaleNone];
+ [mpPreview setImageScaling: NSScaleProportionally];
[mpPreview setImageAlignment: NSImageAlignCenter];
[mpPreview setImageFrameStyle: NSImageFrameNone];
[mpPreviewBox addSubview: [mpPreview autorelease]];
diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx
index a54a7fad7ac5..8a4744d1efcd 100644
--- a/vcl/aqua/source/gdi/salgdi.cxx
+++ b/vcl/aqua/source/gdi/salgdi.cxx
@@ -473,7 +473,6 @@ static void AddPolygonToPath( CGMutablePathRef xPath,
const CGAffineTransform* pTransform = NULL;
const bool bHasCurves = rPolygon.areControlPointsUsed();
- bool bPendingCurve = false;
for( int nPointIdx = 0, nPrevIdx = 0;; nPrevIdx = nPointIdx++ )
{
int nClosedIdx = nPointIdx;
@@ -488,7 +487,7 @@ static void AddPolygonToPath( CGMutablePathRef xPath,
::basegfx::B2DPoint aPoint = rPolygon.getB2DPoint( nClosedIdx );
- if(bPixelSnap)
+ if( bPixelSnap)
{
// snap device coordinates to full pixels
aPoint.setX( basegfx::fround( aPoint.getX() ) );
@@ -498,9 +497,19 @@ static void AddPolygonToPath( CGMutablePathRef xPath,
if( bLineDraw )
aPoint += aHalfPointOfs;
- if( !nPointIdx ) // first point
+ if( !nPointIdx ) { // first point => just move there
CGPathMoveToPoint( xPath, pTransform, aPoint.getX(), aPoint.getY() );
- else if( !bPendingCurve ) // line segment
+ continue;
+ }
+
+ bool bPendingCurve = false;
+ if( bHasCurves )
+ {
+ bPendingCurve = rPolygon.isNextControlPointUsed( nPrevIdx );
+ bPendingCurve |= rPolygon.isPrevControlPointUsed( nClosedIdx );
+ }
+
+ if( !bPendingCurve ) // line segment
CGPathAddLineToPoint( xPath, pTransform, aPoint.getX(), aPoint.getY() );
else // cubic bezier segment
{
@@ -514,9 +523,6 @@ static void AddPolygonToPath( CGMutablePathRef xPath,
CGPathAddCurveToPoint( xPath, pTransform, aCP1.getX(), aCP1.getY(),
aCP2.getX(), aCP2.getY(), aPoint.getX(), aPoint.getY() );
}
-
- if( bHasCurves )
- bPendingCurve = rPolygon.isNextControlPointUsed( nClosedIdx );
}
if( bClosePath )
@@ -694,6 +700,13 @@ void AquaSalGraphics::drawPixel( long nX, long nY, SalColor nSalColor )
void AquaSalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 )
{
+ if( nX1 == nX2 && nY1 == nY2 )
+ {
+ // #i109453# platform independent code expects at least one pixel to be drawn
+ drawPixel( nX1, nY1 );
+ return;
+ }
+
if( !CheckContext() )
return;
@@ -975,6 +988,7 @@ bool AquaSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPol
// -----------------------------------------------------------------------
bool AquaSalGraphics::drawPolyLine( const ::basegfx::B2DPolygon& rPolyLine,
+ double fTransparency,
const ::basegfx::B2DVector& rLineWidths,
basegfx::B2DLineJoin eLineJoin )
{
@@ -1019,6 +1033,7 @@ bool AquaSalGraphics::drawPolyLine( const ::basegfx::B2DPolygon& rPolyLine,
CGContextAddPath( mrContext, xPath );
// draw path with antialiased line
CGContextSetShouldAntialias( mrContext, true );
+ CGContextSetAlpha( mrContext, 1.0 - fTransparency );
CGContextSetLineJoin( mrContext, aCGLineJoin );
CGContextSetLineWidth( mrContext, rLineWidths.getX() );
CGContextDrawPath( mrContext, kCGPathStroke );
@@ -1095,7 +1110,8 @@ void AquaSalGraphics::copyBits( const SalTwoRect *pPosAry, SalGraphics *pSrcGrap
DBG_ASSERT( pSrc->mxLayer!=NULL, "AquaSalGraphics::copyBits() from non-layered graphics" );
const CGPoint aDstPoint = { +pPosAry->mnDestX - pPosAry->mnSrcX, pPosAry->mnDestY - pPosAry->mnSrcY };
- if( !mnBitmapDepth || (aDstPoint.x + pSrc->mnWidth) <= mnWidth ) // workaround a Quartz crasher
+ if( (pPosAry->mnSrcWidth == pPosAry->mnDestWidth && pPosAry->mnSrcHeight == pPosAry->mnDestHeight) &&
+ (!mnBitmapDepth || (aDstPoint.x + pSrc->mnWidth) <= mnWidth) ) // workaround a Quartz crasher
{
// in XOR mode the drawing context is redirected to the XOR mask
// if source and target are identical then copyBits() paints onto the target context though
diff --git a/vcl/aqua/source/gdi/salnativewidgets.cxx b/vcl/aqua/source/gdi/salnativewidgets.cxx
index b4b843eaca58..5eccf88dc523 100644
--- a/vcl/aqua/source/gdi/salnativewidgets.cxx
+++ b/vcl/aqua/source/gdi/salnativewidgets.cxx
@@ -380,7 +380,7 @@ BOOL AquaSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart n
* nType/nPart combination.
*/
BOOL AquaSalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- const Point& rPos, SalControlHandle& rControlHandle, BOOL& rIsInside )
+ const Point& rPos, BOOL& rIsInside )
{
if ( nType == CTRL_SCROLLBAR )
{
@@ -468,7 +468,6 @@ UInt32 AquaSalGraphics::getTrackState( ControlState nState )
*
* rControlRegion: The bounding region of the complete control in VCL frame coordinates.
* aValue: An optional value (tristate/numerical/string)
- * rControlHandle: Carries platform dependent data and is maintained by the AquaSalGraphics implementation.
* aCaption: A caption or title string (like button text etc)
*/
BOOL AquaSalGraphics::drawNativeControl(ControlType nType,
@@ -476,7 +475,6 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType,
const Region& rControlRegion,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle,
const rtl::OUString& aCaption )
{
BOOL bOK = FALSE;
@@ -1226,12 +1224,11 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType,
*
* rControlRegion: The bounding region of the complete control in VCL frame coordinates.
* aValue: An optional value (tristate/numerical/string)
- * rControlHandle: Carries platform dependent data and is maintained by the AquaSalGraphics implementation.
* aCaption: A caption or title string (like button text etc)
*/
BOOL AquaSalGraphics::drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const rtl::OUString& aCaption )
+ const rtl::OUString& aCaption )
{
return( FALSE );
}
@@ -1248,11 +1245,10 @@ BOOL AquaSalGraphics::drawNativeControlText( ControlType nType, ControlPart nPar
*
* rControlRegion: The bounding region of the control in VCL frame coordinates.
* aValue: An optional value (tristate/numerical/string)
- * rControlHandle: Carries platform dependent data and is maintained by the AquaSalGraphics implementation.
* aCaption: A caption or title string (like button text etc)
*/
BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, const rtl::OUString& aCaption,
+ const ImplControlValue& aValue, const rtl::OUString& aCaption,
Region &rNativeBoundingRegion, Region &rNativeContentRegion )
{
diff --git a/vcl/aqua/source/gdi/salprn.cxx b/vcl/aqua/source/gdi/salprn.cxx
index cee243093ff3..1c0401f769b5 100644
--- a/vcl/aqua/source/gdi/salprn.cxx
+++ b/vcl/aqua/source/gdi/salprn.cxx
@@ -532,8 +532,6 @@ BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName,
PrintAccessoryViewState aAccViewState;
sal_Int32 nAllPages = 0;
- aAccViewState.bNeedRestart = true;
-
// reset IsLastPage
i_rController.setLastPage( sal_False );
@@ -549,111 +547,133 @@ BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName,
if( ! i_rController.isShowDialogs() )
bShowProgressPanel = sal_False;
+ // possibly create one job for collated output
+ sal_Bool bSinglePrintJobs = sal_False;
+ beans::PropertyValue* pSingleValue = i_rController.getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintCollateAsSingleJobs" ) ) );
+ if( pSingleValue )
+ {
+ pSingleValue->Value >>= bSinglePrintJobs;
+ }
+
// FIXME: jobStarted() should be done after the print dialog has ended (if there is one)
// how do I know when that might be ?
i_rController.jobStarted();
- do
- {
- if( aAccViewState.bNeedRestart )
- {
- mnCurPageRangeStart = 0;
- mnCurPageRangeCount = 0;
- nAllPages = i_rController.getFilteredPageCount();
- }
- aAccViewState.bNeedRestart = false;
- Size aCurSize( 21000, 29700 );
- if( nAllPages > 0 )
+ int nCopies = i_rController.getPrinter()->GetCopyCount();
+ int nJobs = 1;
+ if( bSinglePrintJobs )
+ {
+ nJobs = nCopies;
+ nCopies = 1;
+ }
+
+ for( int nCurJob = 0; nCurJob < nJobs; nCurJob++ )
+ {
+ aAccViewState.bNeedRestart = true;
+ do
{
- mnCurPageRangeCount = 1;
- aCurSize = getPageSize( i_rController, mnCurPageRangeStart );
- Size aNextSize( aCurSize );
+ if( aAccViewState.bNeedRestart )
+ {
+ mnCurPageRangeStart = 0;
+ mnCurPageRangeCount = 0;
+ nAllPages = i_rController.getFilteredPageCount();
+ }
- // print pages up to a different size
- while( mnCurPageRangeCount + mnCurPageRangeStart < nAllPages )
+ aAccViewState.bNeedRestart = false;
+
+ Size aCurSize( 21000, 29700 );
+ if( nAllPages > 0 )
{
- aNextSize = getPageSize( i_rController, mnCurPageRangeStart + mnCurPageRangeCount );
- if( aCurSize == aNextSize // same page size
- ||
- (aCurSize.Width() == aNextSize.Height() && aCurSize.Height() == aNextSize.Width()) // same size, but different orientation
- )
+ mnCurPageRangeCount = 1;
+ aCurSize = getPageSize( i_rController, mnCurPageRangeStart );
+ Size aNextSize( aCurSize );
+
+ // print pages up to a different size
+ while( mnCurPageRangeCount + mnCurPageRangeStart < nAllPages )
{
- mnCurPageRangeCount++;
+ aNextSize = getPageSize( i_rController, mnCurPageRangeStart + mnCurPageRangeCount );
+ if( aCurSize == aNextSize // same page size
+ ||
+ (aCurSize.Width() == aNextSize.Height() && aCurSize.Height() == aNextSize.Width()) // same size, but different orientation
+ )
+ {
+ mnCurPageRangeCount++;
+ }
+ else
+ break;
}
- else
- break;
}
- }
- else
- mnCurPageRangeCount = 0;
-
- // now for the current run
- mnStartPageOffsetX = mnStartPageOffsetY = 0;
- // setup the paper size and orientation
- // do this on our associated Printer object, since that is
- // out interface to the applications which occasionally rely on the paper
- // information (e.g. brochure printing scales to the found paper size)
- // also SetPaperSizeUser has the advantage that we can share a
- // platform independent paper matching algorithm
- boost::shared_ptr<Printer> pPrinter( i_rController.getPrinter() );
- pPrinter->SetMapMode( MapMode( MAP_100TH_MM ) );
- pPrinter->SetPaperSizeUser( aCurSize, true );
-
- // create view
- NSView* pPrintView = [[AquaPrintView alloc] initWithController: &i_rController withInfoPrinter: this];
-
- NSMutableDictionary* pPrintDict = [mpPrintInfo dictionary];
-
- // set filename
- if( i_pFileName )
- {
- [mpPrintInfo setJobDisposition: NSPrintSaveJob];
- NSString* pPath = CreateNSString( *i_pFileName );
- [pPrintDict setObject: pPath forKey: NSPrintSavePath];
- [pPath release];
- }
+ else
+ mnCurPageRangeCount = 0;
+
+ // now for the current run
+ mnStartPageOffsetX = mnStartPageOffsetY = 0;
+ // setup the paper size and orientation
+ // do this on our associated Printer object, since that is
+ // out interface to the applications which occasionally rely on the paper
+ // information (e.g. brochure printing scales to the found paper size)
+ // also SetPaperSizeUser has the advantage that we can share a
+ // platform independent paper matching algorithm
+ boost::shared_ptr<Printer> pPrinter( i_rController.getPrinter() );
+ pPrinter->SetMapMode( MapMode( MAP_100TH_MM ) );
+ pPrinter->SetPaperSizeUser( aCurSize, true );
+
+ // create view
+ NSView* pPrintView = [[AquaPrintView alloc] initWithController: &i_rController withInfoPrinter: this];
+
+ NSMutableDictionary* pPrintDict = [mpPrintInfo dictionary];
+
+ // set filename
+ if( i_pFileName )
+ {
+ [mpPrintInfo setJobDisposition: NSPrintSaveJob];
+ NSString* pPath = CreateNSString( *i_pFileName );
+ [pPrintDict setObject: pPath forKey: NSPrintSavePath];
+ [pPath release];
+ }
- [pPrintDict setObject: [[NSNumber numberWithInt: (int)i_rController.getPrinter()->GetCopyCount()] autorelease] forKey: NSPrintCopies];
- [pPrintDict setObject: [[NSNumber numberWithBool: YES] autorelease] forKey: NSPrintDetailedErrorReporting];
- [pPrintDict setObject: [[NSNumber numberWithInt: 1] autorelease] forKey: NSPrintFirstPage];
- // #i103253# weird: for some reason, autoreleasing the value below like the others above
- // leads do a double free malloc error. Why this value should behave differently from all the others
- // is a mystery.
- [pPrintDict setObject: [NSNumber numberWithInt: mnCurPageRangeCount] forKey: NSPrintLastPage];
+ [pPrintDict setObject: [[NSNumber numberWithInt: nCopies] autorelease] forKey: NSPrintCopies];
+ [pPrintDict setObject: [[NSNumber numberWithBool: YES] autorelease] forKey: NSPrintDetailedErrorReporting];
+ [pPrintDict setObject: [[NSNumber numberWithInt: 1] autorelease] forKey: NSPrintFirstPage];
+ // #i103253# weird: for some reason, autoreleasing the value below like the others above
+ // leads do a double free malloc error. Why this value should behave differently from all the others
+ // is a mystery.
+ [pPrintDict setObject: [NSNumber numberWithInt: mnCurPageRangeCount] forKey: NSPrintLastPage];
- // create print operation
- NSPrintOperation* pPrintOperation = [NSPrintOperation printOperationWithView: pPrintView printInfo: mpPrintInfo];
+ // create print operation
+ NSPrintOperation* pPrintOperation = [NSPrintOperation printOperationWithView: pPrintView printInfo: mpPrintInfo];
- if( pPrintOperation )
- {
- NSObject* pReleaseAfterUse = nil;
- bool bShowPanel = (! i_rController.isDirectPrint() && getUseNativeDialog() && i_rController.isShowDialogs() );
- [pPrintOperation setShowsPrintPanel: bShowPanel ? YES : NO ];
- [pPrintOperation setShowsProgressPanel: bShowProgressPanel ? YES : NO];
-
- // set job title (since MacOSX 10.5)
- if( [pPrintOperation respondsToSelector: @selector(setJobTitle:)] )
- [pPrintOperation performSelector: @selector(setJobTitle:) withObject: [CreateNSString( i_rJobName ) autorelease]];
-
- if( bShowPanel && mnCurPageRangeStart == 0 ) // only the first range of pages gets the accesory view
- pReleaseAfterUse = [AquaPrintAccessoryView setupPrinterPanel: pPrintOperation withController: &i_rController withState: &aAccViewState];
-
- bSuccess = TRUE;
- mbJob = true;
- pInst->startedPrintJob();
- [pPrintOperation runOperation];
- pInst->endedPrintJob();
- bWasAborted = [[[pPrintOperation printInfo] jobDisposition] compare: NSPrintCancelJob] == NSOrderedSame;
- mbJob = false;
- if( pReleaseAfterUse )
- [pReleaseAfterUse release];
- }
+ if( pPrintOperation )
+ {
+ NSObject* pReleaseAfterUse = nil;
+ bool bShowPanel = (! i_rController.isDirectPrint() && getUseNativeDialog() && i_rController.isShowDialogs() );
+ [pPrintOperation setShowsPrintPanel: bShowPanel ? YES : NO ];
+ [pPrintOperation setShowsProgressPanel: bShowProgressPanel ? YES : NO];
+
+ // set job title (since MacOSX 10.5)
+ if( [pPrintOperation respondsToSelector: @selector(setJobTitle:)] )
+ [pPrintOperation performSelector: @selector(setJobTitle:) withObject: [CreateNSString( i_rJobName ) autorelease]];
+
+ if( bShowPanel && mnCurPageRangeStart == 0 && nCurJob == 0) // only the first range of pages (in the first job) gets the accesory view
+ pReleaseAfterUse = [AquaPrintAccessoryView setupPrinterPanel: pPrintOperation withController: &i_rController withState: &aAccViewState];
+
+ bSuccess = TRUE;
+ mbJob = true;
+ pInst->startedPrintJob();
+ [pPrintOperation runOperation];
+ pInst->endedPrintJob();
+ bWasAborted = [[[pPrintOperation printInfo] jobDisposition] compare: NSPrintCancelJob] == NSOrderedSame;
+ mbJob = false;
+ if( pReleaseAfterUse )
+ [pReleaseAfterUse release];
+ }
- mnCurPageRangeStart += mnCurPageRangeCount;
- mnCurPageRangeCount = 1;
- } while( aAccViewState.bNeedRestart || mnCurPageRangeStart + mnCurPageRangeCount < nAllPages );
+ mnCurPageRangeStart += mnCurPageRangeCount;
+ mnCurPageRangeCount = 1;
+ } while( aAccViewState.bNeedRestart || mnCurPageRangeStart + mnCurPageRangeCount < nAllPages );
+ }
// inform application that it can release its data
// this is awkward, but the XRenderable interface has no method for this,
diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx
index 71c84ee0c2f1..b14354e1b4bd 100644
--- a/vcl/aqua/source/window/salframe.cxx
+++ b/vcl/aqua/source/window/salframe.cxx
@@ -1128,6 +1128,16 @@ static Font getFont( NSFont* pFont, long nDPIY, const Font& rDefault )
return aResult;
}
+void AquaSalFrame::getResolution( long& o_rDPIX, long& o_rDPIY )
+{
+ if( ! mpGraphics )
+ {
+ GetGraphics();
+ ReleaseGraphics( mpGraphics );
+ }
+ mpGraphics->GetResolution( o_rDPIX, o_rDPIY );
+}
+
// on OSX-Aqua the style settings are independent of the frame, so it does
// not really belong here. Since the connection to the Appearance_Manager
// is currently done in salnativewidgets.cxx this would be a good place.
@@ -1157,13 +1167,8 @@ void AquaSalFrame::UpdateSettings( AllSettings& rSettings )
// get the system font settings
Font aAppFont = aStyleSettings.GetAppFont();
- if( ! mpGraphics )
- {
- GetGraphics();
- ReleaseGraphics( mpGraphics );
- }
long nDPIX = 72, nDPIY = 72;
- mpGraphics->GetResolution( nDPIX, nDPIY );
+ getResolution( nDPIX, nDPIY );
aAppFont = getFont( [NSFont systemFontOfSize: 0], nDPIY, aAppFont );
// TODO: better mapping of aqua<->ooo font settings
@@ -1352,40 +1357,81 @@ void AquaSalFrame::GetWorkArea( Rectangle& rRect )
SalPointerState AquaSalFrame::GetPointerState()
{
SalPointerState state;
+ state.mnState = 0;
// get position
NSPoint aPt = [mpWindow mouseLocationOutsideOfEventStream];
CocoaToVCL( aPt, false );
state.maPos = Point(static_cast<long>(aPt.x), static_cast<long>(aPt.y));
- // FIXME: replace Carbon by Cocoa
- // Cocoa does not have an equivalent for GetCurrentEventButtonState
- // and GetCurrentEventKeyModifiers.
- // we could try to get away with tracking all events for modifierKeys
- // and all mouse events for button state in VCL_NSApllication::sendEvent,
- // but it is unclear whether this will get us the same result.
- // leave in GetCurrentEventButtonState and GetCurrentEventKeyModifiers for now
+ NSEvent* pCur = [NSApp currentEvent];
+ bool bMouseEvent = false;
+ if( pCur )
+ {
+ bMouseEvent = true;
+ switch( [pCur type] )
+ {
+ case NSLeftMouseDown: state.mnState |= MOUSE_LEFT; break;
+ case NSLeftMouseUp: break;
+ case NSRightMouseDown: state.mnState |= MOUSE_RIGHT; break;
+ case NSRightMouseUp: break;
+ case NSOtherMouseDown: state.mnState |= ([pCur buttonNumber] == 2) ? MOUSE_MIDDLE : 0; break;
+ case NSOtherMouseUp: break;
+ case NSMouseMoved: break;
+ case NSLeftMouseDragged: state.mnState |= MOUSE_LEFT; break;
+ case NSRightMouseDragged: state.mnState |= MOUSE_RIGHT; break;
+ case NSOtherMouseDragged: state.mnState |= ([pCur buttonNumber] == 2) ? MOUSE_MIDDLE : 0; break;
+ break;
+ default:
+ bMouseEvent = false;
+ break;
+ }
+ }
+ if( bMouseEvent )
+ {
+ unsigned int nMask = (unsigned int)[pCur modifierFlags];
+ if( (nMask & NSShiftKeyMask) != 0 )
+ state.mnState |= KEY_SHIFT;
+ if( (nMask & NSControlKeyMask) != 0 )
+ state.mnState |= KEY_MOD3;
+ if( (nMask & NSAlternateKeyMask) != 0 )
+ state.mnState |= KEY_MOD2;
+ if( (nMask & NSCommandKeyMask) != 0 )
+ state.mnState |= KEY_MOD1;
+
+ }
+ else
+ {
+ // FIXME: replace Carbon by Cocoa
+ // Cocoa does not have an equivalent for GetCurrentEventButtonState
+ // and GetCurrentEventKeyModifiers.
+ // we could try to get away with tracking all events for modifierKeys
+ // and all mouse events for button state in VCL_NSApllication::sendEvent,
+ // but it is unclear whether this will get us the same result.
+ // leave in GetCurrentEventButtonState and GetCurrentEventKeyModifiers for now
+
+ // fill in button state
+ UInt32 nState = GetCurrentEventButtonState();
+ state.mnState = 0;
+ if( nState & 1 )
+ state.mnState |= MOUSE_LEFT; // primary button
+ if( nState & 2 )
+ state.mnState |= MOUSE_RIGHT; // secondary button
+ if( nState & 4 )
+ state.mnState |= MOUSE_MIDDLE; // tertiary button
+
+ // fill in modifier state
+ nState = GetCurrentEventKeyModifiers();
+ if( nState & shiftKey )
+ state.mnState |= KEY_SHIFT;
+ if( nState & controlKey )
+ state.mnState |= KEY_MOD3;
+ if( nState & optionKey )
+ state.mnState |= KEY_MOD2;
+ if( nState & cmdKey )
+ state.mnState |= KEY_MOD1;
+ }
- // fill in button state
- UInt32 nState = GetCurrentEventButtonState();
- state.mnState = 0;
- if( nState & 1 )
- state.mnState |= MOUSE_LEFT; // primary button
- if( nState & 2 )
- state.mnState |= MOUSE_RIGHT; // secondary button
- if( nState & 4 )
- state.mnState |= MOUSE_MIDDLE; // tertiary button
-
- // fill in modifier state
- nState = GetCurrentEventKeyModifiers();
- if( nState & shiftKey )
- state.mnState |= KEY_SHIFT;
- if( nState & controlKey )
- state.mnState |= KEY_MOD3;
- if( nState & optionKey )
- state.mnState |= KEY_MOD2;
- if( nState & cmdKey )
- state.mnState |= KEY_MOD1;
return state;
}
diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm
index 67926a38608d..25dadf0e592b 100755
--- a/vcl/aqua/source/window/salframeview.mm
+++ b/vcl/aqua/source/window/salframeview.mm
@@ -37,7 +37,9 @@
#include "vcl/window.hxx"
#include "vcl/svapp.hxx"
-
+
+#define WHEEL_EVENT_FACTOR 1.5
+
static USHORT ImplGetModifierMask( unsigned int nMask )
{
USHORT nRet = 0;
@@ -654,11 +656,12 @@ private:
mpFrame->CocoaToVCL( aPt );
SalWheelMouseEvent aEvent;
- aEvent.mnTime = mpFrame->mnLastEventTime;
- aEvent.mnX = static_cast<long>(aPt.x) - mpFrame->maGeometry.nX;
- aEvent.mnY = static_cast<long>(aPt.y) - mpFrame->maGeometry.nY;
- aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags );
- aEvent.mnCode |= KEY_MOD1; // we want zooming, no scrolling
+ aEvent.mnTime = mpFrame->mnLastEventTime;
+ aEvent.mnX = static_cast<long>(aPt.x) - mpFrame->maGeometry.nX;
+ aEvent.mnY = static_cast<long>(aPt.y) - mpFrame->maGeometry.nY;
+ aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags );
+ aEvent.mnCode |= KEY_MOD1; // we want zooming, no scrolling
+ aEvent.mbDeltaIsPixel = TRUE;
// --- RTL --- (mirror mouse pos)
if( Application::GetSettings().GetLayoutRTL() )
@@ -667,11 +670,11 @@ private:
if( dZ != 0.0 )
{
aEvent.mnDelta = static_cast<long>(floor(dZ));
- aEvent.mnNotchDelta = aEvent.mnDelta / 8;
- if( aEvent.mnNotchDelta == 0 )
- aEvent.mnNotchDelta = dZ < 0.0 ? -1 : 1;
+ aEvent.mnNotchDelta = dZ < 0 ? -1 : 1;
+ if( aEvent.mnDelta == 0 )
+ aEvent.mnDelta = aEvent.mnNotchDelta;
aEvent.mbHorz = FALSE;
- aEvent.mnScrollLines = aEvent.mnNotchDelta > 0 ? aEvent.mnNotchDelta : -aEvent.mnNotchDelta;
+ aEvent.mnScrollLines = dZ > 0 ? dZ/WHEEL_EVENT_FACTOR : -dZ/WHEEL_EVENT_FACTOR;
if( aEvent.mnScrollLines == 0 )
aEvent.mnScrollLines = 1;
mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent );
@@ -712,10 +715,11 @@ private:
mpFrame->CocoaToVCL( aPt );
SalWheelMouseEvent aEvent;
- aEvent.mnTime = mpFrame->mnLastEventTime;
- aEvent.mnX = static_cast<long>(aPt.x) - mpFrame->maGeometry.nX;
- aEvent.mnY = static_cast<long>(aPt.y) - mpFrame->maGeometry.nY;
- aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags );
+ aEvent.mnTime = mpFrame->mnLastEventTime;
+ aEvent.mnX = static_cast<long>(aPt.x) - mpFrame->maGeometry.nX;
+ aEvent.mnY = static_cast<long>(aPt.y) - mpFrame->maGeometry.nY;
+ aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags );
+ aEvent.mbDeltaIsPixel = TRUE;
// --- RTL --- (mirror mouse pos)
if( Application::GetSettings().GetLayoutRTL() )
@@ -724,9 +728,9 @@ private:
if( dX != 0.0 )
{
aEvent.mnDelta = static_cast<long>(floor(dX));
- aEvent.mnNotchDelta = aEvent.mnDelta / 8;
- if( aEvent.mnNotchDelta == 0 )
- aEvent.mnNotchDelta = dX < 0.0 ? -1 : 1;
+ aEvent.mnNotchDelta = dX < 0 ? -1 : 1;
+ if( aEvent.mnDelta == 0 )
+ aEvent.mnDelta = aEvent.mnNotchDelta;
aEvent.mbHorz = TRUE;
aEvent.mnScrollLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL;
mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent );
@@ -734,9 +738,9 @@ private:
if( dY != 0.0 && AquaSalFrame::isAlive( mpFrame ))
{
aEvent.mnDelta = static_cast<long>(floor(dY));
- aEvent.mnNotchDelta = aEvent.mnDelta / 8;
- if( aEvent.mnNotchDelta == 0 )
- aEvent.mnNotchDelta = dY < 0.0 ? -1 : 1;
+ aEvent.mnNotchDelta = dY < 0 ? -1 : 1;
+ if( aEvent.mnDelta == 0 )
+ aEvent.mnDelta = aEvent.mnNotchDelta;
aEvent.mbHorz = FALSE;
aEvent.mnScrollLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL;
mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent );
@@ -771,10 +775,11 @@ private:
mpFrame->CocoaToVCL( aPt );
SalWheelMouseEvent aEvent;
- aEvent.mnTime = mpFrame->mnLastEventTime;
- aEvent.mnX = static_cast<long>(aPt.x) - mpFrame->maGeometry.nX;
- aEvent.mnY = static_cast<long>(aPt.y) - mpFrame->maGeometry.nY;
- aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags );
+ aEvent.mnTime = mpFrame->mnLastEventTime;
+ aEvent.mnX = static_cast<long>(aPt.x) - mpFrame->maGeometry.nX;
+ aEvent.mnY = static_cast<long>(aPt.y) - mpFrame->maGeometry.nY;
+ aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags );
+ aEvent.mbDeltaIsPixel = TRUE;
// --- RTL --- (mirror mouse pos)
if( Application::GetSettings().GetLayoutRTL() )
@@ -783,30 +788,27 @@ private:
if( dX != 0.0 )
{
aEvent.mnDelta = static_cast<long>(floor(dX));
- aEvent.mnNotchDelta = aEvent.mnDelta / 8;
- if( aEvent.mnNotchDelta == 0 )
- aEvent.mnNotchDelta = dX < 0.0 ? -1 : 1;
+ aEvent.mnNotchDelta = dX < 0 ? -1 : 1;
+ if( aEvent.mnDelta == 0 )
+ aEvent.mnDelta = aEvent.mnNotchDelta;
aEvent.mbHorz = TRUE;
- aEvent.mnScrollLines = aEvent.mnNotchDelta > 0 ? aEvent.mnNotchDelta : -aEvent.mnNotchDelta;
+ aEvent.mnScrollLines = dY > 0 ? dX/WHEEL_EVENT_FACTOR : -dX/WHEEL_EVENT_FACTOR;
if( aEvent.mnScrollLines == 0 )
aEvent.mnScrollLines = 1;
- if( aEvent.mnScrollLines > 15 )
- aEvent.mnScrollLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL;
+
mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent );
}
if( dY != 0.0 && AquaSalFrame::isAlive( mpFrame ) )
{
aEvent.mnDelta = static_cast<long>(floor(dY));
- aEvent.mnNotchDelta = aEvent.mnDelta / 8;
- if( aEvent.mnNotchDelta == 0 )
- aEvent.mnNotchDelta = dY < 0.0 ? -1 : 1;
+ aEvent.mnNotchDelta = dY < 0 ? -1 : 1;
+ if( aEvent.mnDelta == 0 )
+ aEvent.mnDelta = aEvent.mnNotchDelta;
aEvent.mbHorz = FALSE;
- aEvent.mnScrollLines = aEvent.mnNotchDelta > 0 ? aEvent.mnNotchDelta : -aEvent.mnNotchDelta;
- if( aEvent.mnScrollLines == 0 )
+ aEvent.mnScrollLines = dY > 0 ? dY/WHEEL_EVENT_FACTOR : -dY/WHEEL_EVENT_FACTOR;
+ if( aEvent.mnScrollLines < 1 )
aEvent.mnScrollLines = 1;
- if( aEvent.mnScrollLines > 15 )
- aEvent.mnScrollLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL;
-
+
mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent );
}
}
@@ -1508,6 +1510,11 @@ private:
mbKeyHandled = true;
}
+-(void)clearLastEvent
+{
+ mpLastEvent = nil;
+}
+
- (NSRect)firstRectForCharacterRange:(NSRange)theRange
{
SalExtTextInputPosEvent aPosEvent;
diff --git a/vcl/aqua/source/window/salmenu.cxx b/vcl/aqua/source/window/salmenu.cxx
index f39d7c675bc4..ed3086d8506f 100644
--- a/vcl/aqua/source/window/salmenu.cxx
+++ b/vcl/aqua/source/window/salmenu.cxx
@@ -370,6 +370,10 @@ bool AquaSalMenu::ShowNativePopupMenu(FloatingWindow * pWin, const Rectangle& rR
displayPopupFrame.origin.y = pWin->ImplGetFrame()->maGeometry.nY - pParentAquaSalFrame->maGeometry.nY + offset;
pParentAquaSalFrame->VCLToCocoa(displayPopupFrame, false);
+ // #i111992# if this menu was opened due to a key event, prevent dispatching that yet again
+ if( [pParentNSView respondsToSelector: @selector(clearLastEvent)] )
+ [pParentNSView performSelector:@selector(clearLastEvent)];
+
// open popup menu
NSPopUpButtonCell * pPopUpButtonCell = [[NSPopUpButtonCell alloc] initTextCell:@"" pullsDown:NO];
[pPopUpButtonCell setMenu: pCopyMenu];
diff --git a/vcl/inc/postgraphitestl.h b/vcl/inc/postgraphitestl.h
deleted file mode 100644
index 736aa248b7ff..000000000000
--- a/vcl/inc/postgraphitestl.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifdef std_was_redefined_as_stlport
-// put things back the way they were
-# define std std_was_redefined_as_stlport
-# undef _STLP_OUTERMOST_HEADER_ID
-// force config to be re-read
-# undef _STLP_NOTHROW_INHERENTLY
-# undef _STLP_CONFIG_H
-# include <stddef.h>
-#endif
diff --git a/vcl/inc/pregraphitestl.h b/vcl/inc/pregraphitestl.h
deleted file mode 100644
index ece0af477113..000000000000
--- a/vcl/inc/pregraphitestl.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#if defined(GRAPHITEADAPTSTL) && defined(std)
-# include <ostream>
-# include <istream>
-# include <fstream>
-# include <iostream>
-# include <vector>
-# include <algorithm>
-# define std_was_redefined_as_stlport std
-# undef std
-# define _STLP_OUTERMOST_HEADER_ID 0xdeadbeaf
-# pragma GCC visibility push(default)
-# include _STLP_NATIVE_HEADER(exception_defines.h)
-# include _STLP_NATIVE_HEADER(limits)
-# include _STLP_NATIVE_HEADER(memory)
-# include _STLP_NATIVE_HEADER(exception)
-# include _STLP_NATIVE_HEADER(iosfwd)
-# include _STLP_NATIVE_HEADER(algorithm)
-# include _STLP_NATIVE_HEADER(string)
-# include _STLP_NATIVE_HEADER(streambuf)
-# include _STLP_NATIVE_HEADER(ios)
-# include _STLP_NATIVE_HEADER(locale)
-# include _STLP_NATIVE_HEADER(stdexcept)
-# include _STLP_NATIVE_HEADER(ostream)
-# include _STLP_NATIVE_HEADER(istream)
-# include _STLP_NATIVE_HEADER(iostream)
-# include _STLP_NATIVE_HEADER(vector)
-# pragma GCC visibility pop
-#endif
-//sil_std resolves to the std that Graphite was built with
-namespace sil_std = std;
diff --git a/vcl/inc/vcl/abstdlg.hxx b/vcl/inc/vcl/abstdlg.hxx
index 1d4e08991bda..2fa134af5078 100644..100755
--- a/vcl/inc/vcl/abstdlg.hxx
+++ b/vcl/inc/vcl/abstdlg.hxx
@@ -66,6 +66,16 @@ public:
virtual void Sync() = 0;
};
+class VCL_DLLPUBLIC AbstractPasswordToOpenModifyDialog : public VclAbstractDialog
+{
+public:
+ virtual String GetPasswordToOpen() const = 0;
+ virtual String GetPasswordToModify() const = 0;
+ virtual bool IsRecommendToOpenReadonly() const = 0;
+};
+
+//-------------------------------------------------------------
+
class VCL_DLLPUBLIC VclAbstractDialogFactory
{
public:
@@ -74,6 +84,9 @@ public:
// nDialogId was previously a ResId without ResMgr; the ResourceId is now
// an implementation detail of the factory
virtual VclAbstractDialog* CreateVclDialog( Window* pParent, sal_uInt32 nResId ) = 0;
+
+ // creates instance of PasswordToOpenModifyDialog from cui
+ virtual AbstractPasswordToOpenModifyDialog * CreatePasswordToOpenModifyDialog( Window * pParent, sal_uInt16 nMinPasswdLen, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify ) = 0;
};
#endif
diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx
index 317a98026f45..8f4b94bf7b18 100644
--- a/vcl/inc/vcl/button.hxx
+++ b/vcl/inc/vcl/button.hxx
@@ -60,7 +60,7 @@ public:
SAL_DLLPRIVATE USHORT ImplGetTextStyle( XubString& rText, WinBits nWinStyle, ULONG nDrawFlags );
SAL_DLLPRIVATE void ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, Size& rSize,
BOOL bLayout, ULONG nImageSep, ULONG nDrawFlags,
- USHORT nTextStyle, Rectangle *pSymbolRect=NULL );
+ USHORT nTextStyle, Rectangle *pSymbolRect=NULL, bool bAddImageSep = false );
SAL_DLLPRIVATE void ImplSetFocusRect( const Rectangle &rFocusRect );
SAL_DLLPRIVATE const Rectangle& ImplGetFocusRect() const;
SAL_DLLPRIVATE void ImplSetSymbolAlign( SymbolAlign eAlign );
diff --git a/vcl/inc/vcl/cmdevt.hxx b/vcl/inc/vcl/cmdevt.hxx
index 0faac8472253..7e968b6c7a54 100644
--- a/vcl/inc/vcl/cmdevt.hxx
+++ b/vcl/inc/vcl/cmdevt.hxx
@@ -138,18 +138,20 @@ private:
USHORT mnMode;
USHORT mnCode;
BOOL mbHorz;
+ BOOL mbDeltaIsPixel;
public:
CommandWheelData();
CommandWheelData( long nWheelDelta, long nWheelNotchDelta,
ULONG nScrollLines,
USHORT nWheelMode, USHORT nKeyModifier,
- BOOL mbHorz = FALSE );
+ BOOL bHorz = FALSE, BOOL bDeltaIsPixel = FALSE );
long GetDelta() const { return mnDelta; }
long GetNotchDelta() const { return mnNotchDelta; }
ULONG GetScrollLines() const { return mnLines; }
BOOL IsHorz() const { return mbHorz; }
+ BOOL IsDeltaPixel() const { return mbDeltaIsPixel; }
USHORT GetMode() const { return mnMode; }
@@ -173,12 +175,13 @@ inline CommandWheelData::CommandWheelData()
mnMode = 0;
mnCode = 0;
mbHorz = FALSE;
+ mbDeltaIsPixel = FALSE;
}
inline CommandWheelData::CommandWheelData( long nWheelDelta, long nWheelNotchDelta,
ULONG nScrollLines,
USHORT nWheelMode, USHORT nKeyModifier,
- BOOL bHorz )
+ BOOL bHorz, BOOL bDeltaIsPixel )
{
mnDelta = nWheelDelta;
mnNotchDelta = nWheelNotchDelta;
@@ -186,6 +189,7 @@ inline CommandWheelData::CommandWheelData( long nWheelDelta, long nWheelNotchDel
mnMode = nWheelMode;
mnCode = nKeyModifier;
mbHorz = bHorz;
+ mbDeltaIsPixel = bDeltaIsPixel;
}
// ---------------------
diff --git a/vcl/inc/vcl/dockwin.hxx b/vcl/inc/vcl/dockwin.hxx
index 3a1dca044bb7..61464400d595 100644
--- a/vcl/inc/vcl/dockwin.hxx
+++ b/vcl/inc/vcl/dockwin.hxx
@@ -152,7 +152,7 @@ public:
void Unlock();
BOOL IsLocked() const;
- void StartPopupMode( ToolBox* pParentToolBox );
+ void StartPopupMode( ToolBox* pParentToolBox, ULONG nPopupModeFlags );
BOOL IsInPopupMode() const;
void TitleButtonClick( USHORT nButton );
@@ -234,7 +234,10 @@ public:
BOOL IsLocked( const Window *pWin );
void StartPopupMode( ToolBox *pParentToolBox, const Window *pWin );
+ void StartPopupMode( ToolBox *pParentToolBox, const Window *pWin, ULONG nPopupModeFlags );
+
BOOL IsInPopupMode( const Window *pWin );
+ void EndPopupMode( const Window *pWin );
// required because those methods are not virtual in Window (!!!) and must
// be availbale from the toolkit
diff --git a/vcl/inc/vcl/glyphcache.hxx b/vcl/inc/vcl/glyphcache.hxx
index fa3e99f2373f..a77c1626dc24 100644
--- a/vcl/inc/vcl/glyphcache.hxx
+++ b/vcl/inc/vcl/glyphcache.hxx
@@ -51,6 +51,7 @@ class RawBitmap;
class CmapResult;
#include <vcl/outfont.hxx>
+#include <vcl/impfont.hxx>
class ServerFontLayout;
#include <vcl/sallayout.hxx>
@@ -258,11 +259,15 @@ class VCL_DLLPUBLIC ImplServerFontEntry : public ImplFontEntry
{
private:
ServerFont* mpServerFont;
+ ImplFontOptions maFontOptions;
+ bool mbGotFontOptions;
+ bool mbValidFontOptions;
public:
ImplServerFontEntry( ImplFontSelectData& );
virtual ~ImplServerFontEntry();
void SetServerFont( ServerFont* p) { mpServerFont = p; }
+ void HandleFontOptions();
};
// =======================================================================
diff --git a/vcl/inc/vcl/graphite_adaptors.hxx b/vcl/inc/vcl/graphite_adaptors.hxx
index 0b5f88184ce4..43c2e37a5fb2 100644
--- a/vcl/inc/vcl/graphite_adaptors.hxx
+++ b/vcl/inc/vcl/graphite_adaptors.hxx
@@ -55,11 +55,11 @@
#include "vcl/dllapi.h"
// Libraries
-#include "pregraphitestl.h"
+#include <tools/preextstl.h>
#include <graphite/GrClient.h>
#include <graphite/Font.h>
#include <graphite/ITextSource.h>
-#include "postgraphitestl.h"
+#include <tools/postextstl.h>
// Module type definitions and forward declarations.
//
@@ -119,7 +119,7 @@ public:
const grutils::GrFeatureParser * features() const { return mpFeatures; };
private:
- virtual void UniqueCacheInfo(sil_std::wstring &, bool &, bool &);
+ virtual void UniqueCacheInfo(ext_std::wstring &, bool &, bool &);
FreetypeServerFont& mrFont;
FontProperties maFontProperties;
diff --git a/vcl/inc/vcl/graphite_cache.hxx b/vcl/inc/vcl/graphite_cache.hxx
index eba5109c7446..5472b32dd62f 100644
--- a/vcl/inc/vcl/graphite_cache.hxx
+++ b/vcl/inc/vcl/graphite_cache.hxx
@@ -127,7 +127,7 @@ public:
}
m_segMap.clear();
};
- GrSegRecord * getSegment(ImplLayoutArgs & layoutArgs, bool bIsRtl)
+ GrSegRecord * getSegment(ImplLayoutArgs & layoutArgs, bool bIsRtl, int segCharLimit)
{
GrSegRecord * found = NULL;
// try to find a segment starting at correct place, if not, try to find a
@@ -152,8 +152,6 @@ public:
if (found->m_seg->startCharacter() <= layoutArgs.mnMinCharPos &&
found->m_seg->stopCharacter() >= layoutArgs.mnEndCharPos)
{
- const size_t seg_char_limit = min(layoutArgs.mnLength, layoutArgs.mnEndCharPos
- + GraphiteLayout::EXTRA_CONTEXT_LENGTH);
DBG_ASSERT(found && found->m_seg, "null entry in GraphiteSegmentCache");
// restore original start character, in case it has changed
found->m_seg->setTextSourceOffset(found->m_startChar);
@@ -161,7 +159,7 @@ public:
// interest
// We could use substr and ==, but substr does a copy,
// so its probably faster to do it like this
- for (size_t i = layoutArgs.mnMinCharPos; i < seg_char_limit; i++)
+ for (int i = layoutArgs.mnMinCharPos; i < segCharLimit; i++)
{
//if (!found->m_rope->match(rtl::OUString(layoutArgs.mpStr[i], layoutArgs.mnLength), i - found->m_seg->startCharacter()))
if (found->m_rope->getStr()[i-found->m_seg->startCharacter()] != layoutArgs.mpStr[i])
@@ -171,6 +169,15 @@ public:
{
return NULL;
}
+ if (found->m_seg->stopCharacter() > layoutArgs.mnEndCharPos &&
+ static_cast<int>(found->char2BaseGlyph().size()) > layoutArgs.mnEndCharPos)
+ {
+ // check that the requested end character isn't mid cluster
+ if (found->char2BaseGlyph()[layoutArgs.mnEndCharPos-layoutArgs.mnMinCharPos] == -1)
+ {
+ return NULL;
+ }
+ }
// if (found->m_lockCount != 0)
// OutputDebugString("Multple users of SegRecord!");
found->m_lockCount++;
@@ -183,10 +190,8 @@ public:
// this is expecially needed when editing a large paragraph
// each edit changes the pointers, but if we don't reuse any segments it gets very
// slow.
- const size_t seg_char_limit = min(layoutArgs.mnLength, layoutArgs.mnEndCharPos
- + GraphiteLayout::EXTRA_CONTEXT_LENGTH);
rtl::OUString * rope = new rtl::OUString(layoutArgs.mpStr + layoutArgs.mnMinCharPos,
- seg_char_limit - layoutArgs.mnMinCharPos);
+ segCharLimit - layoutArgs.mnMinCharPos);
if (!rope) return NULL;
size_t nHash = (*(rope)).hashCode();
GrRMEntry range = m_ropeMap.equal_range(nHash);
diff --git a/vcl/inc/vcl/graphite_features.hxx b/vcl/inc/vcl/graphite_features.hxx
index 9f63a029eb5f..47f4c3a01e7f 100644
--- a/vcl/inc/vcl/graphite_features.hxx
+++ b/vcl/inc/vcl/graphite_features.hxx
@@ -29,11 +29,11 @@
// Parse a string of features specified as ; separated pairs.
// e.g.
// 1001=1&2002=2&fav1=0
-#include "pregraphitestl.h"
+#include <tools/preextstl.h>
#include <graphite/GrClient.h>
#include <graphite/Font.h>
#include <graphite/GrFeature.h>
-#include "postgraphitestl.h"
+#include <tools/postextstl.h>
namespace grutils
{
diff --git a/vcl/inc/vcl/graphite_layout.hxx b/vcl/inc/vcl/graphite_layout.hxx
index b3a3814e9ce6..520f4620cd90 100644
--- a/vcl/inc/vcl/graphite_layout.hxx
+++ b/vcl/inc/vcl/graphite_layout.hxx
@@ -40,13 +40,13 @@
#include <vector>
#include <utility>
// Libraries
-#include "pregraphitestl.h"
+#include <tools/preextstl.h>
#include <graphite/GrClient.h>
#include <graphite/Font.h>
#include <graphite/GrConstants.h>
#include <graphite/GrAppData.h>
#include <graphite/SegmentAux.h>
-#include "postgraphitestl.h"
+#include <tools/postextstl.h>
// Platform
#include <vcl/sallayout.hxx>
#include <vcl/dllapi.h>
@@ -75,6 +75,14 @@ namespace grutils { class GrFeatureParser; }
class VCL_DLLPUBLIC GraphiteLayout : public SalLayout
{
public:
+ // Mask to allow Word break status to be stored within mvChar2BaseGlyph
+ enum {
+ WORD_BREAK_BEFORE = 0x40000000,
+ HYPHEN_BREAK_BEFORE = 0x80000000,
+ BREAK_MASK = 0xC0000000,
+ GLYPH_INDEX_MASK = 0x3FFFFFFF
+ } LineBreakMask;
+
class Glyphs : public std::vector<GlyphItem>
{
public:
@@ -159,6 +167,7 @@ private:
std::pair<int,int> glyph_to_chars(const GlyphItem &) const;
std::pair<long,long> caret_positions(size_t) const;
+ void expandOrCondense(ImplLayoutArgs &rArgs);
};
diff --git a/vcl/inc/vcl/help.hxx b/vcl/inc/vcl/help.hxx
index 4bca986812ed..30308aa8a723 100644
--- a/vcl/inc/vcl/help.hxx
+++ b/vcl/inc/vcl/help.hxx
@@ -48,6 +48,7 @@ class Window;
#define QUICKHELP_BOTTOM ((USHORT)0x0020)
#define QUICKHELP_NOAUTOPOS (QUICKHELP_LEFT | QUICKHELP_CENTER | QUICKHELP_RIGHT | QUICKHELP_TOP | QUICKHELP_VCENTER | QUICKHELP_BOTTOM)
#define QUICKHELP_CTRLTEXT ((USHORT)0x0040)
+#define QUICKHELP_NOEVADEPOINTER ((USHORT)0x4000)
#define QUICKHELP_BIDI_RTL ((USHORT)0x8000)
// By changes you must also change: rsc/vclrsc.hxx
diff --git a/vcl/inc/vcl/impfont.hxx b/vcl/inc/vcl/impfont.hxx
index 6ce9f21500b5..a1104bbf4a86 100644
--- a/vcl/inc/vcl/impfont.hxx
+++ b/vcl/inc/vcl/impfont.hxx
@@ -177,7 +177,8 @@ class CmapResult;
class VCL_DLLPUBLIC ImplFontCharMap
{
public:
- explicit ImplFontCharMap( const CmapResult& );
+ explicit ImplFontCharMap( const CmapResult& );
+ virtual ~ImplFontCharMap();
static ImplFontCharMap* GetDefaultMap( bool bSymbols=false);
@@ -201,7 +202,6 @@ public:
int GetGlyphIndex( sal_uInt32 ) const;
private:
- /*virtual*/ ~ImplFontCharMap();
int ImplFindRangeIndex( sal_uInt32 ) const;
// prevent assignment and copy construction
diff --git a/vcl/inc/vcl/lstbox.hxx b/vcl/inc/vcl/lstbox.hxx
index 98cd05d999dd..3659e5aee485 100644
--- a/vcl/inc/vcl/lstbox.hxx
+++ b/vcl/inc/vcl/lstbox.hxx
@@ -130,6 +130,7 @@ public:
virtual USHORT GetEntryPos( const XubString& rStr ) const;
virtual USHORT GetEntryPos( const void* pData ) const;
+ Image GetEntryImage( USHORT nPos ) const;
virtual XubString GetEntry( USHORT nPos ) const;
virtual USHORT GetEntryCount() const;
diff --git a/vcl/inc/vcl/menu.hxx b/vcl/inc/vcl/menu.hxx
index c0cc3b5b51d6..908f3e30319c 100644
--- a/vcl/inc/vcl/menu.hxx
+++ b/vcl/inc/vcl/menu.hxx
@@ -41,6 +41,7 @@ struct MenuItemData;
class Point;
class Size;
class Rectangle;
+class Menu;
class MenuItemList;
class HelpEvent;
class Image;
@@ -102,6 +103,17 @@ typedef USHORT MenuItemBits;
// forces images & toggle visibility for toolbar config popup
#define MENU_FLAG_SHOWCHECKIMAGES 0x0008
+struct ImplMenuDelData
+{
+ ImplMenuDelData* mpNext;
+ const Menu* mpMenu;
+
+ ImplMenuDelData( const Menu* pMenu );
+ ~ImplMenuDelData();
+
+ bool isDeleted() const { return mpMenu == 0; }
+};
+
// --------
// - Menu -
// --------
@@ -120,9 +132,9 @@ class VCL_DLLPUBLIC Menu : public Resource
friend class MenuFloatingWindow;
friend class PopupMenu;
friend class SystemWindow;
-
+ friend struct ImplMenuDelData;
private:
- void* pMenuData_NotUsedYet;
+ ImplMenuDelData* mpFirstDel;
MenuItemList* pItemList; // Liste mit den MenuItems
MenuLogo* pLogo;
Menu* pStartedFrom;
@@ -186,6 +198,8 @@ protected:
// return value is Max( rCheckHeight, rRadioHeight )
SAL_DLLPRIVATE long ImplGetNativeCheckAndRadioSize( Window*, long& rCheckHeight, long& rRadioHeight, long &rMaxWidth ) const;
+ SAL_DLLPRIVATE void ImplAddDel( ImplMenuDelData &rDel );
+ SAL_DLLPRIVATE void ImplRemoveDel( ImplMenuDelData &rDel );
public:
SAL_DLLPRIVATE void ImplKillLayoutData() const;
SAL_DLLPRIVATE Menu* ImplGetStartedFrom() const;
diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx
index 70c1e6aa624d..9b748f2b5937 100644
--- a/vcl/inc/vcl/outdev.hxx
+++ b/vcl/inc/vcl/outdev.hxx
@@ -39,6 +39,7 @@
#include <vcl/mapmod.hxx>
#include <vcl/wall.hxx>
#include <vcl/settings.hxx>
+#include <vcl/salnativewidgets.hxx>
#include <tools/poly.hxx>
#include <basegfx/vector/b2enums.hxx>
#include <com/sun/star/uno/Reference.h>
@@ -1177,6 +1178,49 @@ public:
BitmapEx GetDownsampledBitmapEx( const Size& rDstSz,
const Point& rSrcPt, const Size& rSrcSz,
const BitmapEx& rBmpEx, long nMaxBmpDPIX, long nMaxBmpDPIY );
+
+ //-------------------------------------
+ // Native Widget Rendering functions
+ //-------------------------------------
+
+ // These all just call through to the private mpGraphics functions of the same name.
+
+ // Query the platform layer for control support
+ BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart );
+
+ // Query the native control to determine if it was acted upon
+ BOOL HitTestNativeControl( ControlType nType,
+ ControlPart nPart,
+ const Region& rControlRegion,
+ const Point& aPos,
+ BOOL& rIsInside );
+
+ // Request rendering of a particular control and/or part
+ BOOL DrawNativeControl( ControlType nType,
+ ControlPart nPart,
+ const Region& rControlRegion,
+ ControlState nState,
+ const ImplControlValue& aValue,
+ ::rtl::OUString aCaption );
+
+ // Request rendering of a caption string for a control
+ BOOL DrawNativeControlText( ControlType nType,
+ ControlPart nPart,
+ const Region& rControlRegion,
+ ControlState nState,
+ const ImplControlValue& aValue,
+ ::rtl::OUString aCaption );
+
+ // Query the native control's actual drawing region (including adornment)
+ BOOL GetNativeControlRegion( ControlType nType,
+ ControlPart nPart,
+ const Region& rControlRegion,
+ ControlState nState,
+ const ImplControlValue& aValue,
+ ::rtl::OUString aCaption,
+ Region &rNativeBoundingRegion,
+ Region &rNativeContentRegion );
+
};
#endif // _SV_OUTDEV_HXX
diff --git a/vcl/inc/vcl/outfont.hxx b/vcl/inc/vcl/outfont.hxx
index 995fcd6009ff..4bbf7176ddb2 100644
--- a/vcl/inc/vcl/outfont.hxx
+++ b/vcl/inc/vcl/outfont.hxx
@@ -39,6 +39,8 @@
#include <hash_map>
+#include <com/sun/star/linguistic2/XLinguServiceManager.hpp>
+
class ImplDevFontListData;
class ImplGetDevFontList;
class ImplGetDevSizeList;
@@ -186,6 +188,7 @@ public: // TODO: change to private
class VCL_DLLPUBLIC ImplDevFontList
{
private:
+ friend class WinGlyphFallbackSubstititution;
mutable bool mbMatchData; // true if matching attributes are initialized
bool mbMapNames; // true if MapNames are available
@@ -222,6 +225,9 @@ public:
ImplGetDevFontList* GetDevFontList() const;
ImplGetDevSizeList* GetDevSizeList( const String& rFontName ) const;
+ //used by 2-level font fallback
+ ImplDevFontListData* ImplFindByLocale(com::sun::star::lang::Locale lc) const;
+
protected:
void InitMatchData() const;
bool AreMapNamesAvailable() const { return mbMapNames; }
diff --git a/vcl/inc/vcl/ppdparser.hxx b/vcl/inc/vcl/ppdparser.hxx
index 12e8a16f6264..c7a1e09b81e4 100644
--- a/vcl/inc/vcl/ppdparser.hxx
+++ b/vcl/inc/vcl/ppdparser.hxx
@@ -221,7 +221,7 @@ public:
bool isType42Capable() const { return m_bType42Capable; }
ULONG getLanguageLevel() const { return m_nLanguageLevel; }
- const String& getDefaultPaperDimension() const;
+ String getDefaultPaperDimension() const;
void getDefaultPaperDimension( int& rWidth, int& rHeight ) const
{ getPaperDimension( getDefaultPaperDimension(), rWidth, rHeight ); }
bool getPaperDimension( const String& rPaperName,
@@ -230,12 +230,12 @@ public:
// returns false if paper not found
int getPaperDimensions() const
{ return m_pPaperDimensions ? m_pPaperDimensions->countValues() : 0; }
- const String& getPaperDimension( int ) const;
- const String& getPaperDimensionCommand( int ) const;
- const String& getPaperDimensionCommand( const String & ) const;
+ String getPaperDimension( int ) const;
+ String getPaperDimensionCommand( int ) const;
+ String getPaperDimensionCommand( const String & ) const;
// match the best paper for width and height
- const String& matchPaper( int nWidth, int nHeight ) const;
+ String matchPaper( int nWidth, int nHeight ) const;
bool getMargins( const String& rPaperName,
int &rLeft, int& rRight,
@@ -245,27 +245,27 @@ public:
// values int pt
- const String& getDefaultInputSlot() const;
+ String getDefaultInputSlot() const;
int getInputSlots() const
{ return m_pInputSlots ? m_pInputSlots->countValues() : 0; }
- const String& getSlot( int ) const;
- const String& getSlotCommand( int ) const;
- const String& getSlotCommand( const String& ) const;
+ String getSlot( int ) const;
+ String getSlotCommand( int ) const;
+ String getSlotCommand( const String& ) const;
void getDefaultResolution( int& rXRes, int& rYRes ) const;
int getResolutions() const;
void getResolution( int, int& rXRes, int& rYRes ) const;
- const String& getResolutionCommand( int nXRes, int nYRes ) const;
+ String getResolutionCommand( int nXRes, int nYRes ) const;
// values in dpi
void getResolutionFromString( const String&, int&, int& ) const;
// helper function
- const String& getDefaultDuplexType() const;
+ String getDefaultDuplexType() const;
int getDuplexTypes() const
{ return m_pDuplexTypes ? m_pDuplexTypes->countValues() : 0; }
- const String& getDuplex( int ) const;
- const String& getDuplexCommand( int ) const;
- const String& getDuplexCommand( const String& ) const;
+ String getDuplex( int ) const;
+ String getDuplexCommand( int ) const;
+ String getDuplexCommand( const String& ) const;
int getFonts() const
{ return m_pFontList ? m_pFontList->countValues() : 0; }
@@ -275,7 +275,7 @@ public:
void getFontAttributes( const String&,
String& rEncoding,
String& rCharset ) const;
- const String& getFont( int ) const;
+ String getFont( int ) const;
rtl::OUString translateKey( const rtl::OUString& i_rKey,
diff --git a/vcl/inc/vcl/prndlg.hxx b/vcl/inc/vcl/prndlg.hxx
index bec612b65593..fdaf06c9854e 100644
--- a/vcl/inc/vcl/prndlg.hxx
+++ b/vcl/inc/vcl/prndlg.hxx
@@ -55,9 +55,12 @@ namespace vcl
{
GDIMetaFile maMtf;
Size maOrigSize;
+ Size maPreviewSize;
VirtualDevice maPageVDev;
rtl::OUString maReplacementString;
rtl::OUString maToolTipString;
+
+ bool useHCColorReplacement() const;
public:
PrintPreviewWindow( Window* pParent, const ResId& );
virtual ~PrintPreviewWindow();
@@ -293,6 +296,7 @@ namespace vcl
bool isPrintToFile();
int getCopyCount();
bool isCollate();
+ bool isSingleJobs();
void previewForward();
void previewBackward();
@@ -321,6 +325,7 @@ namespace vcl
bool isCanceled() const { return mbCanceled; }
void setProgress( int i_nCurrent, int i_nMax = -1 );
void tick();
+ void reset();
virtual void Paint( const Rectangle& );
};
diff --git a/vcl/inc/vcl/salgdi.hxx b/vcl/inc/vcl/salgdi.hxx
index 02e9efbc0f94..08c489f7d466 100644
--- a/vcl/inc/vcl/salgdi.hxx
+++ b/vcl/inc/vcl/salgdi.hxx
@@ -125,7 +125,7 @@ protected:
virtual void drawPolygon( ULONG nPoints, const SalPoint* pPtAry ) = 0;
virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ) = 0;
virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ) = 0;
- virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin ) = 0;
+ virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin ) = 0;
virtual sal_Bool drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) = 0;
virtual sal_Bool drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) = 0;
virtual sal_Bool drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry ) = 0;
@@ -159,15 +159,15 @@ protected:
// native widget rendering methods that require mirroring
virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside );
+ const Point& aPos, BOOL& rIsInside );
virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ ControlState nState, const ImplControlValue& aValue,
const rtl::OUString& aCaption );
virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const rtl::OUString& aCaption );
+ const rtl::OUString& aCaption );
virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, const rtl::OUString& aCaption,
+ const ImplControlValue& aValue, const rtl::OUString& aCaption,
Region &rNativeBoundingRegion, Region &rNativeContentRegion );
/** Render bitmap with alpha channel
@@ -373,7 +373,7 @@ public:
PCONSTSALPOINT* pPtAry,
const OutputDevice *pOutDev );
bool DrawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency, const OutputDevice* );
- bool DrawPolyLine( const basegfx::B2DPolygon&, const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin, const OutputDevice* );
+ bool DrawPolyLine( const basegfx::B2DPolygon&, double fTransparency, const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin, const OutputDevice* );
sal_Bool DrawPolyLineBezier( ULONG nPoints,
const SalPoint* pPtAry,
const BYTE* pFlgAry,
@@ -442,7 +442,6 @@ public:
ControlPart nPart,
const Region& rControlRegion,
const Point& aPos,
- SalControlHandle& rControlHandle,
BOOL& rIsInside,
const OutputDevice *pOutDev );
@@ -452,7 +451,6 @@ public:
const Region& rControlRegion,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle,
const rtl::OUString& aCaption,
const OutputDevice *pOutDev );
@@ -462,7 +460,6 @@ public:
const Region& rControlRegion,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle,
const rtl::OUString& aCaption,
const OutputDevice *pOutDev );
@@ -472,7 +469,6 @@ public:
const Region& rControlRegion,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle,
const rtl::OUString& aCaption,
Region &rNativeBoundingRegion,
Region &rNativeContentRegion,
diff --git a/vcl/inc/vcl/salwtype.hxx b/vcl/inc/vcl/salwtype.hxx
index c67d36ac4ea9..95b3806d648b 100644
--- a/vcl/inc/vcl/salwtype.hxx
+++ b/vcl/inc/vcl/salwtype.hxx
@@ -180,6 +180,11 @@ struct SalWheelMouseEvent
ULONG mnScrollLines; // Aktuelle Anzahl zu scrollende Zeilen
USHORT mnCode; // SV-ModifierCode (KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT)
BOOL mbHorz; // Horizontal
+ BOOL mbDeltaIsPixel; // delta value is a pixel value (on mac)
+
+ SalWheelMouseEvent()
+ : mnTime( 0 ), mnX( 0 ), mnY( 0 ), mnDelta( 0 ), mnNotchDelta( 0 ), mnScrollLines( 0 ), mnCode( 0 ), mbHorz( FALSE ), mbDeltaIsPixel( FALSE )
+ {}
};
// MOUSEACTIVATE
diff --git a/vcl/inc/vcl/syswin.hxx b/vcl/inc/vcl/syswin.hxx
index b0e74df9a767..b3a7d9b8775e 100644
--- a/vcl/inc/vcl/syswin.hxx
+++ b/vcl/inc/vcl/syswin.hxx
@@ -179,6 +179,8 @@ private:
SystemWindow (const SystemWindow &);
SystemWindow & operator= (const SystemWindow &);
+ SAL_DLLPRIVATE void ImplMoveToScreen( long& io_rX, long& io_rY, long i_nWidth, long i_nHeight, Window* i_pConfigureWin );
+
protected:
// Single argument ctors shall be explicit.
explicit SystemWindow( WindowType nType );
diff --git a/vcl/inc/vcl/vclevent.hxx b/vcl/inc/vcl/vclevent.hxx
index 048eb1d5a670..8ccb880fce34 100644
--- a/vcl/inc/vcl/vclevent.hxx
+++ b/vcl/inc/vcl/vclevent.hxx
@@ -154,8 +154,8 @@ namespace com { namespace sun { namespace star {
#define VCLEVENT_TOOLBOX_FORMATCHANGED 1172 // request new layout
#define VCLEVENT_COMBOBOX_SETTEXT 1173
// --> OD 2009-04-01 #i92103#
-#define VCLEVENT_LISTBOX_ENTRY_EXPANDED 1174
-#define VCLEVENT_LISTBOX_ENTRY_COLLAPSED 1175
+#define VCLEVENT_ITEM_EXPANDED 1174
+#define VCLEVENT_ITEM_COLLAPSED 1175
// <--
#define VCLEVENT_DROPDOWN_PRE_OPEN 1176
@@ -192,6 +192,7 @@ namespace com { namespace sun { namespace star {
#define VCLEVENT_TOOLBOX_BUTTONSTATECHANGED 1223 // pData = itempos
#define VCLEVENT_TABLECELL_NAMECHANGED 1224 // pData = struct(Entry, Column, oldText)
+#define VCLEVENT_TABLEROW_SELECT 1225
class VCL_DLLPUBLIC VclSimpleEvent
{
diff --git a/vcl/inc/vcl/window.h b/vcl/inc/vcl/window.h
index 9d917a09b6de..691c3ed18421 100644
--- a/vcl/inc/vcl/window.h
+++ b/vcl/inc/vcl/window.h
@@ -56,7 +56,6 @@ class VirtualDevice;
class Cursor;
class ImplDevFontList;
class ImplFontCache;
-class SalControlHandle;
class SmartId;
class VCLXWindow;
class SalFrame;
@@ -120,7 +119,6 @@ struct ImplWinData
USHORT mnTrackFlags;
USHORT mnIsTopWindow;
BOOL mbMouseOver; // tracks mouse over for native widget paint effect
- SalControlHandle* mpSalControlHandle; // native data for NWF
BOOL mbEnableNativeWidget; // toggle native widget rendering
SmartId* mpSmartHelpId;
SmartId* mpSmartUniqueId;
diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx
index 3d1cc91ee468..8264767e59ad 100644
--- a/vcl/inc/vcl/window.hxx
+++ b/vcl/inc/vcl/window.hxx
@@ -124,6 +124,8 @@ namespace dnd {
namespace vcl { struct ControlLayoutData; }
+namespace svt { class PopupWindowControllerImpl; }
+
// ---------------
// - WindowTypes -
// ---------------
@@ -362,6 +364,8 @@ class VCL_DLLPUBLIC Window : public OutputDevice
friend class ImplPopupFloatWin;
friend class MenuFloatingWindow;
+ friend class svt::PopupWindowControllerImpl;
+
private:
// NOTE: to remove many dependencies of other modules
// to this central file, all members are now hidden
@@ -548,20 +552,18 @@ public:
SAL_DLLPRIVATE ::std::vector<Window *>& ImplGetOwnerDrawList();
SAL_DLLPRIVATE Window* ImplGetTopmostFrameWindow();
- SAL_DLLPRIVATE Rectangle ImplGetWindowExtentsRelative( Window *pRelativeWindow, BOOL bClientOnly );
+ SAL_DLLPRIVATE Rectangle ImplGetWindowExtentsRelative( Window *pRelativeWindow, BOOL bClientOnly ) const;
SAL_DLLPRIVATE void ImplNotifyIconifiedState( BOOL bIconified );
SAL_DLLPRIVATE bool ImplStopDnd();
SAL_DLLPRIVATE void ImplStartDnd();
SAL_DLLPRIVATE static void ImplInitAppFontData( Window* pWindow );
- SAL_DLLPRIVATE void ImplInitSalControlHandle();
SAL_DLLPRIVATE void ImplPaintToDevice( OutputDevice* pTargetOutDev, const Point& rPos );
SAL_DLLPRIVATE BOOL ImplIsInTaskPaneList();
SAL_DLLPRIVATE void ImplIsInTaskPaneList( BOOL mbIsInTaskList );
SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvas >
ImplGetCanvas( const Size& rFullscreenSize, bool bFullscreen, bool bSpriteCanvas ) const;
- SAL_DLLPRIVATE void ImplMoveControlValue( ControlType, const ImplControlValue&, const Point& ) const;
private:
// Default construction is forbidden and not implemented.
@@ -856,9 +858,9 @@ public:
Point AbsoluteScreenToOutputPixel( const Point& rPos ) const;
Rectangle GetDesktopRectPixel() const;
// window extents including border and decoratrion
- Rectangle GetWindowExtentsRelative( Window *pRelativeWindow );
+ Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const;
// window extents of the client window, coordinates to be used in SetPosPixel
- Rectangle GetClientWindowExtentsRelative( Window *pRelativeWindow );
+ Rectangle GetClientWindowExtentsRelative( Window *pRelativeWindow ) const;
virtual BOOL IsScrollable() const;
virtual void Scroll( long nHorzScroll, long nVertScroll,
@@ -1092,44 +1094,6 @@ public:
void EnableNativeWidget( BOOL bEnable = TRUE );
BOOL IsNativeWidgetEnabled() const;
- // These all just call through to the private mpWindowImpl->mpFrame functions of the same name.
-
- // Query the platform layer for control support
- BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart );
-
- // Query the native control to determine if it was acted upon
- BOOL HitTestNativeControl( ControlType nType,
- ControlPart nPart,
- const Region& rControlRegion,
- const Point& aPos,
- BOOL& rIsInside );
-
- // Request rendering of a particular control and/or part
- BOOL DrawNativeControl( ControlType nType,
- ControlPart nPart,
- const Region& rControlRegion,
- ControlState nState,
- const ImplControlValue& aValue,
- rtl::OUString aCaption );
-
- // Request rendering of a caption string for a control
- BOOL DrawNativeControlText( ControlType nType,
- ControlPart nPart,
- const Region& rControlRegion,
- ControlState nState,
- const ImplControlValue& aValue,
- rtl::OUString aCaption );
-
- // Query the native control's actual drawing region (including adornment)
- BOOL GetNativeControlRegion( ControlType nType,
- ControlPart nPart,
- const Region& rControlRegion,
- ControlState nState,
- const ImplControlValue& aValue,
- rtl::OUString aCaption,
- Region &rNativeBoundingRegion,
- Region &rNativeContentRegion );
-
// a helper method for a Control's Draw method
void PaintToDevice( OutputDevice* pDevice, const Point& rPos, const Size& rSize );
diff --git a/vcl/os2/inc/salgdi.h b/vcl/os2/inc/salgdi.h
index ce486084a5b1..cf05ff15d7e2 100644
--- a/vcl/os2/inc/salgdi.h
+++ b/vcl/os2/inc/salgdi.h
@@ -162,7 +162,7 @@ protected:
virtual void drawPolygon( ULONG nPoints, const SalPoint* pPtAry );
virtual void drawPolyPolygon( ULONG nPoly, const ULONG* pPoints, PCONSTSALPOINT* pPtAry );
virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency );
- virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin);
+ virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin );
virtual sal_Bool drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry );
virtual sal_Bool drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry );
virtual sal_Bool drawPolyPolygonBezier( ULONG nPoly, const ULONG* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry );
@@ -197,15 +197,15 @@ protected:
#if 0
// native widget rendering methods that require mirroring
virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside );
+ const Point& aPos, BOOL& rIsInside );
virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ ControlState nState, const ImplControlValue& aValue,
rtl::OUString aCaption );
virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, rtl::OUString aCaption );
+ rtl::OUString aCaption );
virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, rtl::OUString aCaption,
+ const ImplControlValue& aValue, rtl::OUString aCaption,
Region &rNativeBoundingRegion, Region &rNativeContentRegion );
#endif
diff --git a/vcl/os2/source/gdi/salgdi.cxx b/vcl/os2/source/gdi/salgdi.cxx
index 5be40355f731..dff1557170fb 100644
--- a/vcl/os2/source/gdi/salgdi.cxx
+++ b/vcl/os2/source/gdi/salgdi.cxx
@@ -670,6 +670,7 @@ bool Os2SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double /
bool Os2SalGraphics::drawPolyLine(
const basegfx::B2DPolygon& /*rPolygon*/,
+ double /*fTransparency*/,
const basegfx::B2DVector& /*rLineWidths*/,
basegfx::B2DLineJoin /*eLineJoin*/)
{
diff --git a/vcl/os2/source/window/salframe.cxx b/vcl/os2/source/window/salframe.cxx
index 7ecc27ff9754..f3314c725255 100644
--- a/vcl/os2/source/window/salframe.cxx
+++ b/vcl/os2/source/window/salframe.cxx
@@ -3032,10 +3032,8 @@ static void ImplHandleMoveMsg( HWND hWnd)
// -----------------------------------------------------------------------
-static long ImplHandleSizeMsg( HWND hWnd, MPARAM nMP2 )
+static void ImplHandleSizeMsg( HWND hWnd, MPARAM nMP2 )
{
- long nRet;
-
Os2SalFrame* pFrame = GetWindowPtr( hWnd );
if ( pFrame )
{
@@ -3047,11 +3045,10 @@ static long ImplHandleSizeMsg( HWND hWnd, MPARAM nMP2 )
pFrame->mpGraphics->mnHeight = (int)SHORT2FROMMP(nMP2);
// Status merken
ImplSaveFrameState( pFrame );
- nRet = pFrame->CallCallback( SALEVENT_RESIZE, 0 );
+ pFrame->CallCallback( SALEVENT_RESIZE, 0 );
if ( WinIsWindowVisible( pFrame->mhWndFrame ) && !pFrame->mbInShow )
WinUpdateWindow( pFrame->mhWndClient );
}
- return nRet;
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx
index b22a7d21f357..dd9a5b4a15ee 100644
--- a/vcl/source/app/dbggui.cxx
+++ b/vcl/source/app/dbggui.cxx
@@ -1783,8 +1783,6 @@ void DbgDialogTest( Window* pWindow )
}
// =======================================================================
-void DbgPrintShell( const char* pLine );
-
#ifndef WNT
#define USE_VCL_MSGBOX
#define COPY_BUTTON_ID 25
@@ -1963,27 +1961,6 @@ void DbgPrintWindow( const char* pLine )
bIn = FALSE;
}
-// -----------------------------------------------------------------------
-
-void DbgPrintShell( const char* pLine )
-{
-#if defined( WNT )
- // TODO: Shouldn't this be a IsDebuggerPresent()?
- if ( GetSystemMetrics( SM_DEBUG ) )
- {
- strcpy( aDbgOutBuf, pLine );
- strcat( aDbgOutBuf, "\r\n" );
- OutputDebugString( aDbgOutBuf );
- return;
- }
-
- DbgPrintWindow( pLine );
-#endif
-#ifdef UNX
- fprintf( stderr, "%s\n", pLine );
-#endif
-}
-
// =======================================================================
#ifdef WNT
@@ -1996,7 +1973,6 @@ void DbgGUIInit()
{
DbgSetPrintMsgBox( DbgPrintMsgBox );
DbgSetPrintWindow( DbgPrintWindow );
- DbgSetPrintShell( DbgPrintShell );
#ifdef WNT
DbgSetTestSolarMutex( ImplDbgTestSolarMutex );
#endif
@@ -2008,7 +1984,6 @@ void DbgGUIDeInit()
{
DbgSetPrintMsgBox( NULL );
DbgSetPrintWindow( NULL );
- DbgSetPrintShell( NULL );
#ifdef WNT
DbgSetTestSolarMutex( NULL );
#endif
diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx
index b4ab10887fcd..ac1da931ba06 100644
--- a/vcl/source/app/help.cxx
+++ b/vcl/source/app/help.cxx
@@ -759,18 +759,26 @@ void ImplSetHelpWindowPos( Window* pHelpWin, USHORT nHelpWinStyle, USHORT nStyle
else if ( ( aPos.Y() + aSz.Height() ) > aScreenRect.Bottom() )
aPos.Y() = aScreenRect.Bottom() - aSz.Height();
- // the popup must not appear under the mouse
- // otherwise it would directly be closed due to a focus change...
- Rectangle aHelpRect( aPos, aSz );
- if( aHelpRect.IsInside( mPos ) )
+ if( ! (nStyle & QUICKHELP_NOEVADEPOINTER) )
{
- Point delta(2,2);
- Point pSize( aSz.Width(), aSz.Height() );
- Point pTest( mPos - pSize - delta );
- if( pTest.X() > aScreenRect.Left() && pTest.Y() > aScreenRect.Top() )
- aPos = pTest;
- else
- aPos = mPos + delta;
+ /* the remark below should be obsolete by now as the helpwindow should
+ not be focusable, leaving it as a hint. However it is sensible in most
+ conditions to evade the mouse pointer so the content window is fully visible.
+
+ // the popup must not appear under the mouse
+ // otherwise it would directly be closed due to a focus change...
+ */
+ Rectangle aHelpRect( aPos, aSz );
+ if( aHelpRect.IsInside( mPos ) )
+ {
+ Point delta(2,2);
+ Point pSize( aSz.Width(), aSz.Height() );
+ Point pTest( mPos - pSize - delta );
+ if( pTest.X() > aScreenRect.Left() && pTest.Y() > aScreenRect.Top() )
+ aPos = pTest;
+ else
+ aPos = mPos + delta;
+ }
}
Window* pWindow = pHelpWin->GetParent()->ImplGetFrameWindow();
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 5ad3f6787461..980e0f1c5b58 100755
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -188,7 +188,7 @@ ImplMouseData::ImplMouseData()
mnActionDelay = 250;
mnMenuDelay = 150;
mnFollow = MOUSE_FOLLOW_MENU | MOUSE_FOLLOW_DDLIST;
- mnWheelBehavior = MOUSE_WHEEL_FOCUS_ONLY;
+ mnWheelBehavior = MOUSE_WHEEL_ALWAYS;
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 7cec6867e0a3..e503172eb2c6 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1975,11 +1975,14 @@ BOOL Application::IsHeadlessModeEnabled()
void Application::ShowNativeErrorBox(const String& sTitle ,
const String& sMessage)
{
- ImplGetSalSystem()->ShowNativeMessageBox (
+ int btn = ImplGetSalSystem()->ShowNativeMessageBox (
sTitle,
sMessage,
SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK,
SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK);
+ if (btn != SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK) {
+ OSL_TRACE("ShowNativeMessageBox returned %d\n", btn);
+ }
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 1f45b5902381..d66389eee62d 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -367,7 +367,8 @@ USHORT Button::ImplGetTextStyle( XubString& rText, WinBits nWinStyle,
void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos,
Size& rSize, BOOL bLayout,
ULONG nImageSep, ULONG nDrawFlags,
- USHORT nTextStyle, Rectangle *pSymbolRect )
+ USHORT nTextStyle, Rectangle *pSymbolRect,
+ bool bAddImageSep )
{
XubString aText( GetText() );
BOOL bDrawImage = HasImage() && ! ( ImplGetButtonState() & BUTTON_DRAW_NOIMAGE );
@@ -502,6 +503,13 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos,
if ( aTSSize.Height() < aTextSize.Height() )
aTSSize.Height() = aTextSize.Height();
+
+ if( bAddImageSep && bDrawImage )
+ {
+ long nDiff = (aImageSize.Height() - aTextSize.Height()) / 3;
+ if( nDiff > 0 )
+ nImageSep += nDiff;
+ }
}
aMax.Width() = aTSSize.Width() > aImageSize.Width() ? aTSSize.Width() : aImageSize.Width();
@@ -880,7 +888,9 @@ void PushButton::ImplInitSettings( BOOL bFont,
EnableChildTransparentMode( TRUE );
SetParentClipMode( PARENTCLIPMODE_NOCLIP );
SetPaintTransparent( TRUE );
- mpWindowImpl->mbUseNativeFocus = ImplGetSVData()->maNWFData.mbNoFocusRects;
+ mpWindowImpl->mbUseNativeFocus = (GetStyle() & WB_FLATBUTTON)
+ ? false
+ : ImplGetSVData()->maNWFData.mbNoFocusRects;
}
else
{
@@ -1177,7 +1187,7 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags
aSize.Width() -= ( 5 + nSymbolSize );
ImplDrawAlignedImage( pDev, aPos, aSize, bLayout,
- 1, nDrawFlags, nTextStyle );
+ 1, nDrawFlags, nTextStyle, NULL, (GetStyle() & WB_FLATBUTTON) != 0 );
}
else
ImplCalcSymbolRect( aInRect );
@@ -1194,8 +1204,10 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags
ULONG nImageSep = 1 + (pDev->GetTextHeight()-10)/2;
if( nImageSep < 1 )
nImageSep = 1;
+ // FIXME: (GetStyle() & WB_FLATBUTTON) != 0 is preliminary
+ // in the next major this should be replaced by "true"
ImplDrawAlignedImage( pDev, aPos, aSize, bLayout, nImageSep, nDrawFlags,
- nTextStyle, IsSymbol() ? &aSymbolRect : NULL );
+ nTextStyle, IsSymbol() ? &aSymbolRect : NULL, (GetStyle() & WB_FLATBUTTON) != 0 );
if ( IsSymbol() && ! bLayout )
{
@@ -1363,7 +1375,7 @@ void PushButton::ImplDrawPushButton( bool bLayout )
Size aInRectSize( LogicToPixel( Size( aInRect.GetWidth(), aInRect.GetHeight() ) ) );
aPBVal.mbSingleLine = (aInRectSize.Height() < 2 * aFontSize.Height() );
- if( ((nState & CTRL_STATE_ROLLOVER) || HasFocus()) || ! (GetStyle() & WB_FLATBUTTON) )
+ if( ((nState & CTRL_STATE_ROLLOVER)) || ! (GetStyle() & WB_FLATBUTTON) )
{
bNativeOK = DrawNativeControl( CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL, aCtrlRegion, nState,
aControlValue, rtl::OUString()/*PushButton::GetText()*/ );
@@ -1388,7 +1400,7 @@ void PushButton::ImplDrawPushButton( bool bLayout )
if( (GetStyle() & WB_FLATBUTTON) )
{
Rectangle aTempRect( aInRect );
- if( ! bLayout && (bRollOver || HasFocus()) )
+ if( ! bLayout && bRollOver )
ImplDrawPushButtonFrame( this, aTempRect, nButtonStyle );
aInRect.Left() += 2;
aInRect.Top() += 2;
@@ -1879,7 +1891,8 @@ long PushButton::PreNotify( NotifyEvent& rNEvt )
pBorder->Update();
}
}
- else if( IsNativeControlSupported(CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL) )
+ else if( (GetStyle() & WB_FLATBUTTON) ||
+ IsNativeControlSupported(CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL) )
{
Invalidate();
}
@@ -3675,11 +3688,14 @@ void CheckBox::ImplCheck()
else
eNewState = STATE_NOCHECK;
meState = eNewState;
- ImplInvalidateOrDrawCheckBoxState();
ImplDelData aDelData;
ImplAddDel( &aDelData );
- Toggle();
+ if( (GetStyle() & WB_EARLYTOGGLE) )
+ Toggle();
+ ImplInvalidateOrDrawCheckBoxState();
+ if( ! (GetStyle() & WB_EARLYTOGGLE) )
+ Toggle();
if ( aDelData.IsDelete() )
return;
ImplRemoveDel( &aDelData );
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index cd74a4cd88ce..ebccfdc1e6bb 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -741,6 +741,13 @@ void ImplListBoxWindow::ImplUpdateEntryMetrics( ImplEntryType& rEntry )
aMetrics.nEntryHeight );
}
+ if ( !aMetrics.bText && !aMetrics.bImage && !IsUserDrawEnabled() )
+ {
+ // entries which have no (aka an empty) text, and no image, and are not user-drawn, should be
+ // shown nonetheless
+ aMetrics.nEntryHeight = mnTextHeight + mnBorder;
+ }
+
if ( aMetrics.nEntryWidth > mnMaxWidth )
mnMaxWidth = aMetrics.nEntryWidth;
if ( aMetrics.nEntryHeight > mnMaxHeight )
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index 70b67c0a3d57..6c7df5b106bf 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -885,6 +885,8 @@ void ListBox::StateChanged( StateChangedType nType )
{
SetStyle( ImplInitStyle( GetStyle() ) );
mpImplLB->GetMainWindow()->EnableSort( ( GetStyle() & WB_SORT ) ? TRUE : FALSE );
+ BOOL bSimpleMode = ( GetStyle() & WB_SIMPLEMODE ) ? TRUE : FALSE;
+ mpImplLB->SetMultiSelectionSimpleMode( bSimpleMode );
}
else if( nType == STATE_CHANGE_MIRRORING )
{
@@ -1081,6 +1083,15 @@ void ListBox::RemoveEntry( USHORT nPos )
// -----------------------------------------------------------------------
+Image ListBox::GetEntryImage( USHORT nPos ) const
+{
+ if ( mpImplLB->GetEntryList()->HasEntryImage( nPos ) )
+ return mpImplLB->GetEntryList()->GetEntryImage( nPos );
+ return Image();
+}
+
+// -----------------------------------------------------------------------
+
USHORT ListBox::GetEntryPos( const XubString& rStr ) const
{
USHORT nPos = mpImplLB->GetEntryList()->FindEntry( rStr );
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 741267044829..95f84626b582 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -408,6 +408,9 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth )
if( aImageSize.Height() > aSize.Height() )
aSize.Height() = aImageSize.Height();
+ aSize.Width() += TAB_TABOFFSET_X*2;
+ aSize.Height() += TAB_TABOFFSET_Y*2;
+
Region aCtrlRegion( Rectangle( (const Point&)Point( 0, 0 ), aSize ) );
Region aBoundingRgn, aContentRgn;
const ImplControlValue aControlValue( BUTTONVALUE_DONTKNOW, rtl::OUString(), 0 );
@@ -419,8 +422,6 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth )
return aCont.GetSize();
}
- aSize.Width() += TAB_TABOFFSET_X*2;
- aSize.Height() += TAB_TABOFFSET_Y*2;
// For systems without synthetic bold support
if ( mbExtraSpace )
aSize.Width() += TAB_EXTRASPACE_X;
@@ -1156,8 +1157,6 @@ void TabControl::MouseButtonDown( const MouseEvent& rMEvt )
ImplTabItem* pItem = ImplGetItem( nPageId );
if( pItem && pItem->mbEnabled )
SelectTabPage( nPageId );
- else
- Sound::Beep( SOUND_ERROR, this );
}
}
}
diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx
index 9884e7016fee..cb565122ea63 100644
--- a/vcl/source/fontsubset/cff.cxx
+++ b/vcl/source/fontsubset/cff.cxx
@@ -33,6 +33,7 @@
#include <assert.h>
#include <vcl/fontsubset.hxx>
+#include <vcl/strhelper.hxx>
//#define IGNORE_HINTS
@@ -468,7 +469,7 @@ public: // TODO: is public really needed?
private:
// typeop exceution context
int mnStackIdx;
- ValType mnValStack[ NMAXSTACK];
+ ValType mnValStack[ NMAXSTACK+4];
ValType mnTransVals[ NMAXTRANS];
int mnHintSize;
@@ -1241,16 +1242,33 @@ void CffSubsetterContext::convertOneTypeEsc( void)
break;
}
case TYPE2OP::HFLEX1: {
- assert( mnStackIdx == 9 );
- writeCurveTo( mnStackIdx, -9, -8, -7, -6, -5, -6 );
- writeCurveTo( mnStackIdx, -4, -6, -3, -2, -1, -8 );
+ assert( mnStackIdx == 9);
+#if 0 // emulate hflex1 as straight line
+ const ValType* pX = &mnValStack[ mnStackIdx];
+ const ValType fDX = pX[-9] + pX[-7] + pX[-5] + pX[-4] + pX[-3] + pX[-1];
+ writeType1Val( fDX);
+ writeTypeOp( TYPE1OP::HLINETO);
+#else // emulate hflex1 as two curves
+ writeCurveTo( mnStackIdx, -9, -8, -7, -6, -5, 0);
+ writeCurveTo( mnStackIdx, -4, 0, -3, -2, -1, 0);
+ // TODO: emulate hflex1 using othersubr call
+#endif
mnStackIdx -= 9;
}
break;
case TYPE2OP::HFLEX: {
- assert( mnStackIdx == 7 );
- writeCurveTo( mnStackIdx, -7, 0, -6, -5, -4, -5 );
- writeCurveTo( mnStackIdx, -3, -5, -2, 0, -1, 0 );
+ assert( mnStackIdx == 7);
+ ValType* pX = &mnValStack[ mnStackIdx];
+#if 0 // emulate hflex as straight line
+ const ValType fDX = pX[-7] + pX[-6] + pX[-4] + pX[-3] + pX[-2] + pX[-1];
+ writeType1Val( fDX);
+ writeTypeOp( TYPE1OP::HLINETO);
+#else // emulate hflex as two curves
+ pX[+1] = -pX[-5]; // temp: +dy5==-dy2
+ writeCurveTo( mnStackIdx, -7, 0, -6, -5, -4, 0);
+ writeCurveTo( mnStackIdx, -3, 0, -2, +1, -1, 0);
+ // TODO: emulate hflex using othersubr call
+#endif
mnStackIdx -= 7;
}
break;
@@ -2027,6 +2045,17 @@ void Type1Emitter::emitAllCrypted( void)
// --------------------------------------------------------------------
+// #i110387# quick-and-dirty double->ascii conversion
+// needed because sprintf/ecvt/etc. alone are too localized (LC_NUMERIC)
+// also strip off trailing zeros in fraction while we are at it
+inline int dbl2str( char* pOut, double fVal, int nPrecision=6)
+{
+ const int nLen = psp::getValueOfDouble( pOut, fVal, nPrecision);
+ return nLen;
+}
+
+// --------------------------------------------------------------------
+
void Type1Emitter::emitValVector( const char* pLineHead, const char* pLineTail,
const ValVector& rVector)
{
@@ -2042,10 +2071,11 @@ void Type1Emitter::emitValVector( const char* pLineHead, const char* pLineTail,
aVal = *it;
if( ++it == rVector.end() )
break;
- mpPtr += sprintf( mpPtr, "%g ", aVal);
+ mpPtr += dbl2str( mpPtr, aVal);
+ *(mpPtr++) = ' ';
}
// emit the last value
- mpPtr += sprintf( mpPtr, "%g", aVal);
+ mpPtr += dbl2str( mpPtr, aVal);
// emit the line tail
mpPtr += sprintf( mpPtr, pLineTail);
}
@@ -2202,18 +2232,33 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter,
rEmitter.emitValVector( "/FamilyBlues [", "]ND\n", mpCffLocal->maFamilyBlues);
rEmitter.emitValVector( "/FamilyOtherBlues [", "]ND\n", mpCffLocal->maFamilyOtherBlues);
- if( mpCffLocal->mfBlueScale)
- pOut += sprintf( pOut, "/BlueScale %.6f def\n", mpCffLocal->mfBlueScale);
- if( mpCffLocal->mfBlueShift) // default BlueShift==7
- pOut += sprintf( pOut, "/BlueShift %.1f def\n", mpCffLocal->mfBlueShift);
- if( mpCffLocal->mfBlueFuzz) // default BlueFuzz==1
- pOut += sprintf( pOut, "/BlueFuzz %.1f def\n", mpCffLocal->mfBlueFuzz);
+ if( mpCffLocal->mfBlueScale) {
+ pOut += sprintf( pOut, "/BlueScale ");
+ pOut += dbl2str( pOut, mpCffLocal->mfBlueScale, 6);
+ pOut += sprintf( pOut, " def\n");
+ }
+ if( mpCffLocal->mfBlueShift) { // default BlueShift==7
+ pOut += sprintf( pOut, "/BlueShift ");
+ pOut += dbl2str( pOut, mpCffLocal->mfBlueShift);
+ pOut += sprintf( pOut, " def\n");
+ }
+ if( mpCffLocal->mfBlueFuzz) { // default BlueFuzz==1
+ pOut += sprintf( pOut, "/BlueFuzz ");
+ pOut += dbl2str( pOut, mpCffLocal->mfBlueFuzz);
+ pOut += sprintf( pOut, " def\n");
+ }
// emit stem hint related privdict entries
- if( mpCffLocal->maStemStdHW)
- pOut += sprintf( pOut, "/StdHW [%g] def\n", mpCffLocal->maStemStdHW);
- if( mpCffLocal->maStemStdVW)
- pOut += sprintf( pOut, "/StdVW [%g] def\n", mpCffLocal->maStemStdVW);
+ if( mpCffLocal->maStemStdHW) {
+ pOut += sprintf( pOut, "/StdHW [");
+ pOut += dbl2str( pOut, mpCffLocal->maStemStdHW);
+ pOut += sprintf( pOut, "] def\n");
+ }
+ if( mpCffLocal->maStemStdVW) {
+ pOut += sprintf( pOut, "/StdVW [");
+ pOut += dbl2str( pOut, mpCffLocal->maStemStdVW);
+ pOut += sprintf( pOut, "] def\n");
+ }
rEmitter.emitValVector( "/StemSnapH [", "]ND\n", mpCffLocal->maStemSnapH);
rEmitter.emitValVector( "/StemSnapV [", "]ND\n", mpCffLocal->maStemSnapV);
@@ -2224,8 +2269,11 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter,
pOut += sprintf( pOut, "/LanguageGroup %d def\n", mpCffLocal->mnLangGroup);
if( mpCffLocal->mnLangGroup == 1) // compatibility with ancient printers
pOut += sprintf( pOut, "/RndStemUp false def\n");
- if( mpCffLocal->mfExpFactor)
- pOut += sprintf( pOut, "/ExpansionFactor %.2f def\n", mpCffLocal->mfExpFactor);
+ if( mpCffLocal->mfExpFactor) {
+ pOut += sprintf( pOut, "/ExpansionFactor ");
+ pOut += dbl2str( pOut, mpCffLocal->mfExpFactor);
+ pOut += sprintf( pOut, " def\n");
+ }
#endif // IGNORE_HINTS
// emit remaining privdict entries
@@ -2248,6 +2296,7 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter,
// emit used GlobalSubr charstrings
// these are the just the default subrs
+ // TODO: do we need them as the flex hints are resolved differently?
static const char aSubrs[] =
"/Subrs 5 array\n"
"dup 0 15 RD \x5F\x3D\x6B\xAC\x3C\xBD\x74\x3D\x3E\x17\xA0\x86\x58\x08\x85 NP\n"
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index 51c76b5a4626..074935086b0b 100644
--- a/vcl/source/gdi/bitmap.cxx
+++ b/vcl/source/gdi/bitmap.cxx
@@ -323,7 +323,23 @@ BOOL Bitmap::HasGreyPalette() const
BOOL bRet = FALSE;
if( 1 == nBitCount )
- bRet = TRUE;
+ {
+ BitmapReadAccess* pRAcc = ( (Bitmap*) this )->AcquireReadAccess();
+
+ if( pRAcc )
+ {
+ const BitmapColor& rCol0( pRAcc->GetPaletteColor( 0 ) );
+ const BitmapColor& rCol1( pRAcc->GetPaletteColor( 1 ) );
+ if( rCol0.GetRed() == rCol0.GetGreen() && rCol0.GetRed() == rCol0.GetBlue() &&
+ rCol1.GetRed() == rCol1.GetGreen() && rCol1.GetRed() == rCol1.GetBlue() )
+ {
+ bRet = TRUE;
+ }
+ ( (Bitmap*) this )->ReleaseAccess( pRAcc );
+ }
+ else
+ bRet = TRUE;
+ }
else if( 4 == nBitCount || 8 == nBitCount )
{
BitmapReadAccess* pRAcc = ( (Bitmap*) this )->AcquireReadAccess();
diff --git a/vcl/source/gdi/image.cxx b/vcl/source/gdi/image.cxx
index e3f63a03d081..e79308b2664e 100644
--- a/vcl/source/gdi/image.cxx
+++ b/vcl/source/gdi/image.cxx
@@ -50,6 +50,10 @@
#include <vcl/image.h>
#include <vcl/image.hxx>
+#if OSL_DEBUG_LEVEL > 0
+#include <rtl/strbuf.hxx>
+#endif
+
DBG_NAME( Image )
DBG_NAME( ImageList )
@@ -543,11 +547,19 @@ void ImageAryData::Load(const rtl::OUString &rPrefix)
rtl::OUString aFileName = rPrefix;
aFileName += maName;
-#ifdef DBG_UTIL
- bool bSuccess = aImageTree->loadImage( aFileName, aSymbolsStyle, maBitmapEx, true );
- DBG_ASSERT (bSuccess, "ImageAryData::Failed to load image");
-#else
- aImageTree->loadImage( aFileName, aSymbolsStyle, maBitmapEx, true );
+#if OSL_DEBUG_LEVEL > 0
+ bool bSuccess =
+#endif
+ aImageTree->loadImage( aFileName, aSymbolsStyle, maBitmapEx, true );
+#if OSL_DEBUG_LEVEL > 0
+ if ( !bSuccess )
+ {
+ ::rtl::OStringBuffer aMessage;
+ aMessage.append( "ImageAryData::Load: failed to load image '" );
+ aMessage.append( ::rtl::OUStringToOString( aFileName, RTL_TEXTENCODING_UTF8 ).getStr() );
+ aMessage.append( "'" );
+ OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() );
+ }
#endif
}
diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk
index 75f2b3fffc64..f069828f25f9 100644
--- a/vcl/source/gdi/makefile.mk
+++ b/vcl/source/gdi/makefile.mk
@@ -106,6 +106,7 @@ SLOFILES= $(EXCEPTIONSFILES) \
$(SLO)$/outdev4.obj \
$(SLO)$/outdev5.obj \
$(SLO)$/outdev6.obj \
+ $(SLO)$/outdevnative.obj \
$(SLO)$/regband.obj \
$(SLO)$/region.obj \
$(SLO)$/wall.obj \
diff --git a/vcl/source/gdi/metric.cxx b/vcl/source/gdi/metric.cxx
index e5f54df41c9e..325146b6be8a 100644
--- a/vcl/source/gdi/metric.cxx
+++ b/vcl/source/gdi/metric.cxx
@@ -386,8 +386,9 @@ int ImplFontCharMap::GetGlyphIndex( sal_uInt32 cChar ) const
const bool bSymbolic = (mpRangeCodes[0]>=0xF000) & (mpRangeCodes[1]<=0xF0FF);
if( !bSymbolic )
return 0;
- // check for symbol aliasing (U+F0xx -> U+00xx)
- nRange = ImplFindRangeIndex( cChar | 0xF000 );
+ // check for symbol aliasing (U+00xx <-> U+F0xx)
+ cChar |= 0xF000;
+ nRange = ImplFindRangeIndex( cChar );
}
// check that we are inside a range
if( (nRange & 1) != 0 )
@@ -401,7 +402,7 @@ int ImplFontCharMap::GetGlyphIndex( sal_uInt32 cChar ) const
nGlyphIndex += nStartIndex;
} else {
// the glyphid array has the glyph index
- nGlyphIndex = mpGlyphIds[ nGlyphIndex - nStartIndex];
+ nGlyphIndex = mpGlyphIds[ nGlyphIndex - nStartIndex ];
}
return nGlyphIndex;
diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx
index 62be0130e068..a011e4ee4a92 100644
--- a/vcl/source/gdi/outdev.cxx
+++ b/vcl/source/gdi/outdev.cxx
@@ -2311,7 +2311,7 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt )
aB2DPolyLine = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aB2DPolyLine);
}
- if(mpGraphics->DrawPolyLine(aB2DPolyLine, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this))
+ if( mpGraphics->DrawPolyLine( aB2DPolyLine, 0.0, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this))
{
return;
}
@@ -2383,6 +2383,16 @@ void OutputDevice::impPaintLineGeometryWithEvtlExpand(
{
const double fHalfLineWidth((rInfo.GetWidth() * 0.5) + 0.5);
+ if(aLinePolyPolygon.areControlPointsUsed())
+ {
+ // #i110768# When area geometry has to be created, do not
+ // use the fallback bezier decomposition inside createAreaGeometry,
+ // but one that is at least as good as ImplSubdivideBezier was.
+ // There, Polygon::AdaptiveSubdivide was used with default parameter
+ // 1.0 as quality index.
+ aLinePolyPolygon = basegfx::tools::adaptiveSubdivideByDistance(aLinePolyPolygon, 1.0);
+ }
+
for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++)
{
aFillPolyPolygon.append(basegfx::tools::createAreaGeometry(
@@ -2406,7 +2416,7 @@ void OutputDevice::impPaintLineGeometryWithEvtlExpand(
if(bTryAA)
{
- bDone = mpGraphics->DrawPolyLine(aCandidate, basegfx::B2DVector(1.0, 1.0), basegfx::B2DLINEJOIN_NONE, this);
+ bDone = mpGraphics->DrawPolyLine( aCandidate, 0.0, basegfx::B2DVector(1.0,1.0), basegfx::B2DLINEJOIN_NONE, this);
}
if(!bDone)
@@ -2595,7 +2605,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly )
aB2DPolyLine = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aB2DPolyLine);
}
- if(mpGraphics->DrawPolyLine(aB2DPolyLine, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this))
+ if(mpGraphics->DrawPolyLine( aB2DPolyLine, 0.0, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this))
{
return;
}
@@ -2643,7 +2653,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly, const LineInfo& rLineInfo
if((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW)
&& LINE_SOLID == rLineInfo.GetStyle())
{
- DrawPolyLine(rPoly.getB2DPolygon(), (double)rLineInfo.GetWidth(), rLineInfo.GetLineJoin());
+ DrawPolyLine( rPoly.getB2DPolygon(), (double)rLineInfo.GetWidth(), rLineInfo.GetLineJoin());
return;
}
@@ -2775,7 +2785,7 @@ void OutputDevice::DrawPolygon( const Polygon& rPoly )
aB2DPolygon = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aB2DPolygon);
}
- bSuccess = mpGraphics->DrawPolyLine(aB2DPolygon, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this);
+ bSuccess = mpGraphics->DrawPolyLine( aB2DPolygon, 0.0, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this);
}
if(bSuccess)
@@ -2867,7 +2877,7 @@ void OutputDevice::DrawPolyPolygon( const PolyPolygon& rPolyPoly )
for(sal_uInt32 a(0); bSuccess && a < aB2DPolyPolygon.count(); a++)
{
- bSuccess = mpGraphics->DrawPolyLine(aB2DPolyPolygon.getB2DPolygon(a), aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this);
+ bSuccess = mpGraphics->DrawPolyLine( aB2DPolyPolygon.getB2DPolygon(a), 0.0, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this);
}
}
@@ -2990,7 +3000,7 @@ void OutputDevice::ImpDrawPolyPolygonWithB2DPolyPolygon(const basegfx::B2DPolyPo
for(sal_uInt32 a(0);bSuccess && a < aB2DPolyPolygon.count(); a++)
{
- bSuccess = mpGraphics->DrawPolyLine(aB2DPolyPolygon.getB2DPolygon(a), aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this);
+ bSuccess = mpGraphics->DrawPolyLine( aB2DPolyPolygon.getB2DPolygon(a), 0.0, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this);
}
}
@@ -3037,7 +3047,7 @@ bool OutputDevice::ImpTryDrawPolyLineDirect(
}
// draw the polyline
- return mpGraphics->DrawPolyLine(aB2DPolygon, aB2DLineWidth, eLineJoin, this);
+ return mpGraphics->DrawPolyLine( aB2DPolygon, 0.0, aB2DLineWidth, eLineJoin, this);
}
void OutputDevice::DrawPolyLine(
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index e13ae6cbe64a..949d3df5275f 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -579,6 +579,7 @@ Font OutputDevice::GetDefaultFont( USHORT nType, LanguageType eLang,
{
aFont.SetHeight( nDefaultHeight );
aFont.SetWeight( WEIGHT_NORMAL );
+ aFont.SetLanguage( eLang );
if ( aFont.GetCharSet() == RTL_TEXTENCODING_DONTKNOW )
aFont.SetCharSet( gsl_getSystemTextEncoding() );
@@ -1672,6 +1673,18 @@ void ImplDevFontList::InitMatchData() const
}
}
+//----------------------------------------------------------------------------
+ImplDevFontListData* ImplDevFontList::ImplFindByLocale(com::sun::star::lang::Locale lc) const
+{
+ // get the default font for a specified locale
+ const DefaultFontConfiguration& rDefaults = *DefaultFontConfiguration::get();
+ String aDefault = rDefaults.getUserInterfaceFont( lc );
+ ImplDevFontListData* pFontData = ImplFindByTokenNames( aDefault );
+ if( pFontData )
+ return pFontData;
+ return 0;
+}
+
// -----------------------------------------------------------------------
ImplDevFontListData* ImplDevFontList::ImplFindByAttributes( ULONG nSearchType,
@@ -2091,11 +2104,14 @@ ImplDevFontListData* ImplDevFontList::FindDefaultFont() const
ImplDevFontList* ImplDevFontList::Clone( bool bScalable, bool bEmbeddable ) const
{
ImplDevFontList* pClonedList = new ImplDevFontList;
- pClonedList->mbMatchData = mbMatchData;
+// pClonedList->mbMatchData = mbMatchData;
pClonedList->mbMapNames = mbMapNames;
pClonedList->mpPreMatchHook = mpPreMatchHook;
pClonedList->mpFallbackHook = mpFallbackHook;
+ // TODO: clone the config-font attributes too?
+ pClonedList->mbMatchData = false;
+
DevFontList::const_iterator it = maDevFontList.begin();
for(; it != maDevFontList.end(); ++it )
{
diff --git a/vcl/source/gdi/outdev6.cxx b/vcl/source/gdi/outdev6.cxx
index bef37284adbd..47b150ddc4c5 100644
--- a/vcl/source/gdi/outdev6.cxx
+++ b/vcl/source/gdi/outdev6.cxx
@@ -184,18 +184,31 @@ void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly,
if((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW)
&& mpGraphics->supportsOperation(OutDevSupport_B2DDraw)
- && ROP_OVERPAINT == GetRasterOp()
- && IsFillColor())
+ && ROP_OVERPAINT == GetRasterOp() )
{
// b2dpolygon support not implemented yet on non-UNX platforms
const ::basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation();
basegfx::B2DPolyPolygon aB2DPolyPolygon(rB2DPolyPoly);
- // transform the polygon and ensure closed
- aB2DPolyPolygon.transform(aTransform);
- aB2DPolyPolygon.setClosed(true);
+ // transform the polygon into device space and ensure it is closed
+ aB2DPolyPolygon.transform( aTransform );
+ aB2DPolyPolygon.setClosed( true );
- if(mpGraphics->DrawPolyPolygon(aB2DPolyPolygon, fTransparency, this))
+ bool bDrawnOk = true;
+ if( IsFillColor() )
+ bDrawnOk = mpGraphics->DrawPolyPolygon( aB2DPolyPolygon, fTransparency, this );
+ if( bDrawnOk && IsLineColor() )
+ {
+ const basegfx::B2DVector aHairlineWidth(1,1);
+ const int nPolyCount = aB2DPolyPolygon.count();
+ for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx )
+ {
+ const ::basegfx::B2DPolygon aOnePoly = aB2DPolyPolygon.getB2DPolygon( nPolyIdx );
+ mpGraphics->DrawPolyLine( aOnePoly, fTransparency, aHairlineWidth, ::basegfx::B2DLINEJOIN_NONE, this );
+ }
+ }
+
+ if( bDrawnOk )
{
#if 0
// MetaB2DPolyPolygonAction is not implemented yet:
@@ -287,14 +300,17 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly,
// get the polygon in device coordinates
basegfx::B2DPolyPolygon aB2DPolyPolygon( rPolyPoly.getB2DPolyPolygon() );
- aB2DPolyPolygon.setClosed( true );
const ::basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation();
aB2DPolyPolygon.transform( aTransform );
- // draw the transparent polygon
- bDrawn = mpGraphics->DrawPolyPolygon( aB2DPolyPolygon, nTransparencePercent*0.01, this );
+ const double fTransparency = 0.01 * nTransparencePercent;
+ if( mbFillColor )
+ {
+ // draw the transparent polygon
+ // NOTE: filled polygons are assumed to be drawn as if they were always closed
+ bDrawn = mpGraphics->DrawPolyPolygon( aB2DPolyPolygon, fTransparency, this );
+ }
- // DrawTransparent() assumes that the border is NOT to be drawn transparently???
if( mbLineColor )
{
// disable the fill color for now
@@ -305,7 +321,7 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly,
for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx )
{
const ::basegfx::B2DPolygon& rPolygon = aB2DPolyPolygon.getB2DPolygon( nPolyIdx );
- mpGraphics->DrawPolyLine( rPolygon, aLineWidths, ::basegfx::B2DLINEJOIN_NONE, this );
+ bDrawn = mpGraphics->DrawPolyLine( rPolygon, fTransparency, aLineWidths, ::basegfx::B2DLINEJOIN_NONE, this );
}
// prepare to restore the fill color
mbInitFillColor = mbFillColor;
diff --git a/vcl/source/gdi/outdevnative.cxx b/vcl/source/gdi/outdevnative.cxx
new file mode 100644
index 000000000000..fed41ec4de85
--- /dev/null
+++ b/vcl/source/gdi/outdevnative.cxx
@@ -0,0 +1,290 @@
+/*************************************************************************
+ *
+ * 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_vcl.hxx"
+
+#include "vcl/outdev.hxx"
+#include "vcl/window.hxx"
+#include "vcl/salgdi.hxx"
+#include "vcl/salnativewidgets.hxx"
+#include "vcl/pdfextoutdevdata.hxx"
+
+// -----------------------------------------------------------------------
+
+static bool lcl_enableNativeWidget( const OutputDevice& i_rDevice )
+{
+ const OutDevType eType( i_rDevice.GetOutDevType() );
+ switch ( eType )
+ {
+
+ case OUTDEV_WINDOW:
+ return dynamic_cast< const Window* >( &i_rDevice )->IsNativeWidgetEnabled();
+
+ case OUTDEV_VIRDEV:
+ {
+ const ::vcl::ExtOutDevData* pOutDevData( i_rDevice.GetExtOutDevData() );
+ const ::vcl::PDFExtOutDevData* pPDFData( dynamic_cast< const ::vcl::PDFExtOutDevData* >( pOutDevData ) );
+ if ( pPDFData != NULL )
+ return false;
+ return true;
+ }
+
+ default:
+ return false;
+ }
+}
+
+// -----------------------------------------------------------------------
+// These functions are mainly passthrough functions that allow access to
+// the SalFrame behind a Window object for native widget rendering purposes.
+// -----------------------------------------------------------------------
+
+// -----------------------------------------------------------------------
+
+BOOL OutputDevice::IsNativeControlSupported( ControlType nType, ControlPart nPart )
+{
+ if( !lcl_enableNativeWidget( *this ) )
+ return FALSE;
+
+ if ( !mpGraphics )
+ if ( !ImplGetGraphics() )
+ return FALSE;
+
+ return( mpGraphics->IsNativeControlSupported(nType, nPart) );
+}
+
+
+// -----------------------------------------------------------------------
+
+BOOL OutputDevice::HitTestNativeControl( ControlType nType,
+ ControlPart nPart,
+ const Region& rControlRegion,
+ const Point& aPos,
+ BOOL& rIsInside )
+{
+ if( !lcl_enableNativeWidget( *this ) )
+ return FALSE;
+
+ if ( !mpGraphics )
+ if ( !ImplGetGraphics() )
+ return FALSE;
+
+ Point aWinOffs( mnOutOffX, mnOutOffY );
+ Region screenRegion( rControlRegion );
+ screenRegion.Move( aWinOffs.X(), aWinOffs.Y());
+
+ return( mpGraphics->HitTestNativeControl(nType, nPart, screenRegion, Point( aPos.X() + mnOutOffX, aPos.Y() + mnOutOffY ),
+ rIsInside, this ) );
+}
+
+// -----------------------------------------------------------------------
+
+static void lcl_moveControlValue( ControlType nType, const ImplControlValue& aValue, const Point& rDelta )
+{
+ if( aValue.getOptionalVal() )
+ {
+ switch( nType )
+ {
+ case CTRL_SLIDER:
+ {
+ SliderValue* pSlVal = reinterpret_cast<SliderValue*>(aValue.getOptionalVal());
+ pSlVal->maThumbRect.Move( rDelta.X(), rDelta.Y() );
+ }
+ break;
+ case CTRL_SCROLLBAR:
+ {
+ ScrollbarValue* pScVal = reinterpret_cast<ScrollbarValue*>(aValue.getOptionalVal());
+ pScVal->maThumbRect.Move( rDelta.X(), rDelta.Y() );
+ pScVal->maButton1Rect.Move( rDelta.X(), rDelta.Y() );
+ pScVal->maButton2Rect.Move( rDelta.X(), rDelta.Y() );
+ }
+ break;
+ case CTRL_SPINBOX:
+ case CTRL_SPINBUTTONS:
+ {
+ SpinbuttonValue* pSpVal = reinterpret_cast<SpinbuttonValue*>(aValue.getOptionalVal());
+ pSpVal->maUpperRect.Move( rDelta.X(), rDelta.Y() );
+ pSpVal->maLowerRect.Move( rDelta.X(), rDelta.Y() );
+ }
+ break;
+ case CTRL_TOOLBAR:
+ {
+ ToolbarValue* pTVal = reinterpret_cast<ToolbarValue*>(aValue.getOptionalVal());
+ pTVal->maGripRect.Move( rDelta.X(), rDelta.Y() );
+ }
+ break;
+ }
+ }
+}
+
+BOOL OutputDevice::DrawNativeControl( ControlType nType,
+ ControlPart nPart,
+ const Region& rControlRegion,
+ ControlState nState,
+ const ImplControlValue& aValue,
+ ::rtl::OUString aCaption )
+{
+ if( !lcl_enableNativeWidget( *this ) )
+ return FALSE;
+
+ /*
+ if( !IsInPaint() && IsPaintTransparent() )
+ {
+ // only required if called directly (ie, we're not in Paint() ):
+ // force redraw (Paint()) for transparent controls
+ // to trigger a repaint of the background
+ Region aClipRgn( GetClipRegion() );
+ if( !rControlRegion.IsEmpty() )
+ aClipRgn.Intersect( rControlRegion );
+ Invalidate( aClipRgn, INVALIDATE_UPDATE );
+ return TRUE;
+ }
+ */
+
+ // make sure the current clip region is initialized correctly
+ if ( !mpGraphics )
+ if ( !ImplGetGraphics() )
+ return FALSE;
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbOutputClipped )
+ return TRUE;
+
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+
+ // Convert the coordinates from relative to Window-absolute, so we draw
+ // in the correct place in platform code
+ Point aWinOffs( mnOutOffX, mnOutOffY );
+ Region screenRegion( rControlRegion );
+ screenRegion.Move( aWinOffs.X(), aWinOffs.Y());
+
+ // do so for ImplControlValue members, also
+ lcl_moveControlValue( nType, aValue, aWinOffs );
+
+ Region aTestRegion( GetActiveClipRegion() );
+ aTestRegion.Intersect( rControlRegion );
+ if( aTestRegion == rControlRegion )
+ nState |= CTRL_CACHING_ALLOWED; // control is not clipped, caching allowed
+
+ BOOL bRet = mpGraphics->DrawNativeControl(nType, nPart, screenRegion, nState, aValue, aCaption, this );
+
+ // transform back ImplControlValue members
+ lcl_moveControlValue( nType, aValue, Point()-aWinOffs );
+
+ return bRet;
+}
+
+
+// -----------------------------------------------------------------------
+
+BOOL OutputDevice::DrawNativeControlText(ControlType nType,
+ ControlPart nPart,
+ const Region& rControlRegion,
+ ControlState nState,
+ const ImplControlValue& aValue,
+ ::rtl::OUString aCaption )
+{
+ if( !lcl_enableNativeWidget( *this ) )
+ return FALSE;
+
+ // make sure the current clip region is initialized correctly
+ if ( !mpGraphics )
+ if ( !ImplGetGraphics() )
+ return false;
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbOutputClipped )
+ return true;
+
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+
+ // Convert the coordinates from relative to Window-absolute, so we draw
+ // in the correct place in platform code
+ Point aWinOffs( mnOutOffX, mnOutOffY );
+ Region screenRegion( rControlRegion );
+ screenRegion.Move( aWinOffs.X(), aWinOffs.Y());
+ lcl_moveControlValue( nType, aValue, aWinOffs );
+
+ BOOL bRet = mpGraphics->DrawNativeControlText(nType, nPart, screenRegion, nState, aValue, aCaption, this );
+
+ // transform back ImplControlValue members
+ lcl_moveControlValue( nType, aValue, Point()-aWinOffs );
+
+ return bRet;
+}
+
+
+// -----------------------------------------------------------------------
+
+BOOL OutputDevice::GetNativeControlRegion( ControlType nType,
+ ControlPart nPart,
+ const Region& rControlRegion,
+ ControlState nState,
+ const ImplControlValue& aValue,
+ ::rtl::OUString aCaption,
+ Region &rNativeBoundingRegion,
+ Region &rNativeContentRegion )
+{
+ if( !lcl_enableNativeWidget( *this ) )
+ return FALSE;
+
+ if ( !mpGraphics )
+ if ( !ImplGetGraphics() )
+ return FALSE;
+
+ // Convert the coordinates from relative to Window-absolute, so we draw
+ // in the correct place in platform code
+ Point aWinOffs( mnOutOffX, mnOutOffY );
+ Region screenRegion( rControlRegion );
+ screenRegion.Move( aWinOffs.X(), aWinOffs.Y());
+ lcl_moveControlValue( nType, aValue, aWinOffs );
+
+ BOOL bRet = mpGraphics->GetNativeControlRegion(nType, nPart, screenRegion, nState, aValue,
+ aCaption, rNativeBoundingRegion,
+ rNativeContentRegion, this );
+ if( bRet )
+ {
+ // transform back native regions
+ rNativeBoundingRegion.Move( -aWinOffs.X(), -aWinOffs.Y() );
+ rNativeContentRegion.Move( -aWinOffs.X(), -aWinOffs.Y() );
+ }
+ // transform back ImplControlValue members
+ lcl_moveControlValue( nType, aValue, Point()-aWinOffs );
+
+ return bRet;
+}
+
+
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 6a24775219d9..6cb0a7d07697 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -4081,15 +4081,15 @@ bool PDFWriterImpl::emitFonts()
}
else if( (aSubsetInfo.m_nFontType & FontSubsetInfo::TYPE1_PFB) != 0 ) // TODO: also support PFA?
{
- unsigned char* pBuffer = new unsigned char[ (int)nLength1 ];
+ boost::shared_array<unsigned char> pBuffer( new unsigned char[ nLength1 ] );
sal_uInt64 nBytesRead = 0;
- CHECK_RETURN( (osl_File_E_None == osl_readFile( aFontFile, pBuffer, nLength1, &nBytesRead ) ) );
+ CHECK_RETURN( (osl_File_E_None == osl_readFile( aFontFile, pBuffer.get(), nLength1, &nBytesRead ) ) );
DBG_ASSERT( nBytesRead==nLength1, "PDF-FontSubset read incomplete!" );
CHECK_RETURN( (osl_File_E_None == osl_setFilePos( aFontFile, osl_Pos_Absolut, 0 ) ) );
// get the PFB-segment lengths
ThreeInts aSegmentLengths = {0,0,0};
- getPfbSegmentLengths( pBuffer, (int)nBytesRead, aSegmentLengths );
+ getPfbSegmentLengths( pBuffer.get(), (int)nBytesRead, aSegmentLengths );
// the lengths below are mandatory for PDF-exported Type1 fonts
// because the PFB segment headers get stripped! WhyOhWhy.
aLine.append( (sal_Int32)aSegmentLengths[0] );
@@ -4106,11 +4106,9 @@ bool PDFWriterImpl::emitFonts()
// emit PFB-sections without section headers
beginCompression();
checkAndEnableStreamEncryption( nFontStream );
- CHECK_RETURN( writeBuffer( pBuffer+ 6, aSegmentLengths[0] ) );
- CHECK_RETURN( writeBuffer( pBuffer+12 + aSegmentLengths[0], aSegmentLengths[1] ) );
- CHECK_RETURN( writeBuffer( pBuffer+18 + aSegmentLengths[0] + aSegmentLengths[1], aSegmentLengths[2] ) );
-
- delete[] pBuffer;
+ CHECK_RETURN( writeBuffer( &pBuffer[6], aSegmentLengths[0] ) );
+ CHECK_RETURN( writeBuffer( &pBuffer[12] + aSegmentLengths[0], aSegmentLengths[1] ) );
+ CHECK_RETURN( writeBuffer( &pBuffer[18] + aSegmentLengths[0] + aSegmentLengths[1], aSegmentLengths[2] ) );
}
else
{
@@ -9749,7 +9747,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask )
aLine.append( " ]\n" );
}
}
- else if( m_bIsPDF_A1 )
+ else if( m_bIsPDF_A1 && (bWriteMask || aTransparentColor != Color( COL_TRANSPARENT )) )
m_aErrors.insert( PDFWriter::Warning_Transparency_Omitted_PDFA );
aLine.append( ">>\n"
@@ -11733,7 +11731,7 @@ sal_Int32 PDFWriterImpl::findRadioGroupWidget( const PDFWriter::RadioButtonWidge
m_aWidgets.back().m_nPage = m_nCurrentPage;
m_aWidgets.back().m_eType = PDFWriter::RadioButton;
m_aWidgets.back().m_nRadioGroup = rBtn.RadioGroup;
- m_aWidgets.back().m_nFlags |= 0x00008000;
+ m_aWidgets.back().m_nFlags |= 0x0000C000; // NoToggleToOff and Radio bits
createWidgetFieldName( sal_Int32(m_aWidgets.size()-1), rBtn );
}
diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index b7eb8e5f50bf..11971db34378 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -703,7 +703,7 @@ void PNGReaderImpl::ImplGetGrayPalette( sal_uInt16 nBitDepth )
nBitDepth = 8;
sal_uInt16 nPaletteEntryCount = 1 << nBitDepth;
- sal_uInt32 nAdd = 256 / (nPaletteEntryCount - 1);
+ sal_uInt32 nAdd = nBitDepth ? 256 / (nPaletteEntryCount - 1) : 0;
// no bitdepth==2 available
// but bitdepth==4 with two unused bits is close enough
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index de7cd2e139da..191f8f26dc75 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -36,6 +36,7 @@
#include "vcl/svids.hrc"
#include "vcl/metaact.hxx"
#include "vcl/msgbox.hxx"
+#include "vcl/configsettings.hxx"
#include "tools/urlobj.hxx"
@@ -171,13 +172,15 @@ public:
// set by user through printer config dialog
// if set, pages are centered and trimmed onto the fixed page
Size maFixedPageSize;
+ sal_Int32 mnDefaultPaperBin;
ImplPrinterControllerData() :
mbFirstPage( sal_True ),
mbLastPage( sal_False ),
mbReversePageOrder( sal_False ),
meJobState( view::PrintableState_JOB_STARTED ),
- mpProgress( NULL )
+ mpProgress( NULL ),
+ mnDefaultPaperBin( -1 )
{}
~ImplPrinterControllerData() { delete mpProgress; }
@@ -327,9 +330,25 @@ 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
if( ! pController->getPrinter() )
{
- boost::shared_ptr<Printer> pPrinter( new Printer( i_rInitSetup.GetPrinterName() ) );
+ 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 ) );
pController->setPrinter( pPrinter );
}
@@ -440,7 +459,12 @@ void Printer::ImplPrintJob( const boost::shared_ptr<PrinterController>& i_pContr
return;
}
pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LocalFileName" ) ),
- makeAny( aFile ) );
+ makeAny( aFile ) );
+ }
+ else if( aDlg.isSingleJobs() )
+ {
+ pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintCollateAsSingleJobs" ) ),
+ makeAny( sal_True ) );
}
}
catch( std::bad_alloc& )
@@ -501,6 +525,13 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl::
if ( !mpPrinter )
return FALSE;
+ sal_Bool bSinglePrintJobs = sal_False;
+ beans::PropertyValue* pSingleValue = i_pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintCollateAsSingleJobs" ) ) );
+ if( pSingleValue )
+ {
+ pSingleValue->Value >>= bSinglePrintJobs;
+ }
+
// remark: currently it is still possible to use EnablePrintFile and
// SetPrintFileName to redirect printout into file
// it can be argued that those methods should be removed in favor
@@ -514,6 +545,7 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl::
{
mbPrintFile = TRUE;
maPrintFile = aFile;
+ bSinglePrintJobs = sal_False;
}
}
@@ -561,49 +593,90 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl::
i_pController->setJobState( view::PrintableState_JOB_STARTED );
i_pController->jobStarted();
- if( mpPrinter->StartJob( pPrintFile,
- i_rJobName,
- Application::GetDisplayName(),
- nCopies,
- bCollateCopy,
- i_pController->isDirectPrint(),
- maJobSetup.ImplGetConstData() ) )
+ int nJobs = 1;
+ int nRepeatCount = bUserCopy ? mnCopyCount : 1;
+ if( bSinglePrintJobs )
{
- mbJobActive = TRUE;
- i_pController->createProgressDialog();
- int nPages = i_pController->getFilteredPageCount();
- int nRepeatCount = bUserCopy ? mnCopyCount : 1;
- for( int nIteration = 0; nIteration < nRepeatCount; nIteration++ )
+ nJobs = mnCopyCount;
+ nCopies = 1;
+ nRepeatCount = 1;
+ }
+
+ for( int nJobIteration = 0; nJobIteration < nJobs; nJobIteration++ )
+ {
+ bool bError = false;
+ if( mpPrinter->StartJob( pPrintFile,
+ i_rJobName,
+ Application::GetDisplayName(),
+ nCopies,
+ bCollateCopy,
+ i_pController->isDirectPrint(),
+ maJobSetup.ImplGetConstData() ) )
{
- for( int nPage = 0; nPage < nPages; nPage++ )
+ mbJobActive = TRUE;
+ i_pController->createProgressDialog();
+ int nPages = i_pController->getFilteredPageCount();
+ for( int nIteration = 0; nIteration < nRepeatCount; nIteration++ )
{
- if( nPage == nPages-1 && nIteration == nRepeatCount-1 )
- i_pController->setLastPage( sal_True );
- i_pController->printFilteredPage( nPage );
+ for( int nPage = 0; nPage < nPages; nPage++ )
+ {
+ if( nPage == nPages-1 && nIteration == nRepeatCount-1 && nJobIteration == nJobs-1 )
+ i_pController->setLastPage( sal_True );
+ i_pController->printFilteredPage( nPage );
+ }
+ // FIXME: duplex ?
+ }
+ EndJob();
+
+ if( nJobIteration < nJobs-1 )
+ {
+ mpPrinter = pSVData->mpDefInst->CreatePrinter( mpInfoPrinter );
+
+ if ( mpPrinter )
+ {
+ maJobName = i_rJobName;
+ mnCurPage = 1;
+ mnCurPrintPage = 1;
+ mbPrinting = TRUE;
+ }
+ else
+ bError = true;
}
- // FIXME: duplex ?
}
- EndJob();
+ else
+ bError = true;
- if( i_pController->getJobState() == view::PrintableState_JOB_STARTED )
- i_pController->setJobState( view::PrintableState_JOB_SPOOLED );
+ if( bError )
+ {
+ mnError = ImplSalPrinterErrorCodeToVCL( mpPrinter->GetErrorCode() );
+ if ( !mnError )
+ mnError = PRINTER_GENERALERROR;
+ i_pController->setJobState( mnError == PRINTER_ABORT
+ ? view::PrintableState_JOB_ABORTED
+ : view::PrintableState_JOB_FAILED );
+ if( mpPrinter )
+ pSVData->mpDefInst->DestroyPrinter( mpPrinter );
+ mnCurPage = 0;
+ mnCurPrintPage = 0;
+ mbPrinting = FALSE;
+ mpPrinter = NULL;
+
+ return false;
+ }
}
- else
- {
- mnError = ImplSalPrinterErrorCodeToVCL( mpPrinter->GetErrorCode() );
- if ( !mnError )
- mnError = PRINTER_GENERALERROR;
- i_pController->setJobState( mnError == PRINTER_ABORT
- ? view::PrintableState_JOB_ABORTED
- : view::PrintableState_JOB_FAILED );
- pSVData->mpDefInst->DestroyPrinter( mpPrinter );
- mnCurPage = 0;
- mnCurPrintPage = 0;
- mbPrinting = FALSE;
- mpPrinter = NULL;
- return false;
- }
+ if( i_pController->getJobState() == view::PrintableState_JOB_STARTED )
+ i_pController->setJobState( view::PrintableState_JOB_SPOOLED );
+ }
+
+ // make last used printer persistent for UI jobs
+ if( i_pController->isShowDialogs() && ! i_pController->isDirectPrint() )
+ {
+ SettingsConfigItem* pItem = SettingsConfigItem::get();
+ pItem->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LastPrinterUsed" ) ),
+ GetName()
+ );
}
return true;
@@ -634,6 +707,7 @@ void PrinterController::setPrinter( const boost::shared_ptr<Printer>& i_rPrinter
mpImplData->mpPrinter = i_rPrinter;
setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ),
makeAny( rtl::OUString( i_rPrinter->GetName() ) ) );
+ mpImplData->mnDefaultPaperBin = mpImplData->mpPrinter->GetPaperBin();
}
bool PrinterController::setupPrinter( Window* i_pParent )
@@ -668,27 +742,55 @@ PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( cons
{
PrinterController::PageSize aPageSize;
aPageSize.aSize = mpPrinter->GetPaperSize();
+ awt::Size aSetSize, aIsSize;
+ sal_Int32 nPaperBin = mnDefaultPaperBin;
for( sal_Int32 nProperty = 0, nPropertyCount = i_rProps.getLength(); nProperty < nPropertyCount; ++nProperty )
{
- if( i_rProps[ nProperty ].Name.equalsAscii( "PageSize" ) )
+ if( i_rProps[ nProperty ].Name.equalsAscii( "PreferredPageSize" ) )
{
- awt::Size aSize;
- i_rProps[ nProperty].Value >>= aSize;
- aPageSize.aSize.Width() = aSize.Width;
- aPageSize.aSize.Height() = aSize.Height;
-
- Size aCurSize( mpPrinter->GetPaperSize() );
- Size aRealPaperSize( getRealPaperSize( aPageSize.aSize ) );
- if( aRealPaperSize != aCurSize )
- mpPrinter->SetPaperSizeUser( aRealPaperSize, ! isFixedPageSize() );
+ i_rProps[ nProperty ].Value >>= aSetSize;
}
- if( i_rProps[ nProperty ].Name.equalsAscii( "PageIncludesNonprintableArea" ) )
+ else if( i_rProps[ nProperty ].Name.equalsAscii( "PageSize" ) )
+ {
+ i_rProps[ nProperty ].Value >>= aIsSize;
+ }
+ else if( i_rProps[ nProperty ].Name.equalsAscii( "PageIncludesNonprintableArea" ) )
{
sal_Bool bVal = sal_False;
- i_rProps[ nProperty].Value >>= bVal;
+ i_rProps[ nProperty ].Value >>= bVal;
aPageSize.bFullPaper = static_cast<bool>(bVal);
}
+ else if( i_rProps[ nProperty ].Name.equalsAscii( "PrinterPaperTray" ) )
+ {
+ sal_Int32 nBin = -1;
+ i_rProps[ nProperty ].Value >>= nBin;
+ if( nBin >= 0 && nBin < mpPrinter->GetPaperBinCount() )
+ nPaperBin = nBin;
+ }
+ }
+
+ Size aCurSize( mpPrinter->GetPaperSize() );
+ if( aSetSize.Width && aSetSize.Height )
+ {
+ Size aSetPaperSize( aSetSize.Width, aSetSize.Height );
+ Size aRealPaperSize( getRealPaperSize( aSetPaperSize ) );
+ if( aRealPaperSize != aCurSize )
+ aIsSize = aSetSize;
}
+
+ if( aIsSize.Width && aIsSize.Height )
+ {
+ aPageSize.aSize.Width() = aIsSize.Width;
+ aPageSize.aSize.Height() = aIsSize.Height;
+
+ Size aRealPaperSize( getRealPaperSize( aPageSize.aSize ) );
+ if( aRealPaperSize != aCurSize )
+ mpPrinter->SetPaperSizeUser( aRealPaperSize, ! isFixedPageSize() );
+ }
+
+ if( nPaperBin != -1 && nPaperBin != mpPrinter->GetPaperBin() )
+ mpPrinter->SetPaperBin( nPaperBin );
+
return aPageSize;
}
@@ -1393,6 +1495,8 @@ void PrinterController::createProgressDialog()
mpImplData->mpProgress->Show();
}
}
+ else
+ mpImplData->mpProgress->reset();
}
void PrinterController::setMultipage( const MultiPageSetup& i_rMPS )
diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx
index 55d6f7bdd892..7a6808a0e392 100644
--- a/vcl/source/gdi/salgdilayout.cxx
+++ b/vcl/source/gdi/salgdilayout.cxx
@@ -405,6 +405,7 @@ void SalGraphics::DrawRect( long nX, long nY, long nWidth, long nHeight, cons
}
bool SalGraphics::drawPolyLine(
const basegfx::B2DPolygon& /*rPolyPolygon*/,
+ double /*fTransparency*/,
const basegfx::B2DVector& /*rLineWidths*/,
basegfx::B2DLineJoin /*eLineJoin*/)
{
@@ -536,7 +537,7 @@ sal_Bool SalGraphics::DrawPolyPolygonBezier( sal_uInt32 i_nPoly, const sal_uInt3
return bRet;
}
-bool SalGraphics::DrawPolyLine( const ::basegfx::B2DPolygon& i_rPolygon,
+bool SalGraphics::DrawPolyLine( const ::basegfx::B2DPolygon& i_rPolygon, double fTransparency,
const ::basegfx::B2DVector& i_rLineWidth, basegfx::B2DLineJoin i_eLineJoin,
const OutputDevice* i_pOutDev )
{
@@ -544,10 +545,10 @@ bool SalGraphics::DrawPolyLine( const ::basegfx::B2DPolygon& i_rPolygon,
if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) )
{
basegfx::B2DPolygon aMirror( mirror( i_rPolygon, i_pOutDev ) );
- bRet = drawPolyLine( aMirror, i_rLineWidth, i_eLineJoin );
+ bRet = drawPolyLine( aMirror, fTransparency, i_rLineWidth, i_eLineJoin );
}
else
- bRet = drawPolyLine( i_rPolygon, i_rLineWidth, i_eLineJoin );
+ bRet = drawPolyLine( i_rPolygon, fTransparency, i_rLineWidth, i_eLineJoin );
return bRet;
}
@@ -669,7 +670,7 @@ BOOL SalGraphics::DrawEPS( long nX, long nY, long nWidth, long nHeight, void*
}
BOOL SalGraphics::HitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside, const OutputDevice *pOutDev )
+ const Point& aPos, BOOL& rIsInside, const OutputDevice *pOutDev )
{
if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) )
{
@@ -677,10 +678,10 @@ BOOL SalGraphics::HitTestNativeControl( ControlType nType, ControlPart nPart, co
Region rgn( rControlRegion );
mirror( pt.X(), pOutDev );
mirror( rgn, pOutDev );
- return hitTestNativeControl( nType, nPart, rgn, pt, rControlHandle, rIsInside );
+ return hitTestNativeControl( nType, nPart, rgn, pt, rIsInside );
}
else
- return hitTestNativeControl( nType, nPart, rControlRegion, aPos, rControlHandle, rIsInside );
+ return hitTestNativeControl( nType, nPart, rControlRegion, aPos, rIsInside );
}
void SalGraphics::mirror( ControlType nType, const ImplControlValue& rVal, const OutputDevice* pOutDev, bool bBack ) const
@@ -722,7 +723,7 @@ void SalGraphics::mirror( ControlType nType, const ImplControlValue& rVal, const
}
BOOL SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ ControlState nState, const ImplControlValue& aValue,
const OUString& aCaption, const OutputDevice *pOutDev )
{
if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) )
@@ -730,33 +731,33 @@ BOOL SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const
Region rgn( rControlRegion );
mirror( rgn, pOutDev );
mirror( nType, aValue, pOutDev );
- BOOL bRet = drawNativeControl( nType, nPart, rgn, nState, aValue, rControlHandle, aCaption );
+ BOOL bRet = drawNativeControl( nType, nPart, rgn, nState, aValue, aCaption );
mirror( nType, aValue, pOutDev, true );
return bRet;
}
else
- return drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rControlHandle, aCaption );
+ return drawNativeControl( nType, nPart, rControlRegion, nState, aValue, aCaption );
}
BOOL SalGraphics::DrawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& aCaption, const OutputDevice *pOutDev )
+ const OUString& aCaption, const OutputDevice *pOutDev )
{
if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) )
{
Region rgn( rControlRegion );
mirror( rgn, pOutDev );
mirror( nType, aValue, pOutDev );
- BOOL bRet = drawNativeControlText( nType, nPart, rgn, nState, aValue, rControlHandle, aCaption );
+ BOOL bRet = drawNativeControlText( nType, nPart, rgn, nState, aValue, aCaption );
mirror( nType, aValue, pOutDev, true );
return bRet;
}
else
- return drawNativeControlText( nType, nPart, rControlRegion, nState, aValue, rControlHandle, aCaption );
+ return drawNativeControlText( nType, nPart, rControlRegion, nState, aValue, aCaption );
}
BOOL SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& aCaption,
+ const ImplControlValue& aValue, const OUString& aCaption,
Region &rNativeBoundingRegion, Region &rNativeContentRegion, const OutputDevice *pOutDev )
{
if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) )
@@ -764,7 +765,7 @@ BOOL SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart,
Region rgn( rControlRegion );
mirror( rgn, pOutDev );
mirror( nType, aValue, pOutDev );
- if( getNativeControlRegion( nType, nPart, rgn, nState, aValue, rControlHandle, aCaption,
+ if( getNativeControlRegion( nType, nPart, rgn, nState, aValue, aCaption,
rNativeBoundingRegion, rNativeContentRegion ) )
{
mirror( rNativeBoundingRegion, pOutDev, true );
@@ -779,7 +780,7 @@ BOOL SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart,
}
}
else
- return getNativeControlRegion( nType, nPart, rControlRegion, nState, aValue, rControlHandle, aCaption,
+ return getNativeControlRegion( nType, nPart, rControlRegion, nState, aValue, aCaption,
rNativeBoundingRegion, rNativeContentRegion );
}
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index bf462d1d8add..5e187944c706 100755
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -133,20 +133,21 @@ int GetVerticalFlags( sal_UCS4 nChar )
/* #i52932# remember:
nChar == 0x2010 || nChar == 0x2015
nChar == 0x2016 || nChar == 0x2026
- are GF_NONE also, but already handled in the first if
+ are GF_NONE also, but already handled in the outer if condition
*/
if((nChar >= 0x3008 && nChar <= 0x301C && nChar != 0x3012)
|| (nChar == 0xFF3B || nChar == 0xFF3D)
|| (nChar >= 0xFF5B && nChar <= 0xFF9F) // halfwidth forms
- || (nChar == 0xFFE3)
- || (nChar >= 0x02F800 && nChar <= 0x02FFFF) )
+ || (nChar == 0xFFE3) )
return GF_NONE; // not rotated
else if( nChar == 0x30fc )
return GF_ROTR; // right
return GF_ROTL; // left
}
+ else if( (nChar >= 0x20000) && (nChar <= 0x3FFFF) ) // all SIP/TIP ideographs
+ return GF_ROTL; // left
- return GF_NONE;
+ return GF_NONE; // not rotated as default
}
// -----------------------------------------------------------------------
@@ -1800,8 +1801,8 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
int nRunStart, nRunEnd;
while (rArgs.GetNextRun(&nRunStart, &nRunEnd, &bRtl))
{
- if (bRtl) std::fill(vRtl.begin() + nRunStart - rArgs.mnMinCharPos,
- vRtl.begin() + nRunEnd - rArgs.mnMinCharPos, true);
+ if (bRtl) std::fill(vRtl.begin() + (nRunStart - rArgs.mnMinCharPos),
+ vRtl.begin() + (nRunEnd - rArgs.mnMinCharPos), true);
}
rArgs.ResetPos();
diff --git a/vcl/source/gdi/salnativewidgets-none.cxx b/vcl/source/gdi/salnativewidgets-none.cxx
index 8b87f142ba25..7faf12d062fe 100644
--- a/vcl/source/gdi/salnativewidgets-none.cxx
+++ b/vcl/source/gdi/salnativewidgets-none.cxx
@@ -60,7 +60,6 @@ BOOL SalGraphics::hitTestNativeControl( ControlType,
ControlPart,
const Region&,
const Point&,
- SalControlHandle&,
BOOL& )
{
return( FALSE );
@@ -74,7 +73,6 @@ BOOL SalGraphics::hitTestNativeControl( ControlType,
*
* rControlRegion: The bounding region of the complete control in VCL frame coordinates.
* aValue: An optional value (tristate/numerical/string)
- * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation.
* aCaption: A caption or title string (like button text etc)
*/
BOOL SalGraphics::drawNativeControl( ControlType,
@@ -82,7 +80,6 @@ BOOL SalGraphics::drawNativeControl( ControlType,
const Region&,
ControlState,
const ImplControlValue&,
- SalControlHandle&,
const OUString& )
{
return( FALSE );
@@ -97,7 +94,6 @@ BOOL SalGraphics::drawNativeControl( ControlType,
*
* rControlRegion: The bounding region of the complete control in VCL frame coordinates.
* aValue: An optional value (tristate/numerical/string)
- * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation.
* aCaption: A caption or title string (like button text etc)
*/
BOOL SalGraphics::drawNativeControlText( ControlType,
@@ -105,7 +101,6 @@ BOOL SalGraphics::drawNativeControlText( ControlType,
const Region&,
ControlState,
const ImplControlValue&,
- SalControlHandle&,
const OUString& )
{
return( FALSE );
@@ -123,7 +118,6 @@ BOOL SalGraphics::drawNativeControlText( ControlType,
*
* rControlRegion: The bounding region of the control in VCL frame coordinates.
* aValue: An optional value (tristate/numerical/string)
- * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation.
* aCaption: A caption or title string (like button text etc)
*/
BOOL SalGraphics::getNativeControlRegion( ControlType,
@@ -131,7 +125,6 @@ BOOL SalGraphics::getNativeControlRegion( ControlType,
const Region&,
ControlState,
const ImplControlValue&,
- SalControlHandle&,
const OUString&,
Region &,
Region & )
diff --git a/vcl/source/glyphs/glyphcache.cxx b/vcl/source/glyphs/glyphcache.cxx
index ea0f18896b7a..1953ecf553c4 100644
--- a/vcl/source/glyphs/glyphcache.cxx
+++ b/vcl/source/glyphs/glyphcache.cxx
@@ -519,8 +519,10 @@ bool ServerFont::IsGlyphInvisible( int nGlyphIndex )
// =======================================================================
ImplServerFontEntry::ImplServerFontEntry( ImplFontSelectData& rFSD )
-: ImplFontEntry( rFSD ),
- mpServerFont( NULL )
+: ImplFontEntry( rFSD )
+, mpServerFont( NULL )
+, mbGotFontOptions( false )
+, mbValidFontOptions( false )
{}
// -----------------------------------------------------------------------
diff --git a/vcl/source/glyphs/graphite_adaptors.cxx b/vcl/source/glyphs/graphite_adaptors.cxx
index 4afced765612..f66f5b48e39e 100644
--- a/vcl/source/glyphs/graphite_adaptors.cxx
+++ b/vcl/source/glyphs/graphite_adaptors.cxx
@@ -168,7 +168,7 @@ GraphiteFontAdaptor::~GraphiteFontAdaptor() throw()
mpFeatures = NULL;
}
-void GraphiteFontAdaptor::UniqueCacheInfo(sil_std::wstring & face_name_out, bool & bold_out, bool & italic_out)
+void GraphiteFontAdaptor::UniqueCacheInfo(ext_std::wstring & face_name_out, bool & bold_out, bool & italic_out)
{
face_name_out = maFontProperties.szFaceName;
bold_out = maFontProperties.fBold;
diff --git a/vcl/source/glyphs/graphite_cache.cxx b/vcl/source/glyphs/graphite_cache.cxx
index 713f3c1ed088..64bbb0a38d60 100644
--- a/vcl/source/glyphs/graphite_cache.cxx
+++ b/vcl/source/glyphs/graphite_cache.cxx
@@ -36,10 +36,10 @@
#include <tools/debug.hxx>
#include <vcl/sallayout.hxx>
-#include "pregraphitestl.h"
+#include <tools/preextstl.h>
#include <graphite/GrClient.h>
#include <graphite/Segment.h>
-#include "postgraphitestl.h"
+#include <tools/postextstl.h>
#include <rtl/ustring.hxx>
#include <vcl/graphite_layout.hxx>
diff --git a/vcl/source/glyphs/graphite_features.cxx b/vcl/source/glyphs/graphite_features.cxx
index bae96642da30..1cb25306c4ee 100644
--- a/vcl/source/glyphs/graphite_features.cxx
+++ b/vcl/source/glyphs/graphite_features.cxx
@@ -88,7 +88,7 @@ GrFeatureParser::GrFeatureParser(gr::Font & font, const std::string features, co
gr::isocode aLang = maLang;
for (size_t i = pos; i < nFeatEnd; i++)
aLang.rgch[i-pos] = features[i];
- sil_std::pair<gr::LanguageIterator,gr::LanguageIterator> aSupported
+ ext_std::pair<gr::LanguageIterator,gr::LanguageIterator> aSupported
= font.getSupportedLanguages();
gr::LanguageIterator iL = aSupported.first;
while (iL != aSupported.second)
@@ -139,7 +139,7 @@ void GrFeatureParser::setLang(gr::Font & font, const std::string & lang)
if (lang[i] == '-') break;
aLang.rgch[i] = lang[i];
}
- sil_std::pair<gr::LanguageIterator,gr::LanguageIterator> aSupported
+ ext_std::pair<gr::LanguageIterator,gr::LanguageIterator> aSupported
= font.getSupportedLanguages();
gr::LanguageIterator iL = aSupported.first;
while (iL != aSupported.second)
@@ -186,7 +186,7 @@ bool GrFeatureParser::isValid(gr::Font & font, gr::FeatureSetting & setting)
{
return false;
}
- sil_std::pair< gr::FeatureSettingIterator, gr::FeatureSettingIterator >
+ ext_std::pair< gr::FeatureSettingIterator, gr::FeatureSettingIterator >
validValues = font.getFeatureSettings(i);
gr::FeatureSettingIterator j = validValues.first;
while (j != validValues.second)
diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx
index 25ea77dd07a3..ff2fd8f306b1 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -63,13 +63,13 @@
#include <unicode/uscript.h>
// Graphite Libraries (must be after vcl headers on windows)
-#include "pregraphitestl.h"
+#include <tools/preextstl.h>
#include <graphite/GrClient.h>
#include <graphite/Font.h>
#include <graphite/ITextSource.h>
#include <graphite/Segment.h>
#include <graphite/SegmentPainter.h>
-#include "postgraphitestl.h"
+#include <tools/postextstl.h>
#include <vcl/graphite_layout.hxx>
#include <vcl/graphite_features.hxx>
@@ -104,8 +104,8 @@ FILE * grLog()
namespace
{
- typedef sil_std::pair<gr::GlyphIterator, gr::GlyphIterator> glyph_range_t;
- typedef sil_std::pair<gr::GlyphSetIterator, gr::GlyphSetIterator> glyph_set_range_t;
+ typedef ext_std::pair<gr::GlyphIterator, gr::GlyphIterator> glyph_range_t;
+ typedef ext_std::pair<gr::GlyphSetIterator, gr::GlyphSetIterator> glyph_set_range_t;
inline long round(const float n) {
return long(n + (n < 0 ? -0.5 : 0.5));
@@ -170,7 +170,7 @@ GraphiteLayout::Glyphs::fill_from(gr::Segment & rSegment, ImplLayoutArgs &rArgs,
bool bRtl, long &rWidth, float fScaling, std::vector<int> & rChar2Base, std::vector<int> & rGlyph2Char, std::vector<int> & rCharDxs)
{
// Create a glyph item for each of the glyph and append it to the base class glyph list.
- typedef sil_std::pair< gr::GlyphSetIterator, gr::GlyphSetIterator > GrGlyphSet;
+ typedef ext_std::pair< gr::GlyphSetIterator, gr::GlyphSetIterator > GrGlyphSet;
int nChar = rArgs.mnEndCharPos - rArgs.mnMinCharPos;
glyph_range_t iGlyphs = rSegment.glyphs();
int nGlyphs = iGlyphs.second - iGlyphs.first;
@@ -353,6 +353,46 @@ std::pair<float,float> GraphiteLayout::Glyphs::appendCluster(gr::Segment & rSeg,
assert(size() < rGlyph2Char.size());
rChar2Base[nFirstCharInCluster-rArgs.mnMinCharPos] = size();
rGlyph2Char[size()] = nFirstCharInCluster;
+
+ // can we break before this cluster?
+ // Glyphs may have either a positive or negative breakWeight refering to
+ // the position after or before the glyph respectively
+ int nPrevBreakWeight = 0;
+ if (nFirstGlyphInCluster > 0)
+ {
+ nPrevBreakWeight = (iGlyphs.first + (nFirstGlyphInCluster - 1))->breakweight();
+ }
+ int nBreakWeight = aFirstGlyph.breakweight();
+ if (nBreakWeight < 0)
+ {
+ // negative means it applies to the position before the glyph's character
+ nBreakWeight *= -1;
+ if (nPrevBreakWeight > 0 && nPrevBreakWeight < nBreakWeight)
+ {
+ // prevBreakWeight wins
+ nBreakWeight = nPrevBreakWeight;
+ }
+ }
+ else
+ {
+ nBreakWeight = 0;
+ // positive means break after
+ if (nPrevBreakWeight > 0)
+ nBreakWeight = nPrevBreakWeight;
+ }
+ if (nBreakWeight > gr::klbNoBreak/*0*/ &&
+ // nBreakWeight <= gr::klbHyphenBreak) // uses Graphite hyphenation
+ nBreakWeight <= gr::klbLetterBreak) // Needed for issue 111272
+ {
+ if (nBreakWeight < gr::klbHyphenBreak)
+ rChar2Base[nFirstCharInCluster-rArgs.mnMinCharPos] |= WORD_BREAK_BEFORE;
+ else
+ rChar2Base[nFirstCharInCluster-rArgs.mnMinCharPos] |= HYPHEN_BREAK_BEFORE;
+ }
+ // always allow a break before a space even if graphite doesn't
+ if (rArgs.mpStr[nFirstCharInCluster] == 0x20)
+ rChar2Base[nFirstCharInCluster-rArgs.mnMinCharPos] |= WORD_BREAK_BEFORE;
+
bool bBaseGlyph = true;
for (int j = nFirstGlyphInCluster;
j != nNextGlyph; j += nDelta)
@@ -409,7 +449,7 @@ std::pair<float,float> GraphiteLayout::Glyphs::appendCluster(gr::Segment & rSeg,
}
}
#ifdef GRLAYOUT_DEBUG
- fprintf(grLog(),"Cluster g[%d-%d) c[%d-%d)%x x%ld y%f\n", nFirstGlyphInCluster, nNextGlyph, nFirstCharInCluster, nNextChar, rArgs.mpStr[nFirstCharInCluster], nXPos, aFirstGlyph.yOffset());
+ fprintf(grLog(),"Cluster g[%d-%d) c[%d-%d)%x x%ld y%f bw%d\n", nFirstGlyphInCluster, nNextGlyph, nFirstCharInCluster, nNextChar, rArgs.mpStr[nFirstCharInCluster], nXPos, aFirstGlyph.yOffset(), nBreakWeight);
#endif
return aBounds;
}
@@ -585,7 +625,7 @@ public:
sal_Int32 hashCode(const grutils::GrFeatureParser * mpFeatures)
{
// is this sufficient?
- sil_std::wstring aFace;
+ ext_std::wstring aFace;
bool bBold;
bool bItalic;
UniqueCacheInfo(aFace, bBold, bItalic);
@@ -641,6 +681,19 @@ gr::Segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs)
if (bRtl && (mrFont.getSupportedScriptDirections() & gr::kfsdcHorizRtl))
maLayout.setRightToLeft(bRtl);
+ // Context is often needed beyond the specified end, however, we don't
+ // want it if there has been a direction change, since it is hard
+ // to tell between reordering within one direction and multi-directional
+ // text. Extra context, can also cause problems with ligatures stradling
+ // a hyphenation point, so disable if CTL is disabled.
+ const int nSegCharLimit = min(rArgs.mnLength, mnEndCharPos + EXTRA_CONTEXT_LENGTH);
+ int limit = rArgs.mnEndCharPos;
+ if ((nSegCharLimit > limit) && !(SAL_LAYOUT_COMPLEX_DISABLED & rArgs.mnFlags))
+ {
+ limit += findSameDirLimit(rArgs.mpStr + rArgs.mnEndCharPos,
+ nSegCharLimit - rArgs.mnEndCharPos, bRtl);
+ }
+
#ifdef GRCACHE
GrFontHasher hasher(mrFont);
sal_Int32 aFontHash = hasher.hashCode(mpFeatures);
@@ -648,7 +701,7 @@ gr::Segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs)
(GraphiteCacheHandler::instance).getCache(aFontHash);
if (pCache)
{
- *pSegRecord = pCache->getSegment(rArgs, bRtl);
+ *pSegRecord = pCache->getSegment(rArgs, bRtl, nSegCharLimit);
if (*pSegRecord)
{
pSegment = (*pSegRecord)->getSegment();
@@ -667,18 +720,6 @@ gr::Segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs)
}
#endif
- // Context is often needed beyond the specified end, however, we don't
- // want it if there has been a direction change, since it is hard
- // to tell between reordering within one direction and multi-directional
- // text.
- const int segCharLimit = min(rArgs.mnLength, mnEndCharPos + EXTRA_CONTEXT_LENGTH);
- int limit = rArgs.mnEndCharPos;
- if (segCharLimit > limit)
- {
- limit += findSameDirLimit(rArgs.mpStr + rArgs.mnEndCharPos,
- segCharLimit - rArgs.mnEndCharPos, bRtl);
- }
-
// Create a new TextSource object for the engine.
mpTextSrc = new TextSourceAdaptor(rArgs, limit);
if (mpFeatures) mpTextSrc->setFeatures(mpFeatures);
@@ -795,27 +836,35 @@ bool GraphiteLayout::LayoutGlyphs(ImplLayoutArgs& rArgs, gr::Segment * pSegment)
int GraphiteLayout::GetTextBreak(long maxmnWidth, long char_extra, int factor) const
{
- // Adjust maxmnWidth so FindNextBreakPoint returns a sensible answer.
- maxmnWidth -= (mnEndCharPos-mnMinCharPos-1)*char_extra; // extra character spacing.
- maxmnWidth /= factor; // scaling factor.
+#ifdef GRLAYOUT_DEBUG
+ fprintf(grLog(),"Gr::GetTextBreak c[%d-%d) maxWidth %ld char extra %ld factor %d\n",
+ mnMinCharPos, mnEndCharPos, maxmnWidth, char_extra, factor);
+#endif
- // Ask the segment for the nearest whole letter break for the width.
- //float width;
- float targetWidth = maxmnWidth/mfScaling;
// return quickly if this segment is narrower than the target width
- // (sometimes graphite doesn't seem to realise this!)
- if (targetWidth > mnWidth)
+ if (maxmnWidth > mnWidth * factor + char_extra * (mnEndCharPos - mnMinCharPos - 1))
return STRING_LEN;
- //int nBreak = mpSegment->findNextBreakPoint(mnMinCharPos,
- // gr::klbWordBreak, gr::klbLetterBreak, targetWidth, &width);
- // LineFillSegment seems to give better results that findNextBreakPoint
- // though it may be slower
- gr::LayoutEnvironment aLE;
- gr::LineFillSegment lineSeg(const_cast<gr::Font *>(&mrFont), mpTextSrc, &aLE,
- mnMinCharPos, mpTextSrc->getContextLength(),
- targetWidth);
- int nBreak = lineSeg.stopCharacter();
+ long nWidth = mvCharDxs[0] * factor;
+ int nLastBreak = -1;
+ for (size_t i = 1; i < mvCharDxs.size(); i++)
+ {
+ nWidth += char_extra;
+ if (nWidth > maxmnWidth) break;
+ if (mvChar2BaseGlyph[i] != -1)
+ {
+ if (mvChar2BaseGlyph[i] & (WORD_BREAK_BEFORE | HYPHEN_BREAK_BEFORE))
+ nLastBreak = static_cast<int>(i);
+ }
+ nWidth += (mvCharDxs[i] - mvCharDxs[i-1]) * factor;
+ }
+ int nBreak = mnMinCharPos;
+ if (nLastBreak > -1)
+ nBreak += nLastBreak;
+
+#ifdef GRLAYOUT_DEBUG
+ fprintf(grLog(), "Gr::GetTextBreak break after %d\n", nBreak - mnMinCharPos);
+#endif
if (nBreak > mnEndCharPos) nBreak = STRING_LEN;
else if (nBreak < mnMinCharPos) nBreak = mnMinCharPos;
@@ -833,9 +882,10 @@ long GraphiteLayout::FillDXArray( sal_Int32* pDXArray ) const
{
for (size_t i = 0; i < mvCharDxs.size(); i++)
{
- assert((mvChar2BaseGlyph[i] >= -1) && (mvChar2BaseGlyph[i] < (signed)mvGlyphs.size()));
+ assert( (mvChar2BaseGlyph[i] == -1) ||
+ ((signed)(mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK) < (signed)mvGlyphs.size()));
if (mvChar2BaseGlyph[i] != -1 &&
- mvGlyphs[mvChar2BaseGlyph[i]].mnGlyphIndex == GF_DROPPED)
+ mvGlyphs[mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK].mnGlyphIndex == GF_DROPPED)
{
// when used in MultiSalLayout::GetTextBreak dropped glyphs
// must have zero width
@@ -865,7 +915,6 @@ long GraphiteLayout::FillDXArray( sal_Int32* pDXArray ) const
void GraphiteLayout::AdjustLayout(ImplLayoutArgs& rArgs)
{
SalLayout::AdjustLayout(rArgs);
-
if(rArgs.mpDXArray)
{
std::vector<int> vDeltaWidths(mvGlyphs.size(), 0);
@@ -894,8 +943,75 @@ void GraphiteLayout::AdjustLayout(ImplLayoutArgs& rArgs)
}
}
}
+ else if (rArgs.mnLayoutWidth > 0)
+ {
+#ifdef GRLAYOUT_DEBUG
+ fprintf(grLog(), "AdjustLayout width %ld=>%ld\n", mnWidth, rArgs.mnLayoutWidth);
+#endif
+ expandOrCondense(rArgs);
+ }
}
+void GraphiteLayout::expandOrCondense(ImplLayoutArgs &rArgs)
+{
+ int nDeltaWidth = rArgs.mnLayoutWidth - mnWidth;
+ if (nDeltaWidth > 0) // expand, just expand between clusters
+ {
+ int nClusterCount = 0;
+ for (size_t j = 0; j < mvGlyphs.size(); j++)
+ {
+ if (mvGlyphs[j].IsClusterStart())
+ {
+ ++nClusterCount;
+ }
+ }
+ if (nClusterCount > 1)
+ {
+ float fExtraPerCluster = static_cast<float>(nDeltaWidth) / static_cast<float>(nClusterCount - 1);
+ int nCluster = 0;
+ int nOffset = 0;
+ for (size_t i = 0; i < mvGlyphs.size(); i++)
+ {
+ if (mvGlyphs[i].IsClusterStart())
+ {
+ nOffset = fExtraPerCluster * nCluster;
+ size_t nCharIndex = mvGlyph2Char[i];
+ mvCharDxs[nCharIndex] += nOffset;
+ // adjust char dxs for rest of characters in cluster
+ while (++nCharIndex < mvGlyph2Char.size())
+ {
+ int nChar2Base = (mvChar2BaseGlyph[nCharIndex] == -1)? -1 : mvChar2BaseGlyph[nCharIndex] & GLYPH_INDEX_MASK;
+ if (nChar2Base == -1 || nChar2Base == static_cast<int>(i))
+ mvCharDxs[nCharIndex] += nOffset;
+ }
+ ++nCluster;
+ }
+ mvGlyphs[i].maLinearPos.X() += nOffset;
+ }
+ }
+ }
+ else // condense - apply a factor to all glyph positions
+ {
+ if (mvGlyphs.size() == 0) return;
+ Glyphs::iterator iLastGlyph = mvGlyphs.begin() + (mvGlyphs.size() - 1);
+ // position last glyph using original width
+ float fXFactor = static_cast<float>(rArgs.mnLayoutWidth - iLastGlyph->mnOrigWidth) / static_cast<float>(iLastGlyph->maLinearPos.X());
+#ifdef GRLAYOUT_DEBUG
+ fprintf(grLog(), "Condense by factor %f\n", fXFactor);
+#endif
+ iLastGlyph->maLinearPos.X() = rArgs.mnLayoutWidth - iLastGlyph->mnOrigWidth;
+ Glyphs::iterator iGlyph = mvGlyphs.begin();
+ while (iGlyph != iLastGlyph)
+ {
+ iGlyph->maLinearPos.X() = static_cast<float>(iGlyph->maLinearPos.X()) * fXFactor;
+ ++iGlyph;
+ }
+ for (size_t i = 0; i < mvCharDxs.size(); i++)
+ {
+ mvCharDxs[i] = fXFactor * static_cast<float>(mvCharDxs[i]);
+ }
+ }
+}
void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDeltaWidth)
{
@@ -917,37 +1033,39 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt
int nPrevClusterLastChar = -1;
for (size_t i = 0; i < nChars; i++)
{
- if (mvChar2BaseGlyph[i] > -1 && mvChar2BaseGlyph[i] != nPrevClusterGlyph)
+ int nChar2Base = (mvChar2BaseGlyph[i] == -1)? -1 : mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK;
+ if ((nChar2Base > -1) && (nChar2Base != nPrevClusterGlyph))
{
- assert((mvChar2BaseGlyph[i] > -1) && (mvChar2BaseGlyph[i] < (signed)mvGlyphs.size()));
- GlyphItem & gi = mvGlyphs[mvChar2BaseGlyph[i]];
+ assert((nChar2Base > -1) && (nChar2Base < (signed)mvGlyphs.size()));
+ GlyphItem & gi = mvGlyphs[nChar2Base];
if (!gi.IsClusterStart())
continue;
// find last glyph of this cluster
size_t j = i + 1;
int nLastChar = i;
- int nLastGlyph = mvChar2BaseGlyph[i];
+ int nLastGlyph = nChar2Base;
for (; j < nChars; j++)
{
- assert((mvChar2BaseGlyph[j] >= -1) && (mvChar2BaseGlyph[j] < (signed)mvGlyphs.size()));
- if (mvChar2BaseGlyph[j] != -1 && mvGlyphs[mvChar2BaseGlyph[j]].IsClusterStart())
+ int nChar2BaseJ = (mvChar2BaseGlyph[j] == -1)? -1 : mvChar2BaseGlyph[j] & GLYPH_INDEX_MASK;
+ assert((nChar2BaseJ >= -1) && (nChar2BaseJ < (signed)mvGlyphs.size()));
+ if (nChar2BaseJ != -1 && mvGlyphs[nChar2BaseJ].IsClusterStart())
{
- nLastGlyph = mvChar2BaseGlyph[j] + ((bRtl)? 1 : -1);
+ nLastGlyph = nChar2BaseJ + ((bRtl)? 1 : -1);
nLastChar = j - 1;
break;
}
}
if (nLastGlyph < 0)
{
- nLastGlyph = mvChar2BaseGlyph[i];
+ nLastGlyph = nChar2Base;
}
// Its harder to find the last glyph rtl, since the first of
// cluster is still on the left so we need to search towards
// the previous cluster to the right
if (bRtl)
{
- nLastGlyph = mvChar2BaseGlyph[i];
+ nLastGlyph = nChar2Base;
while (nLastGlyph + 1 < (signed)mvGlyphs.size() &&
!mvGlyphs[nLastGlyph+1].IsClusterStart())
{
@@ -983,7 +1101,7 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt
// update glyph positions
if (bRtl)
{
- for (int n = mvChar2BaseGlyph[i]; n <= nLastGlyph; n++)
+ for (int n = nChar2Base; n <= nLastGlyph; n++)
{
assert((n > - 1) && (n < (signed)mvGlyphs.size()));
mvGlyphs[n].maLinearPos.X() += -nDGlyphOrigin + nXOffset;
@@ -991,17 +1109,17 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt
}
else
{
- for (int n = mvChar2BaseGlyph[i]; n <= nLastGlyph; n++)
+ for (int n = nChar2Base; n <= nLastGlyph; n++)
{
assert((n > - 1) && (n < (signed)mvGlyphs.size()));
mvGlyphs[n].maLinearPos.X() += nDGlyphOrigin + nXOffset;
}
}
- rDeltaWidth[mvChar2BaseGlyph[i]] = nDWidth;
+ rDeltaWidth[nChar2Base] = nDWidth;
#ifdef GRLAYOUT_DEBUG
- fprintf(grLog(),"c%d g%d-%d dW%ld-%ld=%ld dX%ld x%ld\t", (int)i, mvChar2BaseGlyph[i], nLastGlyph, nNewClusterWidth, nOrigClusterWidth, nDWidth, nDGlyphOrigin, mvGlyphs[mvChar2BaseGlyph[i]].maLinearPos.X());
+ fprintf(grLog(),"c%d g%d-%d dW%ld-%ld=%ld dX%ld x%ld\t", (int)i, nChar2Base, nLastGlyph, nNewClusterWidth, nOrigClusterWidth, nDWidth, nDGlyphOrigin, mvGlyphs[nChar2Base].maLinearPos.X());
#endif
- nPrevClusterGlyph = mvChar2BaseGlyph[i];
+ nPrevClusterGlyph = nChar2Base;
nPrevClusterLastChar = nLastChar;
i = nLastChar;
}
@@ -1043,7 +1161,7 @@ void GraphiteLayout::kashidaJustify(std::vector<int>& rDeltaWidths, sal_GlyphId
continue;
}
// calculate gap, ignore if too small
- int nGapWidth = rDeltaWidths[nOrigGlyphIndex];;
+ int nGapWidth = rDeltaWidths[nOrigGlyphIndex];
// worst case is one kashida even for mini-gaps
if( 3 * nGapWidth < nKashidaWidth )
{
@@ -1104,13 +1222,14 @@ void GraphiteLayout::GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray
{
if (mvChar2BaseGlyph[nCharSlot] != -1)
{
- assert((mvChar2BaseGlyph[nCharSlot] > -1) && (mvChar2BaseGlyph[nCharSlot] < (signed)mvGlyphs.size()));
- GlyphItem gi = mvGlyphs[mvChar2BaseGlyph[nCharSlot]];
+ int nChar2Base = mvChar2BaseGlyph[nCharSlot] & GLYPH_INDEX_MASK;
+ assert((mvChar2BaseGlyph[nCharSlot] > -1) && (nChar2Base < (signed)mvGlyphs.size()));
+ GlyphItem gi = mvGlyphs[nChar2Base];
if (gi.mnGlyphIndex == GF_DROPPED)
{
continue;
}
- int nCluster = mvChar2BaseGlyph[nCharSlot];
+ int nCluster = nChar2Base;
long origClusterWidth = gi.mnNewWidth;
long nMin = gi.maLinearPos.X();
long nMax = gi.maLinearPos.X() + gi.mnNewWidth;
@@ -1135,7 +1254,7 @@ void GraphiteLayout::GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray
pCaretXArray[i] = nMin;
pCaretXArray[i+1] = nMax;
}
- prevBase = mvChar2BaseGlyph[nCharSlot];
+ prevBase = nChar2Base;
prevClusterWidth = origClusterWidth;
}
else if (prevBase > -1)
@@ -1268,7 +1387,7 @@ int GraphiteLayout::GetNextGlyphs( int length, sal_GlyphId * glyph_out,
#ifdef GRLAYOUT_DEBUG
fprintf(grLog(),"GetNextGlyphs g%d c%d x%ld,%ld adv%ld, pos %ld,%ld\n", glyph_slot - 1,
- mvGlyph2Char[glyph_slot-1], glyph_itr->maLinearPos.X(), glyph_itr->maLinearPos.Y(), nGlyphAdvance,
+ GLYPH_INDEX_MASK&mvGlyph2Char[glyph_slot-1], glyph_itr->maLinearPos.X(), glyph_itr->maLinearPos.Y(), nGlyphAdvance,
aPosOut.X(), aPosOut.Y());
#endif
diff --git a/vcl/source/glyphs/graphite_textsrc.cxx b/vcl/source/glyphs/graphite_textsrc.cxx
index d7547662e065..5764ba9454c9 100644
--- a/vcl/source/glyphs/graphite_textsrc.cxx
+++ b/vcl/source/glyphs/graphite_textsrc.cxx
@@ -135,16 +135,16 @@ gr::isocode TextSourceAdaptor::getLanguage(gr::toffset)
return unknown;
}
-sil_std::pair<gr::toffset, gr::toffset> TextSourceAdaptor::propertyRange(gr::toffset nCharIdx)
+ext_std::pair<gr::toffset, gr::toffset> TextSourceAdaptor::propertyRange(gr::toffset nCharIdx)
{
if (nCharIdx < unsigned(maLayoutArgs.mnMinCharPos))
- return sil_std::make_pair(0, maLayoutArgs.mnMinCharPos);
+ return ext_std::make_pair(0, maLayoutArgs.mnMinCharPos);
if (nCharIdx < mnEnd)
- return sil_std::make_pair(maLayoutArgs.mnMinCharPos, mnEnd);
+ return ext_std::make_pair(maLayoutArgs.mnMinCharPos, mnEnd);
- return sil_std::make_pair(mnEnd, maLayoutArgs.mnLength);
+ return ext_std::make_pair(mnEnd, maLayoutArgs.mnLength);
}
size_t TextSourceAdaptor::getFontFeatures(gr::toffset, gr::FeatureSetting * settings)
@@ -156,7 +156,7 @@ size_t TextSourceAdaptor::getFontFeatures(gr::toffset, gr::FeatureSetting * sett
bool TextSourceAdaptor::sameSegment(gr::toffset char_idx1, gr::toffset char_idx2)
{
- const sil_std::pair<gr::toffset, gr::toffset>
+ const ext_std::pair<gr::toffset, gr::toffset>
range1 = propertyRange(char_idx1),
range2 = propertyRange(char_idx2);
diff --git a/vcl/source/glyphs/graphite_textsrc.hxx b/vcl/source/glyphs/graphite_textsrc.hxx
index 2397d6a5f701..2b9c705a5ea7 100644
--- a/vcl/source/glyphs/graphite_textsrc.hxx
+++ b/vcl/source/glyphs/graphite_textsrc.hxx
@@ -59,11 +59,11 @@
#include "vcl/dllapi.h"
// Libraries
-#include "pregraphitestl.h"
+#include <tools/preextstl.h>
#include <graphite/GrClient.h>
#include <graphite/Font.h>
#include <graphite/ITextSource.h>
-#include "postgraphitestl.h"
+#include <tools/postextstl.h>
// Module type definitions and forward declarations.
//
@@ -90,7 +90,7 @@ public:
virtual float getVerticalOffset(gr::toffset ich);
virtual gr::isocode getLanguage(gr::toffset ich);
- virtual sil_std::pair<gr::toffset, gr::toffset> propertyRange(gr::toffset ich);
+ virtual ext_std::pair<gr::toffset, gr::toffset> propertyRange(gr::toffset ich);
virtual size_t getFontFeatures(gr::toffset ich, gr::FeatureSetting * prgfset);
virtual bool sameSegment(gr::toffset ich1, gr::toffset ich2);
diff --git a/vcl/source/helper/xconnection.cxx b/vcl/source/helper/xconnection.cxx
index 19ac9103bf96..caf7ee237d67 100644
--- a/vcl/source/helper/xconnection.cxx
+++ b/vcl/source/helper/xconnection.cxx
@@ -141,12 +141,16 @@ bool DisplayConnection::dispatchEvent( void* pThis, void* pData, int nBytes )
SolarMutexReleaser aRel;
DisplayConnection* This = (DisplayConnection*)pThis;
- MutexGuard aGuard( This->m_aMutex );
Sequence< sal_Int8 > aSeq( (sal_Int8*)pData, nBytes );
Any aEvent;
aEvent <<= aSeq;
- for( ::std::list< Reference< XEventHandler > >::const_iterator it = This->m_aHandlers.begin(); it != This->m_aHandlers.end(); ++it )
+ ::std::list< Reference< XEventHandler > > handlers;
+ {
+ MutexGuard aGuard( This->m_aMutex );
+ handlers = This->m_aHandlers;
+ }
+ for( ::std::list< Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it )
if( (*it)->handleEvent( aEvent ) )
return true;
return false;
@@ -157,12 +161,16 @@ bool DisplayConnection::dispatchErrorEvent( void* pThis, void* pData, int nBytes
SolarMutexReleaser aRel;
DisplayConnection* This = (DisplayConnection*)pThis;
- MutexGuard aGuard( This->m_aMutex );
Sequence< sal_Int8 > aSeq( (sal_Int8*)pData, nBytes );
Any aEvent;
aEvent <<= aSeq;
- for( ::std::list< Reference< XEventHandler > >::const_iterator it = This->m_aErrorHandlers.begin(); it != This->m_aErrorHandlers.end(); ++it )
+ ::std::list< Reference< XEventHandler > > handlers;
+ {
+ MutexGuard aGuard( This->m_aMutex );
+ handlers = This->m_aErrorHandlers;
+ }
+ for( ::std::list< 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 3158926f5e6d..58f0a477c848 100644
--- a/vcl/source/src/print.src
+++ b/vcl/source/src/print.src
@@ -356,7 +356,7 @@ ModalDialog SV_DLG_PRINT
{
Pos = MAP_APPFONT( 5, 35 );
Size = MAP_APPFONT( 150, 10 );
- Text [en-US] = "Range and Copies";
+ Text [en-US] = "Range and copies";
};
FixedText SV_PRINT_COPYCOUNT
{
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index e3a8d2ce35de..e67c2d9ecfd5 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -426,11 +426,19 @@ void DockingManager::SetFloatingMode( const Window *pWindow, BOOL bFloating )
pWrapper->SetFloatingMode( bFloating );
}
-void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const Window *pWindow )
+void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const Window *pWindow, ULONG nFlags )
{
ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow );
if( pWrapper )
- pWrapper->StartPopupMode( pParentToolBox );
+ pWrapper->StartPopupMode( pParentToolBox, nFlags );
+}
+
+void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const Window *pWindow )
+{
+ StartPopupMode( pParentToolBox, pWindow, FLOATWIN_POPUPMODE_ALLOWTEAROFF |
+ FLOATWIN_POPUPMODE_NOFOCUSCLOSE |
+ FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE |
+ FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE );
}
BOOL DockingManager::IsInPopupMode( const Window *pWindow )
@@ -442,6 +450,17 @@ BOOL DockingManager::IsInPopupMode( const Window *pWindow )
return FALSE;
}
+// -----------------------------------------------------------------------
+
+void DockingManager::EndPopupMode( const Window *pWin )
+{
+ ImplDockingWindowWrapper *pWrapper = GetDockingWindowWrapper( pWin );
+ if( pWrapper && pWrapper->GetFloatingWindow() && pWrapper->GetFloatingWindow()->IsInPopupMode() )
+ pWrapper->GetFloatingWindow()->EndPopupMode();
+}
+
+// -----------------------------------------------------------------------
+
void DockingManager::AddWindow( const Window *pWindow )
{
ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow );
@@ -515,12 +534,15 @@ private:
ImplDockingWindowWrapper* mpDockingWin;
BOOL mbHighlight;
BOOL mbMoving;
+ bool mbTrackingEnabled;
Point maDelta;
Point maTearOffPosition;
+ bool mbGripAtBottom;
+ bool mbHasGrip;
void ImplSetBorder();
public:
- ImplPopupFloatWin( Window* pParent, ImplDockingWindowWrapper* pDockingWin );
+ ImplPopupFloatWin( Window* pParent, ImplDockingWindowWrapper* pDockingWin, bool bHasGrip );
~ImplPopupFloatWin();
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
@@ -537,9 +559,11 @@ public:
Point GetTearOffPosition() const;
void DrawGrip();
void DrawBorder();
+
+ bool hasGrip() const { return mbHasGrip; }
};
-ImplPopupFloatWin::ImplPopupFloatWin( Window* pParent, ImplDockingWindowWrapper* pDockingWin ) :
+ImplPopupFloatWin::ImplPopupFloatWin( Window* pParent, ImplDockingWindowWrapper* pDockingWin, bool bHasGrip ) :
FloatingWindow( pParent, WB_NOBORDER | WB_SYSTEMWINDOW | WB_NOSHADOW)
{
mpWindowImpl->mbToolbarFloatingWindow = TRUE; // indicate window type, required for accessibility
@@ -547,6 +571,9 @@ ImplPopupFloatWin::ImplPopupFloatWin( Window* pParent, ImplDockingWindowWrapper*
mpDockingWin = pDockingWin;
mbHighlight = FALSE;
mbMoving = FALSE;
+ mbTrackingEnabled = FALSE;
+ mbGripAtBottom = TRUE;
+ mbHasGrip = bHasGrip;
ImplSetBorder();
}
@@ -582,7 +609,9 @@ void ImplPopupFloatWin::ImplSetBorder()
// we're using a special border for the grip
// by setting those members the method SetOutputSizePixel() can
// be used to set the proper window size
- mpWindowImpl->mnTopBorder = 1 + POPUP_DRAGHEIGHT+2;
+ mpWindowImpl->mnTopBorder = 1;
+ if( hasGrip() )
+ mpWindowImpl->mnTopBorder += POPUP_DRAGHEIGHT+2;
mpWindowImpl->mnBottomBorder = 1;
mpWindowImpl->mnLeftBorder = 1;
mpWindowImpl->mnRightBorder = 1;
@@ -596,13 +625,25 @@ void ImplPopupFloatWin::Resize()
Rectangle ImplPopupFloatWin::GetDragRect() const
{
- return Rectangle( 1, 1, GetOutputSizePixel().Width()-1, 2+POPUP_DRAGHEIGHT );
+ Rectangle aRect;
+ if( hasGrip() )
+ {
+ aRect = Rectangle( 1,1, GetOutputSizePixel().Width()-1, 2+POPUP_DRAGHEIGHT );
+ if( mbGripAtBottom )
+ {
+ int height = GetOutputSizePixel().Height();
+ aRect.Top() = height - 3 - POPUP_DRAGHEIGHT;
+ aRect.Bottom() = aRect.Top() + 1 + POPUP_DRAGHEIGHT;
+ }
+ }
+ return aRect;
}
Point ImplPopupFloatWin::GetToolboxPosition() const
{
// return inner position where a toolbox could be placed
- Point aPt( 1, 1+GetDragRect().getHeight() ); // grip + border
+ Point aPt( 1, 1 + ((mbGripAtBottom || !hasGrip()) ? 0 : GetDragRect().getHeight()) ); // grip + border
+
return aPt;
}
@@ -616,7 +657,6 @@ Point ImplPopupFloatWin::GetTearOffPosition() const
void ImplPopupFloatWin::DrawBorder()
{
SetFillColor();
- SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() );
Point aPt;
Rectangle aRect( aPt, GetOutputSizePixel() );
@@ -626,9 +666,16 @@ void ImplPopupFloatWin::DrawBorder()
if( !aItemClipRect.IsEmpty() )
{
aItemClipRect.SetPos( AbsoluteScreenToOutputPixel( aItemClipRect.TopLeft() ) );
+
+ // draw the excluded border part with the background color of a toolbox
+ SetClipRegion( Region( aItemClipRect ) );
+ SetLineColor( GetSettings().GetStyleSettings().GetFaceColor() );
+ DrawRect( aRect );
+
aClipRgn.Exclude( aItemClipRect );
SetClipRegion( aClipRgn );
}
+ SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() );
DrawRect( aRect );
SetClipRegion( oldClipRgn );
}
@@ -724,7 +771,8 @@ void ImplPopupFloatWin::Paint( const Rectangle& )
Rectangle aRect( aPt, GetOutputSizePixel() );
DrawWallpaper( aRect, Wallpaper( GetSettings().GetStyleSettings().GetFaceGradientColor() ) );
DrawBorder();
- DrawGrip();
+ if( hasGrip() )
+ DrawGrip();
}
void ImplPopupFloatWin::MouseMove( const MouseEvent& rMEvt )
@@ -733,7 +781,7 @@ void ImplPopupFloatWin::MouseMove( const MouseEvent& rMEvt )
if( !ToolBox::AlwaysLocked() ) // no tear off if locking is enabled
{
- if( rMEvt.IsLeft() && GetDragRect().IsInside( aMousePos ) )
+ if( mbTrackingEnabled && rMEvt.IsLeft() && GetDragRect().IsInside( aMousePos ) )
{
// start window move
mbMoving = TRUE;
@@ -755,6 +803,7 @@ void ImplPopupFloatWin::MouseMove( const MouseEvent& rMEvt )
void ImplPopupFloatWin::MouseButtonUp( const MouseEvent& rMEvt )
{
+ mbTrackingEnabled = false;
FloatingWindow::MouseButtonUp( rMEvt );
}
@@ -769,6 +818,11 @@ void ImplPopupFloatWin::MouseButtonDown( const MouseEvent& rMEvt )
ImplMirrorFramePos(aState.maPos);
maTearOffPosition = GetWindow( WINDOW_BORDER )->GetPosPixel();
maDelta = aState.maPos - maTearOffPosition;
+ mbTrackingEnabled = true;
+ }
+ else
+ {
+ mbTrackingEnabled = false;
}
}
@@ -1187,7 +1241,7 @@ BOOL ImplDockingWindowWrapper::IsTitleButtonVisible( USHORT nButton ) const
// -----------------------------------------------------------------------
-void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox )
+void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, ULONG nFlags )
{
// do nothing if window is floating
if( IsFloatingMode() )
@@ -1202,7 +1256,7 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox )
mpOldBorderWin = NULL; // no border window found
// the new parent for popup mode
- ImplPopupFloatWin* pWin = new ImplPopupFloatWin( mpParent, this );
+ ImplPopupFloatWin* pWin = new ImplPopupFloatWin( mpParent, this, (nFlags & FLOATWIN_POPUPMODE_ALLOWTEAROFF) != 0 );
pWin->SetPopupModeEndHdl( LINK( this, ImplDockingWindowWrapper, PopupModeEnd ) );
pWin->SetText( GetWindow()->GetText() );
@@ -1232,12 +1286,6 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox )
// (SetPosPixel etc. check for valid mpFloatWin pointer)
mpFloatWin = pWin;
- ULONG nFlags = FLOATWIN_POPUPMODE_ALLOWTEAROFF |
- FLOATWIN_POPUPMODE_NOFOCUSCLOSE |
- FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE |
- FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE;
-// |FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE;
-
// if the subtoolbar was opened via keyboard make sure that key events
// will go into subtoolbar
if( pParentToolBox->IsKeyEvent() )
@@ -1339,7 +1387,7 @@ void ImplDockingWindowWrapper::SetFloatingMode( BOOL bFloatMode )
aSettings.SetStyleSettings( aStyleSettings );
pWin->SetSettings( aSettings );*/
- mpFloatWin = pWin;
+// mpFloatWin = pWin;
GetWindow()->mpWindowImpl->mpBorderWindow = NULL;
@@ -1374,6 +1422,8 @@ void ImplDockingWindowWrapper::SetFloatingMode( BOOL bFloatMode )
pWin->SetMinOutputSizePixel( maMinOutSize );
pWin->SetMaxOutputSizePixel( maMaxOutSize );
+ mpFloatWin = pWin;
+
if ( bVisible )
GetWindow()->Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index ddfb1125d0d7..1723d26ce399 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -32,6 +32,7 @@
#include "vcl/salinst.hxx"
#include "tools/list.hxx"
#include "tools/debug.hxx"
+#include "tools/diagnose_ex.h"
#include "vcl/svdata.hxx"
#include "vcl/svapp.hxx"
#include "vcl/mnemonic.hxx"
@@ -937,6 +938,14 @@ Menu::~Menu()
if ( nEventId )
Application::RemoveUserEvent( nEventId );
+ // Notify deletion of this menu
+ ImplMenuDelData* pDelData = mpFirstDel;
+ while ( pDelData )
+ {
+ pDelData->mpMenu = NULL;
+ pDelData = pDelData->mpNext;
+ }
+
bKilled = TRUE;
delete pItemList;
@@ -969,7 +978,7 @@ void Menu::ImplInit()
bInCallback = FALSE;
bKilled = FALSE;
mpLayoutData = NULL;
-
+ mpFirstDel = NULL; // Dtor notification list
// Native-support: returns NULL if not supported
mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu( bIsMenuBar );
}
@@ -1033,19 +1042,29 @@ void Menu::CreateAutoMnemonics()
void Menu::Activate()
{
bInCallback = TRUE;
+
+ ImplMenuDelData aDelData( this );
+
ImplCallEventListeners( VCLEVENT_MENU_ACTIVATE, ITEMPOS_INVALID );
- if ( !aActivateHdl.Call( this ) )
+
+ if( !aDelData.isDeleted() )
{
- Menu* pStartMenu = ImplGetStartMenu();
- if ( pStartMenu && ( pStartMenu != this ) )
+ if ( !aActivateHdl.Call( this ) )
{
- pStartMenu->bInCallback = TRUE;
- // MT 11/01: Call EventListener here? I don't know...
- pStartMenu->aActivateHdl.Call( this );
- pStartMenu->bInCallback = FALSE;
+ if( !aDelData.isDeleted() )
+ {
+ Menu* pStartMenu = ImplGetStartMenu();
+ if ( pStartMenu && ( pStartMenu != this ) )
+ {
+ pStartMenu->bInCallback = TRUE;
+ // MT 11/01: Call EventListener here? I don't know...
+ pStartMenu->aActivateHdl.Call( this );
+ pStartMenu->bInCallback = FALSE;
+ }
+ }
}
+ bInCallback = FALSE;
}
- bInCallback = FALSE;
}
void Menu::Deactivate()
@@ -1058,33 +1077,49 @@ void Menu::Deactivate()
}
bInCallback = TRUE;
+
+ ImplMenuDelData aDelData( this );
+
Menu* pStartMenu = ImplGetStartMenu();
ImplCallEventListeners( VCLEVENT_MENU_DEACTIVATE, ITEMPOS_INVALID );
- if ( !aDeactivateHdl.Call( this ) )
+
+ if( !aDelData.isDeleted() )
{
- if ( pStartMenu && ( pStartMenu != this ) )
+ if ( !aDeactivateHdl.Call( this ) )
{
- pStartMenu->bInCallback = TRUE;
- pStartMenu->aDeactivateHdl.Call( this );
- pStartMenu->bInCallback = FALSE;
+ if( !aDelData.isDeleted() )
+ {
+ if ( pStartMenu && ( pStartMenu != this ) )
+ {
+ pStartMenu->bInCallback = TRUE;
+ pStartMenu->aDeactivateHdl.Call( this );
+ pStartMenu->bInCallback = FALSE;
+ }
+ }
}
}
- bInCallback = FALSE;
- if ( this == pStartMenu )
- GetpApp()->HideHelpStatusText();
+ if( !aDelData.isDeleted() )
+ {
+ bInCallback = FALSE;
+
+ if ( this == pStartMenu )
+ GetpApp()->HideHelpStatusText();
+ }
}
void Menu::Highlight()
{
+ ImplMenuDelData aDelData( this );
+
Menu* pStartMenu = ImplGetStartMenu();
- if ( !aHighlightHdl.Call( this ) )
+ if ( !aHighlightHdl.Call( this ) && !aDelData.isDeleted() )
{
if ( pStartMenu && ( pStartMenu != this ) )
pStartMenu->aHighlightHdl.Call( this );
}
- if ( GetCurItemId() )
+ if ( !aDelData.isDeleted() && GetCurItemId() )
GetpApp()->ShowHelpStatusText( GetHelpText( GetCurItemId() ) );
}
@@ -1111,14 +1146,19 @@ void Menu::ImplSelect()
void Menu::Select()
{
+ ImplMenuDelData aDelData( this );
+
ImplCallEventListeners( VCLEVENT_MENU_SELECT, GetItemPos( GetCurItemId() ) );
- if ( !aSelectHdl.Call( this ) )
+ if ( !aDelData.isDeleted() && !aSelectHdl.Call( this ) )
{
- Menu* pStartMenu = ImplGetStartMenu();
- if ( pStartMenu && ( pStartMenu != this ) )
+ if( !aDelData.isDeleted() )
{
- pStartMenu->nSelectedId = nSelectedId;
- pStartMenu->aSelectHdl.Call( this );
+ Menu* pStartMenu = ImplGetStartMenu();
+ if ( pStartMenu && ( pStartMenu != this ) )
+ {
+ pStartMenu->nSelectedId = nSelectedId;
+ pStartMenu->aSelectHdl.Call( this );
+ }
}
}
}
@@ -1140,6 +1180,8 @@ void Menu::RequestHelp( const HelpEvent& )
void Menu::ImplCallEventListeners( ULONG nEvent, USHORT nPos )
{
+ ImplMenuDelData aDelData( this );
+
VclMenuEvent aEvent( this, nEvent, nPos );
// This is needed by atk accessibility bridge
@@ -1148,16 +1190,22 @@ void Menu::ImplCallEventListeners( ULONG nEvent, USHORT nPos )
ImplGetSVData()->mpApp->ImplCallEventListeners( &aEvent );
}
- if ( !maEventListeners.empty() )
+ if ( !aDelData.isDeleted() && !maEventListeners.empty() )
maEventListeners.Call( &aEvent );
- Menu* pMenu = this;
- while ( pMenu )
+ if( !aDelData.isDeleted() )
{
- if ( !maChildEventListeners.empty() )
- maChildEventListeners.Call( &aEvent );
+ Menu* pMenu = this;
+ while ( pMenu )
+ {
+ if ( !maChildEventListeners.empty() )
+ maChildEventListeners.Call( &aEvent );
- pMenu = ( pMenu->pStartedFrom != pMenu ) ? pMenu->pStartedFrom : NULL;
+ if( aDelData.isDeleted() )
+ break;
+
+ pMenu = ( pMenu->pStartedFrom != pMenu ) ? pMenu->pStartedFrom : NULL;
+ }
}
}
@@ -2260,6 +2308,42 @@ long Menu::ImplGetNativeCheckAndRadioSize( Window* pWin, long& rCheckHeight, lon
return (rCheckHeight > rRadioHeight) ? rCheckHeight : rRadioHeight;
}
+// -----------------------------------------------------------------------
+
+void Menu::ImplAddDel( ImplMenuDelData& rDel )
+{
+ DBG_ASSERT( !rDel.mpMenu, "Menu::ImplAddDel(): cannot add ImplMenuDelData twice !" );
+ if( !rDel.mpMenu )
+ {
+ rDel.mpMenu = this;
+ rDel.mpNext = mpFirstDel;
+ mpFirstDel = &rDel;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Menu::ImplRemoveDel( ImplMenuDelData& rDel )
+{
+ rDel.mpMenu = NULL;
+ if ( mpFirstDel == &rDel )
+ {
+ mpFirstDel = rDel.mpNext;
+ }
+ else
+ {
+ ImplMenuDelData* pData = mpFirstDel;
+ while ( pData && (pData->mpNext != &rDel) )
+ pData = pData->mpNext;
+
+ DBG_ASSERT( pData, "Menu::ImplRemoveDel(): ImplMenuDelData not registered !" );
+ if( pData )
+ pData->mpNext = rDel.mpNext;
+ }
+}
+
+// -----------------------------------------------------------------------
+
Size Menu::ImplCalcSize( Window* pWin )
{
// | Checked| Image| Text| Accel/Popup|
@@ -2789,13 +2873,19 @@ Menu* Menu::ImplGetStartMenu()
void Menu::ImplCallHighlight( USHORT nHighlightedItem )
{
+ ImplMenuDelData aDelData( this );
+
nSelectedId = 0;
MenuItemData* pData = pItemList->GetDataFromPos( nHighlightedItem );
if ( pData )
nSelectedId = pData->nId;
ImplCallEventListeners( VCLEVENT_MENU_HIGHLIGHT, GetItemPos( GetCurItemId() ) );
- Highlight();
- nSelectedId = 0;
+
+ if( !aDelData.isDeleted() )
+ {
+ Highlight();
+ nSelectedId = 0;
+ }
}
IMPL_LINK( Menu, ImplCallSelect, Menu*, EMPTYARG )
@@ -3291,10 +3381,14 @@ BOOL MenuBar::HandleMenuActivateEvent( Menu *pMenu ) const
{
if( pMenu )
{
+ ImplMenuDelData aDelData( this );
+
pMenu->pStartedFrom = (Menu*)this;
pMenu->bInCallback = TRUE;
pMenu->Activate();
- pMenu->bInCallback = FALSE;
+
+ if( !aDelData.isDeleted() )
+ pMenu->bInCallback = FALSE;
}
return TRUE;
}
@@ -3303,10 +3397,13 @@ BOOL MenuBar::HandleMenuDeActivateEvent( Menu *pMenu ) const
{
if( pMenu )
{
+ ImplMenuDelData aDelData( this );
+
pMenu->pStartedFrom = (Menu*)this;
pMenu->bInCallback = TRUE;
pMenu->Deactivate();
- pMenu->bInCallback = FALSE;
+ if( !aDelData.isDeleted() )
+ pMenu->bInCallback = FALSE;
}
return TRUE;
}
@@ -3317,13 +3414,18 @@ BOOL MenuBar::HandleMenuHighlightEvent( Menu *pMenu, USHORT nHighlightEventId )
pMenu = ((Menu*) this)->ImplFindMenu( nHighlightEventId );
if( pMenu )
{
+ ImplMenuDelData aDelData( pMenu );
+
if( mnHighlightedItemPos != ITEMPOS_INVALID )
pMenu->ImplCallEventListeners( VCLEVENT_MENU_DEHIGHLIGHT, mnHighlightedItemPos );
- pMenu->mnHighlightedItemPos = pMenu->GetItemPos( nHighlightEventId );
- pMenu->nSelectedId = nHighlightEventId;
- pMenu->pStartedFrom = (Menu*)this;
- pMenu->ImplCallHighlight( pMenu->mnHighlightedItemPos );
+ if( !aDelData.isDeleted() )
+ {
+ pMenu->mnHighlightedItemPos = pMenu->GetItemPos( nHighlightEventId );
+ pMenu->nSelectedId = nHighlightEventId;
+ pMenu->pStartedFrom = (Menu*)this;
+ pMenu->ImplCallHighlight( pMenu->mnHighlightedItemPos );
+ }
return TRUE;
}
else
@@ -3464,6 +3566,9 @@ USHORT PopupMenu::Execute( Window* pExecWindow, const Point& rPopupPos )
USHORT PopupMenu::Execute( Window* pExecWindow, const Rectangle& rRect, USHORT nFlags )
{
+ ENSURE_OR_RETURN( pExecWindow, "PopupMenu::Execute: need a non-NULL window!", 0 );
+
+
ULONG nPopupModeFlags = 0;
if ( nFlags & POPUPMENU_EXECUTE_DOWN )
nPopupModeFlags = FLOATWIN_POPUPMODE_DOWN;
@@ -5985,3 +6090,17 @@ bool MenuBarWindow::HandleMenuButtonEvent( USHORT i_nButtonId )
}
return FALSE;
}
+
+ImplMenuDelData::ImplMenuDelData( const Menu* pMenu )
+: mpNext( 0 )
+, mpMenu( 0 )
+{
+ if( pMenu )
+ const_cast< Menu* >( pMenu )->ImplAddDel( *this );
+}
+
+ImplMenuDelData::~ImplMenuDelData()
+{
+ if( mpMenu )
+ const_cast< Menu* >( mpMenu )->ImplRemoveDel( *this );
+}
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index caf5705cbcd9..35077b1cff0e 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -42,16 +42,22 @@
#include "vcl/help.hxx"
#include "vcl/decoview.hxx"
#include "vcl/svapp.hxx"
+#include "vcl/unohelp.hxx"
#include "unotools/localedatawrapper.hxx"
#include "rtl/ustrbuf.hxx"
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/container/XNameAccess.hpp"
+#include "com/sun/star/beans/PropertyValue.hpp"
#include "com/sun/star/awt/Size.hpp"
using namespace vcl;
using namespace com::sun::star;
using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::container;
using namespace com::sun::star::beans;
#define HELPID_PREFIX ".HelpId:vcl:PrintDialog"
@@ -66,7 +72,7 @@ PrintDialog::PrintPreviewWindow::PrintPreviewWindow( Window* i_pParent, const Re
{
SetPaintTransparent( TRUE );
SetBackground();
- if( GetSettings().GetStyleSettings().GetHighContrastMode() )
+ if( useHCColorReplacement() )
maPageVDev.SetBackground( GetSettings().GetStyleSettings().GetWindowColor() );
else
maPageVDev.SetBackground( Color( COL_WHITE ) );
@@ -76,12 +82,76 @@ PrintDialog::PrintPreviewWindow::~PrintPreviewWindow()
{
}
+bool PrintDialog::PrintPreviewWindow::useHCColorReplacement() const
+{
+ bool bRet = false;
+ if( GetSettings().GetStyleSettings().GetHighContrastMode() )
+ {
+ try
+ {
+ // get service provider
+ Reference< XMultiServiceFactory > xSMgr( unohelper::GetMultiServiceFactory() );
+ // create configuration hierachical access name
+ if( xSMgr.is() )
+ {
+ try
+ {
+ Reference< XMultiServiceFactory > xConfigProvider(
+ Reference< XMultiServiceFactory >(
+ xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.ConfigurationProvider" ))),
+ UNO_QUERY )
+ );
+ if( xConfigProvider.is() )
+ {
+ Sequence< Any > aArgs(1);
+ PropertyValue aVal;
+ aVal.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) );
+ aVal.Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common/Accessibility" ) );
+ aArgs.getArray()[0] <<= aVal;
+ Reference< XNameAccess > xConfigAccess(
+ Reference< XNameAccess >(
+ xConfigProvider->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.ConfigurationAccess" )),
+ aArgs ),
+ UNO_QUERY )
+ );
+ if( xConfigAccess.is() )
+ {
+ try
+ {
+ sal_Bool bValue = sal_False;
+ Any aAny = xConfigAccess->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsForPagePreviews" ) ) );
+ if( aAny >>= bValue )
+ bRet = bool(bValue);
+ }
+ catch( NoSuchElementException& )
+ {
+ }
+ catch( WrappedTargetException& )
+ {
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ }
+ }
+ }
+ catch( WrappedTargetException& )
+ {
+ }
+ }
+ return bRet;
+}
+
void PrintDialog::PrintPreviewWindow::DataChanged( const DataChangedEvent& i_rDCEvt )
{
// react on settings changed
if( i_rDCEvt.GetType() == DATACHANGED_SETTINGS )
{
- if( GetSettings().GetStyleSettings().GetHighContrastMode() )
+ if( useHCColorReplacement() )
maPageVDev.SetBackground( GetSettings().GetStyleSettings().GetWindowColor() );
else
maPageVDev.SetBackground( Color( COL_WHITE ) );
@@ -118,6 +188,23 @@ void PrintDialog::PrintPreviewWindow::Resize()
}
aScaledSize.Width() = long(aScaledSize.Width()*fScale);
aScaledSize.Height() = long(aScaledSize.Height()*fScale);
+
+ maPreviewSize = aScaledSize;
+
+ // #i104784# if we render the page too small then rounding issues result in
+ // layout artifacts looking really bad. So scale the page unto a device that is not
+ // full page size but not too small either. This also results in much better visual
+ // quality of the preview, e.g. when its height approaches the number of text lines
+ // find a good scaling factor
+ Size aPreviewMMSize( maPageVDev.PixelToLogic( aScaledSize, MapMode( MAP_100TH_MM ) ) );
+ double fZoom = double(maOrigSize.Height())/double(aPreviewMMSize.Height());
+ while( fZoom > 10 )
+ {
+ aScaledSize.Width() *= 2;
+ aScaledSize.Height() *= 2;
+ fZoom /= 2.0;
+ }
+
maPageVDev.SetOutputSizePixel( aScaledSize, FALSE );
}
@@ -129,9 +216,14 @@ void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& )
// replacement is active
Push();
Rectangle aTextRect( Point( 0, 0 ), aSize );
- Font aFont( GetSettings().GetStyleSettings().GetFieldFont() );
- aFont.SetSize( Size( 0, aSize.Height()/12 ) );
- SetFont( aFont );
+ DecorationView aVw( this );
+ aVw.DrawFrame( aTextRect, FRAME_DRAW_GROUP );
+ aTextRect.Left() += 2;
+ aTextRect.Top() += 2;
+ aTextRect.Right() -= 2;
+ aTextRect.Bottom() -= 2;
+ Font aFont( GetSettings().GetStyleSettings().GetLabelFont() );
+ SetZoomedPointFont( aFont );
DrawText( aTextRect, maReplacementString,
TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER | TEXT_DRAW_WORDBREAK | TEXT_DRAW_MULTILINE
);
@@ -141,11 +233,11 @@ void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& )
{
GDIMetaFile aMtf( maMtf );
- Size aPreviewSize = maPageVDev.GetOutputSizePixel();
- Point aOffset( (aSize.Width() - aPreviewSize.Width()) / 2,
- (aSize.Height() - aPreviewSize.Height()) / 2 );
+ Point aOffset( (aSize.Width() - maPreviewSize.Width()) / 2,
+ (aSize.Height() - maPreviewSize.Height()) / 2 );
- const Size aLogicSize( maPageVDev.PixelToLogic( aPreviewSize, MapMode( MAP_100TH_MM ) ) );
+ Size aVDevSize( maPageVDev.GetOutputSizePixel() );
+ const Size aLogicSize( maPageVDev.PixelToLogic( aVDevSize, MapMode( MAP_100TH_MM ) ) );
Size aOrigSize( maOrigSize );
if( aOrigSize.Width() < 1 )
aOrigSize.Width() = aLogicSize.Width();
@@ -165,11 +257,11 @@ void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& )
SetMapMode( MAP_PIXEL );
maPageVDev.SetMapMode( MAP_PIXEL );
- DrawOutDev( aOffset, aPreviewSize, Point( 0, 0 ), aPreviewSize, maPageVDev );
+ DrawOutDev( aOffset, maPreviewSize, Point( 0, 0 ), aVDevSize, maPageVDev );
DecorationView aVw( this );
- aOffset.X() -= 1; aOffset.Y() -=1; aPreviewSize.Width() += 2; aPreviewSize.Height() += 2;
- aVw.DrawFrame( Rectangle( aOffset, aPreviewSize ), FRAME_DRAW_GROUP );
+ Rectangle aFrame( aOffset + Point( -1, -1 ), Size( maPreviewSize.Width() + 2, maPreviewSize.Height() + 2 ) );
+ aVw.DrawFrame( aFrame, FRAME_DRAW_GROUP );
}
}
@@ -211,9 +303,7 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi
#endif
SetQuickHelpText( aBuf.makeStringAndClear() );
maMtf = i_rNewPreview;
- if( GetSettings().GetStyleSettings().GetHighContrastMode() &&
- GetSettings().GetStyleSettings().GetWindowColor().IsDark()
- )
+ if( useHCColorReplacement() )
{
maMtf.ReplaceColors( Color( COL_BLACK ), Color( COL_WHITE ), 30 );
}
@@ -557,7 +647,7 @@ void PrintDialog::JobTabPage::setupLayout()
// add printer fixed line
maLayout.addWindow( &maPrinterFL );
// add print LB
- maLayout.addWindow( &maPrinters );
+ maLayout.addWindow( &maPrinters, 3 );
// create a row for details button/text and properties button
boost::shared_ptr< vcl::RowOrColumn > xDetRow( new vcl::RowOrColumn( &maLayout, false ) );
@@ -834,6 +924,7 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterCont
maNUpPage.maBorderCB.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
maOptionsPage.maToFileBox.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
maOptionsPage.maReverseOrderBox.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
+ maOptionsPage.maCollateSingleJobsBox.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
maNUpPage.maPagesBtn.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
// setup modify hdl
@@ -1027,6 +1118,11 @@ bool PrintDialog::isCollate()
return maJobPage.maCopyCountField.GetValue() > 1 ? maJobPage.maCollateBox.IsChecked() : FALSE;
}
+bool PrintDialog::isSingleJobs()
+{
+ return maOptionsPage.maCollateSingleJobsBox.IsChecked();
+}
+
static void setSmartId( Window* i_pWindow, const char* i_pType, sal_Int32 i_nId = -1, const rtl::OUString& i_rPropName = rtl::OUString() )
{
rtl::OUStringBuffer aBuf( 256 );
@@ -1049,10 +1145,17 @@ static void setSmartId( Window* i_pWindow, const char* i_pType, sal_Int32 i_nId
i_pWindow->SetSmartHelpId( SmartId( aBuf.makeStringAndClear(), HID_PRINTDLG ) );
}
-static void setHelpText( Window* i_pWindow, const Sequence< rtl::OUString >& i_rHelpTexts, sal_Int32 i_nIndex )
+static void setHelpText( Window* /*i_pWindow*/, const Sequence< rtl::OUString >& /*i_rHelpTexts*/, sal_Int32 /*i_nIndex*/ )
{
+ // without a help text set and the correct smartID,
+ // help texts will be retrieved from the online help system
+
+ // passed help texts for optional UI is used only for native dialogs which currently
+ // cannot access the same (rather implicit) mechanism
+ #if 0
if( i_nIndex >= 0 && i_nIndex < i_rHelpTexts.getLength() )
i_pWindow->SetHelpText( i_rHelpTexts.getConstArray()[i_nIndex] );
+ #endif
}
void updateMaxSize( const Size& i_rCheckSize, Size& o_rMaxSize )
@@ -1572,6 +1675,12 @@ void PrintDialog::setupOptionalUI()
maJobPage.maLayout.setBorders( nIndex-1, 0, 0, 0, aBorder.Width() );
#endif
+ // create auto mnemomnics now so they can be calculated in layout
+ ImplWindowAutoMnemonic( &maJobPage );
+ ImplWindowAutoMnemonic( &maNUpPage );
+ ImplWindowAutoMnemonic( &maOptionsPage );
+ ImplWindowAutoMnemonic( this );
+
// calculate job page
Size aMaxSize = maJobPage.maLayout.getOptimalSize( WINDOWSIZE_PREFERRED );
// and layout page
@@ -1654,6 +1763,7 @@ void PrintDialog::checkControlDependencies()
maJobPage.maCollateImage.SetSizePixel( aImgSize );
maJobPage.maCollateImage.SetImage( bHC ? aHCImg : aImg );
maJobPage.maCollateImage.SetModeImage( aHCImg, BMP_COLOR_HIGHCONTRAST );
+ maJobPage.maLayout.resize();
// enable setup button only for printers that can be setup
bool bHaveSetup = maPController->getPrinter()->HasSupport( SUPPORT_SETUPDIALOG );
@@ -2444,6 +2554,11 @@ void PrintProgressDialog::tick()
setProgress( ++mnCur );
}
+void PrintProgressDialog::reset()
+{
+ setProgress( 0 );
+}
+
void PrintProgressDialog::Paint( const Rectangle& )
{
if( maProgressRect.IsEmpty() )
diff --git a/vcl/source/window/seleng.cxx b/vcl/source/window/seleng.cxx
index b4f4d0f2b6df..d4ee01c26d61 100644
--- a/vcl/source/window/seleng.cxx
+++ b/vcl/source/window/seleng.cxx
@@ -200,7 +200,11 @@ void SelectionEngine::CursorPosChanging( BOOL bShift, BOOL bMod1 )
BOOL SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt )
{
nFlags &= (~SELENG_CMDEVT);
- if ( !pFunctionSet || !pWin || rMEvt.GetClicks() > 1 || rMEvt.IsRight() )
+ if ( !pFunctionSet || !pWin )
+ return FALSE;
+ const bool bRightClickCursorPositioning =
+ rMEvt.IsRight() && rMEvt.GetClicks() == 1 && !IsInSelection();
+ if ( (rMEvt.GetClicks() > 1 || rMEvt.IsRight()) && !bRightClickCursorPositioning )
return FALSE;
USHORT nModifier = rMEvt.GetModifier() | nLockedMods;
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index 056b55dc3b61..f3624ef56f59 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -659,6 +659,63 @@ static void ImplWindowStateToStr( const WindowStateData& rData, ByteString& rStr
// -----------------------------------------------------------------------
+void SystemWindow::ImplMoveToScreen( long& io_rX, long& io_rY, long i_nWidth, long i_nHeight, Window* i_pConfigureWin )
+{
+ Rectangle aScreenRect;
+ if( Application::IsMultiDisplay() )
+ {
+ aScreenRect = Application::GetScreenPosSizePixel( GetScreenNumber() );
+ }
+ else
+ {
+ aScreenRect = Application::GetScreenPosSizePixel( 0 );
+ for( unsigned int i = 1; i < Application::GetScreenCount(); i++ )
+ aScreenRect.Union( Application::GetScreenPosSizePixel( i ) );
+ }
+ // unfortunately most of the time width and height are not really known
+ if( i_nWidth < 1 )
+ i_nWidth = 50;
+ if( i_nHeight < 1 )
+ i_nHeight = 50;
+
+ // check left border
+ bool bMove = false;
+ if( io_rX + i_nWidth < aScreenRect.Left() )
+ {
+ bMove = true;
+ io_rX = aScreenRect.Left();
+ }
+ // check right border
+ if( io_rX > aScreenRect.Right() - i_nWidth )
+ {
+ bMove = true;
+ io_rX = aScreenRect.Right() - i_nWidth;
+ }
+ // check top border
+ if( io_rY + i_nHeight < aScreenRect.Top() )
+ {
+ bMove = true;
+ io_rY = aScreenRect.Top();
+ }
+ // check bottom border
+ if( io_rY > aScreenRect.Bottom() - i_nHeight )
+ {
+ bMove = true;
+ io_rY = aScreenRect.Bottom() - i_nHeight;
+ }
+ Window* pParent = i_pConfigureWin->GetParent();
+ if( bMove && pParent )
+ {
+ // calculate absolute screen pos here, since that is what is contained in WindowState
+ Point aParentAbsPos( pParent->OutputToAbsoluteScreenPixel( Point(0,0) ) );
+ Size aParentSizePixel( pParent->GetOutputSizePixel() );
+ Point aPos( (aParentSizePixel.Width() - i_nWidth) / 2,
+ (aParentSizePixel.Height() - i_nHeight) / 2 );
+ io_rX = aParentAbsPos.X() + aPos.X();
+ io_rY = aParentAbsPos.Y() + aPos.Y();
+ }
+}
+
void SystemWindow::SetWindowStateData( const WindowStateData& rData )
{
ULONG nValidMask = rData.GetMask();
@@ -701,6 +758,10 @@ void SystemWindow::SetWindowStateData( const WindowStateData& rData )
//nState &= ~(WINDOWSTATE_STATE_MINIMIZED);
aState.mnState = nState & SAL_FRAMESTATE_SYSTEMMASK;
+ // normalize window positions onto screen
+ ImplMoveToScreen( aState.mnX, aState.mnY, aState.mnWidth, aState.mnHeight, pWindow );
+ ImplMoveToScreen( aState.mnMaximizedX, aState.mnMaximizedY, aState.mnMaximizedWidth, aState.mnMaximizedHeight, pWindow );
+
// #96568# avoid having multiple frames at the same screen location
// do the check only if not maximized
if( !((rData.GetMask() & WINDOWSTATE_MASK_STATE) && (nState & WINDOWSTATE_STATE_MAXIMIZED)) )
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 8906edaa5046..ebeb5c94d68a 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -98,6 +98,7 @@
#include "vcl/lazydelete.hxx"
#include <set>
+#include <typeinfo>
using namespace rtl;
using namespace ::com::sun::star::uno;
@@ -1322,7 +1323,6 @@ ImplWinData* Window::ImplGetWinData() const
mpWindowImpl->mpWinData->mnIsTopWindow = (USHORT) ~0; // not initialized yet, 0/1 will indicate TopWindow (see IsTopWindow())
mpWindowImpl->mpWinData->mbMouseOver = FALSE;
mpWindowImpl->mpWinData->mbEnableNativeWidget = (pNoNWF && *pNoNWF) ? FALSE : TRUE; // TRUE: try to draw this control with native theme API
- mpWindowImpl->mpWinData->mpSalControlHandle = NULL;
mpWindowImpl->mpWinData->mpSmartHelpId = NULL;
mpWindowImpl->mpWinData->mpSmartUniqueId = NULL;
}
@@ -4328,6 +4328,27 @@ Window::Window( Window* pParent, const ResId& rResId )
}
// -----------------------------------------------------------------------
+#if OSL_DEBUG_LEVEL > 0
+namespace
+{
+ void lcl_appendWindowInfo( ByteString& io_rErrorString, const Window& i_rWindow )
+ {
+ // skip border windows, they don't carry information which helps diagnosing the problem
+ const Window* pWindow( &i_rWindow );
+ while ( pWindow && ( pWindow->GetType() == WINDOW_BORDERWINDOW ) )
+ pWindow = pWindow->GetWindow( WINDOW_FIRSTCHILD );
+ if ( !pWindow )
+ pWindow = &i_rWindow;
+
+ io_rErrorString += char(13);
+ io_rErrorString += typeid( *pWindow ).name();
+ io_rErrorString += " (window text: '";
+ io_rErrorString += ByteString( pWindow->GetText(), RTL_TEXTENCODING_UTF8 );
+ io_rErrorString += "')";
+ }
+}
+#endif
+// -----------------------------------------------------------------------
Window::~Window()
{
@@ -4460,9 +4481,7 @@ Window::~Window()
if ( ImplIsRealParentPath( pTempWin ) )
{
bError = TRUE;
- if ( aErrorStr.Len() )
- aErrorStr += "; ";
- aErrorStr += ByteString( pTempWin->GetText(), RTL_TEXTENCODING_UTF8 );
+ lcl_appendWindowInfo( aErrorStr, *pTempWin );
}
pTempWin = pTempWin->mpWindowImpl->mpNextOverlap;
}
@@ -4483,9 +4502,7 @@ Window::~Window()
if ( ImplIsRealParentPath( pTempWin ) )
{
bError = TRUE;
- if ( aErrorStr.Len() )
- aErrorStr += "; ";
- aErrorStr += ByteString( pTempWin->GetText(), RTL_TEXTENCODING_UTF8 );
+ lcl_appendWindowInfo( aErrorStr, *pTempWin );
}
pTempWin = pTempWin->mpWindowImpl->mpFrameData->mpNextFrame;
}
@@ -4507,10 +4524,8 @@ Window::~Window()
pTempWin = mpWindowImpl->mpFirstChild;
while ( pTempWin )
{
- aTempStr += ByteString( pTempWin->GetText(), RTL_TEXTENCODING_UTF8 );
+ lcl_appendWindowInfo( aTempStr, *pTempWin );
pTempWin = pTempWin->mpWindowImpl->mpNext;
- if ( pTempWin )
- aTempStr += "; ";
}
DBG_ERROR( aTempStr.GetBuffer() );
GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed!
@@ -4524,10 +4539,8 @@ Window::~Window()
pTempWin = mpWindowImpl->mpFirstOverlap;
while ( pTempWin )
{
- aTempStr += ByteString( pTempWin->GetText(), RTL_TEXTENCODING_UTF8 );
+ lcl_appendWindowInfo( aTempStr, *pTempWin );
pTempWin = pTempWin->mpWindowImpl->mpNext;
- if ( pTempWin )
- aTempStr += "; ";
}
DBG_ERROR( aTempStr.GetBuffer() );
GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed!
@@ -4722,10 +4735,6 @@ Window::~Window()
delete mpWindowImpl->mpWinData->mpFocusRect;
if ( mpWindowImpl->mpWinData->mpTrackRect )
delete mpWindowImpl->mpWinData->mpTrackRect;
- // Native widget support
- delete mpWindowImpl->mpWinData->mpSalControlHandle;
- mpWindowImpl->mpWinData->mpSalControlHandle = NULL;
-
if ( mpWindowImpl->mpWinData->mpSmartHelpId )
delete mpWindowImpl->mpWinData->mpSmartHelpId;
if ( mpWindowImpl->mpWinData->mpSmartUniqueId )
@@ -7444,13 +7453,13 @@ Rectangle Window::ImplOutputToUnmirroredAbsoluteScreenPixel( const Rectangle &rR
// -----------------------------------------------------------------------
-Rectangle Window::GetWindowExtentsRelative( Window *pRelativeWindow )
+Rectangle Window::GetWindowExtentsRelative( Window *pRelativeWindow ) const
{
// with decoration
return ImplGetWindowExtentsRelative( pRelativeWindow, FALSE );
}
-Rectangle Window::GetClientWindowExtentsRelative( Window *pRelativeWindow )
+Rectangle Window::GetClientWindowExtentsRelative( Window *pRelativeWindow ) const
{
// without decoration
return ImplGetWindowExtentsRelative( pRelativeWindow, TRUE );
@@ -7458,12 +7467,12 @@ Rectangle Window::GetClientWindowExtentsRelative( Window *pRelativeWindow )
// -----------------------------------------------------------------------
-Rectangle Window::ImplGetWindowExtentsRelative( Window *pRelativeWindow, BOOL bClientOnly )
+Rectangle Window::ImplGetWindowExtentsRelative( Window *pRelativeWindow, BOOL bClientOnly ) const
{
SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry();
// make sure we use the extent of our border window,
// otherwise we miss a few pixels
- Window *pWin = (!bClientOnly && mpWindowImpl->mpBorderWindow) ? mpWindowImpl->mpBorderWindow : this;
+ const Window *pWin = (!bClientOnly && mpWindowImpl->mpBorderWindow) ? mpWindowImpl->mpBorderWindow : this;
Point aPos( pWin->OutputToScreenPixel( Point(0,0) ) );
aPos.X() += g.nX;
@@ -8154,7 +8163,7 @@ const XubString& Window::GetHelpText() const
{
rtl::OUStringBuffer aTxt( 64+mpWindowImpl->maHelpText.Len() );
aTxt.append( mpWindowImpl->maHelpText );
- aTxt.appendAscii( "\n+++++++++++++++\n" );
+ aTxt.appendAscii( "\n------------------\n" );
if( bStrHelpId )
aTxt.append( rtl::OUString( aStrHelpId ) );
else
@@ -8641,7 +8650,10 @@ Reference< XClipboard > Window::GetClipboard()
if( xFactory.is() )
{
- mpWindowImpl->mpFrameData->mxClipboard = Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboard" ) ), UNO_QUERY );
+ mpWindowImpl->mpFrameData->mxClipboard = 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 );
#if defined(UNX) && !defined(QUARTZ) // unix clipboard needs to be initialized
if( mpWindowImpl->mpFrameData->mxClipboard.is() )
@@ -8704,6 +8716,9 @@ Reference< XClipboard > Window::GetPrimarySelection()
static Reference< XClipboard > s_xSelection;
if ( !s_xSelection.is() )
+ s_xSelection = 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 );
mpWindowImpl->mpFrameData->mxSelection = s_xSelection;
diff --git a/vcl/source/window/window3.cxx b/vcl/source/window/window3.cxx
index aecbc9c3ef0c..65019ba2a4af 100644
--- a/vcl/source/window/window3.cxx
+++ b/vcl/source/window/window3.cxx
@@ -28,269 +28,10 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#define _SV_WINDOW_CXX
-
-#include "svsys.h"
-#include "vcl/window.h"
#include "vcl/window.hxx"
#include "vcl/waitobj.hxx"
-#include "vcl/salgdi.hxx"
-#include "vcl/salnativewidgets.hxx"
-#include "vcl/salctrlhandle.hxx"
-#include "rtl/ustring.hxx"
#include "vcl/button.hxx"
-using namespace rtl;
-
-// -----------------------------------------------------------------------
-// These functions are mainly passthrough functions that allow access to
-// the SalFrame behind a Window object for native widget rendering purposes.
-// -----------------------------------------------------------------------
-
-void Window::ImplInitSalControlHandle()
-{
- // create SalControlHandle on demand
- // not needed for ordinary windows
- // TODO: move creation to SalGraphics
- //if( !ImplGetWinData()->mpSalControlHandle )
- // ImplGetWinData()->mpSalControlHandle = new SalControlHandle;
-}
-
-// -----------------------------------------------------------------------
-
-BOOL Window::IsNativeControlSupported( ControlType nType, ControlPart nPart )
-{
- if( !IsNativeWidgetEnabled() )
- return FALSE;
-
- if ( !mpGraphics )
- if ( !ImplGetGraphics() )
- return FALSE;
-
- return( mpGraphics->IsNativeControlSupported(nType, nPart) );
-}
-
-
-// -----------------------------------------------------------------------
-
-BOOL Window::HitTestNativeControl( ControlType nType,
- ControlPart nPart,
- const Region& rControlRegion,
- const Point& aPos,
- BOOL& rIsInside )
-{
- if( !IsNativeWidgetEnabled() )
- return FALSE;
-
- if ( !mpGraphics )
- if ( !ImplGetGraphics() )
- return FALSE;
-
- ImplInitSalControlHandle();
-
- Point aWinOffs;
- aWinOffs = OutputToScreenPixel( aWinOffs );
- Region screenRegion( rControlRegion );
- screenRegion.Move( aWinOffs.X(), aWinOffs.Y());
-
- return( mpGraphics->HitTestNativeControl(nType, nPart, screenRegion, OutputToScreenPixel( aPos ), *ImplGetWinData()->mpSalControlHandle, rIsInside, this ) );
-}
-
-// -----------------------------------------------------------------------
-
-void Window::ImplMoveControlValue( ControlType nType, const ImplControlValue& aValue, const Point& rDelta ) const
-{
- if( aValue.getOptionalVal() )
- {
- switch( nType )
- {
- case CTRL_SLIDER:
- {
- SliderValue* pSlVal = reinterpret_cast<SliderValue*>(aValue.getOptionalVal());
- pSlVal->maThumbRect.Move( rDelta.X(), rDelta.Y() );
- }
- break;
- case CTRL_SCROLLBAR:
- {
- ScrollbarValue* pScVal = reinterpret_cast<ScrollbarValue*>(aValue.getOptionalVal());
- pScVal->maThumbRect.Move( rDelta.X(), rDelta.Y() );
- pScVal->maButton1Rect.Move( rDelta.X(), rDelta.Y() );
- pScVal->maButton2Rect.Move( rDelta.X(), rDelta.Y() );
- }
- break;
- case CTRL_SPINBOX:
- case CTRL_SPINBUTTONS:
- {
- SpinbuttonValue* pSpVal = reinterpret_cast<SpinbuttonValue*>(aValue.getOptionalVal());
- pSpVal->maUpperRect.Move( rDelta.X(), rDelta.Y() );
- pSpVal->maLowerRect.Move( rDelta.X(), rDelta.Y() );
- }
- break;
- case CTRL_TOOLBAR:
- {
- ToolbarValue* pTVal = reinterpret_cast<ToolbarValue*>(aValue.getOptionalVal());
- pTVal->maGripRect.Move( rDelta.X(), rDelta.Y() );
- }
- break;
- }
- }
-}
-
-BOOL Window::DrawNativeControl( ControlType nType,
- ControlPart nPart,
- const Region& rControlRegion,
- ControlState nState,
- const ImplControlValue& aValue,
- OUString aCaption )
-{
- if( !IsNativeWidgetEnabled() )
- return FALSE;
-
- /*
- if( !IsInPaint() && IsPaintTransparent() )
- {
- // only required if called directly (ie, we're not in Paint() ):
- // force redraw (Paint()) for transparent controls
- // to trigger a repaint of the background
- Region aClipRgn( GetClipRegion() );
- if( !rControlRegion.IsEmpty() )
- aClipRgn.Intersect( rControlRegion );
- Invalidate( aClipRgn, INVALIDATE_UPDATE );
- return TRUE;
- }
- */
-
- ImplInitSalControlHandle();
-
- // make sure the current clip region is initialized correctly
- if ( !mpGraphics )
- if ( !ImplGetGraphics() )
- return FALSE;
-
- if ( mbInitClipRegion )
- ImplInitClipRegion();
- if ( mbOutputClipped )
- return TRUE;
-
- if ( mbInitLineColor )
- ImplInitLineColor();
- if ( mbInitFillColor )
- ImplInitFillColor();
-
- // Convert the coordinates from relative to Window-absolute, so we draw
- // in the correct place in platform code
- Point aWinOffs;
- aWinOffs = OutputToScreenPixel( aWinOffs );
- Region screenRegion( rControlRegion );
- screenRegion.Move( aWinOffs.X(), aWinOffs.Y());
-
- // do so for ImplControlValue members, also
- ImplMoveControlValue( nType, aValue, aWinOffs );
-
- Region aTestRegion( GetActiveClipRegion() );
- aTestRegion.Intersect( rControlRegion );
- if( aTestRegion == rControlRegion )
- nState |= CTRL_CACHING_ALLOWED; // control is not clipped, caching allowed
-
- BOOL bRet = mpGraphics->DrawNativeControl(nType, nPart, screenRegion, nState, aValue, *ImplGetWinData()->mpSalControlHandle, aCaption, this );
-
- // transform back ImplControlValue members
- ImplMoveControlValue( nType, aValue, Point()-aWinOffs );
-
- return bRet;
-}
-
-
-// -----------------------------------------------------------------------
-
-BOOL Window::DrawNativeControlText(ControlType nType,
- ControlPart nPart,
- const Region& rControlRegion,
- ControlState nState,
- const ImplControlValue& aValue,
- OUString aCaption )
-{
- if( !IsNativeWidgetEnabled() )
- return FALSE;
-
- ImplInitSalControlHandle();
-
- // make sure the current clip region is initialized correctly
- if ( !mpGraphics )
- if ( !ImplGetGraphics() )
- return false;
-
- if ( mbInitClipRegion )
- ImplInitClipRegion();
- if ( mbOutputClipped )
- return true;
-
- if ( mbInitLineColor )
- ImplInitLineColor();
- if ( mbInitFillColor )
- ImplInitFillColor();
-
- // Convert the coordinates from relative to Window-absolute, so we draw
- // in the correct place in platform code
- Point aWinOffs;
- aWinOffs = OutputToScreenPixel( aWinOffs );
- Region screenRegion( rControlRegion );
- screenRegion.Move( aWinOffs.X(), aWinOffs.Y());
- ImplMoveControlValue( nType, aValue, aWinOffs );
-
- BOOL bRet = mpGraphics->DrawNativeControlText(nType, nPart, screenRegion, nState, aValue, *ImplGetWinData()->mpSalControlHandle, aCaption, this );
-
- // transform back ImplControlValue members
- ImplMoveControlValue( nType, aValue, Point()-aWinOffs );
-
- return bRet;
-}
-
-
-// -----------------------------------------------------------------------
-
-BOOL Window::GetNativeControlRegion( ControlType nType,
- ControlPart nPart,
- const Region& rControlRegion,
- ControlState nState,
- const ImplControlValue& aValue,
- OUString aCaption,
- Region &rNativeBoundingRegion,
- Region &rNativeContentRegion )
-{
- if( !IsNativeWidgetEnabled() )
- return FALSE;
-
- if ( !mpGraphics )
- if ( !ImplGetGraphics() )
- return FALSE;
-
- ImplInitSalControlHandle();
-
- // Convert the coordinates from relative to Window-absolute, so we draw
- // in the correct place in platform code
- Point aWinOffs;
- aWinOffs = OutputToScreenPixel( aWinOffs );
- Region screenRegion( rControlRegion );
- screenRegion.Move( aWinOffs.X(), aWinOffs.Y());
- ImplMoveControlValue( nType, aValue, aWinOffs );
-
- BOOL bRet = mpGraphics->GetNativeControlRegion(nType, nPart, screenRegion, nState, aValue,
- *ImplGetWinData()->mpSalControlHandle, aCaption, rNativeBoundingRegion,
- rNativeContentRegion, this );
- if( bRet )
- {
- // transform back native regions
- rNativeBoundingRegion.Move( -aWinOffs.X(), -aWinOffs.Y() );
- rNativeContentRegion.Move( -aWinOffs.X(), -aWinOffs.Y() );
- }
- // transform back ImplControlValue members
- ImplMoveControlValue( nType, aValue, Point()-aWinOffs );
-
- return bRet;
-}
-
-
// -----------------------------------------------------------------------
WaitObject::~WaitObject()
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index 95ac5940b6d2..7b0512a1320b 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -1474,6 +1474,7 @@ static long ImplHandleWheelEvent( Window* pWindow, const SalWheelMouseEvent& rEv
USHORT nMode;
USHORT nCode = rEvt.mnCode;
bool bHorz = rEvt.mbHorz;
+ bool bPixel = rEvt.mbDeltaIsPixel;
if ( nCode & KEY_MOD1 )
nMode = COMMAND_WHEEL_ZOOM;
else if ( nCode & KEY_MOD2 )
@@ -1486,7 +1487,7 @@ static long ImplHandleWheelEvent( Window* pWindow, const SalWheelMouseEvent& rEv
bHorz = true;
}
- CommandWheelData aWheelData( rEvt.mnDelta, rEvt.mnNotchDelta, rEvt.mnScrollLines, nMode, nCode, bHorz );
+ CommandWheelData aWheelData( rEvt.mnDelta, rEvt.mnNotchDelta, rEvt.mnScrollLines, nMode, nCode, bHorz, bPixel );
Point aMousePos( rEvt.mnX, rEvt.mnY );
BOOL bRet = TRUE;
diff --git a/vcl/unx/gtk/a11y/atkbridge.cxx b/vcl/unx/gtk/a11y/atkbridge.cxx
index 47efde7d3dfd..25add8e0dd18 100644
--- a/vcl/unx/gtk/a11y/atkbridge.cxx
+++ b/vcl/unx/gtk/a11y/atkbridge.cxx
@@ -40,10 +40,7 @@ bool InitAtkBridge(void)
{
const char* pVersion = atk_get_toolkit_version();
if( ! pVersion )
- {
- // g_warning( "unable to get gail version number" );
return false;
- }
unsigned int major, minor, micro;
diff --git a/vcl/unx/gtk/a11y/atktext.cxx b/vcl/unx/gtk/a11y/atktext.cxx
index f346a6a5a02c..e6d3276891de 100644
--- a/vcl/unx/gtk/a11y/atktext.cxx
+++ b/vcl/unx/gtk/a11y/atktext.cxx
@@ -454,6 +454,84 @@ text_wrapper_set_caret_offset (AtkText *text,
return FALSE;
}
+// --> OD 2010-03-04 #i92232#
+AtkAttributeSet*
+handle_text_markup_as_run_attribute( accessibility::XAccessibleTextMarkup* pTextMarkup,
+ const gint nTextMarkupType,
+ const gint offset,
+ AtkAttributeSet* pSet,
+ gint *start_offset,
+ gint *end_offset )
+{
+ const gint nTextMarkupCount( pTextMarkup->getTextMarkupCount( nTextMarkupType ) );
+ if ( nTextMarkupCount > 0 )
+ {
+ for ( gint nTextMarkupIndex = 0;
+ nTextMarkupIndex < nTextMarkupCount;
+ ++nTextMarkupIndex )
+ {
+ accessibility::TextSegment aTextSegment =
+ pTextMarkup->getTextMarkup( nTextMarkupIndex, nTextMarkupType );
+ const gint nStartOffsetTextMarkup = aTextSegment.SegmentStart;
+ const gint nEndOffsetTextMarkup = aTextSegment.SegmentEnd;
+ if ( nStartOffsetTextMarkup <= offset )
+ {
+ if ( offset < nEndOffsetTextMarkup )
+ {
+ // text markup at <offset>
+ *start_offset = ::std::max( *start_offset,
+ nStartOffsetTextMarkup );
+ *end_offset = ::std::min( *end_offset,
+ nEndOffsetTextMarkup );
+ switch ( nTextMarkupType )
+ {
+ case com::sun::star::text::TextMarkupType::SPELLCHECK:
+ {
+ pSet = attribute_set_prepend_misspelled( pSet );
+ }
+ break;
+ case com::sun::star::text::TextMarkupType::TRACK_CHANGE_INSERTION:
+ {
+ pSet = attribute_set_prepend_tracked_change_insertion( pSet );
+ }
+ break;
+ case com::sun::star::text::TextMarkupType::TRACK_CHANGE_DELETION:
+ {
+ pSet = attribute_set_prepend_tracked_change_deletion( pSet );
+ }
+ break;
+ case com::sun::star::text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
+ {
+ pSet = attribute_set_prepend_tracked_change_formatchange( pSet );
+ }
+ break;
+ default:
+ {
+ OSL_ASSERT( false );
+ }
+ }
+ break; // no further iteration needed.
+ }
+ else
+ {
+ *start_offset = ::std::max( *start_offset,
+ nEndOffsetTextMarkup );
+ // continue iteration.
+ }
+ }
+ else
+ {
+ *end_offset = ::std::min( *end_offset,
+ nStartOffsetTextMarkup );
+ break; // no further iteration.
+ }
+ } // eof iteration over text markups
+ }
+
+ return pSet;
+}
+// <--
+
static AtkAttributeSet *
text_wrapper_get_run_attributes( AtkText *text,
gint offset,
@@ -491,41 +569,41 @@ text_wrapper_get_run_attributes( AtkText *text,
}
}
- // Special handling for missspelled
+ // Special handling for misspelled text
+ // --> OD 2010-03-01 #i92232#
+ // - add special handling for tracked changes and refactor the
+ // corresponding code for handling misspelled text.
accessibility::XAccessibleTextMarkup* pTextMarkup = getTextMarkup( text );
if( pTextMarkup )
{
- uno::Sequence< accessibility::TextSegment > aTextSegmentSeq =
- pTextMarkup->getTextMarkupAtIndex( offset, com::sun::star::text::TextMarkupType::SPELLCHECK );
- if( aTextSegmentSeq.getLength() > 0 )
+ // Get attribute run here if it hasn't been done before
+ if( !bOffsetsAreValid )
{
- accessibility::TextSegment aTextSegment = aTextSegmentSeq[0];
- gint nStartOffsetMisspelled = aTextSegment.SegmentStart;
- gint nEndOffsetMisspelled = aTextSegment.SegmentEnd;
-
- // Get attribute run here if it hasn't been done before
- if( !bOffsetsAreValid )
- {
- accessibility::TextSegment aAttributeTextSegment =
- pText->getTextAtIndex(offset, accessibility::AccessibleTextType::ATTRIBUTE_RUN);
- *start_offset = aAttributeTextSegment.SegmentStart;
- *end_offset = aAttributeTextSegment.SegmentEnd;
- }
-
- if( nEndOffsetMisspelled <= offset )
- *start_offset = ::std::max( *start_offset, nEndOffsetMisspelled );
- else if( nStartOffsetMisspelled <= offset )
- *start_offset = ::std::max( *start_offset, nStartOffsetMisspelled );
-
- if( nStartOffsetMisspelled > offset )
- *end_offset = ::std::min( *end_offset, nStartOffsetMisspelled );
- else if( nEndOffsetMisspelled > offset )
- *end_offset = ::std::min( *end_offset, nEndOffsetMisspelled );
-
- if( nStartOffsetMisspelled <= offset && nEndOffsetMisspelled > offset )
- pSet = attribute_set_prepend_misspelled( pSet );
+ accessibility::TextSegment aAttributeTextSegment =
+ pText->getTextAtIndex(offset, accessibility::AccessibleTextType::ATTRIBUTE_RUN);
+ *start_offset = aAttributeTextSegment.SegmentStart;
+ *end_offset = aAttributeTextSegment.SegmentEnd;
}
+ // handle misspelled text
+ pSet = handle_text_markup_as_run_attribute(
+ pTextMarkup,
+ com::sun::star::text::TextMarkupType::SPELLCHECK,
+ offset, pSet, start_offset, end_offset );
+ // handle tracked changes
+ pSet = handle_text_markup_as_run_attribute(
+ pTextMarkup,
+ com::sun::star::text::TextMarkupType::TRACK_CHANGE_INSERTION,
+ offset, pSet, start_offset, end_offset );
+ pSet = handle_text_markup_as_run_attribute(
+ pTextMarkup,
+ com::sun::star::text::TextMarkupType::TRACK_CHANGE_DELETION,
+ offset, pSet, start_offset, end_offset );
+ pSet = handle_text_markup_as_run_attribute(
+ pTextMarkup,
+ com::sun::star::text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE,
+ offset, pSet, start_offset, end_offset );
}
+ // <--
}
catch(const uno::Exception& e){
diff --git a/vcl/unx/gtk/a11y/atktextattributes.cxx b/vcl/unx/gtk/a11y/atktextattributes.cxx
index 02624a9628cf..04498810597f 100644
--- a/vcl/unx/gtk/a11y/atktextattributes.cxx
+++ b/vcl/unx/gtk/a11y/atktextattributes.cxx
@@ -74,6 +74,12 @@ static AtkTextAttribute atk_text_attribute_tab_stops = ATK_TEXT_ATTR_INVALID;
static AtkTextAttribute atk_text_attribute_writing_mode = ATK_TEXT_ATTR_INVALID;
static AtkTextAttribute atk_text_attribute_vertical_align = ATK_TEXT_ATTR_INVALID;
static AtkTextAttribute atk_text_attribute_misspelled = ATK_TEXT_ATTR_INVALID;
+// --> OD 2010-03-01 #i92232#
+static AtkTextAttribute atk_text_attribute_tracked_change = ATK_TEXT_ATTR_INVALID;
+// <--
+// --> OD 2010-03-05 #i92233#
+static AtkTextAttribute atk_text_attribute_mm_to_pixel_ratio = ATK_TEXT_ATTR_INVALID;
+// <--
/*****************************************************************************/
@@ -103,6 +109,9 @@ enum ExportedAttribute
TEXT_ATTRIBUTE_STRIKETHROUGH,
TEXT_ATTRIBUTE_UNDERLINE,
TEXT_ATTRIBUTE_WEIGHT,
+ // --> OD 2010-03-05 #i92233#
+ TEXT_ATTRIBUTE_MM_TO_PIXEL_RATIO,
+ // <--
TEXT_ATTRIBUTE_JUSTIFICATION,
TEXT_ATTRIBUTE_BOTTOM_MARGIN,
TEXT_ATTRIBUTE_FIRST_LINE_INDENT,
@@ -137,6 +146,9 @@ static const char * ExportedTextAttributes[TEXT_ATTRIBUTE_LAST] =
"CharStrikeout", // TEXT_ATTRIBUTE_STRIKETHROUGH
"CharUnderline", // TEXT_ATTRIBUTE_UNDERLINE
"CharWeight", // TEXT_ATTRIBUTE_WEIGHT
+ // --> OD 2010-03-05 #i92233#
+ "MMToPixelRatio", // TEXT_ATTRIBUTE_MM_TO_PIXEL_RATIO
+ // <--
"ParaAdjust", // TEXT_ATTRIBUTE_JUSTIFICATION
"ParaBottomMargin", // TEXT_ATTRIBUTE_BOTTOM_MARGIN
"ParaFirstLineIndent", // TEXT_ATTRIBUTE_FIRST_LINE_INDENT
@@ -1293,6 +1305,14 @@ attribute_set_new_from_property_values(
attribute_set = attribute_set_prepend(attribute_set, atk_text_attribute_tab_stops,
get_value(rAttributeList, aIndexList[TEXT_ATTRIBUTE_TAB_STOPS], TabStops2String));
+ // --> OD 2010-03-05 #i92233#
+ if( ATK_TEXT_ATTR_INVALID == atk_text_attribute_mm_to_pixel_ratio )
+ atk_text_attribute_mm_to_pixel_ratio = atk_text_attribute_register("mm-to-pixel-ratio");
+
+ attribute_set = attribute_set_prepend( attribute_set, atk_text_attribute_mm_to_pixel_ratio,
+ get_value(rAttributeList, aIndexList[TEXT_ATTRIBUTE_MM_TO_PIXEL_RATIO], Float2String));
+ // <--
+
return attribute_set;
}
@@ -1308,6 +1328,49 @@ AtkAttributeSet* attribute_set_prepend_misspelled( AtkAttributeSet* attribute_se
return attribute_set;
}
+// --> OD 2010-03-01 #i92232#
+AtkAttributeSet* attribute_set_prepend_tracked_change_insertion( AtkAttributeSet* attribute_set )
+{
+ if ( ATK_TEXT_ATTR_INVALID == atk_text_attribute_tracked_change )
+ {
+ atk_text_attribute_tracked_change = atk_text_attribute_register( "text-tracked-change" );
+ }
+
+ attribute_set = attribute_set_prepend( attribute_set,
+ atk_text_attribute_tracked_change,
+ g_strdup_printf( "insertion" ) );
+
+ return attribute_set;
+}
+
+AtkAttributeSet* attribute_set_prepend_tracked_change_deletion( AtkAttributeSet* attribute_set )
+{
+ if ( ATK_TEXT_ATTR_INVALID == atk_text_attribute_tracked_change )
+ {
+ atk_text_attribute_tracked_change = atk_text_attribute_register( "text-tracked-change" );
+ }
+
+ attribute_set = attribute_set_prepend( attribute_set,
+ atk_text_attribute_tracked_change,
+ g_strdup_printf( "deletion" ) );
+
+ return attribute_set;
+}
+
+AtkAttributeSet* attribute_set_prepend_tracked_change_formatchange( AtkAttributeSet* attribute_set )
+{
+ if ( ATK_TEXT_ATTR_INVALID == atk_text_attribute_tracked_change )
+ {
+ atk_text_attribute_tracked_change = atk_text_attribute_register( "text-tracked-change" );
+ }
+
+ attribute_set = attribute_set_prepend( attribute_set,
+ atk_text_attribute_tracked_change,
+ g_strdup_printf( "attribute-change" ) );
+
+ return attribute_set;
+}
+// <--
/*****************************************************************************/
diff --git a/vcl/unx/gtk/a11y/atktextattributes.hxx b/vcl/unx/gtk/a11y/atktextattributes.hxx
index e363460bb578..9c7628bf927e 100644
--- a/vcl/unx/gtk/a11y/atktextattributes.hxx
+++ b/vcl/unx/gtk/a11y/atktextattributes.hxx
@@ -45,5 +45,10 @@ attribute_set_map_to_property_values(
com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rValueList );
AtkAttributeSet* attribute_set_prepend_misspelled( AtkAttributeSet* attribute_set );
+// --> OD 2010-03-01 #i92232#
+AtkAttributeSet* attribute_set_prepend_tracked_change_insertion( AtkAttributeSet* attribute_set );
+AtkAttributeSet* attribute_set_prepend_tracked_change_deletion( AtkAttributeSet* attribute_set );
+AtkAttributeSet* attribute_set_prepend_tracked_change_formatchange( AtkAttributeSet* attribute_set );
+// <--
#endif
diff --git a/vcl/unx/gtk/a11y/atkwindow.cxx b/vcl/unx/gtk/a11y/atkwindow.cxx
index f588c1e345e4..5448235998e8 100644
--- a/vcl/unx/gtk/a11y/atkwindow.cxx
+++ b/vcl/unx/gtk/a11y/atkwindow.cxx
@@ -143,6 +143,22 @@ ooo_window_wrapper_real_focus_gtk (GtkWidget *, GdkEventFocus *)
return FALSE;
}
+static gboolean ooo_tooltip_map( GtkWidget* pToolTip, gpointer )
+{
+ AtkObject* pAccessible = gtk_widget_get_accessible( pToolTip );
+ if( pAccessible )
+ atk_object_notify_state_change( pAccessible, ATK_STATE_SHOWING, TRUE );
+ return FALSE;
+}
+
+static gboolean ooo_tooltip_unmap( GtkWidget* pToolTip, gpointer )
+{
+ AtkObject* pAccessible = gtk_widget_get_accessible( pToolTip );
+ if( pAccessible )
+ atk_object_notify_state_change( pAccessible, ATK_STATE_SHOWING, FALSE );
+ return FALSE;
+}
+
/*****************************************************************************/
static bool
@@ -208,6 +224,16 @@ ooo_window_wrapper_real_initialize(AtkObject *obj, gpointer data)
g_signal_connect_after( GTK_WIDGET( data ), "focus-out-event",
G_CALLBACK (ooo_window_wrapper_real_focus_gtk),
NULL);
+
+ if( obj->role == ATK_ROLE_TOOL_TIP )
+ {
+ g_signal_connect_after( GTK_WIDGET( data ), "map-event",
+ G_CALLBACK (ooo_tooltip_map),
+ NULL);
+ g_signal_connect_after( GTK_WIDGET( data ), "unmap-event",
+ G_CALLBACK (ooo_tooltip_unmap),
+ NULL);
+ }
}
/*****************************************************************************/
diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx
index 5beb838c0e82..10f75309708d 100644
--- a/vcl/unx/gtk/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk/a11y/atkwrapper.cxx
@@ -283,7 +283,9 @@ static AtkRole mapToAtkRole( sal_Int16 nRole )
ATK_ROLE_RULER,
ATK_ROLE_UNKNOWN, // SECTION - registered below
ATK_ROLE_UNKNOWN, // TREE_ITEM - registered below
- ATK_ROLE_TREE_TABLE
+ ATK_ROLE_TREE_TABLE,
+ ATK_ROLE_SCROLL_PANE, // COMMENT - mapped to atk_role_scroll_pane
+ ATK_ROLE_UNKNOWN // COMMENT_END - mapped to atk_role_unknown
};
static bool initialized = false;
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index d1e5c5954352..2679f4a29c02 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -636,9 +636,6 @@ void GtkXLib::Init()
Display *pDisp = gdk_x11_display_get_xdisplay( pGdkDisp );
- XSetIOErrorHandler ( (XIOErrorHandler)X11SalData::XIOErrorHdl );
- XSetErrorHandler ( (XErrorHandler)X11SalData::XErrorHdl );
-
m_pGtkSalDisplay = new GtkSalDisplay( pGdkDisp );
gdk_window_add_filter( NULL, call_filterGdkEvent, m_pGtkSalDisplay );
@@ -800,15 +797,12 @@ void GtkXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
*/
bool bDispatchThread = false;
+ gboolean wasEvent = FALSE;
{
// release YieldMutex (and re-acquire at block end)
YieldMutexReleaser aReleaser;
if( osl_tryToAcquireMutex( m_aDispatchMutex ) )
- {
- // we are the dispatch thread
- osl_resetCondition( m_aDispatchCondition );
bDispatchThread = true;
- }
else if( ! bWait )
return; // someone else is waiting already, return
@@ -816,7 +810,7 @@ void GtkXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
if( bDispatchThread )
{
int nMaxEvents = bHandleAllCurrentEvents ? 100 : 1;
- gboolean wasEvent = FALSE, wasOneEvent = TRUE;
+ gboolean wasOneEvent = TRUE;
while( nMaxEvents-- && wasOneEvent )
{
wasOneEvent = g_main_context_iteration( NULL, FALSE );
@@ -824,17 +818,17 @@ void GtkXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
wasEvent = TRUE;
}
if( bWait && ! wasEvent )
- g_main_context_iteration( NULL, TRUE );
+ wasEvent = g_main_context_iteration( NULL, TRUE );
}
- else if( userEventFn( this ) )
+ else if( bWait )
{
/* #i41693# in case the dispatch thread hangs in join
* for this thread the condition will never be set
* workaround: timeout of 1 second a emergency exit
*/
- TimeValue aValue;
- aValue.Seconds = 1;
- aValue.Nanosec = 0;
+ // we are the dispatch thread
+ osl_resetCondition( m_aDispatchCondition );
+ TimeValue aValue = { 1, 0 };
osl_waitCondition( m_aDispatchCondition, &aValue );
}
}
@@ -842,8 +836,8 @@ void GtkXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
if( bDispatchThread )
{
osl_releaseMutex( m_aDispatchMutex );
- osl_setCondition( m_aDispatchCondition ); // trigger non dispatch thread yields
- osl_resetCondition( m_aDispatchCondition );
+ if( wasEvent )
+ osl_setCondition( m_aDispatchCondition ); // trigger non dispatch thread yields
}
}
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index de4d55b0230a..cdc72485ae6c 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -191,34 +191,34 @@ static void NWCalcArrowRect( const Rectangle& rButton, Rectangle& rArrow );
//---
static Rectangle NWGetButtonArea( int nScreen, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption );
+ const ImplControlValue& aValue, const OUString& rCaption );
//---
static Rectangle NWGetEditBoxPixmapRect( int nScreen, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption );
+ const ImplControlValue& aValue, const OUString& rCaption );
static void NWPaintOneEditBox( int nScreen, GdkDrawable * gdkDrawable, GdkRectangle *gdkRect,
ControlType nType, ControlPart nPart, Rectangle aEditBoxRect,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
//---
static Rectangle NWGetSpinButtonRect( int nScreen, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption );
+ const ImplControlValue& aValue, const OUString& rCaption );
static void NWPaintOneSpinButton( int nScreen, GdkPixmap * pixmap, ControlType nType, ControlPart nPart, Rectangle aAreaRect,
- ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ ControlState nState, const ImplControlValue& aValue,
const OUString& rCaption );
//---
static Rectangle NWGetComboBoxButtonRect( int nScreen, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption );
+ const ImplControlValue& aValue, const OUString& rCaption );
//---
static Rectangle NWGetListBoxButtonRect( int nScreen, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption );
+ const ImplControlValue& aValue, const OUString& rCaption );
static Rectangle NWGetListBoxIndicatorRect( int nScreen, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption );
+ const ImplControlValue& aValue, const OUString& rCaption );
static Rectangle NWGetToolbarRect( int nScreen,
ControlType nType,
@@ -226,7 +226,6 @@ static Rectangle NWGetToolbarRect( int nScreen,
Rectangle aAreaRect,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle,
const OUString& rCaption );
//---
@@ -620,7 +619,6 @@ BOOL GtkSalGraphics::hitTestNativeControl( ControlType nType,
ControlPart nPart,
const Region& rControlRegion,
const Point& aPos,
- SalControlHandle&,
BOOL& rIsInside )
{
if ( ( nType == CTRL_SCROLLBAR ) &&
@@ -725,7 +723,6 @@ BOOL GtkSalGraphics::hitTestNativeControl( ControlType nType,
*
* rControlRegion: The bounding region of the complete control in VCL frame coordinates.
* aValue: An optional value (tristate/numerical/string)
- * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation.
* rCaption: A caption or title string (like button text etc)
*/
BOOL GtkSalGraphics::drawNativeControl( ControlType nType,
@@ -733,13 +730,12 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType,
const Region& rControlRegion,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle,
const OUString& rCaption )
{
if( (nType==CTRL_CHECKBOX) && (nPart==PART_ENTIRE_CONTROL) &&
aValue.getTristateVal() == BUTTONVALUE_MIXED )
{
- return drawNativeMixedStateCheck( nType, nPart, rControlRegion, nState, aValue, rControlHandle, rCaption );
+ return drawNativeMixedStateCheck( nType, nPart, rControlRegion, nState, aValue, rCaption );
}
BOOL returnVal = FALSE;
@@ -802,61 +798,61 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType,
if ( (nType==CTRL_PUSHBUTTON) && (nPart==PART_ENTIRE_CONTROL) )
{
- returnVal = NWPaintGTKButton( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKButton( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if ( (nType==CTRL_RADIOBUTTON) && (nPart==PART_ENTIRE_CONTROL) )
{
- returnVal = NWPaintGTKRadio( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKRadio( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if ( (nType==CTRL_CHECKBOX) && (nPart==PART_ENTIRE_CONTROL) )
{
- returnVal = NWPaintGTKCheck( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKCheck( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if ( (nType==CTRL_SCROLLBAR) && ((nPart==PART_DRAW_BACKGROUND_HORZ) || (nPart==PART_DRAW_BACKGROUND_VERT)) )
{
- returnVal = NWPaintGTKScrollbar( nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKScrollbar( nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if ( ((nType==CTRL_EDITBOX) && ((nPart==PART_ENTIRE_CONTROL) || (nPart==HAS_BACKGROUND_TEXTURE)) )
|| ((nType==CTRL_SPINBOX) && (nPart==HAS_BACKGROUND_TEXTURE))
|| ((nType==CTRL_COMBOBOX) && (nPart==HAS_BACKGROUND_TEXTURE))
|| ((nType==CTRL_LISTBOX) && (nPart==HAS_BACKGROUND_TEXTURE)) )
{
- returnVal = NWPaintGTKEditBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKEditBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if ( ((nType==CTRL_MULTILINE_EDITBOX) && ((nPart==PART_ENTIRE_CONTROL) || (nPart==HAS_BACKGROUND_TEXTURE)) ) )
{
- returnVal = NWPaintGTKEditBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKEditBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if ( ((nType==CTRL_SPINBOX) || (nType==CTRL_SPINBUTTONS))
&& ((nPart==PART_ENTIRE_CONTROL) || (nPart==PART_ALL_BUTTONS)) )
{
- returnVal = NWPaintGTKSpinBox( nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKSpinBox( nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if ( (nType == CTRL_COMBOBOX) &&
( (nPart==PART_ENTIRE_CONTROL)
||(nPart==PART_BUTTON_DOWN)
) )
{
- returnVal = NWPaintGTKComboBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKComboBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if ( (nType==CTRL_TAB_ITEM) || (nType==CTRL_TAB_PANE) || (nType==CTRL_TAB_BODY) || (nType==CTRL_FIXEDBORDER) )
{
if ( nType == CTRL_TAB_BODY )
returnVal = TRUE;
else
- returnVal = NWPaintGTKTabItem( nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption);
+ returnVal = NWPaintGTKTabItem( nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption);
}
else if ( (nType==CTRL_LISTBOX) && ((nPart==PART_ENTIRE_CONTROL) || (nPart==PART_WINDOW)) )
{
- returnVal = NWPaintGTKListBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKListBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if ( (nType== CTRL_TOOLBAR) )
{
- returnVal = NWPaintGTKToolbar( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKToolbar( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if ( (nType== CTRL_MENUBAR) )
{
- returnVal = NWPaintGTKMenubar( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKMenubar( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if( (nType == CTRL_MENU_POPUP)
&& ( (nPart == PART_ENTIRE_CONTROL)
@@ -866,19 +862,19 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType,
)
)
{
- returnVal = NWPaintGTKPopupMenu( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKPopupMenu( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if( (nType == CTRL_TOOLTIP) && (nPart == PART_ENTIRE_CONTROL) )
{
- returnVal = NWPaintGTKTooltip( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKTooltip( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if( (nType == CTRL_PROGRESS) && (nPart == PART_ENTIRE_CONTROL) )
{
- returnVal = NWPaintGTKProgress( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKProgress( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if( (nType == CTRL_LISTNODE) && (nPart == PART_ENTIRE_CONTROL) )
{
- returnVal = NWPaintGTKListNode( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKListNode( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if( (nType == CTRL_LISTNET) && (nPart == PART_ENTIRE_CONTROL) )
{
@@ -887,7 +883,7 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType,
}
else if( (nType == CTRL_SLIDER) )
{
- returnVal = NWPaintGTKSlider( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKSlider( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
if( pixmap )
@@ -904,7 +900,6 @@ BOOL GtkSalGraphics::drawNativeMixedStateCheck( ControlType nType,
const Region& rControlRegion,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle,
const OUString& rCaption )
{
// need to emulate something for mixed state
@@ -927,7 +922,7 @@ BOOL GtkSalGraphics::drawNativeMixedStateCheck( ControlType nType,
SetClipRegion( pFontGC_, aRegion );
XDestroyRegion( aRegion );
- returnVal = drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rControlHandle, rCaption );
+ returnVal = drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rCaption );
if( returnVal )
{
@@ -938,7 +933,7 @@ BOOL GtkSalGraphics::drawNativeMixedStateCheck( ControlType nType,
XUnionRectWithRegion( &aXRect, aRegion, aRegion );
SetClipRegion( pFontGC_, aRegion );
XDestroyRegion( aRegion );
- returnVal = drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rControlHandle, rCaption );
+ returnVal = drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rCaption );
}
// clean up
@@ -957,7 +952,6 @@ BOOL GtkSalGraphics::drawNativeMixedStateCheck( ControlType nType,
*
* rControlRegion: The bounding region of the complete control in VCL frame coordinates.
* aValue: An optional value (tristate/numerical/string)
- * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation.
* rCaption: A caption or title string (like button text etc)
*/
BOOL GtkSalGraphics::drawNativeControlText( ControlType,
@@ -965,7 +959,6 @@ BOOL GtkSalGraphics::drawNativeControlText( ControlType,
const Region&,
ControlState,
const ImplControlValue&,
- SalControlHandle&,
const OUString& )
{
return( FALSE );
@@ -983,7 +976,6 @@ BOOL GtkSalGraphics::drawNativeControlText( ControlType,
*
* rControlRegion: The bounding region of the control in VCL frame coordinates.
* aValue: An optional value (tristate/numerical/string)
- * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation.
* rCaption: A caption or title string (like button text etc)
*/
BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType,
@@ -991,7 +983,6 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType,
const Region& rControlRegion,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle,
const OUString& rCaption,
Region &rNativeBoundingRegion,
Region &rNativeContentRegion )
@@ -1003,7 +994,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType,
&& (rControlRegion.GetBoundRect().GetHeight() > 16) )
{
rNativeBoundingRegion = NWGetButtonArea( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(),
- nState, aValue, rControlHandle, rCaption );
+ nState, aValue, rCaption );
rNativeContentRegion = rControlRegion;
returnVal = TRUE;
@@ -1011,7 +1002,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType,
if ( (nType==CTRL_COMBOBOX) && ((nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) )
{
rNativeBoundingRegion = NWGetComboBoxButtonRect( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), nState,
- aValue, rControlHandle, rCaption );
+ aValue, rCaption );
rNativeContentRegion = rNativeBoundingRegion;
returnVal = TRUE;
@@ -1020,7 +1011,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType,
{
rNativeBoundingRegion = NWGetSpinButtonRect( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), nState,
- aValue, rControlHandle, rCaption );
+ aValue, rCaption );
rNativeContentRegion = rNativeBoundingRegion;
returnVal = TRUE;
@@ -1028,7 +1019,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType,
if ( (nType==CTRL_LISTBOX) && ((nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) )
{
rNativeBoundingRegion = NWGetListBoxButtonRect( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), nState,
- aValue, rControlHandle, rCaption );
+ aValue, rCaption );
rNativeContentRegion = rNativeBoundingRegion;
returnVal = TRUE;
@@ -1041,7 +1032,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType,
(nPart==PART_BUTTON)
))
{
- rNativeBoundingRegion = NWGetToolbarRect( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), nState, aValue, rControlHandle, rCaption );
+ rNativeBoundingRegion = NWGetToolbarRect( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), nState, aValue, rCaption );
rNativeContentRegion = rNativeBoundingRegion;
returnVal = TRUE;
}
@@ -1155,7 +1146,7 @@ BOOL GtkSalGraphics::NWPaintGTKButton(
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue&,
- SalControlHandle&, const OUString& )
+ const OUString& )
{
GtkStateType stateType;
GtkShadowType shadowType;
@@ -1268,7 +1259,7 @@ BOOL GtkSalGraphics::NWPaintGTKButton(
static Rectangle NWGetButtonArea( int nScreen,
ControlType, ControlPart, Rectangle aAreaRect, ControlState nState,
- const ImplControlValue&, SalControlHandle&, const OUString& )
+ const ImplControlValue&, const OUString& )
{
gboolean interiorFocus;
gint focusWidth;
@@ -1324,7 +1315,7 @@ BOOL GtkSalGraphics::NWPaintGTKRadio( GdkDrawable* gdkDrawable,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState,
- const ImplControlValue& aValue, SalControlHandle&,
+ const ImplControlValue& aValue,
const OUString& )
{
GtkStateType stateType;
@@ -1383,7 +1374,7 @@ BOOL GtkSalGraphics::NWPaintGTKCheck( GdkDrawable* gdkDrawable,
const clipList& rClipList,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle&, const OUString& )
+ const OUString& )
{
GtkStateType stateType;
GtkShadowType shadowType;
@@ -1438,7 +1429,7 @@ BOOL GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList&,
ControlState nState,
- const ImplControlValue& aValue, SalControlHandle&,
+ const ImplControlValue& aValue,
const OUString& )
{
ScrollbarValue* pScrollbarVal = (ScrollbarValue *)(aValue.getOptionalVal());
@@ -1844,7 +1835,7 @@ BOOL GtkSalGraphics::NWPaintGTKEditBox( GdkDrawable* gdkDrawable,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ const ImplControlValue& aValue,
const OUString& rCaption )
{
Rectangle pixmapRect;
@@ -1853,7 +1844,7 @@ BOOL GtkSalGraphics::NWPaintGTKEditBox( GdkDrawable* gdkDrawable,
// Find the overall bounding rect of the buttons's drawing area,
// plus its actual draw rect excluding adornment
pixmapRect = NWGetEditBoxPixmapRect( m_nScreen, nType, nPart, rControlRectangle,
- nState, aValue, rControlHandle, rCaption );
+ nState, aValue, rCaption );
for( clipList::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it )
{
clipRect.x = it->Left();
@@ -1861,7 +1852,7 @@ BOOL GtkSalGraphics::NWPaintGTKEditBox( GdkDrawable* gdkDrawable,
clipRect.width = it->GetWidth();
clipRect.height = it->GetHeight();
- NWPaintOneEditBox( m_nScreen, gdkDrawable, &clipRect, nType, nPart, pixmapRect, nState, aValue, rControlHandle, rCaption );
+ NWPaintOneEditBox( m_nScreen, gdkDrawable, &clipRect, nType, nPart, pixmapRect, nState, aValue, rCaption );
}
return( TRUE );
@@ -1878,7 +1869,6 @@ static Rectangle NWGetEditBoxPixmapRect(int nScreen,
Rectangle aAreaRect,
ControlState,
const ImplControlValue&,
- SalControlHandle&,
const OUString& )
{
Rectangle pixmapRect = aAreaRect;
@@ -1915,7 +1905,6 @@ static void NWPaintOneEditBox( int nScreen,
Rectangle aEditBoxRect,
ControlState nState,
const ImplControlValue&,
- SalControlHandle&,
const OUString& )
{
GtkStateType stateType;
@@ -1984,7 +1973,7 @@ BOOL GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart,
const clipList&,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption )
+ const OUString& rCaption )
{
GdkPixmap * pixmap;
Rectangle pixmapRect;
@@ -2032,8 +2021,8 @@ BOOL GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart,
if ( !pixmap )
return( FALSE );
- upBtnRect = NWGetSpinButtonRect( m_nScreen, nType, upBtnPart, pixmapRect, upBtnState, aValue, rControlHandle, rCaption );
- downBtnRect = NWGetSpinButtonRect( m_nScreen, nType, downBtnPart, pixmapRect, downBtnState, aValue, rControlHandle, rCaption );
+ upBtnRect = NWGetSpinButtonRect( m_nScreen, nType, upBtnPart, pixmapRect, upBtnState, aValue, rCaption );
+ downBtnRect = NWGetSpinButtonRect( m_nScreen, nType, downBtnPart, pixmapRect, downBtnState, aValue, rCaption );
if ( (nType==CTRL_SPINBOX) && (nPart!=PART_ALL_BUTTONS) )
{
@@ -2043,7 +2032,7 @@ BOOL GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart,
aEditBoxRect.setX( 0 );
aEditBoxRect.setY( 0 );
- NWPaintOneEditBox( m_nScreen, pixmap, NULL, nType, nPart, aEditBoxRect, nState, aValue, rControlHandle, rCaption );
+ NWPaintOneEditBox( m_nScreen, pixmap, NULL, nType, nPart, aEditBoxRect, nState, aValue, rCaption );
}
NWSetWidgetState( gWidgetData[m_nScreen].gSpinButtonWidget, nState, stateType );
@@ -2060,8 +2049,8 @@ BOOL GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart,
shadowRect.GetWidth(), shadowRect.GetHeight() );
}
- NWPaintOneSpinButton( m_nScreen, pixmap, nType, upBtnPart, pixmapRect, upBtnState, aValue, rControlHandle, rCaption );
- NWPaintOneSpinButton( m_nScreen, pixmap, nType, downBtnPart, pixmapRect, downBtnState, aValue, rControlHandle, rCaption );
+ NWPaintOneSpinButton( m_nScreen, pixmap, nType, upBtnPart, pixmapRect, upBtnState, aValue, rCaption );
+ NWPaintOneSpinButton( m_nScreen, pixmap, nType, downBtnPart, pixmapRect, downBtnState, aValue, rCaption );
if( !NWRenderPixmapToScreen(pixmap, pixmapRect) )
{
@@ -2081,7 +2070,6 @@ static Rectangle NWGetSpinButtonRect( int nScreen,
Rectangle aAreaRect,
ControlState,
const ImplControlValue&,
- SalControlHandle&,
const OUString& )
{
gint buttonSize;
@@ -2125,7 +2113,6 @@ static void NWPaintOneSpinButton( int nScreen,
Rectangle aAreaRect,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle,
const OUString& rCaption )
{
Rectangle buttonRect;
@@ -2137,7 +2124,7 @@ static void NWPaintOneSpinButton( int nScreen,
NWEnsureGTKSpinButton( nScreen );
NWConvertVCLStateToGTKState( nState, &stateType, &shadowType );
- buttonRect = NWGetSpinButtonRect( nScreen, nType, nPart, aAreaRect, nState, aValue, rControlHandle, rCaption );
+ buttonRect = NWGetSpinButtonRect( nScreen, nType, nPart, aAreaRect, nState, aValue, rCaption );
NWSetWidgetState( gWidgetData[nScreen].gSpinButtonWidget, nState, stateType );
gtk_paint_box( gWidgetData[nScreen].gSpinButtonWidget->style, pixmap, stateType, shadowType, NULL, gWidgetData[nScreen].gSpinButtonWidget,
@@ -2169,7 +2156,7 @@ BOOL GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable,
const clipList& rClipList,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption )
+ const OUString& rCaption )
{
Rectangle pixmapRect;
Rectangle buttonRect;
@@ -2194,7 +2181,7 @@ BOOL GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable,
NWSetWidgetState( gWidgetData[m_nScreen].gComboWidget, nState, stateType );
NWSetWidgetState( gWidgetData[m_nScreen].gArrowWidget, nState, stateType );
- buttonRect = NWGetComboBoxButtonRect( m_nScreen, nType, PART_BUTTON_DOWN, pixmapRect, nState, aValue, rControlHandle, rCaption );
+ buttonRect = NWGetComboBoxButtonRect( m_nScreen, nType, PART_BUTTON_DOWN, pixmapRect, nState, aValue, rCaption );
if( nPart == PART_BUTTON_DOWN )
buttonRect.Left() += 1;
@@ -2216,7 +2203,7 @@ BOOL GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable,
if( nPart == PART_ENTIRE_CONTROL )
NWPaintOneEditBox( m_nScreen, gdkDrawable, &clipRect, nType, nPart, aEditBoxRect,
- nState, aValue, rControlHandle, rCaption );
+ nState, aValue, rCaption );
// Buttons must paint opaque since some themes have alpha-channel enabled buttons
gtk_paint_flat_box( gWidgetData[m_nScreen].gBtnWidget->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE,
@@ -2247,7 +2234,6 @@ static Rectangle NWGetComboBoxButtonRect( int nScreen,
Rectangle aAreaRect,
ControlState,
const ImplControlValue&,
- SalControlHandle&,
const OUString& )
{
Rectangle aButtonRect;
@@ -2302,7 +2288,7 @@ BOOL GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart,
const clipList&,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle&, const OUString& )
+ const OUString& )
{
GdkPixmap * pixmap;
Rectangle pixmapRect;
@@ -2444,7 +2430,7 @@ BOOL GtkSalGraphics::NWPaintGTKListBox( GdkDrawable* gdkDrawable,
const clipList& rClipList,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption )
+ const OUString& rCaption )
{
Rectangle pixmapRect;
Rectangle widgetRect;
@@ -2511,7 +2497,7 @@ BOOL GtkSalGraphics::NWPaintGTKListBox( GdkDrawable* gdkDrawable,
y+(widgetRect.Top() - pixmapRect.Top()),
widgetRect.GetWidth(), widgetRect.GetHeight() );
aIndicatorRect = NWGetListBoxIndicatorRect( m_nScreen, nType, nPart, widgetRect, nState,
- aValue, rControlHandle, rCaption );
+ aValue, rCaption );
gtk_paint_tab( gWidgetData[m_nScreen].gOptionMenuWidget->style, gdkDrawable, stateType, shadowType, &clipRect,
gWidgetData[m_nScreen].gOptionMenuWidget, "optionmenutab",
x+(aIndicatorRect.Left() - pixmapRect.Left()),
@@ -2538,7 +2524,7 @@ BOOL GtkSalGraphics::NWPaintGTKToolbar(
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle&, const OUString& )
+ const OUString& )
{
GtkStateType stateType;
GtkShadowType shadowType;
@@ -2685,7 +2671,7 @@ BOOL GtkSalGraphics::NWPaintGTKMenubar(
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue&,
- SalControlHandle&, const OUString& )
+ const OUString& )
{
GtkStateType stateType;
GtkShadowType shadowType;
@@ -2770,7 +2756,7 @@ BOOL GtkSalGraphics::NWPaintGTKPopupMenu(
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue&,
- SalControlHandle&, const OUString& )
+ const OUString& )
{
// #i50745# gtk does not draw disabled menu entries (and crux theme
// even crashes), draw them using vcl functionality.
@@ -2900,7 +2886,7 @@ BOOL GtkSalGraphics::NWPaintGTKTooltip(
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState, const ImplControlValue&,
- SalControlHandle&, const OUString& )
+ const OUString& )
{
NWEnsureGTKTooltip( m_nScreen );
@@ -2938,7 +2924,7 @@ BOOL GtkSalGraphics::NWPaintGTKListNode(
const Rectangle& rControlRectangle,
const clipList&,
ControlState nState, const ImplControlValue& rValue,
- SalControlHandle&, const OUString& )
+ const OUString& )
{
NWEnsureGTKTreeView( m_nScreen );
@@ -2992,7 +2978,7 @@ BOOL GtkSalGraphics::NWPaintGTKProgress(
const Rectangle& rControlRectangle,
const clipList&,
ControlState, const ImplControlValue& rValue,
- SalControlHandle&, const OUString& )
+ const OUString& )
{
NWEnsureGTKProgressBar( m_nScreen );
@@ -3056,7 +3042,7 @@ BOOL GtkSalGraphics::NWPaintGTKSlider(
const Rectangle& rControlRectangle,
const clipList&,
ControlState nState, const ImplControlValue& rValue,
- SalControlHandle&, const OUString& )
+ const OUString& )
{
NWEnsureGTKSlider( m_nScreen );
@@ -3185,7 +3171,6 @@ static Rectangle NWGetListBoxButtonRect( int nScreen,
Rectangle aAreaRect,
ControlState,
const ImplControlValue&,
- SalControlHandle&,
const OUString& )
{
Rectangle aPartRect;
@@ -3248,7 +3233,6 @@ static Rectangle NWGetListBoxIndicatorRect( int nScreen,
Rectangle aAreaRect,
ControlState,
const ImplControlValue&,
- SalControlHandle&,
const OUString& )
{
Rectangle aIndicatorRect;
@@ -3295,7 +3279,6 @@ static Rectangle NWGetToolbarRect( int nScreen,
Rectangle aAreaRect,
ControlState,
const ImplControlValue&,
- SalControlHandle&,
const OUString& )
{
Rectangle aRet;
@@ -3471,11 +3454,11 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
aBackColor = getColor( pMenubarStyle->bg[GTK_STATE_NORMAL] );
aStyleSet.SetMenuBarColor( aBackColor );
aBackColor = getColor( pMenuStyle->bg[GTK_STATE_NORMAL] );
- aTextColor = getColor( pMenuTextStyle->text[GTK_STATE_NORMAL] );
+ aTextColor = getColor( pMenuTextStyle->fg[GTK_STATE_NORMAL] );
aStyleSet.SetMenuColor( aBackColor );
aStyleSet.SetMenuTextColor( aTextColor );
- aTextColor = getColor( pMenubarStyle->text[GTK_STATE_NORMAL] );
+ aTextColor = getColor( pMenubarStyle->fg[GTK_STATE_NORMAL] );
aStyleSet.SetMenuBarTextColor( aTextColor );
#if OSL_DEBUG_LEVEL > 1
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index ef356eb57aa9..c6ff16f8395b 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -566,6 +566,7 @@ void GtkSalFrame::InitCommon()
m_nExtStyle = 0;
m_pRegion = NULL;
m_ePointerStyle = 0xffff;
+ m_bSetFocusOnMap = false;
gtk_widget_set_app_paintable( m_pWindow, TRUE );
gtk_widget_set_double_buffered( m_pWindow, FALSE );
@@ -690,7 +691,7 @@ static void lcl_set_accept_focus( GtkWindow* pWindow, gboolean bAccept, bool bBe
XFree( pHints );
if (GetX11SalData()->GetDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("compiz"))
- return;
+ return;
/* remove WM_TAKE_FOCUS protocol; this would usually be the
* right thing, but gtk handles it internally whereas we
@@ -803,18 +804,6 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle )
( ! (nStyle & SAL_FRAME_STYLE_FLOAT) ||
(nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION|SAL_FRAME_STYLE_FLOAT_FOCUSABLE) ) );
- /* #i100116# metacity has a peculiar behavior regarding WM_HINT accept focus and _NET_WM_USER_TIME
- at some point that may be fixed in metacity and we will have to revisit this
- */
-
- // MT/PL 2010/02: #i102694# and #i102803# have been introduced by this hack
- // Nowadays the original issue referenced above doesn't seem to exist anymore, tested different szenarious described in the issues
- // If some older versions of MetaCity are still in use somewhere, they need to be updated, instead of using strange hacks in OOo.
- // As a work around for such old systems, people might consider to not use the GTK plugin.
-
- bool bMetaCityToolWindowHack = false;
- // bMetaCityToolWindowHack = getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity") && (nStyle & SAL_FRAME_STYLE_TOOLWINDOW );
-
if( bDecoHandling )
{
bool bNoDecor = ! (nStyle & (SAL_FRAME_STYLE_MOVEABLE | SAL_FRAME_STYLE_SIZEABLE | SAL_FRAME_STYLE_CLOSEABLE ) );
@@ -830,8 +819,6 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle )
{
eType = GDK_WINDOW_TYPE_HINT_UTILITY;
gtk_window_set_skip_taskbar_hint( GTK_WINDOW(m_pWindow), true );
- if( bMetaCityToolWindowHack )
- lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, true );
}
else if( (nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) )
{
@@ -844,7 +831,8 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle )
eType = GDK_WINDOW_TYPE_HINT_UTILITY;
}
- if( (nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ) )
+ if( (nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN )
+ && getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
{
eType = GDK_WINDOW_TYPE_HINT_TOOLBAR;
gtk_window_set_keep_above( GTK_WINDOW(m_pWindow), true );
@@ -881,7 +869,7 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle )
if( bDecoHandling )
{
gtk_window_set_resizable( GTK_WINDOW(m_pWindow), (nStyle & SAL_FRAME_STYLE_SIZEABLE) ? TRUE : FALSE );
- if( ( (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION)) ) || bMetaCityToolWindowHack )
+ if( ( (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION)) ) )
lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, false );
}
@@ -1304,7 +1292,8 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate )
{
if( m_pWindow )
{
- if( m_pParent && (m_pParent->m_nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN) )
+ if( m_pParent && (m_pParent->m_nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN)
+ && getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
gtk_window_set_keep_above( GTK_WINDOW(m_pWindow), bVisible );
if( bVisible )
{
@@ -1364,23 +1353,21 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate )
//
// i.e. having a time < that of the toplevel frame means that the toplevel frame gets unfocused.
// awesome.
- if( nUserTime == 0 &&
- (
- getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity") ||
- (
- getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("compiz") &&
- (m_nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION))
- )
- )
- )
+ bool bHack =
+ getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity") ||
+ getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("compiz")
+ ;
+ if( nUserTime == 0 && bHack )
{
/* #i99360# ugly workaround an X11 library bug */
nUserTime= getDisplay()->GetLastUserEventTime( true );
//nUserTime = gdk_x11_get_server_time(GTK_WIDGET (m_pWindow)->window);
}
-
lcl_set_user_time( GTK_WIDGET(m_pWindow)->window, nUserTime );
+ if( bHack && ! bNoActivate && (m_nStyle & SAL_FRAME_STYLE_TOOLWINDOW) )
+ m_bSetFocusOnMap = true;
+
gtk_widget_show( m_pWindow );
if( isFloatGrabWindow() )
@@ -1465,6 +1452,12 @@ void GtkSalFrame::setMinMaxSize()
aHints |= GDK_HINT_MAX_SIZE;
}
}
+ if( m_bFullscreen )
+ {
+ aGeo.max_width = m_aMaxSize.Width();
+ aGeo.max_height = m_aMaxSize.Height();
+ aHints |= GDK_HINT_MAX_SIZE;
+ }
if( aHints )
gtk_window_set_geometry_hints( GTK_WINDOW(m_pWindow),
NULL,
@@ -1816,8 +1809,6 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen )
{
m_aRestorePosSize = Rectangle( Point( maGeometry.nX, maGeometry.nY ),
Size( maGeometry.nWidth, maGeometry.nHeight ) );
- // workaround different window managers have different opinions about
- // _NET_WM_STATE_FULLSCREEN (Metacity <-> KWin)
bool bVisible = GTK_WIDGET_MAPPED(m_pWindow);
if( bVisible )
Show( FALSE );
@@ -1834,12 +1825,22 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen )
gtk_window_move( GTK_WINDOW(m_pWindow),
maGeometry.nX = aNewPosSize.Left(),
maGeometry.nY = aNewPosSize.Top() );
+ // #i110881# for the benefit of compiz set a max size here
+ // else setting to fullscreen fails for unknown reasons
+ m_aMaxSize.Width() = aNewPosSize.GetWidth()+100;
+ m_aMaxSize.Height() = aNewPosSize.GetHeight()+100;
+ // workaround different legacy version window managers have different opinions about
+ // _NET_WM_STATE_FULLSCREEN (Metacity <-> KWin)
+ if( ! getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
+ gtk_window_fullscreen( GTK_WINDOW( m_pWindow ) );
if( bVisible )
Show( TRUE );
}
else
{
bool bVisible = GTK_WIDGET_MAPPED(m_pWindow);
+ if( ! getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
+ gtk_window_unfullscreen( GTK_WINDOW(m_pWindow) );
if( bVisible )
Show( FALSE );
m_nStyle &= ~SAL_FRAME_STYLE_PARTIAL_FULLSCREEN;
@@ -1862,8 +1863,11 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen )
{
if( bFullScreen )
{
- if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) )
- gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE );
+ if( getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
+ {
+ if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) )
+ gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE );
+ }
gtk_window_fullscreen( GTK_WINDOW(m_pWindow) );
moveToScreen( nScreen );
Size aScreenSize = pDisp->GetScreenSize( m_nScreen );
@@ -1875,8 +1879,11 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen )
else
{
gtk_window_unfullscreen( GTK_WINDOW(m_pWindow) );
- if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) )
- gtk_window_set_resizable( GTK_WINDOW(m_pWindow), FALSE );
+ if( getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
+ {
+ if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) )
+ gtk_window_set_resizable( GTK_WINDOW(m_pWindow), FALSE );
+ }
moveToScreen( nScreen );
}
}
@@ -2848,6 +2855,8 @@ gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, gpointer frame )
GTK_YIELD_GRAB();
+ bool bSetFocus = pThis->m_bSetFocusOnMap;
+ pThis->m_bSetFocusOnMap = false;
if( ImplGetSVData()->mbIsTestTool )
{
/* #i76541# testtool needs the focus to be in a new document
@@ -2857,9 +2866,14 @@ gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, gpointer frame )
* so this is done when running in testtool only
*/
if( ! pThis->m_pParent && (pThis->m_nStyle & SAL_FRAME_STYLE_MOVEABLE) != 0 )
- XSetInputFocus( pThis->getDisplay()->GetDisplay(),
- GDK_WINDOW_XWINDOW( GTK_WIDGET(pThis->m_pWindow)->window),
- RevertToParent, CurrentTime );
+ bSetFocus = true;
+ }
+
+ if( bSetFocus )
+ {
+ XSetInputFocus( pThis->getDisplay()->GetDisplay(),
+ GDK_WINDOW_XWINDOW( GTK_WIDGET(pThis->m_pWindow)->window),
+ RevertToParent, CurrentTime );
}
pThis->CallCallback( SALEVENT_RESIZE, NULL );
@@ -3184,6 +3198,15 @@ gboolean GtkSalFrame::signalState( GtkWidget*, GdkEvent* pEvent, gpointer frame
}
pThis->m_nState = pEvent->window_state.new_window_state;
+ #if OSL_DEBUG_LEVEL > 1
+ if( (pEvent->window_state.changed_mask & GDK_WINDOW_STATE_FULLSCREEN) )
+ {
+ fprintf( stderr, "window %p %s full screen state\n",
+ pThis,
+ (pEvent->window_state.new_window_state & GDK_WINDOW_STATE_FULLSCREEN) ? "enters" : "leaves");
+ }
+ #endif
+
return FALSE;
}
@@ -3213,7 +3236,8 @@ GtkSalFrame::IMHandler::IMHandler( GtkSalFrame* pFrame )
: m_pFrame(pFrame),
m_nPrevKeyPresses( 0 ),
m_pIMContext( NULL ),
- m_bFocused( true )
+ m_bFocused( true ),
+ m_bPreeditJustChanged( false )
{
m_aInputEvent.mpTextAttr = NULL;
createIMContext();
@@ -3388,6 +3412,8 @@ bool GtkSalFrame::IMHandler::handleKeyEvent( GdkEventKey* pEvent )
if( aDel.isDeleted() )
return true;
+ m_bPreeditJustChanged = false;
+
if( bResult )
return true;
else
@@ -3417,6 +3443,8 @@ bool GtkSalFrame::IMHandler::handleKeyEvent( GdkEventKey* pEvent )
if( aDel.isDeleted() )
return true;
+ m_bPreeditJustChanged = false;
+
std::list<PreviousKeyPress>::iterator iter = m_aPrevKeyPresses.begin();
std::list<PreviousKeyPress>::iterator iter_end = m_aPrevKeyPresses.end();
while (iter != iter_end)
@@ -3480,8 +3508,6 @@ void GtkSalFrame::IMHandler::signalIMCommit( GtkIMContext* CONTEXT_ARG, gchar* p
{
GTK_YIELD_GRAB();
- bool bWasPreedit = (pThis->m_aInputEvent.mpTextAttr != 0);
-
pThis->m_aInputEvent.mnTime = 0;
pThis->m_aInputEvent.mpTextAttr = 0;
pThis->m_aInputEvent.maText = String( pText, RTL_TEXTENCODING_UTF8 );
@@ -3505,6 +3531,9 @@ void GtkSalFrame::IMHandler::signalIMCommit( GtkIMContext* CONTEXT_ARG, gchar* p
* or because there never was a preedit.
*/
bool bSingleCommit = false;
+ bool bWasPreedit =
+ (pThis->m_aInputEvent.mpTextAttr != 0) ||
+ pThis->m_bPreeditJustChanged;
if( ! bWasPreedit
&& pThis->m_aInputEvent.maText.Len() == 1
&& ! pThis->m_aPrevKeyPresses.empty()
@@ -3519,7 +3548,6 @@ void GtkSalFrame::IMHandler::signalIMCommit( GtkIMContext* CONTEXT_ARG, gchar* p
bSingleCommit = true;
}
}
-
if( ! bSingleCommit )
{
pThis->m_pFrame->CallCallback( SALEVENT_EXTTEXTINPUT, (void*)&pThis->m_aInputEvent);
@@ -3567,6 +3595,8 @@ void GtkSalFrame::IMHandler::signalIMPreeditChanged( GtkIMContext*, gpointer im_
}
}
+ pThis->m_bPreeditJustChanged = true;
+
bool bEndPreedit = (!pText || !*pText) && pThis->m_aInputEvent.mpTextAttr != NULL;
pThis->m_aInputEvent.mnTime = 0;
pThis->m_aInputEvent.maText = String( pText, RTL_TEXTENCODING_UTF8 );
@@ -3650,6 +3680,8 @@ void GtkSalFrame::IMHandler::signalIMPreeditEnd( GtkIMContext*, gpointer im_hand
GtkSalFrame::IMHandler* pThis = (GtkSalFrame::IMHandler*)im_handler;
GTK_YIELD_GRAB();
+ pThis->m_bPreeditJustChanged = true;
+
vcl::DeletionListener aDel( pThis->m_pFrame );
pThis->doCallEndExtTextInput();
if( ! aDel.isDeleted() )
@@ -3725,8 +3757,21 @@ gboolean GtkSalFrame::IMHandler::signalIMDeleteSurrounding( GtkIMContext*, gint
if (xText.is())
{
sal_uInt32 nPosition = xText->getCaretPosition();
- xText->deleteText(nPosition + offset, nPosition + offset + nchars);
- return TRUE;
+ // --> OD 2010-06-04 #i111768# - apply patch from kstribley:
+ // range checking
+// xText->deleteText(nPosition + offset, nPosition + offset + nchars);
+ sal_Int32 nDeletePos = nPosition + offset;
+ sal_Int32 nDeleteEnd = nDeletePos + nchars;
+ if (nDeletePos < 0)
+ nDeletePos = 0;
+ if (nDeleteEnd < 0)
+ nDeleteEnd = 0;
+ if (nDeleteEnd > xText->getCharacterCount())
+ nDeleteEnd = xText->getCharacterCount();
+
+ xText->deleteText(nDeletePos, nDeleteEnd);
+ // <--
+ return TRUE;
}
return FALSE;
diff --git a/vcl/unx/headless/svpgdi.cxx b/vcl/unx/headless/svpgdi.cxx
index e65c9faf1432..68d8be7cb4eb 100644
--- a/vcl/unx/headless/svpgdi.cxx
+++ b/vcl/unx/headless/svpgdi.cxx
@@ -382,7 +382,7 @@ void SvpSalGraphics::drawPolyPolygon( sal_uInt32 nPoly,
dbgOut( m_aDevice );
}
-bool SvpSalGraphics::drawPolyLine( const ::basegfx::B2DPolygon&, const ::basegfx::B2DVector& /*rLineWidths*/, basegfx::B2DLineJoin /*eJoin*/ )
+bool SvpSalGraphics::drawPolyLine( const ::basegfx::B2DPolygon&, double /*fTransparency*/, const ::basegfx::B2DVector& /*rLineWidths*/, basegfx::B2DLineJoin /*eJoin*/ )
{
// TODO: implement and advertise OutDevSupport_B2DDraw support
return false;
diff --git a/vcl/unx/headless/svpgdi.hxx b/vcl/unx/headless/svpgdi.hxx
index 132dafaa9adf..ca1af87f8862 100644
--- a/vcl/unx/headless/svpgdi.hxx
+++ b/vcl/unx/headless/svpgdi.hxx
@@ -121,7 +121,7 @@ public:
virtual void drawLine( long nX1, long nY1, long nX2, long nY2 );
virtual void drawRect( long nX, long nY, long nWidth, long nHeight );
virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency );
- virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin );
+ virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin );
virtual void drawPolyLine( ULONG nPoints, const SalPoint* pPtAry );
virtual void drawPolygon( ULONG nPoints, const SalPoint* pPtAry );
virtual void drawPolyPolygon( sal_uInt32 nPoly,
diff --git a/vcl/unx/headless/svpinst.cxx b/vcl/unx/headless/svpinst.cxx
index 485062bf0617..466b56868900 100644
--- a/vcl/unx/headless/svpinst.cxx
+++ b/vcl/unx/headless/svpinst.cxx
@@ -55,6 +55,19 @@ extern "C"
}
}
+bool SvpSalInstance::isFrameAlive( const SalFrame* pFrame ) const
+{
+ for( std::list< SalFrame* >::const_iterator it = m_aFrames.begin();
+ it != m_aFrames.end(); ++it )
+ {
+ if( *it == pFrame )
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
SvpSalInstance* SvpSalInstance::s_pDefaultInstance = NULL;
SvpSalInstance::SvpSalInstance()
@@ -346,12 +359,15 @@ void SvpSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents )
{
for( std::list<SalUserEvent>::const_iterator it = aEvents.begin(); it != aEvents.end(); ++it )
{
- it->m_pFrame->CallCallback( it->m_nEvent, it->m_pData );
- if( it->m_nEvent == SALEVENT_RESIZE )
+ if ( isFrameAlive( it->m_pFrame ) )
{
- // this would be a good time to post a paint
- const SvpSalFrame* pSvpFrame = static_cast<const SvpSalFrame*>(it->m_pFrame);
- pSvpFrame->PostPaint();
+ it->m_pFrame->CallCallback( it->m_nEvent, it->m_pData );
+ if( it->m_nEvent == SALEVENT_RESIZE )
+ {
+ // this would be a good time to post a paint
+ const SvpSalFrame* pSvpFrame = static_cast<const SvpSalFrame*>(it->m_pFrame);
+ pSvpFrame->PostPaint();
+ }
}
}
}
diff --git a/vcl/unx/headless/svpinst.hxx b/vcl/unx/headless/svpinst.hxx
index d37c1c7e126e..284a2d11cd82 100644
--- a/vcl/unx/headless/svpinst.hxx
+++ b/vcl/unx/headless/svpinst.hxx
@@ -108,6 +108,9 @@ class SvpSalInstance : public SalInstance
std::list< SalUserEvent > m_aUserEvents;
std::list< SalFrame* > m_aFrames;
+
+ bool isFrameAlive( const SalFrame* pFrame ) const;
+
public:
static SvpSalInstance* s_pDefaultInstance;
diff --git a/vcl/unx/headless/svppspgraphics.cxx b/vcl/unx/headless/svppspgraphics.cxx
index 7f551051c1a7..6da09b38023c 100644
--- a/vcl/unx/headless/svppspgraphics.cxx
+++ b/vcl/unx/headless/svppspgraphics.cxx
@@ -323,7 +323,7 @@ void PspGraphics::drawPolyPolygon( sal_uInt32 nPoly,
m_pPrinterGfx->DrawPolyPolygon (nPoly, pPoints, (const Point**)pPtAry);
}
-bool PspGraphics::drawPolyLine( const ::basegfx::B2DPolygon&, const ::basegfx::B2DVector& /*rLineWidths*/, basegfx::B2DLineJoin /*eJoin*/ )
+bool PspGraphics::drawPolyLine( const ::basegfx::B2DPolygon&, double /*fTransparency*/, const ::basegfx::B2DVector& /*rLineWidths*/, basegfx::B2DLineJoin /*eJoin*/ )
{
// TODO: implement and advertise OutDevSupport_B2DDraw support
return false;
diff --git a/vcl/unx/headless/svppspgraphics.hxx b/vcl/unx/headless/svppspgraphics.hxx
index 82ba613615cb..063dff34c3c2 100644
--- a/vcl/unx/headless/svppspgraphics.hxx
+++ b/vcl/unx/headless/svppspgraphics.hxx
@@ -142,7 +142,7 @@ public:
virtual void drawPolyLine( ULONG nPoints, const SalPoint* pPtAry );
virtual void drawPolygon( ULONG nPoints, const SalPoint* pPtAry );
virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency );
- virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin );
+ virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin );
virtual void drawPolyPolygon( sal_uInt32 nPoly,
const sal_uInt32* pPoints,
PCONSTSALPOINT* pPtAry );
diff --git a/vcl/unx/inc/plugins/gtk/gtkframe.hxx b/vcl/unx/inc/plugins/gtk/gtkframe.hxx
index 0a91d99fd839..18dd476fc2c4 100644
--- a/vcl/unx/inc/plugins/gtk/gtkframe.hxx
+++ b/vcl/unx/inc/plugins/gtk/gtkframe.hxx
@@ -130,6 +130,7 @@ class GtkSalFrame : public SalFrame
int m_nPrevKeyPresses; // avoid using size()
GtkIMContext* m_pIMContext;
bool m_bFocused;
+ bool m_bPreeditJustChanged;
SalExtTextInputEvent m_aInputEvent;
std::vector< USHORT > m_aInputFlags;
@@ -185,6 +186,7 @@ class GtkSalFrame : public SalFrame
bool m_bDefaultSize;
bool m_bSendModChangeOnRelease;
bool m_bWindowIsGtkPlug;
+ bool m_bSetFocusOnMap;
String m_aTitle;
IMHandler* m_pIMHandler;
diff --git a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx
index ed3f782c8576..065b5435eeb0 100644
--- a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx
+++ b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx
@@ -64,15 +64,15 @@ public:
// native widget methods
virtual BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart );
virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside );
+ const Point& aPos, BOOL& rIsInside );
virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ ControlState nState, const ImplControlValue& aValue,
const rtl::OUString& rCaption );
virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const rtl::OUString& rCaption );
+ const rtl::OUString& rCaption );
virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, const rtl::OUString& rCaption,
+ const ImplControlValue& aValue, const rtl::OUString& rCaption,
Region &rNativeBoundingRegion, Region &rNativeContentRegion );
//helper methods for frame's UpdateSettings
@@ -101,86 +101,86 @@ protected:
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKRadio( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKCheck( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKScrollbar( ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKEditBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKSpinBox( ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKComboBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKTabItem( ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKListBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKToolbar( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKMenubar( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKPopupMenu( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKTooltip( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKProgress( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKSlider( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKListNode( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL drawNativeMixedStateCheck( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ ControlState nState, const ImplControlValue& aValue,
const rtl::OUString& rCaption );
};
diff --git a/vcl/unx/inc/pspgraphics.h b/vcl/unx/inc/pspgraphics.h
index 2eae73cdaa86..4b1ac12116a3 100644
--- a/vcl/unx/inc/pspgraphics.h
+++ b/vcl/unx/inc/pspgraphics.h
@@ -142,7 +142,7 @@ public:
const sal_uInt32* pPoints,
PCONSTSALPOINT* pPtAry );
virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency );
- virtual bool drawPolyLine( const basegfx::B2DPolygon&, const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin);
+ virtual bool drawPolyLine( const basegfx::B2DPolygon&, double fTransparency, const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin);
virtual sal_Bool drawPolyLineBezier( ULONG nPoints,
const SalPoint* pPtAry,
const BYTE* pFlgAry );
diff --git a/vcl/unx/inc/saldata.hxx b/vcl/unx/inc/saldata.hxx
index 3810558d470d..7e38e0a89bf2 100644
--- a/vcl/unx/inc/saldata.hxx
+++ b/vcl/unx/inc/saldata.hxx
@@ -62,6 +62,7 @@ protected:
SalXLib *pXLib_;
SalDisplay *m_pSalDisplay;
pthread_t hMainThread_;
+ rtl::OUString maLocalHostName;
public:
X11SalData();
@@ -87,6 +88,9 @@ public:
inline void StopTimer();
void Timeout() const;
+ const rtl::OUString& GetLocalHostName() const
+ { return maLocalHostName; }
+
static int XErrorHdl( Display*, XErrorEvent* );
static int XIOErrorHdl( Display* );
diff --git a/vcl/unx/inc/saldisp.hxx b/vcl/unx/inc/saldisp.hxx
index e54d6e828911..3734cbec6ef7 100644
--- a/vcl/unx/inc/saldisp.hxx
+++ b/vcl/unx/inc/saldisp.hxx
@@ -231,6 +231,7 @@ protected:
XErrorHandler m_aHandler;
};
std::vector< XErrorStackEntry > m_aXErrorHandlerStack;
+ XIOErrorHandler m_aOrigXIOErrorHandler;
public:
SalXLib();
virtual ~SalXLib();
diff --git a/vcl/unx/inc/salgdi.h b/vcl/unx/inc/salgdi.h
index da69f04b6f8f..42d9c5592317 100644
--- a/vcl/unx/inc/salgdi.h
+++ b/vcl/unx/inc/salgdi.h
@@ -57,6 +57,10 @@ class ImplLayoutArgs;
class X11FontLayout;
class ServerFontLayout;
+namespace basegfx {
+ class B2DTrapezoid;
+}
+
// -=-= SalGraphicsData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
class CairoFontsCache
@@ -289,8 +293,11 @@ public:
virtual void drawPolyPolygon( sal_uInt32 nPoly,
const sal_uInt32* pPoints,
PCONSTSALPOINT* pPtAry );
- virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPolygon, double fTransparency );
- virtual bool drawPolyLine( const ::basegfx::B2DPolygon& rPolygon, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin);
+ virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency );
+ virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin );
+ virtual bool drawFilledTrapezoids( const ::basegfx::B2DTrapezoid*, int nTrapCount, double fTransparency );
+
+#if 1 // TODO: remove these obselete methods
virtual sal_Bool drawPolyLineBezier( ULONG nPoints,
const SalPoint* pPtAry,
const BYTE* pFlgAry );
@@ -301,6 +308,8 @@ public:
const sal_uInt32* pPoints,
const SalPoint* const* pPtAry,
const BYTE* const* pFlgAry );
+#endif
+
virtual void copyArea( long nDestX,
long nDestY,
long nSrcX,
diff --git a/vcl/unx/inc/wmadaptor.hxx b/vcl/unx/inc/wmadaptor.hxx
index c628cfe091ef..cbedede2cc99 100644
--- a/vcl/unx/inc/wmadaptor.hxx
+++ b/vcl/unx/inc/wmadaptor.hxx
@@ -58,6 +58,8 @@ public:
NET_WM_NAME,
NET_WM_DESKTOP,
NET_WM_ICON_NAME,
+ NET_WM_PID,
+ NET_WM_PING,
NET_WM_STATE,
NET_WM_STATE_MAXIMIZED_HORZ,
NET_WM_STATE_MAXIMIZED_VERT,
@@ -160,6 +162,7 @@ protected:
m_aWMWorkAreas;
bool m_bTransientBehaviour;
bool m_bEnableAlwaysOnTopWorks;
+ bool m_bLegacyPartialFullscreen;
int m_nWinGravity;
int m_nInitWinGravity;
@@ -220,6 +223,18 @@ public:
virtual void setWMName( X11SalFrame* pFrame, const String& rWMName ) const;
/*
+ * set NET_WM_PID
+ */
+ virtual void setPID( X11SalFrame* pFrame ) const;
+
+ /*
+ * set WM_CLIENT_MACHINE
+ */
+ virtual void setClientMachine( X11SalFrame* pFrame ) const;
+
+ virtual void answerPing( X11SalFrame*, XClientMessageEvent* ) const;
+
+ /*
* maximizes frame
* maximization can be toggled in either direction
* to get the original position and size
@@ -231,6 +246,15 @@ public:
*/
virtual void showFullScreen( X11SalFrame* pFrame, bool bFullScreen ) const;
/*
+ * tell whether legacy partial full screen handling is necessary
+ * see #i107249#: NET_WM_STATE_FULLSCREEN is not well defined, but de facto
+ * modern WM's interpret it the "right" way, namely they make "full screen"
+ * taking twin view or Xinerama into accound and honor the positioning hints
+ * to see which screen actually was meant to use for fullscreen.
+ */
+ bool isLegacyPartialFullscreen() const
+ { return m_bLegacyPartialFullscreen; }
+ /*
* set window struts
*/
virtual void setFrameStruts( X11SalFrame*pFrame,
diff --git a/vcl/unx/kde/kdedata.cxx b/vcl/unx/kde/kdedata.cxx
index 5e2801e47fc6..34b0ff652cde 100644
--- a/vcl/unx/kde/kdedata.cxx
+++ b/vcl/unx/kde/kdedata.cxx
@@ -182,9 +182,6 @@ void KDEXLib::Init()
SalDisplay *pSalDisplay = new SalKDEDisplay( pDisp );
- XSetIOErrorHandler ( (XIOErrorHandler)X11SalData::XIOErrorHdl );
- XSetErrorHandler ( (XErrorHandler)X11SalData::XErrorHdl );
-
pInputMethod->CreateMethod( pDisp );
pInputMethod->AddConnectionWatch( pDisp, (void*)this );
pSalDisplay->SetInputMethod( pInputMethod );
diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx
index ea9161235ac9..3adc9f5c679a 100644
--- a/vcl/unx/kde/salnativewidgets-kde.cxx
+++ b/vcl/unx/kde/salnativewidgets-kde.cxx
@@ -1177,18 +1177,18 @@ class KDESalGraphics : public X11SalGraphics
virtual BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart );
virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart,
const Region& rControlRegion, const Point& aPos,
- SalControlHandle& rControlHandle, BOOL& rIsInside );
+ BOOL& rIsInside );
virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart,
const Region& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ const ImplControlValue& aValue,
const OUString& aCaption );
virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart,
const Region& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ const ImplControlValue& aValue,
const OUString& aCaption );
virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart,
const Region& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ const ImplControlValue& aValue,
const OUString& aCaption,
Region &rNativeBoundingRegion, Region &rNativeContentRegion );
};
@@ -1242,7 +1242,7 @@ BOOL KDESalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP
*/
BOOL KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart,
const Region& rControlRegion, const Point& rPos,
- SalControlHandle&, BOOL& rIsInside )
+ BOOL& rIsInside )
{
if ( nType == CTRL_SCROLLBAR )
{
@@ -1344,15 +1344,12 @@ BOOL KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart,
@param aValue
An optional value (tristate/numerical/string).
- @param rControlHandle
- Carries platform dependent data and is maintained by the SalFrame implementation.
-
@param aCaption
A caption or title string (like button text etc.)
*/
BOOL KDESalGraphics::drawNativeControl( ControlType nType, ControlPart nPart,
const Region& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle&,
+ const ImplControlValue& aValue,
const OUString& )
{
BOOL bReturn = FALSE;
@@ -1489,15 +1486,12 @@ BOOL KDESalGraphics::drawNativeControl( ControlType nType, ControlPart nPart,
@param aValue
An optional value (tristate/numerical/string)
- @param rControlHandle
- Carries platform dependent data and is maintained by the SalFrame implementation.
-
@param aCaption
A caption or title string (like button text etc.)
*/
BOOL KDESalGraphics::drawNativeControlText( ControlType, ControlPart,
const Region&, ControlState,
- const ImplControlValue&, SalControlHandle&,
+ const ImplControlValue&,
const OUString& )
{
return FALSE;
@@ -1517,15 +1511,12 @@ BOOL KDESalGraphics::drawNativeControlText( ControlType, ControlPart,
@param aValue
An optional value (tristate/numerical/string)
- @param rControlHandle
- Carries platform dependent data and is maintained by the SalFrame implementation.
-
@param aCaption
A caption or title string (like button text etc.)
*/
BOOL KDESalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart,
const Region& rControlRegion, ControlState nState,
- const ImplControlValue&, SalControlHandle&,
+ const ImplControlValue&,
const OUString&,
Region &rNativeBoundingRegion, Region &rNativeContentRegion )
{
diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx
index 25dd50ce3958..5f8b5d2ae59e 100644
--- a/vcl/unx/kde4/KDESalGraphics.cxx
+++ b/vcl/unx/kde4/KDESalGraphics.cxx
@@ -158,7 +158,7 @@ BOOL KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart par
BOOL KDESalGraphics::hitTestNativeControl( ControlType, ControlPart,
const Region&, const Point&,
- SalControlHandle&, BOOL& )
+ BOOL& )
{
return FALSE;
}
@@ -220,7 +220,7 @@ namespace
BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
const Region& rControlRegion, ControlState nControlState,
- const ImplControlValue& value, SalControlHandle&,
+ const ImplControlValue& value,
const OUString& )
{
// put not implemented types here
@@ -567,7 +567,7 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
const Region& controlRegion, ControlState controlState,
- const ImplControlValue& val, SalControlHandle&,
+ const ImplControlValue& val,
const OUString&,
Region &nativeBoundingRegion, Region &nativeContentRegion )
{
@@ -744,7 +744,7 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
{
if( part == PART_BORDER )
{
- int size = kapp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
+ int size = kapp->style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
USHORT nStyle = val.getNumericVal();
if( nStyle & FRAME_DRAW_NODRAW )
{
diff --git a/vcl/unx/kde4/KDESalGraphics.hxx b/vcl/unx/kde4/KDESalGraphics.hxx
index b5328f462a16..5661d743e0cd 100644
--- a/vcl/unx/kde4/KDESalGraphics.hxx
+++ b/vcl/unx/kde4/KDESalGraphics.hxx
@@ -59,7 +59,7 @@ class KDESalGraphics : public X11SalGraphics
*/
virtual BOOL hitTestNativeControl( ControlType type, ControlPart part,
const Region& rControlRegion, const Point& aPos,
- SalControlHandle& rControlHandle, BOOL& rIsInside );
+ BOOL& rIsInside );
/** Draw the requested control described by part/nControlState.
@param rControlRegion
@@ -68,15 +68,12 @@ class KDESalGraphics : public X11SalGraphics
@param aValue
An optional value (tristate/numerical/string).
- @param rControlHandle
- Carries platform dependent data and is maintained by the SalFrame implementation.
-
@param aCaption
A caption or title string (like button text etc.)
*/
virtual BOOL drawNativeControl( ControlType type, ControlPart part,
const Region& rControlRegion, ControlState nControlState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ const ImplControlValue& aValue,
const rtl::OUString& aCaption );
/** Draw text on the widget.
@@ -85,12 +82,11 @@ class KDESalGraphics : public X11SalGraphics
@param rControlRegion The bounding region of the complete control in VCL frame coordinates.
@param aValue An optional value (tristate/numerical/string)
- @param rControlHandle Carries platform dependent data and is maintained by the SalFrame implementation.
@param aCaption A caption or title string (like button text etc.)
*/
virtual BOOL drawNativeControlText( ControlType, ControlPart,
const Region&, ControlState,
- const ImplControlValue&, SalControlHandle&,
+ const ImplControlValue&,
const rtl::OUString& ) { return false; }
/** Check if the bounding regions match.
@@ -106,15 +102,12 @@ class KDESalGraphics : public X11SalGraphics
@param aValue
An optional value (tristate/numerical/string)
- @param rControlHandle
- Carries platform dependent data and is maintained by the SalFrame implementation.
-
@param aCaption
A caption or title string (like button text etc.)
*/
virtual BOOL getNativeControlRegion( ControlType type, ControlPart part,
const Region& rControlRegion, ControlState nControlState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ const ImplControlValue& aValue,
const rtl::OUString& aCaption,
Region &rNativeBoundingRegion, Region &rNativeContentRegion );
}; \ No newline at end of file
diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx
index 2e5b86b79f9c..6a2793b8abe3 100644
--- a/vcl/unx/kde4/KDEXLib.cxx
+++ b/vcl/unx/kde4/KDEXLib.cxx
@@ -148,9 +148,6 @@ void KDEXLib::Init()
((VCLKDEApplication*)m_pApplication)->disp = pSalDisplay;
- XSetIOErrorHandler ( (XIOErrorHandler)X11SalData::XIOErrorHdl );
- XSetErrorHandler ( (XErrorHandler)X11SalData::XErrorHdl );
-
pInputMethod->CreateMethod( pDisp );
pInputMethod->AddConnectionWatch( pDisp, (void*)this );
pSalDisplay->SetInputMethod( pInputMethod );
@@ -175,4 +172,4 @@ void KDEXLib::doStartup()
fprintf( stderr, "called KStartupInfo::appStarted()\n" );
#endif
}
-} \ No newline at end of file
+}
diff --git a/vcl/unx/source/app/keysymnames.cxx b/vcl/unx/source/app/keysymnames.cxx
index cf7f7e082e69..c9515f016433 100644
--- a/vcl/unx/source/app/keysymnames.cxx
+++ b/vcl/unx/source/app/keysymnames.cxx
@@ -637,6 +637,7 @@ const char* SalDisplay::GetKeyboardName( BOOL bRefresh )
}
}
}
+ close(kbd);
}
}
#else
diff --git a/vcl/unx/source/app/saldata.cxx b/vcl/unx/source/app/saldata.cxx
index 4155887a9875..50ef71df8619 100644
--- a/vcl/unx/source/app/saldata.cxx
+++ b/vcl/unx/source/app/saldata.cxx
@@ -276,6 +276,7 @@ X11SalData::X11SalData()
m_pPlugin = NULL;
hMainThread_ = pthread_self();
+ osl_getLocalHostname( &maLocalHostName.pData );
}
X11SalData::~X11SalData()
@@ -352,8 +353,9 @@ SalXLib::SalXLib()
nFDs_ = m_pTimeoutFDS[0] + 1;
}
- PushXErrorLevel( !!getenv( "SAL_IGNOREXERRORS" ) );
m_bHaveSystemChildFrames = false;
+ m_aOrigXIOErrorHandler = XSetIOErrorHandler ( (XIOErrorHandler)X11SalData::XIOErrorHdl );
+ PushXErrorLevel( !!getenv( "SAL_IGNOREXERRORS" ) );
}
SalXLib::~SalXLib()
@@ -363,6 +365,7 @@ SalXLib::~SalXLib()
close (m_pTimeoutFDS[1]);
PopXErrorLevel();
+ XSetIOErrorHandler (m_aOrigXIOErrorHandler);
}
void SalXLib::PushXErrorLevel( bool bIgnore )
@@ -458,8 +461,6 @@ void SalXLib::Init()
exit(0);
}
- XSetIOErrorHandler ( (XIOErrorHandler)X11SalData::XIOErrorHdl );
-
SalDisplay *pSalDisplay = new SalX11Display( pDisp );
pInputMethod->CreateMethod( pDisp );
diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx
index 2ed699ad0eb5..aa2afab93657 100644
--- a/vcl/unx/source/app/saldisp.cxx
+++ b/vcl/unx/source/app/saldisp.cxx
@@ -322,12 +322,12 @@ sal_IsLocalDisplay( Display *pDisplay )
if( pPtr != NULL )
{
- OUString aLocalHostname;
- if( osl_getLocalHostname( &aLocalHostname.pData ) == osl_Socket_Ok)
+ const OUString& rLocalHostname( GetX11SalData()->GetLocalHostName() );
+ if( rLocalHostname.getLength() )
{
*pPtr = '\0';
OUString aDisplayHostname( pDisplayHost, strlen( pDisplayHost ), osl_getThreadTextEncoding() );
- bEqual = sal_EqualHosts( aLocalHostname, aDisplayHostname );
+ bEqual = sal_EqualHosts( rLocalHostname, aDisplayHostname );
bEqual = bEqual && sal_IsDisplayNumber( pPtr + 1 );
}
}
diff --git a/vcl/unx/source/app/sm.cxx b/vcl/unx/source/app/sm.cxx
index dbaa278a780b..959d6af5912d 100644
--- a/vcl/unx/source/app/sm.cxx
+++ b/vcl/unx/source/app/sm.cxx
@@ -159,6 +159,10 @@ class ICEConnectionObserver
static int nWakeupFiles[2];
static oslMutex ICEMutex;
static oslThread ICEThread;
+#ifdef USE_SM_EXTENSION
+ static IceIOErrorHandler origIOErrorHandler;
+ static IceErrorHandler origErrorHandler;
+#endif
public:
static void activate();
@@ -179,6 +183,19 @@ oslMutex ICEConnectionObserver::ICEMutex = NULL;
oslThread ICEConnectionObserver::ICEThread = NULL;
int ICEConnectionObserver::nWakeupFiles[2] = { 0, 0 };
+#ifdef USE_SM_EXTENSION
+IceIOErrorHandler ICEConnectionObserver::origIOErrorHandler = NULL;
+IceErrorHandler ICEConnectionObserver::origErrorHandler = NULL;
+
+static void IgnoreIceErrors(IceConn, Bool, int, unsigned long, int, int, IcePointer)
+{
+}
+
+static void IgnoreIceIOErrors(IceConn)
+{
+}
+#endif
+
// HACK
bool SessionManagerClient::bDocSaveDone = false;
@@ -591,6 +608,12 @@ void ICEConnectionObserver::activate()
ICEMutex = osl_createMutex();
bIsWatching = TRUE;
#ifdef USE_SM_EXTENSION
+ /*
+ * Default handlers call exit, we don't care that strongly if something
+ * happens to fail
+ */
+ origIOErrorHandler = IceSetIOErrorHandler( IgnoreIceIOErrors );
+ origErrorHandler = IceSetErrorHandler( IgnoreIceErrors );
IceAddConnectionWatch( ICEWatchProc, NULL );
#endif
}
@@ -604,6 +627,8 @@ void ICEConnectionObserver::deactivate()
bIsWatching = FALSE;
#ifdef USE_SM_EXTENSION
IceRemoveConnectionWatch( ICEWatchProc, NULL );
+ IceSetErrorHandler( origErrorHandler );
+ IceSetIOErrorHandler( origIOErrorHandler );
#endif
nConnections = 0;
if( ICEThread )
diff --git a/vcl/unx/source/app/wmadaptor.cxx b/vcl/unx/source/app/wmadaptor.cxx
index 89c8bb56291c..1a116fcbe8d6 100644
--- a/vcl/unx/source/app/wmadaptor.cxx
+++ b/vcl/unx/source/app/wmadaptor.cxx
@@ -34,6 +34,7 @@
#include <sal/alloca.h>
#include <wmadaptor.hxx>
#include <saldisp.hxx>
+#include <saldata.hxx>
#include <salframe.h>
#include <vcl/salgdi.hxx>
#include <osl/thread.h>
@@ -118,6 +119,7 @@ static const WMAdaptorProtocol aProtocolTab[] =
{ "_NET_NUMBER_OF_DESKTOPS", WMAdaptor::NET_NUMBER_OF_DESKTOPS },
{ "_NET_WM_DESKTOP", WMAdaptor::NET_WM_DESKTOP },
{ "_NET_WM_ICON_NAME", WMAdaptor::NET_WM_ICON_NAME },
+ { "_NET_WM_PING", WMAdaptor::NET_WM_PING },
{ "_NET_WM_STATE", WMAdaptor::NET_WM_STATE },
{ "_NET_WM_STATE_ABOVE", WMAdaptor::NET_WM_STATE_STAYS_ON_TOP },
{ "_NET_WM_STATE_FULLSCREEN", WMAdaptor::NET_WM_STATE_FULLSCREEN },
@@ -179,7 +181,8 @@ static const WMAdaptorProtocol aAtomTab[] =
{ "_XSETTINGS_SETTINGS", WMAdaptor::XSETTINGS },
{ "_XEMBED", WMAdaptor::XEMBED },
{ "_XEMBED_INFO", WMAdaptor::XEMBED_INFO },
- { "_NET_WM_USER_TIME", WMAdaptor::NET_WM_USER_TIME }
+ { "_NET_WM_USER_TIME", WMAdaptor::NET_WM_USER_TIME },
+ { "_NET_WM_PID", WMAdaptor::NET_WM_PID }
};
extern "C" {
@@ -233,6 +236,7 @@ WMAdaptor::WMAdaptor( SalDisplay* pDisplay ) :
m_pSalDisplay( pDisplay ),
m_bTransientBehaviour( true ),
m_bEnableAlwaysOnTopWorks( false ),
+ m_bLegacyPartialFullscreen( false ),
m_nWinGravity( StaticGravity ),
m_nInitWinGravity( StaticGravity )
{
@@ -909,6 +913,40 @@ bool WMAdaptor::getNetWmName()
XFree( pProperty );
pProperty = NULL;
}
+ // if this is metacity, check for version to enable a legacy workaround
+ if( m_aWMName.EqualsAscii( "Metacity" ) )
+ {
+ int nVersionMajor = 0, nVersionMinor = 0;
+ Atom nVersionAtom = XInternAtom( m_pDisplay, "_METACITY_VERSION", True );
+ if( nVersionAtom )
+ {
+ if( XGetWindowProperty( m_pDisplay,
+ aWMChild,
+ nVersionAtom,
+ 0, 256,
+ False,
+ m_aWMAtoms[ UTF8_STRING ],
+ &aRealType,
+ &nFormat,
+ &nItems,
+ &nBytesLeft,
+ &pProperty ) == 0
+ && nItems != 0
+ )
+ {
+ String aMetaVersion( (sal_Char*)pProperty, nItems, RTL_TEXTENCODING_UTF8 );
+ nVersionMajor = aMetaVersion.GetToken( 0, '.' ).ToInt32();
+ nVersionMinor = aMetaVersion.GetToken( 1, '.' ).ToInt32();
+ }
+ if( pProperty )
+ {
+ XFree( pProperty );
+ pProperty = NULL;
+ }
+ }
+ if( nVersionMajor < 2 || (nVersionMajor == 2 && nVersionMinor < 12) )
+ m_bLegacyPartialFullscreen = true;
+ }
}
}
else if( pProperty )
@@ -1369,56 +1407,59 @@ void WMAdaptor::setFrameTypeAndDecoration( X11SalFrame* pFrame, WMWindowType eTy
pFrame->meWindowType = eType;
pFrame->mnDecorationFlags = nDecorationFlags;
- // set mwm hints
- struct _mwmhints {
- unsigned long flags, func, deco;
- long input_mode;
- unsigned long status;
- } aHint;
-
- aHint.flags = 15; /* flags for functions, decoration, input mode and status */
- aHint.deco = 0;
- aHint.func = 1L << 2;
- aHint.status = 0;
- aHint.input_mode = 0;
-
- // evaluate decoration flags
- if( nDecorationFlags & decoration_All )
- aHint.deco = 1, aHint.func = 1;
- else
- {
- if( nDecorationFlags & decoration_Title )
- aHint.deco |= 1L << 3;
- if( nDecorationFlags & decoration_Border )
- aHint.deco |= 1L << 1;
- if( nDecorationFlags & decoration_Resize )
- aHint.deco |= 1L << 2, aHint.func |= 1L << 1;
- if( nDecorationFlags & decoration_MinimizeBtn )
- aHint.deco |= 1L << 5, aHint.func |= 1L << 3;
- if( nDecorationFlags & decoration_MaximizeBtn )
- aHint.deco |= 1L << 6, aHint.func |= 1L << 4;
- if( nDecorationFlags & decoration_CloseBtn )
- aHint.deco |= 1L << 4, aHint.func |= 1L << 5;
- }
- // evaluate window type
- switch( eType )
+ if( ! pFrame->mbFullScreen )
{
- case windowType_ModalDialogue:
- aHint.input_mode = 1;
- break;
- default:
- break;
- }
+ // set mwm hints
+ struct _mwmhints {
+ unsigned long flags, func, deco;
+ long input_mode;
+ unsigned long status;
+ } aHint;
+
+ aHint.flags = 15; /* flags for functions, decoration, input mode and status */
+ aHint.deco = 0;
+ aHint.func = 1L << 2;
+ aHint.status = 0;
+ aHint.input_mode = 0;
+
+ // evaluate decoration flags
+ if( nDecorationFlags & decoration_All )
+ aHint.deco = 1, aHint.func = 1;
+ else
+ {
+ if( nDecorationFlags & decoration_Title )
+ aHint.deco |= 1L << 3;
+ if( nDecorationFlags & decoration_Border )
+ aHint.deco |= 1L << 1;
+ if( nDecorationFlags & decoration_Resize )
+ aHint.deco |= 1L << 2, aHint.func |= 1L << 1;
+ if( nDecorationFlags & decoration_MinimizeBtn )
+ aHint.deco |= 1L << 5, aHint.func |= 1L << 3;
+ if( nDecorationFlags & decoration_MaximizeBtn )
+ aHint.deco |= 1L << 6, aHint.func |= 1L << 4;
+ if( nDecorationFlags & decoration_CloseBtn )
+ aHint.deco |= 1L << 4, aHint.func |= 1L << 5;
+ }
+ // evaluate window type
+ switch( eType )
+ {
+ case windowType_ModalDialogue:
+ aHint.input_mode = 1;
+ break;
+ default:
+ break;
+ }
- // set the hint
- XChangeProperty( m_pDisplay,
- pFrame->GetShellWindow(),
- m_aWMAtoms[ MOTIF_WM_HINTS ],
- m_aWMAtoms[ MOTIF_WM_HINTS ],
- 32,
- PropModeReplace,
- (unsigned char*)&aHint,
- 5 );
+ // set the hint
+ XChangeProperty( m_pDisplay,
+ pFrame->GetShellWindow(),
+ m_aWMAtoms[ MOTIF_WM_HINTS ],
+ m_aWMAtoms[ MOTIF_WM_HINTS ],
+ 32,
+ PropModeReplace,
+ (unsigned char*)&aHint,
+ 5 );
+ }
// set transientFor hint
/* #91030# dtwm will not map a dialogue if the transient
@@ -2412,3 +2453,52 @@ void NetWMAdaptor::setUserTime( X11SalFrame* i_pFrame, long i_nUserTime ) const
);
}
}
+
+/*
+ * WMAdaptor::setPID
+ */
+void WMAdaptor::setPID( X11SalFrame* i_pFrame ) const
+{
+ if( m_aWMAtoms[NET_WM_PID] )
+ {
+ long nPID = (long)getpid();
+ XChangeProperty( m_pDisplay,
+ i_pFrame->GetShellWindow(),
+ m_aWMAtoms[NET_WM_PID],
+ XA_CARDINAL,
+ 32,
+ PropModeReplace,
+ (unsigned char*)&nPID,
+ 1
+ );
+ }
+}
+
+/*
+* WMAdaptor::setClientMachine
+*/
+void WMAdaptor::setClientMachine( X11SalFrame* i_pFrame ) const
+{
+ rtl::OString aWmClient( rtl::OUStringToOString( GetX11SalData()->GetLocalHostName(), RTL_TEXTENCODING_ASCII_US ) );
+ XTextProperty aClientProp = { (unsigned char*)aWmClient.getStr(), XA_STRING, 8, aWmClient.getLength() };
+ XSetWMClientMachine( m_pDisplay, i_pFrame->GetShellWindow(), &aClientProp );
+}
+
+void WMAdaptor::answerPing( X11SalFrame* i_pFrame, XClientMessageEvent* i_pEvent ) const
+{
+ if( m_aWMAtoms[NET_WM_PING] &&
+ i_pEvent->message_type == m_aWMAtoms[ WM_PROTOCOLS ] &&
+ (Atom)i_pEvent->data.l[0] == m_aWMAtoms[ NET_WM_PING ] )
+ {
+ XEvent aEvent;
+ aEvent.xclient = *i_pEvent;
+ aEvent.xclient.window = m_pSalDisplay->GetRootWindow( i_pFrame->GetScreenNumber() );
+ XSendEvent( m_pDisplay,
+ m_pSalDisplay->GetRootWindow( i_pFrame->GetScreenNumber() ),
+ False,
+ SubstructureNotifyMask | SubstructureRedirectMask,
+ &aEvent
+ );
+ XFlush( m_pDisplay );
+ }
+}
diff --git a/vcl/unx/source/dtrans/X11_selection.cxx b/vcl/unx/source/dtrans/X11_selection.cxx
index 2d63489dac3d..7f205407b21b 100644
--- a/vcl/unx/source/dtrans/X11_selection.cxx
+++ b/vcl/unx/source/dtrans/X11_selection.cxx
@@ -70,6 +70,7 @@
#include <osl/process.h>
#include <comphelper/processfactory.hxx>
+#include <vos/mutex.hxx>
#define DRAG_EVENT_MASK ButtonPressMask |\
ButtonReleaseMask |\
@@ -3807,7 +3808,10 @@ void SelectionManager::shutdown() throw()
*/
aGuard.clear();
while (osl_isThreadRunning(m_aThread))
+ {
+ vos::OGuard guard2(Application::GetSolarMutex());
Application::Reschedule();
+ }
osl_joinWithThread( m_aThread );
osl_destroyThread( m_aThread );
m_aThread = NULL;
diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx
index bc6de4fbc94a..3e24cd7c8e45 100644
--- a/vcl/unx/source/fontmanager/fontconfig.cxx
+++ b/vcl/unx/source/fontmanager/fontconfig.cxx
@@ -123,6 +123,8 @@ class FontCfgWrapper
FcPattern* (*m_pFcFontSetMatch)(FcConfig*,FcFontSet**, int, FcPattern*,FcResult*);
FcBool (*m_pFcConfigAppFontAddFile)(FcConfig*, const FcChar8*);
FcBool (*m_pFcConfigAppFontAddDir)(FcConfig*, const FcChar8*);
+ FcBool (*m_pFcConfigParseAndLoad)(FcConfig*,const FcChar8*,FcBool);
+
FcBool (*m_pFcConfigSubstitute)(FcConfig*,FcPattern*,FcMatchKind);
FcBool (*m_pFcPatternAddInteger)(FcPattern*,const char*,int);
FcBool (*m_pFcPatternAddDouble)(FcPattern*,const char*,double);
@@ -221,6 +223,9 @@ public:
{ return m_pFcConfigAppFontAddFile( pConfig, pFileName ); }
FcBool FcConfigAppFontAddDir(FcConfig* pConfig, const FcChar8* pDirName )
{ return m_pFcConfigAppFontAddDir( pConfig, pDirName ); }
+ FcBool FcConfigParseAndLoad( FcConfig* pConfig, const FcChar8* pFileName, FcBool bComplain )
+ { return m_pFcConfigParseAndLoad( pConfig, pFileName, bComplain ); }
+
void FcDefaultSubstitute( FcPattern* pPattern )
{ m_pFcDefaultSubstitute( pPattern ); }
FcPattern* FcFontSetMatch( FcConfig* pConfig, FcFontSet **ppFontSet, int nset, FcPattern* pPattern, FcResult* pResult )
@@ -326,6 +331,8 @@ FontCfgWrapper::FontCfgWrapper()
loadSymbol( "FcConfigAppFontAddFile" );
m_pFcConfigAppFontAddDir = (FcBool(*)(FcConfig*, const FcChar8*))
loadSymbol( "FcConfigAppFontAddDir" );
+ m_pFcConfigParseAndLoad = (FcBool(*)(FcConfig*, const FcChar8*, FcBool))
+ loadSymbol( "FcConfigParseAndLoad" );
m_pFcDefaultSubstitute = (void(*)(FcPattern *))
loadSymbol( "FcDefaultSubstitute" );
m_pFcFontSetMatch = (FcPattern*(*)(FcConfig*,FcFontSet**,int,FcPattern*,FcResult*))
@@ -383,6 +390,7 @@ FontCfgWrapper::FontCfgWrapper()
m_pFcPatternGetBool &&
m_pFcConfigAppFontAddFile &&
m_pFcConfigAppFontAddDir &&
+ m_pFcConfigParseAndLoad &&
m_pFcDefaultSubstitute &&
m_pFcConfigSubstitute &&
m_pFcPatternAddInteger &&
@@ -767,10 +775,14 @@ int PrintFontManager::countFontconfigFonts( std::hash_map<rtl::OString, int, rtl
// set family name
if( pUpdate->m_nFamilyName != nFamilyName )
{
+#if 0 // fontconfig prefers nameid=16 for the family name which is all fine
+ // but Writer suffers from #i79878#
+ // the only reasonable workaround for now is to use the classic nameid=1
pUpdate->m_aAliases.remove( pUpdate->m_nFamilyName );
pUpdate->m_aAliases.push_back( pUpdate->m_nFamilyName );
pUpdate->m_aAliases.remove( nFamilyName );
pUpdate->m_nFamilyName = nFamilyName;
+#endif
}
if( eWeightRes == FcResultMatch )
pUpdate->m_eWeight = convertWeight(weight);
@@ -836,13 +848,25 @@ bool PrintFontManager::addFontconfigDir( const rtl::OString& rDirName )
if( nVersion <= 20400 )
return false;
const char* pDirName = (const char*)rDirName.getStr();
- bool bRet = (rWrapper.FcConfigAppFontAddDir( rWrapper.FcConfigGetCurrent(), (FcChar8*)pDirName ) == FcTrue);
+ bool bDirOk = (rWrapper.FcConfigAppFontAddDir( rWrapper.FcConfigGetCurrent(), (FcChar8*)pDirName ) == FcTrue);
#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "FcConfigAppFontAddDir( \"%s\") => %d\n", pDirName, bRet );
+ fprintf( stderr, "FcConfigAppFontAddDir( \"%s\") => %d\n", pDirName, bDirOk );
#endif
- return bRet;
+ if( bDirOk )
+ {
+ const rtl::OString aConfFileName = rDirName + "/fc_local.conf";
+ bool bCfgOk = rWrapper.FcConfigParseAndLoad( rWrapper.FcConfigGetCurrent(),
+ (FcChar8*)aConfFileName.getStr(), FcTrue );
+ (void)bCfgOk; // silence compiler warning
+
+#if OSL_DEBUG_LEVEL > 1
+ fprintf( stderr, "FcConfigParseAndLoad( \"%s\") => %d\n", aConfFileName.getStr(), bCfgOk );
+#endif
+ }
+
+ return bDirOk;
}
static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern,
diff --git a/vcl/unx/source/fontmanager/fontmanager.cxx b/vcl/unx/source/fontmanager/fontmanager.cxx
index 93e3eef53ab3..21183dc567ec 100644
--- a/vcl/unx/source/fontmanager/fontmanager.cxx
+++ b/vcl/unx/source/fontmanager/fontmanager.cxx
@@ -40,6 +40,7 @@
#include "vcl/fontcache.hxx"
#include "vcl/fontcache.hxx"
#include "vcl/fontsubset.hxx"
+#include "vcl/impfont.hxx"
#include "vcl/strhelper.hxx"
#include "vcl/ppdparser.hxx"
#include "vcl/svdata.hxx"
@@ -3795,6 +3796,35 @@ void PrintFontManager::getGlyphWidths( fontID nFont,
free( pMetrics );
rUnicodeEnc.clear();
}
+
+ // fill the unicode map
+ // TODO: isn't this map already available elsewhere in the fontmanager?
+ const sal_uInt8* pCmapData = NULL;
+ int nCmapSize = 0;
+ if( GetSfntTable( pTTFont, O_cmap, &pCmapData, &nCmapSize ) )
+ {
+ CmapResult aCmapResult;
+ if( ParseCMAP( pCmapData, nCmapSize, aCmapResult ) )
+ {
+ const ImplFontCharMap aCharMap( aCmapResult );
+ for( sal_uInt32 cOld = 0;;)
+ {
+ // get next unicode covered by font
+ const sal_uInt32 c = aCharMap.GetNextChar( cOld );
+ if( c == cOld )
+ break;
+ cOld = c;
+#if 1 // TODO: remove when sal_Unicode covers all of unicode
+ if( c > (sal_Unicode)~0 )
+ break;
+#endif
+ // get the matching glyph index
+ const sal_uInt32 nGlyphId = aCharMap.GetGlyphIndex( c );
+ // update the requested map
+ rUnicodeEnc[ (sal_Unicode)c ] = nGlyphId;
+ }
+ }
+ }
}
CloseTTFont( pTTFont );
}
diff --git a/vcl/unx/source/gdi/pspgraphics.cxx b/vcl/unx/source/gdi/pspgraphics.cxx
index d599e09e71f2..d3eb103b9dd6 100644
--- a/vcl/unx/source/gdi/pspgraphics.cxx
+++ b/vcl/unx/source/gdi/pspgraphics.cxx
@@ -403,7 +403,7 @@ bool PspGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double /*fT
return false;
}
-bool PspGraphics::drawPolyLine( const basegfx::B2DPolygon&, const basegfx::B2DVector& /*rLineWidths*/, basegfx::B2DLineJoin /*eJoin*/)
+bool PspGraphics::drawPolyLine( const basegfx::B2DPolygon&, double /*fTranspareny*/, const basegfx::B2DVector& /*rLineWidths*/, basegfx::B2DLineJoin /*eJoin*/)
{
// TODO: a PS printer can draw B2DPolyLines almost directly
return false;
diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx
index 7637d3b2bd02..ae21c3aa9f7b 100644
--- a/vcl/unx/source/gdi/salgdi.cxx
+++ b/vcl/unx/source/gdi/salgdi.cxx
@@ -50,8 +50,9 @@
#include "basegfx/polygon/b2dpolygonclipper.hxx"
#include "basegfx/polygon/b2dlinegeometry.hxx"
#include "basegfx/matrix/b2dhommatrix.hxx"
-#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include "basegfx/matrix/b2dhommatrixtools.hxx"
#include "basegfx/polygon/b2dpolypolygoncutter.hxx"
+#include "basegfx/polygon/b2dtrapezoid.hxx"
#include <vector>
#include <queue>
@@ -1087,117 +1088,8 @@ SystemGraphicsData X11SalGraphics::GetGraphicsData() const
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-// B2DPolygon support methods
-
-namespace { // anonymous namespace to prevent export
-// the methods and structures here are used by the
-// B2DPolyPolygon->RenderTrapezoid conversion algorithm
-
-// compare two line segments
-// assumption: both segments point downward
-// assumption: they must have at least some y-overlap
-// assumption: rA.p1.y <= rB.p1.y
-bool IsLeftOf( const XLineFixed& rA, const XLineFixed& rB )
-{
- bool bAbove = (rA.p1.y <= rB.p1.y);
- const XLineFixed& rU = bAbove ? rA : rB;
- const XLineFixed& rL = bAbove ? rB : rA;
-
- const XFixed aXDiff = rU.p2.x - rU.p1.x;
- const XFixed aYDiff = rU.p2.y - rU.p1.y;
-
- // compare upper point of lower segment with line through upper segment
- if( (rU.p1.y != rL.p1.y) || (rU.p1.x != rL.p1.x) )
- {
- const sal_Int64 n1 = (sal_Int64)aXDiff * (rL.p1.y - rU.p1.y);
- const sal_Int64 n2 = (sal_Int64)aYDiff * (rL.p1.x - rU.p1.x);
- if( n1 != n2 )
- return ((n1 < n2) == bAbove);
- }
-
- // compare lower point of lower segment with line through upper segment
- if( (rU.p2.y != rL.p2.y) || (rU.p2.x != rL.p2.x) )
- {
- const sal_Int64 n3 = (sal_Int64)aXDiff * (rL.p2.y - rU.p1.y);
- const sal_Int64 n4 = (sal_Int64)aYDiff * (rL.p2.x - rU.p1.x);
- if( n3 != n4 )
- return ((n3 < n4) == bAbove);
- }
-
- // both segments overlap
- return false;
-}
-
-struct HalfTrapezoid
-{
- // assumptions:
- // maLine.p1.y <= mnY < maLine.p2.y
- XLineFixed maLine;
- XFixed mnY;
-
- XFixed getXMin() const { return std::min( maLine.p1.x, maLine.p2.x); }
- XFixed getXMax() const { return std::max( maLine.p1.x, maLine.p2.x); }
-};
-
-class HalfTrapCompare
-{
-public:
- bool operator()( const HalfTrapezoid& rA, const HalfTrapezoid& rB ) const
- {
- bool bIsTopLeft = false;
- if( rA.mnY != rB.mnY ) // sort top-first if possible
- bIsTopLeft = (rA.mnY < rB.mnY);
- else // else sort left-first
- bIsTopLeft = IsLeftOf( rA.maLine, rB.maLine );
- // adjust to priority_queue sorting convention
- return !bIsTopLeft;
- }
-};
-
-typedef std::vector< HalfTrapezoid > HTVector;
-typedef std::priority_queue< HalfTrapezoid, HTVector, HalfTrapCompare > HTQueueBase;
-// we need a priority queue with a reserve() to prevent countless reallocations
-class HTQueue
-: public HTQueueBase
-{
-public:
- void reserve( size_t n ) { c.reserve( n ); }
- void swapvec( HTVector& v ) { c.swap( v ); }
-};
-
-typedef std::vector<XTrapezoid> TrapezoidVector;
-
-class TrapezoidXCompare
-{
- const TrapezoidVector& mrVector;
-public:
- TrapezoidXCompare( const TrapezoidVector& rVector )
- : mrVector( rVector ) {}
- bool operator()( int nA, int nB ) const
- { return IsLeftOf( mrVector[nA].left, mrVector[nB].left ); }
-};
-
-typedef std::multiset< int, TrapezoidXCompare > ActiveTrapSet;
-
-class TrapezoidYCompare
-{
- const TrapezoidVector& mrVector;
-public:
- TrapezoidYCompare( const TrapezoidVector& rVector )
- : mrVector( rVector ) {}
- bool operator()( int nA, int nB ) const
- { return (mrVector[nA].bottom < mrVector[nB].bottom); }
-};
-
-typedef std::multiset< int, TrapezoidYCompare > VerticalTrapSet;
-
-#ifndef DISABLE_SOLVECROSSOVER_WORKAROUND
-void splitIntersectingSegments( HTVector&);
-#endif // DISABLE_SOLVECROSSOVER_WORKAROUND
-} // end of anonymous namespace
-
// draw a poly-polygon
-bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPolyPoly, double fTransparency)
+bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPolyPoly, double fTransparency )
{
// nothing to do for empty polypolygons
const int nOrigPolyCount = rOrigPolyPoly.count();
@@ -1219,329 +1111,66 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly
if( pRenderEnv )
return FALSE;
- // check xrender support for trapezoids
- XRenderPeer& rRenderPeer = XRenderPeer::GetInstance();
- if( !rRenderPeer.AreTrapezoidsSupported() )
- return FALSE;
- Picture aDstPic = GetXRenderPicture();
- // check xrender support for this drawable
- if( !aDstPic )
- return FALSE;
+ // snap to raster if requested
+ basegfx::B2DPolyPolygon aPolyPoly = rOrigPolyPoly;
+ const bool bSnapToRaster = !getAntiAliasB2DDraw();
+ if( bSnapToRaster )
+ aPolyPoly = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges( aPolyPoly );
// don't bother with polygons outside of visible area
const basegfx::B2DRange aViewRange( 0, 0, GetGraphicsWidth(), GetGraphicsHeight() );
- const basegfx::B2DRange aPolyRange = basegfx::tools::getRange( rOrigPolyPoly );
- const bool bNeedViewClip = aPolyRange.isInside( aViewRange );
- if( !aPolyRange.overlaps( aViewRange ) )
+ aPolyPoly = basegfx::tools::clipPolyPolygonOnRange( aPolyPoly, aViewRange, true, false );
+ if( !aPolyPoly.count() )
return true;
- // convert the polypolygon to trapezoids
-
- // prepare the polypolygon for the algorithm below:
- // - clip it against the view range
- // - make sure it contains no self-intersections
- // while we are at it guess the number of involved polygon points
- int nHTQueueReserve = 0;
- basegfx::B2DPolyPolygon aGoodPolyPoly;
- for( int nOrigPolyIdx = 0; nOrigPolyIdx < nOrigPolyCount; ++nOrigPolyIdx )
- {
- const ::basegfx::B2DPolygon aOuterPolygon = rOrigPolyPoly.getB2DPolygon( nOrigPolyIdx );
-
- // render-trapezoids should be inside the view => clip polygon against view range
- basegfx::B2DPolyPolygon aClippedPolygon( aOuterPolygon );
- if( bNeedViewClip )
- {
- aClippedPolygon = basegfx::tools::clipPolygonOnRange( aOuterPolygon, aViewRange, true, false );
- DBG_ASSERT( aClippedPolygon.count(), "polygon confirmed to overlap with view should not get here" );
- }
- const int nClippedPolyCount = aClippedPolygon.count();
- if( !nClippedPolyCount )
- continue;
-
-#ifndef DISABLE_SOLVECROSSOVER_WORKAROUND
- for( int nClippedPolyIdx = 0; nClippedPolyIdx < nClippedPolyCount; ++nClippedPolyIdx )
- {
- const ::basegfx::B2DPolygon aSolvedPolygon = aClippedPolygon.getB2DPolygon( nClippedPolyIdx );
- const int nPointCount = aSolvedPolygon.count();
- aGoodPolyPoly.append( aSolvedPolygon );
- nHTQueueReserve += aSolvedPolygon.areControlPointsUsed() ? 8 * nPointCount : nPointCount;
- }
-#else // DISABLE_SOLVECROSSOVER_WORKAROUND
- // #i103259# polypoly.solveCrossover() fails to remove self-intersections
- // but polygon.solveCrossover() works. Use it to build the intersection-free polypolygon
- // TODO: if the self-intersection prevention is too expensive make the trap-algorithm tolerate intersections
- for( int nClippedPolyIdx = 0; nClippedPolyIdx < nClippedPolyCount; ++nClippedPolyIdx )
- {
- ::basegfx::B2DPolygon aUnsolvedPolygon = aClippedPolygon.getB2DPolygon( nClippedPolyIdx );
- basegfx::B2DPolyPolygon aSolvedPolyPoly( basegfx::tools::solveCrossovers( aUnsolvedPolygon) );
- const int nSolvedPolyCount = aSolvedPolyPoly.count();
- for( int nSolvedPolyIdx = 0; nSolvedPolyIdx < nSolvedPolyCount; ++nSolvedPolyIdx )
- {
- // build the intersection-free polypolygon one by one
- const ::basegfx::B2DPolygon aSolvedPolygon = aSolvedPolyPoly.getB2DPolygon( nSolvedPolyIdx );
- aGoodPolyPoly.append( aSolvedPolygon );
- // and while we are at it use the conviently available point count to guess the number of needed half-traps
- const int nPointCount = aSolvedPolygon.count();
- nHTQueueReserve += aSolvedPolygon.areControlPointsUsed() ? 8 * nPointCount : nPointCount;
- }
- }
-#endif // DISABLE_SOLVECROSSOVER_WORKAROUND
- }
- // #i100922# try to prevent priority-queue reallocations by reservering enough
- nHTQueueReserve = ((4*nHTQueueReserve) | 0x1FFF) + 1;
- HTVector aHTVector;
- aHTVector.reserve( nHTQueueReserve );
-
- // first convert the B2DPolyPolygon to HalfTrapezoids
- const int nGoodPolyCount = aGoodPolyPoly.count();
- for( int nGoodPolyIdx = 0; nGoodPolyIdx < nGoodPolyCount; ++nGoodPolyIdx )
- {
- ::basegfx::B2DPolygon aInnerPolygon = aGoodPolyPoly.getB2DPolygon( nGoodPolyIdx );
-
- // render-trapezoids have linear edges => get rid of bezier segments
- if( aInnerPolygon.areControlPointsUsed() )
- aInnerPolygon = ::basegfx::tools::adaptiveSubdivideByDistance( aInnerPolygon, 0.125 );
-
- const int nPointCount = aInnerPolygon.count();
- if( nPointCount >= 3 )
- {
- // convert polygon point pairs to HalfTrapezoids
- // connect the polygon point with the first one if needed
- XPointFixed aOldXPF = { 0, 0 };
- XPointFixed aNewXPF;
- for( int nPointIdx = 0; nPointIdx <= nPointCount; ++nPointIdx, aOldXPF = aNewXPF )
- {
- // auto-close the polygon if needed
- const int k = (nPointIdx < nPointCount) ? nPointIdx : 0;
- const ::basegfx::B2DPoint& aPoint = aInnerPolygon.getB2DPoint( k );
-
- // convert the B2DPoint into XRENDER units
- if(getAntiAliasB2DDraw())
- {
- aNewXPF.x = XDoubleToFixed( aPoint.getX() );
- aNewXPF.y = XDoubleToFixed( aPoint.getY() );
- }
- else
- {
- aNewXPF.x = XDoubleToFixed( basegfx::fround( aPoint.getX() ) );
- aNewXPF.y = XDoubleToFixed( basegfx::fround( aPoint.getY() ) );
- }
-
- // check if enough data is available for a new HalfTrapezoid
- if( nPointIdx == 0 )
- continue;
-
- // construct HalfTrapezoid as topdown segment
- HalfTrapezoid aHT;
- if( aNewXPF.y < aOldXPF.y )
- {
- aHT.maLine.p1 = aNewXPF;
- aHT.maLine.p2 = aOldXPF;
- }
- else
- {
- aHT.maLine.p2 = aNewXPF;
- aHT.maLine.p1 = aOldXPF;
- }
-
- aHT.mnY = aHT.maLine.p1.y;
+ // tesselate the polypolygon into trapezoids
+ basegfx::B2DTrapezoidVector aB2DTrapVector;
+ basegfx::tools::trapezoidSubdivide( aB2DTrapVector, aPolyPoly );
+ const int nTrapCount = aB2DTrapVector.size();
+ const bool bDrawn = drawFilledTrapezoids( &aB2DTrapVector[0], nTrapCount, fTransparency );
+ return bDrawn;
+}
-#if 0 // ignore clipped HalfTrapezoids
- if( aHT.mnY < 0 )
- aHT.mnY = 0;
- else if( aHT.mnY > 10000 )
- continue;
-#endif
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- // queue up the HalfTrapezoid
- aHTVector.push_back( aHT );
- }
- }
- }
+bool X11SalGraphics::drawFilledTrapezoids( const ::basegfx::B2DTrapezoid* pB2DTraps, int nTrapCount, double fTransparency )
+{
+ if( nTrapCount <= 0 )
+ return true;
- if( aHTVector.empty() )
- return TRUE;
+ Picture aDstPic = GetXRenderPicture();
+ // check xrender support for this drawable
+ if( !aDstPic )
+ return false;
-#ifndef DISABLE_SOLVECROSSOVER_WORKAROUND
- // find intersecting halftraps and split them up
- // TODO: remove when solveCrossOvers gets fast enough so its use can be enabled above
- // FAQ: why should segment intersection be handled before adaptiveSubdivide()?
- // Answer: because it is conceptually much faster
- // Example: consider two intersecting circles with a diameter of 1000 pixels
- // before subdivision: eight bezier segments
- // after subdivision: more than a thousand line segments
- // since even the best generic intersection finders have a complexity of O((n+k)*log(n+k))
- // it shows that testing while the segment count is still low is a much better approach.
- splitIntersectingSegments( aHTVector);
-#endif // DISABLE_SOLVECROSSOVER_WORKAROUND
-
- // build queue from vector of intersection-free segments
- // TODO: is replacing the priority-queue by a sorted vector worth it?
- std::make_heap( aHTVector.begin(), aHTVector.end(), HalfTrapCompare());
- HTQueue aHTQueue;
- aHTQueue.swapvec( aHTVector);
-
- // then convert the HalfTrapezoids into full Trapezoids
- TrapezoidVector aTrapVector;
- aTrapVector.reserve( aHTQueue.size() * 2 ); // just a guess
-
- TrapezoidXCompare aTrapXCompare( aTrapVector );
- ActiveTrapSet aActiveTraps( aTrapXCompare );
-
- TrapezoidYCompare aTrapYCompare( aTrapVector );
- VerticalTrapSet aVerticalTraps( aTrapYCompare );
-
- while( !aHTQueue.empty() )
+ // convert the B2DTrapezoids into XRender-Trapezoids
+ typedef std::vector<XTrapezoid> TrapezoidVector;
+ TrapezoidVector aTrapVector( nTrapCount );
+ const basegfx::B2DTrapezoid* pB2DTrap = pB2DTraps;
+ for( int i = 0; i < nTrapCount; ++pB2DTrap, ++i )
{
- XTrapezoid aTrapezoid;
-
- // convert a HalfTrapezoid pair
- // get the left side of the trapezoid
- const HalfTrapezoid& rLeft = aHTQueue.top();
- aTrapezoid.top = rLeft.mnY;
- aTrapezoid.left = rLeft.maLine;
- aHTQueue.pop();
-
- // ignore left segment that would result in an empty trapezoid
- if( aTrapezoid.left.p2.y <= aTrapezoid.top )
- continue;
-
- // get the right side of the trapezoid
- aTrapezoid.right.p2.y = aTrapezoid.bottom;
- while( !aHTQueue.empty() ) {
- const HalfTrapezoid& rRight = aHTQueue.top();
- aTrapezoid.right = rRight.maLine;
- aHTQueue.pop();
- // ignore right segment that would result in an empty trapezoid
- if( aTrapezoid.right.p2.y > aTrapezoid.top )
- break;
- }
-
- // the topmost endpoint determines the trapezoid bottom
- aTrapezoid.bottom = aTrapezoid.left.p2.y;
- if( aTrapezoid.bottom > aTrapezoid.right.p2.y )
- aTrapezoid.bottom = aTrapezoid.right.p2.y;
-
- // keep the full Trapezoid candidate
- aTrapVector.push_back( aTrapezoid );
-
- // unless it splits another trapezoid that is still active
- bool bSplit = false;
- ActiveTrapSet::iterator aActiveTrapsIt = aActiveTraps.begin();
- while(aActiveTrapsIt != aActiveTraps.end())
- {
- XTrapezoid& rLeftTrap = aTrapVector[ *aActiveTrapsIt ];
-
- // skip until first overlap candidate
- // TODO: use stl::*er_bound() instead
- if( IsLeftOf( aTrapezoid.left, rLeftTrap.left) )
- {
- ++aActiveTrapsIt;
- continue;
- }
-
- // in the ActiveTrapSet there are still trapezoids where
- // a vertical overlap with new trapezoids is no longer possible
- // they could have been removed in the verticaltraps loop below
- // but this would be expensive and is not needed as we can
- // simply ignore them until we stumble upon them here.
- if( rLeftTrap.bottom <= aTrapezoid.top )
- {
- ActiveTrapSet::iterator it = aActiveTrapsIt;
- if( aActiveTrapsIt != aActiveTraps.begin() )
- {
- --aActiveTrapsIt;
- aActiveTraps.erase( it );
- ++aActiveTrapsIt;
- }
- else
- {
- aActiveTraps.erase( it );
- aActiveTrapsIt = aActiveTraps.begin();
- }
- continue;
- }
-
- // check if there is horizontal overlap
- // aTrapezoid.left==rLeftTrap.right is allowed though
- if( !IsLeftOf( aTrapezoid.left, rLeftTrap.right ) )
- {
- ++aActiveTrapsIt;
- continue;
- }
-
- // prepare to split the old trapezoid and keep its upper part
- // find the old trapezoids entry in the VerticalTrapSet and remove it
- typedef std::pair<VerticalTrapSet::iterator, VerticalTrapSet::iterator> VTSPair;
- VTSPair aVTSPair = aVerticalTraps.equal_range( *aActiveTrapsIt );
- VerticalTrapSet::iterator aVTSit = aVTSPair.first;
- for(; aVTSit != aVTSPair.second; ++aVTSit )
- {
- if( *aVTSit != *aActiveTrapsIt )
- continue;
- aVerticalTraps.erase( aVTSit );
- break;
- }
- // then update the old trapezoid's bottom
- rLeftTrap.bottom = aTrapezoid.top;
- // enter the updated old trapzoid in VerticalTrapSet
- aVerticalTraps.insert( aVerticalTraps.begin(), *aActiveTrapsIt );
- // the old trapezoid is no longer active
- aActiveTraps.erase( aActiveTrapsIt );
-
- // the trapezoid causing the split has become obsolete
- // so its both sides have to be re-queued
- HalfTrapezoid aHT;
- aHT.mnY = aTrapezoid.top;
- aHT.maLine = aTrapezoid.left;
- aHTQueue.push( aHT );
- aHT.maLine = aTrapezoid.right;
- aHTQueue.push( aHT );
-
- bSplit = true;
- break;
- }
-
- // keep or forget the resulting full Trapezoid
- if( bSplit )
- aTrapVector.pop_back();
- else
- {
- aActiveTraps.insert( aTrapVector.size()-1 );
- aVerticalTraps.insert( aTrapVector.size()-1 );
- }
-
- // mark trapezoids that can no longer be split as inactive
- // and recycle their sides which were not fully resolved
- static const XFixed nMaxTop = +0x7FFFFFFF;
- const XFixed nNewTop = aHTQueue.empty() ? nMaxTop : aHTQueue.top().mnY;
- while( !aVerticalTraps.empty() )
- {
- // check the next trapezoid to be retired
- const XTrapezoid& rOldTrap = aTrapVector[ *aVerticalTraps.begin() ];
- if( nNewTop < rOldTrap.bottom )
- break;
- // this trapezoid can no longer be split
- aVerticalTraps.erase( aVerticalTraps.begin() );
-
- // recycle its sides that were not fully resolved
- HalfTrapezoid aHT;
- aHT.mnY = rOldTrap.bottom;
-
- if( rOldTrap.left.p2.y > aHT.mnY )
- {
- aHT.maLine = rOldTrap.left;
- aHTQueue.push( aHT );
- }
- if( rOldTrap.right.p2.y > aHT.mnY )
- {
- aHT.maLine = rOldTrap.right;
- aHTQueue.push( aHT );
- }
- }
+ XTrapezoid& rTrap = aTrapVector[ i ] ;
+
+ // set y-coordinates
+ const double fY1 = pB2DTrap->getTopY();
+ rTrap.left.p1.y = rTrap.right.p1.y = rTrap.top = XDoubleToFixed( fY1 );
+ const double fY2 = pB2DTrap->getBottomY();
+ rTrap.left.p2.y = rTrap.right.p2.y = rTrap.bottom = XDoubleToFixed( fY2 );
+
+ // set x-coordinates
+ const double fXL1 = pB2DTrap->getTopXLeft();
+ rTrap.left.p1.x = XDoubleToFixed( fXL1 );
+ const double fXR1 = pB2DTrap->getTopXRight();
+ rTrap.right.p1.x = XDoubleToFixed( fXR1 );
+ const double fXL2 = pB2DTrap->getBottomXLeft();
+ rTrap.left.p2.x = XDoubleToFixed( fXL2 );
+ const double fXR2 = pB2DTrap->getBottomXRight();
+ rTrap.right.p2.x = XDoubleToFixed( fXR2 );
}
- // create xrender Picture for polygon foreground
+ // get xrender Picture for polygon foreground
+ // TODO: cache it like the target picture which uses GetXRenderPicture()
+ XRenderPeer& rRenderPeer = XRenderPeer::GetInstance();
SalDisplay::RenderEntry& rEntry = GetDisplay()->GetRenderEntries( m_nScreen )[ 32 ];
if( !rEntry.m_aPicture )
{
@@ -1569,15 +1198,17 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly
rRenderPeer.CompositeTrapezoids( PictOpOver,
rEntry.m_aPicture, aDstPic, pMaskFormat, 0, 0, &aTrapVector[0], aTrapVector.size() );
- return TRUE;
+ return true;
}
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin eLineJoin)
+bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, double fTransparency, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin eLineJoin)
{
+ const bool bIsHairline = (rLineWidth.getX() == rLineWidth.getY()) && (rLineWidth.getX() <= 1.2);
+
// #i101491#
- if(rPolygon.count() > 1000)
+ if( !bIsHairline && (rPolygon.count() > 1000) )
{
// the used basegfx::tools::createAreaGeometry is simply too
// expensive with very big polygons; fallback to caller (who
@@ -1587,33 +1218,44 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const :
// the same way.
return false;
}
- const XRenderPeer& rRenderPeer = XRenderPeer::GetInstance();
- if( !rRenderPeer.AreTrapezoidsSupported() )
- return false;
- // get the area polygon for the line polygon
+ // temporarily adjust brush color to pen color
+ // since the line is drawn as an area-polygon
+ const SalColor aKeepBrushColor = nBrushColor_;
+ nBrushColor_ = nPenColor_;
+
+ // #i11575#desc5#b adjust B2D tesselation result to raster positions
basegfx::B2DPolygon aPolygon = rPolygon;
- if( (rLineWidth.getX() != rLineWidth.getY())
- && !basegfx::fTools::equalZero( rLineWidth.getY() ) )
+ const double fHalfWidth = 0.5 * rLineWidth.getX();
+ aPolygon.transform( basegfx::tools::createTranslateB2DHomMatrix(+fHalfWidth,+fHalfWidth) );
+
+ // shortcut for hairline drawing to improve performance
+ if( bIsHairline )
{
- // prepare for createAreaGeometry() with anisotropic linewidth
- aPolygon.transform(basegfx::tools::createScaleB2DHomMatrix(1.0, rLineWidth.getX() / rLineWidth.getY()));
+ // hairlines can benefit from a simplified tesselation
+ // e.g. for hairlines the linejoin style can be ignored
+ basegfx::B2DTrapezoidVector aB2DTrapVector;
+ basegfx::tools::createLineTrapezoidFromB2DPolygon( aB2DTrapVector, aPolygon, rLineWidth.getX() );
+
+ // draw tesselation result
+ const int nTrapCount = aB2DTrapVector.size();
+ const bool bDrawOk = drawFilledTrapezoids( &aB2DTrapVector[0], nTrapCount, fTransparency );
+
+ // restore the original brush GC
+ nBrushColor_ = aKeepBrushColor;
+ return bDrawOk;
}
- // special handling for hairlines to improve the drawing performance
- // TODO: revisit after basegfx performance related changes
- const bool bIsHairline = (rLineWidth.getX() < 1.2) && (rLineWidth.getY() < 1.2);
- if( bIsHairline )
+ // get the area polygon for the line polygon
+ if( (rLineWidth.getX() != rLineWidth.getY())
+ && !basegfx::fTools::equalZero( rLineWidth.getY() ) )
{
- // for hairlines the linejoin style becomes irrelevant
- eLineJoin = basegfx::B2DLINEJOIN_NONE;
- // createAreaGeometry is still too expensive when beziers are involved
- if( aPolygon.areControlPointsUsed() )
- aPolygon = ::basegfx::tools::adaptiveSubdivideByDistance( aPolygon, 0.125 );
+ // prepare for createAreaGeometry() with anisotropic linewidth
+ aPolygon.transform( basegfx::tools::createScaleB2DHomMatrix(1.0, rLineWidth.getX() / rLineWidth.getY()));
}
// create the area-polygon for the line
- const basegfx::B2DPolyPolygon aAreaPolyPoly( basegfx::tools::createAreaGeometry(aPolygon, 0.5*rLineWidth.getX(), eLineJoin) );
+ const basegfx::B2DPolyPolygon aAreaPolyPoly( basegfx::tools::createAreaGeometry(aPolygon, fHalfWidth, eLineJoin) );
if( (rLineWidth.getX() != rLineWidth.getY())
&& !basegfx::fTools::equalZero( rLineWidth.getX() ) )
@@ -1622,11 +1264,6 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const :
aPolygon.transform(basegfx::tools::createScaleB2DHomMatrix(1.0, rLineWidth.getY() / rLineWidth.getX()));
}
- // temporarily adjust brush color to pen color
- // since the line is drawn as an area-polygon
- const SalColor aKeepBrushColor = nBrushColor_;
- nBrushColor_ = nPenColor_;
-
// draw each area polypolygon component individually
// to emulate the polypolygon winding rule "non-zero"
bool bDrawOk = true;
@@ -1634,7 +1271,7 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const :
for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx )
{
const ::basegfx::B2DPolyPolygon aOnePoly( aAreaPolyPoly.getB2DPolygon( nPolyIdx ) );
- bDrawOk = drawPolyPolygon( aOnePoly, 0.0);
+ bDrawOk = drawPolyPolygon( aOnePoly, fTransparency );
if( !bDrawOk )
break;
}
@@ -1646,259 +1283,3 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const :
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-#ifndef DISABLE_SOLVECROSSOVER_WORKAROUND
-// TODO: move the intersection solver into basegfx
-// and then support bezier-intersection finding too
-
-namespace { // anonymous namespace to prevent export
-
-typedef HalfTrapezoid LineSeg;
-typedef HTVector LSVector;
-
-inline bool operator==( const LineSeg& r1, const LineSeg& r2)
-{
- if( r1.maLine.p2.y != r2.maLine.p2.y) return false;
- if( r1.maLine.p2.x != r2.maLine.p2.x) return false;
- if( r1.maLine.p1.y != r2.maLine.p1.y) return false;
- if( r1.maLine.p1.x != r2.maLine.p1.x) return false;
- return true;
-}
-
-struct LSYMinCmp
-{
- bool operator()( const LineSeg& r1, const LineSeg& r2) const
- { return r2.maLine.p1.y < r1.maLine.p1.y; }
-};
-
-struct LSYMaxCmp
-{
- bool operator()( const LineSeg& r1, const LineSeg& r2) const
- { return r2.maLine.p2.y < r1.maLine.p2.y; }
-};
-
-struct LSXMinCmp
-{
- bool operator()( const LineSeg& r1, const LineSeg& r2) const
- { return( r1.getXMin() < r2.getXMin()); }
-};
-
-struct CutPoint
-{
- XFixed mnSegmentId;
- float mfCutParam;
- XPointFixed maPoint;
-};
-
-struct CutPointCmp
-{
- bool operator()( const CutPoint& r1, const CutPoint& r2) const
- {
- if( r1.mnSegmentId != r2.mnSegmentId)
- return (r1.mnSegmentId < r2.mnSegmentId);
- return (r1.mfCutParam < r2.mfCutParam);
- }
-};
-
-bool findIntersection( const LineSeg& rLS1, const LineSeg& rLS2, CutPoint aCutPoints[2])
-{
- // segments intersect at r1.p1 + s*(r1.p2-r1.p1) == r2.p1 + t*(r2.p2-r2.p1)
- // when both segment-parameters are ((0 <s<1) && (0<t<1))
- // (r1.p1 - r2.p1) == s * (r1.p1 - r1.p2) + t * (r2.p2 - r2.p1)
- // =>
- // (r1.p1x - r2.p1x) == s * (r1.p1x - r1.p2x) + t * (r2.p2x - r2.p1x)
- // (r1.p1y - r2.p1y) == s * (r1.p1y - r1.p2y) + t * (r2.p2y - r2.p1y)
- // check if lines are identical or parallel => not intersecting
- const XLineFixed& r1 = rLS1.maLine;
- const XLineFixed& r2 = rLS2.maLine;
- const double fDet = (double)(r1.p1.x - r1.p2.x) * (r2.p2.y - r2.p1.y)
- - (double)(r2.p2.x - r2.p1.x) * (r1.p1.y - r1.p2.y);
- static const double fEps = 1e-8;
- if( fabs(fDet) < fEps)
- return false;
- // check if intersecting with first segment
- const double fS1 = (double)(r2.p2.y - r2.p1.y) * (r1.p1.x - r2.p1.x);
- const double fS2 = (double)(r2.p2.x - r2.p1.x) * (r2.p1.y - r1.p1.y);
- const double fS = (fS1 + fS2) / fDet;
- if( (fS <= +fEps) || (fS >= 1-fEps))
- return false;
- // check if intersecting with second segment
- const double fT1 = (double)(r1.p2.y - r1.p1.y) * (r1.p1.x - r2.p1.x);
- const double fT2 = (double)(r1.p2.x - r1.p1.x) * (r2.p1.y - r1.p1.y);
- const double fT = (fT1 + fT2) / fDet;
- if( (fT <= +fEps) || (fT >= 1-fEps))
- return false;
- // force the intersection point to be exactly identical on both segments
- aCutPoints[0].maPoint.x = (XFixed)(r1.p1.x + fS * (r1.p2.x - r1.p1.x));
- aCutPoints[0].maPoint.y = (XFixed)(r1.p1.y + fS * (r1.p2.y - r1.p1.y));
- aCutPoints[1].maPoint.x = aCutPoints[0].maPoint.x;
- aCutPoints[1].maPoint.y = aCutPoints[0].maPoint.y;
- aCutPoints[0].mnSegmentId = rLS1.mnY;
- aCutPoints[0].mfCutParam = (float)fS;
- aCutPoints[1].mnSegmentId = rLS2.mnY;
- aCutPoints[1].mfCutParam = (float)fT;
- return true;
-}
-
-typedef std::priority_queue< LineSeg, LSVector, LSYMinCmp> LSYMinQueueBase;
-typedef std::priority_queue< LineSeg, LSVector, LSYMaxCmp> LSYMaxQueueBase;
-typedef std::multiset< LineSeg, LSXMinCmp> LSXMinSet;
-typedef std::set< CutPoint, CutPointCmp> CutPointSet;
-
-class LSYMinQueue : public LSYMinQueueBase
-{
-public:
- void reserve( size_t n) { c.reserve(n);}
- void swapvec( LSVector& v) { c.swap(v);}
-};
-
-class LSYMaxQueue : public LSYMaxQueueBase
-{
-public:
- void reserve( size_t n) { c.reserve(n);}
-};
-
-void addAndCutSegment( LSVector& rLSVector, const LineSeg& rLS, CutPointSet& rCutPointSet)
-{
- // short circuit when no segment was cut
- if( rCutPointSet.empty()) {
- rLSVector.push_back( rLS);
- return;
- }
-
- // find the first cut point for this segment
- LineSeg aCS = rLS;
- CutPoint aMinCutPoint;
- aMinCutPoint.mnSegmentId = rLS.mnY;
- aMinCutPoint.mfCutParam = 0.0;
- CutPointSet::iterator itFirst = rCutPointSet.lower_bound( aMinCutPoint);
- CutPointSet::iterator it = itFirst;
- // iterate through all cut points of this segment
- for(; it != rCutPointSet.end(); ++it) {
- const CutPoint rCutPoint = (*it);
- if( rCutPoint.mnSegmentId != rLS.mnY)
- break;
- // cut segment at the cutpoint
- aCS.maLine.p2 = rCutPoint.maPoint;
- rLSVector.push_back( aCS);
- // prepare for next segment cut
- aCS.maLine.p1 = aCS.maLine.p2;
- }
- // remove cutparams that will no longer be needed
- // TODO: is it worth it or should we just keep the cutparams?
- rCutPointSet.erase( itFirst, it);
-
- // add segment part remaining after last cut
- aCS.maLine.p2 = rLS.maLine.p2;
- rLSVector.push_back( aCS);
-}
-
-void splitIntersectingSegments( LSVector& rLSVector)
-{
- // get a unique id for each lineseg, temporarily abuse the mnY member
- LSVector::iterator aLSit = rLSVector.begin();
- for( int i = 0; aLSit != rLSVector.end(); ++aLSit) {
- LineSeg& rLS = *aLSit;
- rLS.mnY = i++;
- }
- // get an y-sorted queue from the input vector
- LSYMinQueue aYMinQueue;
- std::make_heap( rLSVector.begin(), rLSVector.end(), LSYMinCmp());
- aYMinQueue.swapvec( rLSVector);
-
- // prepare the result vector
- // try to avoid reallocations by guessing a reasonable result size
- rLSVector.reserve( aYMinQueue.size() * 3/2 );
-
- // find all intersections
- CutPointSet aCutPointSet;
- LSXMinSet aXMinSet;
- LSYMaxQueue aYMaxQueue;
- aYMaxQueue.reserve( aYMinQueue.size());
- // sweep-down and check all segment-pairs that overlap
- while( !aYMinQueue.empty()) {
- // get next input-segment
- const LineSeg& rLS = aYMinQueue.top();
- // retire obsoleted segments
- const XFixed fYCur = rLS.maLine.p1.y;
- while( !aYMaxQueue.empty()) {
- // check next segment to be retired
- const LineSeg& rOS = aYMaxQueue.top();
- if( fYCur < rOS.maLine.p2.y)
- break;
- // emit resolved segment into result
- addAndCutSegment( rLSVector, rOS, aCutPointSet);
- // find segment to be retired in xmin-compare-set
- LSXMinSet::iterator itR = aXMinSet.lower_bound( rOS);
- while( !(*itR == rOS)) ++itR;
- // retire segment from xmin-compare-set
- aXMinSet.erase( itR);
- // this segment is pining for the fjords
- aYMaxQueue.pop();
- }
-
- // iterate over all segments that might overlap
- // skip over the leftmost segments that cannot overlap
- const XFixed fXMax = rLS.getXMax();
- LSXMinSet::const_iterator itC = aXMinSet.begin();
- for(; itC != aXMinSet.end(); ++itC)
- if( (*itC).getXMin() <= fXMax)
- break;
- // TODO: if the linear search becomes too expensive
- // then use an XMaxQueue based approach to replace it
- const XFixed fXMin = rLS.getXMin();
- for(; itC != aXMinSet.end(); ++itC) {
- const LineSeg& rOS = *itC;
- if( fXMin >= rOS.getXMax())
- continue;
- if( fXMax < rOS.getXMin())
- break;
- CutPoint aCutPoints[2];
- if( !findIntersection( rLS, rOS, aCutPoints))
- continue;
- // remember cut parameters
- // TODO: std::set seems to use individual allocations
- // which results in perf-problems for many entries
- // => pre-allocate nodes by using a non-default allocator
- aCutPointSet.insert( aCutPoints[0]);
- aCutPointSet.insert( aCutPoints[1]);
- }
- // add segment to xmin-compare-set
- // TODO: do we have a good insertion hint?
- aXMinSet.insert( /*itC,*/ rLS);
- // register segment for retirement
- aYMaxQueue.push( rLS);
- aYMinQueue.pop();
- }
-
- // retire the remaining segments
- aXMinSet.clear();
- while( !aYMaxQueue.empty()) {
- // emit segments and cut them up if needed
- const LineSeg& rLS = aYMaxQueue.top();
- addAndCutSegment( rLSVector, rLS, aCutPointSet);
- aYMaxQueue.pop();
- }
-
- // get the segments ready to be consumed by the drawPolygon() caller
- aLSit = rLSVector.begin();
- LSVector::iterator aLSit2 = aLSit;
- for(; aLSit != rLSVector.end(); ++aLSit) {
- LineSeg& rLS = *aLSit;
- // restore the segment top member
- rLS.mnY = rLS.maLine.p1.y;
- // remove horizontal segments for now
- // TODO: until the trapezoid converter is adjusted to handle them
- if( rLS.maLine.p1.y == rLS.maLine.p2.y )
- continue;
- *(aLSit2++) = rLS;
- }
- if(aLSit2 != aLSit)
- rLSVector.resize( aLSit2 - rLSVector.begin() );
-}
-
-} // end anonymous namespace
-
-#endif // DISABLE_SOLVECROSSOVER_WORKAROUND
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx
index 7cf2009a3e07..6024b66f6010 100644
--- a/vcl/unx/source/gdi/salgdi3.cxx
+++ b/vcl/unx/source/gdi/salgdi3.cxx
@@ -641,13 +641,11 @@ bool X11SalGraphics::setFont( const ImplFontSelectData *pEntry, int nFallbackLev
mpServerFont[ nFallbackLevel ] = pServerFont;
// apply font specific-hint settings if needed
+ // TODO: also disable it for reference devices
if( !bPrinter_ )
{
- // TODO: is it worth it to cache the hint settings, e.g. in the ImplFontEntry?
- ImplFontOptions aFontOptions;
- bool GetFCFontOptions( const ImplFontAttributes&, int nSize, ImplFontOptions&);
- if( GetFCFontOptions( *pEntry->mpFontData, pEntry->mnHeight, aFontOptions ) )
- pServerFont->SetFontOptions( aFontOptions );
+ ImplServerFontEntry* pSFE = static_cast<ImplServerFontEntry*>( pEntry->mpFontEntry );
+ pSFE->HandleFontOptions();
}
return true;
@@ -656,6 +654,24 @@ bool X11SalGraphics::setFont( const ImplFontSelectData *pEntry, int nFallbackLev
return false;
}
+void ImplServerFontEntry::HandleFontOptions( void )
+{
+ bool GetFCFontOptions( const ImplFontAttributes&, int nSize, ImplFontOptions& );
+
+ if( !mpServerFont )
+ return;
+ if( !mbGotFontOptions )
+ {
+ // get and cache the font options
+ mbGotFontOptions = true;
+ mbValidFontOptions = GetFCFontOptions( *maFontSelData.mpFontData,
+ maFontSelData.mnHeight, maFontOptions );
+ }
+ // apply the font options
+ if( mbValidFontOptions )
+ mpServerFont->SetFontOptions( maFontOptions );
+}
+
//--------------------------------------------------------------------------
inline sal_Unicode SwapBytes( const sal_Unicode nIn )
@@ -1633,11 +1649,13 @@ void X11SalGraphics::GetDevFontSubstList( OutputDevice* )
void cairosubcallback( void* pPattern )
{
CairoWrapper& rCairo = CairoWrapper::get();
- if( rCairo.isValid() )
- {
+ if( !rCairo.isValid() )
+ return;
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
- rCairo.ft_font_options_substitute( rStyleSettings.GetCairoFontOptions(), pPattern);
- }
+ const void* pFontOptions = rStyleSettings.GetCairoFontOptions();
+ if( !pFontOptions )
+ return;
+ rCairo.ft_font_options_substitute( pFontOptions, pPattern );
}
bool GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize,
@@ -1664,7 +1682,6 @@ bool GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize,
default:
aInfo.m_eItalic = psp::italic::Unknown;
break;
-
}
// set weight
switch( rFontAttributes.GetWeight() )
@@ -1740,7 +1757,6 @@ bool GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize,
const psp::PrintFontManager& rPFM = psp::PrintFontManager::get();
bool bOK = rPFM.getFontOptions( aInfo, nSize, cairosubcallback, rFontOptions);
-
return bOK;
}
@@ -2025,7 +2041,7 @@ static ImplFontSelectData GetFcSubstitute(const ImplFontSelectData &rFontSelData
{
ImplFontSelectData aRet(rFontSelData);
- const rtl::OString aLangAttrib; //TODO: = MsLangId::convertLanguageToIsoByteString( rFontSelData.meLanguage );
+ const rtl::OString aLangAttrib = MsLangId::convertLanguageToIsoByteString( rFontSelData.meLanguage );
psp::italic::type eItalic = psp::italic::Unknown;
if( rFontSelData.GetSlant() != ITALIC_DONTKNOW )
diff --git a/vcl/unx/source/gdi/salprnpsp.cxx b/vcl/unx/source/gdi/salprnpsp.cxx
index 3491622f783c..90c6a196143e 100644
--- a/vcl/unx/source/gdi/salprnpsp.cxx
+++ b/vcl/unx/source/gdi/salprnpsp.cxx
@@ -694,6 +694,18 @@ BOOL PspSalInfoPrinter::SetData(
pKey = aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ) );
pValue = pKey ? pKey->getValueCaseInsensitive( aPaper ) : NULL;
+
+ // some PPD files do not specify the standard paper names (e.g. C5 instead of EnvC5)
+ // try to find the correct paper anyway using the size
+ if( pKey && ! pValue && pJobSetup->mePaperFormat != PAPER_USER )
+ {
+ PaperInfo aInfo( pJobSetup->mePaperFormat );
+ aPaper = aData.m_pParser->matchPaper(
+ TenMuToPt( aInfo.getWidth() ),
+ TenMuToPt( aInfo.getHeight() ) );
+ pValue = pKey->getValueCaseInsensitive( aPaper );
+ }
+
if( ! ( pKey && pValue && aData.m_aContext.setValue( pKey, pValue, false ) == pValue ) )
return FALSE;
}
diff --git a/vcl/unx/source/plugadapt/salplug.cxx b/vcl/unx/source/plugadapt/salplug.cxx
index c42c22bc0592..a438760cffba 100644
--- a/vcl/unx/source/plugadapt/salplug.cxx
+++ b/vcl/unx/source/plugadapt/salplug.cxx
@@ -98,6 +98,14 @@ static SalInstance* tryInstance( const OUString& rModuleBase )
{
pCloseModule = NULL;
}
+ /*
+ * #i109007# KDE3 seems to have the same problem; an atexit cleanup
+ * handler, which cannot be resolved anymore if the plugin is already unloaded.
+ */
+ else if( rModuleBase.equalsAscii("kde") )
+ {
+ pCloseModule = NULL;
+ }
GetSalData()->m_pPlugin = aMod;
}
diff --git a/vcl/unx/source/printer/ppdparser.cxx b/vcl/unx/source/printer/ppdparser.cxx
index 971db860cf42..b2549573d099 100644
--- a/vcl/unx/source/printer/ppdparser.cxx
+++ b/vcl/unx/source/printer/ppdparser.cxx
@@ -258,7 +258,6 @@ using namespace rtl;
std::list< PPDParser* > PPDParser::aAllParsers;
std::hash_map< OUString, OUString, OUStringHash >* PPDParser::pAllPPDFiles = NULL;
-static String aEmptyString;
class PPDDecompressStream
{
@@ -1284,12 +1283,12 @@ void PPDParser::parseConstraint( const ByteString& rLine )
m_aConstraints.push_back( aConstraint );
}
-const String& PPDParser::getDefaultPaperDimension() const
+String PPDParser::getDefaultPaperDimension() const
{
if( m_pDefaultPaperDimension )
return m_pDefaultPaperDimension->m_aOption;
- return aEmptyString;
+ return String();
}
bool PPDParser::getMargins(
@@ -1356,10 +1355,10 @@ bool PPDParser::getPaperDimension(
return true;
}
-const String& PPDParser::matchPaper( int nWidth, int nHeight ) const
+String PPDParser::matchPaper( int nWidth, int nHeight ) const
{
if( ! m_pPaperDimensions )
- return aEmptyString;
+ return String();
int nPDim = -1;
double PDWidth, PDHeight;
@@ -1393,51 +1392,51 @@ const String& PPDParser::matchPaper( int nWidth, int nHeight ) const
{
// swap portrait/landscape and try again
bDontSwap = true;
- const String& rRet = matchPaper( nHeight, nWidth );
+ String rRet = matchPaper( nHeight, nWidth );
bDontSwap = false;
return rRet;
}
- return nPDim != -1 ? m_pPaperDimensions->getValue( nPDim )->m_aOption : aEmptyString;
+ return nPDim != -1 ? m_pPaperDimensions->getValue( nPDim )->m_aOption : String();
}
-const String& PPDParser::getDefaultInputSlot() const
+String PPDParser::getDefaultInputSlot() const
{
if( m_pDefaultInputSlot )
return m_pDefaultInputSlot->m_aValue;
- return aEmptyString;
+ return String();
}
-const String& PPDParser::getSlot( int nSlot ) const
+String PPDParser::getSlot( int nSlot ) const
{
if( ! m_pInputSlots )
- return aEmptyString;
+ return String();
if( nSlot > 0 && nSlot < m_pInputSlots->countValues() )
return m_pInputSlots->getValue( nSlot )->m_aOption;
else if( m_pInputSlots->countValues() > 0 )
return m_pInputSlots->getValue( (ULONG)0 )->m_aOption;
- return aEmptyString;
+ return String();
}
-const String& PPDParser::getSlotCommand( int nSlot ) const
+String PPDParser::getSlotCommand( int nSlot ) const
{
if( ! m_pInputSlots )
- return aEmptyString;
+ return String();
if( nSlot > 0 && nSlot < m_pInputSlots->countValues() )
return m_pInputSlots->getValue( nSlot )->m_aValue;
else if( m_pInputSlots->countValues() > 0 )
return m_pInputSlots->getValue( (ULONG)0 )->m_aValue;
- return aEmptyString;
+ return String();
}
-const String& PPDParser::getSlotCommand( const String& rSlot ) const
+String PPDParser::getSlotCommand( const String& rSlot ) const
{
if( ! m_pInputSlots )
- return aEmptyString;
+ return String();
for( int i=0; i < m_pInputSlots->countValues(); i++ )
{
@@ -1445,39 +1444,39 @@ const String& PPDParser::getSlotCommand( const String& rSlot ) const
if( pValue->m_aOption == rSlot )
return pValue->m_aValue;
}
- return aEmptyString;
+ return String();
}
-const String& PPDParser::getPaperDimension( int nPaperDimension ) const
+String PPDParser::getPaperDimension( int nPaperDimension ) const
{
if( ! m_pPaperDimensions )
- return aEmptyString;
+ return String();
if( nPaperDimension > 0 && nPaperDimension < m_pPaperDimensions->countValues() )
return m_pPaperDimensions->getValue( nPaperDimension )->m_aOption;
else if( m_pPaperDimensions->countValues() > 0 )
return m_pPaperDimensions->getValue( (ULONG)0 )->m_aOption;
- return aEmptyString;
+ return String();
}
-const String& PPDParser::getPaperDimensionCommand( int nPaperDimension ) const
+String PPDParser::getPaperDimensionCommand( int nPaperDimension ) const
{
if( ! m_pPaperDimensions )
- return aEmptyString;
+ return String();
if( nPaperDimension > 0 && nPaperDimension < m_pPaperDimensions->countValues() )
return m_pPaperDimensions->getValue( nPaperDimension )->m_aValue;
else if( m_pPaperDimensions->countValues() > 0 )
return m_pPaperDimensions->getValue( (ULONG)0 )->m_aValue;
- return aEmptyString;
+ return String();
}
-const String& PPDParser::getPaperDimensionCommand( const String& rPaperDimension ) const
+String PPDParser::getPaperDimensionCommand( const String& rPaperDimension ) const
{
if( ! m_pPaperDimensions )
- return aEmptyString;
+ return String();
for( int i=0; i < m_pPaperDimensions->countValues(); i++ )
{
@@ -1485,7 +1484,7 @@ const String& PPDParser::getPaperDimensionCommand( const String& rPaperDimension
if( pValue->m_aOption == rPaperDimension )
return pValue->m_aValue;
}
- return aEmptyString;
+ return String();
}
void PPDParser::getResolutionFromString(
@@ -1543,13 +1542,13 @@ void PPDParser::getResolution( int nNr, int& rXRes, int& rYRes ) const
rXRes, rYRes );
}
-const String& PPDParser::getResolutionCommand( int nXRes, int nYRes ) const
+String PPDParser::getResolutionCommand( int nXRes, int nYRes ) const
{
if( ( ! m_pResolutions || m_pResolutions->countValues() == 0 ) && m_pDefaultResolution )
return m_pDefaultResolution->m_aValue;
if( ! m_pResolutions )
- return aEmptyString;
+ return String();
int nX, nY;
for( int i = 0; i < m_pResolutions->countValues(); i++ )
@@ -1559,46 +1558,46 @@ const String& PPDParser::getResolutionCommand( int nXRes, int nYRes ) const
if( nX == nXRes && nY == nYRes )
return m_pResolutions->getValue( i )->m_aValue;
}
- return aEmptyString;
+ return String();
}
-const String& PPDParser::getDefaultDuplexType() const
+String PPDParser::getDefaultDuplexType() const
{
if( m_pDefaultDuplexType )
return m_pDefaultDuplexType->m_aValue;
- return aEmptyString;
+ return String();
}
-const String& PPDParser::getDuplex( int nDuplex ) const
+String PPDParser::getDuplex( int nDuplex ) const
{
if( ! m_pDuplexTypes )
- return aEmptyString;
+ return String();
if( nDuplex > 0 && nDuplex < m_pDuplexTypes->countValues() )
return m_pDuplexTypes->getValue( nDuplex )->m_aOption;
else if( m_pDuplexTypes->countValues() > 0 )
return m_pDuplexTypes->getValue( (ULONG)0 )->m_aOption;
- return aEmptyString;
+ return String();
}
-const String& PPDParser::getDuplexCommand( int nDuplex ) const
+String PPDParser::getDuplexCommand( int nDuplex ) const
{
if( ! m_pDuplexTypes )
- return aEmptyString;
+ return String();
if( nDuplex > 0 && nDuplex < m_pDuplexTypes->countValues() )
return m_pDuplexTypes->getValue( nDuplex )->m_aValue;
else if( m_pDuplexTypes->countValues() > 0 )
return m_pDuplexTypes->getValue( (ULONG)0 )->m_aValue;
- return aEmptyString;
+ return String();
}
-const String& PPDParser::getDuplexCommand( const String& rDuplex ) const
+String PPDParser::getDuplexCommand( const String& rDuplex ) const
{
if( ! m_pDuplexTypes )
- return aEmptyString;
+ return String();
for( int i=0; i < m_pDuplexTypes->countValues(); i++ )
{
@@ -1606,7 +1605,7 @@ const String& PPDParser::getDuplexCommand( const String& rDuplex ) const
if( pValue->m_aOption == rDuplex )
return pValue->m_aValue;
}
- return aEmptyString;
+ return String();
}
void PPDParser::getFontAttributes(
@@ -1636,14 +1635,14 @@ void PPDParser::getFontAttributes(
}
}
-const String& PPDParser::getFont( int nFont ) const
+String PPDParser::getFont( int nFont ) const
{
if( ! m_pFontList )
- return aEmptyString;
+ return String();
if( nFont >=0 && nFont < m_pFontList->countValues() )
return m_pFontList->getValue( nFont )->m_aOption;
- return aEmptyString;
+ return String();
}
rtl::OUString PPDParser::translateKey( const rtl::OUString& i_rKey,
diff --git a/vcl/unx/source/printergfx/printerjob.cxx b/vcl/unx/source/printergfx/printerjob.cxx
index 3e885d8af5b4..5e18849b8dfe 100644
--- a/vcl/unx/source/printergfx/printerjob.cxx
+++ b/vcl/unx/source/printergfx/printerjob.cxx
@@ -284,7 +284,8 @@ removeSpoolDir (const rtl::OUString& rSpoolDir)
nChar = psp::appendStr ("rm -rf ", pSystem);
nChar += psp::appendStr (aSysPathByte.getStr(), pSystem + nChar);
- system (pSystem);
+ if (system (pSystem) == -1)
+ OSL_ENSURE( 0, "psprint: couldn't remove spool directory" );
}
/* creates a spool directory with a "pidgin random" value based on
diff --git a/vcl/unx/source/window/salframe.cxx b/vcl/unx/source/window/salframe.cxx
index 5b538626a634..6d243e41db8c 100644
--- a/vcl/unx/source/window/salframe.cxx
+++ b/vcl/unx/source/window/salframe.cxx
@@ -528,6 +528,8 @@ void X11SalFrame::Init( ULONG nSalFrameStyle, int nScreen, SystemParentData* pPa
Atom a[4];
int n = 0;
a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::WM_DELETE_WINDOW );
+ if( pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_PING ) )
+ a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_PING );
if( ! s_pSaveYourselfFrame && ! mpParent)
{
// at all times have only one frame with SaveYourself
@@ -549,11 +551,23 @@ void X11SalFrame::Init( ULONG nSalFrameStyle, int nScreen, SystemParentData* pPa
pHints->win_gravity = GetDisplay()->getWMAdaptor()->getPositionWinGravity();
pHints->x = 0;
pHints->y = 0;
+ if( mbFullScreen )
+ {
+ pHints->flags |= PMaxSize | PMinSize;
+ pHints->max_width = w+100;
+ pHints->max_height = h+100;
+ pHints->min_width = w;
+ pHints->min_height = h;
+ }
XSetWMNormalHints( GetXDisplay(),
GetShellWindow(),
pHints );
XFree (pHints);
+ // set PID and WM_CLIENT_MACHINE
+ pDisplay_->getWMAdaptor()->setClientMachine( this );
+ pDisplay_->getWMAdaptor()->setPID( this );
+
// set client leader
if( aClientLeader )
{
@@ -605,7 +619,8 @@ void X11SalFrame::Init( ULONG nSalFrameStyle, int nScreen, SystemParentData* pPa
eType = WMAdaptor::windowType_Utility;
if( nStyle_ & SAL_FRAME_STYLE_OWNERDRAWDECORATION )
eType = WMAdaptor::windowType_Toolbar;
- if( nStyle_ & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN )
+ if( (nStyle_ & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN)
+ && GetDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
eType = WMAdaptor::windowType_Dock;
GetDisplay()->getWMAdaptor()->
@@ -735,6 +750,8 @@ void X11SalFrame::passOnSaveYourSelf()
int n = 0;
a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::WM_DELETE_WINDOW );
a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::WM_SAVE_YOURSELF );
+ if( pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_PING ) )
+ a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_PING );
XSetWMProtocols( GetXDisplay(), s_pSaveYourselfFrame->GetShellWindow(), a, n );
}
}
@@ -1130,7 +1147,7 @@ void X11SalFrame::Show( BOOL bVisible, BOOL bNoActivate )
// even though transient frames should be kept above their parent
// this does not necessarily hold true for DOCK type windows
// so artificially set ABOVE and remove it again on hide
- if( mpParent && (mpParent->nStyle_ & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ) )
+ if( mpParent && (mpParent->nStyle_ & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ) && pDisplay_->getWMAdaptor()->isLegacyPartialFullscreen())
pDisplay_->getWMAdaptor()->enableAlwaysOnTop( this, bVisible );
bMapped_ = bVisible;
@@ -1322,11 +1339,6 @@ void X11SalFrame::Show( BOOL bVisible, BOOL bNoActivate )
}
else
{
-#if OSL_DEBUG_LEVEL > 1
- if( nStyle_ & SAL_FRAME_STYLE_OWNERDRAWDECORATION )
- fprintf( stderr, "hide on ownerdraw\n" );
-#endif
-
if( getInputContext() )
getInputContext()->Unmap( this );
@@ -1616,6 +1628,7 @@ void X11SalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, USHOR
}
else
SetPosSize( aPosSize );
+
bDefaultPosition_ = False;
}
@@ -2042,6 +2055,12 @@ void X11SalFrame::SetPosSize( const Rectangle &rPosSize )
pHints->y = values.y;
pHints->win_gravity = pDisplay_->getWMAdaptor()->getPositionWinGravity();
}
+ if( mbFullScreen )
+ {
+ pHints->max_width = 10000;
+ pHints->max_height = 10000;
+ pHints->flags |= PMaxSize;
+ }
XSetWMNormalHints( GetXDisplay(),
GetShellWindow(),
pHints );
@@ -2199,28 +2218,15 @@ void X11SalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen )
maGeometry.nWidth = aRect.GetWidth();
maGeometry.nHeight = aRect.GetHeight();
mbMaximizedHorz = mbMaximizedVert = false;
+ mbFullScreen = true;
createNewWindow( None, m_nScreen );
- GetDisplay()->getWMAdaptor()->enableAlwaysOnTop( this, true );
- #if 0
- // this would give additional intent to the window
- // manager to force the positioning of the window;
- // alas all other windows will be expunged from that
- // region, leaving us in a pity state afterwards
- Size aScreenSize = pDisplay_->GetScreenSize( m_nScreen );
- pDisplay_->getWMAdaptor()->setFrameStruts( this,
- aRect.Left(), aRect.Top(),
- aScreenSize.Width() - aRect.Right(),
- aScreenSize.Height() - aRect.Bottom(),
- aRect.Left(), aRect.Right(),
- aRect.Top(), aRect.Bottom(),
- aRect.Left(), aRect.Right(),
- aRect.Top(), aRect.Bottom()
- );
- #endif
-
+ if( GetDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
+ GetDisplay()->getWMAdaptor()->enableAlwaysOnTop( this, true );
+ else
+ GetDisplay()->getWMAdaptor()->showFullScreen( this, true );
if( bVisible )
Show(TRUE);
- mbFullScreen = true;
+
}
else
{
@@ -3927,52 +3933,56 @@ long X11SalFrame::HandleClientMessage( XClientMessageEvent *pEvent )
Close(); // ???
return 1;
}
- else if( pEvent->message_type == rWMAdaptor.getAtom( WMAdaptor::WM_PROTOCOLS )
- && ! ( nStyle_ & SAL_FRAME_STYLE_PLUG )
- && ! (( nStyle_ & SAL_FRAME_STYLE_FLOAT ) && (nStyle_ & SAL_FRAME_STYLE_OWNERDRAWDECORATION))
- )
+ else if( pEvent->message_type == rWMAdaptor.getAtom( WMAdaptor::WM_PROTOCOLS ) )
{
- if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_DELETE_WINDOW ) )
- {
- Close();
- return 1;
- }
- else if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_TAKE_FOCUS ) )
- {
- // do nothing, we set the input focus in ToTop() if necessary
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "got WM_TAKE_FOCUS on %s window\n",
- (nStyle_&SAL_FRAME_STYLE_OWNERDRAWDECORATION) ?
- "ownerdraw" : "NON OWNERDRAW" );
-#endif
- }
- else if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_SAVE_YOURSELF ) )
+ if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::NET_WM_PING ) )
+ rWMAdaptor.answerPing( this, pEvent );
+ else if( ! ( nStyle_ & SAL_FRAME_STYLE_PLUG )
+ && ! (( nStyle_ & SAL_FRAME_STYLE_FLOAT ) && (nStyle_ & SAL_FRAME_STYLE_OWNERDRAWDECORATION))
+ )
{
- bool bSession = rWMAdaptor.getWindowManagerName().EqualsAscii( "Dtwm" );
-
- if( ! bSession )
+ if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_DELETE_WINDOW ) )
+ {
+ Close();
+ return 1;
+ }
+ else if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_TAKE_FOCUS ) )
{
- if( this == s_pSaveYourselfFrame )
+ // do nothing, we set the input focus in ToTop() if necessary
+ #if OSL_DEBUG_LEVEL > 1
+ fprintf( stderr, "got WM_TAKE_FOCUS on %s window\n",
+ (nStyle_&SAL_FRAME_STYLE_OWNERDRAWDECORATION) ?
+ "ownerdraw" : "NON OWNERDRAW" );
+ #endif
+ }
+ else if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_SAVE_YOURSELF ) )
+ {
+ bool bSession = rWMAdaptor.getWindowManagerName().EqualsAscii( "Dtwm" );
+
+ if( ! bSession )
{
- ByteString aExec( SessionManagerClient::getExecName(), osl_getThreadTextEncoding() );
- const char* argv[2];
- argv[0] = "/bin/sh";
- argv[1] = const_cast<char*>(aExec.GetBuffer());
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "SaveYourself request, setting command: %s %s\n", argv[0], argv[1] );
-#endif
- XSetCommand( GetXDisplay(), GetShellWindow(), (char**)argv, 2 );
+ if( this == s_pSaveYourselfFrame )
+ {
+ ByteString aExec( SessionManagerClient::getExecName(), osl_getThreadTextEncoding() );
+ const char* argv[2];
+ argv[0] = "/bin/sh";
+ argv[1] = const_cast<char*>(aExec.GetBuffer());
+ #if OSL_DEBUG_LEVEL > 1
+ fprintf( stderr, "SaveYourself request, setting command: %s %s\n", argv[0], argv[1] );
+ #endif
+ XSetCommand( GetXDisplay(), GetShellWindow(), (char**)argv, 2 );
+ }
+ else
+ // can only happen in race between WM and window closing
+ XChangeProperty( GetXDisplay(), GetShellWindow(), rWMAdaptor.getAtom( WMAdaptor::WM_COMMAND ), XA_STRING, 8, PropModeReplace, (unsigned char*)"", 0 );
}
else
- // can only happen in race between WM and window closing
- XChangeProperty( GetXDisplay(), GetShellWindow(), rWMAdaptor.getAtom( WMAdaptor::WM_COMMAND ), XA_STRING, 8, PropModeReplace, (unsigned char*)"", 0 );
- }
- else
- {
- // save open documents; would be good for non Dtwm, too,
- // but there is no real Shutdown message in the ancient
- // SM protocol; on Dtwm SaveYourself really means Shutdown, too.
- IceSalSession::handleOldX11SaveYourself( this );
+ {
+ // save open documents; would be good for non Dtwm, too,
+ // but there is no real Shutdown message in the ancient
+ // SM protocol; on Dtwm SaveYourself really means Shutdown, too.
+ IceSalSession::handleOldX11SaveYourself( this );
+ }
}
}
}
diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk
index d501765c8491..eb54531c375c 100644
--- a/vcl/util/makefile.mk
+++ b/vcl/util/makefile.mk
@@ -299,6 +299,7 @@ SHL2DEPN=$(SHL1IMPLIBN) $(SHL1TARGETN)
SHL2STDLIBS=\
$(VCLLIB)\
$(I18NPAPERLIB) \
+ $(I18NISOLANGLIB) \
$(TOOLSLIB) \
$(VOSLIB) \
$(BASEGFXLIB) \
diff --git a/vcl/util/makefile2.pmk b/vcl/util/makefile2.pmk
index 56102a256ea3..df9ba1a214d7 100644
--- a/vcl/util/makefile2.pmk
+++ b/vcl/util/makefile2.pmk
@@ -36,6 +36,6 @@ CFLAGSCXX+=$(OBJCXXFLAGS)
#building with stlport, but graphite was not built with stlport
.IF "$(USE_SYSTEM_STL)"!="YES"
.IF "$(SYSTEM_GRAPHITE)"=="YES"
-CDEFS += -DGRAPHITEADAPTSTL
+CDEFS += -DADAPT_EXT_STL
.ENDIF
.ENDIF
diff --git a/vcl/win/inc/salgdi.h b/vcl/win/inc/salgdi.h
index 6b58e0c5375a..b1bfcbee96f4 100644
--- a/vcl/win/inc/salgdi.h
+++ b/vcl/win/inc/salgdi.h
@@ -194,7 +194,7 @@ protected:
virtual void drawPolygon( ULONG nPoints, const SalPoint* pPtAry );
virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry );
virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency );
- virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin);
+ virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin );
virtual sal_Bool drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry );
virtual sal_Bool drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry );
virtual sal_Bool drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry );
@@ -228,15 +228,15 @@ protected:
// native widget rendering methods that require mirroring
virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside );
+ const Point& aPos, BOOL& rIsInside );
virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ ControlState nState, const ImplControlValue& aValue,
const rtl::OUString& aCaption );
virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const rtl::OUString& aCaption );
+ const rtl::OUString& aCaption );
virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, const rtl::OUString& aCaption,
+ const ImplControlValue& aValue, const rtl::OUString& aCaption,
Region &rNativeBoundingRegion, Region &rNativeContentRegion );
virtual bool drawAlphaBitmap( const SalTwoRect&,
diff --git a/vcl/win/source/app/salinfo.cxx b/vcl/win/source/app/salinfo.cxx
index b7ea81d313ae..14cb5d63437a 100644
--- a/vcl/win/source/app/salinfo.cxx
+++ b/vcl/win/source/app/salinfo.cxx
@@ -160,7 +160,8 @@ bool WinSalSystem::initMonitors()
std::hash_map< rtl::OUString, int, rtl::OUStringHash > aDeviceStringCount;
while( EnumDisplayDevicesW( NULL, nDevice++, &aDev, 0 ) )
{
- if( (aDev.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) == 0 ) // sort out non monitors
+ if( (aDev.StateFlags & DISPLAY_DEVICE_ACTIVE)
+ && !(aDev.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) ) // sort out non/disabled monitors
{
aDev.DeviceName[31] = 0;
aDev.DeviceString[127] = 0;
diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx
index ebe470d3eb7e..d1b5a9cfdeae 100644
--- a/vcl/win/source/gdi/salgdi3.cxx
+++ b/vcl/win/source/gdi/salgdi3.cxx
@@ -47,11 +47,15 @@
#include "vcl/fontsubset.hxx"
#include "vcl/sallayout.hxx"
+#include "vcl/outdev.h" // for ImplGlyphFallbackFontSubstitution
+#include "unotools/fontcfg.hxx" // for IMPL_FONT_ATTR_SYMBOL
+
#include "rtl/logfile.hxx"
#include "rtl/tencinfo.h"
#include "rtl/textcvt.h"
#include "rtl/bootstrap.hxx"
+#include "i18npool/mslangid.hxx"
#include "osl/module.h"
#include "osl/file.hxx"
@@ -82,7 +86,6 @@
#include <set>
#include <map>
-
using namespace vcl;
static const int MAXFONTHEIGHT = 2048;
@@ -314,6 +317,308 @@ RawFontData::RawFontData( HDC hDC, DWORD nTableTag )
}
}
+// ===========================================================================
+// platform specific font substitution hooks for glyph fallback enhancement
+// TODO: move into i18n module (maybe merge with svx/ucsubset.*
+// or merge with i18nutil/source/utility/unicode_data.h)
+struct Unicode2LangType
+{
+ sal_UCS4 mnMinCode;
+ sal_UCS4 mnMaxCode;
+ LanguageType mnLangID;
+};
+
+// entries marked with default-CJK get replaced with the default-CJK language
+#define LANGUAGE_DEFAULT_CJK 0xFFF0
+
+// map unicode ranges to languages supported by OOo
+// NOTE: due to the binary search used this list must be sorted by mnMinCode
+static Unicode2LangType aLangFromCodeChart[]= {
+ {0x0000, 0x007F, LANGUAGE_ENGLISH}, // Basic Latin
+ {0x0080, 0x024F, LANGUAGE_ENGLISH}, // Latin Extended-A and Latin Extended-B
+ {0x0250, 0x02AF, LANGUAGE_SYSTEM}, // IPA Extensions
+ {0x0370, 0x03FF, LANGUAGE_GREEK}, // Greek
+ {0x0590, 0x05FF, LANGUAGE_HEBREW}, // Hebrew
+ {0x0600, 0x06FF, LANGUAGE_ARABIC_PRIMARY_ONLY}, // Arabic
+ {0x0900, 0x097F, LANGUAGE_HINDI}, // Devanagari
+ {0x0980, 0x09FF, LANGUAGE_BENGALI}, // Bengali
+ {0x0A80, 0x0AFF, LANGUAGE_GUJARATI}, // Gujarati
+ {0x0B00, 0x0B7F, LANGUAGE_ORIYA}, // Oriya
+ {0x0B80, 0x0BFF, LANGUAGE_TAMIL}, // Tamil
+ {0x0C00, 0x0C7F, LANGUAGE_TELUGU}, // Telugu
+ {0x0C80, 0x0CFF, LANGUAGE_KANNADA}, // Kannada
+ {0x0D00, 0x0D7F, LANGUAGE_MALAYALAM}, // Malayalam
+ {0x0D80, 0x0D7F, LANGUAGE_SINHALESE_SRI_LANKA}, // Sinhala
+ {0x0E00, 0x0E7F, LANGUAGE_THAI}, // Thai
+ {0x0E80, 0x0EFF, LANGUAGE_LAO}, // Lao
+ {0x0F00, 0x0FFF, LANGUAGE_TIBETAN}, // Tibetan
+ {0x1000, 0x109F, LANGUAGE_BURMESE}, // Burmese
+ {0x10A0, 0x10FF, LANGUAGE_GEORGIAN}, // Georgian
+ {0x1100, 0x11FF, LANGUAGE_KOREAN}, // Hangul Jamo, Korean-specific
+// {0x1200, 0x139F, LANGUAGE_AMHARIC_ETHIOPIA}, // Ethiopic
+// {0x1200, 0x139F, LANGUAGE_TIGRIGNA_ETHIOPIA}, // Ethiopic
+ {0x13A0, 0x13FF, LANGUAGE_CHEROKEE_UNITED_STATES}, // Cherokee
+// {0x1400, 0x167F, LANGUAGE_CANADIAN_ABORIGINAL}, // Canadian Aboriginial Syllabics
+// {0x1680, 0x169F, LANGUAGE_OGHAM}, // Ogham
+// {0x16A0, 0x16F0, LANGUAGE_RUNIC}, // Runic
+// {0x1700, 0x171F, LANGUAGE_TAGALOG}, // Tagalog
+// {0x1720, 0x173F, LANGUAGE_HANUNOO}, // Hanunoo
+// {0x1740, 0x175F, LANGUAGE_BUHID}, // Buhid
+// {0x1760, 0x177F, LANGUAGE_TAGBANWA}, // Tagbanwa
+ {0x1780, 0x17FF, LANGUAGE_KHMER}, // Khmer
+ {0x18A0, 0x18AF, LANGUAGE_MONGOLIAN}, // Mongolian
+// {0x1900, 0x194F, LANGUAGE_LIMBU}, // Limbu
+// {0x1950, 0x197F, LANGUAGE_TAILE}, // Tai Le
+// {0x1980, 0x19DF, LANGUAGE_TAILUE}, // Tai Lue
+ {0x19E0, 0x19FF, LANGUAGE_KHMER}, // Khmer Symbols
+// {0x1A00, 0x1A1F, LANGUAGE_BUGINESE}, // Buginese/Lontara
+// {0x1B00, 0x1B7F, LANGUAGE_BALINESE}, // Balinese
+// {0x1D00, 0x1DFF, LANGUAGE_NONE}, // Phonetic Symbols
+ {0x1E00, 0x1EFF, LANGUAGE_ENGLISH}, // Latin Extended Additional
+ {0x1F00, 0x1FFF, LANGUAGE_GREEK}, // Greek Extended
+ {0x2C60, 0x2C7F, LANGUAGE_ENGLISH}, // Latin Extended-C
+ {0x2E80, 0x2FFf, LANGUAGE_CHINESE_SIMPLIFIED}, // CJK Radicals Supplement + Kangxi Radical + Ideographic Description Characters
+ {0x3000, 0x303F, LANGUAGE_DEFAULT_CJK}, // CJK Symbols and punctuation
+ {0x3040, 0x30FF, LANGUAGE_JAPANESE}, // Japanese Hiragana + Katakana
+ {0x3100, 0x312F, LANGUAGE_CHINESE_TRADITIONAL}, // Bopomofo
+ {0x3130, 0x318F, LANGUAGE_KOREAN}, // Hangul Compatibility Jamo, Kocrean-specific
+ {0x3190, 0x319F, LANGUAGE_JAPANESE}, // Kanbun
+ {0x31A0, 0x31BF, LANGUAGE_CHINESE_TRADITIONAL}, // Bopomofo Extended
+ {0x31C0, 0x31EF, LANGUAGE_DEFAULT_CJK}, // CJK Ideographs
+ {0x31F0, 0x31FF, LANGUAGE_JAPANESE}, // Japanese Katakana Phonetic Extensions
+ {0x3200, 0x321F, LANGUAGE_KOREAN}, // Parenthesized Hangul
+ {0x3220, 0x325F, LANGUAGE_DEFAULT_CJK}, // Parenthesized Ideographs
+ {0x3260, 0x327F, LANGUAGE_KOREAN}, // Circled Hangul
+ {0x3280, 0x32CF, LANGUAGE_DEFAULT_CJK}, // Circled Ideographs
+ {0x32d0, 0x32FF, LANGUAGE_JAPANESE}, // Japanese Circled Katakana
+ {0x3400, 0x4DBF, LANGUAGE_DEFAULT_CJK}, // CJK Unified Ideographs Extension A
+ {0x4E00, 0x9FCF, LANGUAGE_DEFAULT_CJK}, // Unified CJK Ideographs
+ {0xA720, 0xA7FF, LANGUAGE_ENGLISH}, // Latin Extended-D
+ {0xAC00, 0xD7AF, LANGUAGE_KOREAN}, // Hangul Syllables, Korean-specific
+ {0xF900, 0xFAFF, LANGUAGE_DEFAULT_CJK}, // CJK Compatibility Ideographs
+ {0xFB00, 0xFB4F, LANGUAGE_HEBREW}, // Hebrew Presentation Forms
+ {0xFB50, 0xFDFF, LANGUAGE_ARABIC_PRIMARY_ONLY}, // Arabic Presentation Forms-A
+ {0xFE70, 0xFEFE, LANGUAGE_ARABIC_PRIMARY_ONLY}, // Arabic Presentation Forms-B
+ {0xFF65, 0xFF9F, LANGUAGE_JAPANESE}, // Japanese Halfwidth Katakana variant
+ {0xFFA0, 0xFFDC, LANGUAGE_KOREAN}, // Kocrean halfwidth hangual variant
+ {0x10140, 0x1018F, LANGUAGE_GREEK}, // Ancient Greak numbers
+ {0x1D200, 0x1D24F, LANGUAGE_GREEK}, // Ancient Greek Musical
+ {0x20000, 0x2A6DF, LANGUAGE_DEFAULT_CJK}, // CJK Unified Ideographs Extension B
+ {0x2F800, 0x2FA1F, LANGUAGE_DEFAULT_CJK} // CJK Compatibility Ideographs Supplement
+};
+
+// get language matching to the missing char
+LanguageType MapCharToLanguage( sal_UCS4 uChar )
+{
+ // entries marked with default-CJK get replaced with the prefered CJK language
+ static bool bFirst = true;
+ if( bFirst )
+ {
+ bFirst = false;
+
+ // use method suggested in #i97086# to determnine the systems default language
+ // TODO: move into i18npool or sal/osl/w32/nlsupport.c
+ LanguageType nDefaultLang = 0;
+ HKEY hKey = NULL;
+ LONG lResult = ::RegOpenKeyExA( HKEY_LOCAL_MACHINE,
+ "SYSTEM\\CurrentControlSet\\Control\\Nls\\Language",
+ 0, KEY_QUERY_VALUE, &hKey );
+ char aKeyValBuf[16];
+ DWORD nKeyValSize = sizeof(aKeyValBuf);
+ if( ERROR_SUCCESS == lResult )
+ lResult = RegQueryValueExA( hKey, "Default", NULL, NULL, (LPBYTE)aKeyValBuf, &nKeyValSize );
+ aKeyValBuf[ sizeof(aKeyValBuf)-1 ] = '\0';
+ if( ERROR_SUCCESS == lResult )
+ nDefaultLang = (LanguageType)rtl_str_toInt32( aKeyValBuf, 16 );
+
+ // TODO: use the default-CJK language selected in
+ // Tools->Options->LangSettings->Languages when it becomes available here
+ if( !nDefaultLang )
+ nDefaultLang = Application::GetSettings().GetUILanguage();
+
+ LanguageType nDefaultCJK = LANGUAGE_CHINESE;
+ switch( nDefaultLang )
+ {
+ case LANGUAGE_JAPANESE:
+ case LANGUAGE_KOREAN:
+ case LANGUAGE_KOREAN_JOHAB:
+ case LANGUAGE_CHINESE_SIMPLIFIED:
+ case LANGUAGE_CHINESE_TRADITIONAL:
+ case LANGUAGE_CHINESE_SINGAPORE:
+ case LANGUAGE_CHINESE_HONGKONG:
+ case LANGUAGE_CHINESE_MACAU:
+ nDefaultCJK = nDefaultLang;
+ break;
+ default:
+ nDefaultCJK = LANGUAGE_CHINESE;
+ break;
+ }
+
+ // change the marked entries to prefered language
+ static const int nCount = (sizeof(aLangFromCodeChart) / sizeof(*aLangFromCodeChart));
+ for( int i = 0; i < nCount; ++i )
+ {
+ if( aLangFromCodeChart[ i].mnLangID == LANGUAGE_DEFAULT_CJK )
+ aLangFromCodeChart[ i].mnLangID = nDefaultCJK;
+ }
+ }
+
+ // binary search
+ int nLow = 0;
+ int nHigh = (sizeof(aLangFromCodeChart) / sizeof(*aLangFromCodeChart)) - 1;
+ while( nLow <= nHigh )
+ {
+ int nMiddle = (nHigh + nLow) / 2;
+ if( uChar < aLangFromCodeChart[ nMiddle].mnMinCode )
+ nHigh = nMiddle - 1;
+ else if( uChar > aLangFromCodeChart[ nMiddle].mnMaxCode )
+ nLow = nMiddle + 1;
+ else
+ return aLangFromCodeChart[ nMiddle].mnLangID;
+ }
+
+ return LANGUAGE_DONTKNOW;
+}
+
+class WinGlyphFallbackSubstititution
+: public ImplGlyphFallbackFontSubstitution
+{
+public:
+ explicit WinGlyphFallbackSubstititution( HDC );
+
+ bool FindFontSubstitute( ImplFontSelectData&, rtl::OUString& rMissingChars ) const;
+private:
+ HDC mhDC;
+ bool HasMissingChars( const ImplFontData*, const rtl::OUString& rMissingChars ) const;
+};
+
+inline WinGlyphFallbackSubstititution::WinGlyphFallbackSubstititution( HDC hDC )
+: mhDC( hDC )
+{}
+
+void ImplGetLogFontFromFontSelect( HDC, const ImplFontSelectData*,
+ LOGFONTW&, bool /*bTestVerticalAvail*/ );
+
+// does a font face hold the given missing characters?
+bool WinGlyphFallbackSubstititution::HasMissingChars( const ImplFontData* pFace, const rtl::OUString& rMissingChars ) const
+{
+ const ImplWinFontData* pWinFont = static_cast<const ImplWinFontData*>(pFace);
+ const ImplFontCharMap* pCharMap = pWinFont->GetImplFontCharMap();
+ if( !pCharMap )
+ {
+ // construct a Size structure as the parameter of constructor of class ImplFontSelectData
+ const Size aSize( pFace->GetWidth(), pFace->GetHeight() );
+ // create a ImplFontSelectData object for getting s LOGFONT
+ const ImplFontSelectData aFSD( *pFace, aSize, (float)aSize.Height(), 0, false );
+ // construct log font
+ LOGFONTW aLogFont;
+ ImplGetLogFontFromFontSelect( mhDC, &aFSD, aLogFont, true );
+
+ // create HFONT from log font
+ HFONT hNewFont = ::CreateFontIndirectW( &aLogFont );
+ // select the new font into device
+ HFONT hOldFont = ::SelectFont( mhDC, hNewFont );
+
+ // read CMAP table to update their pCharMap
+ pWinFont->UpdateFromHDC( mhDC );;
+
+ // cleanup temporary font
+ ::SelectFont( mhDC, hOldFont );
+ ::DeleteFont( hNewFont );
+
+ // get the new charmap
+ pCharMap = pWinFont->GetImplFontCharMap();
+ }
+
+ // avoid fonts with unknown CMAP subtables for glyph fallback
+ if( !pCharMap || pCharMap->IsDefaultMap() )
+ return false;
+
+ int nMatchCount = 0;
+ // static const int nMaxMatchCount = 1; // TODO: check more missing characters?
+ const sal_Int32 nStrLen = rMissingChars.getLength();
+ for( sal_Int32 nStrIdx = 0; nStrIdx < nStrLen; ++nStrIdx )
+ {
+ const sal_UCS4 uChar = rMissingChars.iterateCodePoints( &nStrIdx );
+ nMatchCount += pCharMap->HasChar( uChar );
+ break; // for now
+ }
+
+ const bool bHasMatches = (nMatchCount > 0);
+ return bHasMatches;
+}
+
+// find a fallback font for missing characters
+// TODO: should stylistic matches be searched and prefered?
+bool WinGlyphFallbackSubstititution::FindFontSubstitute( ImplFontSelectData& rFontSelData, rtl::OUString& rMissingChars ) const
+{
+ // guess a locale matching to the missing chars
+ com::sun::star::lang::Locale aLocale;
+
+ sal_Int32 nStrIdx = 0;
+ const sal_Int32 nStrLen = rMissingChars.getLength();
+ while( nStrIdx < nStrLen )
+ {
+ const sal_UCS4 uChar = rMissingChars.iterateCodePoints( &nStrIdx );
+ const LanguageType eLang = MapCharToLanguage( uChar );
+ if( eLang == LANGUAGE_DONTKNOW )
+ continue;
+ MsLangId::convertLanguageToLocale( eLang, aLocale );
+ break;
+ }
+
+ // fall back to default UI locale if the missing characters are inconclusive
+ if( nStrIdx >= nStrLen )
+ aLocale = Application::GetSettings().GetUILocale();
+
+ // first level fallback:
+ // try use the locale specific default fonts defined in VCL.xcu
+ const ImplDevFontList* pDevFontList = ImplGetSVData()->maGDIData.mpScreenFontList;
+ /*const*/ ImplDevFontListData* pDevFont = pDevFontList->ImplFindByLocale( aLocale );
+ if( pDevFont )
+ {
+ const ImplFontData* pFace = pDevFont->FindBestFontFace( rFontSelData );
+ if( HasMissingChars( pFace, rMissingChars ) )
+ {
+ rFontSelData.maSearchName = pDevFont->GetSearchName();
+ return true;
+ }
+ }
+
+ // are the missing characters symbols?
+ pDevFont = pDevFontList->ImplFindByAttributes( IMPL_FONT_ATTR_SYMBOL,
+ rFontSelData.meWeight, rFontSelData.meWidthType,
+ rFontSelData.meFamily, rFontSelData.meItalic, rFontSelData.maSearchName );
+ if( pDevFont )
+ {
+ const ImplFontData* pFace = pDevFont->FindBestFontFace( rFontSelData );
+ if( HasMissingChars( pFace, rMissingChars ) )
+ {
+ rFontSelData.maSearchName = pDevFont->GetSearchName();
+ return true;
+ }
+ }
+
+ // last level fallback, check each font type face one by one
+ const ImplGetDevFontList* pTestFontList = pDevFontList->GetDevFontList();
+ // limit the count of fonts to be checked to prevent hangs
+ static const int MAX_GFBFONT_COUNT = 600;
+ int nTestFontCount = pTestFontList->Count();
+ if( nTestFontCount > MAX_GFBFONT_COUNT )
+ nTestFontCount = MAX_GFBFONT_COUNT;
+
+ for( int i = 0; i < nTestFontCount; ++i )
+ {
+ const ImplFontData* pFace = pTestFontList->Get( i );
+ if( !HasMissingChars( pFace, rMissingChars ) )
+ continue;
+ rFontSelData.maSearchName = pFace->maName;
+ return true;
+ }
+
+ return false;
+}
+
// =======================================================================
struct ImplEnumInfo
@@ -903,6 +1208,8 @@ bool ImplWinFontData::IsGSUBstituted( sal_UCS4 cChar ) const
ImplFontCharMap* ImplWinFontData::GetImplFontCharMap() const
{
+ if( !mpUnicodeMap )
+ return NULL;
mpUnicodeMap->AddReference();
return mpUnicodeMap;
}
@@ -1272,15 +1579,24 @@ HFONT WinSalGraphics::ImplDoSetFont( ImplFontSelectData* i_pFont, float& o_rFont
&& (ImplSalWICompareAscii( aLogFont.lfFaceName, "Courier" ) == 0) )
lstrcpynW( aLogFont.lfFaceName, L"Courier New", 11 );
- // limit font requests to MAXFONTHEIGHT
+ // #i47675# limit font requests to MAXFONTHEIGHT
// TODO: share MAXFONTHEIGHT font instance
- if( -aLogFont.lfHeight <= MAXFONTHEIGHT )
+ if( (-aLogFont.lfHeight <= MAXFONTHEIGHT)
+ && (+aLogFont.lfWidth <= MAXFONTHEIGHT) )
+ {
o_rFontScale = 1.0;
- else
+ }
+ else if( -aLogFont.lfHeight >= +aLogFont.lfWidth )
{
o_rFontScale = -aLogFont.lfHeight / (float)MAXFONTHEIGHT;
aLogFont.lfHeight = -MAXFONTHEIGHT;
- aLogFont.lfWidth = static_cast<LONG>( aLogFont.lfWidth / o_rFontScale );
+ aLogFont.lfWidth = FRound( aLogFont.lfWidth / o_rFontScale );
+ }
+ else // #i95867# also limit font widths
+ {
+ o_rFontScale = +aLogFont.lfWidth / (float)MAXFONTHEIGHT;
+ aLogFont.lfWidth = +MAXFONTHEIGHT;
+ aLogFont.lfHeight = FRound( aLogFont.lfHeight / o_rFontScale );
}
hNewFont = ::CreateFontIndirectW( &aLogFont );
@@ -2237,6 +2553,10 @@ void WinSalGraphics::GetDevFontList( ImplDevFontList* pFontList )
bImplSalCourierScalable = aInfo.mbImplSalCourierScalable;
bImplSalCourierNew = aInfo.mbImplSalCourierNew;
}
+
+ // set glyph fallback hook
+ static WinGlyphFallbackSubstititution aSubstFallback( mhDC );
+ pFontList->SetFallbackHook( &aSubstFallback );
}
// ----------------------------------------------------------------------------
diff --git a/vcl/win/source/gdi/salgdi_gdiplus.cxx b/vcl/win/source/gdi/salgdi_gdiplus.cxx
index c621d81dce40..88efbb29d30a 100644
--- a/vcl/win/source/gdi/salgdi_gdiplus.cxx
+++ b/vcl/win/source/gdi/salgdi_gdiplus.cxx
@@ -189,14 +189,15 @@ bool WinSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly
return true;
}
-bool WinSalGraphics::drawPolyLine(const basegfx::B2DPolygon& rPolygon, const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin eLineJoin)
+bool WinSalGraphics::drawPolyLine( const basegfx::B2DPolygon& rPolygon, double fTransparency, const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin eLineJoin )
{
const sal_uInt32 nCount(rPolygon.count());
if(mbPen && nCount)
{
Gdiplus::Graphics aGraphics(mhDC);
- Gdiplus::Color aTestColor(255, SALCOLOR_RED(maLineColor), SALCOLOR_GREEN(maLineColor), SALCOLOR_BLUE(maLineColor));
+ const sal_uInt8 aTrans = (sal_uInt8)basegfx::fround( 255 * (1.0 - fTransparency) );
+ Gdiplus::Color aTestColor(aTrans, SALCOLOR_RED(maLineColor), SALCOLOR_GREEN(maLineColor), SALCOLOR_BLUE(maLineColor));
Gdiplus::Pen aTestPen(aTestColor, Gdiplus::REAL(rLineWidths.getX()));
Gdiplus::GraphicsPath aPath;
bool bNoLineJoin(false);
diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx
index 1b7ed7dcfccb..be5d7f8360bc 100644
--- a/vcl/win/source/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx
@@ -295,6 +295,10 @@ BOOL WinSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP
if( nPart == PART_TRACK_HORZ_AREA || nPart == PART_TRACK_VERT_AREA )
hTheme = getThemeHandle( mhWnd, L"Trackbar" );
break;
+ case CTRL_LISTNODE:
+ if( nPart == PART_ENTIRE_CONTROL )
+ hTheme = getThemeHandle( mhWnd, L"TreeView" );
+ break;
default:
hTheme = NULL;
break;
@@ -315,7 +319,6 @@ BOOL WinSalGraphics::hitTestNativeControl( ControlType,
ControlPart,
const Region&,
const Point&,
- SalControlHandle&,
BOOL& )
{
return FALSE;
@@ -421,7 +424,6 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
ControlPart nPart,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle&,
OUString aCaption )
{
// a listbox dropdown is actually a combobox dropdown
@@ -926,6 +928,27 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
return ImplDrawTheme( hTheme, hDC, iPart, iState, aThumbRect, aCaption );
}
+ if( nType == CTRL_LISTNODE )
+ {
+ if( nPart != PART_ENTIRE_CONTROL )
+ return FALSE;
+
+ ButtonValue aButtonValue = aValue.getTristateVal();
+ iPart = TVP_GLYPH;
+ switch( aButtonValue )
+ {
+ case BUTTONVALUE_ON:
+ iState = GLPS_OPENED;
+ break;
+ case BUTTONVALUE_OFF:
+ iState = GLPS_CLOSED;
+ break;
+ default:
+ return FALSE;
+ }
+ return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption );
+ }
+
return false;
}
@@ -936,7 +959,6 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
*
* rControlRegion: The bounding region of the complete control in VCL frame coordinates.
* aValue: An optional value (tristate/numerical/string)
- * rControlHandle: Carries platform dependent data and is maintained by the WinSalGraphics implementation.
* aCaption: A caption or title string (like button text etc)
*/
BOOL WinSalGraphics::drawNativeControl( ControlType nType,
@@ -944,7 +966,6 @@ BOOL WinSalGraphics::drawNativeControl( ControlType nType,
const Region& rControlRegion,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle,
const OUString& aCaption )
{
BOOL bOk = false;
@@ -1006,6 +1027,10 @@ BOOL WinSalGraphics::drawNativeControl( ControlType nType,
if( nPart == PART_ENTIRE_CONTROL )
hTheme = getThemeHandle( mhWnd, L"Progress");
break;
+ case CTRL_LISTNODE:
+ if( nPart == PART_ENTIRE_CONTROL )
+ hTheme = getThemeHandle( mhWnd, L"TreeView");
+ break;
case CTRL_SLIDER:
if( nPart == PART_TRACK_HORZ_AREA || nPart == PART_TRACK_VERT_AREA )
hTheme = getThemeHandle( mhWnd, L"Trackbar" );
@@ -1031,7 +1056,7 @@ BOOL WinSalGraphics::drawNativeControl( ControlType nType,
OUString aCaptionStr( aCaption.replace('~', '&') ); // translate mnemonics
bOk = ImplDrawNativeControl(mhDC, hTheme, rc,
nType, nPart, nState, aValue,
- rControlHandle, aCaptionStr );
+ aCaptionStr );
// restore alignment
SetTextAlign( mhDC, ta );
@@ -1051,7 +1076,6 @@ BOOL WinSalGraphics::drawNativeControl( ControlType nType,
*
* rControlRegion: The bounding region of the complete control in VCL frame coordinates.
* aValue: An optional value (tristate/numerical/string)
- * rControlHandle: Carries platform dependent data and is maintained by the WinSalGraphics implementation.
* aCaption: A caption or title string (like button text etc)
*/
BOOL WinSalGraphics::drawNativeControlText( ControlType,
@@ -1059,7 +1083,6 @@ BOOL WinSalGraphics::drawNativeControlText( ControlType,
const Region&,
ControlState,
const ImplControlValue&,
- SalControlHandle&,
const OUString& )
{
return( false );
@@ -1077,15 +1100,13 @@ BOOL WinSalGraphics::drawNativeControlText( ControlType,
*
* rControlRegion: The bounding region of the control in VCL frame coordinates.
* aValue: An optional value (tristate/numerical/string)
- * rControlHandle: Carries platform dependent data and is maintained by the WinSalGraphics implementation.
* aCaption: A caption or title string (like button text etc)
*/
BOOL WinSalGraphics::getNativeControlRegion( ControlType nType,
ControlPart nPart,
const Region& rControlRegion,
- ControlState,
- const ImplControlValue&,
- SalControlHandle&,
+ ControlState nState,
+ const ImplControlValue& rControlValue,
const OUString&,
Region &rNativeBoundingRegion,
Region &rNativeContentRegion )
@@ -1201,6 +1222,7 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType,
}
}
}
+
if( nType == CTRL_SLIDER && ( (nPart == PART_THUMB_HORZ) || (nPart == PART_THUMB_VERT) ) )
{
HTHEME hTheme = getThemeHandle( mhWnd, L"Trackbar");
@@ -1229,6 +1251,37 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType,
}
}
+ if ( ( nType == CTRL_TAB_ITEM ) && ( nPart == PART_ENTIRE_CONTROL ) )
+ {
+ Rectangle aControlRect( rControlRegion.GetBoundRect() );
+ rNativeContentRegion = aControlRect;
+
+ --aControlRect.Bottom();
+
+ TabitemValue *pValue = static_cast< TabitemValue* >( rControlValue.getOptionalVal() );
+ if ( pValue )
+ {
+ if ( pValue->isBothAligned() )
+ --aControlRect.Right();
+ }
+
+ if ( nState & CTRL_STATE_SELECTED )
+ {
+ aControlRect.Left() -= 2;
+ if ( pValue && !pValue->isBothAligned() )
+ {
+ if ( pValue->isLeftAligned() || pValue->isNotAligned() )
+ aControlRect.Right() += 2;
+ if ( pValue->isRightAligned() )
+ aControlRect.Right() += 1;
+ }
+ aControlRect.Top() -= 2;
+ aControlRect.Bottom() += 2;
+ }
+ rNativeBoundingRegion = aControlRect;
+ bRet = TRUE;
+ }
+
ReleaseDC( mhWnd, hDC );
return( bRet );
}
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index a6567464ac5e..7314fd2b6164 100755..100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -2891,8 +2891,8 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
BOOL bCompBorder = (aStyleSettings.GetOptions() & (STYLE_OPTION_MACSTYLE | STYLE_OPTION_UNIXSTYLE)) == 0;
// TODO: once those options vanish: just set bCompBorder to TRUE
// to have the system colors read
- aStyleSettings.SetScrollBarSize( Min( GetSystemMetrics( SM_CXVSCROLL ), 20 ) ); // #99956# do not allow huge scrollbars, most of the UI is not scaled anymore
- aStyleSettings.SetSpinSize( Min( GetSystemMetrics( SM_CXVSCROLL ), 20 ) );
+ aStyleSettings.SetScrollBarSize( GetSystemMetrics( SM_CXVSCROLL ) );
+ aStyleSettings.SetSpinSize( GetSystemMetrics( SM_CXVSCROLL ) );
aStyleSettings.SetCursorBlinkTime( GetCaretBlinkTime() );
if ( bCompBorder )
{