summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2010-01-28 18:49:22 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2010-01-28 18:49:22 +0000
commitedcc547422e9d869bf1d7982a49430b6c398533a (patch)
tree26311cc60b3b4d615741b75728f1d44ee7d39a35
parent596c166299cdec53864bb1f8a2f5506a410a8392 (diff)
parent60086bf5cd67da4d16b9c70c8137ec5fd675743e (diff)
koheidatapilot03: merge with DEV300_m56
-rw-r--r--avmedia/prj/build.lst2
-rw-r--r--basic/inc/basic/sbstar.hxx1
-rw-r--r--basic/prj/build.lst2
-rw-r--r--basic/source/classes/sb.cxx6
-rw-r--r--basic/source/classes/sb.src2
-rw-r--r--basic/source/classes/sbunoobj.cxx315
-rw-r--r--basic/source/classes/sbxmod.cxx1
-rw-r--r--basic/source/comp/exprtree.cxx6
-rw-r--r--basic/source/comp/scanner.cxx12
-rw-r--r--basic/source/inc/runtime.hxx37
-rw-r--r--basic/source/inc/sbunoobj.hxx53
-rw-r--r--basic/source/runtime/runtime.cxx42
-rw-r--r--basic/source/runtime/step2.cxx10
-rw-r--r--basic/source/sbx/sbxvalue.cxx16
-rwxr-xr-xconnectivity/inc/connectivity/DriversConfig.hxx88
-rw-r--r--connectivity/inc/connectivity/dbexception.hxx6
-rw-r--r--connectivity/inc/connectivity/dbmetadata.hxx7
-rw-r--r--connectivity/inc/connectivity/sqlnode.hxx13
-rw-r--r--connectivity/inc/connectivity/sqlparse.hxx3
-rwxr-xr-xconnectivity/makefile.pmk66
-rw-r--r--connectivity/prj/build.lst14
-rw-r--r--connectivity/prj/d.lst4
-rw-r--r--connectivity/qa/drivers/dbase/makefile.mk8
-rw-r--r--connectivity/source/commontools/DateConversion.cxx4
-rwxr-xr-xconnectivity/source/commontools/DriversConfig.cxx241
-rw-r--r--connectivity/source/commontools/FValue.cxx34
-rw-r--r--connectivity/source/commontools/dbconversion.cxx14
-rw-r--r--connectivity/source/commontools/dbmetadata.cxx10
-rw-r--r--connectivity/source/commontools/dbtools2.cxx86
-rw-r--r--connectivity/source/commontools/makefile.mk1
-rw-r--r--connectivity/source/commontools/parameters.cxx18
-rw-r--r--connectivity/source/dbtools/makefile.mk1
-rwxr-xr-xconnectivity/source/drivers/adabas/adabas.xcu128
-rw-r--r--connectivity/source/drivers/adabas/makefile.mk8
-rwxr-xr-xconnectivity/source/drivers/ado/ado.xcu242
-rw-r--r--connectivity/source/drivers/ado/makefile.mk13
-rwxr-xr-xconnectivity/source/drivers/calc/calc.xcu66
-rw-r--r--connectivity/source/drivers/calc/makefile.mk4
-rw-r--r--connectivity/source/drivers/dbase/DTable.cxx13
-rwxr-xr-xconnectivity/source/drivers/dbase/dbase.xcu98
-rw-r--r--connectivity/source/drivers/dbase/makefile.mk4
-rw-r--r--connectivity/source/drivers/evoab/LCatalog.cxx75
-rw-r--r--connectivity/source/drivers/evoab/LCatalog.hxx (renamed from svx/source/sdr/overlay/overlaylinestriped.cxx)31
-rw-r--r--connectivity/source/drivers/evoab/LColumnAlias.cxx235
-rw-r--r--connectivity/source/drivers/evoab/LColumnAlias.hxx116
-rw-r--r--connectivity/source/drivers/evoab/LColumns.cxx60
-rw-r--r--connectivity/source/drivers/evoab/LColumns.hxx (renamed from svx/inc/svdtouch.hxx)50
-rw-r--r--connectivity/source/drivers/evoab/LConfigAccess.cxx164
-rw-r--r--connectivity/source/drivers/evoab/LConfigAccess.hxx49
-rw-r--r--connectivity/source/drivers/evoab/LConnection.cxx270
-rw-r--r--connectivity/source/drivers/evoab/LConnection.hxx81
-rw-r--r--connectivity/source/drivers/evoab/LDatabaseMetaData.cxx394
-rw-r--r--connectivity/source/drivers/evoab/LDatabaseMetaData.hxx59
-rw-r--r--connectivity/source/drivers/evoab/LDebug.cxx45
-rw-r--r--connectivity/source/drivers/evoab/LDebug.hxx (renamed from svx/inc/svx/sdr/overlay/overlaylinestriped.hxx)28
-rw-r--r--connectivity/source/drivers/evoab/LDriver.cxx508
-rw-r--r--connectivity/source/drivers/evoab/LDriver.hxx118
-rw-r--r--connectivity/source/drivers/evoab/LFolderList.cxx566
-rw-r--r--connectivity/source/drivers/evoab/LFolderList.hxx95
-rw-r--r--connectivity/source/drivers/evoab/LNoException.cxx327
-rw-r--r--connectivity/source/drivers/evoab/LPreparedStatement.cxx46
-rw-r--r--connectivity/source/drivers/evoab/LPreparedStatement.hxx53
-rw-r--r--connectivity/source/drivers/evoab/LResultSet.cxx193
-rw-r--r--connectivity/source/drivers/evoab/LResultSet.hxx84
-rw-r--r--connectivity/source/drivers/evoab/LServices.cxx178
-rw-r--r--connectivity/source/drivers/evoab/LStatement.cxx46
-rw-r--r--connectivity/source/drivers/evoab/LStatement.hxx52
-rw-r--r--connectivity/source/drivers/evoab/LTable.cxx873
-rw-r--r--connectivity/source/drivers/evoab/LTable.hxx103
-rw-r--r--connectivity/source/drivers/evoab/LTables.cxx65
-rw-r--r--connectivity/source/drivers/evoab/LTables.hxx55
-rw-r--r--connectivity/source/drivers/evoab/evoab.map8
-rwxr-xr-xconnectivity/source/drivers/evoab/evoab.xcu64
-rw-r--r--connectivity/source/drivers/evoab/evoab.xml33
-rw-r--r--connectivity/source/drivers/evoab/exports.dxp3
-rw-r--r--connectivity/source/drivers/evoab/makefile.mk108
-rw-r--r--connectivity/source/drivers/evoab2/NResultSet.cxx1
-rwxr-xr-xconnectivity/source/drivers/evoab2/evoab2.xcu79
-rw-r--r--connectivity/source/drivers/evoab2/makefile.mk4
-rw-r--r--connectivity/source/drivers/file/FStatement.cxx48
-rw-r--r--connectivity/source/drivers/file/FStringFunctions.cxx13
-rw-r--r--connectivity/source/drivers/flat/ETable.cxx16
-rwxr-xr-xconnectivity/source/drivers/flat/flat.xcu113
-rw-r--r--connectivity/source/drivers/flat/makefile.mk4
-rwxr-xr-xconnectivity/source/drivers/hsqldb/hsqldb.xcu76
-rw-r--r--connectivity/source/drivers/hsqldb/makefile.mk4
-rw-r--r--connectivity/source/drivers/jdbc/DatabaseMetaData.cxx3
-rw-r--r--connectivity/source/drivers/jdbc/ResultSet.cxx2
-rwxr-xr-xconnectivity/source/drivers/jdbc/jdbc.xcu207
-rw-r--r--connectivity/source/drivers/jdbc/makefile.mk4
-rw-r--r--connectivity/source/drivers/jdbc/tools.cxx3
-rwxr-xr-xconnectivity/source/drivers/kab/kab.xcu49
-rw-r--r--connectivity/source/drivers/kab/makefile.mk4
-rwxr-xr-xconnectivity/source/drivers/macab/macab.xcu49
-rwxr-xr-xconnectivity/source/drivers/macab/makefile.mk4
-rw-r--r--connectivity/source/drivers/mozab/MColumnAlias.cxx152
-rw-r--r--connectivity/source/drivers/mozab/MColumnAlias.hxx77
-rw-r--r--connectivity/source/drivers/mozab/MConnection.cxx3
-rw-r--r--connectivity/source/drivers/mozab/MConnection.hxx1
-rw-r--r--connectivity/source/drivers/mozab/MDatabaseMetaData.cxx2
-rw-r--r--connectivity/source/drivers/mozab/MPreparedStatement.cxx137
-rw-r--r--connectivity/source/drivers/mozab/MPreparedStatement.hxx28
-rw-r--r--connectivity/source/drivers/mozab/MResultSet.cxx7
-rw-r--r--connectivity/source/drivers/mozab/MResultSet.hxx4
-rw-r--r--connectivity/source/drivers/mozab/MResultSetMetaData.cxx7
-rw-r--r--connectivity/source/drivers/mozab/MStatement.cxx224
-rw-r--r--connectivity/source/drivers/mozab/MStatement.hxx80
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx1
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx6
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx9
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx27
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.cxx6
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/makefile.mk4
-rw-r--r--connectivity/source/drivers/mozab/makefile.mk19
-rwxr-xr-xconnectivity/source/drivers/mozab/mozab.xcu157
-rwxr-xr-xconnectivity/source/drivers/mozab/mozab2.xcu121
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx2
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx453
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx78
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx6
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.cxx6
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx52
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx4
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx407
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx20
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx32
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx5
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/makefile.mk9
-rw-r--r--connectivity/source/drivers/mozab/post_include_mozilla.h12
-rw-r--r--connectivity/source/drivers/mozab/pre_include_mozilla.h14
-rw-r--r--connectivity/source/drivers/mysql/makefile.mk4
-rwxr-xr-xconnectivity/source/drivers/mysql/mysql.xcu177
-rw-r--r--connectivity/source/drivers/odbc/makefile.mk4
-rwxr-xr-xconnectivity/source/drivers/odbc/odbc.xcu173
-rw-r--r--connectivity/source/drivers/odbcbase/OTools.cxx10
-rw-r--r--connectivity/source/manager/makefile.mk3
-rw-r--r--connectivity/source/manager/mdrivermanager.cxx49
-rw-r--r--connectivity/source/manager/mdrivermanager.hxx8
-rw-r--r--connectivity/source/manager/mregistration.cxx6
-rw-r--r--connectivity/source/parse/sqlbison.y169
-rw-r--r--connectivity/source/parse/sqlflex.l1
-rw-r--r--connectivity/source/parse/sqliterator.cxx16
-rw-r--r--connectivity/source/parse/sqlnode.cxx238
-rw-r--r--connectivity/source/resource/conn_shared_res.src10
-rwxr-xr-xconnectivity/target.pmk40
-rwxr-xr-xconnectivity/util/delzip0
-rwxr-xr-xconnectivity/util/langfilter.xsl37
-rwxr-xr-xconnectivity/util/makefile.mk80
-rw-r--r--desktop/inc/app.hxx1
-rw-r--r--desktop/prj/build.lst5
-rw-r--r--desktop/prj/d.lst2
-rw-r--r--desktop/source/app/app.cxx4
-rw-r--r--desktop/source/app/check_ext_deps.cxx256
-rw-r--r--desktop/source/app/makefile.mk1
-rw-r--r--desktop/source/deployment/gui/dp_gui.h1
-rw-r--r--desktop/source/deployment/gui/dp_gui.hrc82
-rw-r--r--desktop/source/deployment/gui/dp_gui_dialog.src227
-rw-r--r--desktop/source/deployment/gui/dp_gui_dialog2.cxx2050
-rw-r--r--desktop/source/deployment/gui/dp_gui_dialog2.hxx167
-rw-r--r--desktop/source/deployment/gui/dp_gui_dialog2.src60
-rw-r--r--desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx159
-rw-r--r--desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx21
-rw-r--r--desktop/source/deployment/gui/dp_gui_extlistbox.cxx1175
-rw-r--r--desktop/source/deployment/gui/dp_gui_extlistbox.hxx271
-rw-r--r--desktop/source/deployment/gui/dp_gui_service.cxx26
-rw-r--r--desktop/source/deployment/gui/dp_gui_theextmgr.cxx147
-rw-r--r--desktop/source/deployment/gui/dp_gui_theextmgr.hxx19
-rw-r--r--desktop/source/deployment/gui/dp_gui_updatedata.hxx15
-rw-r--r--desktop/source/deployment/gui/dp_gui_updatedialog.cxx77
-rw-r--r--desktop/source/deployment/gui/dp_gui_updatedialog.hxx15
-rw-r--r--desktop/source/deployment/gui/makefile.mk1
-rw-r--r--desktop/source/deployment/registry/dp_backend.cxx11
-rw-r--r--desktop/source/deployment/registry/help/dp_help.src2
-rw-r--r--desktop/source/deployment/registry/inc/dp_backend.h6
-rw-r--r--desktop/source/deployment/registry/package/dp_package.cxx22
-rw-r--r--desktop/source/inc/helpid.hrc6
-rw-r--r--desktop/util/hidother.src4
-rw-r--r--desktop/win32/source/guistdio/guistdio.inc75
-rw-r--r--desktop/win32/source/rebase/Resource.h41
-rw-r--r--desktop/win32/source/rebase/makefile.mk93
-rw-r--r--desktop/win32/source/rebase/rcfooter.txt2
-rw-r--r--desktop/win32/source/rebase/rcheader.txt39
-rw-r--r--desktop/win32/source/rebase/rctmpl.txt9
-rw-r--r--desktop/win32/source/rebase/rebase.cxx190
-rw-r--r--desktop/win32/source/rebase/rebasegui.cxx200
-rw-r--r--desktop/win32/source/rebase/rebasegui.ulf11
-rw-r--r--desktop/win32/source/setup/makefile.mk2
-rw-r--r--drawinglayer/inc/drawinglayer/attribute/sdrallattribute3d.hxx10
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/chartprimitive2d.hxx2
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx1
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx63
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx114
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx2
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx12
-rw-r--r--drawinglayer/inc/drawinglayer/processor2d/hittestprocessor2d.hxx113
-rw-r--r--drawinglayer/inc/drawinglayer/processor2d/linegeometryextractor2d.hxx8
-rw-r--r--drawinglayer/inc/drawinglayer/processor2d/textaspolygonextractor2d.hxx108
-rw-r--r--drawinglayer/prj/d.lst4
-rw-r--r--drawinglayer/source/attribute/sdrallattribute3d.cxx48
-rw-r--r--drawinglayer/source/primitive2d/chartprimitive2d.cxx7
-rw-r--r--drawinglayer/source/primitive2d/invertprimitive2d.cxx65
-rw-r--r--drawinglayer/source/primitive2d/makefile.mk2
-rw-r--r--drawinglayer/source/primitive2d/polygonprimitive2d.cxx13
-rw-r--r--drawinglayer/source/primitive2d/primitivetools2d.cxx106
-rw-r--r--drawinglayer/source/primitive2d/sceneprimitive2d.cxx8
-rw-r--r--drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx4
-rw-r--r--drawinglayer/source/primitive2d/textlayoutdevice.cxx35
-rw-r--r--drawinglayer/source/primitive2d/textprimitive2d.cxx16
-rw-r--r--drawinglayer/source/processor2d/canvasprocessor.cxx5
-rw-r--r--drawinglayer/source/processor2d/helperchartrenderer.cxx70
-rw-r--r--drawinglayer/source/processor2d/helperchartrenderer.hxx13
-rw-r--r--drawinglayer/source/processor2d/hittestprocessor2d.cxx451
-rw-r--r--drawinglayer/source/processor2d/linegeometryextractor2d.cxx4
-rw-r--r--drawinglayer/source/processor2d/makefile.mk4
-rw-r--r--drawinglayer/source/processor2d/textaspolygonextractor2d.cxx255
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx103
-rw-r--r--drawinglayer/source/processor2d/vclpixelprocessor2d.cxx28
-rw-r--r--drawinglayer/source/processor2d/vclprocessor2d.cxx249
-rw-r--r--drawinglayer/source/processor3d/zbufferprocessor3d.cxx4
-rw-r--r--drawinglayer/util/makefile.mk1
-rw-r--r--embeddedobj/source/msole/makefile.mk8
-rw-r--r--embeddedobj/source/msole/olecomponent.cxx152
-rw-r--r--embeddedobj/source/msole/platform.h11
-rw-r--r--formula/inc/formula/FormulaCompiler.hxx3
-rw-r--r--formula/inc/formula/IFunctionDescription.hxx1
-rw-r--r--formula/source/ui/dlg/formula.cxx39
-rw-r--r--fpicker/prj/build.lst3
-rw-r--r--fpicker/prj/d.lst1
-rw-r--r--fpicker/source/aqua/AquaFilePickerDelegate.mm4
-rw-r--r--fpicker/source/generic/fpicker.cxx2
-rw-r--r--fpicker/source/unx/kde4/FPServiceInfo.hxx74
-rw-r--r--fpicker/source/unx/kde4/KDE4FPEntry.cxx136
-rw-r--r--fpicker/source/unx/kde4/KDE4FilePicker.cxx717
-rw-r--r--fpicker/source/unx/kde4/KDE4FilePicker.hxx205
-rw-r--r--fpicker/source/unx/kde4/fps-kde4-ucd.txt6
-rw-r--r--fpicker/source/unx/kde4/fps_kde4.xml51
-rw-r--r--fpicker/source/unx/kde4/makefile.mk117
-rw-r--r--fpicker/source/win32/filepicker/FPentry.cxx4
-rw-r--r--fpicker/source/win32/filepicker/SolarMutex.cxx58
-rw-r--r--fpicker/source/win32/filepicker/SolarMutex.hxx33
-rw-r--r--fpicker/source/win32/filepicker/VistaFilePicker.cxx36
-rw-r--r--fpicker/source/win32/filepicker/VistaFilePicker.hxx2
-rw-r--r--fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx126
-rw-r--r--fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx5
-rw-r--r--fpicker/source/win32/filepicker/asynceventnotifier.cxx5
-rw-r--r--fpicker/source/win32/filepicker/asyncrequests.cxx4
-rw-r--r--fpicker/source/win32/filepicker/filepickerstate.cxx23
-rw-r--r--fpicker/source/win32/filepicker/makefile.mk6
-rw-r--r--fpicker/source/win32/folderpicker/MtaFop.cxx34
-rw-r--r--fpicker/source/win32/misc/WinImplHelper.cxx46
-rw-r--r--fpicker/source/win32/misc/WinImplHelper.hxx2
-rw-r--r--framework/inc/helper/mischelper.hxx61
-rw-r--r--framework/inc/uielement/langselectionmenucontroller.hxx4
-rw-r--r--framework/inc/uielement/langselectionstatusbarcontroller.hxx4
-rw-r--r--framework/prj/build.lst2
-rw-r--r--framework/source/helper/makefile.mk3
-rw-r--r--framework/source/helper/mischelper.cxx71
-rw-r--r--framework/source/services/frame.cxx9
-rw-r--r--framework/source/uielement/langselectionmenucontroller.cxx36
-rw-r--r--framework/source/uielement/langselectionstatusbarcontroller.cxx36
-rw-r--r--framework/source/uielement/toolbarmanager.cxx16
-rw-r--r--framework/util/makefile.mk1
-rw-r--r--linguistic/source/gciterator.cxx38
-rw-r--r--officecfg/prj/build.lst35
-rw-r--r--officecfg/prj/d.lst4
-rw-r--r--officecfg/registry/data/org/openoffice/Office/Accelerators.xcu10
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu14
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu5
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Common.xcs29
-rwxr-xr-xofficecfg/registry/schema/org/openoffice/Office/DataAccess/Drivers.xcs100
-rwxr-xr-xofficecfg/registry/schema/org/openoffice/Office/DataAccess/makefile.mk46
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/ExtendedColorScheme.xcs4
-rw-r--r--officecfg/registry/schema/org/openoffice/Setup.xcs7
-rw-r--r--readlicense_oo/prj/build.lst2
-rw-r--r--sfx2/inc/sfx2/DocumentMetadataAccess.hxx218
-rw-r--r--sfx2/inc/sfx2/Metadatable.hxx190
-rw-r--r--sfx2/inc/sfx2/XmlIdRegistry.hxx101
-rw-r--r--sfx2/inc/sfx2/app.hxx1
-rw-r--r--sfx2/inc/sfx2/dinfdlg.hxx75
-rw-r--r--sfx2/inc/sfx2/docfile.hxx93
-rw-r--r--sfx2/inc/sfx2/filedlghelper.hxx8
-rw-r--r--sfx2/inc/sfx2/msg.hxx12
-rw-r--r--sfx2/inc/sfx2/objsh.hxx13
-rw-r--r--sfx2/inc/sfx2/passwd.hxx1
-rw-r--r--sfx2/inc/sfx2/sfx.hrc8
-rw-r--r--sfx2/inc/sfx2/sfxbasemodel.hxx138
-rw-r--r--sfx2/inc/sfx2/sfxhtml.hxx22
-rw-r--r--sfx2/inc/sfx2/sfxsids.hrc1
-rw-r--r--sfx2/prj/build.lst2
-rw-r--r--sfx2/prj/d.lst3
-rw-r--r--sfx2/qa/complex/DocumentMetadataAccessTest.java1270
-rw-r--r--sfx2/qa/complex/makefile.mk4
-rw-r--r--sfx2/qa/complex/testdocuments/TESTRDFA.odtbin0 -> 7540 bytes
-rw-r--r--sfx2/qa/complex/tests.sce1
-rw-r--r--sfx2/sdi/sfx.sdi26
-rw-r--r--sfx2/sdi/sfxslots.sdi8
-rw-r--r--sfx2/source/appl/app.cxx8
-rw-r--r--sfx2/source/appl/childwin.cxx3
-rw-r--r--sfx2/source/appl/shutdownicon.cxx6
-rw-r--r--sfx2/source/bastyp/progress.cxx2
-rw-r--r--sfx2/source/bastyp/sfxhtml.cxx222
-rw-r--r--sfx2/source/control/dispatch.cxx18
-rw-r--r--sfx2/source/control/unoctitm.cxx11
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx331
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx112
-rw-r--r--sfx2/source/dialog/passwd.cxx9
-rw-r--r--sfx2/source/dialog/templdlg.cxx11
-rw-r--r--sfx2/source/doc/DocumentMetadataAccess.cxx1414
-rw-r--r--sfx2/source/doc/Metadatable.cxx1860
-rw-r--r--sfx2/source/doc/docfile.cxx358
-rw-r--r--sfx2/source/doc/docinsert.cxx26
-rw-r--r--sfx2/source/doc/doctemplates.cxx13
-rw-r--r--sfx2/source/doc/makefile.mk7
-rw-r--r--sfx2/source/doc/objmisc.cxx131
-rw-r--r--sfx2/source/doc/objserv.cxx21
-rw-r--r--sfx2/source/doc/objstor.cxx158
-rw-r--r--sfx2/source/doc/objxtor.cxx20
-rw-r--r--sfx2/source/doc/plugin.cxx2
-rwxr-xr-xsfx2/source/doc/printhelper.cxx89
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx471
-rw-r--r--sfx2/source/inc/objshimp.hxx5
-rw-r--r--sfx2/source/toolbox/tbxitem.cxx19
-rw-r--r--sfx2/util/makefile.mk4
-rw-r--r--shell/inc/internal/basereader.hxx2
-rw-r--r--shell/inc/internal/contentreader.hxx3
-rw-r--r--shell/inc/internal/metainforeader.hxx3
-rw-r--r--shell/inc/internal/propsheets.hxx1
-rw-r--r--shell/inc/internal/types.hxx3
-rw-r--r--shell/inc/internal/zipfile.hxx11
-rw-r--r--shell/prj/build.lst3
-rwxr-xr-xshell/source/all/makefile.mk2
-rw-r--r--shell/source/all/ooofilereader/basereader.cxx9
-rw-r--r--shell/source/all/ooofilereader/contentreader.cxx23
-rw-r--r--shell/source/all/ooofilereader/makefile.mk3
-rw-r--r--shell/source/all/ooofilereader/metainforeader.cxx42
-rw-r--r--shell/source/all/zipfile/makefile.mk7
-rw-r--r--shell/source/all/zipfile/zipfile.cxx22
-rw-r--r--shell/source/backends/kde4be/exports.map10
-rw-r--r--shell/source/backends/kde4be/kde4backend.cxx158
-rw-r--r--shell/source/backends/kde4be/kde4backend.hxx123
-rw-r--r--shell/source/backends/kde4be/kde4be.xml35
-rw-r--r--shell/source/backends/kde4be/kde4be1-ucd.txt6
-rw-r--r--shell/source/backends/kde4be/kde4becdef.cxx143
-rw-r--r--shell/source/backends/kde4be/kde4commonlayer.cxx157
-rw-r--r--shell/source/backends/kde4be/kde4commonlayer.hxx51
-rw-r--r--shell/source/backends/kde4be/kde4inetlayer.cxx255
-rw-r--r--shell/source/backends/kde4be/kde4inetlayer.hxx59
-rw-r--r--shell/source/backends/kde4be/kde4pathslayer.cxx124
-rw-r--r--shell/source/backends/kde4be/kde4pathslayer.hxx82
-rw-r--r--shell/source/backends/kde4be/kde4vcllayer.cxx115
-rw-r--r--shell/source/backends/kde4be/kde4vcllayer.hxx53
-rw-r--r--shell/source/backends/kde4be/makefile.mk94
-rw-r--r--shell/source/win32/shlxthandler/ooofilt/makefile.mk16
-rw-r--r--shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx212
-rw-r--r--shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx33
-rw-r--r--shell/source/win32/shlxthandler/ooofilt/proxy/ooofiltproxy.cxx1
-rw-r--r--shell/source/win32/shlxthandler/propsheets/propsheets.cxx28
-rw-r--r--shell/source/win32/shlxthandler/res/makefile.mk2
-rw-r--r--shell/source/win32/shlxthandler/util/makefile.mk1
-rw-r--r--shell/source/win32/shlxthandler/util/utilities.cxx1
-rw-r--r--svx/inc/accessibility.hrc94
-rw-r--r--svx/inc/edtspell.hxx3
-rw-r--r--svx/inc/mscodec.hxx51
-rw-r--r--svx/inc/optgenrl.hrc2
-rw-r--r--svx/inc/svx/dialogs.hrc46
-rw-r--r--svx/inc/svx/editobj.hxx3
-rw-r--r--svx/inc/svx/editview.hxx4
-rw-r--r--svx/inc/svx/emphitem.hxx2
-rw-r--r--svx/inc/svx/fntctrl.hxx1
-rw-r--r--svx/inc/svx/msocximex.hxx6
-rw-r--r--svx/inc/svx/obj3d.hxx3
-rw-r--r--svx/inc/svx/outliner.hxx3
-rw-r--r--svx/inc/svx/outlobj.hxx3
-rw-r--r--svx/inc/svx/paperinf.hxx116
-rw-r--r--svx/inc/svx/sdr/attribute/sdrallattribute.hxx27
-rw-r--r--svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx108
-rw-r--r--svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx74
-rw-r--r--svx/inc/svx/sdr/attribute/sdrtextattribute.hxx39
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofgraphic.hxx19
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofsdrobjcustomshape.hxx3
-rw-r--r--svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx14
-rw-r--r--svx/inc/svx/sdr/overlay/overlayanimatedbitmapex.hxx12
-rw-r--r--svx/inc/svx/sdr/overlay/overlaybitmap.hxx94
-rw-r--r--svx/inc/svx/sdr/overlay/overlaybitmapex.hxx11
-rw-r--r--svx/inc/svx/sdr/overlay/overlaycrosshair.hxx32
-rw-r--r--svx/inc/svx/sdr/overlay/overlayhatchrect.hxx24
-rw-r--r--svx/inc/svx/sdr/overlay/overlayhelpline.hxx34
-rw-r--r--svx/inc/svx/sdr/overlay/overlayline.hxx36
-rw-r--r--svx/inc/svx/sdr/overlay/overlaymanager.hxx37
-rw-r--r--svx/inc/svx/sdr/overlay/overlaymanagerbuffered.hxx14
-rw-r--r--svx/inc/svx/sdr/overlay/overlayobject.hxx99
-rw-r--r--svx/inc/svx/sdr/overlay/overlayobjectcell.hxx8
-rw-r--r--svx/inc/svx/sdr/overlay/overlayobjectlist.hxx7
-rw-r--r--svx/inc/svx/sdr/overlay/overlaypolypolygon.hxx36
-rw-r--r--svx/inc/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx12
-rw-r--r--svx/inc/svx/sdr/overlay/overlayrollingrectangle.hxx50
-rw-r--r--svx/inc/svx/sdr/overlay/overlaytools.hxx281
-rw-r--r--svx/inc/svx/sdr/overlay/overlaytriangle.hxx46
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx21
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx12
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx85
-rw-r--r--svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx6
-rw-r--r--svx/inc/svx/sdr/properties/properties.hxx5
-rw-r--r--svx/inc/svx/sdr/properties/textproperties.hxx7
-rw-r--r--svx/inc/svx/sdrhittesthelper.hxx81
-rw-r--r--svx/inc/svx/svdedxv.hxx3
-rw-r--r--svx/inc/svx/svdetc.hxx6
-rw-r--r--svx/inc/svx/svdfppt.hxx12
-rw-r--r--svx/inc/svx/svdhdl.hxx3
-rw-r--r--svx/inc/svx/svdmrkv.hxx11
-rw-r--r--svx/inc/svx/svdoashp.hxx4
-rw-r--r--svx/inc/svx/svdoattr.hxx3
-rw-r--r--svx/inc/svx/svdobj.hxx14
-rw-r--r--svx/inc/svx/svdocapt.hxx1
-rw-r--r--svx/inc/svx/svdocirc.hxx1
-rw-r--r--svx/inc/svx/svdoedge.hxx1
-rw-r--r--svx/inc/svx/svdograf.hxx4
-rw-r--r--svx/inc/svx/svdogrp.hxx1
-rw-r--r--svx/inc/svx/svdomeas.hxx2
-rw-r--r--svx/inc/svx/svdoole2.hxx9
-rw-r--r--svx/inc/svx/svdopath.hxx1
-rw-r--r--svx/inc/svx/svdorect.hxx2
-rw-r--r--svx/inc/svx/svdotable.hxx1
-rw-r--r--svx/inc/svx/svdotext.hxx6
-rw-r--r--svx/inc/svx/svdouno.hxx1
-rw-r--r--svx/inc/svx/svdovirt.hxx1
-rw-r--r--svx/inc/svx/svdpage.hxx31
-rw-r--r--svx/inc/svx/svdpntv.hxx33
-rw-r--r--svx/inc/svx/svdtext.hxx3
-rw-r--r--svx/inc/svx/svxdlg.hxx9
-rw-r--r--svx/inc/svx/svxenum.hxx43
-rw-r--r--svx/inc/svx/svxfont.hxx3
-rw-r--r--svx/inc/svx/svxids.hrc6
-rw-r--r--svx/inc/svx/xcolit.hxx2
-rw-r--r--svx/inc/svx/xflclit.hxx2
-rw-r--r--svx/inc/svx/xflftrit.hxx2
-rw-r--r--svx/inc/svx/xflgrit.hxx2
-rw-r--r--svx/inc/svx/xflhtit.hxx2
-rw-r--r--svx/inc/svx/xftshcit.hxx2
-rw-r--r--svx/inc/svx/xit.hxx8
-rw-r--r--svx/inc/svx/xlnclit.hxx2
-rw-r--r--svx/inc/svx/xlndsit.hxx2
-rw-r--r--svx/inc/svx/xlnedit.hxx2
-rw-r--r--svx/inc/svx/xlnstit.hxx2
-rw-r--r--svx/inc/svx/xsflclit.hxx2
-rw-r--r--svx/inc/xmlgrhlp.hxx2
-rw-r--r--svx/prj/build.lst2
-rw-r--r--svx/prj/d.lst7
-rw-r--r--svx/sdi/svx.sdi51
-rw-r--r--svx/source/accessibility/GraphCtlAccessibleContext.cxx11
-rw-r--r--svx/source/cui/commonlingui.src20
-rw-r--r--svx/source/cui/cuicharmap.cxx8
-rw-r--r--svx/source/cui/dlgfact.cxx6
-rw-r--r--svx/source/cui/dlgfact.hxx2
-rw-r--r--svx/source/cui/hangulhanjadlg.src38
-rw-r--r--svx/source/cui/insrc.cxx88
-rw-r--r--svx/source/cui/insrc.hrc43
-rw-r--r--svx/source/cui/insrc.hxx72
-rw-r--r--svx/source/cui/insrc.src118
-rw-r--r--svx/source/cui/macropg.src4
-rwxr-xr-xsvx/source/cui/makefile.mk6
-rw-r--r--svx/source/cui/optgdlg.cxx32
-rw-r--r--svx/source/cui/optpath.cxx24
-rw-r--r--svx/source/cui/page.cxx75
-rw-r--r--svx/source/cui/page.h42
-rw-r--r--svx/source/cui/page.hxx9
-rw-r--r--svx/source/cui/page.src138
-rw-r--r--svx/source/cui/svuidlg.src24
-rw-r--r--svx/source/cui/zoom.src44
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.cxx60
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeEngine.cxx32
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeGeometry.cxx478
-rw-r--r--svx/source/dialog/dlgctrl.cxx38
-rw-r--r--svx/source/dialog/fntctrl.cxx29
-rw-r--r--svx/source/dialog/imapdlg.cxx5
-rw-r--r--svx/source/dialog/imapwnd.cxx2
-rw-r--r--svx/source/dialog/srchdlg.cxx2
-rw-r--r--svx/source/editeng/editdoc.cxx2
-rw-r--r--svx/source/editeng/editdoc.hxx13
-rw-r--r--svx/source/editeng/editdoc2.cxx50
-rw-r--r--svx/source/editeng/editobj.cxx76
-rw-r--r--svx/source/editeng/editobj2.hxx13
-rw-r--r--svx/source/editeng/editview.cxx51
-rw-r--r--svx/source/editeng/edtspell.cxx25
-rw-r--r--svx/source/editeng/impedit2.cxx51
-rw-r--r--svx/source/engine3d/obj3d.cxx16
-rw-r--r--svx/source/engine3d/scene3d.cxx13
-rw-r--r--svx/source/fmcomp/fmgridif.cxx2
-rw-r--r--svx/source/fmcomp/gridcell.cxx37
-rw-r--r--svx/source/form/fmprop.cxx1
-rw-r--r--svx/source/gallery2/galobj.cxx3
-rw-r--r--svx/source/inc/fmprop.hrc1
-rw-r--r--svx/source/items/paperinf.cxx298
-rw-r--r--svx/source/items/paraitem.cxx1
-rw-r--r--svx/source/msfilter/mscodec.cxx170
-rw-r--r--svx/source/msfilter/msdffimp.cxx12
-rw-r--r--svx/source/msfilter/msocximex.cxx14
-rw-r--r--svx/source/outliner/outliner.cxx4
-rw-r--r--svx/source/outliner/outlobj.cxx17
-rw-r--r--svx/source/outliner/outlvw.cxx12
-rw-r--r--svx/source/sdr/attribute/makefile.mk5
-rw-r--r--svx/source/sdr/attribute/sdrallattribute.cxx126
-rw-r--r--svx/source/sdr/attribute/sdrformtextattribute.cxx304
-rw-r--r--svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx (renamed from svx/inc/svx/sdr/overlay/overlaysdrobject.hxx)58
-rw-r--r--svx/source/sdr/attribute/sdrtextattribute.cxx96
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dpolygon.cxx17
-rw-r--r--svx/source/sdr/contact/viewcontactofgraphic.cxx335
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx103
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrpathobj.cxx119
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofgraphic.cxx29
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofpageobj.cxx3
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx287
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx593
-rw-r--r--svx/source/sdr/overlay/makefile.mk16
-rw-r--r--svx/source/sdr/overlay/overlayanimatedbitmapex.cxx76
-rw-r--r--svx/source/sdr/overlay/overlaybitmap.cxx162
-rw-r--r--svx/source/sdr/overlay/overlaybitmapex.cxx50
-rw-r--r--svx/source/sdr/overlay/overlaycrosshair.cxx100
-rw-r--r--svx/source/sdr/overlay/overlayhatchrect.cxx88
-rw-r--r--svx/source/sdr/overlay/overlayhelpline.cxx189
-rw-r--r--svx/source/sdr/overlay/overlayline.cxx94
-rw-r--r--svx/source/sdr/overlay/overlaymanager.cxx300
-rw-r--r--svx/source/sdr/overlay/overlaymanagerbuffered.cxx55
-rw-r--r--svx/source/sdr/overlay/overlayobject.cxx221
-rw-r--r--svx/source/sdr/overlay/overlayobjectcell.cxx98
-rw-r--r--svx/source/sdr/overlay/overlayobjectlist.cxx95
-rw-r--r--svx/source/sdr/overlay/overlaypolypolygon.cxx93
-rw-r--r--svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx50
-rw-r--r--svx/source/sdr/overlay/overlayrollingrectangle.cxx229
-rw-r--r--svx/source/sdr/overlay/overlaysdrobject.cxx87
-rw-r--r--svx/source/sdr/overlay/overlaytools.cxx498
-rw-r--r--svx/source/sdr/overlay/overlaytriangle.cxx122
-rw-r--r--svx/source/sdr/primitive2d/sdrattributecreator.cxx50
-rw-r--r--svx/source/sdr/primitive2d/sdrdecompositiontools.cxx252
-rw-r--r--svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx9
-rw-r--r--svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx229
-rw-r--r--svx/source/sdr/properties/properties.cxx5
-rw-r--r--svx/source/sdr/properties/textproperties.cxx25
-rw-r--r--svx/source/svdraw/makefile.mk3
-rw-r--r--svx/source/svdraw/sdrhittesthelper.cxx176
-rw-r--r--svx/source/svdraw/sdrpaintwindow.cxx44
-rw-r--r--svx/source/svdraw/svdcrtv.cxx55
-rw-r--r--svx/source/svdraw/svddrgmt.cxx6
-rw-r--r--svx/source/svdraw/svddrgv.cxx4
-rw-r--r--svx/source/svdraw/svdedxv.cxx46
-rw-r--r--svx/source/svdraw/svdetc.cxx279
-rw-r--r--svx/source/svdraw/svdfppt.cxx493
-rw-r--r--svx/source/svdraw/svdhdl.cxx167
-rw-r--r--svx/source/svdraw/svdmrkv.cxx50
-rw-r--r--svx/source/svdraw/svdoashp.cxx198
-rw-r--r--svx/source/svdraw/svdoattr.cxx21
-rw-r--r--svx/source/svdraw/svdobj.cxx123
-rw-r--r--svx/source/svdraw/svdocapt.cxx31
-rw-r--r--svx/source/svdraw/svdocirc.cxx122
-rw-r--r--svx/source/svdraw/svdoedge.cxx33
-rw-r--r--svx/source/svdraw/svdograf.cxx32
-rw-r--r--svx/source/svdraw/svdogrp.cxx26
-rw-r--r--svx/source/svdraw/svdomeas.cxx38
-rw-r--r--svx/source/svdraw/svdoole2.cxx141
-rw-r--r--svx/source/svdraw/svdopath.cxx81
-rw-r--r--svx/source/svdraw/svdorect.cxx76
-rw-r--r--svx/source/svdraw/svdotext.cxx96
-rw-r--r--svx/source/svdraw/svdotextdecomposition.cxx56
-rw-r--r--svx/source/svdraw/svdotextpathdecomposition.cxx248
-rw-r--r--svx/source/svdraw/svdotxed.cxx5
-rw-r--r--svx/source/svdraw/svdotxtr.cxx213
-rw-r--r--svx/source/svdraw/svdouno.cxx5
-rw-r--r--svx/source/svdraw/svdovirt.cxx7
-rw-r--r--svx/source/svdraw/svdpage.cxx113
-rw-r--r--svx/source/svdraw/svdpntv.cxx126
-rw-r--r--svx/source/svdraw/svdsnpv.cxx31
-rw-r--r--svx/source/svdraw/svdtext.cxx12
-rw-r--r--svx/source/svdraw/svdtouch.cxx299
-rw-r--r--svx/source/svdraw/svdtxhdl.cxx400
-rw-r--r--svx/source/svdraw/svdtxhdl.hxx73
-rw-r--r--svx/source/svdraw/svdview.cxx13
-rw-r--r--svx/source/svdraw/svdxcgv.cxx12
-rw-r--r--svx/source/table/cell.cxx5
-rw-r--r--svx/source/table/cellcursor.cxx71
-rw-r--r--svx/source/table/cellcursor.hxx2
-rw-r--r--svx/source/table/svdotable.cxx15
-rw-r--r--svx/source/table/tablecontroller.cxx65
-rw-r--r--svx/source/table/tablecontroller.hxx3
-rw-r--r--svx/source/table/tablehandles.cxx281
-rw-r--r--svx/source/table/tablehandles.hxx5
-rw-r--r--svx/source/table/tablelayouter.cxx136
-rw-r--r--svx/source/table/tablemodel.cxx120
-rw-r--r--svx/source/table/tablemodel.hxx3
-rw-r--r--svx/source/table/viewcontactoftableobj.cxx25
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src2
-rw-r--r--svx/source/unodraw/UnoGraphicExporter.cxx33
-rw-r--r--svx/source/unodraw/gluepts.cxx92
-rw-r--r--svx/source/unodraw/unomod.cxx9
-rw-r--r--svx/source/xml/xmlgrhlp.cxx99
-rw-r--r--svx/source/xoutdev/xattr.cxx50
-rw-r--r--svx/util/makefile.mk4
-rw-r--r--svx/util/makefile.pmk8
-rw-r--r--sysui/desktop/solaris/makefile.mk4
-rw-r--r--sysui/desktop/solaris/pkginfo3
-rw-r--r--sysui/prj/build.lst2
-rw-r--r--sysui/util/checksize.pl4
-rw-r--r--ucb/source/ucp/file/bc.cxx10
-rw-r--r--ucb/source/ucp/file/filcmd.cxx4
-rw-r--r--ucb/source/ucp/file/filglob.cxx3
-rw-r--r--ucb/source/ucp/file/filinpstr.cxx14
-rw-r--r--ucb/source/ucp/file/filprp.cxx2
-rw-r--r--ucb/source/ucp/file/filrow.cxx38
-rw-r--r--ucb/source/ucp/file/filrset.cxx22
-rw-r--r--ucb/source/ucp/file/filstr.cxx20
-rw-r--r--ucb/source/ucp/file/filtask.cxx2
-rw-r--r--ucb/source/ucp/file/prov.cxx8
-rw-r--r--ucb/source/ucp/file/shell.cxx16
-rw-r--r--uui/prj/build.lst2
-rw-r--r--uui/source/iahndl.cxx93
-rw-r--r--uui/source/iahndl.hxx16
-rw-r--r--uui/source/passcrtdlg.cxx12
-rw-r--r--uui/source/passcrtdlg.hrc27
-rw-r--r--uui/source/passcrtdlg.hxx2
-rw-r--r--uui/source/passcrtdlg.src67
-rw-r--r--uui/source/passworddlg.src47
-rw-r--r--xmlhelp/source/cxxhelp/provider/db.cxx44
-rw-r--r--xmlhelp/source/cxxhelp/provider/db.hxx2
-rw-r--r--xmloff/inc/RDFaExportHelper.hxx83
-rw-r--r--xmloff/inc/RDFaImportHelper.hxx91
-rw-r--r--xmloff/inc/SchXMLImport.hxx1
-rw-r--r--xmloff/inc/txtflde.hxx18
-rw-r--r--xmloff/inc/xmlkywd.hxx7
-rw-r--r--xmloff/inc/xmlnmspe.hxx5
-rw-r--r--xmloff/inc/xmloff/SchXMLExportHelper.hxx7
-rw-r--r--xmloff/inc/xmloff/SchXMLImportHelper.hxx7
-rw-r--r--xmloff/inc/xmloff/table/XMLTableExport.hxx2
-rw-r--r--xmloff/inc/xmloff/txtimp.hxx4
-rw-r--r--xmloff/inc/xmloff/txtparae.hxx21
-rw-r--r--xmloff/inc/xmloff/txtprmap.hxx2
-rw-r--r--xmloff/inc/xmloff/xmlexp.hxx28
-rw-r--r--xmloff/inc/xmloff/xmlimp.hxx20
-rw-r--r--xmloff/inc/xmloff/xmltoken.hxx16
-rw-r--r--xmloff/source/chart/SchXMLChartContext.cxx245
-rw-r--r--xmloff/source/chart/SchXMLChartContext.hxx10
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx160
-rw-r--r--xmloff/source/chart/SchXMLImport.cxx37
-rw-r--r--xmloff/source/chart/SchXMLPlotAreaContext.cxx60
-rw-r--r--xmloff/source/chart/SchXMLPlotAreaContext.hxx22
-rw-r--r--xmloff/source/chart/SchXMLSeries2Context.cxx257
-rw-r--r--xmloff/source/chart/SchXMLSeries2Context.hxx20
-rw-r--r--xmloff/source/chart/SchXMLTableContext.cxx60
-rw-r--r--xmloff/source/chart/SchXMLTableContext.hxx6
-rw-r--r--xmloff/source/chart/SchXMLTools.cxx113
-rw-r--r--xmloff/source/chart/SchXMLTools.hxx12
-rw-r--r--xmloff/source/chart/transporttypes.hxx22
-rw-r--r--xmloff/source/core/RDFaExportHelper.cxx218
-rw-r--r--xmloff/source/core/RDFaImportHelper.cxx458
-rw-r--r--xmloff/source/core/makefile.mk5
-rw-r--r--xmloff/source/core/xmlexp.cxx225
-rw-r--r--xmloff/source/core/xmlimp.cxx79
-rw-r--r--xmloff/source/core/xmltoken.cxx16
-rw-r--r--xmloff/source/draw/animationexport.cxx2
-rw-r--r--xmloff/source/draw/animationimport.cxx2
-rw-r--r--xmloff/source/draw/sdpropls.cxx29
-rw-r--r--xmloff/source/draw/sdpropls.hxx2
-rw-r--r--xmloff/source/draw/shapeexport.cxx3
-rw-r--r--xmloff/source/draw/shapeexport2.cxx25
-rw-r--r--xmloff/source/draw/shapeexport4.cxx26
-rw-r--r--xmloff/source/draw/ximpshap.cxx19
-rw-r--r--xmloff/source/forms/elementexport.cxx6
-rw-r--r--xmloff/source/forms/formattributes.cxx1
-rw-r--r--xmloff/source/forms/formattributes.hxx1
-rw-r--r--xmloff/source/forms/strings.hxx1
-rw-r--r--xmloff/source/table/XMLTableExport.cxx4
-rw-r--r--xmloff/source/text/XMLTextMarkImportContext.cxx60
-rw-r--r--xmloff/source/text/txtflde.cxx76
-rw-r--r--xmloff/source/text/txtimp.cxx6
-rw-r--r--xmloff/source/text/txtparae.cxx100
-rw-r--r--xmloff/source/text/txtparai.cxx372
-rw-r--r--xmloff/source/text/txtparai.hxx7
-rw-r--r--xmloff/source/text/txtprmap.cxx2
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_export.cxx19
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_import.cxx18
678 files changed, 35872 insertions, 12377 deletions
diff --git a/avmedia/prj/build.lst b/avmedia/prj/build.lst
index 58fed86ec876..1ef04ca0f7d5 100644
--- a/avmedia/prj/build.lst
+++ b/avmedia/prj/build.lst
@@ -1,4 +1,4 @@
-av avmedia : sfx2 NULL
+av avmedia : l10n tools sfx2 NULL
av avmedia usr1 - all av_mkout NULL
av avmedia\prj get - all av_prj NULL
av avmedia\inc get - all av_inv NULL
diff --git a/basic/inc/basic/sbstar.hxx b/basic/inc/basic/sbstar.hxx
index d75a2ada855e..3ec0803eb4a9 100644
--- a/basic/inc/basic/sbstar.hxx
+++ b/basic/inc/basic/sbstar.hxx
@@ -121,6 +121,7 @@ public:
static void Error( SbError );
static void Error( SbError, const String& rMsg );
static void FatalError( SbError );
+ static void FatalError( SbError, const String& rMsg );
static BOOL IsRunning();
static SbError GetErrBasic();
// #66536 make additional message accessible by RTL function Error
diff --git a/basic/prj/build.lst b/basic/prj/build.lst
index 5f8cf00ce284..ec6bd0e83930 100644
--- a/basic/prj/build.lst
+++ b/basic/prj/build.lst
@@ -1,4 +1,4 @@
-sb basic : offuh svtools sj2 xmlscript framework NULL
+sb basic : l10n offuh svtools sj2 xmlscript framework NULL
sb basic usr1 - all sb_mkout NULL
sb basic\inc nmake - all sb_inc NULL
sb basic\source\app nmake - all sb_app sb_class sb_inc NULL
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 3fbcd592e5bb..7ff7cb76c7c5 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -1357,6 +1357,12 @@ void StarBASIC::FatalError( SbError n )
pINST->FatalError( n );
}
+void StarBASIC::FatalError( SbError _errCode, const String& _details )
+{
+ if( pINST )
+ pINST->FatalError( _errCode, _details );
+}
+
SbError StarBASIC::GetErrBasic()
{
if( pINST )
diff --git a/basic/source/classes/sb.src b/basic/source/classes/sb.src
index a17e3bce687c..214831b8da13 100644
--- a/basic/source/classes/sb.src
+++ b/basic/source/classes/sb.src
@@ -341,7 +341,7 @@ Resource RID_BASIC_START
};
String SbERR_NO_METHOD & ERRCODE_RES_MASK
{
- Text [ en-US ] = "Property or method not found." ;
+ Text [ en-US ] = "Property or method not found: $(ARG1)." ;
};
String SbERR_NEEDS_OBJECT & ERRCODE_RES_MASK
{
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index dc6fb6d13cec..a1bdb687b002 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -68,7 +68,7 @@
#include <com/sun/star/reflection/XIdlArray.hpp>
#include <com/sun/star/reflection/XIdlReflection.hpp>
#include <com/sun/star/reflection/XIdlClassProvider.hpp>
-#include <com/sun/star/reflection/XTypeDescription.hpp>
+#include <com/sun/star/reflection/XServiceConstructorDescription.hpp>
#include <com/sun/star/bridge/oleautomation/NamedArgument.hpp>
#include <com/sun/star/bridge/oleautomation/Date.hpp>
#include <com/sun/star/bridge/oleautomation/Decimal.hpp>
@@ -104,6 +104,8 @@ TYPEINIT1(SbUnoMethod,SbxMethod)
TYPEINIT1(SbUnoProperty,SbxProperty)
TYPEINIT1(SbUnoObject,SbxObject)
TYPEINIT1(SbUnoClass,SbxObject)
+TYPEINIT1(SbUnoService,SbxObject)
+TYPEINIT1(SbUnoServiceCtor,SbxMethod)
typedef WeakImplHelper1< XAllListener > BasicAllListenerHelper;
@@ -2496,35 +2498,7 @@ SbUnoProperty::~SbUnoProperty()
{}
-// #72732 Spezielle SbxVariable, die beim put/get prueft,
-// ob der Kontext fuer eine UnoClass sinnvoll ist. Sonst
-// liegt eventuell ein Schreibfehler im Basic-Source vor.
-BOOL UnoClassMemberVariable::Get( SbxValues& rRes ) const
-{
- // Zugriff auf den Member einer UnoClass mit Parametern ist unsinnig
- if( GetParameters() )
- {
- if( mpRuntime )
- mpRuntime->Error( SbERR_NO_METHOD );
- }
- return SbxVariable::Get( rRes );
-}
-
-BOOL UnoClassMemberVariable::Put( const SbxValues& rRes )
-{
- if( bInternalUse )
- {
- return SbxVariable::Put( rRes );
- }
- // Schreibzugriff auf den Member einer UnoClass ist immer falsch
- mpRuntime->Error( SbERR_NO_METHOD );
- return FALSE;
-}
-
-TYPEINIT1(UnoClassMemberVariable,SbxVariable)
-
-
-SbxVariable* SbUnoObject::Find( const XubString& rName, SbxClassType t )
+SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
{
static Reference< XIdlMethod > xDummyMethod;
static Property aDummyProp;
@@ -3201,16 +3175,16 @@ SbxVariable* getVBAConstant( const String& rName )
// Funktion, um einen globalen Bezeichner im
// UnoScope zu suchen und fuer Sbx zu wrappen
-SbxVariable* findUnoClass( const String& rName )
+SbUnoClass* findUnoClass( const String& rName )
{
// #105550 Check if module exists
SbUnoClass* pUnoClass = NULL;
Reference< XHierarchicalNameAccess > xTypeAccess = getTypeProvider_Impl();
- Reference< XTypeDescription > xTypeDesc;
if( xTypeAccess->hasByHierarchicalName( rName ) )
{
Any aRet = xTypeAccess->getByHierarchicalName( rName );
+ Reference< XTypeDescription > xTypeDesc;
aRet >>= xTypeDesc;
if( xTypeDesc.is() )
@@ -3287,7 +3261,6 @@ SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t )
pRes = new SbxVariable( SbxVARIANT );
SbxObjectRef xWrapper = (SbxObject*)new SbUnoClass( aNewName, xClass );
pRes->PutObject( xWrapper );
-
}
}
else
@@ -3305,15 +3278,26 @@ SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t )
// Sonst wieder als Klasse annehmen
if( !pRes )
{
- SbxVariable* pNewClass = findUnoClass( aNewName );
+ SbUnoClass* pNewClass = findUnoClass( aNewName );
if( pNewClass )
{
- Reference< XIdlClass > xClass;
pRes = new SbxVariable( SbxVARIANT );
SbxObjectRef xWrapper = (SbxObject*)pNewClass;
pRes->PutObject( xWrapper );
}
}
+
+ // An UNO service?
+ if( !pRes )
+ {
+ SbUnoService* pUnoService = findUnoService( aNewName );
+ if( pUnoService )
+ {
+ pRes = new SbxVariable( SbxVARIANT );
+ SbxObjectRef xWrapper = (SbxObject*)pUnoService;
+ pRes->PutObject( xWrapper );
+ }
+ }
}
}
@@ -3334,6 +3318,266 @@ SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t )
}
+SbUnoService* findUnoService( const String& rName )
+{
+ SbUnoService* pSbUnoService = NULL;
+
+ Reference< XHierarchicalNameAccess > xTypeAccess = getTypeProvider_Impl();
+ if( xTypeAccess->hasByHierarchicalName( rName ) )
+ {
+ Any aRet = xTypeAccess->getByHierarchicalName( rName );
+ Reference< XTypeDescription > xTypeDesc;
+ aRet >>= xTypeDesc;
+
+ if( xTypeDesc.is() )
+ {
+ TypeClass eTypeClass = xTypeDesc->getTypeClass();
+ if( eTypeClass == TypeClass_SERVICE )
+ {
+ Reference< XServiceTypeDescription2 > xServiceTypeDesc( xTypeDesc, UNO_QUERY );
+ if( xServiceTypeDesc.is() )
+ pSbUnoService = new SbUnoService( rName, xServiceTypeDesc );
+ }
+ }
+ }
+ return pSbUnoService;
+}
+
+SbxVariable* SbUnoService::Find( const String& rName, SbxClassType )
+{
+ SbxVariable* pRes = SbxObject::Find( rName, SbxCLASS_METHOD );
+
+ if( !pRes )
+ {
+ // Wenn es schon eine Klasse ist, nach einen Feld fragen
+ if( m_bNeedsInit && m_xServiceTypeDesc.is() )
+ {
+ m_bNeedsInit = false;
+
+ Sequence< Reference< XServiceConstructorDescription > > aSCDSeq = m_xServiceTypeDesc->getConstructors();
+ const Reference< XServiceConstructorDescription >* pCtorSeq = aSCDSeq.getConstArray();
+ int nCtorCount = aSCDSeq.getLength();
+ for( int i = 0 ; i < nCtorCount ; ++i )
+ {
+ Reference< XServiceConstructorDescription > xCtor = pCtorSeq[i];
+
+ String aName( xCtor->getName() );
+ if( !aName.Len() )
+ {
+ if( xCtor->isDefaultConstructor() )
+ aName = String::CreateFromAscii( "create" );
+ }
+
+ if( aName.Len() )
+ {
+ // Create and insert SbUnoServiceCtor
+ SbxVariableRef xSbCtorRef = new SbUnoServiceCtor( aName, xCtor );
+ QuickInsert( (SbxVariable*)xSbCtorRef );
+ pRes = xSbCtorRef;
+ }
+ }
+ }
+ }
+
+ return pRes;
+}
+
+void SbUnoService::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType )
+{
+ const SbxHint* pHint = PTR_CAST(SbxHint,&rHint);
+ if( pHint )
+ {
+ SbxVariable* pVar = pHint->GetVar();
+ SbxArray* pParams = pVar->GetParameters();
+ SbUnoServiceCtor* pUnoCtor = PTR_CAST(SbUnoServiceCtor,pVar);
+ if( pUnoCtor && pHint->GetId() == SBX_HINT_DATAWANTED )
+ {
+ // Parameter count -1 because of Param0 == this
+ UINT32 nParamCount = pParams ? ((UINT32)pParams->Count() - 1) : 0;
+ Sequence<Any> args;
+ BOOL bOutParams = FALSE;
+
+ Reference< XServiceConstructorDescription > xCtor = pUnoCtor->getServiceCtorDesc();
+ Sequence< Reference< XParameter > > aParameterSeq = xCtor->getParameters();
+ const Reference< XParameter >* pParameterSeq = aParameterSeq.getConstArray();
+ UINT32 nUnoParamCount = aParameterSeq.getLength();
+
+ // Default: Ignore not needed parameters
+ bool bParameterError = false;
+
+ // Is the last parameter a rest parameter?
+ bool bRestParameterMode = false;
+ if( nUnoParamCount > 0 )
+ {
+ Reference< XParameter > xLastParam = pParameterSeq[ nUnoParamCount - 1 ];
+ if( xLastParam.is() )
+ {
+ if( xLastParam->isRestParameter() )
+ bRestParameterMode = true;
+ }
+ }
+
+ // Too many parameters with context as first parameter?
+ USHORT nSbxParameterOffset = 1;
+ USHORT nParameterOffsetByContext = 0;
+ Reference < XComponentContext > xFirstParamContext;
+ if( nParamCount > nUnoParamCount )
+ {
+ // Check if first parameter is a context and use it
+ // then in createInstanceWithArgumentsAndContext
+ Any aArg0 = sbxToUnoValue( pParams->Get( nSbxParameterOffset ) );
+ if( (aArg0 >>= xFirstParamContext) && xFirstParamContext.is() )
+ nParameterOffsetByContext = 1;
+ }
+
+ UINT32 nEffectiveParamCount = nParamCount - nParameterOffsetByContext;
+ UINT32 nAllocParamCount = nEffectiveParamCount;
+ if( nEffectiveParamCount > nUnoParamCount )
+ {
+ if( !bRestParameterMode )
+ {
+ nEffectiveParamCount = nUnoParamCount;
+ nAllocParamCount = nUnoParamCount;
+ }
+ }
+ // Not enough parameters?
+ else if( nUnoParamCount > nEffectiveParamCount )
+ {
+ // RestParameterMode only helps if one (the last) parameter is missing
+ int nDiff = nUnoParamCount - nEffectiveParamCount;
+ if( !bRestParameterMode || nDiff > 1 )
+ {
+ bParameterError = true;
+ StarBASIC::Error( SbERR_NOT_OPTIONAL );
+ }
+ }
+
+ if( !bParameterError )
+ {
+ if( nAllocParamCount > 0 )
+ {
+ args.realloc( nAllocParamCount );
+ Any* pAnyArgs = args.getArray();
+ for( UINT32 i = 0 ; i < nEffectiveParamCount ; i++ )
+ {
+ USHORT iSbx = (USHORT)(i + nSbxParameterOffset + nParameterOffsetByContext);
+
+ // bRestParameterMode allows nEffectiveParamCount > nUnoParamCount
+ Reference< XParameter > xParam;
+ if( i < nUnoParamCount )
+ {
+ xParam = pParameterSeq[i];
+ if( !xParam.is() )
+ continue;
+
+ Reference< XTypeDescription > xParamTypeDesc = xParam->getType();
+ if( !xParamTypeDesc.is() )
+ continue;
+ com::sun::star::uno::Type aType( xParamTypeDesc->getTypeClass(), xParamTypeDesc->getName() );
+
+ // sbx paramter needs offset 1
+ pAnyArgs[i] = sbxToUnoValue( pParams->Get( iSbx ), aType );
+
+ // Check for out parameter if not already done
+ if( !bOutParams )
+ {
+ if( xParam->isOut() )
+ bOutParams = TRUE;
+ }
+ }
+ else
+ {
+ pAnyArgs[i] = sbxToUnoValue( pParams->Get( iSbx ) );
+ }
+ }
+ }
+
+ // "Call" ctor using createInstanceWithArgumentsAndContext
+ Reference < XComponentContext > xContext;
+ if( xFirstParamContext.is() )
+ {
+ xContext = xFirstParamContext;
+ }
+ else
+ {
+ Reference < XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
+ xContext.set( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" )) ), UNO_QUERY_THROW );
+ }
+ Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() );
+
+ Any aRetAny;
+ if( xServiceMgr.is() )
+ {
+ String aServiceName = GetName();
+ Reference < XInterface > xRet;
+ try
+ {
+ xRet = xServiceMgr->createInstanceWithArgumentsAndContext( aServiceName, args, xContext );
+ }
+ catch( const Exception& )
+ {
+ implHandleAnyException( ::cppu::getCaughtException() );
+ }
+ aRetAny <<= xRet;
+ }
+ unoToSbxValue( pVar, aRetAny );
+
+ // Copy back out parameters?
+ if( bOutParams )
+ {
+ const Any* pAnyArgs = args.getConstArray();
+
+ for( UINT32 j = 0 ; j < nUnoParamCount ; j++ )
+ {
+ Reference< XParameter > xParam = pParameterSeq[j];
+ if( !xParam.is() )
+ continue;
+
+ if( xParam->isOut() )
+ unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(j+1) ), pAnyArgs[ j ] );
+ }
+ }
+ }
+ }
+ else
+ SbxObject::SFX_NOTIFY( rBC, rBCType, rHint, rHintType );
+ }
+}
+
+
+
+static SbUnoServiceCtor* pFirstCtor = NULL;
+
+void clearUnoServiceCtors( void )
+{
+ SbUnoServiceCtor* pCtor = pFirstCtor;
+ while( pCtor )
+ {
+ pCtor->SbxValue::Clear();
+ pCtor = pCtor->pNext;
+ }
+}
+
+SbUnoServiceCtor::SbUnoServiceCtor( const String& aName_, Reference< XServiceConstructorDescription > xServiceCtorDesc )
+ : SbxMethod( aName_, SbxOBJECT )
+ , m_xServiceCtorDesc( xServiceCtorDesc )
+{
+}
+
+SbUnoServiceCtor::~SbUnoServiceCtor()
+{
+}
+
+SbxInfo* SbUnoServiceCtor::GetInfo()
+{
+ SbxInfo* pRet = NULL;
+
+ return pRet;
+}
+
+
+
//========================================================================
//========================================================================
//========================================================================
@@ -3703,7 +3947,6 @@ void RTL_Impl_GetDefaultContext( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite
//========================================================================
// Creates a Basic wrapper object for a strongly typed Uno value
// 1. parameter: Uno type as full qualified type name, e.g. "byte[]"
-// void RTL_Impl_GetDefaultContext( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
{
(void)pBasic;
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index a534209b0cfa..2a61557457b7 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -531,6 +531,7 @@ void ClearUnoObjectsInRTL_Impl( StarBASIC* pBasic )
{
// #67781 Rueckgabewerte der Uno-Methoden loeschen
clearUnoMethods();
+ clearUnoServiceCtors();
ClearUnoObjectsInRTL_Impl_Rek( pBasic );
diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx
index e69551f364e5..701ecdd7bc16 100644
--- a/basic/source/comp/exprtree.cxx
+++ b/basic/source/comp/exprtree.cxx
@@ -701,12 +701,6 @@ SbiExprNode* SbiExpression::Comp()
pNd = new SbiExprNode( pParser, pNd, eTok, Cat() );
nCount++;
}
- // Mehrere Operatoren hintereinander gehen nicht
- if( nCount > 1 )
- {
- pParser->Error( SbERR_SYNTAX );
- bError = TRUE;
- }
}
return pNd;
}
diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx
index 9cde971228d9..2cc496f9cb02 100644
--- a/basic/source/comp/scanner.cxx
+++ b/basic/source/comp/scanner.cxx
@@ -479,7 +479,17 @@ PrevLineCommentLbl:
eoln:
if( nCol && *--pLine == '_' )
{
- pLine = NULL; return NextSym();
+ pLine = NULL;
+ bool bRes = NextSym();
+ if( bVBASupportOn && aSym.GetBuffer()[0] == '.' )
+ {
+ // object _
+ // .Method
+ // ^^^ <- spaces is legal in MSO VBA
+ OSL_TRACE("*** resetting bSpaces***");
+ bSpaces = FALSE;
+ }
+ return bRes;
}
else
{
diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx
index f9629445aa9e..31f99fb93169 100644
--- a/basic/source/inc/runtime.hxx
+++ b/basic/source/inc/runtime.hxx
@@ -220,10 +220,11 @@ public:
SbiInstance( StarBASIC* );
~SbiInstance();
- void Error( SbError ); // trappable Error
+ void Error( SbError ); // trappable Error
void Error( SbError, const String& rMsg ); // trappable Error mit Message
- void FatalError( SbError ); // non-trappable Error
- void Abort(); // Abbruch mit aktuellem Fehlercode
+ void FatalError( SbError ); // non-trappable Error
+ void FatalError( SbError, const String& ); // non-trappable Error
+ void Abort(); // Abbruch mit aktuellem Fehlercode
void Stop();
SbError GetErr() { return nErr; }
@@ -270,30 +271,6 @@ struct RefSaveItem
};
-// #72732 Spezielle SbxVariable, die beim put/get prueft,
-// ob der Kontext fuer eine UnoClass sinnvoll ist. Sonst
-// liegt eventuell ein Schreibfehler im Basic-Source vor.
-class UnoClassMemberVariable : public SbxVariable
-{
- SbiRuntime* mpRuntime;
- BOOL bInternalUse;
-
-public:
- UnoClassMemberVariable( SbiRuntime* pRuntime_, const SbxObjectRef& xWrapper )
- : SbxVariable( SbxVARIANT ), mpRuntime( pRuntime_ )
- {
- bInternalUse = TRUE;
- PutObject( xWrapper );
- bInternalUse = FALSE;
- }
-
- virtual BOOL Get( SbxValues& ) const;
- virtual BOOL Put( const SbxValues& );
-
- TYPEINFO();
-};
-
-
// Eine Instanz dieser Klasse wird fuer jedes ausgefuehrte Unterprogramm
// aufgesetzt. Diese Instanz ist das Herz der BASIC-Maschine und enthaelt
// nur lokale Daten.
@@ -467,8 +444,10 @@ public:
SbiRuntime( SbModule*, SbMethod*, UINT32 );
~SbiRuntime();
- void Error( SbError ); // Fehler setzen, falls != 0
- void FatalError( SbError ); // Fehlerbehandlung=Standard, Fehler setzen
+ void Error( SbError ); // Fehler setzen, falls != 0
+ void Error( SbError, const String& ); // Fehler setzen, falls != 0
+ void FatalError( SbError ); // Fehlerbehandlung=Standard, Fehler setzen
+ void FatalError( SbError, const String& ); // Fehlerbehandlung=Standard, Fehler setzen
void DumpPCode();
BOOL Step(); // Einzelschritt (ein Opcode)
void Stop() { bRun = FALSE; }
diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx
index ee7ac2176e41..6889aa196c54 100644
--- a/basic/source/inc/sbunoobj.hxx
+++ b/basic/source/inc/sbunoobj.hxx
@@ -43,6 +43,7 @@
#include <com/sun/star/beans/XIntrospection.hpp>
#include <com/sun/star/script/XInvocation.hpp>
#include <com/sun/star/reflection/XIdlClass.hpp>
+#include <com/sun/star/reflection/XServiceTypeDescription2.hpp>
#include <rtl/ustring.hxx>
class SbUnoObject: public SbxObject
@@ -149,7 +150,7 @@ public:
};
// Wrapper fuer eine Uno-Klasse
-class SbUnoClass: public SbxObject
+class SbUnoClass : public SbxObject
{
const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass > m_xClass;
@@ -177,7 +178,55 @@ SV_DECL_IMPL_REF(SbUnoClass);
// Funktion, um einen globalen Bezeichner im
// UnoScope zu suchen und fuer Sbx zu wrappen
-SbxVariable* findUnoClass( const String& rName );
+SbUnoClass* findUnoClass( const String& rName );
+
+
+// Wrapper for UNO Service
+class SbUnoService : public SbxObject
+{
+ const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceTypeDescription2 > m_xServiceTypeDesc;
+ bool m_bNeedsInit;
+
+public:
+ TYPEINFO();
+ SbUnoService( const String& aName_,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceTypeDescription2 >& xServiceTypeDesc )
+ : SbxObject( aName_ )
+ , m_xServiceTypeDesc( xServiceTypeDesc )
+ , m_bNeedsInit( true )
+ {}
+
+ virtual SbxVariable* Find( const String&, SbxClassType );
+
+ void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& );
+};
+SV_DECL_IMPL_REF(SbUnoService);
+
+SbUnoService* findUnoService( const String& rName );
+
+
+void clearUnoServiceCtors( void );
+
+class SbUnoServiceCtor : public SbxMethod
+{
+ friend class SbUnoService;
+ friend void clearUnoServiceCtors( void );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceConstructorDescription > m_xServiceCtorDesc;
+
+ SbUnoServiceCtor* pPrev;
+ SbUnoServiceCtor* pNext;
+
+public:
+ TYPEINFO();
+
+ SbUnoServiceCtor( const String& aName_, ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceConstructorDescription > xServiceCtorDesc );
+ virtual ~SbUnoServiceCtor();
+ virtual SbxInfo* GetInfo();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceConstructorDescription > getServiceCtorDesc( void )
+ { return m_xServiceCtorDesc; }
+};
// #105565 Special Object to wrap a strongly typed Uno Any
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index d81cebe60fc6..cc276eea766b 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -430,6 +430,11 @@ void SbiInstance::FatalError( SbError n )
pRun->FatalError( n );
}
+void SbiInstance::FatalError( SbError _errCode, const String& _details )
+{
+ pRun->FatalError( _errCode, _details );
+}
+
void SbiInstance::Abort()
{
// Basic suchen, in dem der Fehler auftrat
@@ -721,7 +726,7 @@ BOOL SbiRuntime::Step()
pCode = pError;
else
bLetParentHandleThis = true;
- }
+ }
else
{
bLetParentHandleThis = true;
@@ -795,12 +800,35 @@ void SbiRuntime::Error( SbError n )
nError = n;
}
+void SbiRuntime::Error( SbError _errCode, const String& _details )
+{
+ if ( _errCode )
+ {
+ OSL_ENSURE( pInst->pRun == this, "SbiRuntime::Error: can't propagate the error message details!" );
+ if ( pInst->pRun == this )
+ {
+ pInst->Error( _errCode, _details );
+ OSL_POSTCOND( nError == _errCode, "SbiRuntime::Error: the instance is expecte to propagate the error code back to me!" );
+ }
+ else
+ {
+ nError = _errCode;
+ }
+ }
+}
+
void SbiRuntime::FatalError( SbError n )
{
StepSTDERROR();
Error( n );
}
+void SbiRuntime::FatalError( SbError _errCode, const String& _details )
+{
+ StepSTDERROR();
+ Error( _errCode, _details );
+}
+
//////////////////////////////////////////////////////////////////////////
//
// Parameter, Locals, Caller
@@ -859,21 +887,13 @@ SbxVariableRef SbiRuntime::PopVar()
BOOL SbiRuntime::ClearExprStack()
{
- // #74732 Hier kann ein Fehler gesetzt werden
- BOOL bErrorSet = FALSE;
-
// Achtung: Clear() reicht nicht, da Methods geloescht werden muessen
while ( nExprLvl )
{
- SbxVariableRef xVar = PopVar();
- if( !nError && xVar->ISA( UnoClassMemberVariable ) )
- {
- Error( SbERR_NO_METHOD );
- bErrorSet = TRUE;
- }
+ PopVar();
}
refExprStk->Clear();
- return bErrorSet;
+ return FALSE;
}
// Variable auf dem Expression-Stack holen, ohne sie zu entfernen
diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx
index 2a7c69b16323..413d3a6f4def 100644
--- a/basic/source/runtime/step2.cxx
+++ b/basic/source/runtime/step2.cxx
@@ -199,7 +199,7 @@ SbxVariable* SbiRuntime::FindElement
}
// #72382 VORSICHT! Liefert jetzt wegen unbekannten
// Modulen IMMER ein Ergebnis!
- SbxVariable* pUnoClass = findUnoClass( aName );
+ SbUnoClass* pUnoClass = findUnoClass( aName );
if( pUnoClass )
{
pElem = new SbxVariable( t );
@@ -255,7 +255,7 @@ SbxVariable* SbiRuntime::FindElement
ClearArgvStack();
// Normalen Error setzen
- Error( nNotFound );
+ Error( nNotFound, aName );
}
else
{
@@ -832,6 +832,7 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 )
// Wenn der Expr-Stack am Anfang einen Statements eine Variable enthaelt,
// hat ein Trottel X als Funktion aufgerufen, obwohl es eine Variable ist!
BOOL bFatalExpr = FALSE;
+ String sUnknownMethodName;
if( nExprLvl > 1 )
bFatalExpr = TRUE;
else if( nExprLvl )
@@ -839,7 +840,10 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 )
SbxVariable* p = refExprStk->Get( 0 );
if( p->GetRefCount() > 1
&& refLocals.Is() && refLocals->Find( p->GetName(), p->GetClass() ) )
+ {
+ sUnknownMethodName = p->GetName();
bFatalExpr = TRUE;
+ }
}
// Der Expr-Stack ist nun nicht mehr notwendig
ClearExprStack();
@@ -854,7 +858,7 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 )
// stimmen!
if( bFatalExpr)
{
- StarBASIC::FatalError( SbERR_NO_METHOD );
+ StarBASIC::FatalError( SbERR_NO_METHOD, sUnknownMethodName );
return;
}
pStmnt = pCode - 9;
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index b0fa4ea1822f..7c3bd3b057ba 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -1572,7 +1572,10 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
else
{
aL.eType = aR.eType = SbxDOUBLE;
- if( Get( aL ) && rOp.Get( aR ) )
+ //if( Get( aL ) && rOp.Get( aR ) )
+ bool bGetL = Get( aL );
+ bool bGetR = rOp.Get( aR );
+ if( bGetL && bGetR )
switch( eOp )
{
case SbxEQ:
@@ -1590,6 +1593,17 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
default:
SetError( SbxERR_NOTIMP );
}
+ // at least one value was got
+ // if this is VBA then a conversion error for one
+ // side will yield a false result of an equality test
+ else if ( bGetR || bGetL )
+ {
+ if ( bVBAInterop && eOp == SbxEQ && GetError() == SbxERR_CONVERSION )
+ {
+ ResetError();
+ bRes = FALSE;
+ }
+ }
}
}
if( eOld != SbxERR_OK )
diff --git a/connectivity/inc/connectivity/DriversConfig.hxx b/connectivity/inc/connectivity/DriversConfig.hxx
new file mode 100755
index 000000000000..8a33019d57ed
--- /dev/null
+++ b/connectivity/inc/connectivity/DriversConfig.hxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: makefile,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: st $ $Date: 2000/11/22 02:32:00 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+#ifndef CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED
+#define CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED
+
+#include <comphelper/stl_types.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/uno/Sequence.h>
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <salhelper/singletonref.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <unotools/confignode.hxx>
+
+namespace connectivity
+{
+ typedef struct
+ {
+ ::comphelper::NamedValueCollection aProperties;
+ ::comphelper::NamedValueCollection aFeatures;
+ ::comphelper::NamedValueCollection aMetaData;
+ ::rtl::OUString sDriverFactory;
+ ::rtl::OUString sDriverTypeDisplayName;
+ } TInstalledDriver;
+ DECLARE_STL_USTRINGACCESS_MAP( TInstalledDriver, TInstalledDrivers);
+
+ class DriversConfigImpl
+ {
+ ::utl::OConfigurationTreeRoot m_aInstalled;
+ public:
+ DriversConfigImpl();
+ void Load(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,TInstalledDrivers& _rDrivers);
+ };
+ //
+ // Allows to access all driver which are located in the configuration
+ //
+ class OOO_DLLPUBLIC_DBTOOLS DriversConfig
+ {
+ typedef salhelper::SingletonRef<DriversConfigImpl> OSharedConfigNode;
+
+ const ::comphelper::NamedValueCollection& impl_get(const ::rtl::OUString& _sURL,sal_Int32 _nProps) const;
+ public:
+ DriversConfig(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
+
+ ::rtl::OUString getDriverFactoryName(const ::rtl::OUString& _sUrl) const;
+ ::rtl::OUString getDriverTypeDisplayName(const ::rtl::OUString& _sUrl) const;
+ const ::comphelper::NamedValueCollection& getProperties(const ::rtl::OUString& _sURL) const;
+ const ::comphelper::NamedValueCollection& getFeatures(const ::rtl::OUString& _sURL) const;
+ const ::comphelper::NamedValueCollection& getMetaData(const ::rtl::OUString& _sURL) const;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > getURLs() const;
+ private:
+ TInstalledDrivers m_aDrivers;
+ OSharedConfigNode m_aNode;
+ };
+}
+#endif // CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED
diff --git a/connectivity/inc/connectivity/dbexception.hxx b/connectivity/inc/connectivity/dbexception.hxx
index 5c9f575da7c7..dbfcf5eb5747 100644
--- a/connectivity/inc/connectivity/dbexception.hxx
+++ b/connectivity/inc/connectivity/dbexception.hxx
@@ -150,6 +150,12 @@ public:
const ::com::sun::star::uno::Any& get() const { return m_aContent; }
+ void clear()
+ {
+ m_aContent.clear();
+ m_eType = UNDEFINED;
+ }
+
protected:
void implDetermineType();
};
diff --git a/connectivity/inc/connectivity/dbmetadata.hxx b/connectivity/inc/connectivity/dbmetadata.hxx
index ea284efb2b86..32662c5c157a 100644
--- a/connectivity/inc/connectivity/dbmetadata.hxx
+++ b/connectivity/inc/connectivity/dbmetadata.hxx
@@ -135,8 +135,15 @@ namespace dbtools
<code>SELECT * FROM table correlation_name</code> is generated.
*/
bool generateASBeforeCorrelationName() const;
+
+ /** should date time be escaped like '2001-01-01' => #2001-01-01#
+ */
bool shouldEscapeDateTime() const;
+ /** auto increment columns should be automaticly used as primary key.
+ */
+ bool isAutoIncrementPrimaryKey() const;
+
/** determines the syntax to use for boolean comparison predicates
@see ::com::sun::star::sdb::BooleanComparisonMode
diff --git a/connectivity/inc/connectivity/sqlnode.hxx b/connectivity/inc/connectivity/sqlnode.hxx
index 7dbc59e0cde8..fda3e24c09e6 100644
--- a/connectivity/inc/connectivity/sqlnode.hxx
+++ b/connectivity/inc/connectivity/sqlnode.hxx
@@ -39,6 +39,7 @@
#include <functional>
#include <set>
#include <boost/shared_ptr.hpp>
+#include <rtl/ustrbuf.hxx>
// forward declarations
namespace com
@@ -428,22 +429,22 @@ namespace connectivity
bool _bSubstitute) const;
private:
- void impl_parseNodeToString_throw( ::rtl::OUString& rString, const SQLParseNodeParameter& rParam) const;
- void impl_parseLikeNodeToString_throw( ::rtl::OUString& rString, const SQLParseNodeParameter& rParam ) const;
- void impl_parseTableRangeNodeToString_throw( ::rtl::OUString& rString, const SQLParseNodeParameter& rParam ) const;
+ void impl_parseNodeToString_throw( ::rtl::OUStringBuffer& rString, const SQLParseNodeParameter& rParam) const;
+ void impl_parseLikeNodeToString_throw( ::rtl::OUStringBuffer& rString, const SQLParseNodeParameter& rParam ) const;
+ void impl_parseTableRangeNodeToString_throw( ::rtl::OUStringBuffer& rString, const SQLParseNodeParameter& rParam ) const;
/** parses a table_name node into a SQL statement particle.
@return
<TRUE/> if and only if parsing was successful, <FALSE/> if default handling should
be applied.
*/
- bool impl_parseTableNameNodeToString_throw( ::rtl::OUString& rString, const SQLParseNodeParameter& rParam ) const;
+ bool impl_parseTableNameNodeToString_throw( ::rtl::OUStringBuffer& rString, const SQLParseNodeParameter& rParam ) const;
- sal_Bool addDateValue(::rtl::OUString& rString, const SQLParseNodeParameter& rParam) const;
+ sal_Bool addDateValue(::rtl::OUStringBuffer& rString, const SQLParseNodeParameter& rParam) const;
::rtl::OUString convertDateTimeString(const SQLParseNodeParameter& rParam, const ::rtl::OUString& rString) const;
::rtl::OUString convertDateString(const SQLParseNodeParameter& rParam, const ::rtl::OUString& rString) const;
::rtl::OUString convertTimeString(const SQLParseNodeParameter& rParam, const ::rtl::OUString& rString) const;
- void parseLeaf(::rtl::OUString & rString, const SQLParseNodeParameter& rParam) const;
+ void parseLeaf(::rtl::OUStringBuffer& rString, const SQLParseNodeParameter& rParam) const;
};
//-----------------------------------------------------------------------------
diff --git a/connectivity/inc/connectivity/sqlparse.hxx b/connectivity/inc/connectivity/sqlparse.hxx
index 6ca31d695bd9..fb775abb480d 100644
--- a/connectivity/inc/connectivity/sqlparse.hxx
+++ b/connectivity/inc/connectivity/sqlparse.hxx
@@ -232,7 +232,8 @@ namespace connectivity
// compares the _sFunctionName with all known function names and return the DataType of the return value
static sal_Int32 getFunctionReturnType(const ::rtl::OUString& _sFunctionName, const IParseContext* pContext = NULL);
-
+ // returns the type for a parameter in a given function name
+ static sal_Int32 getFunctionParameterType(sal_uInt32 _nTokenId,sal_uInt32 _nPos);
void error(sal_Char *fmt);
int SQLlex();
diff --git a/connectivity/makefile.pmk b/connectivity/makefile.pmk
new file mode 100755
index 000000000000..ede06e49d391
--- /dev/null
+++ b/connectivity/makefile.pmk
@@ -0,0 +1,66 @@
+#*************************************************************************
+#
+# 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.pmk,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.
+#
+#*************************************************************************
+
+XSLDIR=$(SOLARXMLDIR)$/processing
+ABSXCSROOT=$(PWD)$/$(MISC)
+# ABSXCSROOT=$(MISC)
+XCSROOT=..
+# XCSROOT=$(SOLARXMLDIR)
+# ABSXCSROOT=$(SOLARXMLDIR)
+DTDDIR=$(SOLARXMLDIR)
+PROCESSOUT=$(MISC)
+PROCESSORDIR=$(SOLARBINDIR)
+
+
+# no validation by inspector class
+NO_INSPECTION=TRUE
+
+JAVAPREPRO=
+.IF "$(JDK_VERSION)" == "110"
+JAVAPREPRO=-jdk11
+.ENDIF
+.IF "$(PRODUCT)" != ""
+JAVAPREPRO=$(JAVAPREPRO) + " -product"
+.ENDIF
+
+# --- Settings -----------------------------------------------------
+PACKAGE=org.openoffice.Office.DataAccess
+.INCLUDE : settings.mk
+
+COMPONENT_CONFIG_DATA*=$(TARGET).xcu
+
+LOCALIZEDFILES= \
+ $(COMPONENT_CONFIG_DATA)
+
+XCUFILES= \
+ $(LOCALIZEDFILES) \
+
+
diff --git a/connectivity/prj/build.lst b/connectivity/prj/build.lst
index 4a35e4af2120..21326f36023a 100644
--- a/connectivity/prj/build.lst
+++ b/connectivity/prj/build.lst
@@ -1,19 +1,19 @@
-cn connectivity : comphelper MOZ:moz SO:moz_prebuilt svtools UNIXODBC:unixODBC unoil javaunohelper HSQLDB:hsqldb QADEVOOO:qadevOOo NULL
+cn connectivity : l10n comphelper MOZ:moz SO:moz_prebuilt svtools UNIXODBC:unixODBC unoil javaunohelper HSQLDB:hsqldb QADEVOOO:qadevOOo officecfg NULL
cn connectivity usr1 - all cn_mkout NULL
cn connectivity\inc nmake - all cn_inc NULL
cn connectivity\com\sun\star\sdbcx\comp\hsqldb nmake - all cn_jhsqldbdb cn_hsqldb cn_inc NULL
cn connectivity\source\commontools nmake - all cn_cmtools cn_parse cn_inc NULL
-cn connectivity\source\manager nmake - all cn_manager cn_inc NULL
+cn connectivity\source\manager nmake - all cn_manager cn_dbtools cn_inc NULL
cn connectivity\source\cpool nmake - all cn_cpool cn_dbtools cn_inc NULL
cn connectivity\source\resource nmake - all cn_res cn_inc NULL
cn connectivity\source\sdbcx nmake - all cn_sdbcx cn_inc NULL
-cn connectivity\source\drivers\ado nmake - w cn_ado cn_dbtools cn_inc NULL
+cn connectivity\source\drivers\ado nmake - all cn_ado cn_dbtools cn_inc NULL
cn connectivity\source\drivers\mozab\mozillasrc nmake - all cn_mozab_mozillasrc cn_file cn_inc NULL
cn connectivity\source\drivers\mozab\bootstrap nmake - all cn_mozab_bootstrap cn_mozab_mozillasrc cn_inc NULL
cn connectivity\source\drivers\mozab nmake - all cn_mozab cn_mozab_bootstrap cn_dbtools cn_inc NULL
-cn connectivity\source\drivers\kab nmake - u cn_kab cn_dbtools cn_inc NULL
-cn connectivity\source\drivers\macab nmake - u cn_macab cn_dbtools cn_inc NULL
-cn connectivity\source\drivers\evoab2 nmake - u cn_evoab2 cn_dbtools cn_file cn_inc NULL
+cn connectivity\source\drivers\kab nmake - all cn_kab cn_dbtools cn_inc NULL
+cn connectivity\source\drivers\macab nmake - all cn_macab cn_dbtools cn_inc NULL
+cn connectivity\source\drivers\evoab2 nmake - all cn_evoab2 cn_dbtools cn_file cn_inc NULL
cn connectivity\source\drivers\calc nmake - all cn_calc cn_file cn_inc NULL
cn connectivity\source\drivers\odbcbase nmake - all cn_odbcbase cn_dbtools cn_inc NULL
cn connectivity\source\drivers\odbc nmake - all cn_odbc cn_odbcbase cn_inc NULL
@@ -28,3 +28,5 @@ cn connectivity\source\parse nmake - all cn_parse cn_
cn connectivity\source\simpledbt nmake - all cn_simpledbt cn_cmtools cn_inc NULL
cn connectivity\source\dbtools nmake - all cn_dbtools cn_simpledbt cn_cmtools cn_parse cn_res cn_sdbcx cn_inc cn_res NULL
cn connectivity\qa\connectivity\tools nmake - all cn_qa_tools cn_inc NULL
+cn connectivity\util nmake - all cn_util cn_ado cn_mozab cn_kab cn_evoab2 cn_calc cn_odbc cn_mysql cn_jdbc cn_adabas cn_flat cn_dbase cn_hsqldb NULL
+
diff --git a/connectivity/prj/d.lst b/connectivity/prj/d.lst
index 36d93ca2c35b..728c8fef03c4 100644
--- a/connectivity/prj/d.lst
+++ b/connectivity/prj/d.lst
@@ -22,8 +22,12 @@
mkdir: %_DEST%\inc%_EXT%\connectivity
mkdir: %_DEST%\inc%_EXT%\connectivity\sdbcx
+mkdir: %_DEST%\xml%_EXT%\registry\spool\DataAccess
..\inc\connectivity\*.hxx %_DEST%\inc%_EXT%\connectivity\*.hxx
..\%__SRC%\inc\sqlbison.hxx %_DEST%\inc%_EXT%\connectivity\sqlbison.hxx
..\inc\connectivity\sdbcx\*.hxx %_DEST%\inc%_EXT%\connectivity\sdbcx\*.hxx
#..\version.mk %_DEST%\inc%_EXT%\connectivity\version.mk
+..\%__SRC%\misc\registry\data\org\openoffice\Office\DataAccess\*.xcu %_DEST%\xml%_EXT%\registry\spool\DataAccess\*.xcu
+..\%COMMON_OUTDIR%\bin\fcfg_drivers_*.zip %_DEST%\pck%_EXT%\fcfg_drivers_*.zip
+..\%__SRC%\bin\fcfg_drivers_*.zip %_DEST%\pck%_EXT%\fcfg_drivers_*.zip \ No newline at end of file
diff --git a/connectivity/qa/drivers/dbase/makefile.mk b/connectivity/qa/drivers/dbase/makefile.mk
index 63a4d5a25569..f7d2f79a7432 100644
--- a/connectivity/qa/drivers/dbase/makefile.mk
+++ b/connectivity/qa/drivers/dbase/makefile.mk
@@ -59,15 +59,9 @@ JARCOMPRESS = TRUE
# --- Targets ------------------------------------------------------
-.IF "$(depend)" == ""
-ALL : ALLTAR
-.ELSE
-ALL: ALLDEP
-.ENDIF
-
.INCLUDE : target.mk
run:
- java -cp $(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)$/OOoRunner.jar org.openoffice.Runner -TestBase java_complex -o complex.connectivity.$(TARGET)
+ java -cp "$(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)$/OOoRunner.jar" org.openoffice.Runner -TestBase java_complex -o complex.connectivity.$(TARGET)
diff --git a/connectivity/source/commontools/DateConversion.cxx b/connectivity/source/commontools/DateConversion.cxx
index e58e292bb91b..5c43e5d50cf1 100644
--- a/connectivity/source/commontools/DateConversion.cxx
+++ b/connectivity/source/commontools/DateConversion.cxx
@@ -93,8 +93,8 @@ using namespace ::com::sun::star::beans;
::rtl::OUString aTemp;
_rxTypeConverter->convertToSimpleType(_rVal, TypeClass_STRING) >>= aTemp;
sal_Int32 nIndex = (sal_Int32)-1;
- ::rtl::OUString sQuot(RTL_CONSTASCII_USTRINGPARAM("\'"));
- ::rtl::OUString sQuotToReplace(RTL_CONSTASCII_USTRINGPARAM("\'\'"));
+ const ::rtl::OUString sQuot(RTL_CONSTASCII_USTRINGPARAM("\'"));
+ const ::rtl::OUString sQuotToReplace(RTL_CONSTASCII_USTRINGPARAM("\'\'"));
do
{
nIndex += 2;
diff --git a/connectivity/source/commontools/DriversConfig.cxx b/connectivity/source/commontools/DriversConfig.cxx
new file mode 100755
index 000000000000..906024f452a4
--- /dev/null
+++ b/connectivity/source/commontools/DriversConfig.cxx
@@ -0,0 +1,241 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: makefile,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: st $ $Date: 2000/11/22 02:32:00 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+#include "connectivity/DriversConfig.hxx"
+#include <tools/wldcrd.hxx>
+
+using namespace connectivity;
+using namespace utl;
+using namespace ::com::sun::star;
+
+namespace
+{
+ void lcl_convert(const uno::Sequence< ::rtl::OUString >& _aSource,uno::Any& _rDest)
+ {
+ uno::Sequence<uno::Any> aRet(_aSource.getLength());
+ uno::Any* pAny = aRet.getArray();
+ const ::rtl::OUString* pIter = _aSource.getConstArray();
+ const ::rtl::OUString* pEnd = pIter + _aSource.getLength();
+ for (;pIter != pEnd ; ++pIter,++pAny)
+ {
+ *pAny <<= *pIter;
+ }
+ _rDest <<= aRet;
+ }
+ void lcl_fillValues(const ::utl::OConfigurationNode& _aURLPatternNode,const ::rtl::OUString& _sNode,::comphelper::NamedValueCollection& _rValues)
+ {
+ const ::utl::OConfigurationNode aPropertiesNode = _aURLPatternNode.openNode(_sNode);
+ if ( aPropertiesNode.isValid() )
+ {
+ uno::Sequence< ::rtl::OUString > aStringSeq;
+ static const ::rtl::OUString s_sValue(RTL_CONSTASCII_USTRINGPARAM("/Value"));
+ const uno::Sequence< ::rtl::OUString > aProperties = aPropertiesNode.getNodeNames();
+ const ::rtl::OUString* pPropertiesIter = aProperties.getConstArray();
+ const ::rtl::OUString* pPropertiesEnd = pPropertiesIter + aProperties.getLength();
+ for (;pPropertiesIter != pPropertiesEnd ; ++pPropertiesIter)
+ {
+ uno::Any aValue = aPropertiesNode.getNodeValue(*pPropertiesIter + s_sValue);
+ if ( aValue >>= aStringSeq )
+ {
+ lcl_convert(aStringSeq,aValue);
+ }
+ _rValues.put(*pPropertiesIter,aValue);
+ } // for (;pPropertiesIter != pPropertiesEnd ; ++pPropertiesIter,++pNamedIter)
+ } // if ( aPropertiesNode.isValid() )
+ }
+ void lcl_readURLPatternNode(const ::utl::OConfigurationTreeRoot& _aInstalled,const ::rtl::OUString& _sEntry,TInstalledDriver& _rInstalledDriver)
+ {
+ const ::utl::OConfigurationNode aURLPatternNode = _aInstalled.openNode(_sEntry);
+ if ( aURLPatternNode.isValid() )
+ {
+ static const ::rtl::OUString s_sParentURLPattern(RTL_CONSTASCII_USTRINGPARAM("ParentURLPattern"));
+ static const ::rtl::OUString s_sDriver(RTL_CONSTASCII_USTRINGPARAM("Driver"));
+ static const ::rtl::OUString s_sDriverTypeDisplayName(RTL_CONSTASCII_USTRINGPARAM("DriverTypeDisplayName"));
+ static const ::rtl::OUString s_sProperties(RTL_CONSTASCII_USTRINGPARAM("Properties"));
+ static const ::rtl::OUString s_sFeatures(RTL_CONSTASCII_USTRINGPARAM("Features"));
+ static const ::rtl::OUString s_sMetaData(RTL_CONSTASCII_USTRINGPARAM("MetaData"));
+ ::rtl::OUString sParentURLPattern;
+ aURLPatternNode.getNodeValue(s_sParentURLPattern) >>= sParentURLPattern;
+ if ( sParentURLPattern.getLength() )
+ lcl_readURLPatternNode(_aInstalled,sParentURLPattern,_rInstalledDriver);
+
+ ::rtl::OUString sDriverFactory;
+ aURLPatternNode.getNodeValue(s_sDriver) >>= sDriverFactory;
+ if ( sDriverFactory.getLength() )
+ _rInstalledDriver.sDriverFactory = sDriverFactory;
+
+ ::rtl::OUString sDriverTypeDisplayName;
+ aURLPatternNode.getNodeValue(s_sDriverTypeDisplayName) >>= sDriverTypeDisplayName;
+ OSL_ENSURE(sDriverTypeDisplayName.getLength(),"No valid DriverTypeDisplayName property!");
+ if ( sDriverTypeDisplayName.getLength() )
+ _rInstalledDriver.sDriverTypeDisplayName = sDriverTypeDisplayName;
+
+ lcl_fillValues(aURLPatternNode,s_sProperties,_rInstalledDriver.aProperties);
+ lcl_fillValues(aURLPatternNode,s_sFeatures,_rInstalledDriver.aFeatures);
+ lcl_fillValues(aURLPatternNode,s_sMetaData,_rInstalledDriver.aMetaData);
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+DriversConfigImpl::DriversConfigImpl()
+{
+}
+// -----------------------------------------------------------------------------
+void DriversConfigImpl::Load(const uno::Reference< lang::XMultiServiceFactory >& _rxORB,TInstalledDrivers& _rDrivers)
+{
+ if ( !m_aInstalled.isValid() )
+ {
+ static const ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.DataAccess.Drivers/Installed")); ///Installed
+ m_aInstalled = ::utl::OConfigurationTreeRoot::createWithServiceFactory(_rxORB, s_sNodeName, -1, ::utl::OConfigurationTreeRoot::CM_READONLY);
+ }
+
+ if ( m_aInstalled.isValid() )
+ {
+ const uno::Sequence< ::rtl::OUString > aURLPatterns = m_aInstalled.getNodeNames();
+ const ::rtl::OUString* pPatternIter = aURLPatterns.getConstArray();
+ const ::rtl::OUString* pPatternEnd = pPatternIter + aURLPatterns.getLength();
+ for (;pPatternIter != pPatternEnd ; ++pPatternIter)
+ {
+ TInstalledDriver aInstalledDriver;
+ lcl_readURLPatternNode(m_aInstalled,*pPatternIter,aInstalledDriver);
+ if ( aInstalledDriver.sDriverFactory.getLength() )
+ _rDrivers.insert(TInstalledDrivers::value_type(*pPatternIter,aInstalledDriver));
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+DriversConfig::DriversConfig(const uno::Reference< lang::XMultiServiceFactory >& _rxORB)
+{
+ m_aNode->Load(_rxORB,m_aDrivers);
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString DriversConfig::getDriverFactoryName(const ::rtl::OUString& _sURL) const
+{
+ ::rtl::OUString sRet;
+ ::rtl::OUString sOldPattern;
+ TInstalledDrivers::const_iterator aIter = m_aDrivers.begin();
+ TInstalledDrivers::const_iterator aEnd = m_aDrivers.end();
+ for(;aIter != aEnd;++aIter)
+ {
+ WildCard aWildCard(aIter->first);
+ if ( sOldPattern.getLength() < aIter->first.getLength() && aWildCard.Matches(_sURL) )
+ {
+ sRet = aIter->second.sDriverFactory;
+ sOldPattern = aIter->first;
+ }
+ }
+
+ return sRet;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString DriversConfig::getDriverTypeDisplayName(const ::rtl::OUString& _sURL) const
+{
+ ::rtl::OUString sRet;
+ ::rtl::OUString sOldPattern;
+ TInstalledDrivers::const_iterator aIter = m_aDrivers.begin();
+ TInstalledDrivers::const_iterator aEnd = m_aDrivers.end();
+ for(;aIter != aEnd;++aIter)
+ {
+ WildCard aWildCard(aIter->first);
+ if ( sOldPattern.getLength() < aIter->first.getLength() && aWildCard.Matches(_sURL) )
+ {
+ sRet = aIter->second.sDriverTypeDisplayName;
+ sOldPattern = aIter->first;
+ }
+ }
+
+ return sRet;
+}
+// -----------------------------------------------------------------------------
+const ::comphelper::NamedValueCollection& DriversConfig::getProperties(const ::rtl::OUString& _sURL) const
+{
+ return impl_get(_sURL,1);
+}
+// -----------------------------------------------------------------------------
+const ::comphelper::NamedValueCollection& DriversConfig::getFeatures(const ::rtl::OUString& _sURL) const
+{
+ return impl_get(_sURL,0);
+}
+// -----------------------------------------------------------------------------
+const ::comphelper::NamedValueCollection& DriversConfig::getMetaData(const ::rtl::OUString& _sURL) const
+{
+ return impl_get(_sURL,2);
+}
+// -----------------------------------------------------------------------------
+const ::comphelper::NamedValueCollection& DriversConfig::impl_get(const ::rtl::OUString& _sURL,sal_Int32 _nProps) const
+{
+ const ::comphelper::NamedValueCollection* pRet = NULL;
+ ::rtl::OUString sOldPattern;
+ TInstalledDrivers::const_iterator aIter = m_aDrivers.begin();
+ TInstalledDrivers::const_iterator aEnd = m_aDrivers.end();
+ for(;aIter != aEnd;++aIter)
+ {
+ WildCard aWildCard(aIter->first);
+ if ( sOldPattern.getLength() < aIter->first.getLength() && aWildCard.Matches(_sURL) )
+ {
+ switch(_nProps)
+ {
+ case 0:
+ pRet = &aIter->second.aFeatures;
+ break;
+ case 1:
+ pRet = &aIter->second.aProperties;
+ break;
+ case 2:
+ pRet = &aIter->second.aMetaData;
+ break;
+ }
+ sOldPattern = aIter->first;
+ }
+ } // for(;aIter != aEnd;++aIter)
+ if ( pRet == NULL )
+ {
+ static const ::comphelper::NamedValueCollection s_sEmpty;
+ pRet = &s_sEmpty;
+ }
+ return *pRet;
+}
+// -----------------------------------------------------------------------------
+uno::Sequence< ::rtl::OUString > DriversConfig::getURLs() const
+{
+ uno::Sequence< ::rtl::OUString > aRet(m_aDrivers.size());
+ ::rtl::OUString* pIter = aRet.getArray();
+ TInstalledDrivers::const_iterator aIter = m_aDrivers.begin();
+ TInstalledDrivers::const_iterator aEnd = m_aDrivers.end();
+ for(;aIter != aEnd;++aIter,++pIter)
+ {
+ *pIter = aIter->first;
+ }
+ return aRet;
+}
diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx
index 433b5ffc69ec..cd09efa227fe 100644
--- a/connectivity/source/commontools/FValue.cxx
+++ b/connectivity/source/commontools/FValue.cxx
@@ -37,6 +37,7 @@
#include <connectivity/dbconversion.hxx>
#include <cppuhelper/extract.hxx>
#include <com/sun/star/io/XInputStream.hpp>
+#include <rtl/ustrbuf.hxx>
#include <rtl/logfile.hxx>
using namespace connectivity;
@@ -984,12 +985,13 @@ Any ORowSetValue::makeAny() const
case DataType::VARBINARY:
case DataType::LONGVARBINARY:
{
- aRet = ::rtl::OUString::createFromAscii("0x");
+ ::rtl::OUStringBuffer sVal = ::rtl::OUString::createFromAscii("0x");
Sequence<sal_Int8> aSeq(getSequence());
const sal_Int8* pBegin = aSeq.getConstArray();
const sal_Int8* pEnd = pBegin + aSeq.getLength();
for(;pBegin != pEnd;++pBegin)
- aRet += ::rtl::OUString::valueOf((sal_Int32)*pBegin,16);
+ sVal.append((sal_Int32)*pBegin,16);
+ aRet = sVal.makeStringAndClear();
}
break;
case DataType::BIT:
@@ -1972,20 +1974,20 @@ void ORowSetValue::fill(const Any& _rValue)
setSigned(sal_False);
break;
}
- case TypeClass_HYPER:
- {
- sal_Int64 nValue(0);
- _rValue >>= nValue;
- (*this) = nValue;
- break;
- }
- case TypeClass_UNSIGNED_HYPER:
- {
- sal_uInt64 nValue(0);
- _rValue >>= nValue;
- (*this) = static_cast<sal_Int64>(nValue);
- setSigned(sal_False);
- break;
+ case TypeClass_HYPER:
+ {
+ sal_Int64 nValue(0);
+ _rValue >>= nValue;
+ (*this) = nValue;
+ break;
+ }
+ case TypeClass_UNSIGNED_HYPER:
+ {
+ sal_uInt64 nValue(0);
+ _rValue >>= nValue;
+ (*this) = static_cast<sal_Int64>(nValue);
+ setSigned(sal_False);
+ break;
}
case TypeClass_UNSIGNED_LONG:
{
diff --git a/connectivity/source/commontools/dbconversion.cxx b/connectivity/source/commontools/dbconversion.cxx
index 995c5323bc89..47c6143e6507 100644
--- a/connectivity/source/commontools/dbconversion.cxx
+++ b/connectivity/source/commontools/dbconversion.cxx
@@ -40,7 +40,7 @@
#include <com/sun/star/util/Date.hpp>
#include <com/sun/star/util/Time.hpp>
#include <com/sun/star/util/DateTime.hpp>
-
+#include <rtl/ustrbuf.hxx>
#define MAX_DAYS 3636532
@@ -96,13 +96,13 @@ namespace dbtools
::rtl::OUString DBTypeConversion::toDateTimeString(const DateTime& _rDateTime)
{
Date aDate(_rDateTime.Day,_rDateTime.Month,_rDateTime.Year);
- ::rtl::OUString aTemp(toDateString(aDate));
- aTemp += ::rtl::OUString::createFromAscii(" ");
+ ::rtl::OUStringBuffer aTemp(toDateString(aDate));
+ aTemp.appendAscii(" ");
Time aTime(0,_rDateTime.Seconds,_rDateTime.Minutes,_rDateTime.Hours);
- aTemp += toTimeString(aTime);
- aTemp += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("."));
- aTemp += ::rtl::OUString::valueOf(static_cast<sal_Int32>(_rDateTime.HundredthSeconds));
- return aTemp;
+ aTemp.append(toTimeString(aTime));
+ aTemp.appendAscii(".");
+ aTemp.append(static_cast<sal_Int32>(_rDateTime.HundredthSeconds));
+ return aTemp.makeStringAndClear();
}
//------------------------------------------------------------------------------
Date DBTypeConversion::toDate(sal_Int32 _nVal)
diff --git a/connectivity/source/commontools/dbmetadata.cxx b/connectivity/source/commontools/dbmetadata.cxx
index 66d2791c3fce..0d47cffce0ab 100644
--- a/connectivity/source/commontools/dbmetadata.cxx
+++ b/connectivity/source/commontools/dbmetadata.cxx
@@ -276,7 +276,15 @@ namespace dbtools
OSL_VERIFY( setting >>= doGenerate );
return doGenerate;
}
-
+ //--------------------------------------------------------------------
+ bool DatabaseMetaData::isAutoIncrementPrimaryKey() const
+ {
+ bool doGenerate( true );
+ Any setting;
+ if ( lcl_getConnectionSetting( "AutoIncrementIsPrimaryKey", *m_pImpl, setting ) )
+ OSL_VERIFY( setting >>= doGenerate );
+ return doGenerate;
+ }
//--------------------------------------------------------------------
sal_Int32 DatabaseMetaData::getBooleanComparisonMode() const
{
diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx
index cc842f56e008..1e1fa87cc58e 100644
--- a/connectivity/source/commontools/dbtools2.cxx
+++ b/connectivity/source/commontools/dbtools2.cxx
@@ -86,10 +86,10 @@ namespace dbtools
sal_Int32 nPrecision = 0;
sal_Int32 nScale = 0;
- ::rtl::OUString sQuoteString = xMetaData->getIdentifierQuoteString();
- ::rtl::OUString aSql = ::dbtools::quoteName(sQuoteString,::comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME))));
+ const ::rtl::OUString sQuoteString = xMetaData->getIdentifierQuoteString();
+ ::rtl::OUStringBuffer aSql = ::dbtools::quoteName(sQuoteString,::comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME))));
- aSql += ::rtl::OUString::createFromAscii(" ");
+ aSql.appendAscii(" ");
nDataType = nPrecision = nScale = 0;
sal_Bool bIsAutoIncrement = sal_False;
@@ -143,54 +143,59 @@ namespace dbtools
sal_Int32 nParenPos = sTypeName.indexOf('(');
if ( nParenPos == -1 )
{
- aSql += sTypeName;
- aSql += ::rtl::OUString::createFromAscii("(");
+ aSql.append(sTypeName);
+ aSql.appendAscii("(");
}
else
{
- aSql += sTypeName.copy(0,++nParenPos);
+ aSql.append(sTypeName.copy(0,++nParenPos));
}
if ( nPrecision > 0 && nDataType != DataType::TIMESTAMP )
{
- aSql += ::rtl::OUString::valueOf(nPrecision);
+ aSql.append(nPrecision);
if ( (nScale > 0) || (_sCreatePattern.getLength() && sCreateParams.indexOf(_sCreatePattern) != -1) )
- aSql += ::rtl::OUString::createFromAscii(",");
+ aSql.appendAscii(",");
}
if ( (nScale > 0) || (_sCreatePattern.getLength() && sCreateParams.indexOf(_sCreatePattern) != -1 ) || nDataType == DataType::TIMESTAMP )
- aSql += ::rtl::OUString::valueOf(nScale);
+ aSql.append(nScale);
if ( nParenPos == -1 )
- aSql += ::rtl::OUString::createFromAscii(")");
+ aSql.appendAscii(")");
else
{
nParenPos = sTypeName.indexOf(')',nParenPos);
- aSql += sTypeName.copy(nParenPos);
+ aSql.append(sTypeName.copy(nParenPos));
}
}
else
- aSql += sTypeName; // simply add the type name
+ aSql.append(sTypeName); // simply add the type name
::rtl::OUString aDefault = ::comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_DEFAULTVALUE)));
- if(aDefault.getLength())
- aSql += ::rtl::OUString::createFromAscii(" DEFAULT ") + sPreFix + aDefault + sPostFix;
+ if ( aDefault.getLength() )
+ {
+ aSql.append(::rtl::OUString::createFromAscii(" DEFAULT "));
+ aSql.append(sPreFix);
+ aSql.append(aDefault);
+ aSql.append(sPostFix);
+ } // if ( aDefault.getLength() )
if(::comphelper::getINT32(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_ISNULLABLE))) == ColumnValue::NO_NULLS)
- aSql += ::rtl::OUString::createFromAscii(" NOT NULL");
+ aSql.append(::rtl::OUString::createFromAscii(" NOT NULL"));
if ( bIsAutoIncrement && sAutoIncrementValue.getLength())
{
- aSql += ::rtl::OUString::createFromAscii(" ");
- aSql += sAutoIncrementValue;
+ aSql.appendAscii(" ");
+ aSql.append(sAutoIncrementValue);
}
- return aSql;
+ return aSql.makeStringAndClear();
}
// -----------------------------------------------------------------------------
::rtl::OUString createStandardCreateStatement(const Reference< XPropertySet >& descriptor,const Reference< XConnection>& _xConnection,const ::rtl::OUString& _sCreatePattern)
{
- ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("CREATE TABLE ");
+ ::rtl::OUStringBuffer aSql = ::rtl::OUString::createFromAscii("CREATE TABLE ");
::rtl::OUString sCatalog,sSchema,sTable,sComposedName;
Reference<XDatabaseMetaData> xMetaData = _xConnection->getMetaData();
@@ -204,7 +209,8 @@ namespace dbtools
if ( !sComposedName.getLength() )
::dbtools::throwFunctionSequenceException(_xConnection);
- aSql += sComposedName + ::rtl::OUString::createFromAscii(" (");
+ aSql.append(sComposedName);
+ aSql.append(::rtl::OUString::createFromAscii(" ("));
// columns
Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY);
@@ -220,11 +226,11 @@ namespace dbtools
{
if ( (xColumns->getByIndex(i) >>= xColProp) && xColProp.is() )
{
- aSql += createStandardColumnPart(xColProp,_xConnection,_sCreatePattern);
- aSql += ::rtl::OUString::createFromAscii(",");
+ aSql.append(createStandardColumnPart(xColProp,_xConnection,_sCreatePattern));
+ aSql.appendAscii(",");
}
}
- return aSql;
+ return aSql.makeStringAndClear();
}
namespace
{
@@ -256,7 +262,7 @@ namespace
Reference<XDatabaseMetaData> xMetaData = _xConnection->getMetaData();
::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap();
- ::rtl::OUString aSql;
+ ::rtl::OUStringBuffer aSql;
// keys
Reference<XKeysSupplier> xKeySup(descriptor,UNO_QUERY);
Reference<XIndexAccess> xKeys = xKeySup->getKeys();
@@ -286,8 +292,8 @@ namespace
::dbtools::throwFunctionSequenceException(_xConnection);
const ::rtl::OUString sQuote = xMetaData->getIdentifierQuoteString();
- aSql += ::rtl::OUString::createFromAscii(" PRIMARY KEY ");
- aSql += generateColumnNames(xColumns,xMetaData);
+ aSql.append(::rtl::OUString::createFromAscii(" PRIMARY KEY "));
+ aSql.append(generateColumnNames(xColumns,xMetaData));
}
else if(nKeyType == KeyType::UNIQUE)
{
@@ -297,8 +303,8 @@ namespace
::dbtools::throwFunctionSequenceException(_xConnection);
const ::rtl::OUString sQuote = xMetaData->getIdentifierQuoteString();
- aSql += ::rtl::OUString::createFromAscii(" UNIQUE ");
- aSql += generateColumnNames(xColumns,xMetaData);
+ aSql.append(::rtl::OUString::createFromAscii(" UNIQUE "));
+ aSql.append(generateColumnNames(xColumns,xMetaData));
}
else if(nKeyType == KeyType::FOREIGN)
{
@@ -309,7 +315,7 @@ namespace
if(!xColumns.is() || !xColumns->getCount())
::dbtools::throwFunctionSequenceException(_xConnection);
- aSql += ::rtl::OUString::createFromAscii(" FOREIGN KEY ");
+ aSql.append(::rtl::OUString::createFromAscii(" FOREIGN KEY "));
::rtl::OUString sRefTable = getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_REFERENCEDTABLE)));
::dbtools::qualifiedNameComponents(xMetaData,
sRefTable,
@@ -323,21 +329,21 @@ namespace
if ( !sComposedName.getLength() )
::dbtools::throwFunctionSequenceException(_xConnection);
- aSql += generateColumnNames(xColumns,xMetaData);
+ aSql.append(generateColumnNames(xColumns,xMetaData));
switch(nDeleteRule)
{
case KeyRule::CASCADE:
- aSql += ::rtl::OUString::createFromAscii(" ON DELETE CASCADE ");
+ aSql.append(::rtl::OUString::createFromAscii(" ON DELETE CASCADE "));
break;
case KeyRule::RESTRICT:
- aSql += ::rtl::OUString::createFromAscii(" ON DELETE RESTRICT ");
+ aSql.append(::rtl::OUString::createFromAscii(" ON DELETE RESTRICT "));
break;
case KeyRule::SET_NULL:
- aSql += ::rtl::OUString::createFromAscii(" ON DELETE SET NULL ");
+ aSql.append(::rtl::OUString::createFromAscii(" ON DELETE SET NULL "));
break;
case KeyRule::SET_DEFAULT:
- aSql += ::rtl::OUString::createFromAscii(" ON DELETE SET DEFAULT ");
+ aSql.append(::rtl::OUString::createFromAscii(" ON DELETE SET DEFAULT "));
break;
default:
;
@@ -349,13 +355,13 @@ namespace
if ( aSql.getLength() )
{
- if ( aSql.lastIndexOf(',') == (aSql.getLength()-1) )
- aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")"));
+ if ( aSql.charAt(aSql.getLength()-1) == ',' )
+ aSql.setCharAt(aSql.getLength()-1,')');
else
- aSql += ::rtl::OUString::createFromAscii(")");
+ aSql.appendAscii(")");
}
- return aSql;
+ return aSql.makeStringAndClear();
}
// -----------------------------------------------------------------------------
@@ -364,7 +370,7 @@ namespace
const ::rtl::OUString& _sCreatePattern)
{
::rtl::OUString aSql = ::dbtools::createStandardCreateStatement(descriptor,_xConnection,_sCreatePattern);
- ::rtl::OUString sKeyStmt = ::dbtools::createStandardKeyStatement(descriptor,_xConnection);
+ const ::rtl::OUString sKeyStmt = ::dbtools::createStandardKeyStatement(descriptor,_xConnection);
if ( sKeyStmt.getLength() )
aSql += sKeyStmt;
else
@@ -603,7 +609,7 @@ Reference< XTablesSupplier> getDataDefinitionByURLAndConnection(
// if we don't get the catalog from the original driver we have to try them all.
if ( !xTablesSup.is() )
- {
+ { // !TODO: Why?
Reference< XEnumerationAccess> xEnumAccess( xManager, UNO_QUERY_THROW );
Reference< XEnumeration > xEnum( xEnumAccess->createEnumeration(), UNO_QUERY_THROW );
while ( xEnum.is() && xEnum->hasMoreElements() && !xTablesSup.is() )
diff --git a/connectivity/source/commontools/makefile.mk b/connectivity/source/commontools/makefile.mk
index a9c942ec9cb2..ee335705e651 100644
--- a/connectivity/source/commontools/makefile.mk
+++ b/connectivity/source/commontools/makefile.mk
@@ -85,6 +85,7 @@ EXCEPTIONSFILES=\
$(SLO)$/filtermanager.obj \
$(SLO)$/parameters.obj \
$(SLO)$/ParamterSubstitution.obj \
+ $(SLO)$/DriversConfig.obj \
$(SLO)$/formattedcolumnvalue.obj \
$(SLO)$/warningscontainer.obj
diff --git a/connectivity/source/commontools/parameters.cxx b/connectivity/source/commontools/parameters.cxx
index d45a7ac849a3..b2a093753804 100644
--- a/connectivity/source/commontools/parameters.cxx
+++ b/connectivity/source/commontools/parameters.cxx
@@ -54,6 +54,7 @@
#include <comphelper/proparrhlp.hxx>
#include <comphelper/broadcasthelper.hxx>
#include "connectivity/ParameterCont.hxx"
+#include <rtl/ustrbuf.hxx>
//........................................................................
namespace dbtools
@@ -394,24 +395,24 @@ namespace dbtools
// did we find links where the detail field refers to a detail column (instead of a parameter name)?
if ( !aAdditionalFilterComponents.empty() )
{
+ const static ::rtl::OUString s_sAnd( RTL_CONSTASCII_USTRINGPARAM( " AND " ) );
// build a conjunction of all the filter components
- ::rtl::OUString sAdditionalFilter;
+ ::rtl::OUStringBuffer sAdditionalFilter;
for ( ::std::vector< ::rtl::OUString >::const_iterator aComponent = aAdditionalFilterComponents.begin();
aComponent != aAdditionalFilterComponents.end();
++aComponent
)
{
- ::rtl::OUString sBracketed( RTL_CONSTASCII_USTRINGPARAM( "( " ) );
- sBracketed += *aComponent;
- sBracketed += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " )" ) );
-
if ( sAdditionalFilter.getLength() )
- sAdditionalFilter += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " AND " ) );
- sAdditionalFilter += sBracketed;
+ sAdditionalFilter.append(s_sAnd);
+
+ sAdditionalFilter.appendAscii("( ",((sal_Int32)(sizeof("( ")-1)));
+ sAdditionalFilter.append(*aComponent);
+ sAdditionalFilter.appendAscii(" )",((sal_Int32)(sizeof(" )")-1)));
}
// now set this filter at the 's filter manager
- _rFilterManager.setFilterComponent( FilterManager::fcLinkFilter, sAdditionalFilter );
+ _rFilterManager.setFilterComponent( FilterManager::fcLinkFilter, sAdditionalFilter.makeStringAndClear() );
_rColumnsInLinkDetails = true;
}
@@ -1119,3 +1120,4 @@ namespace dbtools
//........................................................................
} // namespace frm
//........................................................................
+
diff --git a/connectivity/source/dbtools/makefile.mk b/connectivity/source/dbtools/makefile.mk
index 908d38c92e03..060ff6c55487 100644
--- a/connectivity/source/dbtools/makefile.mk
+++ b/connectivity/source/dbtools/makefile.mk
@@ -65,6 +65,7 @@ SHL1STDLIBS=\
$(SALLIB) \
$(JVMACCESSLIB) \
$(UNOTOOLSLIB) \
+ $(TOOLSLIB) \
$(COMPHELPERLIB) \
$(I18NISOLANGLIB)
diff --git a/connectivity/source/drivers/adabas/adabas.xcu b/connectivity/source/drivers/adabas/adabas.xcu
new file mode 100755
index 000000000000..0648d25cebe6
--- /dev/null
+++ b/connectivity/source/drivers/adabas/adabas.xcu
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * 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: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * 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.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:adabas:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbcx.adabas.ODriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Adabas D</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="ShutdownDatabase" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ </node>
+ <node oor:name="DataCacheSizeIncrement" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:int">
+ <value>20</value>
+ </prop>
+ </node>
+ <node oor:name="DataCacheSize" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:int">
+ <value>20</value>
+ </prop>
+ </node>
+ <node oor:name="ControlUser" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="ControlPassword" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="CharSet" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="Features">
+ <node oor:name="UseSQL92NamingConstraints" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="AppendTableAliasInSelect" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="DisplayVersionColumns" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseDOSLineEnds" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="BooleanComparisonMode" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FormsCheckRequiredFields" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsTableCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="Authentication" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>UserPassword</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/adabas/makefile.mk b/connectivity/source/drivers/adabas/makefile.mk
index 59f3238b4fdc..09b2936e1c7d 100644
--- a/connectivity/source/drivers/adabas/makefile.mk
+++ b/connectivity/source/drivers/adabas/makefile.mk
@@ -42,8 +42,8 @@ VISIBILITY_HIDDEN=TRUE
ENVCFLAGS+=/FR$(SLO)$/
.ENDIF
-.INCLUDE : settings.mk
-.INCLUDE : $(PRJ)$/version.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
+.INCLUDE : $(PRJ)$/version.mk
.IF "$(SYSTEM_ODBC_HEADERS)" == "YES"
CFLAGS+=-DSYSTEM_ODBC_HEADERS
@@ -104,9 +104,7 @@ SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
DEF1EXPORTFILE= exports.dxp
-
# --- Targets ----------------------------------
-.INCLUDE : target.mk
-
+.INCLUDE : $(PRJ)$/target.pmk \ No newline at end of file
diff --git a/connectivity/source/drivers/ado/ado.xcu b/connectivity/source/drivers/ado/ado.xcu
new file mode 100755
index 000000000000..949d6fb86a19
--- /dev/null
+++ b/connectivity/source/drivers/ado/ado.xcu
@@ -0,0 +1,242 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * 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: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * 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.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:ado:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.ado.ODriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">ADO</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="CharSet" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="Features">
+ <node oor:name="GeneratedValues" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseSQL92NamingConstraints" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="AppendTableAliasInSelect" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseBracketedOuterJoinSyntax" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="IgnoreDriverPrivileges" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="DisplayVersionColumns" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseCatalogInSelect" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseSchemaInSelect" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseIndexDirectionKeyword" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseDOSLineEnds" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="BooleanComparisonMode" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FormsCheckRequiredFields" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsTableCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="Authentication" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>UserPassword</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.ado.ODriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Microsoft Access</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="CharSet" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="Features">
+ <node oor:name="UseSQL92NamingConstraints" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="AppendTableAliasInSelect" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseBracketedOuterJoinSyntax" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseDOSLineEnds" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="BooleanComparisonMode" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FormsCheckRequiredFields" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="ColumnAliasInOrderBy" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ </node>
+ <node oor:name="SupportsTableCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FileSystemBased" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="MediaType" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>application/msaccess</value>
+ </prop>
+ </node>
+ <node oor:name="Extension" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>mdb</value>
+ </prop>
+ </node>
+ <node oor:name="BooleanComparisonMode" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:int">
+ <value>3</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=*" oor:op="replace">
+ <prop oor:name="ParentURLPattern">
+ <value>sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=*</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Microsoft Access 2007</value>
+ </prop>
+ <node oor:name="MetaData">
+ <node oor:name="Extension" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/ado/makefile.mk b/connectivity/source/drivers/ado/makefile.mk
index 1aace34e4de6..b453c528e127 100644
--- a/connectivity/source/drivers/ado/makefile.mk
+++ b/connectivity/source/drivers/ado/makefile.mk
@@ -28,7 +28,6 @@
# for a copy of the LGPLv3 License.
#
#*************************************************************************
-.IF "$(GUI)"=="WNT"
PRJ=..$/..$/..
PRJINC=..$/..
@@ -43,9 +42,10 @@ VISIBILITY_HIDDEN=TRUE
ENVCFLAGS+=/FR$(SLO)$/
.ENDIF
-.INCLUDE : settings.mk
.INCLUDE : $(PRJ)$/version.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
+.IF "$(GUI)"=="WNT"
# --- Files -------------------------------------
EXCEPTIONSFILES= \
@@ -109,9 +109,10 @@ SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
DEF1EXPORTFILE= exports.dxp
-# --- Targets ----------------------------------
-
-.INCLUDE : target.mk
-
+.ELSE
+dummy:
+ @echo "Nothing to build for GUI $(GUI)"
.ENDIF # "$(GUI)"=="WNT"
+# --- Targets ----------------------------------
+.INCLUDE : $(PRJ)$/target.pmk
diff --git a/connectivity/source/drivers/calc/calc.xcu b/connectivity/source/drivers/calc/calc.xcu
new file mode 100755
index 000000000000..7260341946f1
--- /dev/null
+++ b/connectivity/source/drivers/calc/calc.xcu
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * 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: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * 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.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:calc:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.calc.ODriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Spreadsheet</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FileSystemBased" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="MediaType" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>application/vnd.oasis.opendocument.spreadsheet</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/calc/makefile.mk b/connectivity/source/drivers/calc/makefile.mk
index 08d83423638d..620bcd6a8eee 100644
--- a/connectivity/source/drivers/calc/makefile.mk
+++ b/connectivity/source/drivers/calc/makefile.mk
@@ -42,7 +42,7 @@ VISIBILITY_HIDDEN=TRUE
ENVCFLAGS+=/FR$(SLO)$/
.ENDIF
-.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
.INCLUDE : $(PRJ)$/version.mk
@@ -94,6 +94,6 @@ DEF1EXPORTFILE= exports.dxp
# --- Targets ----------------------------------
-.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/target.pmk
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index 1c5210bfcdc6..d4a83249098a 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -368,11 +368,12 @@ void ODbaseTable::fillColumns()
cType[0] = aDBFColumn.db_typ;
cType[1] = 0;
aTypeName = ::rtl::OUString::createFromAscii(cType);
+OSL_TRACE("column type: %c",aDBFColumn.db_typ);
switch (aDBFColumn.db_typ)
{
case 'C':
- eType = DataType::CHAR;
+ eType = DataType::VARCHAR;
aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR"));
break;
case 'F':
@@ -2785,13 +2786,13 @@ BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable)
if ( bIsText )
{
// char cChar;
- ::rtl::OUString aStr;
+ ::rtl::OUStringBuffer aStr;
while ( nLength > STRING_MAXLEN )
{
ByteString aBStr;
aBStr.Expand(STRING_MAXLEN);
m_pMemoStream->Read(aBStr.AllocBuffer(STRING_MAXLEN),STRING_MAXLEN);
- aStr += ::rtl::OUString(aBStr.GetBuffer(),aBStr.Len(), m_eEncoding);
+ aStr.append(::rtl::OUString(aBStr.GetBuffer(),aBStr.Len(), m_eEncoding));
nLength -= STRING_MAXLEN;
}
if ( nLength > 0 )
@@ -2800,12 +2801,10 @@ BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable)
aBStr.Expand(static_cast<xub_StrLen>(nLength));
m_pMemoStream->Read(aBStr.AllocBuffer(static_cast<xub_StrLen>(nLength)),nLength);
// aBStr.ReleaseBufferAccess();
-
- aStr += ::rtl::OUString(aBStr.GetBuffer(),aBStr.Len(), m_eEncoding);
-
+ aStr.append(::rtl::OUString(aBStr.GetBuffer(),aBStr.Len(), m_eEncoding));
}
if ( aStr.getLength() )
- aVariable = aStr;
+ aVariable = aStr.makeStringAndClear();
} // if ( bIsText )
else
{
diff --git a/connectivity/source/drivers/dbase/dbase.xcu b/connectivity/source/drivers/dbase/dbase.xcu
new file mode 100755
index 000000000000..e981a56a34d2
--- /dev/null
+++ b/connectivity/source/drivers/dbase/dbase.xcu
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * 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: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * 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.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:dbase:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.dbase.ODriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">dBASE</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="CharSet" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="ShowDeleted" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ </node>
+ <node oor:name="EnableSQL92Check" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="Features">
+ <node oor:name="UseSQL92NamingConstraints" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseDOSLineEnds" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsTableCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FileSystemBased" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="MediaType" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>application/dbase</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/dbase/makefile.mk b/connectivity/source/drivers/dbase/makefile.mk
index 7a827b86d46f..37a88ef47674 100644
--- a/connectivity/source/drivers/dbase/makefile.mk
+++ b/connectivity/source/drivers/dbase/makefile.mk
@@ -41,7 +41,7 @@ VISIBILITY_HIDDEN=TRUE
ENVCFLAGS+=/FR$(SLO)$/
.ENDIF
-.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
.INCLUDE : $(PRJ)$/version.mk
# --- Files -------------------------------------
@@ -128,6 +128,6 @@ DEF1EXPORTFILE= exports.dxp
# --- Targets ----------------------------------
-.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/target.pmk
diff --git a/connectivity/source/drivers/evoab/LCatalog.cxx b/connectivity/source/drivers/evoab/LCatalog.cxx
new file mode 100644
index 000000000000..713af210ac38
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LCatalog.cxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * 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: LCatalog.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * 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_connectivity.hxx"
+
+
+#include "LCatalog.hxx"
+#include "LConnection.hxx"
+#include "LTables.hxx"
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/sdbc/XResultSet.hpp>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::container;
+
+// -------------------------------------------------------------------------
+using namespace connectivity::evoab;
+// -------------------------------------------------------------------------
+OEvoabCatalog::OEvoabCatalog(OEvoabConnection* _pCon) : file::OFileCatalog(_pCon)
+{
+}
+// -------------------------------------------------------------------------
+void OEvoabCatalog::refreshTables()
+{
+ TStringVector aVector;
+ Sequence< ::rtl::OUString > aTypes;
+ Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),
+ ::rtl::OUString::createFromAscii("%"),::rtl::OUString::createFromAscii("%"),aTypes);
+
+ if(xResult.is())
+ {
+ Reference< XRow > xRow(xResult,UNO_QUERY);
+ while(xResult->next())
+ aVector.push_back(xRow->getString(3));
+ }
+ if(m_pTables)
+ m_pTables->reFill(aVector);
+ else
+ m_pTables = new OEvoabTables(m_xMetaData,*this,m_aMutex,aVector);
+}
+// -----------------------------------------------------------------------------
+
+
+
diff --git a/svx/source/sdr/overlay/overlaylinestriped.cxx b/connectivity/source/drivers/evoab/LCatalog.hxx
index c00be65908e2..e539db3a8fc3 100644
--- a/svx/source/sdr/overlay/overlaylinestriped.cxx
+++ b/connectivity/source/drivers/evoab/LCatalog.hxx
@@ -6,7 +6,7 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: overlaylinestriped.cxx,v $
+ * $RCSfile: LCatalog.hxx,v $
* $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
@@ -28,20 +28,25 @@
*
************************************************************************/
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svx.hxx"
-#include <svx/sdr/overlay/overlaylinestriped.hxx>
-#include <tools/gen.hxx>
-#include <vcl/outdev.hxx>
+#ifndef _CONNECTIVITY_EVOAB_LCATALOG_HXX_
+#define _CONNECTIVITY_EVOAB_LCATALOG_HXX_
-//////////////////////////////////////////////////////////////////////////////
+#include "file/FCatalog.hxx"
-namespace sdr
+namespace connectivity
{
- namespace overlay
+ namespace evoab
{
- } // end of namespace overlay
-} // end of namespace sdr
+ class OEvoabConnection;
+ class OEvoabCatalog : public file::OFileCatalog
+ {
+ public:
+ virtual void refreshTables();
+
+ public:
+ OEvoabCatalog(OEvoabConnection* _pCon);
+ };
+ }
+}
+#endif // _CONNECTIVITY_EVOAB_LCATALOG_HXX_
-//////////////////////////////////////////////////////////////////////////////
-// eof
diff --git a/connectivity/source/drivers/evoab/LColumnAlias.cxx b/connectivity/source/drivers/evoab/LColumnAlias.cxx
new file mode 100644
index 000000000000..30b94e2e20c9
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LColumnAlias.cxx
@@ -0,0 +1,235 @@
+/*************************************************************************
+ *
+ * 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: LColumnAlias.cxx,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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_connectivity.hxx"
+#include "LColumnAlias.hxx"
+#include "LDriver.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include "LConfigAccess.hxx"
+
+using namespace ::connectivity;
+using namespace ::connectivity::evoab;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+
+static const ::rtl::OUString sProgrammaticNames[] =
+{
+ ::rtl::OUString::createFromAscii("FirstName"),
+ ::rtl::OUString::createFromAscii("LastName"),
+ ::rtl::OUString::createFromAscii("DisplayName"),
+ ::rtl::OUString::createFromAscii("NickName"),
+ ::rtl::OUString::createFromAscii("PrimaryEmail"),
+ ::rtl::OUString::createFromAscii("SecondEmail"),
+ ::rtl::OUString::createFromAscii("PreferMailFormat"),
+ ::rtl::OUString::createFromAscii("WorkPhone"),
+ ::rtl::OUString::createFromAscii("HomePhone"),
+ ::rtl::OUString::createFromAscii("FaxNumber"),
+ ::rtl::OUString::createFromAscii("PagerNumber"),
+ ::rtl::OUString::createFromAscii("CellularNumber"),
+ ::rtl::OUString::createFromAscii("HomeAddress"),
+ ::rtl::OUString::createFromAscii("HomeAddress2"),
+ ::rtl::OUString::createFromAscii("HomeCity"),
+ ::rtl::OUString::createFromAscii("HomeState"),
+ ::rtl::OUString::createFromAscii("HomeZipCode"),
+ ::rtl::OUString::createFromAscii("HomeCountry"),
+ ::rtl::OUString::createFromAscii("WorkAddress"),
+ ::rtl::OUString::createFromAscii("WorkAddress2"),
+ ::rtl::OUString::createFromAscii("WorkCity"),
+ ::rtl::OUString::createFromAscii("WorkState"),
+ ::rtl::OUString::createFromAscii("WorkZipCode"),
+ ::rtl::OUString::createFromAscii("WorkCountry"),
+ ::rtl::OUString::createFromAscii("JobTitle"),
+ ::rtl::OUString::createFromAscii("Department"),
+ ::rtl::OUString::createFromAscii("Company"),
+ ::rtl::OUString::createFromAscii("WebPage1"),
+ ::rtl::OUString::createFromAscii("WebPage2"),
+ ::rtl::OUString::createFromAscii("BirthYear"),
+ ::rtl::OUString::createFromAscii("BirthMonth"),
+ ::rtl::OUString::createFromAscii("BirthDay"),
+ ::rtl::OUString::createFromAscii("Notes")
+};
+//------------------------------------------------------------------------------
+OColumnAlias::OColumnAlias()
+{
+ // Initialise m_aAlias with the default values from sProgrammaticNames.
+ initialise();
+
+ // Initialise m_aAlias map with the default values from sProgrammaticNames.
+ setAliasMap();
+}
+//------------------------------------------------------------------
+OColumnAlias::~OColumnAlias()
+{
+}
+//------------------------------------------------------------------
+void OColumnAlias::initialise()
+{
+ m_aAlias.reserve( END - FIRSTNAME + 1 );
+ for (sal_Int32 i(FIRSTNAME); i < END; ++i)
+ {
+ m_aAlias.push_back(sProgrammaticNames[i]);
+ m_aHeadLineNames.push_back(sProgrammaticNames[i]);
+ }
+
+ return;
+}
+//------------------------------------------------------------------
+void OColumnAlias::setAlias(const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& _rxORB)
+{
+ OSL_TRACE("OColumnAlias::setAlias()entered");
+
+ // open our driver settings config node
+
+ // the config path for our own driver's settings
+ Reference< XPropertySet > xEvoDriverNode = createDriverConfigNode( _rxORB, OEvoabDriver::getImplementationName_Static() );
+ //Reference< XPropertySet > xMozDriverNode = createDriverConfigNode( _rxORB, mozab::OConnection::getDriverImplementationName() );
+ Reference< XPropertySet > xMozDriverNode = createDriverConfigNode( _rxORB, ::rtl::OUString::createFromAscii ("com.sun.star.comp.sdbc.MozabDriver") );
+ if ( xEvoDriverNode.is() && xMozDriverNode.is() )
+ {
+ try
+ {
+ //=============================================================
+ Reference< XNameAccess > xEvoAliasesNode;
+ Reference< XNameAccess > xMozAliasesNode;
+ xEvoDriverNode->getPropertyValue( ::rtl::OUString::createFromAscii("ColumnAliases") ) >>= xEvoAliasesNode;
+ xMozDriverNode->getPropertyValue( ::rtl::OUString::createFromAscii("ColumnAliases") ) >>= xMozAliasesNode;
+ OSL_ENSURE( xEvoAliasesNode.is(), "OColumnAlias::setAlias: missing the evolution aliases node!" );
+ OSL_ENSURE( xMozAliasesNode.is(), "OColumnAlias::setAlias: missing the mozilla aliases node!" );
+
+ // this is a set of string nodes
+ Sequence< ::rtl::OUString > aColumnProgrammaticNames;
+ //OSL_TRACE("OColumnAlias::setAlias()before xAliasesNode->getElementNames()");
+ if ( xEvoAliasesNode.is() )
+ aColumnProgrammaticNames = xEvoAliasesNode->getElementNames();
+ //OSL_TRACE("OColumnAlias::setAlias()after xAliasesNode->getElementNames()");
+
+ //=============================================================
+ // travel through all the set elements
+ const ::rtl::OUString* pProgrammaticNames = aColumnProgrammaticNames.getConstArray();
+ const ::rtl::OUString* pProgrammaticNamesEnd = pProgrammaticNames + aColumnProgrammaticNames.getLength();
+ ::rtl::OUString sAssignedAlias;
+ ::rtl::OUString sHeadLineName;
+
+ for ( ; pProgrammaticNames < pProgrammaticNamesEnd; ++pProgrammaticNames )
+ {
+ //OSL_TRACE("OColumnAlias::setAlias()::*pProgrammaticNames = %s\n", ((OUtoCStr(*pProgrammaticNames)) ? (OUtoCStr(*pProgrammaticNames)):("NULL")) );
+ OSL_ENSURE( m_aAliasMap.end() != m_aAliasMap.find( *pProgrammaticNames ),
+ "OColumnAlias::setAlias: found an invalid programmtic name!" );
+ // if this asserts, somebody stored a programmatic name in the configuration
+ // which is not allowed (i.e. not in the list of known programmatics).
+ //OSL_TRACE("OColumnAlias::setAlias()before xAliasesNode->getByName()");
+
+#if OSL_DEBUG_LEVEL > 0
+ sal_Bool bExtractionSuccess =
+#endif
+ xMozAliasesNode->getByName( *pProgrammaticNames) >>= sAssignedAlias;
+ OSL_ENSURE( bExtractionSuccess, "OColumnAlias::setAlias: invalid mozilla config data!" );
+#if OSL_DEBUG_LEVEL > 0
+ bExtractionSuccess =
+#endif
+ xEvoAliasesNode->getByName( *pProgrammaticNames) >>= sHeadLineName;
+ OSL_ENSURE( bExtractionSuccess, "OColumnAlias::setAlias: invalid evolution config data!" );
+ //OSL_TRACE("OColumnAlias::setAlias()after xAliasesNode->getByName()");
+
+ // normalize in case the config data is corrupted
+ // (what we really don't need is an empty alias ...)
+ if ( 0 == sAssignedAlias.getLength() )
+ sAssignedAlias = *pProgrammaticNames;
+ if ( 0 == sHeadLineName.getLength() )
+ sHeadLineName = *pProgrammaticNames;
+ //OSL_TRACE("OColumnAlias::setAlias()::sAssignedAlias = %s\n", ((OUtoCStr(sAssignedAlias)) ? (OUtoCStr(sAssignedAlias)):("NULL")) );
+ //OSL_TRACE("OColumnAlias::setAlias()::sHeadLineName = %s\n", ((OUtoCStr(sHeadLineName)) ? (OUtoCStr(sHeadLineName)):("NULL")) );
+
+ //=============================================================
+ // check the value
+ // look up the programmatic indicated by pProgrammaticNames in the known programmatics
+ const ::rtl::OUString* pProgrammatic = sProgrammaticNames + FIRSTNAME;
+ const ::rtl::OUString* pProgrammaticEnd = sProgrammaticNames + END;
+
+ OSL_ENSURE( (sal_Int32)m_aAlias.size() == pProgrammaticEnd - pProgrammatic,
+ "OColumnAlias::setAlias: aliases vector not yet initialized!" );
+
+ // the destination where we want to remember the alias
+ ::std::vector< ::rtl::OUString >::iterator aAlias = m_aAlias.begin();
+ ::std::vector< ::rtl::OUString >::iterator aHeadLineName = m_aHeadLineNames.begin();
+
+ for ( ; pProgrammatic < pProgrammaticEnd; ++pProgrammatic, ++aAlias, ++aHeadLineName )
+ {
+ //OSL_TRACE("OColumnAlias::setAlias()::*pProgrammatic = %s\n", ((OUtoCStr(*pProgrammatic)) ? (OUtoCStr(*pProgrammatic)):("NULL")) );
+ if ( pProgrammaticNames->equals( *pProgrammatic ) )
+ {
+ // add alias to the vector
+ *aAlias = sAssignedAlias;
+ *aHeadLineName = sHeadLineName;
+ break;
+ }
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "OColumnAlias::setAlias: could not read my driver's configuration data!" );
+ }
+ }
+
+ // Initialise m_aAliasMap.
+ setAliasMap();
+
+ return;
+}
+//------------------------------------------------------------------
+const ::std::vector< ::rtl::OUString> & OColumnAlias::getAlias() const
+{
+ return m_aAlias;
+}
+//------------------------------------------------------------------
+const ::std::map< ::rtl::OUString, ::rtl::OUString> & OColumnAlias::getAliasMap() const
+{
+ return m_aAliasMap;
+}
+//------------------------------------------------------------------
+void OColumnAlias::setAliasMap()
+{
+ // Fill the map with the values of m_aAlias
+ // and the sProgrammaticNames array.
+ for (sal_Int32 i(FIRSTNAME); i < END; ++i) {
+ m_aAliasMap[m_aAlias[i]] = m_aHeadLineNames[i];
+ //OSL_TRACE("OColumnAlias::setAliasMap()::m_aAlias[i] = %s\n", ((OUtoCStr(m_aAlias[i])) ? (OUtoCStr(m_aAlias[i])):("NULL")) );
+ //OSL_TRACE("OColumnAlias::setAliasMap()::m_aAliasMap[m_aAlias[i]] = %s\n", ((OUtoCStr(m_aAliasMap[m_aAlias[i]])) ? (OUtoCStr(m_aAliasMap[m_aAlias[i]])):("NULL")) );
+ }
+
+ return;
+}
+//------------------------------------------------------------------
diff --git a/connectivity/source/drivers/evoab/LColumnAlias.hxx b/connectivity/source/drivers/evoab/LColumnAlias.hxx
new file mode 100644
index 000000000000..c91931d121bf
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LColumnAlias.hxx
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * 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: LColumnAlias.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * 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 _CONNECTIVITY_EVOAB_LCOLUMNALIAS_HXX_
+#define _CONNECTIVITY_EVOAB_LCOLUMNALIAS_HXX_
+
+#include <unotools/confignode.hxx>
+
+#include <osl/mutex.hxx>
+#include <vector>
+#include <map>
+
+namespace connectivity
+{
+ namespace evoab
+ {
+ typedef enum {
+ FIRSTNAME = 0,
+ LASTNAME,
+ DISPLAYNAME,
+ NICKNAME,
+ PRIMARYEMAIL,
+ SECONDEMAIL,
+ PREFERMAILFORMAT,
+ WORKPHONE,
+ HOMEPHONE,
+ FAXNUMBER,
+ PAGERNUMBER,
+ CELLULARNUMBER,
+ HOMEADDRESS,
+ HOMEADDRESS2,
+ HOMECITY,
+ HOMESTATE,
+ HOMEZIPCODE,
+ HOMECOUNTRY,
+ WORKADDRESS,
+ WORKADDRESS2,
+ WORKCITY,
+ WORKSTATE,
+ WORKZIPCODE,
+ WORKCOUNTRY,
+ JOBTITLE,
+ DEPARTMENT,
+ COMPANY,
+ WEBPAGE1,
+ WEBPAGE2,
+ BIRTHYEAR,
+ BIRTHMONTH,
+ BIRTHDAY,
+ NOTES,
+ END
+ } ProgrammaticName;
+
+ class OColumnAlias
+ {
+ /**
+ * m_Alias holds aliases for the evolution addressbook
+ * column names. This member gets initialised during
+ * creation of the connection to the driver.
+ * m_aAlias initialises m_aAliasMap which then can be
+ * used to find the corresponding programmatic name
+ * when an alias is used as a query attribute. Mozilla
+ * expects programmatic names from its clients.
+ *
+ * m_aAlias: vector of aliases used to initialise m_aAliasMap.
+ * m_AliasMap: map of {alias, programmaticname} pairs.
+ *
+ */
+ private:
+ ::std::vector< ::rtl::OUString> m_aAlias;
+ ::std::vector< ::rtl::OUString> m_aHeadLineNames;
+ ::std::map< ::rtl::OUString, ::rtl::OUString> m_aAliasMap;
+ protected:
+ ::osl::Mutex m_aMutex;
+ public:
+ void initialise(void);
+ const ::std::vector< ::rtl::OUString> & getAlias(void) const;
+ const ::std::map< ::rtl::OUString, ::rtl::OUString> & getAliasMap(void) const;
+ void setAlias(const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > &);
+ private:
+ void setAliasMap(void);
+ public:
+ OColumnAlias(void);
+ ~OColumnAlias(void);
+ };
+ }
+}
+#endif // _CONNECTIVITY_EVOAB_LCOLUMNALIAS_HXX_
diff --git a/connectivity/source/drivers/evoab/LColumns.cxx b/connectivity/source/drivers/evoab/LColumns.cxx
new file mode 100644
index 000000000000..9608c8efd384
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LColumns.cxx
@@ -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: LColumns.cxx,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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_connectivity.hxx"
+
+#include "LColumns.hxx"
+#include "LTable.hxx"
+#include "connectivity/sdbcx/VColumn.hxx"
+
+using namespace connectivity::evoab;
+using namespace connectivity;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::container;
+
+
+sdbcx::ObjectType OEvoabColumns::createObject(const ::rtl::OUString& _rName)
+{
+
+ OEvoabTable* pTable = (OEvoabTable*)m_pTable;
+ ::vos::ORef<OSQLColumns> aCols = pTable->getTableColumns();
+ OSQLColumns::Vector::const_iterator aIter = find(aCols->get().begin(),aCols->get().end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive()));
+ sdbcx::ObjectType xRet;
+ if(aIter != aCols->get().end())
+ xRet = sdbcx::ObjectType(*aIter,UNO_QUERY);
+ return xRet;
+}
+// -------------------------------------------------------------------------
+
+
diff --git a/svx/inc/svdtouch.hxx b/connectivity/source/drivers/evoab/LColumns.hxx
index 4723eff487f0..457f319ca7b1 100644
--- a/svx/inc/svdtouch.hxx
+++ b/connectivity/source/drivers/evoab/LColumns.hxx
@@ -6,8 +6,8 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: svdtouch.hxx,v $
- * $Revision: 1.6 $
+ * $RCSfile: LColumns.hxx,v $
+ * $Revision: 1.5 $
*
* This file is part of OpenOffice.org.
*
@@ -28,26 +28,28 @@
*
************************************************************************/
-#ifndef _SVDTOUCH_HXX
-#define _SVDTOUCH_HXX
-
-#include <tools/solar.h>
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-class Point;
-class Polygon;
-class PolyPolygon;
-class Rectangle;
-
-bool IsPointInsidePoly(const Polygon& rPoly, const Point& rHit);
-bool IsPointInsidePoly(const PolyPolygon& rPoly, const Point& rHit);
-
-bool IsRectTouchesLine(const Point& rPt1, const Point& rPt2, const Rectangle& rHit);
-bool IsRectTouchesLine(const Polygon& rLine, const Rectangle& rHit);
-bool IsRectTouchesLine(const PolyPolygon& rLine, const Rectangle& rHit);
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#endif //_SVDTOUCH_HXX
+#ifndef _CONNECTIVITY_EVOAB_LCOLUMNS_HXX_
+#define _CONNECTIVITY_EVOAB_LCOLUMNS_HXX_
+
+#include "file/FColumns.hxx"
+
+namespace connectivity
+{
+ namespace evoab
+ {
+ class OEvoabColumns : public file::OColumns
+ {
+ protected:
+ virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
+ public:
+ OEvoabColumns(file::OFileTable* _pTable,
+ ::osl::Mutex& _rMutex,
+ const TStringVector &_rVector
+ ) : file::OColumns(_pTable,_rMutex,_rVector)
+ {}
+
+ };
+ }
+}
+#endif // _CONNECTIVITY_EVOAB_LCOLUMNS_HXX_
diff --git a/connectivity/source/drivers/evoab/LConfigAccess.cxx b/connectivity/source/drivers/evoab/LConfigAccess.cxx
new file mode 100644
index 000000000000..9df502d35d70
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LConfigAccess.cxx
@@ -0,0 +1,164 @@
+/*************************************************************************
+ *
+ * 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: LConfigAccess.cxx,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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_connectivity.hxx"
+#include "LConfigAccess.hxx"
+#include "LDriver.hxx"
+#ifndef CONNECTIVITY_EVOAB_DEBUG_HELPER_HXX
+#include "LDebug.hxx"
+#endif
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+
+//.........................................................................
+namespace connectivity
+{
+ namespace evoab
+ {
+ //-----------------------------------------------------------------
+ Reference< XPropertySet > createDriverConfigNode( Reference< XMultiServiceFactory > _rxORB, ::rtl::OUString _sDriverImplementationName )
+ {
+ OSL_TRACE("createDriverConfigNode()entered");
+
+ Reference< XPropertySet > xNode;
+ try
+ {
+ //=============================================================
+ // create the config provider
+ Reference< XMultiServiceFactory > xConfigProvider(
+ _rxORB->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" ) ),
+ UNO_QUERY
+ );
+ OSL_ENSURE( xConfigProvider.is(), "createDriverConfigNode: could not create the config provider!" );
+
+ if ( xConfigProvider.is() )
+ {
+ ::rtl::OUString sCompleteNodePath = ::rtl::OUString::createFromAscii ("/org.openoffice.Office.DataAccess/DriverSettings/" );
+ sCompleteNodePath += _sDriverImplementationName;
+ //sCompleteNodePath += OEvoabConnection::getDriverImplementationName();
+ //sCompleteNodePath += ::rtl::OUString::createFromAscii ("com.sun.star.comp.sdbc.MozabDriver");
+ EVO_TRACE_STRING("createDriverConfigNode()::sCompleteNodePath = %s\n", sCompleteNodePath );
+
+ //=========================================================
+ // arguments for creating the config access
+ Sequence< Any > aArguments(2);
+ // the path to the node to open
+ aArguments[0] <<= PropertyValue(
+ ::rtl::OUString::createFromAscii( "nodepath"),
+ 0,
+ makeAny( sCompleteNodePath ),
+ PropertyState_DIRECT_VALUE
+ );
+ // the depth: -1 means unlimited
+ aArguments[1] <<= PropertyValue(
+ ::rtl::OUString::createFromAscii( "depth"),
+ 0,
+ makeAny( (sal_Int32)-1 ),
+ PropertyState_DIRECT_VALUE
+ );
+
+ //=========================================================
+ // create the access
+ Reference< XInterface > xAccess = xConfigProvider->createInstanceWithArguments(
+ ::rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationAccess" ),
+ aArguments
+ );
+ OSL_ENSURE( xAccess.is(), "createDriverConfigNode: invalid access returned (should throw an exception instead)!" );
+
+ xNode = xNode.query( xAccess );
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "createDriverConfigNode: caught an exception while accessing the driver's config node!" );
+ }
+
+ // outta here
+ return xNode;
+ }
+
+ //-----------------------------------------------------------------
+ namespace
+ {
+ // a private helper to accessing the point where we store the reference
+ // to the factory
+ Reference< XMultiServiceFactory >& accessFactoryStorage( )
+ {
+ static Reference< XMultiServiceFactory > xEvoabServiceFactory;
+ return xEvoabServiceFactory;
+ }
+ }
+
+ //-----------------------------------------------------------------
+ void setEvoabServiceFactory( const Reference< XMultiServiceFactory >& _rxFactory )
+ {
+ accessFactoryStorage( ) = _rxFactory;
+ }
+
+ //-----------------------------------------------------------------
+ const Reference< XMultiServiceFactory >& getEvoabServiceFactory( )
+ {
+ return accessFactoryStorage( );
+ }
+
+ //-----------------------------------------------------------------
+ ::rtl::OUString getFullPathExportingCommand( Reference< XMultiServiceFactory > _rxORB )
+ {
+ ::rtl::OUString sFullPathExportingCommand;
+
+ //Reference< XMultiServiceFactory > xFactory = getEvoabServiceFactory();
+ //OSL_ENSURE( xFactory.is(), "getPreferredProfileName: invalid service factory!" );
+ OSL_ENSURE( _rxORB.is(), "getFullPathExportingCommand: invalid service factory!" );
+ if ( _rxORB.is() )
+ {
+ try
+ {
+ Reference< XPropertySet > xDriverNode = createDriverConfigNode( _rxORB, OEvoabDriver::getImplementationName_Static() );
+ Reference< XPropertySet > xEvoPrefsNode;
+ if ( xDriverNode.is() )
+ xDriverNode->getPropertyValue( ::rtl::OUString::createFromAscii( "EvolutionPreferences" ) ) >>= xEvoPrefsNode;
+ OSL_ENSURE( xEvoPrefsNode.is(), "getFullPathExportingCommand: could not access the node for the evolution preferences!" );
+ if ( xEvoPrefsNode.is() )
+ xEvoPrefsNode->getPropertyValue( ::rtl::OUString::createFromAscii( "FullPathExportingCommand" ) ) >>= sFullPathExportingCommand;
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "getFullPathExportingCommand: caught an exception!" );
+ }
+ }
+ return sFullPathExportingCommand;
+ }
+ }
+}
+
+//.........................................................................
diff --git a/connectivity/source/drivers/evoab/LConfigAccess.hxx b/connectivity/source/drivers/evoab/LConfigAccess.hxx
new file mode 100644
index 000000000000..9df43ef3226b
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LConfigAccess.hxx
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * 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: LConfigAccess.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * 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 _CONNECTIVITY_EVOAB_LCONFIGACCESS_HXX_
+#define _CONNECTIVITY_EVOAB_LCONFIGACCESS_HXX_
+
+// This is the extended version (for use on the SO side of the driver) of MConfigAccess
+// (which is for use on the mozilla side only)
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+namespace connectivity
+{
+ namespace evoab
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ createDriverConfigNode( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > _rxORB, ::rtl::OUString _sDriverImplementationName );
+ ::rtl::OUString getFullPathExportingCommand( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > _rxORB );
+ }
+}
+#endif // _CONNECTIVITY_EVOAB_LCONFIGACCESS_HXX_
diff --git a/connectivity/source/drivers/evoab/LConnection.cxx b/connectivity/source/drivers/evoab/LConnection.cxx
new file mode 100644
index 000000000000..383354d8ff5f
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LConnection.cxx
@@ -0,0 +1,270 @@
+/*************************************************************************
+ *
+ * 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: LConnection.cxx,v $
+ * $Revision: 1.12.56.1 $
+ *
+ * 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_connectivity.hxx"
+#include "LConnection.hxx"
+#include "LDatabaseMetaData.hxx"
+#include "LCatalog.hxx"
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <tools/urlobj.hxx>
+#include "LPreparedStatement.hxx"
+#include "LStatement.hxx"
+#include <comphelper/extract.hxx>
+#include <connectivity/dbcharset.hxx>
+#include <connectivity/dbexception.hxx>
+#include <comphelper/processfactory.hxx>
+#include <vos/process.hxx>
+#include <tools/debug.hxx>
+#include "LDebug.hxx"
+#include "diagnose_ex.h"
+#include <comphelper/sequence.hxx>
+#include <connectivity/dbexception.hxx>
+#include "resource/common_res.hrc"
+
+using namespace connectivity::evoab;
+using namespace connectivity::file;
+using namespace vos;
+
+typedef connectivity::file::OConnection OConnection_B;
+
+//------------------------------------------------------------------------------
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::lang;
+
+::rtl::OUString implGetExceptionMsg( Exception& e, const ::rtl::OUString& aExceptionType_ )
+{
+ ::rtl::OUString aExceptionType = aExceptionType_;
+ if( aExceptionType.getLength() == 0 )
+ aExceptionType = ::rtl::OUString( ::rtl::OUString::createFromAscii("Unknown" ) );
+
+ ::rtl::OUString aTypeLine( ::rtl::OUString::createFromAscii("\nType: " ) );
+ aTypeLine += aExceptionType;
+
+ ::rtl::OUString aMessageLine( ::rtl::OUString::createFromAscii("\nMessage: " ) );
+ aMessageLine += ::rtl::OUString( e.Message );
+
+ ::rtl::OUString aMsg(aTypeLine);
+ aMsg += aMessageLine;
+ return aMsg;
+}
+
+ // Exception type unknown
+::rtl::OUString implGetExceptionMsg( Exception& e )
+{
+ ::rtl::OUString aMsg = implGetExceptionMsg( e, ::rtl::OUString() );
+ return aMsg;
+}
+
+// --------------------------------------------------------------------------------
+OEvoabConnection::OEvoabConnection(OEvoabDriver* _pDriver) : OConnection(_pDriver)
+ ,m_bHeaderLine(sal_True)
+ ,m_cFieldDelimiter(',')
+ ,m_cStringDelimiter('"')
+ ,m_cDecimalDelimiter('.')
+ ,m_cThousandDelimiter(' ')
+{
+ // Initialise m_aColumnAlias.
+ m_aColumnAlias.setAlias(_pDriver->getFactory());
+}
+//-----------------------------------------------------------------------------
+OEvoabConnection::~OEvoabConnection()
+{
+}
+
+// XServiceInfo
+// --------------------------------------------------------------------------------
+IMPLEMENT_SERVICE_INFO(OEvoabConnection, "com.sun.star.sdbc.drivers.evoab.Connection", "com.sun.star.sdbc.Connection")
+
+//-----------------------------------------------------------------------------
+void OEvoabConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyValue >& info) throw(SQLException)
+{
+ osl_incrementInterlockedCount( &m_refCount );
+ EVO_TRACE_STRING("OEvoabConnection::construct()::url = %s\n", url );
+
+
+ ::rtl::OUString aCLICommand = getDriver()->getEvoab_CLI_EffectiveCommand();
+ ::rtl::OUString aWorkingDirPath = getDriver()->getWorkingDirPath();
+ ::rtl::OUString aArg1 = ::rtl::OUString::createFromAscii(OEvoabDriver::getEVOAB_CLI_ARG_LIST_FOLDERS());
+ ::rtl::OUString aArg2 = ::rtl::OUString::createFromAscii(OEvoabDriver::getEVOAB_CLI_ARG_OUTPUT_FILE_PREFIX());
+ aArg2 += aWorkingDirPath;
+ aArg2 += getDriver()->getEvoFolderListFileName();
+ OArgumentList aArgs(2,&aArg1,&aArg2);
+
+ EVO_TRACE_STRING("OEvoabConnection::construct()::aCLICommand = %s\n", aCLICommand );
+ EVO_TRACE_STRING("OEvoabConnection::construct()::aWorkingDirPath = %s\n", aWorkingDirPath );
+ EVO_TRACE_STRING("OEvoabConnection::construct()::aArg1 = %s\n", aArg1 );
+ EVO_TRACE_STRING("OEvoabConnection::construct()::aArg2 = %s\n", aArg2 );
+ OProcess aApp( aCLICommand,aWorkingDirPath);
+ OSL_VERIFY_EQUALS(
+ aApp.execute( (OProcess::TProcessOption)(OProcess::TOption_Hidden | OProcess::TOption_Wait | OProcess::TOption_SearchPath),aArgs),
+ OProcess::E_None,
+ "Error at execute evolution-addressbook-export to get VCards");
+
+
+ Sequence<PropertyValue> aDriverParam;
+ ::std::vector<PropertyValue> aParam;
+
+ aParam.push_back(PropertyValue(::rtl::OUString::createFromAscii("EnableSQL92Check"), 0, Any(), PropertyState_DIRECT_VALUE));
+ ::dbtools::OCharsetMap aLookupIanaName;
+ ::dbtools::OCharsetMap::const_iterator aLookup = aLookupIanaName.find(RTL_TEXTENCODING_UTF8);
+ aParam.push_back(PropertyValue(::rtl::OUString::createFromAscii("CharSet"), 0,
+ makeAny((*aLookup).getIanaName()), PropertyState_DIRECT_VALUE));
+ aParam.push_back(PropertyValue(::rtl::OUString::createFromAscii("Extension"), 0, makeAny(getDriver()->getFileExt()), PropertyState_DIRECT_VALUE));
+ aParam.push_back(PropertyValue(::rtl::OUString::createFromAscii("HeaderLine"), 0, makeAny(m_bHeaderLine), PropertyState_DIRECT_VALUE));
+ aParam.push_back(PropertyValue(::rtl::OUString::createFromAscii("FieldDelimiter"), 0, makeAny(::rtl::OUString(&m_cFieldDelimiter,1)), PropertyState_DIRECT_VALUE));
+ aParam.push_back(PropertyValue(::rtl::OUString::createFromAscii("StringDelimiter"), 0, makeAny(::rtl::OUString(&m_cStringDelimiter,1)), PropertyState_DIRECT_VALUE));
+ aParam.push_back(PropertyValue(::rtl::OUString::createFromAscii("DecimalDelimiter"), 0, makeAny(::rtl::OUString(&m_cDecimalDelimiter,1)), PropertyState_DIRECT_VALUE));
+ aParam.push_back(PropertyValue(::rtl::OUString::createFromAscii("ThousandDelimiter"), 0, makeAny(::rtl::OUString(&m_cThousandDelimiter,1)), PropertyState_DIRECT_VALUE));
+
+ // build a new parameter sequence from the original parameters, appended by the new parameters from above
+ PropertyValue *pParams = aParam.empty() ? 0 : &aParam[0];
+ aDriverParam = ::comphelper::concatSequences(
+ info,
+ Sequence< PropertyValue >( pParams, aParam.size() )
+ );
+
+ // transform "sdbc:address:evolution" part of URL to "sdbc:flat:file:///..."
+ //
+ sal_Int32 nLen = url.indexOf(':');
+ nLen = url.indexOf(':',nLen+1);
+ ::rtl::OUString aAddrbookURI(url.copy(nLen+1));
+ // Get Scheme
+ nLen = aAddrbookURI.indexOf(':');
+ ::rtl::OUString aAddrbookScheme;
+ if ( nLen == -1 )
+ {
+ // There isn't any subschema: - but could be just subschema
+ if ( aAddrbookURI.getLength() > 0 )
+ {
+ aAddrbookScheme= aAddrbookURI;
+ }
+ else
+ {
+ OSL_TRACE( "No subschema given!!!\n");
+ throwGenericSQLException(STR_URI_SYNTAX_ERROR ,*this);
+ }
+ }
+ else
+ {
+ aAddrbookScheme = aAddrbookURI.copy(0, nLen);
+ }
+
+ EVO_TRACE_STRING("OEvoabConnection::construct()::URI = %s\n", aAddrbookURI );
+ EVO_TRACE_STRING("OEvoabConnection::construct()::Scheme = %s\n", aAddrbookScheme );
+
+ //
+ // Now we have a URI convert it to a Evolution CLI flat file URI
+ //
+ // The Mapping being used is:
+ //
+ // * for Evolution
+ // "sdbc:address:evolution:" -> "sdbc:flat:file:///(file path generated)
+
+ rtl::OUString aEvoFlatURI;
+ if ( aAddrbookScheme.compareToAscii( OEvoabDriver::getSDBC_SCHEME_EVOLUTION() ) == 0 )
+ {
+ aEvoFlatURI = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "sdbc:flat:" ));
+ }
+
+
+ aEvoFlatURI += getDriver()->getWorkingDirURL();
+ EVO_TRACE_STRING("OEvoabConnection::construct()::m_aEvoFlatURI = %s\n", aEvoFlatURI );
+ //setURL(aEvoFlatURI);
+ m_aEvoFlatURI = aEvoFlatURI;
+
+ osl_decrementInterlockedCount( &m_refCount );
+ OConnection::construct(aEvoFlatURI,aDriverParam);
+}
+// --------------------------------------------------------------------------------
+Reference< XDatabaseMetaData > SAL_CALL OEvoabConnection::getMetaData( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OConnection_B::rBHelper.bDisposed);
+
+
+ Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
+ if(!xMetaData.is())
+ {
+ xMetaData = new OEvoabDatabaseMetaData(this);
+ m_xMetaData = xMetaData;
+ }
+
+ return xMetaData;
+}
+//------------------------------------------------------------------------------
+::com::sun::star::uno::Reference< XTablesSupplier > OEvoabConnection::createCatalog()
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ Reference< XTablesSupplier > xTab = m_xCatalog;
+ if(!xTab.is())
+ {
+ OEvoabCatalog *pCat = new OEvoabCatalog(this);
+ xTab = pCat;
+ m_xCatalog = xTab;
+ }
+ return xTab;
+}
+// --------------------------------------------------------------------------------
+Reference< XStatement > SAL_CALL OEvoabConnection::createStatement( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OConnection_B::rBHelper.bDisposed);
+
+ OEvoabStatement* pStmt = new OEvoabStatement(this);
+
+ Reference< XStatement > xStmt = pStmt;
+ m_aStatements.push_back(WeakReferenceHelper(*pStmt));
+ return xStmt;
+}
+// --------------------------------------------------------------------------------
+Reference< XPreparedStatement > SAL_CALL OEvoabConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OConnection_B::rBHelper.bDisposed);
+
+
+ OEvoabPreparedStatement* pStmt = new OEvoabPreparedStatement(this);
+ Reference< XPreparedStatement > xStmt = pStmt;
+ pStmt->construct(sql);
+
+ m_aStatements.push_back(WeakReferenceHelper(*pStmt));
+ return xStmt;
+}
+// --------------------------------------------------------------------------------
+Reference< XPreparedStatement > SAL_CALL OEvoabConnection::prepareCall( const ::rtl::OUString& /*sql*/ ) throw(SQLException, RuntimeException)
+{
+ ::dbtools::throwFeatureNotImplementedException( "XConnection::prepareCall", *this );
+ return NULL;
+}
+// -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/evoab/LConnection.hxx b/connectivity/source/drivers/evoab/LConnection.hxx
new file mode 100644
index 000000000000..e0cd79eb8f78
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LConnection.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * 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: LConnection.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * 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 _CONNECTIVITY_EVOAB_LCONNECTION_HXX_
+#define _CONNECTIVITY_EVOAB_LCONNECTION_HXX_
+
+#include "LDriver.hxx"
+#include "file/FConnection.hxx"
+#include "LColumnAlias.hxx"
+
+namespace connectivity
+{
+ namespace evoab
+ {
+ class OEvoabConnection : public file::OConnection
+ {
+ private:
+ OColumnAlias m_aColumnAlias;
+ sal_Bool m_bHeaderLine; // column names in first row
+ sal_Unicode m_cFieldDelimiter; // look at the name
+ sal_Unicode m_cStringDelimiter; // delimiter for strings m_cStringDelimiter blabla m_cStringDelimiter
+ sal_Unicode m_cDecimalDelimiter; // Dezimal-delimiter (Dezimalpoint)
+ sal_Unicode m_cThousandDelimiter; //
+ rtl::OUString m_aEvoFlatURI;
+
+ public:
+ OEvoabConnection(OEvoabDriver* _pDriver);
+ virtual ~OEvoabConnection();
+
+ virtual void construct(const ::rtl::OUString& _rUrl,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rInfo ) throw( ::com::sun::star::sdbc::SQLException);
+
+ // own methods
+ inline const OEvoabDriver* getDriver() const { return static_cast< const OEvoabDriver* >( m_pDriver ); }
+ inline sal_Bool isHeaderLine() const { return m_bHeaderLine; }
+ inline sal_Unicode getFieldDelimiter() const { return m_cFieldDelimiter; }
+ inline sal_Unicode getStringDelimiter() const { return m_cStringDelimiter; }
+ inline sal_Unicode getDecimalDelimiter() const { return m_cDecimalDelimiter; }
+ inline sal_Unicode getThousandDelimiter() const { return m_cThousandDelimiter;}
+ const OColumnAlias& getColumnAlias() const { return m_aColumnAlias; }
+
+ // XServiceInfo
+ DECLARE_SERVICE_INFO();
+
+ // XConnection
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > createCatalog();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+
+ };
+ }
+}
+#endif // _CONNECTIVITY_EVOAB_LCONNECTION_HXX_
diff --git a/connectivity/source/drivers/evoab/LDatabaseMetaData.cxx b/connectivity/source/drivers/evoab/LDatabaseMetaData.cxx
new file mode 100644
index 000000000000..5a0f80781d2a
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LDatabaseMetaData.cxx
@@ -0,0 +1,394 @@
+/*************************************************************************
+ *
+ * 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: LDatabaseMetaData.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_connectivity.hxx"
+#include "LDatabaseMetaData.hxx"
+#include "LConnection.hxx"
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/ResultSetType.hpp>
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#include <com/sun/star/beans/XFastPropertySet.hpp>
+#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
+#include <com/sun/star/ucb/XContentAccess.hpp>
+#ifndef _COM_SUN_STAR_SQLC_XROW_HPP_
+#include <com/sun/star/sdbc/XRow.hpp>
+#endif
+#include <tools/urlobj.hxx>
+#include "FDatabaseMetaDataResultSet.hxx"
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <comphelper/extract.hxx>
+#include <comphelper/types.hxx>
+#include "LFolderList.hxx"
+#include "connectivity/CommonTools.hxx"
+#include <vos/process.hxx>
+#include <osl/process.h>
+#include <tools/debug.hxx>
+#include <map>
+#include <vector>
+
+#ifndef CONNECTIVITY_EVOAB_DEBUG_HELPER_HXX
+#include "LDebug.hxx"
+#endif
+#include "diagnose_ex.h"
+
+using namespace ::comphelper;
+using namespace connectivity;
+using namespace connectivity::evoab;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::ucb;
+using namespace osl;
+using namespace vos;
+
+namespace connectivity
+{
+ namespace evoab
+ {
+ static sal_Int32 const s_nCOLUMN_SIZE = 256;
+ static sal_Int32 const s_nDECIMAL_DIGITS = 0;
+ static sal_Int32 const s_nNULLABLE = 1;
+ static sal_Int32 const s_nCHAR_OCTET_LENGTH = 65535;
+ }
+}
+
+OEvoabDatabaseMetaData::OEvoabDatabaseMetaData(::connectivity::file::OConnection* _pCon) :ODatabaseMetaData(_pCon)
+{
+}
+// -------------------------------------------------------------------------
+OEvoabDatabaseMetaData::~OEvoabDatabaseMetaData()
+{
+}
+// -------------------------------------------------------------------------
+Reference< XResultSet > OEvoabDatabaseMetaData::impl_getTypeInfo_throw( )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
+ Reference< XResultSet > xRef = pResult;
+ static ODatabaseMetaDataResultSet::ORows aRows;
+ if(aRows.empty())
+ {
+ ODatabaseMetaDataResultSet::ORow aRow;
+
+ aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
+ aRow.push_back(new ORowSetValueDecorator(::rtl::OUString::createFromAscii("CHAR")));
+ aRow.push_back(new ORowSetValueDecorator(DataType::CHAR));
+ aRow.push_back(new ORowSetValueDecorator((sal_Int32)254));
+ aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
+ aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
+ aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
+ aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnValue::NULLABLE));
+ aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
+ aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnSearch::CHAR));
+ aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
+ aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
+ aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
+ aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
+ aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
+ aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
+ aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
+ aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
+ aRow.push_back(new ORowSetValueDecorator((sal_Int32)10));
+
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("VARCHAR"));
+ aRow[2] = new ORowSetValueDecorator(DataType::VARCHAR);
+ aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
+ aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
+ aRows.push_back(aRow);
+
+
+ aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("LONGVARCHAR"));
+ aRow[2] = new ORowSetValueDecorator(DataType::LONGVARCHAR);
+ aRow[3] = new ORowSetValueDecorator((sal_Int32)65535);
+ aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
+ aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DATE"));
+ aRow[2] = new ORowSetValueDecorator(DataType::DATE);
+ aRow[3] = new ORowSetValueDecorator((sal_Int32)10);
+ aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
+ aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIME"));
+ aRow[2] = new ORowSetValueDecorator(DataType::TIME);
+ aRow[3] = new ORowSetValueDecorator((sal_Int32)8);
+ aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
+ aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIMESTAMP"));
+ aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP);
+ aRow[3] = new ORowSetValueDecorator((sal_Int32)19);
+ aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
+ aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("BOOL"));
+ aRow[2] = new ORowSetValueDecorator(DataType::BIT);
+ aRow[3] = ODatabaseMetaDataResultSet::get1Value();
+ aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DECIMAL"));
+ aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL);
+ aRow[3] = new ORowSetValueDecorator((sal_Int32)20);
+ aRow[15] = new ORowSetValueDecorator((sal_Int32)15);
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DOUBLE"));
+ aRow[2] = new ORowSetValueDecorator(DataType::DOUBLE);
+ aRow[3] = new ORowSetValueDecorator((sal_Int32)20);
+ aRow[15] = ODatabaseMetaDataResultSet::get0Value();
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("NUMERIC"));
+ aRow[2] = new ORowSetValueDecorator(DataType::NUMERIC);
+ aRow[3] = new ORowSetValueDecorator((sal_Int32)20);
+ aRow[15] = new ORowSetValueDecorator((sal_Int32)20);
+ aRows.push_back(aRow);
+ }
+
+ pResult->setRows(aRows);
+ return xRef;
+}
+// -------------------------------------------------------------------------
+Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getColumns(
+ const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& tableNamePattern,
+ const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OEvoabDatabaseMetaData::getColumns()::Entered\n");
+ EVO_TRACE_STRING("OEvoabDatabaseMetaData::getColumns()::schemaPattern = %s\n", schemaPattern );
+ EVO_TRACE_STRING("OEvoabDatabaseMetaData::getColumns()::tableNamePattern = %s\n", tableNamePattern );
+ EVO_TRACE_STRING("OEvoabDatabaseMetaData::getColumns()::columnNamePattern = %s\n", columnNamePattern );
+
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ Reference< XTablesSupplier > xTables = m_pConnection->createCatalog();
+ if(!xTables.is())
+ throw SQLException();
+
+ Reference< XNameAccess> xNames = xTables->getTables();
+ if(!xNames.is())
+ throw SQLException();
+
+ ODatabaseMetaDataResultSet::ORows aRows;
+ ODatabaseMetaDataResultSet::ORow aRow(19);
+ aRow[10] = new ORowSetValueDecorator((sal_Int32)10);
+ Sequence< ::rtl::OUString> aTabNames(xNames->getElementNames());
+ const ::rtl::OUString* pTabBegin = aTabNames.getConstArray();
+ const ::rtl::OUString* pTabEnd = pTabBegin + aTabNames.getLength();
+ for(;pTabBegin != pTabEnd;++pTabBegin)
+ {
+ if(match(tableNamePattern,*pTabBegin,'\0'))
+ {
+ Reference< XColumnsSupplier> xTable;
+ ::cppu::extractInterface(xTable,xNames->getByName(*pTabBegin));
+ aRow[3] = new ORowSetValueDecorator(*pTabBegin);
+
+ Reference< XNameAccess> xColumns = xTable->getColumns();
+ if(!xColumns.is())
+ throw SQLException();
+
+ Sequence< ::rtl::OUString> aColNames(xColumns->getElementNames());
+
+ const ::rtl::OUString* pBegin = aColNames.getConstArray();
+ const ::rtl::OUString* pEnd = pBegin + aColNames.getLength();
+ Reference< XPropertySet> xColumn;
+ for(sal_Int32 i=1;pBegin != pEnd;++pBegin,++i)
+ {
+ if(match(columnNamePattern,*pBegin,'\0'))
+ {
+ aRow[4] = new ORowSetValueDecorator(*pBegin);
+
+ ::cppu::extractInterface(xColumn,xColumns->getByName(*pBegin));
+ OSL_ENSURE(xColumn.is(),"Columns contains a column who isn't a fastpropertyset!");
+ aRow[5] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))));
+ aRow[6] = new ORowSetValueDecorator(getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))));
+ aRow[7] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))));
+ aRow[9] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))));
+ aRow[11] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))));
+ aRow[13] = new ORowSetValueDecorator(getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))));
+
+ switch((sal_Int32)aRow[5]->getValue())
+ {
+ case DataType::CHAR:
+ case DataType::VARCHAR:
+ aRow[16] = new ORowSetValueDecorator((sal_Int32)254);
+ break;
+ case DataType::LONGVARCHAR:
+ aRow[16] = new ORowSetValueDecorator((sal_Int32)65535);
+ break;
+ default:
+ aRow[16] = new ORowSetValueDecorator((sal_Int32)0);
+ }
+ aRow[17] = new ORowSetValueDecorator(i);
+ switch(sal_Int32(aRow[11]->getValue()))
+ {
+ case ColumnValue::NO_NULLS:
+ aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("NO"));
+ break;
+ case ColumnValue::NULLABLE:
+ aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("YES"));
+ break;
+ default:
+ aRow[18] = new ORowSetValueDecorator(::rtl::OUString());
+ }
+ aRows.push_back(aRow);
+ }
+ }
+ }
+ }
+
+ ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
+ Reference< XResultSet > xRef = pResult;
+ pResult->setRows(aRows);
+
+ return xRef;
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:flat:")) + m_pConnection->getURL();
+}
+// -------------------------------------------------------------------------
+Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables(
+ const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/,
+ const ::rtl::OUString& /*tableNamePattern*/, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+
+ ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTables);
+ Reference< XResultSet > xRef = pResult;
+
+ // check if any type is given
+ // when no types are given then we have to return all tables e.g. TABLE
+
+ static const ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE"));
+
+ sal_Bool bTableFound = sal_True;
+ sal_Int32 nLength = types.getLength();
+ if(nLength)
+ {
+ bTableFound = sal_False;
+
+ const ::rtl::OUString* pBegin = types.getConstArray();
+ const ::rtl::OUString* pEnd = pBegin + nLength;
+ for(;pBegin != pEnd;++pBegin)
+ {
+ if(*pBegin == aTable)
+ {
+ bTableFound = sal_True;
+ break;
+ }
+ }
+ }
+ if(!bTableFound)
+ return xRef;
+
+ OEvoabConnection* pOEvoabConnection = (OEvoabConnection*)m_pConnection;
+ OEvoabFolderList* pFolderList = new OEvoabFolderList( pOEvoabConnection );
+
+
+ ODatabaseMetaDataResultSet::ORows aRows;
+ sal_Bool bMoreData = sal_True;
+ ::rtl::OUString aName, aLocation;
+ sal_Int32 nCardsCount;
+
+ pFolderList->initializeRow(3);
+ bMoreData = pFolderList->first();
+ OSL_TRACE("OEvoabDatabaseMetaData::getTables()::first %d\n",bMoreData );
+ do
+ {
+ if(bMoreData)
+ bMoreData = pFolderList->getRow();
+ if(bMoreData)
+ {
+ aLocation = pFolderList->getString(1);
+ aName = pFolderList->getString(2);
+ nCardsCount = pFolderList->getInt(3);
+ EVO_TRACE_STRING( "OEvoabDatabaseMetaData::getTables()::aLocation = %s\n", aLocation );
+ EVO_TRACE_STRING( "OEvoabDatabaseMetaData::getTables()::aName = %s\n", aName );
+ OSL_TRACE("OEvoabDatabaseMetaData::getTables()::nCardsCount = %d\n", nCardsCount);
+
+ ODatabaseMetaDataResultSet::ORow aRow(3);
+ aRow.reserve(6);
+ aRow.push_back(new ORowSetValueDecorator(aName));
+ aRow.push_back(new ORowSetValueDecorator(aTable));
+ aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
+ aRows.push_back(aRow);
+
+ ::rtl::OUString aWorkingDir = pOEvoabConnection->getDriver()->getWorkingDirPath();
+ ::rtl::OUString aCLICommand = pOEvoabConnection->getDriver()->getEvoab_CLI_EffectiveCommand();
+ ::rtl::OUString aArg1 = aLocation;
+ ::rtl::OUString aArg2 = ::rtl::OUString::createFromAscii(pOEvoabConnection->getDriver()->getEVOAB_CLI_ARG_OUTPUT_FILE_PREFIX());
+ aArg2 += aWorkingDir;
+ aArg2 += aName;
+ aArg2 += ::rtl::OUString::createFromAscii(".");
+ aArg2 += ::rtl::OUString(pOEvoabConnection->getExtension());
+ ::rtl::OUString aArg3 = ::rtl::OUString::createFromAscii(pOEvoabConnection->getDriver()->getEVOAB_CLI_ARG_OUTPUT_FORMAT());
+
+ OArgumentList aArgs(3,&aArg1,&aArg2,&aArg3);
+
+ EVO_TRACE_STRING( "OEvoabDatabaseMetaData::getTables()::aCLICommand = %s\n", aCLICommand );
+ EVO_TRACE_STRING( "OEvoabDatabaseMetaData::getTables()::aWorkingDir = %s\n", aWorkingDir );
+ EVO_TRACE_STRING( "OEvoabDatabaseMetaData::getTables()::aArg1 = %s\n", aArg1 );
+ EVO_TRACE_STRING( "OEvoabDatabaseMetaData::getTables()::aArg2 = %s\n", aArg2 );
+ EVO_TRACE_STRING( "OEvoabDatabaseMetaData::getTables()::aArg3 = %s\n", aArg3 );
+
+ OProcess aApp( aCLICommand,aWorkingDir);
+ OSL_VERIFY_EQUALS(
+ aApp.execute( (OProcess::TProcessOption)(OProcess::TOption_Hidden | OProcess::TOption_Wait | OProcess::TOption_SearchPath),aArgs),
+ OProcess::E_None,
+ "Error at execute evolution-addressbook-exporter to get VCards" );
+
+ bMoreData = pFolderList->next();
+ }
+ }
+ while ( bMoreData );
+
+ delete pFolderList;
+ pFolderList = NULL;
+
+ pResult->setRows(aRows);
+
+ return xRef;
+}
diff --git a/connectivity/source/drivers/evoab/LDatabaseMetaData.hxx b/connectivity/source/drivers/evoab/LDatabaseMetaData.hxx
new file mode 100644
index 000000000000..bad565d68e54
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LDatabaseMetaData.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * 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: LDatabaseMetaData.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * 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 _CONNECTIVITY_EVOAB_LDATABASEMETADATA_HXX_
+#define _CONNECTIVITY_EVOAB_LDATABASEMETADATA_HXX_
+
+#include "file/FDatabaseMetaData.hxx"
+#include "FDatabaseMetaDataResultSet.hxx"
+
+namespace connectivity
+{
+ namespace evoab
+ {
+ //**************************************************************
+ //************ Class: java.sql.DatabaseMetaDataDate
+ //**************************************************************
+
+ class OEvoabDatabaseMetaData : public file::ODatabaseMetaData
+ {
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > impl_getTypeInfo_throw();
+ virtual ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTables( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ protected:
+ virtual ~OEvoabDatabaseMetaData();
+ public:
+ OEvoabDatabaseMetaData(file::OConnection* _pCon);
+ };
+ }
+}
+#endif // _CONNECTIVITY_EVOAB_LDATABASEMETADATA_HXX_
+
diff --git a/connectivity/source/drivers/evoab/LDebug.cxx b/connectivity/source/drivers/evoab/LDebug.cxx
new file mode 100644
index 000000000000..64b39f7cea03
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LDebug.cxx
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * 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: LDebug.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * 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_connectivity.hxx"
+
+#ifndef CONNECTIVITY_EVOAB_DEBUG_HELPER_HXX
+#include "LDebug.hxx"
+#endif
+#include <osl/diagnose.h>
+
+void evo_traceStringMessage( const sal_Char* _pFormat, const ::rtl::OUString& _rAsciiString )
+{
+ ::rtl::OString sByteStringMessage( _rAsciiString.getStr(), _rAsciiString.getLength(), RTL_TEXTENCODING_ASCII_US );
+ if ( !sByteStringMessage.getLength() )
+ sByteStringMessage = "<empty>";
+ OSL_TRACE( _pFormat, sByteStringMessage.getStr() );
+}
diff --git a/svx/inc/svx/sdr/overlay/overlaylinestriped.hxx b/connectivity/source/drivers/evoab/LDebug.hxx
index 7ec84401d2bd..dc8a64ef796c 100644
--- a/svx/inc/svx/sdr/overlay/overlaylinestriped.hxx
+++ b/connectivity/source/drivers/evoab/LDebug.hxx
@@ -6,8 +6,8 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: overlaylinestriped.hxx,v $
- * $Revision: 1.3 $
+ * $RCSfile: LDebug.hxx,v $
+ * $Revision: 1.5 $
*
* This file is part of OpenOffice.org.
*
@@ -28,22 +28,18 @@
*
************************************************************************/
-#ifndef _SDR_OVERLAY_OVERLAYLINESTRIPED_HXX
-#define _SDR_OVERLAY_OVERLAYLINESTRIPED_HXX
+#ifndef CONNECTIVITY_EVOAB_DEBUG_HELPER_HXX
+#define CONNECTIVITY_EVOAB_DEBUG_HELPER_HXX
-#include <svx/sdr/overlay/overlayline.hxx>
+#include <rtl/ustring.hxx>
-//////////////////////////////////////////////////////////////////////////////
+#ifdef _DEBUG
+ void evo_traceStringMessage( const sal_Char* _pFormat, const ::rtl::OUString& _rAsciiString );
-namespace sdr
-{
- namespace overlay
- {
- } // end of namespace overlay
-} // end of namespace sdr
+ #define EVO_TRACE_STRING( pFormat, rAsciiString ) evo_traceStringMessage( pFormat, rAsciiString )
+#else
+ #define EVO_TRACE_STRING( pFormat, rAsciiString ) (void)(0)
+#endif
-//////////////////////////////////////////////////////////////////////////////
-#endif //_SDR_OVERLAY_OVERLAYLINESTRIPED_HXX
-
-// eof
+#endif // CONNECTIVITY_EVOAB_DEBUG_HELPER_HXX
diff --git a/connectivity/source/drivers/evoab/LDriver.cxx b/connectivity/source/drivers/evoab/LDriver.cxx
new file mode 100644
index 000000000000..379dfba4b21e
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LDriver.cxx
@@ -0,0 +1,508 @@
+/*************************************************************************
+ *
+ * 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: LDriver.cxx,v $
+ * $Revision: 1.10.42.1 $
+ *
+ * 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_connectivity.hxx"
+#include "LDriver.hxx"
+#include "LConnection.hxx"
+#include <com/sun/star/lang/DisposedException.hpp>
+#include "connectivity/dbexception.hxx"
+#include "LConfigAccess.hxx"
+#include <osl/file.hxx>
+#include "osl/security.hxx"
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#include <ucbhelper/content.hxx>
+#include <tools/debug.hxx>
+#include "resource/common_res.hrc"
+#include "resource/sharedresources.hxx"
+#include "LDebug.hxx"
+
+using namespace osl;
+using namespace connectivity::evoab;
+using namespace connectivity::file;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::ucb;
+
+// --------------------------------------------------------------------------------
+OEvoabDriver::OEvoabDriver(const Reference< XMultiServiceFactory >& _rxFactory) : OFileDriver(_rxFactory)
+ ,m_aTempDir(NULL, sal_True)
+ ,m_aFolderListName(::rtl::OUString::createFromAscii(getEVOAB_FOLDERLIST_FILE_NAME()))
+ ,m_aVersionName(::rtl::OUString::createFromAscii(getEVOAB_VERSION_FILE_NAME()))
+ ,m_aFileExt(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(getEVOAB_META_FILE_EXT())))
+ ,m_bWorkingDirCreated(sal_False)
+ ,m_eSupportedEvoVersion( eUnknown )
+{
+ m_aEvoab_CLI_FullPathCommand = getFullPathExportingCommand(_rxFactory);
+
+ if ( m_aEvoab_CLI_FullPathCommand.getLength() == 0 )
+ m_aEvoab_CLI_FullPathCommand = ::rtl::OUString::createFromAscii(getEVOAB_CLI_FULLPATHCOMMAND());
+ if ( m_aEvoab_CLI_FullPathCommand.copy(0,7) != ::rtl::OUString::createFromAscii("file://") && m_aEvoab_CLI_FullPathCommand.copy(0,1) == ::rtl::OUString::createFromAscii("/"))
+ m_aEvoab_CLI_FullPathCommand = ::rtl::OUString::createFromAscii("file://") + m_aEvoab_CLI_FullPathCommand;
+ m_aEvoab_CLI_EffectiveCommand = m_aEvoab_CLI_FullPathCommand;
+ m_aTempDir.EnableKillingFile();
+
+ EVO_TRACE_STRING("OEvoabDriver::OEvoabDriver()::m_aEvoab_CLI_FullPathCommand = %s", m_aEvoab_CLI_FullPathCommand );
+}
+// static ServiceInfo
+//------------------------------------------------------------------------------
+rtl::OUString OEvoabDriver::getImplementationName_Static( ) throw(RuntimeException)
+{
+ return rtl::OUString::createFromAscii(EVOAB_DRIVER_IMPL_NAME);
+}
+
+//------------------------------------------------------------------
+::rtl::OUString SAL_CALL OEvoabDriver::getImplementationName( ) throw(RuntimeException)
+{
+ return getImplementationName_Static();
+}
+
+//------------------------------------------------------------------
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL connectivity::evoab::OEvoabDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception )
+{
+ return *(new OEvoabDriver(_rxFactory));
+}
+// --------------------------------------------------------------------------------
+Reference< XConnection > SAL_CALL OEvoabDriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (ODriver_BASE::rBHelper.bDisposed)
+ throw DisposedException();
+
+ if ( ! acceptsURL(url) )
+ return NULL;
+
+ OEvoabConnection* pCon = new OEvoabConnection(this);
+ pCon->construct(url,info);
+ Reference< XConnection > xCon = pCon;
+ m_xConnections.push_back(WeakReferenceHelper(*pCon));
+
+ return xCon;
+}
+// --------------------------------------------------------------------------------
+namespace
+{
+ ::rtl::OUString lcl_translateProcessErrorMessage( oslProcessError nProcErr)
+ {
+ ::rtl::OUString sProcErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" not executed!."));
+ switch (nProcErr)
+ {
+ case osl_Process_E_None:
+ sProcErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" executed sucessful!"));
+ break;
+ case osl_Process_E_NotFound:
+ sProcErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" executed failed: not found!"));
+ break;
+ case osl_Process_E_NoPermission:
+ sProcErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" executed failed: has no permission!"));
+ break;
+ case osl_Process_E_TimedOut:
+ sProcErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" executed failed: time out!"));
+ break;
+ case osl_Process_E_Unknown:
+ sProcErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" executed failed: unkown reason!"));
+ break;
+ case osl_Process_E_InvalidError:
+ sProcErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" executed failed: invalid error!"));
+ break;
+ default:
+ sProcErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" executed failed: other reason!"));
+ }
+ return sProcErr;
+ }
+ oslProcessError lcl_execute( const ::rtl::OUString& _rCommand, ::rtl::OUString& _rArgument,
+ const ::rtl::OUString& _rWorkingDir, oslProcessOption _nOptions, oslFileHandle& /*[out]*/ _hStdOut )
+ {
+ oslProcessError nError = osl_Process_E_None;
+
+ EVO_TRACE_STRING("LDriver.cxx::lcl_execute: command : %s", _rCommand );
+ EVO_TRACE_STRING("LDriver.cxx::lcl_execute: argument : %s", _rArgument );
+ EVO_TRACE_STRING("LDriver.cxx::lcl_execute: working dir: %s", _rWorkingDir );
+
+ oslProcess hProcess( 0 );
+
+ nError = osl_executeProcess_WithRedirectedIO(
+ _rCommand.pData,
+ &_rArgument.pData,
+ 1,
+ _nOptions,
+ 0,
+ _rWorkingDir.pData,
+ 0,
+ 0,
+ &hProcess,
+ NULL,
+ &_hStdOut,
+ NULL
+ );
+ ::rtl::OUString sError = _rCommand + lcl_translateProcessErrorMessage( nError);
+ EVO_TRACE_STRING( "%s", sError );
+
+ if ( nError == osl_Process_E_None )
+ {
+ TimeValue aFiveSeconds;
+ aFiveSeconds.Seconds = 5;
+ aFiveSeconds.Nanosec = 0;
+ oslProcessError nWaitForProcessError = osl_joinProcessWithTimeout( hProcess, &aFiveSeconds );
+ if ( osl_Process_E_None != nWaitForProcessError )
+ {
+ nError = nWaitForProcessError;
+ // TODO: kill the running process?
+ }
+ osl_freeProcessHandle( hProcess );
+ }
+ return nError;
+ }
+}
+
+// --------------------------------------------------------------------------------
+sal_Bool SAL_CALL OEvoabDriver::acceptsURL( const ::rtl::OUString& url )
+ throw(SQLException, RuntimeException)
+{
+ sal_Bool bRet;
+ bRet = sal_False;
+ // here we have to look if we support this url format
+ if(acceptsURL_Stat(url))
+ {
+ if ( m_eSupportedEvoVersion != eUnknown )
+ return m_eSupportedEvoVersion == eTrue ? sal_True : sal_False;
+
+ if(!m_bWorkingDirCreated)
+ {
+ String sTempDirURL = getTempDirURL();
+ //EVO_TRACE_STRING("OEvoabDriver::acceptsURL()::sTempDirURL = %s", sTempDirURL );
+
+ ::rtl::OUString aTempDirURL(sTempDirURL);
+ m_aWorkingDirURL = aTempDirURL;
+ m_bWorkingDirCreated = sal_True;
+ }
+
+ ::rtl::OUString aCLICommand = getEvoab_CLI_EffectiveCommand();
+ ::rtl::OUString aWorkingDirURL = getWorkingDirURL();
+ ::rtl::OUString aArgVersion = ::rtl::OUString::createFromAscii(getEVOAB_CLI_ARG_VERSION());
+
+ oslFileHandle hStdout = NULL;
+ oslProcessError nProcErr = lcl_execute( aCLICommand, aArgVersion, aWorkingDirURL, 0, hStdout );
+ if(nProcErr != osl_Process_E_None)
+ {
+ if(doesEvoab_CLI_HavePath())
+ aCLICommand = getEvoab_CLI_Command();
+ else
+ aCLICommand = getEvoab_CLI_Path() + getEvoab_CLI_Command();
+ nProcErr = lcl_execute( aCLICommand, aArgVersion, aWorkingDirURL, osl_Process_SEARCHPATH | osl_Process_HIDDEN, hStdout );
+ if ( nProcErr == osl_Process_E_None )
+ m_aEvoab_CLI_EffectiveCommand = aCLICommand;
+ }
+
+ if ( hStdout != NULL )
+ {
+ OSL_ASSERT( hStdout );
+ sal_Char pBuffer[256];
+ sal_uInt64 nBytesRead;
+ oslFileError nFileErr = osl_File_E_None;
+ nFileErr = osl_readFile( hStdout, pBuffer, 256, &nBytesRead);
+ if ( nFileErr != osl_File_E_None )
+ {
+ ::rtl::OUString sErr = translateFileErrorMessage( nFileErr);
+ OSL_ENSURE(false, ::rtl::OUStringToOString( sErr, RTL_TEXTENCODING_ASCII_US ).getStr());
+ }
+ ::rtl::OUString aVersionInfo;
+ if ( nFileErr == osl_File_E_None && nBytesRead > 0 && nBytesRead <= 256)
+ {
+ OSL_TRACE("OEvoabDriver::acceptsURL()::osl_readFile(),nBytesRead = %u",nBytesRead);
+ aVersionInfo =
+ ::rtl::OUString( ( const sal_Char * )pBuffer,
+ (sal_Int32)nBytesRead,
+ RTL_TEXTENCODING_UTF8 );
+ EVO_TRACE_STRING("OEvoabDriver::acceptsURL()::aVersionInfo = %s", aVersionInfo );
+ sal_Int32 nIndex = 0;
+ sal_Bool bNumRetrieved = sal_False;
+ ::rtl::OUString aToken;
+ sal_Int32 aVer[4];
+ sal_Int32 i;
+ for ( i = 0; i < 4; i++ )
+ aVer[i] = 0;
+ do
+ {
+ aToken = aVersionInfo.getToken( 0, ' ', nIndex );
+ //OSL_TRACE("OEvoabDriver::acceptsURL()::Token:%d", nIndex );
+ //EVO_TRACE_STRING("OEvoabDriver::acceptsURL()::aToken = %s", aToken );
+ if( aToken.toChar() >= '0' && aToken.toChar() <= '9' )
+ {
+ bNumRetrieved = sal_True;
+ sal_Int32 nIndex1 = 0;
+ ::rtl::OUString aNum;
+ for(i = 0; i < 4 ; i++)
+ {
+ if( nIndex1 >= 0 )
+ {
+ aNum = aToken.getToken( 0, '.', nIndex1);
+ aVer[i] = aNum.toInt32();
+ OSL_TRACE("OEvoabDriver::acceptsURL()::Ver[%u]=%u", i, aVer[i] );
+ }
+ }
+ }
+ }
+ while ( nIndex >= 0 && !bNumRetrieved );
+
+ if((aVer[0]>1)||(aVer[0]==1 && aVer[1]>3)||(aVer[0]==1 && aVer[1]==3 && aVer[2]>2)||(aVer[0]==1 && aVer[1]==3 && aVer[2]==2 && aVer[3]>=99))
+ bRet = sal_True;
+ else
+ bRet = sal_False;
+ }
+ else
+ bRet = sal_False;
+
+ osl_closeFile( hStdout );
+ }
+ m_eSupportedEvoVersion = bRet ? eTrue : eFalse;
+ }
+ EVO_TRACE_STRING("OEvoabDriver::acceptsURL()::return, return value = %s", ::rtl::OUString::valueOf(bRet) );
+ return bRet;
+}
+
+
+// --------------------------------------------------------------------------------
+sal_Bool OEvoabDriver::acceptsURL_Stat( const ::rtl::OUString& url )
+{
+
+ EVO_TRACE_STRING("OEvoabDriver::acceptsURL_Stat()::Scheme = %s", url );
+ // Skip 'sdbc:address: part of URL
+ //
+ sal_Int32 nLen = url.indexOf(':');
+ nLen = url.indexOf(':',nLen+1);
+ ::rtl::OUString aAddrbookURI(url.copy(nLen+1));
+
+ // Get Scheme
+ nLen = aAddrbookURI.indexOf(':');
+ ::rtl::OUString aAddrbookScheme;
+ if ( nLen == -1 )
+ {
+ // There isn't any subschema: - but could be just subschema
+ if ( aAddrbookURI.getLength() > 0 )
+ aAddrbookScheme= aAddrbookURI;
+ else if(url == ::rtl::OUString::createFromAscii("sdbc:address:") )
+ return sal_True; // special case here
+ else
+ return sal_False;
+ }
+ else
+ aAddrbookScheme = aAddrbookURI.copy(0, nLen);
+
+
+ EVO_TRACE_STRING("OEvoabDriver::acceptsURL_Stat()::URI = %s", aAddrbookURI );
+ EVO_TRACE_STRING("OEvoabDriver::acceptsURL_Stat()::Scheme = %s", aAddrbookScheme );
+
+ return aAddrbookScheme.compareToAscii( getSDBC_SCHEME_EVOLUTION() ) == 0 ;
+}
+// -------------------------------------------------------------------------
+const rtl::OUString OEvoabDriver::getEvoab_CLI_Command() const
+{
+ rtl::OUString aEvoab_CLI_Command;
+ sal_Int32 nLen = m_aEvoab_CLI_FullPathCommand.lastIndexOf('/');
+
+ if ( nLen == -1 )
+ aEvoab_CLI_Command = m_aEvoab_CLI_FullPathCommand;
+ else
+ aEvoab_CLI_Command = m_aEvoab_CLI_FullPathCommand.copy(nLen+1);
+
+ EVO_TRACE_STRING( "OEvoabDriver::getEvoab_CLI_Command()::aEvoab_CLI_Command = %s", aEvoab_CLI_Command );
+
+ return aEvoab_CLI_Command;
+}
+// -------------------------------------------------------------------------
+const rtl::OUString OEvoabDriver::getEvoab_CLI_Path() const
+{
+ rtl::OUString aEvoab_CLI_Path;
+ sal_Int32 nLen = m_aEvoab_CLI_FullPathCommand.lastIndexOf('/');
+
+ if ( nLen == -1 )
+ {
+ rtl::OUString aDefault_CLI_FullPathCommand;
+ aDefault_CLI_FullPathCommand = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(OEvoabDriver::getEVOAB_CLI_FULLPATHCOMMAND()));
+ sal_Int32 nLength = aDefault_CLI_FullPathCommand.lastIndexOf('/');
+ aEvoab_CLI_Path = aDefault_CLI_FullPathCommand.copy(0, nLength+1);
+ }
+ else
+ aEvoab_CLI_Path = m_aEvoab_CLI_FullPathCommand.copy(0, nLen+1);
+ EVO_TRACE_STRING( "OEvoabDriver::getEvoab_CLI_Path()::aEvoab_CLI_Path = %s", aEvoab_CLI_Path );
+
+ return aEvoab_CLI_Path;
+}
+// -------------------------------------------------------------------------
+const rtl::OUString OEvoabDriver::getWorkingDirPath() const
+{
+ ::rtl::OUString aWorkingDirPath;
+ if(m_bWorkingDirCreated)
+ osl::File::getSystemPathFromFileURL( m_aWorkingDirURL, aWorkingDirPath );
+ return aWorkingDirPath;
+}
+// -------------------------------------------------------------------------
+const String OEvoabDriver::getEvoFolderListFileURL() const
+{
+
+ ::rtl::OUString aEvoFolderListFileURL;
+ aEvoFolderListFileURL = getWorkingDirURL() + getEvoFolderListFileName();
+
+ EVO_TRACE_STRING("OEvoabDriver::getEvoFolderListFileURL(): aEvoFolderListFileURL = %s", aEvoFolderListFileURL );
+ return aEvoFolderListFileURL.getStr();
+}
+
+// -------------------------------------------------------------------------
+String OEvoabDriver::getTempDirURL() const
+{
+ ::rtl::OUString aTempDirURL;
+ aTempDirURL = m_aTempDir.GetURL();
+ if((aTempDirURL.lastIndexOf( '/')) != (aTempDirURL.getLength( ) - 1))
+ aTempDirURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
+
+ EVO_TRACE_STRING("OEvoabDriver::getTempDirURL(): aTempDirURL = %s", aTempDirURL );
+ return aTempDirURL.getStr();
+}
+//-------------------------------------------------------------------------
+sal_Bool OEvoabDriver::fileExists(const ::rtl::OUString& _rURL, sal_Bool _bIsDir) const
+{
+ ::ucbhelper::Content aCheckExistence;
+ sal_Bool bExists = sal_False;
+ try
+ {
+ aCheckExistence = ::ucbhelper::Content(_rURL, Reference< XCommandEnvironment >());
+ if(_bIsDir)
+ bExists = aCheckExistence.isFolder();
+ else
+ bExists = aCheckExistence.isDocument();
+ }
+ catch(const Exception&) { }
+ return bExists;
+}
+
+// -----------------------------------------------------------------------------
+const sal_Char* OEvoabDriver::getSDBC_SCHEME_EVOLUTION()
+{
+ static const sal_Char* SDBC_SCHEME_EVOLUTION = EVOAB_EVOLUTION_SCHEMA;
+ return SDBC_SCHEME_EVOLUTION;
+}
+const sal_Char* OEvoabDriver::getEVOAB_FOLDERLIST_FILE_NAME()
+{
+ static const sal_Char* EVOAB_FOLDERLIST_FILE_NAME = "FolderList";
+ return EVOAB_FOLDERLIST_FILE_NAME;
+}
+const sal_Char* OEvoabDriver::getEVOAB_VERSION_FILE_NAME()
+{
+ static const sal_Char* EVOAB_VERSION_FILE_NAME = "EvoVersion";
+ return EVOAB_VERSION_FILE_NAME;
+}
+const sal_Char* OEvoabDriver::getEVOAB_META_FILE_EXT()
+{
+ static const sal_Char* EVOAB_META_FILE_EXT = "csv";
+ return EVOAB_META_FILE_EXT;
+}
+const sal_Char* OEvoabDriver::getEVOAB_CLI_FULLPATHCOMMAND()
+{
+ static const sal_Char* EVOAB_CLI_FULLPATHCOMMAND = "file:///home/evoab/extra/share/evolution/*/tools/evolution-addressbook-export";
+ return EVOAB_CLI_FULLPATHCOMMAND;
+}
+const sal_Char* OEvoabDriver::getEVOAB_CLI_ARG_LIST_FOLDERS()
+{
+ static const sal_Char* EVOAB_CLI_ARG_LIST_FOLDERS = "-l";
+ return EVOAB_CLI_ARG_LIST_FOLDERS;
+}
+const sal_Char* OEvoabDriver::getEVOAB_CLI_ARG_OUTPUT_FILE_PREFIX()
+{
+ static const sal_Char* EVOAB_CLI_ARG_OUTPUT_FILE_PREFIX = "--output=";
+ return EVOAB_CLI_ARG_OUTPUT_FILE_PREFIX;
+}
+const sal_Char* OEvoabDriver::getEVOAB_CLI_ARG_OUTPUT_FORMAT()
+{
+ static const sal_Char* EVOAB_CLI_ARG_OUTPUT_FORMAT = "--format=csv";
+ return EVOAB_CLI_ARG_OUTPUT_FORMAT;
+}
+const sal_Char* OEvoabDriver::getEVOAB_CLI_ARG_VERSION()
+{
+ static const sal_Char* EVOAB_CLI_ARG_VERSION = "--version";
+ return EVOAB_CLI_ARG_VERSION;
+}
+const sal_Char* OEvoabDriver::getEVOAB_CLI_ARG_OUTPUT_REDIRECT()
+{
+ static const sal_Char* EVOAB_CLI_ARG_OUTPUT_REDIRECT = ">";
+ return EVOAB_CLI_ARG_OUTPUT_REDIRECT;
+}
+rtl::OUString OEvoabDriver::translateFileErrorMessage( oslFileError nFileErr)
+{
+ ::rtl::OUString sFileErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" no file operation!."));
+ switch (nFileErr)
+ {
+ case osl_File_E_None:
+ sFileErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" File operation succeeded!"));
+ break;
+ case osl_File_E_INVAL:
+ sFileErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" File operation failed: the format of the parameters was not valid!"));
+ break;
+ case osl_File_E_INTR:
+ sFileErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" File operation failed: function call was interrupted!"));
+ break;
+ case osl_File_E_IO:
+ sFileErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" File operation failed: I/O errors!"));
+ break;
+ case osl_File_E_ISDIR:
+ sFileErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" File operation failed: is a directory!"));
+ break;
+ case osl_File_E_BADF:
+ sFileErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" File operation failed: bad file!"));
+ break;
+ case osl_File_E_FAULT:
+ sFileErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" File operation failed: bad address!"));
+ break;
+ case osl_File_E_AGAIN:
+ sFileErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" File operation failed: operation would block!"));
+ break;
+ case osl_File_E_NOLINK:
+ sFileErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" File operation failed: link has been severed!"));
+ break;
+ default:
+ sFileErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" File operation failed: other reason!"));
+ }
+ return sFileErr;
+}
+// -----------------------------------------------------------------------------
+Sequence< DriverPropertyInfo > SAL_CALL OEvoabDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException)
+{
+ if ( !acceptsURL(url) )
+ {
+ ::connectivity::SharedResources aResources;
+ const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
+ ::dbtools::throwGenericSQLException(sMessage ,*this);
+ } // if ( !acceptsURL(url) )
+ return Sequence< DriverPropertyInfo >();
+}
diff --git a/connectivity/source/drivers/evoab/LDriver.hxx b/connectivity/source/drivers/evoab/LDriver.hxx
new file mode 100644
index 000000000000..bf45c93d9531
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LDriver.hxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * 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: LDriver.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 _CONNECTIVITY_EVOAB_LDRIVER_HXX_
+#define _CONNECTIVITY_EVOAB_LDRIVER_HXX_
+
+#include <cppuhelper/compbase2.hxx>
+#include "connectivity/CommonTools.hxx"
+#include "file/FDriver.hxx"
+#include <unotools/tempfile.hxx>
+#include <osl/file.h>
+#include <osl/process.h>
+
+#define EVOAB_EVOLUTION_SCHEMA "evolution"
+#define EVOAB_LDAP_SCHEMA "ldap"
+#define EVOAB_DRIVER_IMPL_NAME "com.sun.star.comp.sdbc.evoab.OEvoabDriver"
+
+namespace connectivity
+{
+ namespace evoab
+ {
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL OEvoabDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception );
+
+ class OEvoabDriver : public file::OFileDriver
+ {
+ private:
+ enum MaybeVoidBool
+ {
+ eUnknown,
+ eTrue,
+ eFalse
+ };
+ ::utl::TempFile m_aTempDir;
+ rtl::OUString m_aFolderListName;
+ rtl::OUString m_aVersionName;
+ rtl::OUString m_aFileExt;
+ rtl::OUString m_aWorkingDirURL;
+ rtl::OUString m_aEvoab_CLI_EffectiveCommand;
+ rtl::OUString m_aEvoab_CLI_FullPathCommand;
+ sal_Bool m_bWorkingDirCreated;
+ MaybeVoidBool m_eSupportedEvoVersion;
+
+ sal_Bool fileExists(const ::rtl::OUString& _rURL, sal_Bool _bIsDir=sal_False) const;
+
+ public:
+ OEvoabDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory);
+
+ inline rtl::OUString getEvoFolderListName() const { return m_aFolderListName;}
+ inline rtl::OUString getFileExt() const { return m_aFileExt;}
+ inline rtl::OUString getEvoFolderListFileName() const { return m_aFolderListName + ::rtl::OUString::createFromAscii(".") + m_aFileExt;}
+ inline rtl::OUString getEvoVersionFileName() const { return m_aVersionName + ::rtl::OUString::createFromAscii(".") + m_aFileExt;}
+ inline rtl::OUString getWorkingDirURL() const { return m_aWorkingDirURL;}
+ inline rtl::OUString getEvoab_CLI_FullPathCommand() const { return m_aEvoab_CLI_FullPathCommand;}
+ inline rtl::OUString getEvoab_CLI_EffectiveCommand() const { return m_aEvoab_CLI_EffectiveCommand;}
+ inline sal_Bool doesEvoab_CLI_HavePath() const { return m_aEvoab_CLI_FullPathCommand.lastIndexOf('/')!=-1;}
+ const rtl::OUString getEvoab_CLI_Command() const;
+ const rtl::OUString getEvoab_CLI_Path() const;
+ const rtl::OUString getWorkingDirPath() const;
+ const String getEvoFolderListFileURL() const;
+ String getTempDirURL() const;
+
+ // XInterface
+ ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ // XDriver
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+
+
+ // static methods
+ static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException);
+ static sal_Bool acceptsURL_Stat( const ::rtl::OUString& url );
+ static ::rtl::OUString translateProcessErrorMessage( oslProcessError nProcErr);
+ static ::rtl::OUString translateFileErrorMessage( oslFileError nFileErr);
+ static const sal_Char* getSDBC_SCHEME_EVOLUTION();
+ static const sal_Char* getEVOAB_FOLDERLIST_FILE_NAME();
+ static const sal_Char* getEVOAB_VERSION_FILE_NAME();
+ static const sal_Char* getEVOAB_META_FILE_EXT();
+ static const sal_Char* getEVOAB_CLI_FULLPATHCOMMAND();
+ static const sal_Char* getEVOAB_CLI_ARG_LIST_FOLDERS();
+ static const sal_Char* getEVOAB_CLI_ARG_OUTPUT_FILE_PREFIX();
+ static const sal_Char* getEVOAB_CLI_ARG_OUTPUT_FORMAT();
+ static const sal_Char* getEVOAB_CLI_ARG_VERSION();
+ static const sal_Char* getEVOAB_CLI_ARG_OUTPUT_REDIRECT();
+
+ };
+ }
+
+}
+#endif //_CONNECTIVITY_EVOAB_LDRIVER_HXX_
diff --git a/connectivity/source/drivers/evoab/LFolderList.cxx b/connectivity/source/drivers/evoab/LFolderList.cxx
new file mode 100644
index 000000000000..a3c031c05c05
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LFolderList.cxx
@@ -0,0 +1,566 @@
+/*************************************************************************
+ *
+ * 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: LFolderList.cxx,v $
+ * $Revision: 1.15 $
+ *
+ * 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_connectivity.hxx"
+
+#include <ctype.h>
+#include <algorithm>
+#include "LFolderList.hxx"
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <svtools/converter.hxx>
+#include "LConnection.hxx"
+#include "LColumns.hxx"
+#include <osl/thread.h>
+#include <tools/config.hxx>
+#include <comphelper/sequence.hxx>
+#include <svtools/zforlist.hxx>
+#include <rtl/math.hxx>
+#include <stdio.h> //sprintf
+#include <comphelper/extract.hxx>
+#include <comphelper/numbers.hxx>
+#include "LDriver.hxx"
+#include <com/sun/star/util/NumberFormat.hpp>
+#include <unotools/configmgr.hxx>
+#include <i18npool/mslangid.hxx>
+#include "connectivity/dbconversion.hxx"
+#include <comphelper/types.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <tools/debug.hxx>
+#include "connectivity/dbexception.hxx"
+#ifndef CONNECTIVITY_EVOAB_DEBUG_HELPER_HXX
+#include "LDebug.hxx"
+#endif
+#include <svtools/syslocale.hxx>
+
+using namespace ::comphelper;
+using namespace connectivity;
+using namespace connectivity::evoab;
+using namespace connectivity::file;
+using namespace ::cppu;
+using namespace utl;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+
+// -------------------------------------------------------------------------
+void OEvoabFolderList::fillColumns(const ::com::sun::star::lang::Locale& _aLocale)
+{
+ BOOL bRead = TRUE;
+
+ QuotedTokenizedString aHeaderLine;
+ OEvoabConnection* pConnection = (OEvoabConnection*)m_pConnection;
+
+ // read first row
+ QuotedTokenizedString aFirstLine;
+ bRead = m_pFileStream->ReadByteStringLine(aFirstLine,pConnection->getTextEncoding());
+
+ while(bRead && !aFirstLine.Len())
+ {
+ bRead = m_pFileStream->ReadByteStringLine(aFirstLine,pConnection->getTextEncoding());
+ }
+ // use first row as headerline because we need the number of columns
+ aHeaderLine = aFirstLine;
+
+ // column count
+ xub_StrLen nFieldCount = aHeaderLine.GetTokenCount(pConnection->getFieldDelimiter(),pConnection->getStringDelimiter());
+
+ if(!m_aColumns.isValid())
+ m_aColumns = new OSQLColumns();
+ else
+ m_aColumns->get().clear();
+
+ m_aTypes.clear();
+ m_aPrecisions.clear();
+ m_aScales.clear();
+ // reserve some space
+ m_aColumns->get().reserve(nFieldCount);
+ m_aTypes.reserve(nFieldCount);
+ m_aPrecisions.reserve(nFieldCount);
+ m_aScales.reserve(nFieldCount);
+
+ sal_Bool bCase = getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers();
+ CharClass aCharClass(pConnection->getDriver()->getFactory(),_aLocale);
+ // read description
+ sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter();
+ sal_Unicode cThousandDelimiter = pConnection->getThousandDelimiter();
+ String aColumnName;
+ ::rtl::OUString aTypeName;
+ ::comphelper::UStringMixEqual aCase(bCase);
+ xub_StrLen nStartPosFirstLine = 0; // use for eficient way to get the tokens
+ xub_StrLen nStartPosFirstLine2 = 0;
+ for (xub_StrLen i = 0; i < nFieldCount; i++)
+ {
+
+ // no column name so ...
+ aColumnName = 'C';
+ aColumnName += String::CreateFromInt32(i+1);
+
+ sal_Int32 eType;
+ UINT16 nPrecision = 0;
+ UINT16 nScale = 0;
+
+ BOOL bNumeric = FALSE;
+ ULONG nIndex = 0;
+
+ // first without fielddelimiter
+ String aField;
+ aFirstLine.GetTokenSpecial(aField,nStartPosFirstLine,pConnection->getFieldDelimiter(),'\0');
+ if (aField.Len() == 0 ||
+ (pConnection->getStringDelimiter() && pConnection->getStringDelimiter() == aField.GetChar(0)))
+ {
+ bNumeric = FALSE;
+ }
+ else
+ {
+ String aField2;
+ if ( pConnection->getStringDelimiter() != '\0' )
+ aFirstLine.GetTokenSpecial(aField2,nStartPosFirstLine2,pConnection->getFieldDelimiter(),pConnection->getStringDelimiter());
+ else
+ aField2 = aField;
+
+ if (aField2.Len() == 0)
+ {
+ bNumeric = FALSE;
+ }
+ else
+ {
+ bNumeric = TRUE;
+ xub_StrLen nDot = 0;
+ for (xub_StrLen j = 0; j < aField2.Len(); j++)
+ {
+ sal_Unicode c = aField2.GetChar(j);
+ // nur Ziffern und Dezimalpunkt und Tausender-Trennzeichen?
+ if ((!cDecimalDelimiter || c != cDecimalDelimiter) &&
+ (!cThousandDelimiter || c != cThousandDelimiter) &&
+ !aCharClass.isDigit(aField2,j))
+ {
+ bNumeric = FALSE;
+ break;
+ }
+ if (cDecimalDelimiter && c == cDecimalDelimiter)
+ {
+ nPrecision = 15; // we have an decimal value
+ nScale = 2;
+ nDot++;
+ }
+ }
+
+ if (nDot > 1) // if there is more than one dot it isn't a number
+ bNumeric = FALSE;
+ if (bNumeric && cThousandDelimiter)
+ {
+ // Ist der Trenner richtig angegeben?
+ String aValue = aField2.GetToken(0,cDecimalDelimiter);
+ for (sal_Int32 j = aValue.Len() - 4; j >= 0; j -= 4)
+ {
+ sal_Unicode c = aValue.GetChar(j);
+ // nur Ziffern und Dezimalpunkt und Tausender-Trennzeichen?
+ if (c == cThousandDelimiter && j)
+ continue;
+ else
+ {
+ bNumeric = FALSE;
+ break;
+ }
+ }
+ }
+
+ // jetzt koennte es noch ein Datumsfeld sein
+ if (!bNumeric)
+ {
+ try
+ {
+ nIndex = m_xNumberFormatter->detectNumberFormat(::com::sun::star::util::NumberFormat::ALL,aField2);
+ }
+ catch(Exception&)
+ {
+ }
+ }
+ }
+ }
+
+ sal_Int32 nFlags = 0;
+ if (bNumeric)
+ {
+ if (cDecimalDelimiter)
+ {
+ if(nPrecision)
+ {
+ eType = DataType::DECIMAL;
+ aTypeName = ::rtl::OUString::createFromAscii("DECIMAL");
+ }
+ else
+ {
+ eType = DataType::DOUBLE;
+ aTypeName = ::rtl::OUString::createFromAscii("DOUBLE");
+ }
+ }
+ else
+ eType = DataType::INTEGER;
+ nFlags = ColumnSearch::BASIC;
+ }
+ else
+ {
+
+ switch (comphelper::getNumberFormatType(m_xNumberFormatter,nIndex))
+ {
+ case NUMBERFORMAT_DATE:
+ eType = DataType::DATE;
+ aTypeName = ::rtl::OUString::createFromAscii("DATE");
+ break;
+ case NUMBERFORMAT_DATETIME:
+ eType = DataType::TIMESTAMP;
+ aTypeName = ::rtl::OUString::createFromAscii("TIMESTAMP");
+ break;
+ case NUMBERFORMAT_TIME:
+ eType = DataType::TIME;
+ aTypeName = ::rtl::OUString::createFromAscii("TIME");
+ break;
+ default:
+ eType = DataType::VARCHAR;
+ nPrecision = 0; // nyi: Daten koennen aber laenger sein!
+ nScale = 0;
+ aTypeName = ::rtl::OUString::createFromAscii("VARCHAR");
+ };
+ nFlags |= ColumnSearch::CHAR;
+ }
+
+ // check if the columname already exists
+ String aAlias(aColumnName);
+ OSQLColumns::Vector::const_iterator aFind = connectivity::find(m_aColumns->get().begin(),m_aColumns->get().end(),aAlias,aCase);
+ sal_Int32 nExprCnt = 0;
+ while(aFind != m_aColumns->get().end())
+ {
+ (aAlias = aColumnName) += String::CreateFromInt32(++nExprCnt);
+ aFind = connectivity::find(m_aColumns->get().begin(),m_aColumns->get().end(),aAlias,aCase);
+ }
+
+ sdbcx::OColumn* pColumn = new sdbcx::OColumn(aAlias,aTypeName,::rtl::OUString(),
+ ColumnValue::NULLABLE,
+ nPrecision,
+ nScale,
+ eType,
+ sal_False,
+ sal_False,
+ sal_False,
+ bCase);
+ Reference< XPropertySet> xCol = pColumn;
+ m_aColumns->get().push_back(xCol);
+ m_aTypes.push_back(eType);
+ m_aPrecisions.push_back(nPrecision);
+ m_aScales.push_back(nScale);
+ }
+ m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN);
+}
+// -------------------------------------------------------------------------
+DBG_NAME( OEvoabFolderList );
+OEvoabFolderList::OEvoabFolderList(OEvoabConnection* _pConnection)
+ :m_nFilePos(0)
+ ,m_pFileStream(NULL)
+ ,m_pConnection(_pConnection)
+ ,m_bIsNull(sal_False)
+{
+ DBG_CTOR( OEvoabFolderList, NULL );
+ m_aColumns = new OSQLColumns();
+
+ construct();
+}
+// -----------------------------------------------------------------------------
+void OEvoabFolderList::construct()
+{
+ SvtSysLocale aLocale;
+ ::com::sun::star::lang::Locale aAppLocale(aLocale.GetLocaleDataPtr()->getLocale());
+ Sequence< ::com::sun::star::uno::Any > aArg(1);
+ aArg[0] <<= aAppLocale;
+
+ Reference< ::com::sun::star::util::XNumberFormatsSupplier > xSupplier(m_pConnection->getDriver()->getFactory()->createInstanceWithArguments(::rtl::OUString::createFromAscii("com.sun.star.util.NumberFormatsSupplier"),aArg),UNO_QUERY);
+ m_xNumberFormatter = Reference< ::com::sun::star::util::XNumberFormatter >(m_pConnection->getDriver()->getFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.util.NumberFormatter")),UNO_QUERY);
+ m_xNumberFormatter->attachNumberFormatsSupplier(xSupplier);
+
+ INetURLObject aURL;
+ aURL.SetURL(m_pConnection->getDriver()->getEvoFolderListFileURL());
+
+ String aFileName = aURL.GetMainURL(INetURLObject::NO_DECODE);
+
+ EVO_TRACE_STRING("OJ::construct()::aFileName = %s\n", aFileName );
+ m_pFileStream = createStream_simpleError( aFileName,STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE);
+
+ if(!m_pFileStream)
+ m_pFileStream = createStream_simpleError( aFileName,STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYNONE);
+
+ if(m_pFileStream)
+ {
+ m_pFileStream->Seek(STREAM_SEEK_TO_END);
+ sal_Int32 nSize = m_pFileStream->Tell();
+ m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN);
+
+ // Buffersize abhaengig von der Filegroesse
+ m_pFileStream->SetBufferSize(nSize > 1000000 ? 32768 :
+ nSize > 100000 ? 16384 :
+ nSize > 10000 ? 4096 : 1024);
+ OSL_TRACE("OEvoabFolderList::construct()::m_pFileStream->Tell() = %d\n", nSize );
+
+ fillColumns(aAppLocale);
+ }
+}
+
+
+//------------------------------------------------------------------
+sal_Bool OEvoabFolderList::fetchRow(OValueRow _rRow,const OSQLColumns & _rCols)
+{
+ (_rRow->get())[0] = m_nFilePos; // the "bookmark"
+
+ OEvoabConnection* pConnection = (OEvoabConnection*)m_pConnection;
+ // Felder:
+ xub_StrLen nStartPos = 0;
+ String aStr;
+ OSQLColumns::Vector::const_iterator aIter = _rCols.get().begin();
+ for (sal_Int32 i = 0; aIter != _rCols.get().end();++aIter, ++i)
+ {
+ m_aCurrentLine.GetTokenSpecial(aStr,nStartPos,pConnection->getFieldDelimiter(),pConnection->getStringDelimiter());
+ //OSL_TRACE("OEvoabFolderList::fetchRow()::aStr = %s\n", ((OUtoCStr(::rtl::OUString(aStr))) ? (OUtoCStr(::rtl::OUString(aStr))):("NULL")) );
+
+ if (aStr.Len() == 0)
+ (_rRow->get())[i+1].setNull();
+ else
+ {
+ // length depending on the data type
+ sal_Int32 nType = m_aTypes[i];
+ switch(nType)
+ {
+ case DataType::TIMESTAMP:
+ case DataType::DATE:
+ case DataType::TIME:
+ {
+ double nRes = 0.0;
+ try
+ {
+ nRes = m_xNumberFormatter->convertStringToNumber(::com::sun::star::util::NumberFormat::ALL,aStr);
+ Reference<XPropertySet> xProp(m_xNumberFormatter->getNumberFormatsSupplier()->getNumberFormatSettings(),UNO_QUERY);
+ com::sun::star::util::Date aDate;
+ xProp->getPropertyValue(::rtl::OUString::createFromAscii("NullDate")) >>= aDate;
+
+ switch(nType)
+ {
+ case DataType::DATE:
+ (_rRow->get())[i+1] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDate(nRes,aDate));
+ break;
+ case DataType::TIMESTAMP:
+ (_rRow->get())[i+1] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDateTime(nRes,aDate));
+ break;
+ default:
+ (_rRow->get())[i+1] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toTime(nRes));
+ }
+ }
+ catch(Exception&)
+ {
+ (_rRow->get())[i+1].setNull();
+ }
+ } break;
+ case DataType::DOUBLE:
+ case DataType::INTEGER:
+ case DataType::DECIMAL: // #99178# OJ
+ case DataType::NUMERIC:
+ {
+ sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter();
+ sal_Unicode cThousandDelimiter = pConnection->getThousandDelimiter();
+ String aStrConverted;
+
+ OSL_ENSURE(cDecimalDelimiter && nType != DataType::INTEGER ||
+ !cDecimalDelimiter && nType == DataType::INTEGER,
+ "FalscherTyp");
+
+ // In Standard-Notation (DezimalPUNKT ohne Tausender-Komma) umwandeln:
+ for (xub_StrLen j = 0; j < aStr.Len(); ++j)
+ {
+ if (cDecimalDelimiter && aStr.GetChar(j) == cDecimalDelimiter)
+ aStrConverted += '.';
+ else if ( aStr.GetChar(j) == '.' ) // special case, if decimal seperator isn't '.' we have to vut the string after it
+ break; // #99189# OJ
+ else if (cThousandDelimiter && aStr.GetChar(j) == cThousandDelimiter)
+ {
+ // weglassen
+ }
+ else
+ aStrConverted += aStr.GetChar(j) ;
+ }
+ double nVal = ::rtl::math::stringToDouble(aStrConverted.GetBuffer(),',','.',NULL,NULL);
+
+ // #99178# OJ
+ if ( DataType::DECIMAL == nType || DataType::NUMERIC == nType )
+ (_rRow->get())[i+1] = String::CreateFromDouble(nVal);
+ else
+ (_rRow->get())[i+1] = nVal;
+ } break;
+
+ default:
+ {
+ // Wert als String in Variable der Row uebernehmen
+ (_rRow->get())[i+1] = aStr;
+ }
+ break;
+ }
+ }
+ }
+ return sal_True;
+}
+
+
+//------------------------------------------------------------------
+sal_Bool OEvoabFolderList::seekRow(IResultSetHelper::Movement eCursorPosition)
+{
+ //OSL_TRACE("OEvoabFolderList::seekRow()::(before SeekRow)m_aCurrentLine = %d\n", ((OUtoCStr(::rtl::OUString(m_aCurrentLine))) ? (OUtoCStr(::rtl::OUString(m_aCurrentLine))):("NULL")) );
+
+ if ( !m_pFileStream )
+ return sal_False;
+ OEvoabConnection* pConnection = (OEvoabConnection*)m_pConnection;
+ // ----------------------------------------------------------
+ // Positionierung vorbereiten:
+ //OSL_TRACE("OEvoabFolderList::seekRow()::(before SeekRow,m_pFileStriam Exist)m_aCurrentLine = %d\n", ((OUtoCStr(::rtl::OUString(m_aCurrentLine))) ? (OUtoCStr(::rtl::OUString(m_aCurrentLine))):("NULL")) );
+
+ switch(eCursorPosition)
+ {
+ case IResultSetHelper::FIRST:
+ m_nFilePos = 0;
+ // run through
+
+ case IResultSetHelper::NEXT:
+ m_pFileStream->Seek(m_nFilePos);
+
+ if (m_pFileStream->IsEof())
+ {
+ OSL_TRACE( "OEvoabFolderList::seekRow: EOF /before/ reading the line." );
+ return sal_False;
+ }
+
+ m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding());
+ if (m_pFileStream->IsEof())
+ {
+ OSL_TRACE( "OEvoabFolderList::seekRow: EOF /after/ reading the line." );
+ if ( !m_aCurrentLine.Len() )
+ {
+ OSL_TRACE( "OEvoabFolderList::seekRow: empty line read." );
+ return sal_False;
+ }
+ }
+ m_nFilePos = m_pFileStream->Tell();
+ break;
+
+ default:
+ OSL_ENSURE( sal_False, "OEvoabFolderList::seekRow: unsupported positioning!" );
+ break;
+ }
+
+ //OSL_TRACE("OEvoabFolderList::seekRow()::(after SeekRow)m_aCurrentLine = %d\n", ((OUtoCStr(::rtl::OUString(m_aCurrentLine))) ? (OUtoCStr(::rtl::OUString(m_aCurrentLine))):("NULL")) );
+
+ return sal_True;
+}
+// -----------------------------------------------------------------------------
+SvStream* OEvoabFolderList::createStream_simpleError( const String& _rFileName, StreamMode _eOpenMode)
+{
+ utl::UcbLockBytesHandler* p_null_dummy=NULL;
+ SvStream* pReturn = ::utl::UcbStreamHelper::CreateStream( _rFileName, _eOpenMode, p_null_dummy);
+ if (pReturn && (ERRCODE_NONE != pReturn->GetErrorCode()))
+ {
+ delete pReturn;
+ pReturn = NULL;
+ }
+ return pReturn;
+}
+// -----------------------------------------------------------------------------
+const ORowSetValue& OEvoabFolderList::getValue(sal_Int32 _nColumnIndex ) throw(::com::sun::star::sdbc::SQLException)
+{
+ checkIndex( _nColumnIndex );
+
+ m_bIsNull = (m_aRow->get())[_nColumnIndex].isNull();
+ return (m_aRow->get())[_nColumnIndex];
+}
+// -----------------------------------------------------------------------------
+void OEvoabFolderList::checkIndex(sal_Int32 _nColumnIndex ) throw(::com::sun::star::sdbc::SQLException)
+{
+ if ( _nColumnIndex <= 0 || _nColumnIndex >= (sal_Int32)m_aRow->get().size() ) {
+// ::dbtools::throwInvalidIndexException();
+ ;
+ }
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL OEvoabFolderList::getString( sal_Int32 _nColumnIndex ) throw(SQLException, RuntimeException)
+{
+ return getValue(_nColumnIndex);
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL OEvoabFolderList::getInt( sal_Int32 _nColumnIndex ) throw(SQLException, RuntimeException)
+{
+ return getValue( _nColumnIndex );
+}
+// -----------------------------------------------------------------------------
+void OEvoabFolderList::initializeRow(sal_Int32 _nColumnCount)
+{
+ if(!m_aRow.isValid())
+ {
+ m_aRow = new OValueVector(_nColumnCount);
+ (m_aRow->get())[0].setBound(sal_True);
+ ::std::for_each(m_aRow->get().begin()+1,m_aRow->get().end(),TSetBound(sal_False));
+ }
+ //OSL_TRACE("OEvoabFolderList::initializeRow()::_nColumnCount = %d\n", _nColumnCount);
+
+}
+// -------------------------------------------------------------------------
+
+sal_Bool SAL_CALL OEvoabFolderList::first( ) throw(SQLException, RuntimeException)
+{
+ sal_Bool bSuccess = seekRow(IResultSetHelper::FIRST);
+
+ EVO_TRACE_STRING("OEvoabFolderList::first(): returning %s\n", ::rtl::OUString::valueOf(bSuccess) );
+ return bSuccess;
+}
+// -------------------------------------------------------------------------
+
+sal_Bool SAL_CALL OEvoabFolderList::next( ) throw(SQLException, RuntimeException)
+{
+ sal_Bool bSuccess = seekRow(IResultSetHelper::NEXT);
+
+ EVO_TRACE_STRING("OEvoabFolderList::next(): returning %s\n", ::rtl::OUString::valueOf(bSuccess) );
+ return bSuccess;
+}
+// -------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL OEvoabFolderList::getRow( ) throw(SQLException, RuntimeException)
+{
+ sal_Bool bRet = fetchRow(m_aRow,getTableColumns().getBody());
+ EVO_TRACE_STRING("OEvoabFolderList::getRow()::fetchRow() = %s\n", ::rtl::OUString::valueOf(bRet) );
+
+ return bRet;
+}
diff --git a/connectivity/source/drivers/evoab/LFolderList.hxx b/connectivity/source/drivers/evoab/LFolderList.hxx
new file mode 100644
index 000000000000..baa2a3b05e86
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LFolderList.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * 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: LFolderList.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 _CONNECTIVITY_EVOAB_LEVOABFOLDERLIST_HXX_
+#define _CONNECTIVITY_EVOAB_LEVOABFOLDERLIST_HXX_
+
+#include "connectivity/sdbcx/VColumn.hxx"
+#include "connectivity/CommonTools.hxx"
+#include <tools/urlobj.hxx>
+#include "LTable.hxx"
+#include "TResultSetHelper.hxx"
+
+
+namespace connectivity
+{
+ namespace evoab
+ {
+ //==================================================================
+ // Ableitung von String mit ueberladenen GetToken/GetTokenCount-Methoden
+ // Speziell fuer FLAT FILE-Format: Strings koennen gequotet sein
+ //==================================================================
+
+ class OEvoabConnection;
+
+ class OEvoabFolderList
+ {
+ // maps a row postion to a file position
+ ::std::vector<sal_Int32> m_aTypes; // holds all type for columns just to avoid to ask the propertyset
+ ::std::vector<sal_Int32> m_aPrecisions; // same as aboth
+ ::std::vector<sal_Int32> m_aScales;
+ QuotedTokenizedString m_aCurrentLine;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xNumberFormatter;
+ sal_Int32 m_nFilePos; // aktuelle IResultSetHelper::Movement
+ SvStream* m_pFileStream;
+ OEvoabConnection* m_pConnection;
+ ::vos::ORef<OSQLColumns> m_aColumns;
+ OValueRow m_aRow;
+ sal_Bool m_bIsNull;
+
+ private:
+ void fillColumns(const ::com::sun::star::lang::Locale& _aLocale);
+ BOOL CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo);
+
+ sal_Bool fetchRow(OValueRow _rRow,const OSQLColumns& _rCols);
+ sal_Bool seekRow(IResultSetHelper::Movement eCursorPosition);
+
+ public:
+
+ OEvoabFolderList( OEvoabConnection* _pConnection);
+
+ OEvoabConnection* getConnection() const { return m_pConnection;}
+ ::vos::ORef<OSQLColumns> getTableColumns() const {return m_aColumns;}
+ void construct(); // can throw any exception
+ static SvStream* createStream_simpleError( const String& _rFileName, StreamMode _eOpenMode);
+ void initializeRow(sal_Int32 _nColumnCount);
+ void checkIndex(sal_Int32 _nColumnIndex ) throw(::com::sun::star::sdbc::SQLException);
+ const ORowSetValue& getValue(sal_Int32 _nColumnIndex ) throw(::com::sun::star::sdbc::SQLException);
+ ::rtl::OUString SAL_CALL getString( sal_Int32 _nColumnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getInt( sal_Int32 _nColumnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+
+ };
+ }
+}
+#endif // _CONNECTIVITY_EVOAB_LEVOABFOLDERLIST_HXX_
+
diff --git a/connectivity/source/drivers/evoab/LNoException.cxx b/connectivity/source/drivers/evoab/LNoException.cxx
new file mode 100644
index 000000000000..183ab75559f4
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LNoException.cxx
@@ -0,0 +1,327 @@
+/*************************************************************************
+ *
+ * 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: LNoException.cxx,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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_connectivity.hxx"
+#include "LTable.hxx"
+#include "LConnection.hxx"
+
+using namespace connectivity;
+using namespace connectivity::evoab;
+
+//------------------------------------------------------------------
+xub_StrLen OEvoabString::GetTokenCount( sal_Unicode cTok, sal_Unicode cStrDel ) const
+{
+ if ( !Len() )
+ return 0;
+
+ xub_StrLen nTokCount = 1;
+ BOOL bStart = TRUE; // Stehen wir auf dem ersten Zeichen im Token?
+ BOOL bInString = FALSE; // Befinden wir uns INNERHALB eines (cStrDel delimited) String?
+
+ // Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen
+ for( xub_StrLen i = 0; i < Len(); i++ )
+ {
+ if (bStart)
+ {
+ bStart = FALSE;
+ // Erstes Zeichen ein String-Delimiter?
+ if ((*this).GetChar(i) == cStrDel)
+ {
+ bInString = TRUE; // dann sind wir jetzt INNERHALB des Strings!
+ continue; // dieses Zeichen ueberlesen!
+ }
+ }
+
+ if (bInString) {
+ // Wenn jetzt das String-Delimiter-Zeichen auftritt ...
+ if ( (*this).GetChar(i) == cStrDel )
+ {
+ if ((i+1 < Len()) && ((*this).GetChar(i+1) == cStrDel))
+ {
+ // Verdoppeltes String-Delimiter-Zeichen:
+ i++; // kein String-Ende, naechstes Zeichen ueberlesen.
+ }
+ else
+ {
+ // String-Ende
+ bInString = FALSE;
+ }
+ }
+ } else {
+ // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount
+ if ( (*this).GetChar(i) == cTok )
+ {
+ nTokCount++;
+ bStart = TRUE;
+ }
+ }
+ }
+ //OSL_TRACE("OEvoabString::nTokCount = %d\n", ((OUtoCStr(::rtl::OUString(nTokCount))) ? (OUtoCStr(::rtl::OUString(nTokCount))):("NULL")) );
+
+ return nTokCount;
+}
+
+//------------------------------------------------------------------
+void OEvoabString::GetTokenSpecial( String& _rStr,xub_StrLen& nStartPos, sal_Unicode cTok, sal_Unicode cStrDel ) const
+{
+ _rStr.Erase();
+ xub_StrLen nLen = Len();
+ if ( nLen )
+ {
+ BOOL bInString = (nStartPos < nLen) && ((*this).GetChar(nStartPos) == cStrDel); // Befinden wir uns INNERHALB eines (cStrDel delimited) String?
+
+ // Erstes Zeichen ein String-Delimiter?
+ if (bInString )
+ ++nStartPos; // dieses Zeichen ueberlesen!
+ // Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen
+ for( xub_StrLen i = nStartPos; i < nLen; ++i )
+ {
+ if (bInString)
+ {
+ // Wenn jetzt das String-Delimiter-Zeichen auftritt ...
+ if ( (*this).GetChar(i) == cStrDel )
+ {
+ if ((i+1 < nLen) && ((*this).GetChar(i+1) == cStrDel))
+ {
+ // Verdoppeltes String-Delimiter-Zeichen:
+ ++i; // kein String-Ende, naechstes Zeichen ueberlesen.
+
+ _rStr += (*this).GetChar(i); // Zeichen gehoert zum Resultat-String
+ }
+ else
+ {
+ // String-Ende
+ bInString = FALSE;
+ }
+ }
+ else
+ {
+ _rStr += (*this).GetChar(i); // Zeichen gehoert zum Resultat-String
+ }
+
+ }
+ else
+ {
+ // Stimmt das Tokenzeichen ueberein, dann erhoehe nTok
+ if ( (*this).GetChar(i) == cTok )
+ {
+ // Vorzeitiger Abbruch der Schleife moeglich, denn
+ // wir haben, was wir wollten.
+ nStartPos = i+1;
+ break;
+ }
+ else
+ {
+ _rStr += (*this).GetChar(i); // Zeichen gehoert zum Resultat-String
+ }
+ }
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void OEvoabTable::refreshIndexes()
+{
+}
+// -----------------------------------------------------------------------------
+sal_Bool OEvoabTable::checkHeaderLine()
+{
+ if (m_nFilePos == 0 && ((OEvoabConnection*)m_pConnection)->isHeaderLine())
+ {
+ BOOL bRead2;
+ do
+ {
+ bRead2 = m_pFileStream->ReadByteStringLine(m_aCurrentLine,m_pConnection->getTextEncoding());
+ }
+ while(bRead2 && !m_aCurrentLine.Len());
+
+ m_nFilePos = m_pFileStream->Tell();
+ if (m_pFileStream->IsEof())
+ return sal_False;
+ }
+ return sal_True;
+}
+//------------------------------------------------------------------
+sal_Bool OEvoabTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos)
+{
+ //OSL_TRACE("OEvoabTable::(before SeekRow)m_aCurrentLine = %d\n", ((OUtoCStr(::rtl::OUString(m_aCurrentLine))) ? (OUtoCStr(::rtl::OUString(m_aCurrentLine))):("NULL")) );
+
+ if ( !m_pFileStream )
+ return sal_False;
+ OEvoabConnection* pConnection = (OEvoabConnection*)m_pConnection;
+ // ----------------------------------------------------------
+ // Positionierung vorbereiten:
+ //OSL_TRACE("OEvoabTable::(before SeekRow,m_pFileStriam Exist)m_aCurrentLine = %d\n", ((OUtoCStr(::rtl::OUString(m_aCurrentLine))) ? (OUtoCStr(::rtl::OUString(m_aCurrentLine))):("NULL")) );
+
+ m_nFilePos = nCurPos;
+
+ switch(eCursorPosition)
+ {
+ case IResultSetHelper::FIRST:
+ m_nFilePos = 0;
+ m_nRowPos = 1;
+ // run through
+ case IResultSetHelper::NEXT:
+ if(eCursorPosition != IResultSetHelper::FIRST)
+ ++m_nRowPos;
+ m_pFileStream->Seek(m_nFilePos);
+ if (m_pFileStream->IsEof() || !checkHeaderLine())
+ {
+ m_nMaxRowCount = m_nRowPos;
+ return sal_False;
+ }
+
+ m_aRowToFilePos.insert(::std::map<sal_Int32,sal_Int32>::value_type(m_nRowPos,m_nFilePos));
+
+ m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding());
+ if (m_pFileStream->IsEof())
+ {
+ m_nMaxRowCount = m_nRowPos;
+ return sal_False;
+ }
+ nCurPos = m_pFileStream->Tell();
+ break;
+ case IResultSetHelper::PRIOR:
+ --m_nRowPos;
+ if(m_nRowPos > 0)
+ {
+ m_nFilePos = m_aRowToFilePos.find(m_nRowPos)->second;
+ m_pFileStream->Seek(m_nFilePos);
+ if (m_pFileStream->IsEof() || !checkHeaderLine())
+ return sal_False;
+ m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding());
+ if (m_pFileStream->IsEof())
+ return sal_False;
+ nCurPos = m_pFileStream->Tell();
+ }
+ else
+ m_nRowPos = 0;
+
+ break;
+
+ break;
+ case IResultSetHelper::LAST:
+ if(m_nMaxRowCount)
+ {
+ m_nFilePos = m_aRowToFilePos.rbegin()->second;
+ m_nRowPos = m_aRowToFilePos.rbegin()->first;
+ m_pFileStream->Seek(m_nFilePos);
+ if (m_pFileStream->IsEof() || !checkHeaderLine())
+ return sal_False;
+ m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding());
+ if (m_pFileStream->IsEof())
+ return sal_False;
+ nCurPos = m_pFileStream->Tell();
+ }
+ else
+ {
+ while(seekRow(IResultSetHelper::NEXT,1,nCurPos)) ; // run through after last row
+ // now I know all
+ seekRow(IResultSetHelper::PRIOR,1,nCurPos);
+ }
+ break;
+ case IResultSetHelper::RELATIVE:
+ if(nOffset > 0)
+ {
+ for(sal_Int32 i = 0;i<nOffset;++i)
+ seekRow(IResultSetHelper::NEXT,1,nCurPos);
+ }
+ else if(nOffset < 0)
+ {
+ for(sal_Int32 i = nOffset;i;++i)
+ seekRow(IResultSetHelper::PRIOR,1,nCurPos);
+ }
+ break;
+ case IResultSetHelper::ABSOLUTE:
+ {
+ if(nOffset < 0)
+ nOffset = m_nRowPos + nOffset;
+ ::std::map<sal_Int32,sal_Int32>::const_iterator aIter = m_aRowToFilePos.find(nOffset);
+ if(aIter != m_aRowToFilePos.end())
+ {
+ m_nFilePos = aIter->second;
+ m_pFileStream->Seek(m_nFilePos);
+ if (m_pFileStream->IsEof() || !checkHeaderLine())
+ return sal_False;
+ m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding());
+ if (m_pFileStream->IsEof())
+ return sal_False;
+ nCurPos = m_pFileStream->Tell();
+ }
+ else if(m_nMaxRowCount && nOffset > m_nMaxRowCount) // offset is outside the table
+ {
+ m_nRowPos = m_nMaxRowCount;
+ return sal_False;
+ }
+ else
+ {
+ aIter = m_aRowToFilePos.upper_bound(nOffset);
+ if(aIter == m_aRowToFilePos.end())
+ {
+ m_nRowPos = m_aRowToFilePos.rbegin()->first;
+ nCurPos = m_nFilePos = m_aRowToFilePos.rbegin()->second;
+ while(m_nRowPos != nOffset)
+ seekRow(IResultSetHelper::NEXT,1,nCurPos);
+ }
+ else
+ {
+ --aIter;
+ m_nRowPos = aIter->first;
+ m_nFilePos = aIter->second;
+ m_pFileStream->Seek(m_nFilePos);
+ if (m_pFileStream->IsEof() || !checkHeaderLine())
+ return sal_False;
+ m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding());
+ if (m_pFileStream->IsEof())
+ return sal_False;
+ nCurPos = m_pFileStream->Tell();
+ }
+ }
+ }
+
+ break;
+ case IResultSetHelper::BOOKMARK:
+ m_pFileStream->Seek(nOffset);
+ if (m_pFileStream->IsEof())
+ return sal_False;
+
+ m_nFilePos = m_pFileStream->Tell(); // Byte-Position in der Datei merken (am ZeilenANFANG)
+ m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding());
+ if (m_pFileStream->IsEof())
+ return sal_False;
+ nCurPos = m_pFileStream->Tell();
+ break;
+ }
+
+ //OSL_TRACE("OEvoabTable::(after SeekRow)m_aCurrentLine = %d\n", ((OUtoCStr(::rtl::OUString(m_aCurrentLine))) ? (OUtoCStr(::rtl::OUString(m_aCurrentLine))):("NULL")) );
+
+ return sal_True;
+}
+// -----------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/evoab/LPreparedStatement.cxx b/connectivity/source/drivers/evoab/LPreparedStatement.cxx
new file mode 100644
index 000000000000..fa4269fdce4d
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LPreparedStatement.cxx
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * 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: LPreparedStatement.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * 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_connectivity.hxx"
+#include "LPreparedStatement.hxx"
+#include "LResultSet.hxx"
+
+using namespace connectivity::evoab;
+using namespace connectivity::file;
+using namespace ::com::sun::star::uno;
+// -------------------------------------------------------------------------
+OResultSet* OEvoabPreparedStatement::createResultSet()
+{
+ return new OEvoabResultSet(this,m_aSQLIterator);
+}
+// -------------------------------------------------------------------------
+IMPLEMENT_SERVICE_INFO(OEvoabPreparedStatement,"com.sun.star.sdbc.driver.evoab.PreparedStatement","com.sun.star.sdbc.PreparedStatement");
+
diff --git a/connectivity/source/drivers/evoab/LPreparedStatement.hxx b/connectivity/source/drivers/evoab/LPreparedStatement.hxx
new file mode 100644
index 000000000000..e4260ef3a994
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LPreparedStatement.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: LPreparedStatement.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * 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 _CONNECTIVITY_EVOAB_LPREPAREDSTATEMENT_HXX_
+#define _CONNECTIVITY_EVOAB_LPREPAREDSTATEMENT_HXX_
+
+#include "file/FPreparedStatement.hxx"
+
+namespace connectivity
+{
+ namespace evoab
+ {
+ class OConnection;
+ class OEvoabPreparedStatement : public file::OPreparedStatement
+ {
+ protected:
+ virtual file::OResultSet* createResultSet();
+ public:
+ OEvoabPreparedStatement( file::OConnection* _pConnection) : file::OPreparedStatement( _pConnection){};
+ DECLARE_SERVICE_INFO();
+ };
+ }
+}
+
+#endif //_CONNECTIVITY_EVOAB_LPREPAREDSTATEMENT_HXX_
+
diff --git a/connectivity/source/drivers/evoab/LResultSet.cxx b/connectivity/source/drivers/evoab/LResultSet.cxx
new file mode 100644
index 000000000000..fd4959465710
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LResultSet.cxx
@@ -0,0 +1,193 @@
+/*************************************************************************
+ *
+ * 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: LResultSet.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_connectivity.hxx"
+#include <com/sun/star/sdbcx/CompareBookmark.hpp>
+#include <com/sun/star/sdbcx/XDeleteRows.hpp>
+#include "LResultSet.hxx"
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <comphelper/sequence.hxx>
+#include <comphelper/types.hxx>
+
+using namespace ::comphelper;
+
+using namespace connectivity::evoab;
+using namespace connectivity::file;
+using namespace ::cppu;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::sdbcx;
+// using namespace com::sun::star::container;
+// using namespace com::sun::star::util;
+//------------------------------------------------------------------------------
+OEvoabResultSet::OEvoabResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator)
+ : file::OResultSet(pStmt,_aSQLIterator)
+ ,m_bBookmarkable(sal_True)
+{
+ registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISBOOKMARKABLE), PROPERTY_ID_ISBOOKMARKABLE, PropertyAttribute::READONLY,&m_bBookmarkable, ::getBooleanCppuType());
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL OEvoabResultSet::getImplementationName( ) throw ( RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.evoab.ResultSet");
+}
+// -------------------------------------------------------------------------
+Sequence< ::rtl::OUString > SAL_CALL OEvoabResultSet::getSupportedServiceNames( ) throw( RuntimeException)
+{
+ Sequence< ::rtl::OUString > aSupported(2);
+ aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.ResultSet");
+ aSupported[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.ResultSet");
+ return aSupported;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL OEvoabResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw( RuntimeException)
+{
+ Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
+ const ::rtl::OUString* pSupported = aSupported.getConstArray();
+ const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
+ for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
+ ;
+
+ return pSupported != pEnd;
+}
+// -------------------------------------------------------------------------
+Any SAL_CALL OEvoabResultSet::queryInterface( const Type & rType ) throw(RuntimeException)
+{
+ if(rType == ::getCppuType((const Reference<XDeleteRows>*)0) || rType == ::getCppuType((const Reference<XResultSetUpdate>*)0)
+ || rType == ::getCppuType((const Reference<XRowUpdate>*)0))
+ return Any();
+
+ Any aRet = OResultSet::queryInterface(rType);
+ return aRet.hasValue() ? aRet : OEvoabResultSet_BASE::queryInterface(rType);
+}
+// -------------------------------------------------------------------------
+Sequence< Type > SAL_CALL OEvoabResultSet::getTypes( ) throw( RuntimeException)
+{
+ Sequence< Type > aTypes = OResultSet::getTypes();
+ ::std::vector<Type> aOwnTypes;
+ aOwnTypes.reserve(aTypes.getLength());
+ const Type* pBegin = aTypes.getConstArray();
+ const Type* pEnd = pBegin + aTypes.getLength();
+ for(;pBegin != pEnd;++pBegin)
+ {
+ if(!(*pBegin == ::getCppuType((const Reference<XDeleteRows>*)0) ||
+ *pBegin == ::getCppuType((const Reference<XResultSetUpdate>*)0) ||
+ *pBegin == ::getCppuType((const Reference<XRowUpdate>*)0)))
+ {
+ aOwnTypes.push_back(*pBegin);
+ }
+ }
+ Type *pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
+ Sequence< Type > aRet(pTypes, aOwnTypes.size());
+ return ::comphelper::concatSequences(aRet,OEvoabResultSet_BASE::getTypes());
+}
+
+// -------------------------------------------------------------------------
+// XRowLocate
+Any SAL_CALL OEvoabResultSet::getBookmark( ) throw( SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+
+ return makeAny((sal_Int32)(m_aRow->get())[0]->getValue());
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL OEvoabResultSet::moveToBookmark( const Any& bookmark ) throw( SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+
+ m_bRowDeleted = m_bRowInserted = m_bRowUpdated = sal_False;
+
+ return Move(IResultSetHelper::BOOKMARK,comphelper::getINT32(bookmark),sal_True);
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL OEvoabResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw( SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+
+ m_bRowDeleted = m_bRowInserted = m_bRowUpdated = sal_False;
+
+ Move(IResultSetHelper::BOOKMARK,comphelper::getINT32(bookmark),sal_False);
+
+ return relative(rows);
+}
+
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL OEvoabResultSet::compareBookmarks( const Any& lhs, const Any& rhs ) throw( SQLException, RuntimeException)
+{
+ return (lhs == rhs) ? 0 : 2;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL OEvoabResultSet::hasOrderedBookmarks( ) throw( SQLException, RuntimeException)
+{
+ return sal_True;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL OEvoabResultSet::hashBookmark( const Any& bookmark ) throw( SQLException, RuntimeException)
+{
+ return comphelper::getINT32(bookmark);
+}
+// -------------------------------------------------------------------------
+IPropertyArrayHelper* OEvoabResultSet::createArrayHelper( ) const
+{
+ Sequence< Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+}
+// -------------------------------------------------------------------------
+IPropertyArrayHelper & OEvoabResultSet::getInfoHelper()
+{
+ return *OEvoabResultSet_BASE3::getArrayHelper();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OEvoabResultSet::acquire() throw()
+{
+ OEvoabResultSet_BASE2::acquire();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OEvoabResultSet::release() throw()
+{
+ OEvoabResultSet_BASE2::release();
+}
+// -----------------------------------------------------------------------------
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OEvoabResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
+}
+// -----------------------------------------------------------------------------
+
diff --git a/connectivity/source/drivers/evoab/LResultSet.hxx b/connectivity/source/drivers/evoab/LResultSet.hxx
new file mode 100644
index 000000000000..f93ba9364e5a
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LResultSet.hxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * 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: LResultSet.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * 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 _CONNECTIVITY_EVOAB_LRESULTSET_HXX_
+#define _CONNECTIVITY_EVOAB_LRESULTSET_HXX_
+
+#include "file/FResultSet.hxx"
+#include <com/sun/star/sdbcx/XRowLocate.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+namespace connectivity
+{
+ namespace evoab
+ {
+ class OEvoabResultSet;
+ // these typedef's are only necessary for the compiler
+ typedef ::cppu::ImplHelper1< ::com::sun::star::sdbcx::XRowLocate> OEvoabResultSet_BASE;
+ typedef file::OResultSet OEvoabResultSet_BASE2;
+ typedef ::comphelper::OPropertyArrayUsageHelper<OEvoabResultSet> OEvoabResultSet_BASE3;
+
+
+ class OEvoabResultSet : public OEvoabResultSet_BASE2,
+ public OEvoabResultSet_BASE,
+ public OEvoabResultSet_BASE3
+ {
+ sal_Bool m_bBookmarkable;
+ protected:
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+ public:
+ DECLARE_SERVICE_INFO();
+
+ OEvoabResultSet( file::OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator);
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XRowLocate
+ virtual ::com::sun::star::uno::Any SAL_CALL getBookmark( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL compareBookmarks( const ::com::sun::star::uno::Any& first, const ::com::sun::star::uno::Any& second ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+#endif //_CONNECTIVITY_EVOAB_LRESULTSET_HXX_
+
diff --git a/connectivity/source/drivers/evoab/LServices.cxx b/connectivity/source/drivers/evoab/LServices.cxx
new file mode 100644
index 000000000000..bab5ae8cfce9
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LServices.cxx
@@ -0,0 +1,178 @@
+/*************************************************************************
+ *
+ * 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: LServices.cxx,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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_connectivity.hxx"
+#include "LDriver.hxx"
+#include <cppuhelper/factory.hxx>
+#include <osl/diagnose.h>
+
+using namespace connectivity::evoab;
+using ::rtl::OUString;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::registry::XRegistryKey;
+using ::com::sun::star::lang::XSingleServiceFactory;
+using ::com::sun::star::lang::XMultiServiceFactory;
+
+typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc)
+ (
+ const Reference< XMultiServiceFactory > & rServiceManager,
+ const OUString & rComponentName,
+ ::cppu::ComponentInstantiation pCreateFunction,
+ const Sequence< OUString > & rServiceNames,
+ rtl_ModuleCount* _pT
+ );
+
+//***************************************************************************************
+//
+// Die vorgeschriebene C-Api muss erfuellt werden!
+// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen.
+//
+
+//---------------------------------------------------------------------------------------
+void REGISTER_PROVIDER(
+ const OUString& aServiceImplName,
+ const Sequence< OUString>& Services,
+ const Reference< ::com::sun::star::registry::XRegistryKey > & xKey)
+{
+ OUString aMainKeyName;
+ aMainKeyName = OUString::createFromAscii("/");
+ aMainKeyName += aServiceImplName;
+ aMainKeyName += OUString::createFromAscii("/UNO/SERVICES");
+
+ Reference< ::com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) );
+ OSL_ENSURE(xNewKey.is(), "FILE::component_writeInfo : could not create a registry key !");
+
+ for (sal_Int32 i=0; i<Services.getLength(); ++i)
+ xNewKey->createKey(Services[i]);
+}
+
+
+//---------------------------------------------------------------------------------------
+struct ProviderRequest
+{
+ Reference< XSingleServiceFactory > xRet;
+ Reference< XMultiServiceFactory > const xServiceManager;
+ OUString const sImplementationName;
+
+ ProviderRequest(
+ void* pServiceManager,
+ sal_Char const* pImplementationName
+ )
+ : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager))
+ , sImplementationName(OUString::createFromAscii(pImplementationName))
+ {
+ }
+
+ inline
+ sal_Bool CREATE_PROVIDER(
+ const OUString& Implname,
+ const Sequence< OUString > & Services,
+ ::cppu::ComponentInstantiation Factory,
+ createFactoryFunc creator
+ )
+ {
+ if (!xRet.is() && (Implname == sImplementationName))
+ try
+ {
+ xRet = creator( xServiceManager, sImplementationName,Factory, Services,0);
+ }
+ catch(...)
+ {
+ }
+ return xRet.is();
+ }
+
+ void* getProvider() const { return xRet.get(); }
+};
+
+//---------------------------------------------------------------------------------------
+
+extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL
+component_getImplementationEnvironment(
+ const sal_Char **ppEnvTypeName,
+ uno_Environment ** /*ppEnv*/
+ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+//---------------------------------------------------------------------------------------
+extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(
+ void* /*pServiceManager*/,
+ void* pRegistryKey
+ )
+{
+ if (pRegistryKey)
+ try
+ {
+ Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey));
+
+ REGISTER_PROVIDER(
+ OEvoabDriver::getImplementationName_Static(),
+ OEvoabDriver::getSupportedServiceNames_Static(), xKey);
+
+ return sal_True;
+ }
+ catch (::com::sun::star::registry::InvalidRegistryException& )
+ {
+ OSL_ENSURE(sal_False, "FILE::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !");
+ }
+
+ return sal_False;
+}
+
+//---------------------------------------------------------------------------------------
+extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
+ const sal_Char* pImplementationName,
+ void* pServiceManager,
+ void* /*pRegistryKey*/)
+{
+ void* pRet = 0;
+ if (pServiceManager)
+ {
+ ProviderRequest aReq(pServiceManager,pImplementationName);
+
+ aReq.CREATE_PROVIDER(
+ OEvoabDriver::getImplementationName_Static(),
+ OEvoabDriver::getSupportedServiceNames_Static(),
+ OEvoabDriver_CreateInstance, ::cppu::createSingleFactory)
+ ;
+
+ if(aReq.xRet.is())
+ aReq.xRet->acquire();
+
+ pRet = aReq.getProvider();
+ }
+
+ return pRet;
+};
+
diff --git a/connectivity/source/drivers/evoab/LStatement.cxx b/connectivity/source/drivers/evoab/LStatement.cxx
new file mode 100644
index 000000000000..9ef945b1ccd4
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LStatement.cxx
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * 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: LStatement.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * 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_connectivity.hxx"
+#include "LStatement.hxx"
+#include "LResultSet.hxx"
+
+using namespace connectivity::evoab;
+using namespace connectivity::file;
+using namespace com::sun::star::uno;
+// -------------------------------------------------------------------------
+OResultSet* OEvoabStatement::createResultSet()
+{
+ return new OEvoabResultSet(this,m_aSQLIterator);
+}
+// -------------------------------------------------------------------------
+IMPLEMENT_SERVICE_INFO(OEvoabStatement,"com.sun.star.sdbc.driver.evoab.Statement","com.sun.star.sdbc.Statement");
+
diff --git a/connectivity/source/drivers/evoab/LStatement.hxx b/connectivity/source/drivers/evoab/LStatement.hxx
new file mode 100644
index 000000000000..9e8af7f7b273
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LStatement.hxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * 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: LStatement.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * 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 _CONNECTIVITY_EVOAB_LSTATEMENT_HXX_
+#define _CONNECTIVITY_EVOAB_LSTATEMENT_HXX_
+
+#include "file/FStatement.hxx"
+
+namespace connectivity
+{
+ namespace evoab
+ {
+ class OConnection;
+ class OEvoabStatement : public file::OStatement
+ {
+ protected:
+ virtual file::OResultSet* createResultSet();
+ public:
+ OEvoabStatement( file::OConnection* _pConnection) : file::OStatement( _pConnection){}
+ DECLARE_SERVICE_INFO();
+ };
+ }
+}
+
+#endif //_CONNECTIVITY_EVOAB_LSTATEMENT_HXX_
diff --git a/connectivity/source/drivers/evoab/LTable.cxx b/connectivity/source/drivers/evoab/LTable.cxx
new file mode 100644
index 000000000000..cbb4bc53e9f4
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LTable.cxx
@@ -0,0 +1,873 @@
+/*************************************************************************
+ *
+ * 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: LTable.cxx,v $
+ * $Revision: 1.18 $
+ *
+ * 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_connectivity.hxx"
+
+#include <ctype.h>
+#include "LTable.hxx"
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/ucb/XContentAccess.hpp>
+#ifndef _COM_SUN_STAR_SQLC_XROW_HPP_
+//#include <com/sun/star/sdbc/XRow.hpp>
+#endif
+#include <svtools/converter.hxx>
+#include "LConnection.hxx"
+#include "LColumns.hxx"
+#include <osl/thread.h>
+#include <tools/config.hxx>
+#include <comphelper/sequence.hxx>
+#include <svtools/zforlist.hxx>
+#include <rtl/math.hxx>
+#include <stdio.h> //sprintf
+#include <comphelper/extract.hxx>
+#include <comphelper/numbers.hxx>
+#include "LDriver.hxx"
+#include <com/sun/star/util/NumberFormat.hpp>
+#include <unotools/configmgr.hxx>
+#include <i18npool/mslangid.hxx>
+#include "connectivity/dbconversion.hxx"
+#include <comphelper/types.hxx>
+#include <svtools/syslocale.hxx>
+#ifndef CONNECTIVITY_EVOAB_DEBUG_HELPER_HXX
+#include "LDebug.hxx"
+#endif
+#include <map>
+
+using namespace ::comphelper;
+using namespace connectivity;
+using namespace connectivity::evoab;
+using namespace connectivity::file;
+using namespace ::cppu;
+using namespace utl;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::ucb;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+
+// -------------------------------------------------------------------------
+void OEvoabTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale)
+{
+ BOOL bRead = TRUE;
+
+ QuotedTokenizedString aHeaderLine;
+ OEvoabConnection* pConnection = (OEvoabConnection*)m_pConnection;
+ if (pConnection->isHeaderLine())
+ {
+ while(bRead && !aHeaderLine.Len())
+ {
+ bRead = m_pFileStream->ReadByteStringLine(aHeaderLine,pConnection->getTextEncoding());
+ }
+ }
+
+ // read first row
+ QuotedTokenizedString aFirstLine;
+ bRead = m_pFileStream->ReadByteStringLine(aFirstLine,pConnection->getTextEncoding());
+
+ if (!pConnection->isHeaderLine() || !aHeaderLine.Len())
+ {
+ while(bRead && !aFirstLine.Len())
+ {
+ bRead = m_pFileStream->ReadByteStringLine(aFirstLine,pConnection->getTextEncoding());
+ }
+ // use first row as headerline because we need the number of columns
+ aHeaderLine = aFirstLine;
+ }
+ // column count
+ xub_StrLen nFieldCount = aHeaderLine.GetTokenCount(pConnection->getFieldDelimiter(),pConnection->getStringDelimiter());
+
+ if(!m_aColumns.isValid())
+ m_aColumns = new OSQLColumns();
+ else
+ m_aColumns->get().clear();
+
+ m_aTypes.clear();
+ m_aPrecisions.clear();
+ m_aScales.clear();
+ // reserve some space
+ m_aColumnRawNames.reserve(nFieldCount);
+ m_aColumns->get().reserve(nFieldCount);
+ m_aTypes.reserve(nFieldCount);
+ m_aPrecisions.reserve(nFieldCount);
+ m_aScales.reserve(nFieldCount);
+
+ sal_Bool bCase = getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers();
+ CharClass aCharClass(pConnection->getDriver()->getFactory(),_aLocale);
+ // read description
+ sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter();
+ sal_Unicode cThousandDelimiter = pConnection->getThousandDelimiter();
+ String aColumnName;
+ ::rtl::OUString aTypeName;
+ ::comphelper::UStringMixEqual aCase(bCase);
+ xub_StrLen nStartPosHeaderLine = 0; // use for eficient way to get the tokens
+ xub_StrLen nStartPosFirstLine = 0; // use for eficient way to get the tokens
+ xub_StrLen nStartPosFirstLine2 = 0;
+ for (xub_StrLen i = 0; i < nFieldCount; i++)
+ {
+ if (pConnection->isHeaderLine())
+ {
+ aHeaderLine.GetTokenSpecial(aColumnName,nStartPosHeaderLine,pConnection->getFieldDelimiter(),pConnection->getStringDelimiter());
+ }
+ else
+ {
+ // no column name so ...
+ aColumnName = 'C';
+ aColumnName += String::CreateFromInt32(i+1);
+ }
+ //OSL_TRACE("OEvoabTable::aColumnName = %s\n", ((OUtoCStr(::rtl::OUString(aColumnName))) ? (OUtoCStr(::rtl::OUString(aColumnName))):("NULL")) );
+
+ sal_Int32 eType;
+ UINT16 nPrecision = 0;
+ UINT16 nScale = 0;
+
+ BOOL bNumeric = FALSE;
+ ULONG nIndex = 0;
+
+ // first without fielddelimiter
+ String aField;
+ aFirstLine.GetTokenSpecial(aField,nStartPosFirstLine,pConnection->getFieldDelimiter(),'\0');
+ //OSL_TRACE("OEvoabTable::aField = %s\n", ((OUtoCStr(::rtl::OUString(aField))) ? (OUtoCStr(::rtl::OUString(aField))):("NULL")) );
+
+ if (aField.Len() == 0 ||
+ (pConnection->getStringDelimiter() && pConnection->getStringDelimiter() == aField.GetChar(0)))
+ {
+ bNumeric = FALSE;
+ }
+ else
+ {
+ String aField2;
+ if ( pConnection->getStringDelimiter() != '\0' )
+ aFirstLine.GetTokenSpecial(aField2,nStartPosFirstLine2,pConnection->getFieldDelimiter(),pConnection->getStringDelimiter());
+ else
+ aField2 = aField;
+
+ //OSL_TRACE("OEvoabTable::aField2 = %s\n", ((OUtoCStr(::rtl::OUString(aField2))) ? (OUtoCStr(::rtl::OUString(aField2))):("NULL")) );
+
+ if (aField2.Len() == 0)
+ {
+ bNumeric = FALSE;
+ }
+ else
+ {
+ bNumeric = TRUE;
+ xub_StrLen nDot = 0;
+ for (xub_StrLen j = 0; j < aField2.Len(); j++)
+ {
+ sal_Unicode c = aField2.GetChar(j);
+ // nur Ziffern und Dezimalpunkt und Tausender-Trennzeichen?
+ if ((!cDecimalDelimiter || c != cDecimalDelimiter) &&
+ (!cThousandDelimiter || c != cThousandDelimiter) &&
+ !aCharClass.isDigit(aField2,j))
+ {
+ bNumeric = FALSE;
+ break;
+ }
+ if (cDecimalDelimiter && c == cDecimalDelimiter)
+ {
+ nPrecision = 15; // we have an decimal value
+ nScale = 2;
+ nDot++;
+ }
+ }
+
+ if (nDot > 1) // if there is more than one dot it isn't a number
+ bNumeric = FALSE;
+ if (bNumeric && cThousandDelimiter)
+ {
+ // Ist der Trenner richtig angegeben?
+ String aValue = aField2.GetToken(0,cDecimalDelimiter);
+ for (sal_Int32 j = aValue.Len() - 4; j >= 0; j -= 4)
+ {
+ sal_Unicode c = aValue.GetChar(j);
+ // nur Ziffern und Dezimalpunkt und Tausender-Trennzeichen?
+ if (c == cThousandDelimiter && j)
+ continue;
+ else
+ {
+ bNumeric = FALSE;
+ break;
+ }
+ }
+ }
+
+ // jetzt koennte es noch ein Datumsfeld sein
+ if (!bNumeric)
+ {
+ try
+ {
+ nIndex = m_xNumberFormatter->detectNumberFormat(::com::sun::star::util::NumberFormat::ALL,aField2);
+ }
+ catch(Exception&)
+ {
+ }
+ }
+ }
+ }
+
+ sal_Int32 nFlags = 0;
+ if (bNumeric)
+ {
+ if (cDecimalDelimiter)
+ {
+ if(nPrecision)
+ {
+ eType = DataType::DECIMAL;
+ aTypeName = ::rtl::OUString::createFromAscii("DECIMAL");
+ }
+ else
+ {
+ eType = DataType::DOUBLE;
+ aTypeName = ::rtl::OUString::createFromAscii("DOUBLE");
+ }
+ }
+ else
+ eType = DataType::INTEGER;
+ nFlags = ColumnSearch::BASIC;
+ }
+ else
+ {
+
+ switch (comphelper::getNumberFormatType(m_xNumberFormatter,nIndex))
+ {
+ case NUMBERFORMAT_DATE:
+ eType = DataType::DATE;
+ aTypeName = ::rtl::OUString::createFromAscii("DATE");
+ break;
+ case NUMBERFORMAT_DATETIME:
+ eType = DataType::TIMESTAMP;
+ aTypeName = ::rtl::OUString::createFromAscii("TIMESTAMP");
+ break;
+ case NUMBERFORMAT_TIME:
+ eType = DataType::TIME;
+ aTypeName = ::rtl::OUString::createFromAscii("TIME");
+ break;
+ default:
+ eType = DataType::VARCHAR;
+ nPrecision = 0; // nyi: Daten koennen aber laenger sein!
+ nScale = 0;
+ aTypeName = ::rtl::OUString::createFromAscii("VARCHAR");
+ };
+ nFlags |= ColumnSearch::CHAR;
+ }
+
+ // check if the columname already exists
+ String aAlias(aColumnName);
+ OSQLColumns::Vector::const_iterator aFind = connectivity::find(m_aColumns->get().begin(),m_aColumns->get().end(),aAlias,aCase);
+ sal_Int32 nExprCnt = 0;
+ while(aFind != m_aColumns->get().end())
+ {
+ (aAlias = aColumnName) += String::CreateFromInt32(++nExprCnt);
+ aFind = connectivity::find(m_aColumns->get().begin(),m_aColumns->get().end(),aAlias,aCase);
+ }
+
+ m_aColumnRawNames.push_back(::rtl::OUString(aAlias));
+
+ //~ sdbcx::OColumn* pColumn = new sdbcx::OColumn(aAlias,aTypeName,::rtl::OUString(),
+ //~ ColumnValue::NULLABLE,
+ //~ nPrecision,
+ //~ nScale,
+ //~ eType,
+ //~ sal_False,
+ //~ sal_False,
+ //~ sal_False,
+ //~ bCase);
+ //~ Reference< XPropertySet> xCol = pColumn;
+ //~ m_aColumns->push_back(xCol);
+ m_aTypes.push_back(eType);
+ m_aPrecisions.push_back(nPrecision);
+ m_aScales.push_back(nScale);
+ }
+ setColumnAliases();
+ m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN);
+}
+// -------------------------------------------------------------------------
+OEvoabTable::OEvoabTable(sdbcx::OCollection* _pTables,OEvoabConnection* _pConnection) : OEvoabTable_BASE(_pTables,_pConnection)
+{
+
+}
+// -------------------------------------------------------------------------
+OEvoabTable::OEvoabTable(sdbcx::OCollection* _pTables,OEvoabConnection* _pConnection,
+ const ::rtl::OUString& _Name,
+ const ::rtl::OUString& _Type,
+ const ::rtl::OUString& _Description ,
+ const ::rtl::OUString& _SchemaName,
+ const ::rtl::OUString& _CatalogName
+ ) : OEvoabTable_BASE(_pTables,_pConnection,_Name,
+ _Type,
+ _Description,
+ _SchemaName,
+ _CatalogName)
+ ,m_nRowPos(0)
+ ,m_nMaxRowCount(0)
+{
+ //~ OSL_TRACE("OEvoabTable::(in constructor)_Name = %s\n", ((OUtoCStr(_Name)) ? (OUtoCStr(_Name)):("NULL")) );
+ //~ OSL_TRACE("OEvoabTable::(in constructor)_Type = %s\n", ((OUtoCStr(_Type)) ? (OUtoCStr(_Type)):("NULL")) );
+ //~ OSL_TRACE("OEvoabTable::(in constructor)_Description = %s\n", ((OUtoCStr(_Description)) ? (OUtoCStr(_Description)):("NULL")) );
+ //~ OSL_TRACE("OEvoabTable::(in constructor)_SchemaName = %s\n", ((OUtoCStr(_SchemaName)) ? (OUtoCStr(_SchemaName)):("NULL")) );
+ //~ OSL_TRACE("OEvoabTable::(in constructor)_CatalogName = %s\n", ((OUtoCStr(_CatalogName)) ? (OUtoCStr(_CatalogName)):("NULL")) );
+}
+// -----------------------------------------------------------------------------
+void OEvoabTable::construct()
+{
+ SvtSysLocale aLocale;
+ ::com::sun::star::lang::Locale aAppLocale(aLocale.GetLocaleDataPtr()->getLocale());
+ Sequence< ::com::sun::star::uno::Any > aArg(1);
+ aArg[0] <<= aAppLocale;
+
+ Reference< ::com::sun::star::util::XNumberFormatsSupplier > xSupplier(m_pConnection->getDriver()->getFactory()->createInstanceWithArguments(::rtl::OUString::createFromAscii("com.sun.star.util.NumberFormatsSupplier"),aArg),UNO_QUERY);
+ m_xNumberFormatter = Reference< ::com::sun::star::util::XNumberFormatter >(m_pConnection->getDriver()->getFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.util.NumberFormatter")),UNO_QUERY);
+ m_xNumberFormatter->attachNumberFormatsSupplier(xSupplier);
+
+ INetURLObject aURL;
+ aURL.SetURL(getEntry());
+
+ if(aURL.getExtension() != rtl::OUString(m_pConnection->getExtension()))
+ aURL.setExtension(m_pConnection->getExtension());
+
+ String aFileName = aURL.GetMainURL(INetURLObject::NO_DECODE);
+
+ m_pFileStream = createStream_simpleError( aFileName,STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE);
+
+ if(!m_pFileStream)
+ m_pFileStream = createStream_simpleError( aFileName,STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYNONE);
+
+ if(m_pFileStream)
+ {
+ OSL_TRACE("OEvoabTable::construct()::m_pFileStream created\n" );
+ m_pFileStream->Seek(STREAM_SEEK_TO_END);
+ sal_Int32 nSize = m_pFileStream->Tell();
+ m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN);
+
+ // Buffersize abhaengig von der Filegroesse
+ m_pFileStream->SetBufferSize(nSize > 1000000 ? 32768 :
+ nSize > 100000 ? 16384 :
+ nSize > 10000 ? 4096 : 1024);
+ OSL_TRACE("OEvoabTable::construct()::m_pFileStream->Tell() = %d\n", nSize );
+
+ fillColumns(aAppLocale);
+
+ refreshColumns();
+ }
+}
+// -------------------------------------------------------------------------
+String OEvoabTable::getEntry()
+{
+ ::rtl::OUString sURL;
+ try
+ {
+ Reference< XResultSet > xDir = m_pConnection->getDir()->getStaticResultSet();
+ Reference< XRow> xRow(xDir,UNO_QUERY);
+ ::rtl::OUString sName;
+ ::rtl::OUString sExt;
+
+ INetURLObject aURL;
+ xDir->beforeFirst();
+ static const ::rtl::OUString s_sSeparator(RTL_CONSTASCII_USTRINGPARAM("/"));
+ while(xDir->next())
+ {
+ sName = xRow->getString(1);
+ aURL.SetSmartProtocol(INET_PROT_FILE);
+ String sUrl = m_pConnection->getURL() + s_sSeparator + sName;
+ aURL.SetSmartURL( sUrl );
+
+ // cut the extension
+ sExt = aURL.getExtension();
+
+ // name and extension have to coincide
+ if ( m_pConnection->matchesExtension( sExt ) )
+ {
+ sName = sName.replaceAt(sName.getLength()-(sExt.getLength()+1),sExt.getLength()+1,::rtl::OUString());
+ if ( sName == m_Name )
+ {
+ Reference< XContentAccess > xContentAccess( xDir, UNO_QUERY );
+ sURL = xContentAccess->queryContentIdentifierString();
+ break;
+ }
+ }
+ }
+ xDir->beforeFirst(); // move back to before first record
+ }
+ catch(Exception&)
+ {
+ OSL_ASSERT(0);
+ }
+ return sURL.getStr();
+}
+// -------------------------------------------------------------------------
+void OEvoabTable::refreshColumns()
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ TStringVector aVector;
+ aVector.reserve(m_aColumns->get().size());
+
+ for(OSQLColumns::Vector::const_iterator aIter = m_aColumns->get().begin();aIter != m_aColumns->get().end();++aIter)
+ aVector.push_back(Reference< XNamed>(*aIter,UNO_QUERY)->getName());
+
+ if(m_pColumns)
+ m_pColumns->reFill(aVector);
+ else
+ m_pColumns = new OEvoabColumns(this,m_aMutex,aVector);
+
+ OSL_TRACE("OEvoabTable::refreshColumns()::end\n" );
+}
+
+// -------------------------------------------------------------------------
+void SAL_CALL OEvoabTable::disposing(void)
+{
+ OFileTable::disposing();
+ ::osl::MutexGuard aGuard(m_aMutex);
+ m_aColumns = NULL;
+}
+// -------------------------------------------------------------------------
+Sequence< Type > SAL_CALL OEvoabTable::getTypes( ) throw(RuntimeException)
+{
+ Sequence< Type > aTypes = OTable_TYPEDEF::getTypes();
+ ::std::vector<Type> aOwnTypes;
+ aOwnTypes.reserve(aTypes.getLength());
+ const Type* pBegin = aTypes.getConstArray();
+ const Type* pEnd = pBegin + aTypes.getLength();
+ for(;pBegin != pEnd;++pBegin)
+ {
+ if(!(*pBegin == ::getCppuType((const Reference<XKeysSupplier>*)0) ||
+ *pBegin == ::getCppuType((const Reference<XRename>*)0) ||
+ *pBegin == ::getCppuType((const Reference<XIndexesSupplier>*)0) ||
+ *pBegin == ::getCppuType((const Reference<XAlterTable>*)0) ||
+ *pBegin == ::getCppuType((const Reference<XDataDescriptorFactory>*)0)))
+ {
+ aOwnTypes.push_back(*pBegin);
+ }
+ }
+ Type *pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
+ return Sequence< Type >(pTypes, aOwnTypes.size());
+}
+
+// -------------------------------------------------------------------------
+Any SAL_CALL OEvoabTable::queryInterface( const Type & rType ) throw(RuntimeException)
+{
+ if( rType == ::getCppuType((const Reference<XKeysSupplier>*)0) ||
+ rType == ::getCppuType((const Reference<XIndexesSupplier>*)0) ||
+ rType == ::getCppuType((const Reference<XRename>*)0) ||
+ rType == ::getCppuType((const Reference<XAlterTable>*)0) ||
+ rType == ::getCppuType((const Reference<XDataDescriptorFactory>*)0))
+ return Any();
+
+ Any aRet = OTable_TYPEDEF::queryInterface(rType);
+ return aRet.hasValue() ? aRet : ::cppu::queryInterface(rType,static_cast< ::com::sun::star::lang::XUnoTunnel*> (this));
+}
+
+//--------------------------------------------------------------------------
+Sequence< sal_Int8 > OEvoabTable::getUnoTunnelImplementationId()
+{
+ static ::cppu::OImplementationId * pId = 0;
+ if (! pId)
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if (! pId)
+ {
+ static ::cppu::OImplementationId aId;
+ pId = &aId;
+ }
+ }
+ return pId->getImplementationId();
+}
+
+// com::sun::star::lang::XUnoTunnel
+//------------------------------------------------------------------
+sal_Int64 OEvoabTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
+{
+ return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
+ ? reinterpret_cast< sal_Int64 >( this )
+ : OEvoabTable_BASE::getSomething(rId);
+}
+//------------------------------------------------------------------
+sal_Bool OEvoabTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sal_Bool bIsTable,sal_Bool bRetrieveData)
+{
+ *(_rRow->get())[0] = m_nFilePos;
+
+ if (!bRetrieveData)
+ return TRUE;
+
+ OEvoabConnection* pConnection = (OEvoabConnection*)m_pConnection;
+ // Felder:
+ xub_StrLen nStartPos = 0;
+ String aStr;
+ OSQLColumns::Vector::const_iterator aIter = _rCols.get().begin();
+ for (sal_Int32 i = 0; aIter != _rCols.get().end();++aIter, ++i)
+ {
+ m_aCurrentLine.GetTokenSpecial(aStr,nStartPos,pConnection->getFieldDelimiter(),pConnection->getStringDelimiter());
+ //OSL_TRACE("OEvoabTable::fetchRow()::aStr = %s\n", ((OUtoCStr(::rtl::OUString(aStr))) ? (OUtoCStr(::rtl::OUString(aStr))):("NULL")) );
+
+ if (aStr.Len() == 0)
+ (_rRow->get())[i+1]->setNull();
+ else
+ {
+ // Laengen je nach Datentyp:
+ sal_Int32 nLen,
+ nType = 0;
+ if(bIsTable)
+ {
+ nLen = m_aPrecisions[i];
+ nType = m_aTypes[i];
+ }
+ else
+ {
+ Reference< XPropertySet> xColumn = *aIter;
+ xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)) >>= nLen;
+ xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nType;
+ }
+ switch(nType)
+ {
+ case DataType::TIMESTAMP:
+ case DataType::DATE:
+ case DataType::TIME:
+ {
+ double nRes = 0.0;
+ try
+ {
+ nRes = m_xNumberFormatter->convertStringToNumber(::com::sun::star::util::NumberFormat::ALL,aStr);
+ Reference<XPropertySet> xProp(m_xNumberFormatter->getNumberFormatsSupplier()->getNumberFormatSettings(),UNO_QUERY);
+ com::sun::star::util::Date aDate;
+ xProp->getPropertyValue(::rtl::OUString::createFromAscii("NullDate")) >>= aDate;
+
+ switch(nType)
+ {
+ case DataType::DATE:
+ *(_rRow->get())[i+1] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDate(nRes,aDate));
+ break;
+ case DataType::TIMESTAMP:
+ *(_rRow->get())[i+1] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDateTime(nRes,aDate));
+ break;
+ default:
+ *(_rRow->get())[i+1] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toTime(nRes));
+ }
+ }
+ catch(Exception&)
+ {
+ (_rRow->get())[i+1]->setNull();
+ }
+ } break;
+ case DataType::DOUBLE:
+ case DataType::INTEGER:
+ case DataType::DECIMAL: // #99178# OJ
+ case DataType::NUMERIC:
+ {
+ sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter();
+ sal_Unicode cThousandDelimiter = pConnection->getThousandDelimiter();
+ String aStrConverted;
+
+ OSL_ENSURE(cDecimalDelimiter && nType != DataType::INTEGER ||
+ !cDecimalDelimiter && nType == DataType::INTEGER,
+ "FalscherTyp");
+
+ // In Standard-Notation (DezimalPUNKT ohne Tausender-Komma) umwandeln:
+ for (xub_StrLen j = 0; j < aStr.Len(); ++j)
+ {
+ if (cDecimalDelimiter && aStr.GetChar(j) == cDecimalDelimiter)
+ aStrConverted += '.';
+ else if ( aStr.GetChar(j) == '.' ) // special case, if decimal seperator isn't '.' we have to vut the string after it
+ break; // #99189# OJ
+ else if (cThousandDelimiter && aStr.GetChar(j) == cThousandDelimiter)
+ {
+ // weglassen
+ }
+ else
+ aStrConverted += aStr.GetChar(j) ;
+ }
+ double nVal = ::rtl::math::stringToDouble(aStrConverted.GetBuffer(),',','.',NULL,NULL);
+
+ // #99178# OJ
+ if ( DataType::DECIMAL == nType || DataType::NUMERIC == nType )
+ *(_rRow->get())[i+1] = ORowSetValue(String::CreateFromDouble(nVal));
+ else
+ *(_rRow->get())[i+1] = nVal;
+ } break;
+
+ default:
+ {
+ // Wert als String in Variable der Row uebernehmen
+ *(_rRow->get())[i+1] = ORowSetValue(aStr);
+ }
+ break;
+ }
+ }
+ }
+ return sal_True;
+}
+// -----------------------------------------------------------------------------
+sal_Bool OEvoabTable::setColumnAliases()
+{
+
+ size_t nSize = m_aColumnRawNames.size();
+ if(nSize == 0 || m_aPrecisions.size() != nSize || m_aScales.size() != nSize || m_aTypes.size() != nSize)
+ return sal_False;
+ m_aColumns->get().clear();
+ m_aColumns->get().reserve(nSize);
+ ::rtl::OUString aColumnReadName;
+ ::rtl::OUString aColumnHeadlineName;
+ ::rtl::OUString aColumnDisplayName;
+ ::rtl::OUString aColumnFinalName;
+ String sColumnFinalName;
+
+ const TStringVector& colAliasNames = ((OEvoabConnection*)m_pConnection)->getColumnAlias().getAlias();
+ const ::std::map< ::rtl::OUString, ::rtl::OUString > & colMap = ((OEvoabConnection*)m_pConnection)->getColumnAlias().getAliasMap();
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ for(size_t i = 0;i < nSize; ++i)
+ {
+ aColumnReadName = m_aColumnRawNames[i];
+ //OSL_TRACE("OEvoabTable::getColumnRows()::aColumnReadName = %s\n", ((OUtoCStr(aColumnReadName)) ? (OUtoCStr(aColumnReadName)):("NULL")) );
+ sal_Bool bFound = sal_False;
+ for ( size_t j = 0; j < colAliasNames.size(); ++j )
+ {
+ aColumnDisplayName = colAliasNames[j];
+
+ ::std::map< ::rtl::OUString, ::rtl::OUString >::const_iterator aPos = colMap.find( aColumnDisplayName );
+ if ( colMap.end() != aPos )
+ {
+ aColumnHeadlineName = aPos->second;
+ EVO_TRACE_STRING( "OEvoabTable::getColumnRows()::aColumnDisplayName = %s\n", aColumnDisplayName );
+ EVO_TRACE_STRING( "OEvoabTable::getColumnRows()::aColumnHeadlineName= %s\n", aColumnHeadlineName );
+ if(aColumnReadName == aColumnHeadlineName)
+ {
+ //OSL_TRACE("OEvoabTable::getColumnRows()::aColumnHeadlineName = %s\n", ((OUtoCStr(aColumnHeadlineName)) ? (OUtoCStr(aColumnHeadlineName)):("NULL")) );
+ //OSL_TRACE("OEvoabTable::getColumnRows()::aColumnDisplayName = %s\n", ((OUtoCStr(aColumnDisplayName)) ? (OUtoCStr(aColumnDisplayName)):("NULL")) );
+ aColumnFinalName = aColumnDisplayName;
+ bFound = sal_True;
+ //OSL_TRACE("OEvoabTable::getColumnRows()::j = %d\n", j );
+
+ break;
+ }
+ }
+ else
+ OSL_ENSURE( sal_False, "OEvoabTable::setColumnAliases: did not find one of the aliases!" );
+ }
+ if(!bFound)
+ aColumnFinalName = aColumnReadName;
+ sColumnFinalName = aColumnFinalName;
+
+ sal_Bool bCase = getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers();
+ ::rtl::OUString aTypeName;
+ aTypeName = ::rtl::OUString::createFromAscii("VARCHAR");
+ sdbcx::OColumn* pColumn = new sdbcx::OColumn(sColumnFinalName,aTypeName,::rtl::OUString(),
+ ColumnValue::NULLABLE,
+ m_aPrecisions[i],
+ m_aScales[i],
+ m_aTypes[i],
+ sal_False,
+ sal_False,
+ sal_False,
+ bCase);
+ Reference< XPropertySet> xCol = pColumn;
+ m_aColumns->get().push_back(xCol);
+ }
+ return sal_True;
+}
+// -----------------------------------------------------------------------------
+void OEvoabTable::refreshIndexes()
+{
+}
+// -----------------------------------------------------------------------------
+sal_Bool OEvoabTable::checkHeaderLine()
+{
+ if (m_nFilePos == 0 && ((OEvoabConnection*)m_pConnection)->isHeaderLine())
+ {
+ BOOL bRead2;
+ do
+ {
+ bRead2 = m_pFileStream->ReadByteStringLine(m_aCurrentLine,m_pConnection->getTextEncoding());
+ }
+ while(bRead2 && !m_aCurrentLine.Len());
+
+ m_nFilePos = m_pFileStream->Tell();
+ if (m_pFileStream->IsEof())
+ return sal_False;
+ }
+ return sal_True;
+}
+//------------------------------------------------------------------
+sal_Bool OEvoabTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos)
+{
+ //OSL_TRACE("OEvoabTable::(before SeekRow)m_aCurrentLine = %d\n", ((OUtoCStr(::rtl::OUString(m_aCurrentLine))) ? (OUtoCStr(::rtl::OUString(m_aCurrentLine))):("NULL")) );
+
+ if ( !m_pFileStream )
+ return sal_False;
+ OEvoabConnection* pConnection = (OEvoabConnection*)m_pConnection;
+ // ----------------------------------------------------------
+ // Positionierung vorbereiten:
+ //OSL_TRACE("OEvoabTable::(before SeekRow,m_pFileStriam Exist)m_aCurrentLine = %d\n", ((OUtoCStr(::rtl::OUString(m_aCurrentLine))) ? (OUtoCStr(::rtl::OUString(m_aCurrentLine))):("NULL")) );
+
+ m_nFilePos = nCurPos;
+
+ switch(eCursorPosition)
+ {
+ case IResultSetHelper::FIRST:
+ m_nFilePos = 0;
+ m_nRowPos = 1;
+ // run through
+ case IResultSetHelper::NEXT:
+ if(eCursorPosition != IResultSetHelper::FIRST)
+ ++m_nRowPos;
+ m_pFileStream->Seek(m_nFilePos);
+ if (m_pFileStream->IsEof() || !checkHeaderLine())
+ {
+ m_nMaxRowCount = m_nRowPos;
+ return sal_False;
+ }
+
+ m_aRowToFilePos.insert(::std::map<sal_Int32,sal_Int32>::value_type(m_nRowPos,m_nFilePos));
+
+ m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding());
+ if (m_pFileStream->IsEof())
+ {
+ m_nMaxRowCount = m_nRowPos;
+ return sal_False;
+ }
+ nCurPos = m_pFileStream->Tell();
+ break;
+ case IResultSetHelper::PRIOR:
+ --m_nRowPos;
+ if(m_nRowPos > 0)
+ {
+ m_nFilePos = m_aRowToFilePos.find(m_nRowPos)->second;
+ m_pFileStream->Seek(m_nFilePos);
+ if (m_pFileStream->IsEof() || !checkHeaderLine())
+ return sal_False;
+ m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding());
+ if (m_pFileStream->IsEof())
+ return sal_False;
+ nCurPos = m_pFileStream->Tell();
+ }
+ else
+ m_nRowPos = 0;
+
+ break;
+ case IResultSetHelper::LAST:
+ if(m_nMaxRowCount)
+ {
+ m_nFilePos = m_aRowToFilePos.rbegin()->second;
+ m_nRowPos = m_aRowToFilePos.rbegin()->first;
+ m_pFileStream->Seek(m_nFilePos);
+ if (m_pFileStream->IsEof() || !checkHeaderLine())
+ return sal_False;
+ m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding());
+ if (m_pFileStream->IsEof())
+ return sal_False;
+ nCurPos = m_pFileStream->Tell();
+ }
+ else
+ {
+ while(seekRow(IResultSetHelper::NEXT,1,nCurPos)) ; // run through after last row
+ // now I know all
+ seekRow(IResultSetHelper::PRIOR,1,nCurPos);
+ }
+ break;
+ case IResultSetHelper::RELATIVE:
+ if(nOffset > 0)
+ {
+ for(sal_Int32 i = 0;i<nOffset;++i)
+ seekRow(IResultSetHelper::NEXT,1,nCurPos);
+ }
+ else if(nOffset < 0)
+ {
+ for(sal_Int32 i = nOffset;i;++i)
+ seekRow(IResultSetHelper::PRIOR,1,nCurPos);
+ }
+ break;
+ case IResultSetHelper::ABSOLUTE:
+ {
+ if(nOffset < 0)
+ nOffset = m_nRowPos + nOffset;
+ ::std::map<sal_Int32,sal_Int32>::const_iterator aIter = m_aRowToFilePos.find(nOffset);
+ if(aIter != m_aRowToFilePos.end())
+ {
+ m_nFilePos = aIter->second;
+ m_pFileStream->Seek(m_nFilePos);
+ if (m_pFileStream->IsEof() || !checkHeaderLine())
+ return sal_False;
+ m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding());
+ if (m_pFileStream->IsEof())
+ return sal_False;
+ nCurPos = m_pFileStream->Tell();
+ }
+ else if(m_nMaxRowCount && nOffset > m_nMaxRowCount) // offset is outside the table
+ {
+ m_nRowPos = m_nMaxRowCount;
+ return sal_False;
+ }
+ else
+ {
+ aIter = m_aRowToFilePos.upper_bound(nOffset);
+ if(aIter == m_aRowToFilePos.end())
+ {
+ m_nRowPos = m_aRowToFilePos.rbegin()->first;
+ nCurPos = m_nFilePos = m_aRowToFilePos.rbegin()->second;
+ while(m_nRowPos != nOffset)
+ seekRow(IResultSetHelper::NEXT,1,nCurPos);
+ }
+ else
+ {
+ --aIter;
+ m_nRowPos = aIter->first;
+ m_nFilePos = aIter->second;
+ m_pFileStream->Seek(m_nFilePos);
+ if (m_pFileStream->IsEof() || !checkHeaderLine())
+ return sal_False;
+ m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding());
+ if (m_pFileStream->IsEof())
+ return sal_False;
+ nCurPos = m_pFileStream->Tell();
+ }
+ }
+ }
+
+ break;
+ case IResultSetHelper::BOOKMARK:
+ m_pFileStream->Seek(nOffset);
+ if (m_pFileStream->IsEof())
+ return sal_False;
+
+ m_nFilePos = m_pFileStream->Tell(); // Byte-Position in der Datei merken (am ZeilenANFANG)
+ m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding());
+ if (m_pFileStream->IsEof())
+ return sal_False;
+ nCurPos = m_pFileStream->Tell();
+ break;
+ }
+
+ //OSL_TRACE("OEvoabTable::(after SeekRow)m_aCurrentLine = %d\n", ((OUtoCStr(::rtl::OUString(m_aCurrentLine))) ? (OUtoCStr(::rtl::OUString(m_aCurrentLine))):("NULL")) );
+
+ return sal_True;
+}
+// -----------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/evoab/LTable.hxx b/connectivity/source/drivers/evoab/LTable.hxx
new file mode 100644
index 000000000000..360e4487cf09
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LTable.hxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * 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: LTable.hxx,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 _CONNECTIVITY_EVOAB_LTABLE_HXX_
+#define _CONNECTIVITY_EVOAB_LTABLE_HXX_
+
+#include "file/FTable.hxx"
+#include "connectivity/sdbcx/VColumn.hxx"
+#include "connectivity/CommonTools.hxx"
+#include <tools/urlobj.hxx>
+#include "file/quotedstring.hxx"
+#include <vector>
+
+namespace connectivity
+{
+ namespace evoab
+ {
+ typedef file::OFileTable OEvoabTable_BASE;
+ class OEvoabConnection;
+
+ typedef ::std::map< ::rtl::OUString,
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed>, comphelper::UStringMixLess > OContainer;
+
+ class OEvoabTable : public OEvoabTable_BASE
+ {
+ private:
+ // maps a row postion to a file position
+ ::std::map<sal_Int32,sal_Int32> m_aRowToFilePos;
+ ::std::vector<sal_Int32> m_aTypes; // holds all type for columns just to avoid to ask the propertyset
+ ::std::vector<sal_Int32> m_aPrecisions; // same as aboth
+ ::std::vector<sal_Int32> m_aScales;
+ QuotedTokenizedString m_aCurrentLine;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xNumberFormatter;
+ sal_Int32 m_nRowPos;
+ sal_Int32 m_nMaxRowCount; // will be set if stream is once eof
+ ::std::vector< ::rtl::OUString> m_aColumnRawNames;
+ sal_Bool setColumnAliases();
+ void fillColumns(const ::com::sun::star::lang::Locale& _aLocale);
+ sal_Bool checkHeaderLine();
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet> isUniqueByColumnName(const ::rtl::OUString& _rColName);
+
+ public:
+ virtual void refreshColumns();
+ virtual void refreshIndexes();
+
+ public:
+ // DECLARE_CTY_DEFAULTS( OFlatTable_BASE);
+ OEvoabTable( sdbcx::OCollection* _pTables,OEvoabConnection* _pConnection);
+ OEvoabTable( sdbcx::OCollection* _pTables,OEvoabConnection* _pConnection,
+ const ::rtl::OUString& _Name,
+ const ::rtl::OUString& _Type,
+ const ::rtl::OUString& _Description = ::rtl::OUString(),
+ const ::rtl::OUString& _SchemaName = ::rtl::OUString(),
+ const ::rtl::OUString& _CatalogName = ::rtl::OUString()
+ );
+
+ void construct(); // can throw any exception
+
+ virtual sal_Bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos);
+ virtual sal_Bool fetchRow(OValueRefRow& _rRow,const OSQLColumns& _rCols, sal_Bool bIsTable,sal_Bool bRetrieveData);
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL disposing(void);
+
+ // com::sun::star::lang::XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
+
+ String getEntry();
+ };
+ }
+}
+#endif // _CONNECTIVITY_EVOAB_LTABLE_HXX_
+
diff --git a/connectivity/source/drivers/evoab/LTables.cxx b/connectivity/source/drivers/evoab/LTables.cxx
new file mode 100644
index 000000000000..7465c890f240
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LTables.cxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * 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: LTables.cxx,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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_connectivity.hxx"
+#include "LTables.hxx"
+#include "LTable.hxx"
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#include <com/sun/star/sdbc/KeyRule.hpp>
+#include <com/sun/star/sdbcx/KeyType.hpp>
+#include "file/FCatalog.hxx"
+#include "file/FConnection.hxx"
+#include <comphelper/types.hxx>
+
+using namespace connectivity;
+using namespace ::comphelper;
+using namespace connectivity::evoab;
+using namespace connectivity::file;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+namespace starutil = ::com::sun::star::util;
+
+sdbcx::ObjectType OEvoabTables::createObject(const ::rtl::OUString& _rName)
+{
+ OEvoabTable* pRet = new OEvoabTable(this,(OEvoabConnection*)static_cast<OFileCatalog&>(m_rParent).getConnection(),
+ _rName,::rtl::OUString::createFromAscii("TABLE"));
+ sdbcx::ObjectType xRet = pRet;
+ pRet->construct();
+ return xRet;
+}
+// -------------------------------------------------------------------------
+
diff --git a/connectivity/source/drivers/evoab/LTables.hxx b/connectivity/source/drivers/evoab/LTables.hxx
new file mode 100644
index 000000000000..3fcaaa7d8e58
--- /dev/null
+++ b/connectivity/source/drivers/evoab/LTables.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * 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: LTables.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * 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 _CONNECTIVITY_EVOAB_LTABLES_HXX_
+#define _CONNECTIVITY_EVOAB_LTABLES_HXX_
+
+#include "file/FTables.hxx"
+
+namespace connectivity
+{
+ namespace evoab
+ {
+ // namespace ::com::sun::star::sdbcx = ::com::sun::star::sdbcx;
+ typedef file::OTables OEvoabTables_BASE;
+
+ class OEvoabTables : public OEvoabTables_BASE
+ {
+ protected:
+ virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
+ public:
+ OEvoabTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
+ const TStringVector &_rVector) : OEvoabTables_BASE(_rMetaData,_rParent,_rMutex,_rVector)
+ {}
+ };
+ }
+}
+#endif // _CONNECTIVITY_EVOAB_LTABLES_HXX_
+
diff --git a/connectivity/source/drivers/evoab/evoab.map b/connectivity/source/drivers/evoab/evoab.map
new file mode 100644
index 000000000000..00cf7191f143
--- /dev/null
+++ b/connectivity/source/drivers/evoab/evoab.map
@@ -0,0 +1,8 @@
+EVOAB_1_0 {
+ global:
+ component_getImplementationEnvironment;
+ component_writeInfo;
+ component_getFactory;
+ local:
+ *;
+};
diff --git a/connectivity/source/drivers/evoab/evoab.xcu b/connectivity/source/drivers/evoab/evoab.xcu
new file mode 100755
index 000000000000..4c5c4894e0ab
--- /dev/null
+++ b/connectivity/source/drivers/evoab/evoab.xcu
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * 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: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * 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.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:address:evolution:ldap" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.evoab.OEvoabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Evolution LDAP</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:address:evolution:groupwise" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.evoab.OEvoabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Groupwise</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/evoab/evoab.xml b/connectivity/source/drivers/evoab/evoab.xml
new file mode 100644
index 000000000000..8ed16719ae0e
--- /dev/null
+++ b/connectivity/source/drivers/evoab/evoab.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module-description PUBLIC "-//W3C//DTD HTML 3.2//EN" "module-description.dtd">
+<module-description>
+ <module-name>file</module-name>
+ <component-description>
+ <author>Xibei(Berry) Jia</author>
+ <name>com.sun.star.comp.sdbc.evoab.OEvoabDriver</name>
+ <description>This library implements the database driver for evolution address book formats.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.sdbc.Driver</supported-service>
+ <supported-service>com.sun.star.sdbcx.Driver</supported-service>
+ <service-dependency> ... </service-dependency>
+ </component-description>
+ <project-build-dependency>cppuhelper</project-build-dependency>
+ <project-build-dependency>cppu</project-build-dependency>
+ <project-build-dependency>sal</project-build-dependency>
+ <project-build-dependency>vos</project-build-dependency>
+ <runtime-module-dependency>file</runtime-module-dependency>
+ <runtime-module-dependency>cppuhelper</runtime-module-dependency>
+ <runtime-module-dependency>cppu</runtime-module-dependency>
+ <runtime-module-dependency>sal</runtime-module-dependency>
+ <runtime-module-dependency>vos</runtime-module-dependency>
+ <runtime-module-dependency>osl</runtime-module-dependency>
+ <runtime-module-dependency>svtools-light1</runtime-module-dependency>
+ <runtime-module-dependency>svtools</runtime-module-dependency>
+ <runtime-module-dependency>ucbhelper</runtime-module-dependency>
+ <runtime-module-dependency>dbtools</runtime-module-dependency>
+ <runtime-module-dependency>unotools</runtime-module-dependency>
+ <runtime-module-dependency>comphelper</runtime-module-dependency>
+</module-description>
diff --git a/connectivity/source/drivers/evoab/exports.dxp b/connectivity/source/drivers/evoab/exports.dxp
new file mode 100644
index 000000000000..9630d7e06768
--- /dev/null
+++ b/connectivity/source/drivers/evoab/exports.dxp
@@ -0,0 +1,3 @@
+component_getImplementationEnvironment
+component_writeInfo
+component_getFactory
diff --git a/connectivity/source/drivers/evoab/makefile.mk b/connectivity/source/drivers/evoab/makefile.mk
new file mode 100644
index 000000000000..8982322513de
--- /dev/null
+++ b/connectivity/source/drivers/evoab/makefile.mk
@@ -0,0 +1,108 @@
+#*************************************************************************
+#
+# 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.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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+PRJINC=..$/..
+PRJNAME=connectivity
+TARGET=evoab
+
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings ----------------------------------
+.IF "$(DBGUTIL_OJ)"!=""
+ENVCFLAGS+=/FR$(SLO)$/
+.ENDIF
+
+.INCLUDE : $(PRJ)$/version.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
+
+.IF "$(GUI)"=="UNX"
+
+# --- Files -------------------------------------
+
+EXCEPTIONSFILES=\
+ $(SLO)$/LResultSet.obj \
+ $(SLO)$/LStatement.obj \
+ $(SLO)$/LPreparedStatement.obj \
+ $(SLO)$/LFolderList.obj \
+ $(SLO)$/LConfigAccess.obj \
+ $(SLO)$/LColumnAlias.obj \
+ $(SLO)$/LTable.obj \
+ $(SLO)$/LDatabaseMetaData.obj \
+ $(SLO)$/LCatalog.obj \
+ $(SLO)$/LColumns.obj \
+ $(SLO)$/LTables.obj \
+ $(SLO)$/LConnection.obj \
+ $(SLO)$/LServices.obj \
+ $(SLO)$/LDriver.obj
+
+SLOFILES=\
+ $(EXCEPTIONSFILES) \
+ $(SLO)$/LDebug.obj
+
+
+SHL1VERSIONMAP=$(TARGET).map
+
+
+# --- Library -----------------------------------
+#SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
+SHL1TARGET= $(EVOAB_TARGET)$(DLLPOSTFIX)
+SHL1OBJS=$(SLOFILES)
+SHL1STDLIBS=\
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(VOSLIB) \
+ $(TOOLSLIB) \
+ $(SVTOOLLIB) \
+ $(UNOTOOLSLIB) \
+ $(UCBHELPERLIB) \
+ $(SALLIB) \
+ $(DBTOOLSLIB) \
+ $(DBFILELIB) \
+ $(COMPHELPERLIB)
+
+.IF "$(DBFILELIB)" == ""
+SHL1STDLIBS+= ifile.lib
+.ENDIF
+
+SHL1DEPN=
+SHL1IMPLIB= i$(TARGET)
+
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME= $(SHL1TARGET)
+
+.ELSE
+dummy:
+ @echo "Nothing to build for GUI $(GUI)"
+.ENDIF
+# --- Targets ----------------------------------
+.INCLUDE : $(PRJ)$/target.pmk
diff --git a/connectivity/source/drivers/evoab2/NResultSet.cxx b/connectivity/source/drivers/evoab2/NResultSet.cxx
index 8d2fcb837450..ec3f9fe7e99b 100644
--- a/connectivity/source/drivers/evoab2/NResultSet.cxx
+++ b/connectivity/source/drivers/evoab2/NResultSet.cxx
@@ -57,6 +57,7 @@
#include <svtools/syslocale.hxx>
#include <unotools/intlwrapper.hxx>
+#include <cstring>
#include <vector>
namespace connectivity { namespace evoab {
diff --git a/connectivity/source/drivers/evoab2/evoab2.xcu b/connectivity/source/drivers/evoab2/evoab2.xcu
new file mode 100755
index 000000000000..ddfc3b070e81
--- /dev/null
+++ b/connectivity/source/drivers/evoab2/evoab2.xcu
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * 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: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * 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.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:address:evolution:local" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.evoab.OEvoabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Evolution Local</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:address:evolution:ldap" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.evoab.OEvoabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Evolution LDAP</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:address:evolution:groupwise" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.evoab.OEvoabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Groupwise</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/evoab2/makefile.mk b/connectivity/source/drivers/evoab2/makefile.mk
index a911bd262516..e9bb9fdc4d70 100644
--- a/connectivity/source/drivers/evoab2/makefile.mk
+++ b/connectivity/source/drivers/evoab2/makefile.mk
@@ -39,7 +39,7 @@ dummy:
# --- Settings ----------------------------------
-.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
.INCLUDE : $(PRJ)$/version.mk
PKGCONFIG_MODULES=gtk+-2.0
@@ -111,4 +111,4 @@ DEF1NAME= $(SHL1TARGET)
.ENDIF
# --- Targets ----------------------------------
-.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/target.pmk
diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx
index 2692f02d7614..72ad91dbfa73 100644
--- a/connectivity/source/drivers/file/FStatement.cxx
+++ b/connectivity/source/drivers/file/FStatement.cxx
@@ -639,7 +639,7 @@ void OStatement_Base::GetAssignValues()
aColumnNameList.push_back(pCol->getTokenValue());
}
}
- if(!aColumnNameList.size())
+ if ( aColumnNameList.empty() )
throwFunctionSequenceException(*this);
// Werte ...
@@ -652,10 +652,10 @@ void OStatement_Base::GetAssignValues()
if (! SQL_ISTOKEN(pValuesOrQuerySpec->getChild(0),VALUES))
throwFunctionSequenceException(*this);
- OSL_ENSURE(pValuesOrQuerySpec->count() == 2,"OResultSet: pValuesOrQuerySpec->count() != 2");
+ OSL_ENSURE(pValuesOrQuerySpec->count() == 4,"OResultSet: pValuesOrQuerySpec->count() != 4");
// Liste von Werten
- OSQLParseNode * pInsertAtomCommalist = pValuesOrQuerySpec->getChild(1);
+ OSQLParseNode * pInsertAtomCommalist = pValuesOrQuerySpec->getChild(2);
OSL_ENSURE(pInsertAtomCommalist != NULL,"OResultSet: pInsertAtomCommalist darf nicht NULL sein!");
OSL_ENSURE(pInsertAtomCommalist->count() > 0,"OResultSet: pInsertAtomCommalist <= 0");
@@ -665,40 +665,22 @@ void OStatement_Base::GetAssignValues()
for (sal_uInt32 i = 0; i < pInsertAtomCommalist->count(); i++)
{
pRow_Value_Const = pInsertAtomCommalist->getChild(i); // row_value_constructor
- if(pRow_Value_Const->count() == 3) // '(' row_value_const_list ')'
+ OSL_ENSURE(pRow_Value_Const != NULL,"OResultSet: pRow_Value_Const darf nicht NULL sein!");
+ if(SQL_ISRULE(pRow_Value_Const,parameter))
{
- pRow_Value_Const = pRow_Value_Const->getChild(1); // row_value_const_list
- OSL_ENSURE(pRow_Value_Const != NULL,"OResultSet: pRow_Value_Const darf nicht NULL sein!");
- if(SQL_ISRULE(pRow_Value_Const,parameter))
- {
- if(pRow_Value_Const->count() == aColumnNameList.size())
- ParseAssignValues(aColumnNameList,pRow_Value_Const,nIndex++); // kann nur ein Columnname vorhanden sein pro Schleife
- else
- {
-// aStatus.Set(SQL_STAT_ERROR,
-// String::CreateFromAscii("S1000"),
-// aStatus.CreateErrorMessage(String(SdbResId(STR_STAT_SYNTAX_ERROR))),
-// 0, String() );
- throwFunctionSequenceException(*this);
- }
- }
- else if(pRow_Value_Const->isToken())
- ParseAssignValues(aColumnNameList,pRow_Value_Const,static_cast<xub_StrLen>(i));
- else
- {
- if(pRow_Value_Const->count() == aColumnNameList.size())
- {
- for (sal_uInt32 j = 0; j < pRow_Value_Const->count(); ++j)
- ParseAssignValues(aColumnNameList,pRow_Value_Const->getChild(j),nIndex++);
- }
- else
- throwFunctionSequenceException(*this);
- }
+ ParseAssignValues(aColumnNameList,pRow_Value_Const,nIndex++); // kann nur ein Columnname vorhanden sein pro Schleife
}
+ else if(pRow_Value_Const->isToken())
+ ParseAssignValues(aColumnNameList,pRow_Value_Const,static_cast<xub_StrLen>(i));
else
{
- // aStatus.SetStatementTooComplex();
- throwFunctionSequenceException(*this);
+ if(pRow_Value_Const->count() == aColumnNameList.size())
+ {
+ for (sal_uInt32 j = 0; j < pRow_Value_Const->count(); ++j)
+ ParseAssignValues(aColumnNameList,pRow_Value_Const->getChild(j),nIndex++);
+ }
+ else
+ throwFunctionSequenceException(*this);
}
}
}
diff --git a/connectivity/source/drivers/file/FStringFunctions.cxx b/connectivity/source/drivers/file/FStringFunctions.cxx
index e3eeb52f2d7d..07e620763b79 100644
--- a/connectivity/source/drivers/file/FStringFunctions.cxx
+++ b/connectivity/source/drivers/file/FStringFunctions.cxx
@@ -32,6 +32,7 @@
#include "precompiled_connectivity.hxx"
#include "file/FStringFunctions.hxx"
+#include <rtl/ustrbuf.hxx>
#include <rtl/logfile.hxx>
using namespace connectivity;
@@ -102,7 +103,7 @@ ORowSetValue OOp_Concat::operate(const ::std::vector<ORowSetValue>& lhs) const
if ( lhs.empty() )
return ORowSetValue();
- ::rtl::OUString sRet;
+ ::rtl::OUStringBuffer sRet;
::std::vector<ORowSetValue>::const_reverse_iterator aIter = lhs.rbegin();
::std::vector<ORowSetValue>::const_reverse_iterator aEnd = lhs.rend();
for (; aIter != aEnd; ++aIter)
@@ -110,10 +111,10 @@ ORowSetValue OOp_Concat::operate(const ::std::vector<ORowSetValue>& lhs) const
if ( aIter->isNull() )
return ORowSetValue();
- sRet += *aIter;
+ sRet.append(aIter->operator ::rtl::OUString());
}
- return sRet;
+ return sRet.makeStringAndClear();
}
//------------------------------------------------------------------
ORowSetValue OOp_Locate::operate(const ::std::vector<ORowSetValue>& lhs) const
@@ -183,13 +184,13 @@ ORowSetValue OOp_Space::operate(const ORowSetValue& lhs) const
return lhs;
const sal_Char c = ' ';
- ::rtl::OUString sRet;
+ ::rtl::OUStringBuffer sRet;
sal_Int32 nCount = lhs;
for (sal_Int32 i=0; i < nCount; ++i)
{
- sRet += ::rtl::OUString(&c,1,RTL_TEXTENCODING_ASCII_US);
+ sRet.appendAscii(&c,1);
}
- return sRet;
+ return sRet.makeStringAndClear();
}
//------------------------------------------------------------------
ORowSetValue OOp_Replace::operate(const ::std::vector<ORowSetValue>& lhs) const
diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx
index b91bee0917f6..75a89df55bc0 100644
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ b/connectivity/source/drivers/flat/ETable.cxx
@@ -180,13 +180,15 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale)
{
bNumeric = TRUE;
xub_StrLen nDot = 0;
+ xub_StrLen nDecimalDelCount = 0;
for (xub_StrLen j = 0; j < aField2.Len(); j++)
{
const sal_Unicode c = aField2.GetChar(j);
// nur Ziffern und Dezimalpunkt und Tausender-Trennzeichen?
- if ((!cDecimalDelimiter || c != cDecimalDelimiter) &&
- (!cThousandDelimiter || c != cThousandDelimiter) &&
- !aCharClass.isDigit(aField2,j))
+ if ( ( !cDecimalDelimiter || c != cDecimalDelimiter ) &&
+ ( !cThousandDelimiter || c != cThousandDelimiter ) &&
+ !aCharClass.isDigit(aField2,j) &&
+ ( j != 0 || (c != '+' && c != '-' ) ) )
{
bNumeric = FALSE;
break;
@@ -195,11 +197,13 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale)
{
nPrecision = 15; // we have an decimal value
nScale = 2;
- nDot++;
- }
+ ++nDecimalDelCount;
+ } // if (cDecimalDelimiter && c == cDecimalDelimiter)
+ if ( c == '.' )
+ ++nDot;
}
- if (nDot > 1) // if there is more than one dot it isn't a number
+ if (nDecimalDelCount > 1 || nDot > 1 ) // if there is more than one dot it isn't a number
bNumeric = FALSE;
if (bNumeric && cThousandDelimiter)
{
diff --git a/connectivity/source/drivers/flat/flat.xcu b/connectivity/source/drivers/flat/flat.xcu
new file mode 100755
index 000000000000..e70996e8ffa0
--- /dev/null
+++ b/connectivity/source/drivers/flat/flat.xcu
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * 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: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * 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.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:flat:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.flat.ODriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Text</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="CharSet" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="Extension" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="HeaderLine" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FieldDelimiter" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>,</value>
+ </prop>
+ </node>
+ <node oor:name="StringDelimiter" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>"</value>
+ </prop>
+ </node>
+ <node oor:name="DecimalDelimiter" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>.</value>
+ </prop>
+ </node>
+ <node oor:name="ThousandDelimiter" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="EnableSQL92Check" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="Features">
+ <node oor:name="UseSQL92NamingConstraints" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FileSystemBased" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="MediaType" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>application/csv</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/flat/makefile.mk b/connectivity/source/drivers/flat/makefile.mk
index 0cc44de7c55e..d044eab2796a 100644
--- a/connectivity/source/drivers/flat/makefile.mk
+++ b/connectivity/source/drivers/flat/makefile.mk
@@ -41,7 +41,7 @@ VISIBILITY_HIDDEN=TRUE
ENVCFLAGS+=/FR$(SLO)$/
.ENDIF
-.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
.INCLUDE : $(PRJ)$/version.mk
@@ -106,6 +106,6 @@ DEF1EXPORTFILE= exports.dxp
# --- Targets ----------------------------------
-.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/target.pmk
diff --git a/connectivity/source/drivers/hsqldb/hsqldb.xcu b/connectivity/source/drivers/hsqldb/hsqldb.xcu
new file mode 100755
index 000000000000..8fbee4f4c00a
--- /dev/null
+++ b/connectivity/source/drivers/hsqldb/hsqldb.xcu
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * 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: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * 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.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:embedded:hsqldb" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.sdbcx.comp.hsqldb.Driver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">HSQL database engine</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="UseDOSLineEnds" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FormsCheckRequiredFields" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsTableCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseJava" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="AutoIncrementIsPrimaryKey" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/hsqldb/makefile.mk b/connectivity/source/drivers/hsqldb/makefile.mk
index a97365a4d835..9ed5acb17d4c 100644
--- a/connectivity/source/drivers/hsqldb/makefile.mk
+++ b/connectivity/source/drivers/hsqldb/makefile.mk
@@ -39,7 +39,7 @@ VISIBILITY_HIDDEN=TRUE
USE_DEFFILE=TRUE
# --- Settings ----------------------------------
-.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
.INCLUDE : $(PRJ)$/version.mk
.IF "$(SOLAR_JAVA)"==""
@@ -115,6 +115,6 @@ DEF1EXPORTFILE= exports.dxp
# --- Targets ----------------------------------
-.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/target.pmk
diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
index 11863be3b8bf..b0341a3fd564 100644
--- a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
@@ -616,7 +616,8 @@ Reference< XResultSet > java_sql_DatabaseMetaData::impl_callResultSetMethodWithS
const ::rtl::OUString* _pOptionalAdditionalString )
{
bool bCatalog = _rCatalog.hasValue();
- ::rtl::OUString sCatalog( ::comphelper::getString( _rCatalog ) );
+ ::rtl::OUString sCatalog;
+ _rCatalog >>= sCatalog;
bool bSchema = _rSchemaPattern.toChar() != '%';
diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx
index e78488ffbba3..4728586ad4d0 100644
--- a/connectivity/source/drivers/jdbc/ResultSet.cxx
+++ b/connectivity/source/drivers/jdbc/ResultSet.cxx
@@ -261,7 +261,7 @@ sal_Int64 SAL_CALL java_sql_ResultSet::getLong( sal_Int32 columnIndex ) throw(SQ
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getLong" );
static jmethodID mID(NULL);
jlong (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallLongMethod;
- return callMethodWithIntArg<jlong>(pCallMethod,"getLong","(I)L",mID,columnIndex);
+ return callMethodWithIntArg<jlong>(pCallMethod,"getLong","(I)J",mID,columnIndex);
}
// -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/jdbc/jdbc.xcu b/connectivity/source/drivers/jdbc/jdbc.xcu
new file mode 100755
index 000000000000..73fe2e9adc55
--- /dev/null
+++ b/connectivity/source/drivers/jdbc/jdbc.xcu
@@ -0,0 +1,207 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * 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: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * 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.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="jdbc:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.JDBCDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">JDBC</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="JavaDriverClass" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="JavaDriverClassPath" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="AutoIncrementCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="AutoRetrievingStatement" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="IsAutoRetrievingEnabled" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ </node>
+ <node oor:name="AddIndexAppendix" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="Features">
+ <node oor:name="GeneratedValues" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseSQL92NamingConstraints" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="AppendTableAliasInSelect" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseBracketedOuterJoinSyntax" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="IgnoreDriverPrivileges" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="ParameterNameSubstitution" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="DisplayVersionColumns" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseCatalogInSelect" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseSchemaInSelect" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseIndexDirectionKeyword" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseDOSLineEnds" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="BooleanComparisonMode" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FormsCheckRequiredFields" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsTableCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseJava" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="Authentication" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>UserPassword</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="jdbc:oracle:thin:*" oor:op="replace">
+ <prop oor:name="ParentURLPattern">
+ <value>jdbc:*</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Oracle JDBC</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="IgnoreCurrency" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ </node>
+ <node oor:name="TypeInfoSettings" oor:op="replace">
+ <prop oor:name="Value" oor:type="oor:string-list">
+ <value oor:separator=",">Column(2) = -5,Column(6) = PRECISION,Column(2) = -4,Column(6) = PRECISION,Column(2) = -3,Column(6) = PRECISION,Column(2) = -2,Column(6) = PRECISION,Column(2) = -1,Column(6) = PRECISION,Column(2) = -1,Column(6) = PRECISION,Column(2) = 2,Column(6) = PRECISION,Column(2) = 12,Column(6) = PRECISION</value>
+ </prop>
+ </node>
+ <node oor:name="JavaDriverClass" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>oracle.jdbc.driver.OracleDriver</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="Features">
+ <node oor:name="IgnoreCurrency" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="Authentication" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>UserPassword</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/jdbc/makefile.mk b/connectivity/source/drivers/jdbc/makefile.mk
index b8d6a54dd065..831a6755af91 100644
--- a/connectivity/source/drivers/jdbc/makefile.mk
+++ b/connectivity/source/drivers/jdbc/makefile.mk
@@ -42,7 +42,7 @@ VISIBILITY_HIDDEN=TRUE
ENVCFLAGS+=/FR$(SLO)$/
.ENDIF
-.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
.INCLUDE : $(PRJ)$/version.mk
@@ -110,6 +110,6 @@ DEF1EXPORTFILE= exports.dxp
# --- Targets ----------------------------------
-.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/target.pmk
diff --git a/connectivity/source/drivers/jdbc/tools.cxx b/connectivity/source/drivers/jdbc/tools.cxx
index 6f50a6b1affd..daaed46acdd9 100644
--- a/connectivity/source/drivers/jdbc/tools.cxx
+++ b/connectivity/source/drivers/jdbc/tools.cxx
@@ -150,6 +150,9 @@ java_util_Properties* connectivity::createStringPropertyArray(const Sequence< Pr
&& pBegin->Name.compareToAscii( "IgnoreDriverPrivileges" )
&& pBegin->Name.compareToAscii( "ImplicitCatalogRestriction" )
&& pBegin->Name.compareToAscii( "ImplicitSchemaRestriction" )
+ && pBegin->Name.compareToAscii( "SupportsTableCreation" )
+ && pBegin->Name.compareToAscii( "UseJava" )
+ && pBegin->Name.compareToAscii( "Authentication" )
)
{
::rtl::OUString aStr;
diff --git a/connectivity/source/drivers/kab/kab.xcu b/connectivity/source/drivers/kab/kab.xcu
new file mode 100755
index 000000000000..cc8e6b5329b5
--- /dev/null
+++ b/connectivity/source/drivers/kab/kab.xcu
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * 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: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * 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.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:address:kab" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.kab.Driver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">KDE Address Book</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/kab/makefile.mk b/connectivity/source/drivers/kab/makefile.mk
index 4ee330345625..2c0a86f8562b 100644
--- a/connectivity/source/drivers/kab/makefile.mk
+++ b/connectivity/source/drivers/kab/makefile.mk
@@ -40,7 +40,7 @@ VISIBILITY_HIDDEN=TRUE
# --- Settings ----------------------------------
-.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
.INCLUDE : $(PRJ)$/version.mk
.IF "$(GUI)" == "UNX"
@@ -137,5 +137,5 @@ dummy:
@echo "Nothing to build for GUI $(GUI)"
.ENDIF
-.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/target.pmk
diff --git a/connectivity/source/drivers/macab/macab.xcu b/connectivity/source/drivers/macab/macab.xcu
new file mode 100755
index 000000000000..3818c7db882b
--- /dev/null
+++ b/connectivity/source/drivers/macab/macab.xcu
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * 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: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * 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.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:address:macab:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.macab.Driver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Mac OS X Address Book</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/macab/makefile.mk b/connectivity/source/drivers/macab/makefile.mk
index 67f40f2d45cf..8edc8951fa95 100755
--- a/connectivity/source/drivers/macab/makefile.mk
+++ b/connectivity/source/drivers/macab/makefile.mk
@@ -39,7 +39,7 @@ ENABLE_EXCEPTIONS=TRUE
# --- Settings ----------------------------------
-.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
.INCLUDE : $(PRJ)$/version.mk
.IF "$(GUI)" == "UNX"
@@ -133,5 +133,5 @@ dummy:
@echo "Nothing to build for GUI $(GUI)"
.ENDIF
-.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/target.pmk
diff --git a/connectivity/source/drivers/mozab/MColumnAlias.cxx b/connectivity/source/drivers/mozab/MColumnAlias.cxx
index 8055e25585bc..79fa31551701 100644
--- a/connectivity/source/drivers/mozab/MColumnAlias.cxx
+++ b/connectivity/source/drivers/mozab/MColumnAlias.cxx
@@ -32,12 +32,15 @@
#include "precompiled_connectivity.hxx"
#include "MColumnAlias.hxx"
#include "MConnection.hxx"
+#include "MExtConfigAccess.hxx"
+
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
-#ifndef CONNECTIVITY_MOZAB_MEXTCONFIGACCESS_HXX
-#include "MExtConfigAccess.hxx"
-#endif
+#include <tools/diagnose_ex.h>
+
+#include <algorithm>
+#include <functional>
using namespace ::connectivity;
using namespace ::connectivity::mozab;
@@ -46,56 +49,57 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
-static const ::rtl::OUString sProgrammaticNames[] =
-{
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstName")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LastName")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DisplayName")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NickName")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PrimaryEmail")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SecondEmail")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PreferMailFormat")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkPhone")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomePhone")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FaxNumber")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PagerNumber")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellularNumber")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeAddress")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeAddress2")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeCity")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeState")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeZipCode")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeCountry")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkAddress")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkAddress2")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkCity")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkState")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkZipCode")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkCountry")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("JobTitle")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Department")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Company")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WebPage1")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WebPage2")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BirthYear")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BirthMonth")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BirthDay")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom1")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom2")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom3")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom4")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Notes"))
-};
//------------------------------------------------------------------------------
OColumnAlias::OColumnAlias( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB )
{
- for ( size_t i = 0; i < END - BEGIN; ++i )
- m_aAliasMap[ sProgrammaticNames[i] ] = AliasDescription( sProgrammaticNames[i], static_cast< ProgrammaticName>( i ) );
+ static const sal_Char* s_pProgrammaticNames[] =
+ {
+ "FirstName",
+ "LastName",
+ "DisplayName",
+ "NickName",
+ "PrimaryEmail",
+ "SecondEmail",
+ "PreferMailFormat",
+ "WorkPhone",
+ "HomePhone",
+ "FaxNumber",
+ "PagerNumber",
+ "CellularNumber",
+ "HomeAddress",
+ "HomeAddress2",
+ "HomeCity",
+ "HomeState",
+ "HomeZipCode",
+ "HomeCountry",
+ "WorkAddress",
+ "WorkAddress2",
+ "WorkCity",
+ "WorkState",
+ "WorkZipCode",
+ "WorkCountry",
+ "JobTitle",
+ "Department",
+ "Company",
+ "WebPage1",
+ "WebPage2",
+ "BirthYear",
+ "BirthMonth",
+ "BirthDay",
+ "Custom1",
+ "Custom2",
+ "Custom3",
+ "Custom4",
+ "Notes",
+ };
+
+ for ( size_t i = 0; i < sizeof( s_pProgrammaticNames ) / sizeof( s_pProgrammaticNames[0] ); ++i )
+ m_aAliasMap[ ::rtl::OUString::createFromAscii( s_pProgrammaticNames[i] ) ] = AliasEntry( s_pProgrammaticNames[i], i );
initialize( _rxORB );
}
-//------------------------------------------------------------------
+//------------------------------------------------------------------------------
void OColumnAlias::initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB )
{
// open our driver settings config node
@@ -112,34 +116,26 @@ void OColumnAlias::initialize( const ::com::sun::star::uno::Reference< ::com::su
OSL_ENSURE( xAliasesNode.is(), "OColumnAlias::setAlias: missing the aliases node!" );
// this is a set of string nodes
- Sequence< ::rtl::OUString > aColumnProgrammaticNames;
+ Sequence< ::rtl::OUString > aProgrammaticNames;
if ( xAliasesNode.is() )
- aColumnProgrammaticNames = xAliasesNode->getElementNames();
+ aProgrammaticNames = xAliasesNode->getElementNames();
//.............................................................
// travel through all the set elements
- const ::rtl::OUString* pProgrammaticNames = aColumnProgrammaticNames.getConstArray();
- const ::rtl::OUString* pProgrammaticNamesEnd = pProgrammaticNames + aColumnProgrammaticNames.getLength();
+ const ::rtl::OUString* pProgrammaticNames = aProgrammaticNames.getConstArray();
+ const ::rtl::OUString* pProgrammaticNamesEnd = pProgrammaticNames + aProgrammaticNames.getLength();
::rtl::OUString sAssignedAlias;
for ( ; pProgrammaticNames < pProgrammaticNamesEnd; ++pProgrammaticNames )
{
- OSL_ENSURE( m_aAliasMap.end() != m_aAliasMap.find( *pProgrammaticNames ),
- "OColumnAlias::setAlias: found an invalid programmtic name!" );
- // if this asserts, somebody stored a programmatic name in the configuration
- // which is not allowed (i.e. not in the list of known programmatics).
-
-#if OSL_DEBUG_LEVEL > 0
- sal_Bool bExtractionSuccess =
-#endif
- xAliasesNode->getByName( *pProgrammaticNames) >>= sAssignedAlias;
- OSL_ENSURE( bExtractionSuccess, "OColumnAlias::setAlias: invalid config data!" );
+ OSL_VERIFY( xAliasesNode->getByName( *pProgrammaticNames ) >>= sAssignedAlias );
// normalize in case the config data is corrupted
// (what we really don't need is an empty alias ...)
if ( 0 == sAssignedAlias.getLength() )
sAssignedAlias = *pProgrammaticNames;
+ ::rtl::OString sAsciiProgrammaticName( ::rtl::OUStringToOString( *pProgrammaticNames, RTL_TEXTENCODING_ASCII_US ) );
//.............................................................
#if OSL_DEBUG_LEVEL > 0
bool bFound = false;
@@ -149,15 +145,11 @@ void OColumnAlias::initialize( const ::com::sun::star::uno::Reference< ::com::su
++search
)
{
- if ( search->second.sProgrammaticName == *pProgrammaticNames )
+ if ( search->second.programmaticAsciiName.equals( sAsciiProgrammaticName ) )
{
- AliasDescription aDescription( search->second );
-
- // delete this old entry for this programmatic name
+ AliasEntry entry( search->second );
m_aAliasMap.erase( search );
-
- // insert the same AliasDescription under a new name - its alias
- m_aAliasMap[ sAssignedAlias ] = aDescription;
+ m_aAliasMap[ sAssignedAlias ] = entry;
#if OSL_DEBUG_LEVEL > 0
bFound = true;
@@ -172,29 +164,31 @@ void OColumnAlias::initialize( const ::com::sun::star::uno::Reference< ::com::su
}
catch( const Exception& )
{
- OSL_ENSURE( sal_False, "OColumnAlias::setAlias: could not read my driver's configuration data!" );
+ DBG_UNHANDLED_EXCEPTION();
}
}
}
//------------------------------------------------------------------
-OColumnAlias::ProgrammaticName OColumnAlias::getProgrammaticNameIndex( const ::rtl::OUString& _rAliasName ) const
+::rtl::OString OColumnAlias::getProgrammaticNameOrFallbackToUTF8Alias( const ::rtl::OUString& _rAlias ) const
{
- AliasMap::const_iterator pos = m_aAliasMap.find( _rAliasName );
+ AliasMap::const_iterator pos = m_aAliasMap.find( _rAlias );
if ( pos == m_aAliasMap.end() )
{
- OSL_ENSURE( false, "OColumnAlias::getProgrammaticNameIndex: unknown column alias!" );
- return END;
+ OSL_ENSURE( false, "OColumnAlias::getProgrammaticNameOrFallbackToUTF8Alias: no programmatic name for this alias!" );
+ return ::rtl::OUStringToOString( _rAlias, RTL_TEXTENCODING_UTF8 );
}
-
- return pos->second.eProgrammaticNameIndex;
+ return pos->second.programmaticAsciiName;
}
//------------------------------------------------------------------
-::rtl::OUString OColumnAlias::getProgrammaticNameOrFallbackToAlias( const ::rtl::OUString& _rAlias ) const
+bool OColumnAlias::isColumnSearchable( const ::rtl::OUString _alias ) const
{
- AliasMap::const_iterator pos = m_aAliasMap.find( _rAlias );
- if ( pos == m_aAliasMap.end() )
- return _rAlias;
- return pos->second.sProgrammaticName;
+ ::rtl::OString sProgrammatic = getProgrammaticNameOrFallbackToUTF8Alias( _alias );
+
+ return ( !sProgrammatic.equals( "HomeCountry" )
+ && !sProgrammatic.equals( "WorkCountry" )
+ );
+ // for those, we know that they're not searchable in the Mozilla/LDAP implementation.
+ // There might be more ...
}
diff --git a/connectivity/source/drivers/mozab/MColumnAlias.hxx b/connectivity/source/drivers/mozab/MColumnAlias.hxx
index f19273be8ae4..64c9e3b3561b 100644
--- a/connectivity/source/drivers/mozab/MColumnAlias.hxx
+++ b/connectivity/source/drivers/mozab/MColumnAlias.hxx
@@ -36,7 +36,7 @@
#include <osl/mutex.hxx>
#include <vector>
-#include <map>
+#include <hash_map>
namespace connectivity
{
@@ -45,88 +45,41 @@ namespace connectivity
class OColumnAlias
{
public:
- typedef enum {
- BEGIN = 0,
-
- FIRSTNAME = BEGIN,
- LASTNAME,
- DISPLAYNAME,
- NICKNAME,
- PRIMARYEMAIL,
- SECONDEMAIL,
- PREFERMAILFORMAT,
- WORKPHONE,
- HOMEPHONE,
- FAXNUMBER,
- PAGERNUMBER,
- CELLULARNUMBER,
- HOMEADDRESS,
- HOMEADDRESS2,
- HOMECITY,
- HOMESTATE,
- HOMEZIPCODE,
- HOMECOUNTRY,
- WORKADDRESS,
- WORKADDRESS2,
- WORKCITY,
- WORKSTATE,
- WORKZIPCODE,
- WORKCOUNTRY,
- JOBTITLE,
- DEPARTMENT,
- COMPANY,
- WEBPAGE1,
- WEBPAGE2,
- BIRTHYEAR,
- BIRTHMONTH,
- BIRTHDAY,
- CUSTOM1,
- CUSTOM2,
- CUSTOM3,
- CUSTOM4,
- NOTES,
-
- END
- } ProgrammaticName;
-
- struct AliasDescription
+ struct AliasEntry
{
- ::rtl::OUString sProgrammaticName;
- ProgrammaticName eProgrammaticNameIndex;
+ ::rtl::OString programmaticAsciiName;
+ sal_Int32 columnPosition;
- AliasDescription()
- :eProgrammaticNameIndex( END )
+ AliasEntry()
+ :programmaticAsciiName()
+ ,columnPosition( 0 )
{
}
-
- AliasDescription( const ::rtl::OUString& _rName, ProgrammaticName _eIndex )
- :sProgrammaticName( _rName ), eProgrammaticNameIndex( _eIndex )
+ AliasEntry( const sal_Char* _programmaticAsciiName, sal_Int32 _columnPosition )
+ :programmaticAsciiName( _programmaticAsciiName )
+ ,columnPosition( _columnPosition )
{
}
};
-
- typedef ::std::map< ::rtl::OUString, AliasDescription > AliasMap;
+ typedef ::std::hash_map< ::rtl::OUString, AliasEntry, ::rtl::OUStringHash > AliasMap;
private:
AliasMap m_aAliasMap;
- protected:
- ::osl::Mutex m_aMutex;
-
public:
- OColumnAlias(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & );
+ OColumnAlias( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & );
- ProgrammaticName getProgrammaticNameIndex( const ::rtl::OUString& _rAliasName ) const;
inline bool hasAlias( const ::rtl::OUString& _rAlias ) const
{
return m_aAliasMap.find( _rAlias ) != m_aAliasMap.end();
}
- ::rtl::OUString getProgrammaticNameOrFallbackToAlias( const ::rtl::OUString& _rAlias ) const;
+ ::rtl::OString getProgrammaticNameOrFallbackToUTF8Alias( const ::rtl::OUString& _rAlias ) const;
inline AliasMap::const_iterator begin() const { return m_aAliasMap.begin(); }
inline AliasMap::const_iterator end() const { return m_aAliasMap.end(); }
+ bool isColumnSearchable( const ::rtl::OUString _alias ) const;
+
private:
void initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB );
};
diff --git a/connectivity/source/drivers/mozab/MConnection.cxx b/connectivity/source/drivers/mozab/MConnection.cxx
index 6fc45d4ed07f..80da4df794fc 100644
--- a/connectivity/source/drivers/mozab/MConnection.cxx
+++ b/connectivity/source/drivers/mozab/MConnection.cxx
@@ -378,8 +378,7 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const ::
// the statement can only be executed more than once
OPreparedStatement* pPrepared = new OPreparedStatement(this,_sSql);
Reference< XPreparedStatement > xReturn = pPrepared;
- if ( !pPrepared->lateInit() )
- throw SQLException();
+ pPrepared->lateInit();
m_aStatements.push_back(WeakReferenceHelper(xReturn));
return xReturn;
diff --git a/connectivity/source/drivers/mozab/MConnection.hxx b/connectivity/source/drivers/mozab/MConnection.hxx
index 741bd9ef20e1..d29a36f60a14 100644
--- a/connectivity/source/drivers/mozab/MConnection.hxx
+++ b/connectivity/source/drivers/mozab/MConnection.hxx
@@ -51,7 +51,6 @@ namespace connectivity
namespace mozab
{
- class OStatement_Base;
class MozabDriver;
class ODatabaseMetaData;
class MNameMapper;
diff --git a/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx b/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx
index 55350e350474..3ba479abc764 100644
--- a/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx
@@ -157,7 +157,7 @@ ODatabaseMetaDataResultSet::ORows& SAL_CALL ODatabaseMetaData::getColumnRows(
// COLUMN_NAME
aRow[4] = new ORowSetValueDecorator( compare->first );
// ORDINAL_POSITION
- aRow[17] = new ORowSetValueDecorator( static_cast< sal_Int32 >( compare->second.eProgrammaticNameIndex ) + 1 );
+ aRow[17] = new ORowSetValueDecorator( static_cast< sal_Int32 >( compare->second.columnPosition ) + 1 );
aRows.push_back(aRow);
}
}
diff --git a/connectivity/source/drivers/mozab/MPreparedStatement.cxx b/connectivity/source/drivers/mozab/MPreparedStatement.cxx
index 79c58bc6a90c..8cec9c18f635 100644
--- a/connectivity/source/drivers/mozab/MPreparedStatement.cxx
+++ b/connectivity/source/drivers/mozab/MPreparedStatement.cxx
@@ -67,11 +67,11 @@ IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.mozab.PreparedStat
OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const ::rtl::OUString& sql)
- :OStatement_BASE2(_pConnection)
+ :OCommonStatement(_pConnection)
,m_nNumParams(0)
,m_sSqlStatement(sql)
,m_bPrepared(sal_False)
- ,m_pResultSet( NULL )
+ ,m_pResultSet()
{
}
// -----------------------------------------------------------------------------
@@ -79,21 +79,17 @@ OPreparedStatement::~OPreparedStatement()
{
}
// -----------------------------------------------------------------------------
-sal_Bool OPreparedStatement::lateInit()
+void OPreparedStatement::lateInit()
{
- return parseSql( m_sSqlStatement );
+ if ( eSelect != parseSql( m_sSqlStatement ) )
+ throw SQLException();
}
// -------------------------------------------------------------------------
void SAL_CALL OPreparedStatement::disposing()
{
::osl::MutexGuard aGuard(m_aMutex);
- if(m_pResultSet)
- m_pResultSet->release();
-
- clearMyResultSet();
-
- OStatement_BASE2::disposing();
+ OCommonStatement::disposing();
m_xMetaData = NULL;
if(m_aParameterRow.isValid())
@@ -105,63 +101,61 @@ void SAL_CALL OPreparedStatement::disposing()
}
// -----------------------------------------------------------------------------
-sal_Bool OPreparedStatement::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted ) throw (
- ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException )
+OCommonStatement::StatementType OPreparedStatement::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted )
+ throw ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException )
{
- OSL_TRACE("in :: OPreparedStatement::parseSql()");
- if (!OStatement_Base::parseSql( sql, bAdjusted ))
- return sal_False;
+ StatementType eStatementType = OCommonStatement::parseSql( sql, bAdjusted );
+ if ( eStatementType != eSelect )
+ return eStatementType;
m_xParamColumns = new OSQLColumns();
- Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY);
-
// describe all parameters need for the resultset
describeParameter();
- OResultSet::setBoundedColumns(m_aRow,m_xParamColumns,xNames,sal_False,m_xDBMetaData,m_aColMapping);
+ Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY);
+ OResultSet::setBoundedColumns( m_aRow, m_xParamColumns, xNames, sal_False, m_xDBMetaData, m_aColMapping );
- m_pResultSet = createResultSet();
- m_pResultSet->acquire();
- m_xResultSet = Reference<XResultSet>(m_pResultSet);
- initializeResultSet(m_pResultSet);
- OSL_TRACE("Out :: OPreparedStatement::parseSql()");
- return sal_True;
+ return eStatementType;
}
// -----------------------------------------------------------------------------
-
-OResultSet* OPreparedStatement::createResultSet( )
+void OPreparedStatement::initializeResultSet( OResultSet* _pResult )
{
- OSL_TRACE("In/Out : OPreparedStatement::createResultSet( )");
- return new OResultSet( this, m_pSQLIterator );
+ OCommonStatement::initializeResultSet( _pResult );
+ _pResult->setParameterColumns( m_xParamColumns );
+ _pResult->setParameterRow( m_aParameterRow );
}
// -----------------------------------------------------------------------------
-void OPreparedStatement::initializeResultSet( OResultSet* _pResult )
+void OPreparedStatement::clearCachedResultSet()
{
- OSL_TRACE("In : OPreparedStatement::initializeResultSet( )");
- OStatement_Base::initializeResultSet( _pResult );
-
- _pResult->setParameterColumns(m_xParamColumns);
- _pResult->setParameterRow(m_aParameterRow);
- OSL_TRACE("Out : OPreparedStatement::initializeResultSet( )");
+ OCommonStatement::clearCachedResultSet();
+ m_pResultSet.clear();
+ m_xMetaData.clear();
+}
+// -----------------------------------------------------------------------------
+void OPreparedStatement::cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult )
+{
+ OCommonStatement::cacheResultSet( _pResult );
+ OSL_PRECOND( m_pResultSet == NULL, "OPreparedStatement::parseSql: you should call clearCachedResultSet before!" );
+ m_pResultSet = _pResult;
}
// -----------------------------------------------------------------------------
void SAL_CALL OPreparedStatement::acquire() throw()
{
- OStatement_BASE2::acquire();
+ OCommonStatement::acquire();
}
// -----------------------------------------------------------------------------
void SAL_CALL OPreparedStatement::release() throw()
{
- OStatement_BASE2::release();
+ OCommonStatement::release();
}
// -----------------------------------------------------------------------------
Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType ) throw(RuntimeException)
{
- Any aRet = OStatement_BASE2::queryInterface(rType);
+ Any aRet = OCommonStatement::queryInterface(rType);
if(!aRet.hasValue())
aRet = OPreparedStatement_BASE::queryInterface(rType);
return aRet;
@@ -169,61 +163,41 @@ Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType ) throw(Runt
// -------------------------------------------------------------------------
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OPreparedStatement::getTypes( ) throw(::com::sun::star::uno::RuntimeException)
{
- return ::comphelper::concatSequences(OPreparedStatement_BASE::getTypes(),OStatement_BASE2::getTypes());
+ return ::comphelper::concatSequences(OPreparedStatement_BASE::getTypes(),OCommonStatement::getTypes());
}
// -------------------------------------------------------------------------
Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- sal_Bool bReadOnly= sal_True;
- if (m_pResultSet)
+ checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
+
+ sal_Bool bReadOnly = sal_True;
+ if ( m_pResultSet.is() )
bReadOnly = m_pResultSet->determineReadOnly();
- if(!m_xMetaData.is())
+ // if we do not have a result set, then we have not been executed, yet. In this case, assuming readonly=true is
+ // okay, /me thinks.
+
+ if ( !m_xMetaData.is() )
m_xMetaData = new OResultSetMetaData( m_pSQLIterator->getSelectColumns(), m_pSQLIterator->getTables().begin()->first ,m_pTable,bReadOnly );
+
return m_xMetaData;
}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::close( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- // Reset last warning message
-
- try {
- clearWarnings ();
- clearMyResultSet();
- // OStatement_BASE2::close();
- }
- catch (SQLException &) {
- // If we get an error, ignore
- }
- // Remove this Statement object from the Connection object's
- // list
-}
// -------------------------------------------------------------------------
-
sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
- Reference< XResultSet> xRS = OStatement_Base::executeQuery( m_sSqlStatement );
- // same as in statement with the difference that this statement also can contain parameter
-
- OSL_TRACE("In/Out: OPreparedStatement::execute" );
- return xRS.is();
+ Reference< XResultSet> xResult = executeQuery();
+ return xResult.is();
}
// -------------------------------------------------------------------------
sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, RuntimeException)
{
+ ::dbtools::throwFeatureNotImplementedException( "XStatement::executeUpdate", *this );
return 0;
}
// -------------------------------------------------------------------------
@@ -231,7 +205,7 @@ sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, Run
void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
OSL_TRACE("prepStmt::setString( %s )", OUtoCStr( x ) );
setParameter( parameterIndex, x );
@@ -241,7 +215,7 @@ void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::r
Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
return (Reference< XConnection >)m_pConnection;
}
@@ -251,12 +225,11 @@ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLE
{
::osl::MutexGuard aGuard( m_aMutex );
OSL_TRACE("In: OPreparedStatement::executeQuery" );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- Reference< XResultSet > rs = OStatement_Base::executeQuery( m_sSqlStatement );
+ checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
- OSL_TRACE("Out: OPreparedStatement::executeQuery" );
- return rs;
+ // our statement has already been parsed in lateInit, no need to do all this (potentially expensive)
+ // stuff again. Just execute.
+ return impl_executeCurrentQuery();
}
// -------------------------------------------------------------------------
@@ -318,7 +291,7 @@ void SAL_CALL OPreparedStatement::setLong( sal_Int32 /*parameterIndex*/, sal_Int
void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 /*sqlType*/ ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
checkAndResizeParameters(parameterIndex);
@@ -410,7 +383,7 @@ void OPreparedStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,cons
case PROPERTY_ID_USEBOOKMARKS:
break;
default:
- OStatement_Base::setFastPropertyValue_NoBroadcast(nHandle,rValue);
+ OCommonStatement::setFastPropertyValue_NoBroadcast(nHandle,rValue);
}
}
// -----------------------------------------------------------------------------
@@ -422,7 +395,7 @@ void OPreparedStatement::checkParameterIndex(sal_Int32 _parameterIndex)
// -----------------------------------------------------------------------------
void OPreparedStatement::checkAndResizeParameters(sal_Int32 parameterIndex)
{
- ::connectivity::checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
if ( !m_aParameterRow.isValid() ) {
m_aParameterRow = new OValueVector();
diff --git a/connectivity/source/drivers/mozab/MPreparedStatement.hxx b/connectivity/source/drivers/mozab/MPreparedStatement.hxx
index 70f6d0060b6e..f2830654fcfe 100644
--- a/connectivity/source/drivers/mozab/MPreparedStatement.hxx
+++ b/connectivity/source/drivers/mozab/MPreparedStatement.hxx
@@ -53,7 +53,7 @@ namespace connectivity
::com::sun::star::sdbc::XMultipleResults,
::com::sun::star::lang::XServiceInfo> OPreparedStatement_BASE;
- class OPreparedStatement : public OStatement_BASE2,
+ class OPreparedStatement : public OCommonStatement,
public OPreparedStatement_BASE
{
protected:
@@ -79,7 +79,7 @@ namespace connectivity
::rtl::OUString m_sSqlStatement;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xMetaData;
sal_Bool m_bPrepared;
- OResultSet* m_pResultSet;
+ ::rtl::Reference< OResultSet > m_pResultSet;
::vos::ORef<connectivity::OSQLColumns> m_xParamColumns; // the parameter columns
OValueRow m_aParameterRow;
@@ -93,29 +93,29 @@ namespace connectivity
virtual ~OPreparedStatement();
virtual void SAL_CALL disposing();
- virtual sal_Bool parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted = sal_False) throw (
- ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
- virtual OResultSet* createResultSet();
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> initResultSet();
+ // OCommonStatement overridables
+ virtual StatementType
+ parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted = sal_False) throw ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ virtual void initializeResultSet( OResultSet* _pResult );
+ virtual void clearCachedResultSet();
+ virtual void cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult );
+
void checkAndResizeParameters(sal_Int32 parameterIndex);
void setParameter(sal_Int32 parameterIndex, const ORowSetValue& x);
-
sal_uInt32 AddParameter(connectivity::OSQLParseNode * pParameter,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xCol);
void scanParameter(OSQLParseNode* pParseNode,::std::vector< OSQLParseNode*>& _rParaNodes);
void describeColumn(OSQLParseNode* _pParameter,OSQLParseNode* _pNode,const OSQLTable& _xTable);
void describeParameter();
- virtual void initializeResultSet( OResultSet* _pResult );
-
public:
DECLARE_SERVICE_INFO();
// ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird:
OPreparedStatement( OConnection* _pConnection,const ::rtl::OUString& sql);
- sal_Bool lateInit();
+ void lateInit();
//XInterface
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
@@ -153,8 +153,6 @@ namespace connectivity
virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XCloseable
- virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
// XResultSetMetaDataSupplier
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
// XMultipleResults
@@ -163,9 +161,9 @@ namespace connectivity
virtual sal_Bool SAL_CALL getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
public:
- using OStatement_Base::executeQuery;
- using OStatement_Base::executeUpdate;
- using OStatement_Base::execute;
+ using OCommonStatement::executeQuery;
+ using OCommonStatement::executeUpdate;
+ using OCommonStatement::execute;
protected:
using OPropertySetHelper::getFastPropertyValue;
};
diff --git a/connectivity/source/drivers/mozab/MResultSet.cxx b/connectivity/source/drivers/mozab/MResultSet.cxx
index a58e442fcc30..18106375f252 100644
--- a/connectivity/source/drivers/mozab/MResultSet.cxx
+++ b/connectivity/source/drivers/mozab/MResultSet.cxx
@@ -99,7 +99,7 @@ sal_Bool SAL_CALL OResultSet::supportsService( const ::rtl::OUString& _rServiceN
}
// -------------------------------------------------------------------------
-OResultSet::OResultSet(OStatement_Base* pStmt, const ::boost::shared_ptr< connectivity::OSQLParseTreeIterator >& _pSQLIterator )
+OResultSet::OResultSet(OCommonStatement* pStmt, const ::boost::shared_ptr< connectivity::OSQLParseTreeIterator >& _pSQLIterator )
: OResultSet_BASE(m_aMutex)
,OPropertySetHelper(OResultSet_BASE::rBHelper)
,m_pStatement(pStmt)
@@ -512,7 +512,7 @@ void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException)
{
ResultSetEntryGuard aGuard( *this );
OSL_TRACE("In/Out: OResultSet::close" );
- // dispose();
+ dispose();
}
// -------------------------------------------------------------------------
@@ -1125,9 +1125,6 @@ void OResultSet::fillRowData()
m_aQuery.setExpression( queryExpression );
- // We need a unique id for caching mechanism so should fetch card:URI
- m_aQuery.setAttributes( m_aAttributeStrings );
-
rtl::OUString aStr( m_pTable->getName() );
m_aQuery.setAddressbook( aStr );
diff --git a/connectivity/source/drivers/mozab/MResultSet.hxx b/connectivity/source/drivers/mozab/MResultSet.hxx
index 09d53ee616ee..8eccf4cc7673 100644
--- a/connectivity/source/drivers/mozab/MResultSet.hxx
+++ b/connectivity/source/drivers/mozab/MResultSet.hxx
@@ -83,7 +83,7 @@ namespace connectivity
public ::comphelper::OPropertyArrayUsageHelper<OResultSet>
{
protected:
- OStatement_Base* m_pStatement;
+ OCommonStatement* m_pStatement;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xStatement;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData;
sal_uInt32 m_nRowPos;
@@ -126,7 +126,7 @@ namespace connectivity
public:
DECLARE_SERVICE_INFO();
- OResultSet(OStatement_Base* pStmt, const ::boost::shared_ptr< ::connectivity::OSQLParseTreeIterator >& _pSQLIterator );
+ OResultSet(OCommonStatement* pStmt, const ::boost::shared_ptr< ::connectivity::OSQLParseTreeIterator >& _pSQLIterator );
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > operator *()
diff --git a/connectivity/source/drivers/mozab/MResultSetMetaData.cxx b/connectivity/source/drivers/mozab/MResultSetMetaData.cxx
index b0caef93c15c..855f3580b797 100644
--- a/connectivity/source/drivers/mozab/MResultSetMetaData.cxx
+++ b/connectivity/source/drivers/mozab/MResultSetMetaData.cxx
@@ -184,12 +184,7 @@ sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQL
if ( m_pTable->getConnection()->isLDAP() )
{
const OColumnAlias& aAliases( m_pTable->getConnection()->getColumnAlias() );
- OColumnAlias::ProgrammaticName eProgrammatic( aAliases.getProgrammaticNameIndex( sColumnName ) );
- if ( ( eProgrammatic == OColumnAlias::HOMECOUNTRY )
- || ( eProgrammatic == OColumnAlias::WORKCOUNTRY )
- )
- // for those, we know that they're not searchable in the Mozilla/LDAP implementation.
- // There might be more ...
+ if ( !aAliases.isColumnSearchable( sColumnName ) )
return sal_False;
}
diff --git a/connectivity/source/drivers/mozab/MStatement.cxx b/connectivity/source/drivers/mozab/MStatement.cxx
index 50d0b63941f9..852cad9dbc44 100644
--- a/connectivity/source/drivers/mozab/MStatement.cxx
+++ b/connectivity/source/drivers/mozab/MStatement.cxx
@@ -36,6 +36,7 @@
#include <comphelper/property.hxx>
#include <comphelper/uno3.hxx>
#include <osl/thread.h>
+#include <tools/diagnose_ex.h>
#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
#include <com/sun/star/sdbc/ResultSetType.hpp>
#include <com/sun/star/sdbc/FetchDirection.hpp>
@@ -78,39 +79,33 @@ using namespace com::sun::star::container;
using namespace com::sun::star::io;
using namespace com::sun::star::util;
//------------------------------------------------------------------------------
-OStatement_Base::OStatement_Base(OConnection* _pConnection )
- :OStatement_BASE(m_aMutex)
- ,OPropertySetHelper(OStatement_BASE::rBHelper)
+OCommonStatement::OCommonStatement(OConnection* _pConnection )
+ :OCommonStatement_IBASE(m_aMutex)
+ ,OPropertySetHelper(OCommonStatement_IBASE::rBHelper)
+ ,OCommonStatement_SBASE((::cppu::OWeakObject*)_pConnection, this)
,m_xDBMetaData(_pConnection->getMetaData())
,m_pTable(NULL)
,m_pConnection(_pConnection)
,m_aParser(_pConnection->getDriver()->getMSFactory())
,m_pSQLIterator( new OSQLParseTreeIterator( _pConnection, _pConnection->createCatalog()->getTables(), m_aParser, NULL ) )
,m_pParseTree(NULL)
- ,rBHelper(OStatement_BASE::rBHelper)
+ ,rBHelper(OCommonStatement_IBASE::rBHelper)
{
m_pConnection->acquire();
- OSL_TRACE("In/Out: OStatement_Base::OStatement_Base" );
+ OSL_TRACE("In/Out: OCommonStatement::OCommonStatement" );
}
// -----------------------------------------------------------------------------
-OStatement_Base::~OStatement_Base()
+OCommonStatement::~OCommonStatement()
{
}
+
//------------------------------------------------------------------------------
-void OStatement_Base::disposeResultSet()
-{
- // free the cursor if alive
- Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY);
- if (xComp.is())
- xComp->dispose();
- m_xResultSet = Reference< XResultSet>();
-}
-//------------------------------------------------------------------------------
-void OStatement_BASE2::disposing()
+void OCommonStatement::disposing()
{
::osl::MutexGuard aGuard(m_aMutex);
- disposeResultSet();
+ clearWarnings();
+ clearCachedResultSet();
if (m_pConnection)
m_pConnection->release();
@@ -119,76 +114,38 @@ void OStatement_BASE2::disposing()
m_pSQLIterator->dispose();
dispose_ChildImpl();
- OStatement_Base::disposing();
+ OCommonStatement_IBASE::disposing();
}
//-----------------------------------------------------------------------------
-void SAL_CALL OStatement_BASE2::release() throw()
+Any SAL_CALL OCommonStatement::queryInterface( const Type & rType ) throw(RuntimeException)
{
- relase_ChildImpl();
-}
-//-----------------------------------------------------------------------------
-Any SAL_CALL OStatement_Base::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = OStatement_BASE::queryInterface(rType);
+ Any aRet = OCommonStatement_IBASE::queryInterface(rType);
if(!aRet.hasValue())
aRet = OPropertySetHelper::queryInterface(rType);
return aRet;
}
// -------------------------------------------------------------------------
-Sequence< Type > SAL_CALL OStatement_Base::getTypes( ) throw(RuntimeException)
+Sequence< Type > SAL_CALL OCommonStatement::getTypes( ) throw(RuntimeException)
{
::cppu::OTypeCollection aTypes( ::getCppuType( (const Reference< XMultiPropertySet > *)0 ),
::getCppuType( (const Reference< XFastPropertySet > *)0 ),
::getCppuType( (const Reference< XPropertySet > *)0 ));
- return ::comphelper::concatSequences(aTypes.getTypes(),OStatement_BASE::getTypes());
+ return ::comphelper::concatSequences(aTypes.getTypes(),OCommonStatement_IBASE::getTypes());
}
// -------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException)
+void SAL_CALL OCommonStatement::close( ) throw(SQLException, RuntimeException)
{
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
+ checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
}
dispose();
}
-// -------------------------------------------------------------------------
-
-void OStatement_Base::reset() throw (SQLException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- clearWarnings ();
-
- if (m_xResultSet.get().is())
- clearMyResultSet();
-}
-//--------------------------------------------------------------------
-// clearMyResultSet
-// If a ResultSet was created for this Statement, close it
-//--------------------------------------------------------------------
-
-void OStatement_Base::clearMyResultSet () throw (SQLException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- try
- {
- Reference<XCloseable> xCloseable;
- if ( ::comphelper::query_interface( m_xResultSet.get(), xCloseable ) )
- xCloseable->close();
- }
- catch( const DisposedException& ) { }
-
- m_xResultSet = Reference< XResultSet >();
-}
-
-void OStatement_Base::createTable( )
- throw ( SQLException, RuntimeException )
+// -------------------------------------------------------------------------
+void OCommonStatement::createTable( ) throw ( SQLException, RuntimeException )
{
if(m_pParseTree)
{
@@ -233,13 +190,11 @@ void OStatement_Base::createTable( )
getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
}
// -------------------------------------------------------------------------
-sal_Bool OStatement_Base::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted)
+OCommonStatement::StatementType OCommonStatement::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted)
throw ( SQLException, RuntimeException )
{
::rtl::OUString aErr;
- OSL_TRACE("In/Out :: OStatement::parseSql(%s)\n", OUtoCStr( sql ) );
-
m_pParseTree = m_aParser.parseTree(aErr,sql);
#if OSL_DEBUG_LEVEL > 0
@@ -285,12 +240,14 @@ sal_Bool OStatement_Base::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjus
createColumnMapping();
analyseSQL();
- break;
+ return eSelect;
+
case SQL_STATEMENT_CREATE_TABLE:
createTable();
- return sal_False;
+ return eCreateTable;
+
default:
- getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
+ break;
}
}
else if(!bAdjusted) //Our sql parser does not support a statement like "create table foo"
@@ -298,35 +255,71 @@ sal_Bool OStatement_Base::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjus
{
return parseSql(sql + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("(""E-mail"" caracter)")),sal_True);
}
- else
- getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
- return sal_True;
+
+ getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
+ OSL_ENSURE( false, "OCommonStatement::parseSql: unreachable!" );
+ return eSelect;
}
// -------------------------------------------------------------------------
-
-OResultSet* OStatement_Base::createResultSet()
+Reference< XResultSet > OCommonStatement::impl_executeCurrentQuery()
{
- return new OResultSet( this, m_pSQLIterator );
+ clearCachedResultSet();
+
+ ::rtl::Reference< OResultSet > pResult( new OResultSet( this, m_pSQLIterator ) );
+ initializeResultSet( pResult.get() );
+
+ pResult->executeQuery();
+ cacheResultSet( pResult ); // only cache if we survived the execution
+
+ return pResult.get();
+
}
-// -------------------------------------------------------------------------
-void OStatement_Base::initializeResultSet( OResultSet* _pResult )
+// -------------------------------------------------------------------------
+void OCommonStatement::initializeResultSet( OResultSet* _pResult )
{
- OSL_TRACE("In : initializeResultSet");
+ ENSURE_OR_THROW( _pResult, "invalid result set" );
+
_pResult->setColumnMapping(m_aColMapping);
_pResult->setOrderByColumns(m_aOrderbyColumnNumber);
_pResult->setOrderByAscending(m_aOrderbyAscending);
_pResult->setBindingRow(m_aRow);
_pResult->setTable(m_pTable);
- OSL_TRACE("Out : initializeResultSet");
}
// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OStatement_Base::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
+void OCommonStatement::clearCachedResultSet()
+{
+ Reference< XResultSet > xResultSet( m_xResultSet.get(), UNO_QUERY );
+ if ( !xResultSet.is() )
+ return;
+
+ try
+ {
+ Reference< XCloseable > xCloseable( xResultSet, UNO_QUERY_THROW );
+ xCloseable->close();
+ }
+ catch( const DisposedException& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ m_xResultSet = Reference< XResultSet >();
+}
+
+// -------------------------------------------------------------------------
+void OCommonStatement::cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult )
+{
+ ENSURE_OR_THROW( _pResult.is(), "invalid result set" );
+ m_xResultSet = Reference< XResultSet >( _pResult.get() );
+}
+
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL OCommonStatement::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
OSL_TRACE("Statement::execute( %s )", OUtoCStr( sql ) );
@@ -336,31 +329,26 @@ sal_Bool SAL_CALL OStatement_Base::execute( const ::rtl::OUString& sql ) throw(S
}
// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
+Reference< XResultSet > SAL_CALL OCommonStatement::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_ThreadMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
OSL_TRACE("Statement::executeQuery( %s )", OUtoCStr( sql ) );
- if (!parseSql( sql )) //parseSql return false means this sql is a create table statement
+ // parse the statement
+ StatementType eStatementType = parseSql( sql );
+ if ( eStatementType != eSelect )
return NULL;
- OResultSet* pResult = createResultSet();
- Reference< XResultSet > xRS = pResult;
- initializeResultSet( pResult );
-
- pResult->executeQuery();
- m_xResultSet = xRS; // we need a reference to it for later use
-
- return xRS;
+ return impl_executeCurrentQuery();
}
// -------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL OStatement_Base::getConnection( ) throw(SQLException, RuntimeException)
+Reference< XConnection > SAL_CALL OCommonStatement::getConnection( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
// just return our connection here
return (Reference< XConnection >)m_pConnection;
@@ -370,37 +358,37 @@ Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeExcep
{
Any aRet = ::cppu::queryInterface(rType,static_cast< XServiceInfo*> (this));
if(!aRet.hasValue())
- aRet = OStatement_Base::queryInterface(rType);
+ aRet = OCommonStatement::queryInterface(rType);
return aRet;
}
// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OStatement_Base::executeUpdate( const ::rtl::OUString& /*sql*/ ) throw(SQLException, RuntimeException)
+sal_Int32 SAL_CALL OCommonStatement::executeUpdate( const ::rtl::OUString& /*sql*/ ) throw(SQLException, RuntimeException)
{
- ::dbtools::throwFeatureNotImplementedException( "XPreparedStatement::executeUpdate", *this );
+ ::dbtools::throwFeatureNotImplementedException( "XStatement::executeUpdate", *this );
return 0;
}
// -------------------------------------------------------------------------
-Any SAL_CALL OStatement_Base::getWarnings( ) throw(SQLException, RuntimeException)
+Any SAL_CALL OCommonStatement::getWarnings( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
return makeAny(m_aLastWarning);
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::clearWarnings( ) throw(SQLException, RuntimeException)
+void SAL_CALL OCommonStatement::clearWarnings( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
m_aLastWarning = SQLWarning();
}
// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* OStatement_Base::createArrayHelper( ) const
+::cppu::IPropertyArrayHelper* OCommonStatement::createArrayHelper( ) const
{
// this properties are define by the service resultset
// they must in alphabetic order
@@ -421,12 +409,12 @@ void SAL_CALL OStatement_Base::clearWarnings( ) throw(SQLException, RuntimeExce
}
// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper & OStatement_Base::getInfoHelper()
+::cppu::IPropertyArrayHelper & OCommonStatement::getInfoHelper()
{
- return *const_cast<OStatement_Base*>(this)->getArrayHelper();
+ return *const_cast<OCommonStatement*>(this)->getArrayHelper();
}
// -------------------------------------------------------------------------
-sal_Bool OStatement_Base::convertFastPropertyValue(
+sal_Bool OCommonStatement::convertFastPropertyValue(
Any & /*rConvertedValue*/,
Any & /*rOldValue*/,
sal_Int32 /*nHandle*/,
@@ -438,7 +426,7 @@ sal_Bool OStatement_Base::convertFastPropertyValue(
return bConverted;
}
// -------------------------------------------------------------------------
-void OStatement_Base::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& /*rValue*/) throw (Exception)
+void OCommonStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& /*rValue*/) throw (Exception)
{
// set the value to what ever is nescessary
switch(nHandle)
@@ -456,7 +444,7 @@ void OStatement_Base::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const A
}
}
// -------------------------------------------------------------------------
-void OStatement_Base::getFastPropertyValue(Any& /*rValue*/,sal_Int32 nHandle) const
+void OCommonStatement::getFastPropertyValue(Any& /*rValue*/,sal_Int32 nHandle) const
{
switch(nHandle)
{
@@ -475,32 +463,32 @@ void OStatement_Base::getFastPropertyValue(Any& /*rValue*/,sal_Int32 nHandle) co
// -------------------------------------------------------------------------
IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.OStatement","com.sun.star.sdbc.Statement");
// -----------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::acquire() throw()
+void SAL_CALL OCommonStatement::acquire() throw()
{
- OStatement_BASE::acquire();
+ OCommonStatement_IBASE::acquire();
}
// -----------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::release() throw()
+void SAL_CALL OCommonStatement::release() throw()
{
- OStatement_BASE::release();
+ relase_ChildImpl();
}
// -----------------------------------------------------------------------------
void SAL_CALL OStatement::acquire() throw()
{
- OStatement_BASE2::acquire();
+ OCommonStatement::acquire();
}
// -----------------------------------------------------------------------------
void SAL_CALL OStatement::release() throw()
{
- OStatement_BASE2::release();
+ OCommonStatement::release();
}
// -----------------------------------------------------------------------------
-Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OStatement_Base::getPropertySetInfo( ) throw(RuntimeException)
+Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OCommonStatement::getPropertySetInfo( ) throw(RuntimeException)
{
return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
}
// -----------------------------------------------------------------------------
-void OStatement_Base::createColumnMapping()
+void OCommonStatement::createColumnMapping()
{
size_t i;
@@ -524,7 +512,7 @@ void OStatement_Base::createColumnMapping()
}
// -----------------------------------------------------------------------------
-void OStatement_Base::analyseSQL()
+void OCommonStatement::analyseSQL()
{
const OSQLParseNode* pOrderbyClause = m_pSQLIterator->getOrderTree();
if(pOrderbyClause)
@@ -549,7 +537,7 @@ void OStatement_Base::analyseSQL()
}
}
//------------------------------------------------------------------
-void OStatement_Base::setOrderbyColumn( OSQLParseNode* pColumnRef,
+void OCommonStatement::setOrderbyColumn( OSQLParseNode* pColumnRef,
OSQLParseNode* pAscendingDescending)
{
::rtl::OUString aColumnName;
diff --git a/connectivity/source/drivers/mozab/MStatement.hxx b/connectivity/source/drivers/mozab/MStatement.hxx
index 48e66568b85e..1c3f3f93e8cc 100644
--- a/connectivity/source/drivers/mozab/MStatement.hxx
+++ b/connectivity/source/drivers/mozab/MStatement.hxx
@@ -64,21 +64,28 @@ namespace connectivity
typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbc::XStatement,
::com::sun::star::sdbc::XWarningsSupplier,
- ::com::sun::star::sdbc::XCloseable> OStatement_BASE;
+ ::com::sun::star::sdbc::XCloseable> OCommonStatement_IBASE;
//**************************************************************
- //************ Class: OStatement_Base
+ //************ Class: OCommonStatement
// is a base class for the normal statement and for the prepared statement
//**************************************************************
- class OStatement_Base : public comphelper::OBaseMutex,
- public OStatement_BASE,
- public ::cppu::OPropertySetHelper,
- public ::comphelper::OPropertyArrayUsageHelper<OStatement_Base>
-
+ class OCommonStatement;
+ typedef ::connectivity::OSubComponent< OCommonStatement, OCommonStatement_IBASE > OCommonStatement_SBASE;
+
+ class OCommonStatement :public comphelper::OBaseMutex
+ ,public OCommonStatement_IBASE
+ ,public ::cppu::OPropertySetHelper
+ ,public ::comphelper::OPropertyArrayUsageHelper< OCommonStatement >
+ ,public OCommonStatement_SBASE
{
- ::com::sun::star::sdbc::SQLWarning m_aLastWarning;
+ friend class ::connectivity::OSubComponent< OCommonStatement, OCommonStatement_IBASE >;
+
+ private:
+ ::com::sun::star::sdbc::SQLWarning m_aLastWarning;
+
protected:
- ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet> m_xResultSet; // The last ResultSet created
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet > m_xResultSet;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> m_xDBMetaData;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xColNames; // table columns
@@ -105,8 +112,6 @@ namespace connectivity
protected:
- void disposeResultSet();
-
// OPropertyArrayUsageHelper
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
// OPropertySetHelper
@@ -123,23 +128,37 @@ namespace connectivity
virtual void SAL_CALL getFastPropertyValue(
::com::sun::star::uno::Any& rValue,
sal_Int32 nHandle) const;
- virtual ~OStatement_Base();
+ virtual ~OCommonStatement();
protected:
//
// Driver Internal Methods
//
- virtual sal_Bool parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted = sal_False) throw (
- ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ enum StatementType { eSelect, eCreateTable };
+ /** called to do the parsing of a to-be-executed SQL statement, and set all members as needed
+ */
+ virtual StatementType
+ parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted = sal_False) throw ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ /** called to initialize a result set, according to a previously parsed SQL statement
+ */
+ virtual void initializeResultSet( OResultSet* _pResult );
+ /** called when a possible cached instance of our last result set should be cleared
+ */
+ virtual void clearCachedResultSet();
+ /** caches a result set which has just been created by an execution of an SQL statement
+ */
+ virtual void cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult );
+
+
+ /** executes the current query (the one which has been passed to the last parseSql call)
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >
+ impl_executeCurrentQuery();
- OResultSet* createResultSet();
- virtual void initializeResultSet( OResultSet* _pResult );
void createColumnMapping();
void analyseSQL();
void setOrderbyColumn( connectivity::OSQLParseNode* pColumnRef,
connectivity::OSQLParseNode* pAscendingDescending);
- void reset () throw( ::com::sun::star::sdbc::SQLException);
- void clearMyResultSet () throw( ::com::sun::star::sdbc::SQLException);
virtual void createTable( ) throw (
::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
@@ -147,11 +166,12 @@ namespace connectivity
// other methods
OConnection* getOwnConnection() const { return m_pConnection;}
- OStatement_Base(OConnection* _pConnection );
- using OStatement_BASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
+ OCommonStatement(OConnection* _pConnection );
+ using OCommonStatement_IBASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
// OComponentHelper
- virtual void SAL_CALL disposing(void){OStatement_BASE::disposing();}
+ virtual void SAL_CALL disposing(void);
+
// XInterface
virtual void SAL_CALL release() throw();
virtual void SAL_CALL acquire() throw();
@@ -177,28 +197,14 @@ namespace connectivity
using OPropertySetHelper::getFastPropertyValue;
};
- class OStatement_BASE2 :public OStatement_Base
- ,public ::connectivity::OSubComponent<OStatement_BASE2, OStatement_BASE>
-
- {
- friend class OSubComponent<OStatement_BASE2, OStatement_BASE>;
- public:
- OStatement_BASE2(OConnection* _pConnection ) : OStatement_Base(_pConnection ),
- ::connectivity::OSubComponent<OStatement_BASE2, OStatement_BASE>((::cppu::OWeakObject*)_pConnection, this){}
- // OComponentHelper
- virtual void SAL_CALL disposing(void);
- // XInterface
- virtual void SAL_CALL release() throw();
- };
-
- class OStatement : public OStatement_BASE2,
+ class OStatement : public OCommonStatement,
public ::com::sun::star::lang::XServiceInfo
{
protected:
~OStatement(){}
public:
// ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird:
- OStatement( OConnection* _pConnection) : OStatement_BASE2( _pConnection){}
+ OStatement( OConnection* _pConnection) : OCommonStatement( _pConnection){}
DECLARE_SERVICE_INFO();
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
diff --git a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx
index 4853a9796898..94dc9387d876 100644
--- a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx
+++ b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx
@@ -30,6 +30,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_connectivity.hxx"
+
#include "MMozillaBootstrap.hxx"
using namespace com::sun::star::uno;
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx
index 180c67a30006..8c03770afd80 100644
--- a/connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx
@@ -34,12 +34,13 @@
#include "mozilla_nsinit.h"
+#include <MNSInit.hxx>
+
#include <sal/types.h>
#include <osl/diagnose.h>
#include <osl/conditn.hxx>
#include <osl/file.hxx>
#include <rtl/bootstrap.hxx>
-#include <MNSInit.hxx>
#ifndef CONNECTIVITY_MOZAB_MCONFIGACCESS_HXX
#include "MConfigAccess.hxx"
@@ -77,7 +78,8 @@ extern "C" void NS_SetupRegistry();
const PRUnichar* pUsedProfile = *_pValidProfiles;
// have a look what the configuration suggests as preferred profile
- const PRUnichar* pPreferredProfile = static_cast< const PRUnichar* >( getUserProfile( ) );
+ // PRUnichar != sal_Unicode in mingw
+ const PRUnichar* pPreferredProfile = reinterpret_cast_mingw_only< const PRUnichar* >( getUserProfile( ) );
if ( pPreferredProfile && *pPreferredProfile )
{
PRUnichar const* const* pLoop = _pValidProfiles;
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx
index 82d0dc4db693..276f87f43b18 100644
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx
@@ -179,7 +179,8 @@ NS_IMETHODIMP nsProfile::ProfileExists(const PRUnichar *profileName, PRBool *exi
NS_ENSURE_ARG_POINTER(profileName);
NS_ENSURE_ARG_POINTER(exists);
- *exists = xMozillaBootstrap->getProfileExists(xMozillaBootstrap->getCurrentProduct(),profileName);
+ // PRUnichar != sal_Unicode in mingw
+ *exists = xMozillaBootstrap->getProfileExists(xMozillaBootstrap->getCurrentProduct(),reinterpret_cast_mingw_only<const sal_Unicode *>(profileName));
return NS_OK;
}
// Returns the name of the current profile i.e., the last used profile
@@ -463,10 +464,12 @@ NS_IMETHODIMP nsProfile::GetProfileDir(const PRUnichar *profileName, nsIFile **p
nsresult rv = NS_OK;
- rtl::OUString path = xMozillaBootstrap->getProfilePath(xMozillaBootstrap->getCurrentProduct(),profileName);
+ // PRUnichar != sal_Unicode in mingw
+ rtl::OUString path = xMozillaBootstrap->getProfilePath(xMozillaBootstrap->getCurrentProduct(),reinterpret_cast_mingw_only<const sal_Unicode *>(profileName));
nsCOMPtr<nsILocalFile> localFile;
- nsAutoString filePath(path.getStr());
+ // PRUnichar != sal_Unicode in mingw
+ nsAutoString filePath(reinterpret_cast_mingw_only<const PRUnichar *>(path.getStr()));
rv = NS_NewLocalFile(filePath, PR_TRUE,
getter_AddRefs(localFile));
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
index 142da2237daf..a9ab5c015ace 100644
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
@@ -129,7 +129,8 @@ namespace connectivity
nsAutoString path;
nsresult rv = profilePath->GetPath(path);
NS_ENSURE_SUCCESS(rv, ::rtl::OUString());
- return ::rtl::OUString(path.get());
+ // PRUnichar != sal_Unicode in mingw
+ return ::rtl::OUString(reinterpret_cast_mingw_only<const sal_Unicode *>(path.get()));
}
else
return ::rtl::OUString();
@@ -170,7 +171,8 @@ namespace connectivity
//step 1 : get mozilla registry file
nsCOMPtr<nsILocalFile> localFile;
::rtl::OUString regDir( getRegistryFileName( MozillaProductType_Mozilla ) );
- nsAutoString registryDir(regDir.getStr());
+ // PRUnichar != sal_Unicode in mingw
+ nsAutoString registryDir(reinterpret_cast_mingw_only<const PRUnichar *>(regDir.getStr()));
rv = NS_NewLocalFile(registryDir, PR_TRUE,
getter_AddRefs(localFile));
NS_ENSURE_SUCCESS(rv,rv);
@@ -190,7 +192,8 @@ namespace connectivity
//step 3:Enumerator it
rv = registry->GetKey(nsIRegistry::Common,
- szProfileSubtreeString.getStr(),
+ // PRUnichar != sal_Unicode in mingw
+ reinterpret_cast_mingw_only<const PRUnichar *>(szProfileSubtreeString.getStr()),
&profilesTreeKey);
if (NS_FAILED(rv)) return rv;
@@ -198,12 +201,14 @@ namespace connectivity
// Get the current profile
rv = registry->GetString(profilesTreeKey,
- szCurrentProfileString.getStr(),
+ // PRUnichar != sal_Unicode in mingw
+ reinterpret_cast_mingw_only<const PRUnichar *>(szCurrentProfileString.getStr()),
getter_Copies(tmpCurrentProfile));
if (tmpCurrentProfile)
{
- m_Product.setCurrentProfile ( NS_STATIC_CAST(const PRUnichar*, tmpCurrentProfile));
+ // PRUnichar != sal_Unicode in mingw
+ m_Product.setCurrentProfile ( reinterpret_cast_mingw_only<const sal_Unicode *>(NS_STATIC_CAST(const PRUnichar*, tmpCurrentProfile)));
}
@@ -243,7 +248,8 @@ namespace connectivity
nsXPIDLString regData;
rv = registry->GetString(profKey,
- szDirectoryString.getStr(),
+ // PRUnichar != sal_Unicode in mingw
+ reinterpret_cast_mingw_only<const PRUnichar *>(szDirectoryString.getStr()),
getter_Copies(regData));
if (NS_FAILED(rv)) continue;
@@ -257,7 +263,8 @@ namespace connectivity
//Add found profile to profile lists
if (NS_SUCCEEDED(rv) && tempLocal)
{
- ProfileStruct* profileItem = new ProfileStruct(MozillaProductType_Mozilla,NS_STATIC_CAST(const PRUnichar*, profile),tempLocal);
+ // PRUnichar != sal_Unicode in mingw
+ ProfileStruct* profileItem = new ProfileStruct(MozillaProductType_Mozilla,reinterpret_cast_mingw_only<const sal_Unicode *>(NS_STATIC_CAST(const PRUnichar*, profile)),tempLocal);
m_Product.mProfileList[profileItem->getProfileName()] = profileItem;
}
@@ -330,7 +337,8 @@ namespace connectivity
nsCAutoString filePath(sPath.getStr());
if (isRelative) {
- nsAutoString registryDir( regDir.getStr() );
+ // PRUnichar != sal_Unicode in mingw
+ nsAutoString registryDir( reinterpret_cast_mingw_only<const PRUnichar *>(regDir.getStr()) );
nsCOMPtr<nsILocalFile> mAppData;
rv = NS_NewLocalFile(registryDir, PR_TRUE,
getter_AddRefs(mAppData));
@@ -490,7 +498,8 @@ namespace connectivity
if (!path.getLength())
return sal_True;
- nsAutoString filePath(path.getStr());
+ // PRUnichar != sal_Unicode in mingw
+ nsAutoString filePath(reinterpret_cast_mingw_only<const PRUnichar *>(path.getStr()));
nsresult rv;
nsCOMPtr<nsILocalFile> localFile;
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.cxx
index 91f3f273085b..cd098757d7a3 100644
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.cxx
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.cxx
@@ -83,7 +83,8 @@ namespace connectivity
rv = theProfile->GetCurrentProfile(getter_Copies(currentProfileStr));
if (NS_FAILED(rv) || currentProfileStr.get() == nsnull)
return ::rtl::OUString();
- return ::rtl::OUString(currentProfileStr.get());
+ // PRUnichar != sal_Unicode in mingw
+ return ::rtl::OUString(reinterpret_cast_mingw_only<const sal_Unicode *>(currentProfileStr.get()));
}
::rtl::OUString ProfileManager::setCurrentProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException)
{
@@ -102,7 +103,8 @@ namespace connectivity
nsCOMPtr<nsIProfile> theProfile(do_GetService(NS_PROFILE_CONTRACTID,&rv));
if (NS_FAILED(rv)) return ::rtl::OUString();
- const PRUnichar* pUsedProfile = profileName.getStr();
+ // PRUnichar != sal_Unicode in mingw
+ const PRUnichar* pUsedProfile = reinterpret_cast_mingw_only<const PRUnichar *>(profileName.getStr());
//set current profile
rv = theProfile->SetCurrentProfile( pUsedProfile );
if (NS_FAILED(rv)) return ::rtl::OUString();
diff --git a/connectivity/source/drivers/mozab/bootstrap/makefile.mk b/connectivity/source/drivers/mozab/bootstrap/makefile.mk
index 5e4927f811fd..a22b3699760a 100644
--- a/connectivity/source/drivers/mozab/bootstrap/makefile.mk
+++ b/connectivity/source/drivers/mozab/bootstrap/makefile.mk
@@ -88,6 +88,8 @@ SLOFILES += \
$(SLO)$/MNSProfileDirServiceProvider.obj
.ENDIF
+CDEFS += -DMOZILLA_INTERNAL_API
+
.IF "$(GUI)"=="UNX"
.IF "$(COMNAME)"=="sunpro5"
CFLAGS += -features=tmplife
@@ -167,7 +169,7 @@ CFLAGS += -fPIC
CFLAGSCXX += \
-fno-rtti -Wconversion -Wpointer-arith \
-Wcast-align -Woverloaded-virtual -Wsynth \
- -Wno-long-long
+ -Wno-long-long -Wno-deprecated
CDEFS += -DTRACING
.ENDIF
diff --git a/connectivity/source/drivers/mozab/makefile.mk b/connectivity/source/drivers/mozab/makefile.mk
index a842c75c7a72..6240ed041047 100644
--- a/connectivity/source/drivers/mozab/makefile.mk
+++ b/connectivity/source/drivers/mozab/makefile.mk
@@ -66,13 +66,13 @@ MOZ_REG_LIB := $(MOZ_LIB)$/mozreg.lib
.IF "$(OS)"=="WNT"
.IF "$(COM)"=="GCC"
-MOZ_LIB_XPCOM= -L$(MOZ_LIB) -lembed_base_s -lnspr4 -lmozreg_s -lxpcom
+MOZ_LIB_XPCOM= -L$(MOZ_LIB) -lembed_base_s -lnspr4 -lmozreg_s -lxpcom -lxpcom_core
.ELSE
LIB += $(MOZ_LIB)
-MOZ_LIB_XPCOM= $(MOZ_EMBED_LIB) $(MOZ_LIB)$/nspr4.lib $(MOZ_REG_LIB) $(MOZ_LIB)$/xpcom.lib
+MOZ_LIB_XPCOM= $(MOZ_EMBED_LIB) $(MOZ_LIB)$/nspr4.lib $(MOZ_REG_LIB) $(MOZ_LIB)$/xpcom.lib $(MOZ_LIB)$/xpcom_core.lib
.ENDIF
.ELSE "$(OS)"=="WNT"
-MOZ_LIB_XPCOM= -L$(MOZ_LIB) -lembed_base_s -lnspr4 -lmozreg_s -lxpcom
+MOZ_LIB_XPCOM= -L$(MOZ_LIB) -lnspr4 -lxpcom_core -lmozreg_s -lembed_base_s
.ENDIF
#End of mozilla specific stuff.
@@ -83,13 +83,18 @@ USE_DEFFILE=TRUE
ENABLE_EXCEPTIONS=TRUE
VISIBILITY_HIDDEN=TRUE
+.IF "$(OS)"!="WNT"
+COMPONENT_CONFIG_DATA=$(TARGET)2.xcu
+COMPONENT_CONFIG_SCHEMA=$(TARGET)2.xcs
+.ENDIF
+
# --- Settings ----------------------------------
.IF "$(DBGUTIL_OJ)"!=""
ENVCFLAGS+=/FR$(SLO)$/
.ENDIF
-.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
.INCLUDE : $(PRJ)$/version.mk
@@ -98,7 +103,6 @@ ENVCFLAGS+=/FR$(SLO)$/
SLOFILES=\
$(SLO)$/MDriver.obj \
$(SLO)$/MServices.obj
-
# --- MOZAB BASE Library -----------------------------------
@@ -140,7 +144,8 @@ MOZSLOFILES=\
$(SLO)$/MNSINIParser.obj \
$(SLO)$/MNSRunnable.obj \
$(SLO)$/MNSProfile.obj \
- $(SLO)$/MNSProfileDirServiceProvider.obj
+ $(SLO)$/MNSProfileDirServiceProvider.obj \
+ $(SLO)$/MLdapAttributeMap.obj
SLO2FILES=\
@@ -186,7 +191,7 @@ DEF2NAME= $(SHL2TARGET)
# --- Targets ----------------------------------
-.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/target.pmk
# --- filter file ------------------------------
diff --git a/connectivity/source/drivers/mozab/mozab.xcu b/connectivity/source/drivers/mozab/mozab.xcu
new file mode 100755
index 000000000000..f47e1708e690
--- /dev/null
+++ b/connectivity/source/drivers/mozab/mozab.xcu
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * 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: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * 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.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:address:outlook" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.MozabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Microsoft Outlook Address Book</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:address:outlookexp" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.MozabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Microsoft Windows Address Book</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:address:mozilla:" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.MozabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Mozilla Address Book</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:address:thunderbird:" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.MozabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Thunderbird Address Book</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:address:ldap:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.MozabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">LDAP Address Book</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="BaseDN" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="MaxRowCount" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:int">
+ <value>100</value>
+ </prop>
+ </node>
+ <node oor:name="PortNumber" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:int">
+ <value>389</value>
+ </prop>
+ </node>
+ <node oor:name="UseSSL" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsTableCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="Authentication" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>UserPassword</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/mozab/mozab2.xcu b/connectivity/source/drivers/mozab/mozab2.xcu
new file mode 100755
index 000000000000..41d99391c540
--- /dev/null
+++ b/connectivity/source/drivers/mozab/mozab2.xcu
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * 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: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * 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.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:address:mozilla:" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.MozabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Mozilla Address Book</value>
+ </prop>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:address:thunderbird:" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.MozabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Thunderbird Address Book</value>
+ </prop>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:address:ldap:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.MozabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">LDAP Address Book</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="BaseDN" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="MaxRowCount" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:int">
+ <value>100</value>
+ </prop>
+ </node>
+ <node oor:name="PortNumber" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:int">
+ <value>389</value>
+ </prop>
+ </node>
+ <node oor:name="UseSSL" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsTableCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="Authentication" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>UserPassword</value>
+ </prop>
+ </node>
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx
index f681d6953e04..369adf92a6bc 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx
@@ -48,10 +48,12 @@
#include <osl/mutex.hxx>
#include <osl/conditn.hxx>
+#include <nsIAbDirFactoryService.h>
#include <MNSInit.hxx>
#include <MNameMapper.hxx>
#include "MNSMozabProxy.hxx"
#include <MNSDeclares.hxx>
+
static ::osl::Mutex m_aMetaMutex;
#include <osl/diagnose.h>
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx b/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx
new file mode 100644
index 000000000000..351b5a5992f7
--- /dev/null
+++ b/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx
@@ -0,0 +1,453 @@
+/*************************************************************************
+* 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: code,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.
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_connectivity.hxx"
+
+#include <rtl/strbuf.hxx>
+ // keep this include at the beginning. Some of the other includes seems to inject a symbol "l" into the
+ // global namespace, which leads to a compiler warning in strbuf.hxx, about some parameters named "l"
+ // hiding objects "in an outer scope".
+
+#include "MLdapAttributeMap.hxx"
+#include "MTypeConverter.hxx"
+#include "MQueryHelper.hxx"
+
+#include <tools/diagnose_ex.h>
+
+#include <hash_map>
+
+//........................................................................
+namespace connectivity { namespace mozab {
+//........................................................................
+
+ //====================================================================
+ //= helper
+ //====================================================================
+ namespace
+ {
+ typedef nsresult (NS_STDCALL nsIAbCard::*CardPropertyGetter)( PRUnichar** aFirstName );
+ typedef nsresult (NS_STDCALL nsIAbCard::*CardPropertySetter)( const PRUnichar* aFirstName );
+ struct CardPropertyData
+ {
+ const sal_Char* pLDAPAttributeList;
+ CardPropertyGetter PropGetter;
+ CardPropertySetter PropSetter;
+
+ CardPropertyData()
+ :pLDAPAttributeList( NULL )
+ ,PropGetter( NULL )
+ ,PropSetter( NULL )
+ {
+ }
+ CardPropertyData( const sal_Char* _pLDAPAttributeList, CardPropertyGetter _PropGetter, CardPropertySetter _PropSetter )
+ :pLDAPAttributeList( _pLDAPAttributeList )
+ ,PropGetter( _PropGetter )
+ ,PropSetter( _PropSetter )
+ {
+ }
+ };
+
+ typedef ::std::hash_map< ::rtl::OString, CardPropertyData, ::rtl::OStringHash > MapPropertiesToAttributes;
+
+ #define DEF_CARD_ACCESS( PropertyName ) \
+ &nsIAbCard::Get##PropertyName, &nsIAbCard::Set##PropertyName
+
+ static const MapPropertiesToAttributes& lcl_getPropertyMap()
+ {
+ static MapPropertiesToAttributes aMap;
+ if ( aMap.empty() )
+ {
+ struct MapEntry
+ {
+ const sal_Char* pAsciiPropertyName;
+ const sal_Char* pAsciiAttrributeList;
+ CardPropertyGetter PropGetter;
+ CardPropertySetter PropSetter;
+ };
+ const MapEntry aEntries[] = {
+ { "FirstName", "givenname", DEF_CARD_ACCESS( FirstName ) },
+ { "LastName", "sn,surnname", DEF_CARD_ACCESS( LastName ) },
+ { "DisplayName", "cn,commonname,displayname", DEF_CARD_ACCESS( DisplayName ) },
+ { "NickName", "xmozillanickname", DEF_CARD_ACCESS( NickName ) },
+ { "PrimaryEmail", "mail", DEF_CARD_ACCESS( PrimaryEmail ) },
+ { "SecondEmail", "xmozillasecondemail", DEF_CARD_ACCESS( SecondEmail ) },
+ { "WorkPhone", "telephonenumber", DEF_CARD_ACCESS( WorkPhone ) },
+ { "HomePhone", "homephone", DEF_CARD_ACCESS( HomePhone ) },
+ { "FaxNumber", "fax,facsimiletelephonenumber", DEF_CARD_ACCESS( FaxNumber ) },
+ { "PagerNumber", "pager,pagerphone", DEF_CARD_ACCESS( PagerNumber ) },
+ { "CellularNumber", "mobile,cellphone,carphone", DEF_CARD_ACCESS( CellularNumber ) },
+ { "HomeAddress", "homepostaladdress,mozillaHomeStreet", DEF_CARD_ACCESS( HomeAddress ) },
+ { "HomeAddress2", "mozillaHomeStreet2", DEF_CARD_ACCESS( HomeAddress2 ) },
+ { "HomeCity", "homelocality,mozillaHomeLocalityName", DEF_CARD_ACCESS( HomeCity ) },
+ { "HomeState", "homeregion,mozillaHomeState", DEF_CARD_ACCESS( HomeState ) },
+ { "HomeZipCode", "homepostalcode,mozillaHomePostalCode", DEF_CARD_ACCESS( HomeZipCode ) },
+ { "HomeCountry", "homecountryname,mozillaHomeCountryName", DEF_CARD_ACCESS( HomeCountry ) },
+ { "WorkAddress", "postofficebox,streetaddress,streetaddress1", DEF_CARD_ACCESS( WorkAddress ) },
+ { "WorkAddress2", "streetaddress2", DEF_CARD_ACCESS( WorkAddress2 ) },
+ { "WorkCity", "l,locality", DEF_CARD_ACCESS( WorkCity ) },
+ { "WorkState", "st,region", DEF_CARD_ACCESS( WorkState ) },
+ { "WorkZipCode", "postalcode,zip", DEF_CARD_ACCESS( WorkZipCode ) },
+ { "WorkCountry", "countryname", DEF_CARD_ACCESS( WorkCountry ) },
+ { "JobTitle", "title", DEF_CARD_ACCESS( JobTitle ) },
+ { "Department", "ou,orgunit,department,departmentnumber", DEF_CARD_ACCESS( Department ) },
+ { "Company", "o,company", DEF_CARD_ACCESS( Company ) },
+ { "WebPage1", "workurl", DEF_CARD_ACCESS( WebPage1 ) },
+ { "WebPage2", "homeurl", DEF_CARD_ACCESS( WebPage2 ) },
+ { "BirthYear", "birthyear", DEF_CARD_ACCESS( BirthYear ) },
+ { "BirthMonth", "birthmonth", DEF_CARD_ACCESS( BirthMonth ) },
+ { "BirthYear", "birthday", DEF_CARD_ACCESS( BirthDay ) },
+ { "Custom1", "custom1", DEF_CARD_ACCESS( Custom1 ) },
+ { "Custom2", "custom2", DEF_CARD_ACCESS( Custom2 ) },
+ { "Custom3", "custom3", DEF_CARD_ACCESS( Custom3 ) },
+ { "Custom4", "custom4", DEF_CARD_ACCESS( Custom4 ) },
+ { "Notes", "notes,description", DEF_CARD_ACCESS( Notes ) },
+ { "PreferMailFormat", "xmozillausehtmlmail", NULL, NULL },
+ { NULL, NULL, NULL, NULL }
+ };
+ const MapEntry* loop = aEntries;
+ while ( loop->pAsciiPropertyName )
+ {
+ aMap[ ::rtl::OString( loop->pAsciiPropertyName ) ] =
+ CardPropertyData( loop->pAsciiAttrributeList, loop->PropGetter, loop->PropSetter );
+ ++loop;
+ }
+ }
+ return aMap;
+ }
+ }
+
+ //====================================================================
+ //= AttributeMap_Data
+ //====================================================================
+ struct AttributeMap_Data
+ {
+ };
+
+ //====================================================================
+ //= MLdapAttributeMap
+ //====================================================================
+ // -------------------------------------------------------------------
+ MLdapAttributeMap::MLdapAttributeMap()
+ :m_pData( new AttributeMap_Data )
+ {
+ }
+
+ // -------------------------------------------------------------------
+ MLdapAttributeMap::~MLdapAttributeMap()
+ {
+ }
+
+ // -------------------------------------------------------------------
+ NS_IMPL_THREADSAFE_ISUPPORTS1( MLdapAttributeMap, nsIAbLDAPAttributeMap )
+
+ // -------------------------------------------------------------------
+ NS_IMETHODIMP MLdapAttributeMap::GetAttributeList(const nsACString & aProperty, nsACString & _retval)
+ {
+ ::rtl::OString sProperty( MTypeConverter::nsACStringToOString( aProperty ) );
+
+ const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
+ MapPropertiesToAttributes::const_iterator pos = rPropertyMap.find( sProperty );
+
+ if ( pos == rPropertyMap.end() )
+ {
+ _retval.SetIsVoid( PR_TRUE );
+ }
+ else
+ {
+ MTypeConverter::asciiToNsACString( pos->second.pLDAPAttributeList, _retval );
+ }
+
+ return NS_OK;
+ }
+
+ // -------------------------------------------------------------------
+ NS_IMETHODIMP MLdapAttributeMap::GetAttributes(const nsACString & aProperty, PRUint32* aCount, char*** aAttrs)
+ {
+ OSL_ENSURE( false, "MLdapAttributeMap::GetAttributes: not implemented!" );
+ (void)aProperty;
+ (void)aCount;
+ (void)aAttrs;
+ return NS_ERROR_NOT_IMPLEMENTED;
+ }
+
+ // -------------------------------------------------------------------
+ NS_IMETHODIMP MLdapAttributeMap::GetFirstAttribute(const nsACString & aProperty, nsACString & _retval)
+ {
+ ::rtl::OString sProperty( MTypeConverter::nsACStringToOString( aProperty ) );
+
+ const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
+ MapPropertiesToAttributes::const_iterator pos = rPropertyMap.find( sProperty );
+
+ if ( pos == rPropertyMap.end() )
+ {
+ _retval.SetIsVoid( PR_TRUE );
+ }
+ else
+ {
+ sal_Int32 tokenPos(0);
+ ::rtl::OString sAttributeList( pos->second.pLDAPAttributeList );
+ MTypeConverter::asciiToNsACString( sAttributeList.getToken( 0, ',', tokenPos ).getStr(), _retval );
+ }
+
+ return NS_OK;
+ }
+
+ // -------------------------------------------------------------------
+ NS_IMETHODIMP MLdapAttributeMap::SetAttributeList(const nsACString & aProperty, const nsACString & aAttributeList, PRBool allowInconsistencies)
+ {
+ OSL_ENSURE( false, "MLdapAttributeMap::SetAttributeList: not implemented!" );
+ (void)aProperty;
+ (void)aAttributeList;
+ (void)allowInconsistencies;
+ return NS_ERROR_NOT_IMPLEMENTED;
+ }
+
+ // -------------------------------------------------------------------
+ NS_IMETHODIMP MLdapAttributeMap::GetProperty(const nsACString & aAttribute, nsACString & _retval)
+ {
+ OSL_ENSURE( false, "MLdapAttributeMap::GetProperty: not implemented!" );
+ (void)aAttribute;
+ (void)_retval;
+ return NS_ERROR_NOT_IMPLEMENTED;
+ }
+
+ // -------------------------------------------------------------------
+ NS_IMETHODIMP MLdapAttributeMap::GetAllCardAttributes(nsACString & _retval)
+ {
+ const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
+
+ ::rtl::OStringBuffer aAllAttributes;
+ for ( MapPropertiesToAttributes::const_iterator loop = rPropertyMap.begin();
+ loop != rPropertyMap.end();
+ ++loop
+ )
+ {
+ aAllAttributes.append( loop->second.pLDAPAttributeList );
+ if ( loop != rPropertyMap.end() )
+ aAllAttributes.append( ',' );
+ }
+
+ MTypeConverter::asciiToNsACString( aAllAttributes.getStr(), _retval );
+ return NS_OK;
+ }
+
+ // -------------------------------------------------------------------
+ NS_IMETHODIMP MLdapAttributeMap::CheckState(void)
+ {
+ // we do not allow modifying the map, so we're always in a valid state
+ return NS_OK;
+ }
+
+ // -------------------------------------------------------------------
+ NS_IMETHODIMP MLdapAttributeMap::SetFromPrefs(const nsACString & aPrefBranchName)
+ {
+ OSL_ENSURE( false, "MLdapAttributeMap::SetFromPrefs: not implemented!" );
+ (void)aPrefBranchName;
+ return NS_ERROR_NOT_IMPLEMENTED;
+ }
+
+ // -------------------------------------------------------------------
+ NS_IMETHODIMP MLdapAttributeMap::SetCardPropertiesFromLDAPMessage(nsILDAPMessage* aMessage, nsIAbCard* aCard)
+ {
+ NS_ENSURE_ARG_POINTER( aMessage );
+ NS_ENSURE_ARG_POINTER( aCard );
+
+ // in case that's not present in the LDAP message: set the "preferred mail format" to "none"
+ aCard->SetPreferMailFormat( nsIAbPreferMailFormat::unknown );
+
+ const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
+ for ( MapPropertiesToAttributes::const_iterator prop = rPropertyMap.begin();
+ prop != rPropertyMap.end();
+ ++prop
+ )
+ {
+ // split the list of attributes for the current property
+ ::rtl::OString sAttributeList( prop->second.pLDAPAttributeList );
+ ::rtl::OString sAttribute;
+
+ sal_Int32 tokenPos = 0;
+ while ( tokenPos != -1 )
+ {
+ sAttribute = sAttributeList.getToken( 0, ',', tokenPos );
+
+ // retrieve the values for the current attribute
+ PRUint32 valueCount = 0;
+ PRUnichar** values = NULL;
+ nsresult rv = aMessage->GetValues( sAttribute.getStr(), &valueCount, &values );
+ if ( NS_FAILED( rv ) )
+ // try the next attribute
+ continue;
+
+ if ( valueCount )
+ {
+ CardPropertySetter propSetter = prop->second.PropSetter;
+ OSL_ENSURE( propSetter,
+ "MLdapAttributeMap::SetCardPropertiesFromLDAPMessage: "
+ "unexpected: could retrieve an attribute value, but have no setter for it!" );
+ if ( propSetter )
+ {
+ (aCard->*propSetter)( values[0] );
+ }
+
+ // we're done with this property - no need to handle the remaining attributes which
+ // map to it
+ break;
+ }
+ }
+ }
+ return NS_OK;
+ }
+
+ // -------------------------------------------------------------------
+ namespace
+ {
+ struct PreferMailFormatType
+ {
+ const sal_Char* description;
+ PRUint32 formatType;
+
+ PreferMailFormatType()
+ :description( NULL )
+ ,formatType( nsIAbPreferMailFormat::unknown )
+ {
+ }
+
+ PreferMailFormatType( const sal_Char* _description, PRUint32 _formatType )
+ :description( _description )
+ ,formatType( _formatType )
+ {
+ }
+ };
+
+ static const PreferMailFormatType* lcl_getMailFormatTypes()
+ {
+ static const PreferMailFormatType aMailFormatTypes[] =
+ {
+ PreferMailFormatType( "text/plain", nsIAbPreferMailFormat::plaintext ),
+ PreferMailFormatType( "text/html", nsIAbPreferMailFormat::html ),
+ PreferMailFormatType( "unknown", nsIAbPreferMailFormat::unknown ),
+ PreferMailFormatType()
+ };
+ return aMailFormatTypes;
+ }
+ }
+
+ // -------------------------------------------------------------------
+ void MLdapAttributeMap::fillCardFromResult( nsIAbCard& _card, const MQueryHelperResultEntry& _result )
+ {
+ _card.SetPreferMailFormat( nsIAbPreferMailFormat::unknown );
+
+ ::rtl::OUString resultValue;
+
+ const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
+ for ( MapPropertiesToAttributes::const_iterator prop = rPropertyMap.begin();
+ prop != rPropertyMap.end();
+ ++prop
+ )
+ {
+ resultValue = _result.getValue( prop->first );
+
+ CardPropertySetter propSetter = prop->second.PropSetter;
+ if ( propSetter )
+ {
+ // PRUnichar != sal_Unicode in mingw
+ (_card.*propSetter)( reinterpret_cast_mingw_only<const PRUnichar *>(resultValue.getStr()) );
+ }
+ else
+ {
+ if ( prop->first.equals( "PreferMailFormat" ) )
+ {
+ unsigned int format = nsIAbPreferMailFormat::unknown;
+ const PreferMailFormatType* pMailFormatType = lcl_getMailFormatTypes();
+ while ( pMailFormatType->description )
+ {
+ if ( resultValue.equalsAscii( pMailFormatType->description ) )
+ {
+ format = pMailFormatType->formatType;
+ break;
+ }
+ ++pMailFormatType;
+ }
+ _card.SetPreferMailFormat(format);
+ }
+ else
+ OSL_ENSURE( false, "MLdapAttributeMap::fillCardFromResult: unexpected property without default setters!" );
+ }
+ }
+ }
+
+ // -------------------------------------------------------------------
+ void MLdapAttributeMap::fillResultFromCard( MQueryHelperResultEntry& _result, nsIAbCard& _card )
+ {
+ nsXPIDLString value;
+ ::rtl::OUString resultValue;
+
+ const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
+ for ( MapPropertiesToAttributes::const_iterator prop = rPropertyMap.begin();
+ prop != rPropertyMap.end();
+ ++prop
+ )
+ {
+ CardPropertyGetter propGetter = prop->second.PropGetter;
+ if ( propGetter )
+ {
+ (_card.*propGetter)( getter_Copies( value ) );
+
+ nsAutoString temp( value );
+ MTypeConverter::nsStringToOUString( temp, resultValue );
+ }
+ else
+ {
+ if ( prop->first.equals( "PreferMailFormat" ) )
+ {
+ unsigned int format = nsIAbPreferMailFormat::unknown;
+ _card.GetPreferMailFormat( &format );
+ const PreferMailFormatType* pMailFormatType = lcl_getMailFormatTypes();
+ while ( pMailFormatType->description )
+ {
+ if ( format == pMailFormatType->formatType )
+ {
+ resultValue = ::rtl::OUString::createFromAscii( pMailFormatType->description );
+ break;
+ }
+ ++pMailFormatType;
+ }
+ }
+ else
+ OSL_ENSURE( false, "MLdapAttributeMap::fillResultFromCard: unexpected property without default getters!" );
+ }
+
+ _result.insert( prop->first, resultValue );
+ }
+ }
+
+//........................................................................
+} } // namespace connectivity::mozab
+//........................................................................
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx b/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx
new file mode 100644
index 000000000000..7cf5aa86a252
--- /dev/null
+++ b/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+* 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: code,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 CONNECTIVITY_MLDAPATTRIBUTEMAP_HXX
+#define CONNECTIVITY_MLDAPATTRIBUTEMAP_HXX
+
+#include <MNSInclude.hxx>
+
+#include <memory>
+
+//........................................................................
+namespace connectivity { namespace mozab {
+//........................................................................
+
+ struct AttributeMap_Data;
+ class MQueryHelperResultEntry;
+
+ //====================================================================
+ //= class MLdapAttributeMap
+ //====================================================================
+ /** implements the nsIAbLDAPAttributeMap interface
+
+ Somewhere between Mozilla 1.7.5 and SeaMonkey 1.1.12, the LDAP address book
+ implementation was changed to take the attribute mapping (from LDAP attributes
+ to address book properties) not directly from the preferences. Instead, this mapping
+ is now delivered by a dedicated implementation (supporting the nsIAbLDAPAttributeMap
+ interface).
+
+ */
+ class MLdapAttributeMap : public nsIAbLDAPAttributeMap
+ {
+ public:
+ MLdapAttributeMap();
+
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIABLDAPATTRIBUTEMAP
+
+ static void fillCardFromResult( nsIAbCard& _card, const MQueryHelperResultEntry& _result );
+ static void fillResultFromCard( MQueryHelperResultEntry& _result, nsIAbCard& _card );
+
+ protected:
+ virtual ~MLdapAttributeMap();
+
+ private:
+ ::std::auto_ptr< AttributeMap_Data > m_pData;
+ };
+
+//........................................................................
+} } // namespace connectivity::mozab
+//........................................................................
+
+#endif // CONNECTIVITY_MLDAPATTRIBUTEMAP_HXX
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx b/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx
index 881878a665f5..a40de061281b 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx
@@ -34,6 +34,9 @@
// Only include Mozilla include files once and using this file...
//
+// moved this here and in first position due to "long l;" unxsoli4 warning
+#include <rtl/ustrbuf.hxx>
+
#include "pre_include_mozilla.h"
#if defined __GNUC__
#pragma GCC system_header
@@ -44,6 +47,7 @@
#include <nsCOMPtr.h>
#include <nsISupportsArray.h>
#include <nsString.h>
+
#if defined __SUNPRO_CC
#pragma disable_warn
// somewhere in the files included directly or indirectly in nsString.h, warnings are enabled, again
@@ -70,6 +74,8 @@
#include <nsIAbDirectoryQueryProxy.h>
#include <nsIAbDirFactory.h>
#include <nsIRunnable.h>
+#include <nsIAbLDAPAttributeMap.h>
+#include <nsILDAPMessage.h>
#include <prerr.h>
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.cxx b/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.cxx
index e0a338835b94..d26c34acbced 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.cxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.cxx
@@ -379,7 +379,8 @@ MNSMozabProxy::InitLDAP(sal_Char* sUri, sal_Unicode* sBindDN, sal_Unicode* pPass
messageListener->AddRef();
nsCAutoString nsBind;
- nsBind.AssignWithConversion(sBindDN);
+ // PRUnichar != sal_Unicode in mingw
+ nsBind.AssignWithConversion(reinterpret_cast_mingw_only<const PRUnichar *>(sBindDN));
// Now lets initialize the LDAP connection properly.
rv = ldapConnection->Init(host.get(), port, useSSL, nsBind,
@@ -395,7 +396,8 @@ MNSMozabProxy::InitLDAP(sal_Char* sUri, sal_Unicode* sBindDN, sal_Unicode* pPass
if ( pPasswd && *pPasswd )
{
nsCAutoString nsPassword;
- nsPassword.AssignWithConversion(pPasswd);
+ // PRUnichar != sal_Unicode in mingw
+ nsPassword.AssignWithConversion(reinterpret_cast_mingw_only<const PRUnichar *>(pPasswd));
rv = ldapOperation->SimpleBind(nsPassword);
}
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx b/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx
index b298e56262cc..9ff5aa04fc07 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx
@@ -30,14 +30,14 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_connectivity.hxx"
+
#include <MQueryHelper.hxx>
#include <MNameMapper.hxx>
#include <MConnection.hxx>
#include <connectivity/dbexception.hxx>
#include "MQuery.hxx"
-#ifndef _CONNECTIVITY_MAB_CONVERSIONS_HXX_
+#include "MLdapAttributeMap.hxx"
#include "MTypeConverter.hxx"
-#endif
#include "MNSMozabProxy.hxx"
#include <com/sun/star/uno/Reference.hxx>
#include <unotools/processfactory.hxx>
@@ -54,6 +54,7 @@ static NS_DEFINE_CID(kAbDirectoryQueryArgumentsCID, NS_ABDIRECTORYQUERYARGUMENTS
static NS_DEFINE_CID(kBooleanConditionStringCID, NS_BOOLEANCONDITIONSTRING_CID);
static NS_DEFINE_CID(kBooleanExpressionCID, NS_BOOLEANEXPRESSION_CID);
static NS_DEFINE_CID(kAbDirectoryQueryProxyCID, NS_ABDIRECTORYQUERYPROXY_CID);
+static NS_DEFINE_CID(kAbLDAPAttributeMap, NS_IABLDAPATTRIBUTEMAP_IID);
using namespace connectivity::mozab;
using namespace connectivity;
@@ -139,31 +140,6 @@ void MQuery::construct()
NS_IF_ADDREF( m_aQueryHelper);
}
// -------------------------------------------------------------------------
-void MQuery::setAttributes(::std::vector< ::rtl::OUString> &attrs)
-{
- OSL_TRACE("IN MQuery::setAttributes()\n");
- ::osl::MutexGuard aGuard( m_aMutex );
-
- m_aAttributes.clear();
- m_aAttributes.reserve(attrs.size());
- ::std::vector< ::rtl::OUString>::iterator aIterAttr = attrs.begin();
- ::std::map< ::rtl::OUString, ::rtl::OUString>::iterator aIterMap;
-
- for ( aIterAttr = attrs.begin(); aIterAttr != attrs.end();++aIterAttr )
- m_aAttributes.push_back( m_rColumnAlias.getProgrammaticNameOrFallbackToAlias( *aIterAttr ) );
-
- OSL_TRACE("\tOUT MQuery::setAttributes()\n");
-}
-// -------------------------------------------------------------------------
-const ::std::vector< ::rtl::OUString> &MQuery::getAttributes() const
-{
- OSL_TRACE("IN MQuery::getAttributes()\n");
-
- OSL_TRACE("\tOUT MQuery::getAttributes()\n");
-
- return(m_aAttributes);
-}
-// -------------------------------------------------------------------------
void MQuery::setAddressbook(::rtl::OUString &ab)
{
OSL_TRACE("IN MQuery::setAddressbook()\n");
@@ -253,12 +229,9 @@ static sal_Int32 generateExpression( MQuery* _aQuery, MQueryExpression* _aExpr,
// Set the 'name' property of the boolString.
// Check if it's an alias first...
- rtl::OUString attrName;
- ::std::map< ::rtl::OUString, ::rtl::OUString>::const_iterator aIterMap;
- attrName = _aQuery->getColumnAlias().getProgrammaticNameOrFallbackToAlias( evStr->getName() );
- ::std::string aMiName = MTypeConverter::ouStringToStlString(attrName);
- boolString->SetName(strdup(aMiName.c_str()));
- OSL_TRACE("Name = %s ;", aMiName.c_str() );
+ rtl::OString attrName = _aQuery->getColumnAlias().getProgrammaticNameOrFallbackToUTF8Alias( evStr->getName() );
+ boolString->SetName( strdup( attrName.getStr() ) );
+ OSL_TRACE("Name = %s ;", attrName.getStr() );
// Set the 'matchType' property of the boolString. Check for equal length.
sal_Bool requiresValue = sal_True;
switch(evStr->getCond()) {
@@ -609,8 +582,8 @@ sal_Int32 MQuery::executeQueryProxied(OConnection* _pCon)
PRInt32 count=1;
nsCOMPtr< nsIAbDirectoryQueryArguments > arguments = do_CreateInstance( kAbDirectoryQueryArgumentsCID, &rv);
-
NS_ENSURE_SUCCESS( rv, rv );
+
rv = arguments->SetExpression(queryExpression);
NS_ENSURE_SUCCESS( rv, rv );
@@ -620,6 +593,10 @@ sal_Int32 MQuery::executeQueryProxied(OConnection* _pCon)
rv = arguments->SetQuerySubDirectories(m_bQuerySubDirs);
NS_ENSURE_SUCCESS( rv, rv );
+ nsCOMPtr< nsIAbLDAPAttributeMap > attributeMap( new MLdapAttributeMap );
+ rv = arguments->SetTypeSpecificArg( attributeMap );
+ NS_ENSURE_SUCCESS( rv, rv );
+
// Execute the query.
OSL_TRACE( "****** calling DoQuery\n");
@@ -719,7 +696,7 @@ MQuery::setRowValue( ORowSetValue& rValue, sal_Int32 nDBRow,const rtl::OUString&
switch ( nType )
{
case DataType::VARCHAR:
- xResEntry->setValue( m_rColumnAlias.getProgrammaticNameOrFallbackToAlias( aDBColumnName ), rValue.getString() );
+ xResEntry->setValue( m_rColumnAlias.getProgrammaticNameOrFallbackToUTF8Alias( aDBColumnName ), rValue.getString() );
break;
default:
OSL_ENSURE( sal_False, "invalid data type!" );
@@ -745,7 +722,7 @@ MQuery::getRowValue( ORowSetValue& rValue, sal_Int32 nDBRow,const rtl::OUString&
switch ( nType )
{
case DataType::VARCHAR:
- rValue = xResEntry->getValue( m_rColumnAlias.getProgrammaticNameOrFallbackToAlias( aDBColumnName ) );
+ rValue = xResEntry->getValue( m_rColumnAlias.getProgrammaticNameOrFallbackToUTF8Alias( aDBColumnName ) );
break;
default:
@@ -828,8 +805,7 @@ MQuery::FreeNameMapper( MNameMapper* _ptr )
delete _ptr;
}
// -------------------------------------------------------------------------
-sal_Bool MQuery::
-isWritable(OConnection* _pCon)
+sal_Bool MQuery::isWritable(OConnection* _pCon)
{
if ( !m_aQueryDirectory )
return sal_False;
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx b/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx
index 7ff57d8d0d23..8bf376cde61f 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx
@@ -205,7 +205,6 @@ namespace connectivity
private:
MQueryDirectory *m_aQueryDirectory;
MQueryHelper *m_aQueryHelper;
- ::std::vector< ::rtl::OUString> m_aAttributes;
::rtl::OUString m_aAddressbook;
sal_Int32 m_nMaxNrOfReturns;
sal_Bool m_bQuerySubDirs;
@@ -240,9 +239,6 @@ namespace connectivity
sal_uInt32 InsertLoginInfo(OConnection* _pCon);
- void setAttributes( ::std::vector< ::rtl::OUString>&);
- const ::std::vector< ::rtl::OUString> &getAttributes(void) const;
-
void setAddressbook( ::rtl::OUString&);
::rtl::OUString getAddressbook(void) const;
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx
index 01fed34d8b39..3a1fe97d8311 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx
@@ -30,62 +30,20 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_connectivity.hxx"
-#include <MQueryHelper.hxx>
+#include "MQueryHelper.hxx"
#include "MTypeConverter.hxx"
+#include "MConnection.hxx"
+#include "MNSDeclares.hxx"
+#include "MLdapAttributeMap.hxx"
+
#include <connectivity/dbexception.hxx>
-#ifndef _CONNECTIVITY_MOZAB_BCONNECTION_HXX_
-#include <MConnection.hxx>
-#endif
#include "resource/mozab_res.hrc"
-#include "MNSDeclares.hxx"
using namespace connectivity::mozab;
-enum
-{
- index_FirstName=0,
- index_LastName,
- index_DisplayName,
- index_NickName,
- index_PrimaryEmail,
- index_SecondEmail,
- index_PreferMailFormat,
- index_WorkPhone,
- index_HomePhone,
- index_FaxNumber,
- index_PagerNumber,
- index_CellularNumber,
- index_HomeAddress,
- index_HomeAddress2,
- index_HomeCity,
- index_HomeState,
- index_HomeZipCode,
- index_HomeCountry,
- index_WorkAddress,
- index_WorkAddress2,
- index_WorkCity,
- index_WorkState,
- index_WorkZipCode,
- index_WorkCountry,
- index_JobTitle,
- index_Department,
- index_Company,
- index_WebPage1,
- index_WebPage2,
- index_BirthYear,
- index_BirthMonth,
- index_BirthDay,
- index_Custom1,
- index_Custom2,
- index_Custom3,
- index_Custom4,
- index_Notes
-};
-
-
NS_IMPL_THREADSAFE_ISUPPORTS1(connectivity::mozab::MQueryHelper,nsIAbDirectoryQueryResultListener)
//
@@ -101,8 +59,6 @@ MQueryHelperResultEntry::MQueryHelperResultEntry()
MQueryHelperResultEntry::~MQueryHelperResultEntry()
{
-
-
OSL_TRACE("IN MQueryHelperResultEntry::~MQueryHelperResultEntry()\n");
OSL_TRACE("OUT MQueryHelperResultEntry::~MQueryHelperResultEntry()\n");
@@ -117,39 +73,31 @@ MQueryHelperResultEntry::getCard()
{
return m_Card;
}
-void
-MQueryHelperResultEntry::insert( const rtl::OUString &key, rtl::OUString &value )
+void MQueryHelperResultEntry::insert( const rtl::OString &key, rtl::OUString &value )
{
- m_Fields.insert( fieldMap::value_type( key, value ) );
+ m_Fields[ key ] = value;
}
-rtl::OUString
-MQueryHelperResultEntry::getValue( const rtl::OUString &key ) const
+rtl::OUString MQueryHelperResultEntry::getValue( const rtl::OString &key ) const
{
- fieldMap::const_iterator iter;
-
- iter = m_Fields.find( key );
-
- if ( iter == m_Fields.end() ) {
+ FieldMap::const_iterator iter = m_Fields.find( key );
+ if ( iter == m_Fields.end() )
+ {
return rtl::OUString();
- } else {
- return (*iter).second;
+ }
+ else
+ {
+ return iter->second;
}
}
-rtl::OUString
-MQueryHelperResultEntry::setValue( const rtl::OUString &key, const rtl::OUString & rValue)
+void MQueryHelperResultEntry::setValue( const rtl::OString &key, const rtl::OUString & rValue)
{
- m_Fields.erase(key);
- m_Fields.insert( fieldMap::value_type( key, rValue ) );
- return rValue;
+ m_Fields[ key ] = rValue;
}
//
// class MQueryHelper
//
-// MIME-types.
-static char PreferMailFormatTypes[2][11] = {"text/plain",
- "text/html"};
MQueryHelper::MQueryHelper()
:m_nIndex( 0 )
,m_bHasMore( sal_True )
@@ -473,7 +421,7 @@ NS_IMETHODIMP MQueryHelper::OnQueryItem(nsIAbDirectoryQueryResult *result)
nsCOMPtr<nsIAbCard> card(do_QueryInterface(cardSupports, &rv));
NS_ENSURE_SUCCESS(rv, rv);
- getCardValues(card);
+ getCardValues(card);
}
nsMemory::Free(name);
@@ -484,56 +432,13 @@ NS_IMETHODIMP MQueryHelper::OnQueryItem(nsIAbDirectoryQueryResult *result)
return(NS_OK);
}
+// -----------------------------------------------------------------------------
void MQueryHelper::notifyQueryError()
{
m_bQueryComplete = sal_True ;
notifyResultOrComplete() ;
}
-static const ::rtl::OUString& getAttribute(PRUint32 index)
-{
- static const ::rtl::OUString sAttributeNames[] =
- {
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstName")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LastName")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DisplayName")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NickName")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PrimaryEmail")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SecondEmail")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PreferMailFormat")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkPhone")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomePhone")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FaxNumber")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PagerNumber")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellularNumber")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeAddress")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeAddress2")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeCity")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeState")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeZipCode")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeCountry")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkAddress")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkAddress2")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkCity")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkState")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkZipCode")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkCountry")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("JobTitle")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Department")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Company")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WebPage1")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WebPage2")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BirthYear")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BirthMonth")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BirthDay")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom1")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom2")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom3")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom4")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Notes"))
- };
- return sAttributeNames[index];
-}
const char * getAddrURI(const nsIAbDirectory* directory)
{
nsresult retCode;
@@ -687,127 +592,7 @@ sal_Bool MQueryHelper::setCardValues(const sal_Int32 rowIndex)
return sal_False;
}
- ::rtl::OUString sValue;
-
- getCardAttributeAndValue(getAttribute(index_FirstName),sValue,resEntry);
- card->SetFirstName(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_LastName),sValue,resEntry);
- card->SetLastName(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_DisplayName),sValue,resEntry);
- card->SetDisplayName(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_NickName),sValue,resEntry);
- card->SetNickName(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_PrimaryEmail),sValue,resEntry);
- card->SetPrimaryEmail(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_SecondEmail),sValue,resEntry);
- card->SetSecondEmail(sValue.getStr());
-
- unsigned int format;
- ::rtl::OUString prefMailValue;
- getCardAttributeAndValue(getAttribute(index_WorkPhone),prefMailValue,resEntry);
- for(format=2;format >0;format--)
- {
- if (! prefMailValue.compareTo(
- ::rtl::OUString::createFromAscii(PreferMailFormatTypes[format-1]) ) )
- break;
- }
- card->SetPreferMailFormat(format);
-
- getCardAttributeAndValue(getAttribute(index_WorkPhone),sValue,resEntry);
- card->SetWorkPhone(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_HomePhone),sValue,resEntry);
- card->SetHomePhone(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_FaxNumber),sValue,resEntry);
- card->SetFaxNumber(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_PagerNumber),sValue,resEntry);
- card->SetPagerNumber(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_CellularNumber),sValue,resEntry);
- card->SetCellularNumber(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_HomeAddress),sValue,resEntry);
- card->SetHomeAddress(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_HomeAddress2),sValue,resEntry);
- card->SetHomeAddress2(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_HomeCity),sValue,resEntry);
- card->SetHomeCity(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_HomeState),sValue,resEntry);
- card->SetHomeState(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_HomeZipCode),sValue,resEntry);
- card->SetHomeZipCode(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_HomeCountry),sValue,resEntry);
- card->SetHomeCountry(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_WorkAddress),sValue,resEntry);
- card->SetWorkAddress(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_WorkAddress2),sValue,resEntry);
- card->SetWorkAddress2(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_WorkCity),sValue,resEntry);
- card->SetWorkCity(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_WorkState),sValue,resEntry);
- card->SetWorkState(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_WorkZipCode),sValue,resEntry);
- card->SetWorkZipCode(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_WorkCountry),sValue,resEntry);
- card->SetWorkCountry(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_JobTitle),sValue,resEntry);
- card->SetJobTitle(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_Department),sValue,resEntry);
- card->SetDepartment(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_Company),sValue,resEntry);
- card->SetCompany(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_WebPage1),sValue,resEntry);
- card->SetWebPage1(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_WebPage2),sValue,resEntry);
- card->SetWebPage2(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_BirthYear),sValue,resEntry);
- card->SetBirthYear(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_BirthMonth),sValue,resEntry);
- card->SetBirthMonth(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_BirthDay),sValue,resEntry);
- card->SetBirthDay(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_Custom1),sValue,resEntry);
- card->SetCustom1(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_Custom2),sValue,resEntry);
- card->SetCustom2(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_Custom3),sValue,resEntry);
- card->SetCustom3(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_Custom4),sValue,resEntry);
- card->SetCustom4(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_Notes),sValue,resEntry);
- card->SetNotes(sValue.getStr());
-
+ MLdapAttributeMap::fillCardFromResult( *card, *resEntry );
return sal_True;
}
@@ -821,142 +606,7 @@ void MQueryHelper::getCardValues(nsIAbCard *card,sal_Int32 rowIndex)
else
resEntry = new MQueryHelperResultEntry();
- nsXPIDLString sValue;
-
- card->GetFirstName(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_FirstName),sValue,resEntry);
-
- card->GetLastName(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_LastName),sValue,resEntry);
-
- card->GetDisplayName(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_DisplayName),sValue,resEntry);
-
- card->GetNickName(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_NickName),sValue,resEntry);
-
- card->GetPrimaryEmail(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_PrimaryEmail),sValue,resEntry);
-
- card->GetSecondEmail(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_SecondEmail),sValue,resEntry);
-
- unsigned int format = 0;
- card->GetPreferMailFormat(&format);
- ::rtl::OUString prefMailValue;
- switch(format)
- {
- case nsIAbPreferMailFormat::html:
- prefMailValue = ::rtl::OUString::createFromAscii(PreferMailFormatTypes[1]);
- break;
- case nsIAbPreferMailFormat::plaintext:
- prefMailValue = ::rtl::OUString::createFromAscii(PreferMailFormatTypes[0]);
- break;
- case nsIAbPreferMailFormat::unknown:
- default:
- prefMailValue = ::rtl::OUString::createFromAscii(PreferMailFormatTypes[0]);
- break;
-
- }
- resEntry->insert( getAttribute(index_PreferMailFormat), prefMailValue );
-
- card->GetWorkPhone(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_WorkPhone),sValue,resEntry);
-
- card->GetHomePhone(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_HomePhone),sValue,resEntry);
-
- card->GetFaxNumber(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_FaxNumber),sValue,resEntry);
-
- card->GetPagerNumber(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_PagerNumber),sValue,resEntry);
-
- card->GetCellularNumber(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_CellularNumber),sValue,resEntry);
-
- card->GetHomeAddress(getter_Copies(sValue));
- PRInt32 offset;
- nsXPIDLString space;
- space.Assign(NS_LITERAL_STRING(" "));
- while ((offset = sValue.FindChar('\r')) >= 0) sValue.Replace(offset, 1, space);
- while ((offset = sValue.FindChar('\n')) >= 0) sValue.Replace(offset, 1, space);
- addCardAttributeAndValue(getAttribute(index_HomeAddress),sValue,resEntry);
-
- card->GetHomeAddress2(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_HomeAddress2),sValue,resEntry);
-
- card->GetHomeCity(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_HomeCity),sValue,resEntry);
-
- card->GetHomeState(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_HomeState),sValue,resEntry);
-
- card->GetHomeZipCode(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_HomeZipCode),sValue,resEntry);
-
- card->GetHomeCountry(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_HomeCountry),sValue,resEntry);
-
- card->GetWorkAddress(getter_Copies(sValue));
- while ((offset = sValue.FindChar('\r')) >= 0) sValue.Replace(offset, 1, space);
- while ((offset = sValue.FindChar('\n')) >= 0) sValue.Replace(offset, 1, space);
- addCardAttributeAndValue(getAttribute(index_WorkAddress),sValue,resEntry);
-
- card->GetWorkAddress2(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_WorkAddress2),sValue,resEntry);
-
- card->GetWorkCity(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_WorkCity),sValue,resEntry);
-
- card->GetWorkState(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_WorkState),sValue,resEntry);
-
- card->GetWorkZipCode(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_WorkZipCode),sValue,resEntry);
-
- card->GetWorkCountry(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_WorkCountry),sValue,resEntry);
-
- card->GetJobTitle(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_JobTitle),sValue,resEntry);
-
- card->GetDepartment(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_Department),sValue,resEntry);
-
- card->GetCompany(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_Company),sValue,resEntry);
-
- card->GetWebPage1(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_WebPage1),sValue,resEntry);
-
- card->GetWebPage2(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_WebPage2),sValue,resEntry);
-
- card->GetBirthYear(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_BirthYear),sValue,resEntry);
-
- card->GetBirthMonth(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_BirthMonth),sValue,resEntry);
-
- card->GetBirthDay(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_BirthDay),sValue,resEntry);
-
- card->GetCustom1(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_Custom1),sValue,resEntry);
-
- card->GetCustom2(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_Custom2),sValue,resEntry);
-
- card->GetCustom3(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_Custom3),sValue,resEntry);
-
- card->GetCustom4(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_Custom4),sValue,resEntry);
-
- card->GetNotes(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_Notes),sValue,resEntry);
-
+ MLdapAttributeMap::fillResultFromCard( *resEntry, *card );
resEntry->setCard(card);
if (!rowIndex)
append( resEntry );
@@ -975,21 +625,8 @@ sal_Bool MQueryHelper::resyncRow(sal_Int32 rowIndex)
getCardValues(card,rowIndex);
return sal_True;
}
-void MQueryHelper::addCardAttributeAndValue(const ::rtl::OUString& sName, nsXPIDLString Value, MQueryHelperResultEntry *resEntry)
-{
- nsAutoString temp(Value) ;
- ::rtl::OUString attrValue;
- MTypeConverter::nsStringToOUString( temp, attrValue );
- resEntry->insert( sName, attrValue );
-}
-
-void MQueryHelper::getCardAttributeAndValue(const ::rtl::OUString& sName, ::rtl::OUString &ouValue, MQueryHelperResultEntry *resEntry)
-{
- ouValue = resEntry->getValue( sName);
-}
-
// -------------------------------------------------------------------------
-sal_Int32 MQueryHelper::createNewCard()
+sal_Int32 MQueryHelper::createNewCard()
{
::osl::MutexGuard aGuard( m_aMutex );
nsresult rv;
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx
index 2f3f4db2d7c5..c08a110a04c0 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx
@@ -40,6 +40,8 @@
#include <comphelper/stl_types.hxx>
#include <osl/thread.hxx>
+#include <hash_map>
+
namespace connectivity
{
namespace mozab
@@ -47,20 +49,20 @@ namespace connectivity
class MQueryHelperResultEntry
{
private:
- mutable ::osl::Mutex m_aMutex;
+ typedef ::std::hash_map< ::rtl::OString, ::rtl::OUString, ::rtl::OStringHash > FieldMap;
- DECLARE_STL_USTRINGACCESS_MAP(::rtl::OUString,fieldMap);
+ mutable ::osl::Mutex m_aMutex;
+ FieldMap m_Fields;
+ nsCOMPtr<nsIAbCard> m_Card;
+ sal_Int32 m_RowStates;
- fieldMap m_Fields;
- nsCOMPtr<nsIAbCard> m_Card;
- sal_Int32 m_RowStates;
public:
MQueryHelperResultEntry();
~MQueryHelperResultEntry();
- void insert( const rtl::OUString &key, rtl::OUString &value );
- rtl::OUString getValue( const rtl::OUString &key ) const;
- rtl::OUString setValue( const rtl::OUString &key, const rtl::OUString & rValue);
+ void insert( const rtl::OString &key, rtl::OUString &value );
+ rtl::OUString getValue( const rtl::OString &key ) const;
+ void setValue( const rtl::OString &key, const rtl::OUString & rValue);
void setCard(nsIAbCard *card);
nsIAbCard *getCard();
@@ -90,8 +92,6 @@ namespace connectivity
void clearResultOrComplete();
void notifyResultOrComplete();
sal_Bool waitForResultOrComplete( );
- void addCardAttributeAndValue(const ::rtl::OUString& sName, nsXPIDLString sValue,MQueryHelperResultEntry *resEntry);
- void getCardAttributeAndValue(const ::rtl::OUString& sName, ::rtl::OUString &ouValue, MQueryHelperResultEntry *resEntry) ;
void getCardValues(nsIAbCard *card,sal_Int32 rowIndex=0);
#if OSL_DEBUG_LEVEL > 0
oslThreadIdentifier m_oThreadID;
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx b/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx
index 129cf2d770f5..bd4201ee3729 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx
@@ -51,6 +51,32 @@ void MTypeConverter::ouStringToNsString(::rtl::OUString const &ous, nsString &ns
nss = mozString; // temp.
}
// -------------------------------------------------------------------------
+::rtl::OUString MTypeConverter::nsACStringToOUString( const nsACString& _source )
+{
+ const char* buffer = _source.BeginReading();
+ const char* bufferEnd = _source.EndReading();
+ return ::rtl::OUString( buffer, bufferEnd - buffer, RTL_TEXTENCODING_ASCII_US );
+}
+// -------------------------------------------------------------------------
+::rtl::OString MTypeConverter::nsACStringToOString( const nsACString& _source )
+{
+ const char* buffer = _source.BeginReading();
+ const char* bufferEnd = _source.EndReading();
+ return ::rtl::OString( buffer, bufferEnd - buffer );
+}
+// -------------------------------------------------------------------------
+void MTypeConverter::asciiOUStringToNsACString( const ::rtl::OUString& _asciiString, nsACString& _dest )
+{
+ ::rtl::OString sAsciiVersion( _asciiString.getStr(), _asciiString.getLength(), RTL_TEXTENCODING_ASCII_US );
+ asciiToNsACString( sAsciiVersion.getStr(), _dest );
+}
+// -------------------------------------------------------------------------
+void MTypeConverter::asciiToNsACString( const sal_Char* _asciiString, nsACString& _dest )
+{
+ _dest.Truncate();
+ _dest.AppendASCII( _asciiString );
+}
+// -------------------------------------------------------------------------
void MTypeConverter::nsStringToOUString(nsString const &nss, ::rtl::OUString &ous)
{
// Get clone of buffer.
@@ -58,7 +84,8 @@ void MTypeConverter::nsStringToOUString(nsString const &nss, ::rtl::OUString &ou
sal_Int32 nssLen = nss.Length();
// TODO check if this is ok.
- ::rtl::OUString _ous(uc, nssLen);
+ // PRUnichar != sal_Unicode in mingw
+ ::rtl::OUString _ous(reinterpret_cast_mingw_only<sal_Unicode *>(uc), nssLen);
ous = _ous;
nsMemory::Free(uc);
@@ -67,7 +94,8 @@ void MTypeConverter::nsStringToOUString(nsString const &nss, ::rtl::OUString &ou
void MTypeConverter::prUnicharToOUString(PRUnichar const *pru, ::rtl::OUString &ous)
{
// TODO, specify length.
- ::rtl::OUString _ous(pru);
+ // PRUnichar != sal_Unicode in mingw
+ ::rtl::OUString _ous(reinterpret_cast_mingw_only<const sal_Unicode *>(pru));
ous = _ous;
}
// -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx b/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx
index 792934ee1229..dab5af9645df 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx
@@ -54,6 +54,11 @@ namespace connectivity
static ::std::string ouStringToStlString(const ::rtl::OUString&);
static ::std::string nsStringToStlString(const nsString&);
+ static ::rtl::OUString nsACStringToOUString( const nsACString& _source );
+ static ::rtl::OString nsACStringToOString( const nsACString& _source );
+ static void asciiOUStringToNsACString( const ::rtl::OUString& _asciiString, nsACString& _dest );
+ static void asciiToNsACString( const sal_Char* _asciiString, nsACString& _dest );
+
private:
MTypeConverter() {};
};
diff --git a/connectivity/source/drivers/mozab/mozillasrc/makefile.mk b/connectivity/source/drivers/mozab/mozillasrc/makefile.mk
index 764081619770..e350365d3442 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/makefile.mk
+++ b/connectivity/source/drivers/mozab/mozillasrc/makefile.mk
@@ -71,10 +71,13 @@ SLOFILES = \
$(SLO)$/MQuery.obj \
$(SLO)$/MTypeConverter.obj \
$(SLO)$/MNameMapper.obj \
- $(SLO)$/MNSMozabProxy.obj \
- $(SLO)$/MNSTerminateListener.obj
+ $(SLO)$/MNSMozabProxy.obj \
+ $(SLO)$/MNSTerminateListener.obj \
+ $(SLO)$/MLdapAttributeMap.obj \
+CDEFS += -DMOZILLA_INTERNAL_API
+
.IF "$(GUI)"=="UNX"
.IF "$(COMNAME)"=="sunpro5"
CFLAGS += -features=tmplife
@@ -154,7 +157,7 @@ CFLAGS += -fPIC
CFLAGSCXX += \
-fno-rtti -Wconversion -Wpointer-arith \
-Wcast-align -Woverloaded-virtual -Wsynth \
- -Wno-long-long
+ -Wno-long-long -Wno-deprecated
CDEFS += -DTRACING
.ENDIF
.ENDIF
diff --git a/connectivity/source/drivers/mozab/post_include_mozilla.h b/connectivity/source/drivers/mozab/post_include_mozilla.h
index 3de12f1122bc..25af3fb86d7d 100644
--- a/connectivity/source/drivers/mozab/post_include_mozilla.h
+++ b/connectivity/source/drivers/mozab/post_include_mozilla.h
@@ -47,3 +47,15 @@
#define _DEBUG _DEBUG_WAS_DEFINED
#endif
+#ifndef _CONNECTIVITY_MOZILLA_REINTERPRET_CAST_MINGW_ONLY_
+#define _CONNECTIVITY_MOZILLA_REINTERPRET_CAST_MINGW_ONLY_
+
+#ifdef __cplusplus
+#ifdef __MINGW32__
+template<class T1, class T2> T1 inline reinterpret_cast_mingw_only(T2 p) { return reinterpret_cast<T1>(p); }
+#else
+template<class T1, class T2> T1 inline reinterpret_cast_mingw_only(T2 p) { return p; }
+#endif
+#endif
+
+#endif
diff --git a/connectivity/source/drivers/mozab/pre_include_mozilla.h b/connectivity/source/drivers/mozab/pre_include_mozilla.h
index 50f3848e4059..b175f654d345 100644
--- a/connectivity/source/drivers/mozab/pre_include_mozilla.h
+++ b/connectivity/source/drivers/mozab/pre_include_mozilla.h
@@ -38,18 +38,28 @@
// Turn off DEBUG Assertions
#ifdef _DEBUG
#define _DEBUG_WAS_DEFINED _DEBUG
- #undef _DEBUG
+ #ifndef MOZILLA_ENABLE_DEBUG
+ #undef _DEBUG
+ #endif
#else
#undef _DEBUG_WAS_DEFINED
+ #ifdef MOZILLA_ENABLE_DEBUG
+ #define _DEBUG 1
+ #endif
#endif
// and turn off the additional virtual methods which are part of some interfaces when compiled
// with debug
#ifdef DEBUG
#define DEBUG_WAS_DEFINED DEBUG
- #undef DEBUG
+ #ifndef MOZILLA_ENABLE_DEBUG
+ #undef DEBUG
+ #endif
#else
#undef DEBUG_WAS_DEFINED
+ #ifdef MOZILLA_ENABLE_DEBUG
+ #define DEBUG 1
+ #endif
#endif
#if defined __GNUC__
diff --git a/connectivity/source/drivers/mysql/makefile.mk b/connectivity/source/drivers/mysql/makefile.mk
index 9a24864a9bba..0d46f0c35dbb 100644
--- a/connectivity/source/drivers/mysql/makefile.mk
+++ b/connectivity/source/drivers/mysql/makefile.mk
@@ -42,7 +42,7 @@ VISIBILITY_HIDDEN=TRUE
ENVCFLAGS+=/FR$(SLO)$/
.ENDIF
-.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
.INCLUDE : $(PRJ)$/version.mk
@@ -83,6 +83,6 @@ DEF1EXPORTFILE= exports.dxp
# --- Targets ----------------------------------
-.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/target.pmk
diff --git a/connectivity/source/drivers/mysql/mysql.xcu b/connectivity/source/drivers/mysql/mysql.xcu
new file mode 100755
index 000000000000..c730df2af5c7
--- /dev/null
+++ b/connectivity/source/drivers/mysql/mysql.xcu
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * 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: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * 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.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:mysql:jdbc:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>org.openoffice.comp.drivers.MySQL.Driver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">MySQL (JDBC)</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="CharSet" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="JavaDriverClass" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>com.mysql.jdbc.Driver</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="Features">
+ <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="IgnoreDriverPrivileges" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="DisplayVersionColumns" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseDOSLineEnds" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="BooleanComparisonMode" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FormsCheckRequiredFields" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsTableCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseJava" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="Authentication" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>UserPassword</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:mysql:odbc:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>org.openoffice.comp.drivers.MySQL.Driver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">MySQL (ODBC)</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="CharSet" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="Features">
+ <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="IgnoreDriverPrivileges" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="DisplayVersionColumns" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseDOSLineEnds" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="BooleanComparisonMode" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FormsCheckRequiredFields" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsTableCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="Authentication" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>UserPassword</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/odbc/makefile.mk b/connectivity/source/drivers/odbc/makefile.mk
index f84f2a725d67..8f37b6185d5e 100644
--- a/connectivity/source/drivers/odbc/makefile.mk
+++ b/connectivity/source/drivers/odbc/makefile.mk
@@ -45,7 +45,7 @@ LDUMP=ldump2.exe
ENVCFLAGS+=/FR$(SLO)$/
.ENDIF
-.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
.INCLUDE : $(PRJ)$/version.mk
.IF "$(SYSTEM_ODBC_HEADERS)" == "YES"
@@ -79,4 +79,4 @@ SHL1VERSIONMAP=odbc.map
# --- Targets ----------------------------------
-.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/target.pmk
diff --git a/connectivity/source/drivers/odbc/odbc.xcu b/connectivity/source/drivers/odbc/odbc.xcu
new file mode 100755
index 000000000000..cf306f10d57f
--- /dev/null
+++ b/connectivity/source/drivers/odbc/odbc.xcu
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * 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: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * 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.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:odbc:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.ODBCDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">ODBC</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="CharSet" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="SystemDriverSettings" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="UseCatalog" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ </node>
+ <node oor:name="AutoIncrementCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="AutoRetrievingStatement" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="IsAutoRetrievingEnabled" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ </node>
+ <node oor:name="AddIndexAppendix" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="Features">
+ <node oor:name="GeneratedValues" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseSQL92NamingConstraints" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="AppendTableAliasInSelect" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseBracketedOuterJoinSyntax" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="IgnoreDriverPrivileges" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="ParameterNameSubstitution" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="DisplayVersionColumns" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseCatalogInSelect" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseSchemaInSelect" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseIndexDirectionKeyword" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseDOSLineEnds" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="BooleanComparisonMode" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FormsCheckRequiredFields" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsTableCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="Authentication" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>UserPassword</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/odbcbase/OTools.cxx b/connectivity/source/drivers/odbcbase/OTools.cxx
index ce03fa325019..f72aec64e7dc 100644
--- a/connectivity/source/drivers/odbcbase/OTools.cxx
+++ b/connectivity/source/drivers/odbcbase/OTools.cxx
@@ -37,6 +37,8 @@
#include "odbc/OConnection.hxx"
#include "diagnose_ex.h"
#include <rtl/logfile.hxx>
+#include <rtl/ustrbuf.hxx>
+
#include <string.h>
#include <string>
@@ -544,7 +546,7 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection,
rtl_TextEncoding _nTextEncoding) throw(SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OTools::getStringValue" );
- ::rtl::OUString aData;
+ ::rtl::OUStringBuffer aData;
switch(_fSqlType)
{
case SQL_WVARCHAR:
@@ -599,7 +601,7 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection,
nLen = pcbValue != SQL_NO_TOTAL ? std::min(pcbValue, nMaxLen) : (nMaxLen-1);
waCharArray[nLen] = 0;
- aData += ::rtl::OUString(waCharArray);
+ aData.append(::rtl::OUString(waCharArray));
}
}
break;
@@ -648,7 +650,7 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection,
--nLen;
aCharArray[nLen] = 0;
- aData += ::rtl::OUString((const sal_Char*)aCharArray,nLen,_nTextEncoding);
+ aData.append(::rtl::OUString((const sal_Char*)aCharArray,nLen,_nTextEncoding));
}
// delete all blanks
@@ -656,7 +658,7 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection,
}
}
- return aData;
+ return aData.makeStringAndClear();
}
// -------------------------------------------------------------------------
void OTools::GetInfo(OConnection* _pConnection,
diff --git a/connectivity/source/manager/makefile.mk b/connectivity/source/manager/makefile.mk
index ce16b2f887d8..7cb514cd3696 100644
--- a/connectivity/source/manager/makefile.mk
+++ b/connectivity/source/manager/makefile.mk
@@ -35,6 +35,7 @@ PRJNAME=connectivity
TARGET=sdbc
ENABLE_EXCEPTIONS=TRUE
+VISIBILITY_HIDDEN=TRUE
# --- Settings ----------------------------------
.IF "$(DBGUTIL_OJ)"!=""
@@ -62,6 +63,8 @@ SHL1STDLIBS=\
$(CPPULIB) \
$(CPPUHELPERLIB) \
$(COMPHELPERLIB) \
+ $(DBTOOLSLIB) \
+ $(UNOTOOLSLIB) \
$(SALLIB)
SHL1DEPN=
diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx
index 3cc251659854..d62f6294e5f8 100644
--- a/connectivity/source/manager/mdrivermanager.cxx
+++ b/connectivity/source/manager/mdrivermanager.cxx
@@ -278,13 +278,26 @@ Any SAL_CALL ODriverEnumeration::nextElement( ) throw(NoSuchElementException, W
}
};
+ /// and STL argorithm compatible predicate comparing a DriverAccess' impl name to a string
+ struct EqualDriverAccessToName : public ::std::binary_function< DriverAccess, ::rtl::OUString, bool >
+ {
+ ::rtl::OUString m_sImplName;
+ EqualDriverAccessToName(const ::rtl::OUString& _sImplName) : m_sImplName(_sImplName){}
+ //.................................................................
+ bool operator()( const DriverAccess& lhs)
+ {
+ return lhs.sImplementationName.equals(m_sImplName);
+ }
+ };
+
//==========================================================================
//= OSDBCDriverManager
//==========================================================================
//--------------------------------------------------------------------------
- OSDBCDriverManager::OSDBCDriverManager( const Reference< XComponentContext >& _rxContext )
+OSDBCDriverManager::OSDBCDriverManager( const Reference< XComponentContext >& _rxContext )
:m_aContext( _rxContext )
,m_aEventLogger( _rxContext, "org.openoffice.logging.sdbc.DriverManager" )
+ ,m_aDriverConfig(m_aContext.getLegacyServiceFactory())
,m_nLoginTimeout(0)
{
// bootstrap all objects supporting the .sdb.Driver service
@@ -375,7 +388,7 @@ void OSDBCDriverManager::bootstrapDrivers()
//--------------------------------------------------------------------------
void OSDBCDriverManager::initializeDriverPrecedence()
{
- if (!m_aDriversBS.size())
+ if ( m_aDriversBS.empty() )
// nothing to do
return;
@@ -420,7 +433,7 @@ void OSDBCDriverManager::initializeDriverPrecedence()
{ // we have a DriverAccess with this impl name
OSL_ENSURE( ::std::distance( aPos.first, aPos.second ) == 1,
- "OSDBCDriverManager::initializeDriverPrecedence: move than one driver with this impl name? How this?" );
+ "OSDBCDriverManager::initializeDriverPrecedence: more than one driver with this impl name? How this?" );
// move the DriverAccess pointed to by aPos.first to the position pointed to by aNoPrefDriversStart
if ( aPos.first != aNoPrefDriversStart )
@@ -686,17 +699,29 @@ Reference< XDriver > OSDBCDriverManager::implGetDriverForURL(const ::rtl::OUStri
Reference< XDriver > xReturn;
{
- // search all bootstrapped drivers
- DriverAccessArrayIterator aPos = ::std::find_if(
- m_aDriversBS.begin(), // begin of search range
- m_aDriversBS.end(), // end of search range
- std::unary_compose< AcceptsURL, ExtractAfterLoad >( AcceptsURL( _rURL ), ExtractAfterLoad() )
- // compose two functors: extract the driver from the access, then ask the resulting driver for acceptance
- );
+ const ::rtl::OUString sDriverFactoryName = m_aDriverConfig.getDriverFactoryName(_rURL);
+
+ EqualDriverAccessToName aEqual(sDriverFactoryName);
+ DriverAccessArray::iterator aFind = ::std::find_if(m_aDriversBS.begin(),m_aDriversBS.end(),aEqual);
+ if ( aFind == m_aDriversBS.end() )
+ {
+ // search all bootstrapped drivers
+ aFind = ::std::find_if(
+ m_aDriversBS.begin(), // begin of search range
+ m_aDriversBS.end(), // end of search range
+ std::unary_compose< AcceptsURL, ExtractAfterLoad >( AcceptsURL( _rURL ), ExtractAfterLoad() )
+ // compose two functors: extract the driver from the access, then ask the resulting driver for acceptance
+ );
+ } // if ( m_aDriversBS.find(sDriverFactoryName ) == m_aDriversBS.end() )
+ else
+ {
+ EnsureDriver aEnsure;
+ aEnsure(*aFind);
+ }
// found something?
- if ( m_aDriversBS.end() != aPos )
- xReturn = aPos->xDriver;
+ if ( m_aDriversBS.end() != aFind )
+ xReturn = aFind->xDriver;
}
if ( !xReturn.is() )
diff --git a/connectivity/source/manager/mdrivermanager.hxx b/connectivity/source/manager/mdrivermanager.hxx
index fef1e1b82429..369b8260f302 100644
--- a/connectivity/source/manager/mdrivermanager.hxx
+++ b/connectivity/source/manager/mdrivermanager.hxx
@@ -44,6 +44,7 @@
#include <comphelper/logging.hxx>
#include <comphelper/componentcontext.hxx>
#include <osl/mutex.hxx>
+#include "connectivity/DriversConfig.hxx"
namespace drivermanager
{
@@ -81,16 +82,15 @@ namespace drivermanager
::comphelper::EventLogger m_aEventLogger;
DECLARE_STL_VECTOR(DriverAccess, DriverAccessArray);
- DriverAccessArray m_aDriversBS;
+ DriverAccessArray m_aDriversBS;
// for drivers registered at runtime (not bootstrapped) we don't require an XServiceInfo interface,
// so we have to remember their impl-name in another way
DECLARE_STL_USTRINGACCESS_MAP(SdbcDriver, DriverCollection);
DriverCollection m_aDriversRT;
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
- m_xServiceFactory;
- sal_Int32 m_nLoginTimeout;
+ ::connectivity::DriversConfig m_aDriverConfig;
+ sal_Int32 m_nLoginTimeout;
private:
OSDBCDriverManager(
diff --git a/connectivity/source/manager/mregistration.cxx b/connectivity/source/manager/mregistration.cxx
index 89a7507600f7..4a305267df14 100644
--- a/connectivity/source/manager/mregistration.cxx
+++ b/connectivity/source/manager/mregistration.cxx
@@ -48,13 +48,13 @@ extern "C"
{
//---------------------------------------------------------------------------------------
- void SAL_CALL component_getImplementationEnvironment(const sal_Char** _ppEnvTypeName, uno_Environment** /*_ppEnv*/)
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const sal_Char** _ppEnvTypeName, uno_Environment** /*_ppEnv*/)
{
*_ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//---------------------------------------------------------------------------------------
-sal_Bool SAL_CALL component_writeInfo(void* /*_pServiceManager*/, com::sun::star::registry::XRegistryKey* _pRegistryKey)
+SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(void* /*_pServiceManager*/, com::sun::star::registry::XRegistryKey* _pRegistryKey)
{
@@ -86,7 +86,7 @@ sal_Bool SAL_CALL component_writeInfo(void* /*_pServiceManager*/, com::sun::star
}
//---------------------------------------------------------------------------------------
-void* SAL_CALL component_getFactory(const sal_Char* _pImplName, ::com::sun::star::lang::XMultiServiceFactory* _pServiceManager, void* /*_pRegistryKey*/)
+SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(const sal_Char* _pImplName, ::com::sun::star::lang::XMultiServiceFactory* _pServiceManager, void* /*_pRegistryKey*/)
{
void* pRet = NULL;
diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y
index a42c3cb2302c..be1ee39d9ba2 100644
--- a/connectivity/source/parse/sqlbison.y
+++ b/connectivity/source/parse/sqlbison.y
@@ -107,7 +107,7 @@ static connectivity::OSQLInternalNode* newNode(const sal_Char* pNewValue,
const connectivity::SQLNodeType eNodeType,
const sal_uInt32 nNodeID = 0)
{
-
+ OSL_TRACE("connectivity: Rule Number: %d,%d",eNodeType,nNodeID);
return new connectivity::OSQLInternalNode(pNewValue, eNodeType, nNodeID);
}
@@ -115,7 +115,7 @@ static connectivity::OSQLInternalNode* newNode(const ::rtl::OString& _NewValue,
const connectivity::SQLNodeType eNodeType,
const sal_uInt32 nNodeID = 0)
{
-
+ OSL_TRACE("connectivity: Rule Number: %d,%d",eNodeType,nNodeID);
return new connectivity::OSQLInternalNode(_NewValue, eNodeType, nNodeID);
}
@@ -123,7 +123,7 @@ static connectivity::OSQLInternalNode* newNode(const ::rtl::OUString& _NewValue,
const connectivity::SQLNodeType eNodeType,
const sal_uInt32 nNodeID = 0)
{
-
+ OSL_TRACE("connectivity: Rule Number: %d,%d",eNodeType,nNodeID);
return new connectivity::OSQLInternalNode(_NewValue, eNodeType, nNodeID);
}
@@ -209,7 +209,7 @@ using namespace connectivity;
/* numeric functions */
%token <pParseNode> SQL_TOKEN_ABS SQL_TOKEN_ACOS SQL_TOKEN_ASIN SQL_TOKEN_ATAN SQL_TOKEN_ATAN2 SQL_TOKEN_CEILING
-%token <pParseNode> SQL_TOKEN_COS SQL_TOKEN_COT SQL_TOKEN_DEGREES SQL_TOKEN_EXP SQL_TOKEN_DIV SQL_TOKEN_FLOOR SQL_TOKEN_LOGF SQL_TOKEN_LOG SQL_TOKEN_LN
+%token <pParseNode> SQL_TOKEN_COS SQL_TOKEN_COT SQL_TOKEN_DEGREES SQL_TOKEN_EXP SQL_TOKEN_FLOOR SQL_TOKEN_LOGF SQL_TOKEN_LOG SQL_TOKEN_LN
%token <pParseNode> SQL_TOKEN_LOG10 SQL_TOKEN_MOD SQL_TOKEN_PI SQL_TOKEN_POWER SQL_TOKEN_RADIANS SQL_TOKEN_RAND SQL_TOKEN_ROUNDMAGIC
%token <pParseNode> SQL_TOKEN_ROUND SQL_TOKEN_SIGN SQL_TOKEN_SIN SQL_TOKEN_SQRT SQL_TOKEN_TAN SQL_TOKEN_TRUNCATE
@@ -676,15 +676,12 @@ manipulative_statement_list:
;
***/
-/*sql:
- {$$ = SQL_NEW_LISTRULE;}
- ;
-*/
sql_not:
{$$ = SQL_NEW_RULE;}
| SQL_TOKEN_NOT
;
- /* manipulative statements */
+
+/* manipulative statements */
sql: manipulative_statement
;
@@ -767,10 +764,12 @@ insert_statement:
$$->append($5);}
;
values_or_query_spec:
- SQL_TOKEN_VALUES table_value_const_list
+ SQL_TOKEN_VALUES '(' table_value_const_list ')'
{$$ = SQL_NEW_RULE;
$$->append($1);
- $$->append($2);
+ $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION));
+ $$->append($3);
+ $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));
}
;
@@ -792,18 +791,14 @@ row_value_const_list:
;
row_value_constructor:
row_value_constructor_elem
- | '(' row_value_const_list ')'
+/* | '(' row_value_const_list ')'
{
$$ = SQL_NEW_RULE;
$$->append($1 = newNode("(", SQL_NODE_PUNCTUATION));
$$->append($2);
$$->append($3 = newNode(")", SQL_NODE_PUNCTUATION));
}
-/* | subquery
- {
- $$ = SQL_NEW_RULE;
- $$->append($1);
- }*/
+ */
;
row_value_constructor_elem:
value_exp /*[^')']*/
@@ -1053,47 +1048,16 @@ truth_value:
;
boolean_primary:
predicate
- | '(' search_condition ')'
- {
+ | '(' search_condition ')'
+ { // boolean_primary: rule 2
$$ = SQL_NEW_RULE;
$$->append($1 = newNode("(", SQL_NODE_PUNCTUATION));
$$->append($2);
$$->append($3 = newNode(")", SQL_NODE_PUNCTUATION));
}
- ;
-
-boolean_test:
- boolean_primary
- | boolean_primary SQL_TOKEN_IS sql_not truth_value
- {
- $$ = SQL_NEW_RULE;
- $$->append($1);
- $$->append($2);
- $$->append($3);
- $$->append($4);
- }
- ;
-boolean_factor:
- boolean_test
- | SQL_TOKEN_NOT boolean_test
- {
- $$ = SQL_NEW_RULE;
- $$->append($1);
- $$->append($2);
- }
- ;
-boolean_term:
- boolean_factor
- | boolean_term SQL_TOKEN_AND boolean_factor
- {
- $$ = SQL_NEW_RULE;
- $$->append($1);
- $$->append($2);
- $$->append($3);
- }
| row_value_constructor_elem /*[^')' ',']*/
{
- if(xxx_pGLOBAL_SQLPARSER->inPredicateCheck())
+ if(xxx_pGLOBAL_SQLPARSER->inPredicateCheck())// boolean_primary: rule 3
{
$$ = SQL_NEW_RULE;
sal_Int16 nErg = xxx_pGLOBAL_SQLPARSER->buildComparsionRule($$,$1);
@@ -1115,54 +1079,43 @@ boolean_term:
else
YYERROR;
}
- | boolean_term SQL_TOKEN_AND literal
- {
- if(xxx_pGLOBAL_SQLPARSER->inPredicateCheck())
- {
- $$ = SQL_NEW_RULE;
- $$->append($1);
- $$->append($2);
- sal_Int16 nErg = xxx_pGLOBAL_SQLPARSER->buildComparsionRule($$,$3);
- if(nErg < 1)
- {
- delete $$;
- if(nErg)
- YYERROR;
- else
- YYABORT;
- }
- }
- else
- YYERROR;
+ ;
+boolean_test:
+ boolean_primary
+ | boolean_primary SQL_TOKEN_IS sql_not truth_value
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ $$->append($3);
+ $$->append($4);
}
- | boolean_term SQL_TOKEN_AND SQL_TOKEN_STRING
+ ;
+boolean_factor:
+ boolean_test
+ | SQL_TOKEN_NOT boolean_test
+ { // boolean_factor: rule 1
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ ;
+boolean_term:
+ boolean_factor
+ | boolean_term SQL_TOKEN_AND boolean_factor
{
- if(xxx_pGLOBAL_SQLPARSER->inPredicateCheck())
- {
- $$ = SQL_NEW_RULE;
- $$->append($1);
- $$->append($2);
- sal_Int16 nErg = xxx_pGLOBAL_SQLPARSER->buildComparsionRule($$,$3);
- if(nErg < 1)
- {
- delete $$;
- if(nErg)
- YYERROR;
- else
- YYABORT;
- }
- }
- else
- YYERROR;
-
+ $$ = SQL_NEW_RULE; // boolean_term: rule 1
+ $$->append($1);
+ $$->append($2);
+ $$->append($3);
}
;
search_condition:
boolean_term
| search_condition SQL_TOKEN_OR boolean_term
{
- $$ = SQL_NEW_RULE;
+ $$ = SQL_NEW_RULE; // search_condition
$$->append($1);
$$->append($2);
$$->append($3);
@@ -1182,14 +1135,14 @@ predicate:
comparison_predicate:
row_value_constructor comparison row_value_constructor
{
- $$ = SQL_NEW_RULE;
+ $$ = SQL_NEW_RULE; // comparison_predicate: rule 1
$$->append($1);
$$->append($2);
$$->append($3);
}
| comparison row_value_constructor
{
- if(xxx_pGLOBAL_SQLPARSER->inPredicateCheck())
+ if(xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) // comparison_predicate: rule 2
{
$$ = SQL_NEW_RULE;
sal_Int16 nErg = xxx_pGLOBAL_SQLPARSER->buildPredicateRule($$,$2,$1);
@@ -1221,7 +1174,7 @@ comparison:
;
between_predicate:
row_value_constructor sql_not SQL_TOKEN_BETWEEN row_value_constructor SQL_TOKEN_AND row_value_constructor
- {$$ = SQL_NEW_RULE;
+ {$$ = SQL_NEW_RULE; // between_predicate: rule 1
$$->append($1);
$$->append($2);
$$->append($3);
@@ -1231,7 +1184,7 @@ between_predicate:
}
| sql_not SQL_TOKEN_BETWEEN row_value_constructor SQL_TOKEN_AND row_value_constructor
{
- if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck())
+ if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) // between_predicate: rule 2
{
$$ = SQL_NEW_RULE;
@@ -1258,7 +1211,7 @@ between_predicate:
like_predicate:
row_value_constructor SQL_TOKEN_NOT SQL_TOKEN_LIKE string_value_exp opt_escape
{
- $$ = SQL_NEW_RULE;
+ $$ = SQL_NEW_RULE; // like_predicate: rule 1
$$->append($1);
$$->append($2);
$$->append($3);
@@ -1267,7 +1220,7 @@ like_predicate:
}
| row_value_constructor SQL_TOKEN_LIKE string_value_exp opt_escape
{
- $$ = SQL_NEW_RULE;
+ $$ = SQL_NEW_RULE; // like_predicate: rule 2
$$->append($1);
$$->append($2);
$$->append($3);
@@ -1275,7 +1228,7 @@ like_predicate:
}
| row_value_constructor SQL_TOKEN_NOT SQL_TOKEN_LIKE value_exp_primary opt_escape
{
- $$ = SQL_NEW_RULE;
+ $$ = SQL_NEW_RULE; // like_predicate: rule 3
$$->append($1);
$$->append($2);
$$->append($3);
@@ -1284,7 +1237,7 @@ like_predicate:
}
| row_value_constructor SQL_TOKEN_LIKE value_exp_primary opt_escape
{
- $$ = SQL_NEW_RULE;
+ $$ = SQL_NEW_RULE; // like_predicate: rule 4
$$->append($1);
$$->append($2);
$$->append($3);
@@ -1292,7 +1245,7 @@ like_predicate:
}
| sql_not SQL_TOKEN_LIKE string_value_exp opt_escape
{
- if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck())
+ if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) // like_predicate: rule 5
{
OSQLParseNode* pColumnRef = newNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::column_ref));
pColumnRef->append(newNode(xxx_pGLOBAL_SQLPARSER->getFieldName(),SQL_NODE_NAME));
@@ -1314,7 +1267,7 @@ like_predicate:
}
| sql_not SQL_TOKEN_LIKE value_exp_primary opt_escape
{
- if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck())
+ if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) // like_predicate: rule 6
{
OSQLParseNode* pColumnRef = newNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::column_ref));
pColumnRef->append(newNode(xxx_pGLOBAL_SQLPARSER->getFieldName(),SQL_NODE_NAME));
@@ -1355,7 +1308,7 @@ opt_escape:
test_for_null:
row_value_constructor SQL_TOKEN_IS sql_not truth_value
{
- $$ = SQL_NEW_RULE;
+ $$ = SQL_NEW_RULE; // test_for_null: rule 1
$$->append($1);
$$->append($2);
$$->append($3);
@@ -1363,7 +1316,7 @@ test_for_null:
}
| SQL_TOKEN_IS sql_not truth_value
{
- if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck())
+ if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck())// test_for_null: rule 2
{
OSQLParseNode* pColumnRef = newNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::column_ref));
pColumnRef->append(newNode(xxx_pGLOBAL_SQLPARSER->getFieldName(),SQL_NODE_NAME));
@@ -1393,15 +1346,15 @@ in_predicate_value:
in_predicate:
row_value_constructor sql_not SQL_TOKEN_IN in_predicate_value
{
- $$ = SQL_NEW_RULE;
+ $$ = SQL_NEW_RULE;// in_predicate: rule 1
$$->append($1);
$$->append($2);
$$->append($3);
$$->append($4);
}
- | sql_not SQL_TOKEN_IN in_predicate_value
+ | sql_not SQL_TOKEN_IN in_predicate_value
{
- if ( xxx_pGLOBAL_SQLPARSER->inPredicateCheck() )
+ if ( xxx_pGLOBAL_SQLPARSER->inPredicateCheck() )// in_predicate: rule 2
{
OSQLParseNode* pColumnRef = newNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::column_ref));
pColumnRef->append(newNode(xxx_pGLOBAL_SQLPARSER->getFieldName(),SQL_NODE_NAME));
@@ -3132,7 +3085,7 @@ user: SQL_TOKEN_NAME
sql:
search_condition /* checking predicats */
{
- if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck())
+ if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) // sql: rule 1
{
$$ = $1;
if ( SQL_ISRULE($$,search_condition) )
@@ -3143,7 +3096,9 @@ sql:
}
else
YYERROR;
- };
+ }
+ | '(' sql ')' /* checking predicats */
+ ;
%%
diff --git a/connectivity/source/parse/sqlflex.l b/connectivity/source/parse/sqlflex.l
index 19d2b8a27d8e..6159f79e1b28 100644
--- a/connectivity/source/parse/sqlflex.l
+++ b/connectivity/source/parse/sqlflex.l
@@ -192,7 +192,6 @@ COLLECT {SQL_NEW_KEYWORD(SQL_TOKEN_COLLE
[Dd][Ee][Ss][Cc] {SQL_NEW_KEYWORD(SQL_TOKEN_DESC); return SQL_TOKEN_DESC; }
[Dd][Ii][Ff][Ff][Ee][Rr][Ee][Nn][Cc][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_DIFFERENCE); return SQL_TOKEN_DIFFERENCE; }
[Dd][Ii][Ss][Tt][Ii][Nn][Cc][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_DISTINCT); return SQL_TOKEN_DISTINCT; }
-[Dd][Ii][Vv] {SQL_NEW_KEYWORD(SQL_TOKEN_DIV); return SQL_TOKEN_DIV; }
[Dd][Oo][Uu][Bb][Ll][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_DOUBLE); return SQL_TOKEN_DOUBLE; }
[Dd][Rr][Oo][Pp] {SQL_NEW_KEYWORD(SQL_TOKEN_DROP); return SQL_TOKEN_DROP; }
diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx
index 56f63de5ce14..42778d6a7ed0 100644
--- a/connectivity/source/parse/sqliterator.cxx
+++ b/connectivity/source/parse/sqliterator.cxx
@@ -1493,6 +1493,20 @@ void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode
}
if ( bNotFound )
{
+ sal_Int32 nType = DataType::VARCHAR;
+ OSQLParseNode* pParent = _pColumnRef ? _pColumnRef->getParent() : NULL;
+ if ( pParent && (SQL_ISRULE(pParent,general_set_fct) || SQL_ISRULE(pParent,set_fct_spec)) )
+ {
+ const sal_uInt32 nCount = _pColumnRef->count();
+ sal_uInt32 i = 0;
+ for(; i < nCount;++i)
+ {
+ if ( _pColumnRef->getChild(i) == _pParseNode )
+ break;
+ }
+ nType = ::connectivity::OSQLParser::getFunctionParameterType( pParent->getChild(0)->getTokenID(), i+1);
+ }
+
::rtl::OUString aNewColName( getUniqueColumnName( sParameterName ) );
OParseColumn* pColumn = new OParseColumn(aNewColName,
@@ -1501,7 +1515,7 @@ void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode
ColumnValue::NULLABLE_UNKNOWN,
0,
0,
- DataType::VARCHAR,
+ nType,
sal_False,
sal_False,
isCaseSensitive() );
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index 5710d747a5f9..e134d7a757c4 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -304,9 +304,10 @@ void OSQLParseNode::parseNodeToStr(::rtl::OUString& rString,
if ( _rxConnection.is() )
{
+ ::rtl::OUStringBuffer sBuffer = rString;
try
{
- OSQLParseNode::impl_parseNodeToString_throw( rString,
+ OSQLParseNode::impl_parseNodeToString_throw( sBuffer,
SQLParseNodeParameter(
_rxConnection, xFormatter, _xField, rIntl, pContext,
_bIntl, _bQuote, _cDecSep, _bPredicate, _bSubstitute
@@ -320,6 +321,7 @@ void OSQLParseNode::parseNodeToStr(::rtl::OUString& rString,
// in the sub queries, but this cannot be the case here, as we do not parse to
// SDBC level.
}
+ rString = sBuffer.makeStringAndClear();
}
}
//-----------------------------------------------------------------------------
@@ -342,10 +344,11 @@ bool OSQLParseNode::parseNodeToExecutableStatement( ::rtl::OUString& _out_rStrin
aParseParam.pParser = &_rParser;
_out_rString = ::rtl::OUString();
+ ::rtl::OUStringBuffer sBuffer;
bool bSuccess = false;
try
{
- impl_parseNodeToString_throw( _out_rString, aParseParam );
+ impl_parseNodeToString_throw( sBuffer, aParseParam );
bSuccess = true;
}
catch( const SQLException& e )
@@ -353,6 +356,7 @@ bool OSQLParseNode::parseNodeToExecutableStatement( ::rtl::OUString& _out_rStrin
if ( _pErrorHolder )
*_pErrorHolder = e;
}
+ _out_rString = sBuffer.makeStringAndClear();
return bSuccess;
}
@@ -366,7 +370,7 @@ namespace
}
//-----------------------------------------------------------------------------
-void OSQLParseNode::impl_parseNodeToString_throw(::rtl::OUString& rString, const SQLParseNodeParameter& rParam) const
+void OSQLParseNode::impl_parseNodeToString_throw(::rtl::OUStringBuffer& rString, const SQLParseNodeParameter& rParam) const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::getTableRange" );
if ( isToken() )
@@ -385,19 +389,19 @@ void OSQLParseNode::impl_parseNodeToString_throw(::rtl::OUString& rString, const
case parameter:
{
if(rString.getLength())
- rString += ::rtl::OUString::createFromAscii(" ");
+ rString.appendAscii(" ");
if (nCount == 1) // ?
m_aChildren[0]->impl_parseNodeToString_throw( rString, rParam );
else if (nCount == 2) // :Name
{
m_aChildren[0]->impl_parseNodeToString_throw( rString, rParam );
- rString += m_aChildren[1]->m_aNodeValue;
+ rString.append(m_aChildren[1]->m_aNodeValue);
} // [Name]
else
{
m_aChildren[0]->impl_parseNodeToString_throw( rString, rParam );
- rString += m_aChildren[1]->m_aNodeValue;
- rString += m_aChildren[2]->m_aNodeValue;
+ rString.append(m_aChildren[1]->m_aNodeValue);
+ rString.append(m_aChildren[2]->m_aNodeValue);
}
bHandled = true;
}
@@ -419,7 +423,7 @@ void OSQLParseNode::impl_parseNodeToString_throw(::rtl::OUString& rString, const
case as:
if ( rParam.aMetaData.generateASBeforeCorrelationName() )
- rString += ::rtl::OUString::createFromAscii( " AS" );
+ rString.append(::rtl::OUString::createFromAscii( " AS" ));
bHandled = true;
break;
@@ -447,7 +451,7 @@ void OSQLParseNode::impl_parseNodeToString_throw(::rtl::OUString& rString, const
m_aChildren[0]->impl_parseNodeToString_throw( rString, aNewParam );
aNewParam.bQuote = rParam.bQuote;
//aNewParam.bPredicate = sal_False; // disable [ ] around names // look at i73215
- ::rtl::OUString aStringPara;
+ ::rtl::OUStringBuffer aStringPara;
for (sal_uInt32 i=1; i<nCount; i++)
{
const OSQLParseNode * pSubTree = m_aChildren[i];
@@ -457,13 +461,12 @@ void OSQLParseNode::impl_parseNodeToString_throw(::rtl::OUString& rString, const
// bei den CommaListen zwischen alle Subtrees Commas setzen
if ((m_eNodeType == SQL_NODE_COMMALISTRULE) && (i < (nCount - 1)))
- aStringPara += ::rtl::OUString::createFromAscii(",");
+ aStringPara.appendAscii(",");
}
else
i++;
}
- aStringPara.trim();
- rString += aStringPara;
+ rString.append(aStringPara.makeStringAndClear());
}
bHandled = true;
}
@@ -542,7 +545,7 @@ void OSQLParseNode::impl_parseNodeToString_throw(::rtl::OUString& rString, const
// bei den CommaListen zwischen alle Subtrees Commas setzen
if ((m_eNodeType == SQL_NODE_COMMALISTRULE) && (i != m_aChildren.end()))
- rString += ::rtl::OUString::createFromAscii(",");
+ rString.appendAscii(",");
}
}
else
@@ -554,9 +557,9 @@ void OSQLParseNode::impl_parseNodeToString_throw(::rtl::OUString& rString, const
if ((m_eNodeType == SQL_NODE_COMMALISTRULE) && (i != m_aChildren.end()))
{
if (SQL_ISRULE(this,value_exp_commalist) && rParam.bPredicate)
- rString += ::rtl::OUString::createFromAscii(";");
+ rString.appendAscii(";");
else
- rString += ::rtl::OUString::createFromAscii(",");
+ rString.appendAscii(",");
}
}
}
@@ -564,7 +567,7 @@ void OSQLParseNode::impl_parseNodeToString_throw(::rtl::OUString& rString, const
}
//-----------------------------------------------------------------------------
-bool OSQLParseNode::impl_parseTableNameNodeToString_throw( ::rtl::OUString& rString, const SQLParseNodeParameter& rParam ) const
+bool OSQLParseNode::impl_parseTableNameNodeToString_throw( ::rtl::OUStringBuffer& rString, const SQLParseNodeParameter& rParam ) const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::impl_parseTableNameNodeToString_throw" );
// is the table_name part of a table_ref?
@@ -623,25 +626,25 @@ bool OSQLParseNode::impl_parseTableNameNodeToString_throw( ::rtl::OUString& rStr
if ( pSubQueryNode.get() )
{
// parse the sub-select to SDBC level, too
- ::rtl::OUString sSubSelect;
+ ::rtl::OUStringBuffer sSubSelect;
pSubQueryNode->impl_parseNodeToString_throw( sSubSelect, rParam );
if ( sSubSelect.getLength() )
- sCommand = sSubSelect;
+ sCommand = sSubSelect.makeStringAndClear();
}
}
- rString += ::rtl::OUString::createFromAscii( " ( " );
- rString += sCommand;
- rString += ::rtl::OUString::createFromAscii( " )" );
+ rString.appendAscii( " ( " );
+ rString.append(sCommand);
+ rString.appendAscii( " )" );
// append the query name as table alias, since it might be referenced in other
// parts of the statement - but only if there's no other alias name present
if ( !lcl_isAliasNamePresent( *this ) )
{
- rString += ::rtl::OUString::createFromAscii( " AS " );
+ rString.appendAscii( " AS " );
if ( rParam.bQuote )
- rString += SetQuotation( sTableOrQueryName,
- rParam.aMetaData.getIdentifierQuoteString(), rParam.aMetaData.getIdentifierQuoteString() );
+ rString.append(SetQuotation( sTableOrQueryName,
+ rParam.aMetaData.getIdentifierQuoteString(), rParam.aMetaData.getIdentifierQuoteString() ));
}
// don't forget to remove the query name from the history, else multiple inclusions
@@ -663,7 +666,7 @@ bool OSQLParseNode::impl_parseTableNameNodeToString_throw( ::rtl::OUString& rStr
}
//-----------------------------------------------------------------------------
-void OSQLParseNode::impl_parseTableRangeNodeToString_throw(::rtl::OUString& rString, const SQLParseNodeParameter& rParam) const
+void OSQLParseNode::impl_parseTableRangeNodeToString_throw(::rtl::OUStringBuffer& rString, const SQLParseNodeParameter& rParam) const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::impl_parseTableRangeNodeToString_throw" );
OSL_PRECOND( ( count() == 2 ) || ( count() == 3 ) || ( count() == 5 ) ,"Illegal count");
@@ -674,7 +677,7 @@ void OSQLParseNode::impl_parseTableRangeNodeToString_throw(::rtl::OUString& rStr
}
//-----------------------------------------------------------------------------
-void OSQLParseNode::impl_parseLikeNodeToString_throw( ::rtl::OUString& rString, const SQLParseNodeParameter& rParam ) const
+void OSQLParseNode::impl_parseLikeNodeToString_throw( ::rtl::OUStringBuffer& rString, const SQLParseNodeParameter& rParam ) const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::impl_parseLikeNodeToString_throw" );
OSL_ENSURE(count() >= 4,"count != 5: Prepare for GPF");
@@ -725,8 +728,8 @@ void OSQLParseNode::impl_parseLikeNodeToString_throw( ::rtl::OUString& rString,
if (pParaNode->isToken())
{
::rtl::OUString aStr = ConvertLikeToken(pParaNode, pEscNode, rParam.bInternational);
- rString += ::rtl::OUString::createFromAscii(" ");
- rString += SetQuotation(aStr,::rtl::OUString::createFromAscii("\'"),::rtl::OUString::createFromAscii("\'\'"));
+ rString.appendAscii(" ");
+ rString.append(SetQuotation(aStr,::rtl::OUString::createFromAscii("\'"),::rtl::OUString::createFromAscii("\'\'")));
}
else
pParaNode->impl_parseNodeToString_throw( rString, aNewParam );
@@ -1687,7 +1690,7 @@ void OSQLParseNode::append(OSQLParseNode* pNewNode)
m_aChildren.push_back(pNewNode);
}
// -----------------------------------------------------------------------------
-sal_Bool OSQLParseNode::addDateValue(::rtl::OUString& rString, const SQLParseNodeParameter& rParam) const
+sal_Bool OSQLParseNode::addDateValue(::rtl::OUStringBuffer& rString, const SQLParseNodeParameter& rParam) const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::addDateValue" );
// special display for date/time values
@@ -1708,10 +1711,6 @@ sal_Bool OSQLParseNode::addDateValue(::rtl::OUString& rString, const SQLParseNod
{
suQuote = ::rtl::OUString::createFromAscii("#");
}
- else
- {
- suQuote = ::rtl::OUString::createFromAscii("'");
- }
}
else
{
@@ -1720,29 +1719,25 @@ sal_Bool OSQLParseNode::addDateValue(::rtl::OUString& rString, const SQLParseNod
// suQuote = ::rtl::OUString::createFromAscii("'");
return sal_False;
}
- else
- {
- suQuote = ::rtl::OUString::createFromAscii("'");
- }
}
if (rString.getLength())
- rString += ::rtl::OUString::createFromAscii(" ");
- rString += suQuote;
+ rString.appendAscii(" ");
+ rString.append(suQuote);
const ::rtl::OUString sTokenValue = pODBCNode->m_aChildren[1]->getTokenValue();
if (SQL_ISTOKEN(pODBCNodeChild, D))
{
- rString += rParam.bPredicate ? convertDateString(rParam, sTokenValue) : sTokenValue;
+ rString.append(rParam.bPredicate ? convertDateString(rParam, sTokenValue) : sTokenValue);
}
else if (SQL_ISTOKEN(pODBCNodeChild, T))
{
- rString += rParam.bPredicate ? convertTimeString(rParam, sTokenValue) : sTokenValue;
+ rString.append(rParam.bPredicate ? convertTimeString(rParam, sTokenValue) : sTokenValue);
}
else
{
- rString += rParam.bPredicate ? convertDateTimeString(rParam, sTokenValue) : sTokenValue;
+ rString.append(rParam.bPredicate ? convertDateTimeString(rParam, sTokenValue) : sTokenValue);
}
- rString += suQuote;
+ rString.append(suQuote);
return sal_True;
}
}
@@ -2443,7 +2438,7 @@ OSQLParseNode* OSQLParseNode::replace (OSQLParseNode* pOldSubNode, OSQLParseNode
return pOldSubNode;
}
// -----------------------------------------------------------------------------
-void OSQLParseNode::parseLeaf(::rtl::OUString & rString, const SQLParseNodeParameter& rParam) const
+void OSQLParseNode::parseLeaf(::rtl::OUStringBuffer& rString, const SQLParseNodeParameter& rParam) const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::parseLeaf" );
// ein Blatt ist gefunden
@@ -2453,51 +2448,51 @@ void OSQLParseNode::parseLeaf(::rtl::OUString & rString, const SQLParseNodeParam
case SQL_NODE_KEYWORD:
{
if (rString.getLength())
- rString += ::rtl::OUString::createFromAscii(" ");
+ rString.appendAscii(" ");
- ::rtl::OString sT = OSQLParser::TokenIDToStr(m_nNodeID, &rParam.m_rContext);
- rString += ::rtl::OUString(sT,sT.getLength(),RTL_TEXTENCODING_UTF8);
+ const ::rtl::OString sT = OSQLParser::TokenIDToStr(m_nNodeID, &rParam.m_rContext);
+ rString.append(::rtl::OUString(sT,sT.getLength(),RTL_TEXTENCODING_UTF8));
} break;
case SQL_NODE_STRING:
if (rString.getLength())
- rString += ::rtl::OUString::createFromAscii(" ");
- rString += SetQuotation(m_aNodeValue,::rtl::OUString::createFromAscii("\'"),::rtl::OUString::createFromAscii("\'\'"));
+ rString.appendAscii(" ");
+ rString.append(SetQuotation(m_aNodeValue,::rtl::OUString::createFromAscii("\'"),::rtl::OUString::createFromAscii("\'\'")));
break;
case SQL_NODE_NAME:
if (rString.getLength())
{
- switch(rString.getStr()[rString.getLength()-1] )
+ switch(rString.charAt(rString.getLength()-1) )
{
case ' ' :
case '.' : break;
default :
if ( !rParam.aMetaData.getCatalogSeparator().getLength()
- || rString.getStr()[ rString.getLength()-1 ] != rParam.aMetaData.getCatalogSeparator().toChar()
+ || rString.charAt( rString.getLength()-1 ) != rParam.aMetaData.getCatalogSeparator().toChar()
)
- rString += ::rtl::OUString::createFromAscii(" "); break;
+ rString.appendAscii(" "); break;
}
}
if (rParam.bQuote)
{
if (rParam.bPredicate)
{
- rString+= ::rtl::OUString::createFromAscii("[");
- rString += m_aNodeValue;
- rString+= ::rtl::OUString::createFromAscii("]");
+ rString.appendAscii("[");
+ rString.append(m_aNodeValue);
+ rString.appendAscii("]");
}
else
- rString += SetQuotation(m_aNodeValue,
- rParam.aMetaData.getIdentifierQuoteString(), rParam.aMetaData.getIdentifierQuoteString() );
+ rString.append(SetQuotation(m_aNodeValue,
+ rParam.aMetaData.getIdentifierQuoteString(), rParam.aMetaData.getIdentifierQuoteString() ));
}
else
- rString += m_aNodeValue;
+ rString.append(m_aNodeValue);
break;
case SQL_NODE_ACCESS_DATE:
if (rString.getLength())
- rString += ::rtl::OUString::createFromAscii(" ");
- rString += ::rtl::OUString::createFromAscii("#");
- rString += m_aNodeValue;
- rString += ::rtl::OUString::createFromAscii("#");
+ rString.appendAscii(" ");
+ rString.appendAscii("#");
+ rString.append(m_aNodeValue);
+ rString.appendAscii("#");
break;
case SQL_NODE_INTNUM:
case SQL_NODE_APPROXNUM:
@@ -2507,26 +2502,26 @@ void OSQLParseNode::parseLeaf(::rtl::OUString & rString, const SQLParseNodeParam
aTmp = aTmp.replace('.', rParam.cDecSep);
if (rString.getLength())
- rString += ::rtl::OUString::createFromAscii(" ");
- rString += aTmp;
+ rString.appendAscii(" ");
+ rString.append(aTmp);
} break;
// fall through
default:
if (rString.getLength() && m_aNodeValue.toChar() != '.' && m_aNodeValue.toChar() != ':' )
{
- switch( rString.getStr()[rString.getLength()-1] )
+ switch( rString.charAt(rString.getLength()-1) )
{
case ' ' :
case '.' : break;
default :
if ( !rParam.aMetaData.getCatalogSeparator().getLength()
- || rString.getStr()[ rString.getLength()-1 ] != rParam.aMetaData.getCatalogSeparator().toChar()
+ || rString.charAt( rString.getLength()-1 ) != rParam.aMetaData.getCatalogSeparator().toChar()
)
- rString += ::rtl::OUString::createFromAscii(" "); break;
+ rString.appendAscii(" "); break;
}
}
- rString += m_aNodeValue;
+ rString.append(m_aNodeValue);
}
}
@@ -2621,6 +2616,113 @@ sal_Int32 OSQLParser::getFunctionReturnType(const ::rtl::OUString& _sFunctionNam
return nType;
}
+// -----------------------------------------------------------------------------
+sal_Int32 OSQLParser::getFunctionParameterType(sal_uInt32 _nTokenId, sal_uInt32 _nPos)
+{
+ sal_Int32 nType = DataType::VARCHAR;
+
+ if(_nTokenId == SQL_TOKEN_CHAR) nType = DataType::INTEGER;
+ else if(_nTokenId == SQL_TOKEN_INSERT)
+ {
+ if ( _nPos == 2 || _nPos == 3 )
+ nType = DataType::INTEGER;
+ }
+ else if(_nTokenId == SQL_TOKEN_LEFT)
+ {
+ if ( _nPos == 2 )
+ nType = DataType::INTEGER;
+ }
+ else if(_nTokenId == SQL_TOKEN_LOCATE)
+ {
+ if ( _nPos == 3 )
+ nType = DataType::INTEGER;
+ }
+ else if(_nTokenId == SQL_TOKEN_LOCATE_2)
+ {
+ if ( _nPos == 3 )
+ nType = DataType::INTEGER;
+ }
+ else if( _nTokenId == SQL_TOKEN_REPEAT || _nTokenId == SQL_TOKEN_RIGHT )
+ {
+ if ( _nPos == 2 )
+ nType = DataType::INTEGER;
+ }
+ else if(_nTokenId == SQL_TOKEN_SPACE )
+ {
+ nType = DataType::INTEGER;
+ }
+ else if(_nTokenId == SQL_TOKEN_SUBSTRING)
+ {
+ if ( _nPos != 1 )
+ nType = DataType::INTEGER;
+ }
+ else if(_nTokenId == SQL_TOKEN_DATEDIFF)
+ {
+ if ( _nPos != 1 )
+ nType = DataType::TIMESTAMP;
+ }
+ else if(_nTokenId == SQL_TOKEN_DATEVALUE)
+ nType = DataType::DATE;
+ else if(_nTokenId == SQL_TOKEN_DAYNAME)
+ nType = DataType::DATE;
+ else if(_nTokenId == SQL_TOKEN_DAYOFMONTH)
+ nType = DataType::DATE;
+ else if(_nTokenId == SQL_TOKEN_DAYOFWEEK)
+ nType = DataType::DATE;
+ else if(_nTokenId == SQL_TOKEN_DAYOFYEAR)
+ nType = DataType::DATE;
+ else if(_nTokenId == SQL_TOKEN_EXTRACT) nType = DataType::VARCHAR;
+ else if(_nTokenId == SQL_TOKEN_HOUR) nType = DataType::TIME;
+ else if(_nTokenId == SQL_TOKEN_MINUTE) nType = DataType::TIME;
+ else if(_nTokenId == SQL_TOKEN_MONTH) nType = DataType::DATE;
+ else if(_nTokenId == SQL_TOKEN_MONTHNAME) nType = DataType::DATE;
+ else if(_nTokenId == SQL_TOKEN_NOW) nType = DataType::TIMESTAMP;
+ else if(_nTokenId == SQL_TOKEN_QUARTER) nType = DataType::DATE;
+ else if(_nTokenId == SQL_TOKEN_SECOND) nType = DataType::TIME;
+ else if(_nTokenId == SQL_TOKEN_TIMESTAMPADD) nType = DataType::TIMESTAMP;
+ else if(_nTokenId == SQL_TOKEN_TIMESTAMPDIFF) nType = DataType::TIMESTAMP;
+ else if(_nTokenId == SQL_TOKEN_TIMEVALUE) nType = DataType::TIMESTAMP;
+ else if(_nTokenId == SQL_TOKEN_WEEK) nType = DataType::DATE;
+ else if(_nTokenId == SQL_TOKEN_YEAR) nType = DataType::DATE;
+
+ else if(_nTokenId == SQL_TOKEN_ABS) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_ACOS) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_ASIN) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_ATAN) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_ATAN2) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_CEILING) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_COS) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_COT) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_DEGREES) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_EXP) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_FLOOR) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_LOGF) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_LOG) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_LOG10) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_LN) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_MOD) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_PI) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_POWER) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_RADIANS) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_RAND) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_ROUND) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_ROUNDMAGIC) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_SIGN) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_SIN) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_SQRT) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_TAN) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_TRUNCATE) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_COUNT) nType = DataType::INTEGER;
+ else if(_nTokenId == SQL_TOKEN_MAX) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_MIN) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_AVG) nType = DataType::DOUBLE;
+ else if(_nTokenId == SQL_TOKEN_SUM) nType = DataType::DOUBLE;
+
+ else if(_nTokenId == SQL_TOKEN_LOWER) nType = DataType::VARCHAR;
+ else if(_nTokenId == SQL_TOKEN_UPPER) nType = DataType::VARCHAR;
+
+ return nType;
+}
// -----------------------------------------------------------------------------
const SQLError& OSQLParser::getErrorHelper() const
diff --git a/connectivity/source/resource/conn_shared_res.src b/connectivity/source/resource/conn_shared_res.src
index c9e54b740252..92b3e5814f4e 100644
--- a/connectivity/source/resource/conn_shared_res.src
+++ b/connectivity/source/resource/conn_shared_res.src
@@ -292,23 +292,23 @@ String STR_OPERATOR_TOO_COMPLEX
};
String STR_QUERY_INVALID_LIKE_COLUMN
{
- Text [ en-US ] = "The query can not be executed. The 'LIKE' can only be used with a column name.";
+ Text [ en-US ] = "The query can not be executed. You cannot use 'LIKE' with columns of this type.";
};
String STR_QUERY_INVALID_LIKE_STRING
{
- Text [ en-US ] = "The query can not be executed. The 'LIKE' can only be used with a string argument.";
+ Text [ en-US ] = "The query can not be executed. 'LIKE' can be used with a string argument only.";
};
String STR_QUERY_NOT_LIKE_TOO_COMPLEX
{
- Text [ en-US ] = "The query can not be executed. The 'NOT LIKE' is too complex.";
+ Text [ en-US ] = "The query can not be executed. The 'NOT LIKE' condition is too complex.";
};
String STR_QUERY_LIKE_WILDCARD
{
- Text [ en-US ] = "The query can not be executed. The 'LIKE' statement contains wildcard in the middle.";
+ Text [ en-US ] = "The query can not be executed. The 'LIKE' condition contains wildcard in the middle.";
};
String STR_QUERY_LIKE_WILDCARD_MANY
{
- Text [ en-US ] = "The query can not be executed. The 'LIKE' statement contains too many wildcards.";
+ Text [ en-US ] = "The query can not be executed. The 'LIKE' condition contains too many wildcards.";
};
String STR_INVALID_COLUMNNAME
{
diff --git a/connectivity/target.pmk b/connectivity/target.pmk
new file mode 100755
index 000000000000..97ef318b5feb
--- /dev/null
+++ b/connectivity/target.pmk
@@ -0,0 +1,40 @@
+#*************************************************************************
+#
+# 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.pmk,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.
+#
+#*************************************************************************
+
+.INCLUDE : target.mk
+
+COMPONENT_CONFIG_SCHEMA*=$(TARGET).xcs
+
+ALLTAR: "$(PWD)$/$(MISC)$/registry$/schema$/$(PACKAGEDIR)$/$(COMPONENT_CONFIG_SCHEMA)"
+"$(PWD)$/$(MISC)$/registry$/schema$/$(PACKAGEDIR)$/$(COMPONENT_CONFIG_SCHEMA)" : $(SOLARXMLDIR)$/registry$/schema$/$(PACKAGEDIR)$/Drivers.xcs
+ @@-$(MKDIRHIER) $(@:d)
+ $(COPY) $< $@
+
diff --git a/connectivity/util/delzip b/connectivity/util/delzip
new file mode 100755
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/connectivity/util/delzip
diff --git a/connectivity/util/langfilter.xsl b/connectivity/util/langfilter.xsl
new file mode 100755
index 000000000000..76cfcff20ac6
--- /dev/null
+++ b/connectivity/util/langfilter.xsl
@@ -0,0 +1,37 @@
+<?xml version='1.0' encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:oor="http://openoffice.org/2001/registry">
+<xsl:output method="xml" indent="yes" omit-xml-declaration="no" version="1.0" encoding="UTF-8"/>
+<xsl:param name="lang"/>
+<xsl:template match="*">
+ <xsl:if test="count(.//*[@xml:lang=$lang])&gt;0">
+ <xsl:copy>
+ <xsl:apply-templates select="*|@*"/>
+ </xsl:copy>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="@*">
+ <xsl:copy>
+ <xsl:apply-templates select="*|@*"/>
+ </xsl:copy>
+</xsl:template>
+
+<xsl:template match="value">
+ <xsl:if test="@xml:lang=$lang">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|text()"/>
+ </xsl:copy>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="text()">
+ <xsl:if test="../@xml:lang=$lang">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|text()"/>
+ </xsl:copy>
+ </xsl:if>
+</xsl:template>
+
+
+</xsl:stylesheet>
+
diff --git a/connectivity/util/makefile.mk b/connectivity/util/makefile.mk
new file mode 100755
index 000000000000..805aa0110f6f
--- /dev/null
+++ b/connectivity/util/makefile.mk
@@ -0,0 +1,80 @@
+#*************************************************************************
+#
+# 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.22 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ = ..
+TARGET = connectivity
+PRJNAME = connectivity
+
+# -----------------------------------------------------------------------------
+# include global settings
+# -----------------------------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+DIR_FILTERCFGOUT := $(MISC)$/drivers
+DIR_LANGPACK := $(DIR_FILTERCFGOUT)
+.IF "$(WITH_LANG)"!=""
+DIR_LANG_SOURCE := $(MISC)$/merge
+.ELSE
+DIR_LANG_SOURCE := $(MISC)$/registry$/data
+.ENDIF
+DRIVER_MERGE_XCU := $(shell -@$(FIND) $(DIR_LANG_SOURCE)$/org$/openoffice$/Office$/DataAccess -name "*.xcu")
+
+REALFILTERPACKAGES_FILTERS_UI_LANGPACKS = \
+ $(foreach,i,$(alllangiso) $(foreach,j,$(DRIVER_MERGE_XCU) $(DIR_LANGPACK)$/$i$/org$/openoffice$/Office$/DataAccess$/$(j:f)))
+
+.INCLUDE: target.mk
+
+PACKLANG := $(XSLTPROC) --nonet
+PACKLANG_IN :=
+PACKLANG_PARAM := --stringparam
+PACKLANG_XSL :=
+
+$(REALFILTERPACKAGES_FILTERS_UI_LANGPACKS) :
+ @echo ===================================================================
+ @echo Building language package for driver $(@:b:s/Filter_//)
+ @echo ===================================================================
+ +-$(MKDIRHIER) $(@:d)
+ $(PACKLANG) $(PACKLANG_PARAM) lang $(@:d:d:d:d:d:d:d:d:d:d:b) $(PACKLANG_XSL) langfilter.xsl $(PACKLANG_IN) $(DIR_LANG_SOURCE)$/org$/openoffice$/Office$/DataAccess$/$(@:f) > $@
+
+$(MISC)$/$(TARGET)_delzip :
+ -$(RM) $(BIN)$/fcfg_drivers_{$(alllangiso)}.zip
+
+$(BIN)$/fcfg_drivers_{$(alllangiso)}.zip : $(REALFILTERPACKAGES_FILTERS_UI_LANGPACKS)
+ cd $(DIR_FILTERCFGOUT)$/$(@:b:s/fcfg_drivers_//) && zip -ru ..$/..$/..$/bin$/fcfg_drivers_$(@:b:s/fcfg_drivers_//).zip org/*
+.IF "$(USE_SHELL)"!="4nt"
+ $(PERL) -w $(SOLARENV)$/bin$/cleanzip.pl $@
+.ENDIF # "$(USE_SHELL)"!="4nt"
+
+ALLTAR: \
+ $(MISC)$/$(TARGET)_delzip \
+ $(BIN)$/fcfg_drivers_{$(alllangiso)}.zip
+
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index df875df23ad6..995c7e65e999 100644
--- a/desktop/inc/app.hxx
+++ b/desktop/inc/app.hxx
@@ -134,6 +134,7 @@ class Desktop : public Application
static rtl::OUString GetLicensePath();
static sal_Bool LicenseNeedsAcceptance();
static sal_Bool IsFirstStartWizardNeeded();
+ static sal_Bool CheckExtensionDependencies();
private:
// Bootstrap methods
diff --git a/desktop/prj/build.lst b/desktop/prj/build.lst
index 89c2d8c0509a..3aa56e273ff3 100644
--- a/desktop/prj/build.lst
+++ b/desktop/prj/build.lst
@@ -1,4 +1,4 @@
-dt desktop : sfx2 stoc uui BERKELEYDB:berkeleydb sysui SO:sysui_so BOOST:boost svx xmlhelp NULL
+dt desktop : l10n sfx2 stoc uui BERKELEYDB:berkeleydb sysui SO:sysui_so BOOST:boost svx xmlhelp NULL
dt desktop usr1 - all dt_mkout NULL
dt desktop\inc nmake - all dt_inc NULL
dt desktop\prj get - all dt_prj NULL
@@ -16,6 +16,7 @@ dt desktop\win32\source\guiloader nmake - w dt_guiloader dt_wrapper.w dt_inc N
dt desktop\win32\source\guistdio nmake - w dt_guistdio dt_inc NULL
dt desktop\win32\source\applauncher nmake - w dt_applauncher dt_inc NULL
dt desktop\win32\source\applauncher\ooo nmake - w dt_applauncher_ooo dt_applauncher.w dt_inc NULL
+dt desktop\win32\source\rebase nmake - w dt_rebase dt_inc NULL
dt desktop\os2\source\applauncher nmake - p dt_applauncher dt_inc NULL
dt desktop\unx\source\officeloader nmake - u dt_officeloader_unx dt_inc NULL
dt desktop\source\pagein nmake - u dt_pagein dt_inc NULL
@@ -35,5 +36,5 @@ dt desktop\source\deployment\registry\configuration nmake - all dt_dp_registry_c
dt desktop\source\deployment\registry\help nmake - all dt_dp_registry_help dt_inc NULL
dt desktop\source\deployment\registry\executable nmake - all dt_dp_registry_executable dt_inc NULL
dt desktop\scripts nmake - u dt_scripts dt_inc NULL
-dt desktop\util nmake - all dt_util dt_app dt_so_comp dt_spl dt_wrapper.w dt_officeloader.w dt_officeloader_unx.u dt_migr NULL
+dt desktop\util nmake - all dt_util dt_app dt_so_comp dt_spl dt_wrapper.w dt_officeloader.w dt_officeloader_unx.u dt_migr dt_rebase.w NULL
dt desktop\zipintro nmake - all dt_zipintro NULL
diff --git a/desktop/prj/d.lst b/desktop/prj/d.lst
index 78897216c386..eb0d93886e8a 100644
--- a/desktop/prj/d.lst
+++ b/desktop/prj/d.lst
@@ -82,6 +82,8 @@ mkdir: %_DEST%\bin%_EXT%\odf4ms
..\%__SRC%\bin\unopkga*.dll %_DEST%\bin%_EXT%\unopkga*.dll
..\%__SRC%\lib\libunopkgapp.dylib %_DEST%\lib%_EXT%\libunopkgapp.dylib
..\%__SRC%\lib\libunopkgapp.so %_DEST%\lib%_EXT%\libunopkgapp.so
+..\%__SRC%\bin\rebasegui.exe %_DEST%\bin%_EXT%\rebasegui.exe
+..\%__SRC%\bin\rebaseoo.exe %_DEST%\bin%_EXT%\rebaseoo.exe
..\%__SRC%\bin\pagein %_DEST%\bin%_EXT%\pagein
..\%__SRC%\misc\pagein-* %_DEST%\bin%_EXT%\pagein-*
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 8675d22e0aae..68577b3c1f1e 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1387,6 +1387,10 @@ void Desktop::Main()
tools::InitTestToolLib();
RTL_LOGFILE_CONTEXT_TRACE( aLog, "} tools::InitTestToolLib" );
+ bool bAbort = CheckExtensionDependencies();
+ if ( bAbort )
+ return;
+
// First Start Wizard allowed ?
if ( ! pCmdLineArgs->IsNoFirstStartWizard())
{
diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx
new file mode 100644
index 000000000000..a66031184200
--- /dev/null
+++ b/desktop/source/app/check_ext_deps.cxx
@@ -0,0 +1,256 @@
+/*************************************************************************
+ *
+ * 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_desktop.hxx"
+
+#include <rtl/bootstrap.hxx>
+#include <rtl/ustring.hxx>
+#include <unotools/configmgr.hxx>
+
+#include <comphelper/processfactory.hxx>
+#include <comphelper/sequence.hxx>
+#include <cppuhelper/bootstrap.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include "com/sun/star/deployment/XPackage.hpp"
+#include "com/sun/star/deployment/XPackageManager.hpp"
+#include "com/sun/star/deployment/thePackageManagerFactory.hpp"
+#include <com/sun/star/task/XJob.hpp>
+#include <com/sun/star/task/XJobExecutor.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/util/XChangesBatch.hpp>
+
+#include "app.hxx"
+
+using rtl::OUString;
+using namespace desktop;
+using namespace com::sun::star;
+
+#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))
+
+static const OUString sConfigSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) );
+static const OUString sAccessSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" ) );
+
+//------------------------------------------------------------------------------
+static sal_Int16 impl_showExtensionDialog( uno::Reference< uno::XComponentContext > &xContext )
+{
+ rtl::OUString sServiceName = UNISTRING("com.sun.star.deployment.ui.UpdateRequiredDialog");
+ uno::Reference< uno::XInterface > xService;
+ sal_Int16 nRet = 0;
+
+ uno::Reference< lang::XMultiComponentFactory > xServiceManager( xContext->getServiceManager() );
+ if( !xServiceManager.is() )
+ throw uno::RuntimeException(
+ UNISTRING( "impl_showExtensionDialog(): unable to obtain service manager from component context" ), uno::Reference< uno::XInterface > () );
+
+ xService = xServiceManager->createInstanceWithContext( sServiceName, xContext );
+ uno::Reference< ui::dialogs::XExecutableDialog > xExecuteable( xService, uno::UNO_QUERY );
+ if ( xExecuteable.is() )
+ nRet = xExecuteable->execute();
+
+ return nRet;
+}
+
+//------------------------------------------------------------------------------
+// Check dependencies of all packages
+//------------------------------------------------------------------------------
+static bool impl_checkDependencies( const uno::Reference< deployment::XPackageManager > &xPackageManager )
+{
+ uno::Sequence< uno::Reference< deployment::XPackage > > packages;
+
+ try {
+ packages = xPackageManager->getDeployedPackages( uno::Reference< task::XAbortChannel >(),
+ uno::Reference< ucb::XCommandEnvironment >() );
+ }
+ catch ( deployment::DeploymentException & ) { /* handleGeneralError(e.Cause);*/ }
+ catch ( ucb::CommandFailedException & ) { /* handleGeneralError(e.Reason);*/ }
+ catch ( ucb::CommandAbortedException & ) {}
+ catch ( lang::IllegalArgumentException & e ) {
+ throw uno::RuntimeException( e.Message, e.Context );
+ }
+
+ for ( sal_Int32 i = 0; i < packages.getLength(); ++i )
+ {
+ bool bRegistered = false;
+ try {
+ beans::Optional< beans::Ambiguous< sal_Bool > > option( packages[i]->isRegistered( uno::Reference< task::XAbortChannel >(),
+ uno::Reference< ucb::XCommandEnvironment >() ) );
+ if ( option.IsPresent )
+ {
+ ::beans::Ambiguous< sal_Bool > const & reg = option.Value;
+ if ( reg.IsAmbiguous )
+ bRegistered = false;
+ else
+ bRegistered = reg.Value ? true : false;
+ }
+ else
+ bRegistered = false;
+ }
+ catch ( uno::RuntimeException & ) { throw; }
+ catch ( uno::Exception & exc) {
+ (void) exc;
+ OSL_ENSURE( 0, ::rtl::OUStringToOString( exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ bRegistered = false;
+ }
+
+ if ( bRegistered )
+ {
+ bool bDependenciesValid = false;
+ try {
+ bDependenciesValid = packages[i]->checkDependencies( uno::Reference< ucb::XCommandEnvironment >() );
+ }
+ catch ( deployment::DeploymentException & ) {}
+ if ( ! bDependenciesValid )
+ {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+//------------------------------------------------------------------------------
+// resets the 'check needed' flag (needed, if aborted)
+//------------------------------------------------------------------------------
+static void impl_setNeedsCompatCheck()
+{
+ try {
+ Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
+ // get configuration provider
+ Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >(
+ xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW);
+
+ Sequence< Any > theArgs(1);
+ beans::NamedValue v( OUString::createFromAscii("NodePath"),
+ makeAny( OUString::createFromAscii("org.openoffice.Setup/Office") ) );
+ theArgs[0] <<= v;
+ Reference< beans::XPropertySet > pset = Reference< beans::XPropertySet >(
+ theConfigProvider->createInstanceWithArguments( sAccessSrvc, theArgs ), UNO_QUERY_THROW );
+
+ Any value = makeAny( OUString::createFromAscii("never") );
+
+ pset->setPropertyValue( OUString::createFromAscii("LastCompatibilityCheckID"), value );
+ Reference< util::XChangesBatch >( pset, UNO_QUERY_THROW )->commitChanges();
+ }
+ catch (const Exception&) {}
+}
+
+//------------------------------------------------------------------------------
+static bool impl_check()
+{
+ uno::Reference< uno::XComponentContext > xContext = comphelper_getProcessComponentContext();
+ uno::Reference< deployment::XPackageManager > xManager;
+ bool bDependenciesValid = true;
+
+ try {
+ xManager = deployment::thePackageManagerFactory::get( xContext )->getPackageManager( UNISTRING("user") );
+ }
+ catch ( ucb::CommandFailedException & ){}
+ catch ( uno::RuntimeException & ) {}
+
+ if ( xManager.is() )
+ bDependenciesValid = impl_checkDependencies( xManager );
+
+ if ( bDependenciesValid )
+ {
+ try {
+ xManager = deployment::thePackageManagerFactory::get( xContext )->getPackageManager( UNISTRING("shared") );
+ }
+ catch ( ucb::CommandFailedException & ){}
+ catch ( uno::RuntimeException & ) {}
+
+ if ( xManager.is() )
+ bDependenciesValid = impl_checkDependencies( xManager );
+ }
+
+ short nRet = 0;
+ if ( !bDependenciesValid )
+ nRet = impl_showExtensionDialog( xContext );
+
+ if ( nRet == -1 )
+ {
+ impl_setNeedsCompatCheck();
+ return true;
+ }
+ else
+ return false;
+}
+
+//------------------------------------------------------------------------------
+// to check, if we need checking the dependencies of the extensions again, we compare
+// the build id of the office with the one of the last check
+//------------------------------------------------------------------------------
+static bool impl_needsCompatCheck()
+{
+ bool bNeedsCheck = false;
+ rtl::OUString aLastCheckBuildID;
+ rtl::OUString aCurrentBuildID( UNISTRING( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":buildid}" ) );
+ rtl::Bootstrap::expandMacros( aCurrentBuildID );
+
+ try {
+ Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
+ // get configuration provider
+ Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >(
+ xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW);
+
+ Sequence< Any > theArgs(1);
+ beans::NamedValue v( OUString::createFromAscii("NodePath"),
+ makeAny( OUString::createFromAscii("org.openoffice.Setup/Office") ) );
+ theArgs[0] <<= v;
+ Reference< beans::XPropertySet > pset = Reference< beans::XPropertySet >(
+ theConfigProvider->createInstanceWithArguments( sAccessSrvc, theArgs ), UNO_QUERY_THROW );
+
+ Any result = pset->getPropertyValue( OUString::createFromAscii("LastCompatibilityCheckID") );
+
+ result >>= aLastCheckBuildID;
+ if ( aLastCheckBuildID != aCurrentBuildID )
+ {
+ bNeedsCheck = true;
+ result <<= aCurrentBuildID;
+ pset->setPropertyValue( OUString::createFromAscii("LastCompatibilityCheckID"), result );
+ Reference< util::XChangesBatch >( pset, UNO_QUERY_THROW )->commitChanges();
+ }
+ }
+ catch (const Exception&) {}
+
+ return bNeedsCheck;
+}
+
+//------------------------------------------------------------------------------
+// Do we need to check the dependencies of the extensions?
+// When there are unresolved issues, we can't continue with startup
+sal_Bool Desktop::CheckExtensionDependencies()
+{
+ sal_Bool bAbort = false;
+
+ if ( impl_needsCompatCheck() )
+ bAbort = impl_check();
+
+ return bAbort;
+}
+
diff --git a/desktop/source/app/makefile.mk b/desktop/source/app/makefile.mk
index 18c2170d3f53..36993bfdf355 100644
--- a/desktop/source/app/makefile.mk
+++ b/desktop/source/app/makefile.mk
@@ -56,6 +56,7 @@ SHL1OBJS = \
$(SLO)$/appsys.obj \
$(SLO)$/cfgfilter.obj \
$(SLO)$/checkinstall.obj \
+ $(SLO)$/check_ext_deps.obj \
$(SLO)$/cmdlineargs.obj \
$(SLO)$/cmdlinehelp.obj \
$(SLO)$/configinit.obj \
diff --git a/desktop/source/deployment/gui/dp_gui.h b/desktop/source/deployment/gui/dp_gui.h
index 65fc7635a6ec..7f2cb7a9626a 100644
--- a/desktop/source/deployment/gui/dp_gui.h
+++ b/desktop/source/deployment/gui/dp_gui.h
@@ -82,6 +82,7 @@ enum PackageState { REGISTERED, NOT_REGISTERED, AMBIGUOUS, NOT_AVAILABLE };
class SelectedPackage: public salhelper::SimpleReferenceObject {
public:
+ SelectedPackage() {}
SelectedPackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> &xPackage,
const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> &xPackageManager )
: m_xPackage( xPackage ),
diff --git a/desktop/source/deployment/gui/dp_gui.hrc b/desktop/source/deployment/gui/dp_gui.hrc
index 412e6a067159..387072c98618 100644
--- a/desktop/source/deployment/gui/dp_gui.hrc
+++ b/desktop/source/deployment/gui/dp_gui.hrc
@@ -32,7 +32,8 @@
#include "helpid.hrc"
// Package Manager Dialog:
-#define RID_DLG_PACKAGE_MANAGER RID_DEPLOYMENT_GUI_START
+#define RID_DLG_EXTENSION_MANAGER RID_DEPLOYMENT_GUI_START
+#define RID_DLG_UPDATE_REQUIRED (RID_DEPLOYMENT_GUI_START + 11)
#define RID_EM_BTN_CLOSE 10
#define RID_EM_BTN_HELP 11
@@ -42,27 +43,9 @@
#define RID_EM_BTN_CANCEL 15
#define RID_EM_FT_GET_EXTENSIONS 20
#define RID_EM_FT_PROGRESS 21
+#define RID_EM_FT_MSG 22
// local RIDs:
-#define RID_FT_PACKAGES 5
-
-#define RID_BTN_CLOSE 10
-#define RID_BTN_HELP 11
-
-#define RID_BTN_ADD 20
-#define RID_BTN_REMOVE 21
-#define RID_BTN_ENABLE 22
-#define RID_BTN_DISABLE 23
-#define RID_BTN_EXPORT 24
-#define RID_BTN_CHECK_UPDATES 25
-#define RID_BTN_OPTIONS 26
-#define RID_BTN_GET_EXTENSIONS 27
-
-#define RID_IMG_PLUS 41
-#define RID_IMG_PLUS_HC 42
-#define RID_IMG_MINUS 43
-#define RID_IMG_MINUS_HC 44
-
#define PB_LICENSE_DOWN 50
#define ML_LICENSE 51
#define BTN_LICENSE_DECLINE 53
@@ -145,18 +128,10 @@
#define RID_DLG_UPDATE_NOUPDATE 30
#define RID_DLG_UPDATE_VERSION 31
-#define RID_DLG_EXTENSION_MANAGER (RID_DEPLOYMENT_GUI_START + 6)
-
#define RID_DLG_UPDATEINSTALL (RID_DEPLOYMENT_GUI_START + 20)
#define RID_INFOBOX_UPDATE_SHARED_EXTENSION (RID_DEPLOYMENT_GUI_START + 21)
-#define RID_IMG_DEF_INSTALLATION (RID_DEPLOYMENT_GUI_START+50)
-#define RID_IMG_DEF_INSTALLATION_HC (RID_DEPLOYMENT_GUI_START+51)
-#define RID_IMG_DEF_DOCUMENT (RID_DEPLOYMENT_GUI_START+52)
-#define RID_IMG_DEF_DOCUMENT_HC (RID_DEPLOYMENT_GUI_START+53)
-#define RID_IMG_DEF_PACKAGE (RID_DEPLOYMENT_GUI_START+54)
-#define RID_IMG_DEF_PACKAGE_HC (RID_DEPLOYMENT_GUI_START+55)
#define RID_IMG_WARNING (RID_DEPLOYMENT_GUI_START+56)
#define RID_IMG_WARNING_HC (RID_DEPLOYMENT_GUI_START+57)
#define RID_IMG_LOCKED (RID_DEPLOYMENT_GUI_START+58)
@@ -164,39 +139,26 @@
#define RID_IMG_EXTENSION (RID_DEPLOYMENT_GUI_START+60)
#define RID_IMG_EXTENSION_HC (RID_DEPLOYMENT_GUI_START+61)
-
-#define RID_STR_USER_INSTALLATION (RID_DEPLOYMENT_GUI_START+60)
-#define RID_STR_SHARED_INSTALLATION (RID_DEPLOYMENT_GUI_START+61)
-#define RID_STR_ENABLED (RID_DEPLOYMENT_GUI_START+62)
-#define RID_STR_DISABLED (RID_DEPLOYMENT_GUI_START+63)
-#define RID_STR_UNKNOWN (RID_DEPLOYMENT_GUI_START+64)
-#define RID_STR_PACKAGE (RID_DEPLOYMENT_GUI_START+65)
-#define RID_STR_PACKAGE_STATUS (RID_DEPLOYMENT_GUI_START+66)
-#define RID_STR_EXTENSION_VERSION (RID_DEPLOYMENT_GUI_START+67)
-
-
#define RID_STR_ADD_PACKAGES (RID_DEPLOYMENT_GUI_START+70)
-#define RID_STR_EXPORT_PACKAGE (RID_DEPLOYMENT_GUI_START+71)
-#define RID_STR_EXPORT_PACKAGES (RID_DEPLOYMENT_GUI_START+72)
-
-#define RID_CTX_ITEM_ADD (RID_DEPLOYMENT_GUI_START+80)
-#define RID_CTX_ITEM_REMOVE (RID_DEPLOYMENT_GUI_START+81)
-#define RID_CTX_ITEM_ENABLE (RID_DEPLOYMENT_GUI_START+82)
-#define RID_CTX_ITEM_DISABLE (RID_DEPLOYMENT_GUI_START+83)
-#define RID_CTX_ITEM_EXPORT (RID_DEPLOYMENT_GUI_START+84)
-#define RID_CTX_ITEM_CHECK_UPDATE (RID_DEPLOYMENT_GUI_START+85)
-#define RID_CTX_ITEM_OPTIONS (RID_DEPLOYMENT_GUI_START+86)
-
-#define RID_STR_ADDING_PACKAGES (RID_DEPLOYMENT_GUI_START+90)
-#define RID_STR_REMOVING_PACKAGES (RID_DEPLOYMENT_GUI_START+91)
-#define RID_STR_ENABLING_PACKAGES (RID_DEPLOYMENT_GUI_START+92)
-#define RID_STR_DISABLING_PACKAGES (RID_DEPLOYMENT_GUI_START+93)
-#define RID_STR_EXPORTING_PACKAGES (RID_DEPLOYMENT_GUI_START+94)
-
-#define RID_STR_INSTALL_FOR_ALL (RID_DEPLOYMENT_GUI_START+95)
-#define RID_STR_INSTALL_FOR_ME (RID_DEPLOYMENT_GUI_START+96)
-#define RID_STR_PUBLISHER_LINK (RID_DEPLOYMENT_GUI_START+97)
-#define RID_STR_ERROR_UNKNOWN_STATUS (RID_DEPLOYMENT_GUI_START+98)
+
+#define RID_CTX_ITEM_REMOVE (RID_DEPLOYMENT_GUI_START+80)
+#define RID_CTX_ITEM_ENABLE (RID_DEPLOYMENT_GUI_START+81)
+#define RID_CTX_ITEM_DISABLE (RID_DEPLOYMENT_GUI_START+82)
+#define RID_CTX_ITEM_CHECK_UPDATE (RID_DEPLOYMENT_GUI_START+83)
+#define RID_CTX_ITEM_OPTIONS (RID_DEPLOYMENT_GUI_START+84)
+
+#define RID_STR_ADDING_PACKAGES (RID_DEPLOYMENT_GUI_START+85)
+#define RID_STR_REMOVING_PACKAGES (RID_DEPLOYMENT_GUI_START+86)
+#define RID_STR_ENABLING_PACKAGES (RID_DEPLOYMENT_GUI_START+87)
+#define RID_STR_DISABLING_PACKAGES (RID_DEPLOYMENT_GUI_START+88)
+
+#define RID_STR_INSTALL_FOR_ALL (RID_DEPLOYMENT_GUI_START+90)
+#define RID_STR_INSTALL_FOR_ME (RID_DEPLOYMENT_GUI_START+91)
+#define RID_STR_ERROR_UNKNOWN_STATUS (RID_DEPLOYMENT_GUI_START+92)
+#define RID_STR_CLOSE_BTN (RID_DEPLOYMENT_GUI_START+93)
+#define RID_STR_EXIT_BTN (RID_DEPLOYMENT_GUI_START+94)
+#define RID_STR_NO_ADMIN_PRIVILEGE (RID_DEPLOYMENT_GUI_START+95)
+#define RID_STR_ERROR_MISSING_DEPENDENCIES (RID_DEPLOYMENT_GUI_START+96)
#define WARNINGBOX_CONCURRENTINSTANCE (RID_DEPLOYMENT_GUI_START+100)
diff --git a/desktop/source/deployment/gui/dp_gui_dialog.src b/desktop/source/deployment/gui/dp_gui_dialog.src
index d3730a12536e..e7c785c86973 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog.src
+++ b/desktop/source/deployment/gui/dp_gui_dialog.src
@@ -30,192 +30,10 @@
#include "svtools/controldims.hrc"
#include "dp_gui.hrc"
-ModelessDialog RID_DLG_PACKAGE_MANAGER
-{
- HelpId = HID_PACKAGE_MANAGER;
- Text [ en-US ] = "Extension Manager";
-
- Size = MAP_APPFONT( 300, 200 );
- OutputSize = TRUE;
- SVLook = TRUE;
- Moveable = TRUE;
- Closeable = TRUE;
- Sizeable = TRUE;
- Hide = TRUE;
-
- FixedText RID_FT_PACKAGES
- {
- Group = TRUE;
- Left = TRUE;
- NoLabel = TRUE;
- Text [ en-US ] = "Browse extensions";
- };
-
- PushButton RID_BTN_ADD
- {
- TabStop = TRUE;
- Text [ en-US ] = "~Add...";
- };
- PushButton RID_BTN_REMOVE
- {
- TabStop = TRUE;
- Text [ en-US ] = "~Remove";
- };
- PushButton RID_BTN_ENABLE
- {
- TabStop = TRUE;
- Text [ en-US ] = "~Enable";
- };
- PushButton RID_BTN_DISABLE
- {
- TabStop = TRUE;
- Text [ en-US ] = "~Disable";
- };
- PushButton RID_BTN_EXPORT
- {
- TabStop = TRUE;
- Text [ en-US ] = "E~xport...";
- };
- PushButton RID_BTN_CHECK_UPDATES
- {
- Disable = TRUE;
- TabStop = TRUE;
- Text [ en-US ] = "~Updates...";
- };
- PushButton RID_BTN_OPTIONS
- {
- Disable = TRUE;
- TabStop = TRUE;
- Text [ en-US ] = "~Options...";
- };
-
-
-
- FixedText RID_BTN_GET_EXTENSIONS
- {
- NoLabel = TRUE;
- TabStop = TRUE;
- Text [ en-US ] = "Get more extensions here...";
- };
-
- OKButton RID_BTN_CLOSE
- {
- TabStop = TRUE;
- DefButton = TRUE;
- Text [ en-US ] = "Close";
- };
- HelpButton RID_BTN_HELP
- {
- TabStop = TRUE;
- };
-
- Image RID_IMG_PLUS
- {
- ImageBitmap = Bitmap { File = "plus.bmp"; };
- MASKCOLOR
- };
-
- Image RID_IMG_PLUS_HC
- {
- ImageBitmap = Bitmap { File = "plus_sch.bmp"; };
- MASKCOLOR
- };
- Image RID_IMG_MINUS
- {
- ImageBitmap = Bitmap { File = "minus.bmp"; };
- MASKCOLOR
- };
- Image RID_IMG_MINUS_HC
- {
- ImageBitmap = Bitmap { File = "minus_sch.bmp"; };
- MASKCOLOR
- };
-};
-
-
-Image RID_IMG_DEF_INSTALLATION
-{
- ImageBitmap = Bitmap { File = "harddisk_16.bmp"; };
- MASKCOLOR
-};
-Image RID_IMG_DEF_INSTALLATION_HC
-{
- ImageBitmap = Bitmap { File = "harddisk_16_h.bmp"; };
- MASKCOLOR
-};
-
-Image RID_IMG_DEF_DOCUMENT
-{
- ImageBitmap = Bitmap { File = "sc05500.bmp"; };
- MASKCOLOR
-};
-Image RID_IMG_DEF_DOCUMENT_HC
-{
- ImageBitmap = Bitmap { File = "sch05500.bmp"; };
- MASKCOLOR
-};
-
-Image RID_IMG_DEF_PACKAGE
-{
- ImageBitmap = Bitmap { File = "puzzleslice_16.bmp"; };
- MASKCOLOR
-};
-Image RID_IMG_DEF_PACKAGE_HC
-{
- ImageBitmap = Bitmap { File = "puzzleslice_16_h.bmp"; };
- MASKCOLOR
-};
-
-
-String RID_STR_USER_INSTALLATION
-{
- Text [ en-US ] = "My Extensions";
-};
-
-String RID_STR_SHARED_INSTALLATION
-{
- Text [ en-US ] = "%PRODUCTNAME Extensions";
-};
-
-String RID_STR_PACKAGE
-{
- Text [ en-US ] = "Extension";
-};
-
-String RID_STR_PACKAGE_STATUS
-{
- Text [ en-US ] = "Status";
-};
-
-String RID_STR_EXTENSION_VERSION
-{
- Text [ en-US ] = "Version";
-};
-
String RID_STR_ADD_PACKAGES
{
Text [ en-US ] = "Add Extension(s)";
};
-
-String RID_STR_ENABLED
-{
- Text [ en-US ] = "Enabled";
-};
-
-String RID_STR_DISABLED
-{
- Text [ en-US ] = "Disabled";
-};
-
-String RID_STR_UNKNOWN
-{
- Text [ en-US ] = "Unknown";
-};
-
-String RID_CTX_ITEM_ADD
-{
- Text [ en-US ] = "~Add...";
-};
String RID_CTX_ITEM_REMOVE
{
Text [ en-US ] = "~Remove";
@@ -228,30 +46,15 @@ String RID_CTX_ITEM_DISABLE
{
Text [ en-US ] = "~Disable";
};
-String RID_CTX_ITEM_EXPORT
-{
- Text [ en-US ] = "E~xport...";
-};
String RID_CTX_ITEM_CHECK_UPDATE
{
Text [ en-US ] = "~Update...";
};
-
String RID_CTX_ITEM_OPTIONS
{
Text [ en-US ] = "~Options...";
};
-String RID_STR_EXPORT_PACKAGE
-{
- Text [ en-US ] = "Export Extension";
-};
-
-String RID_STR_EXPORT_PACKAGES
-{
- Text [ en-US ] = "Export Extensions to...";
-};
-
String RID_STR_ADDING_PACKAGES
{
Text [ en-US ] = "Adding %EXTENSION_NAME";
@@ -272,11 +75,6 @@ String RID_STR_DISABLING_PACKAGES
Text [ en-US ] = "Disabling %EXTENSION_NAME";
};
-String RID_STR_EXPORTING_PACKAGES
-{
- Text [ en-US ] = "Exporting Extension(s)";
-};
-
String RID_STR_INSTALL_FOR_ALL
{
Text [ en-US ] = "~For all users";
@@ -287,14 +85,31 @@ String RID_STR_INSTALL_FOR_ME
Text [ en-US ] = "~Only for me";
};
-String RID_STR_PUBLISHER_LINK
+String RID_STR_ERROR_UNKNOWN_STATUS
{
- Text [ en-US ] = "Publisher";
+ Text [ en-US ] = "Error: The status of this extension is unknown";
};
-String RID_STR_ERROR_UNKNOWN_STATUS
+String RID_STR_CLOSE_BTN
{
- Text [ en-US ] = "Error: The status of this extension is unknown";
+ Text [ en-US ] = "Close";
+};
+
+String RID_STR_EXIT_BTN
+{
+ Text [ en-US ] = "Quit";
+};
+
+String RID_STR_NO_ADMIN_PRIVILEGE
+{
+ Text [ en-US ] = "%PRODUCTNAME has been updated to a new version. "
+ "Some shared %PRODUCTNAME extensions are not compatible with this version and need to be updated before %PRODUCTNAME can be started.\n\n"
+ "Updating of shared extension requires administrator privileges. Contact your system administrator to update the following shared extensions:";
+};
+
+String RID_STR_ERROR_MISSING_DEPENDENCIES
+{
+ Text [ en-US ] = "The extension cannot be enabled as the following system dependencies are not fulfilled:";
};
// Dialog layout
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
index 47bcd507cd90..f09d906a840e 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
@@ -36,7 +36,9 @@
#include "svtools/controldims.hrc"
#include "svtools/svtools.hrc"
+#include "dp_gui.h"
#include "dp_gui_dialog2.hxx"
+#include "dp_gui_extlistbox.hxx"
#include "dp_gui_shared.hxx"
#include "dp_gui_theextmgr.hxx"
#include "dp_misc.h"
@@ -55,7 +57,7 @@
#include "comphelper/anytostring.hxx"
#include "cppuhelper/exc_hlp.hxx"
-#include "cppuhelper/implbase1.hxx"
+#include "cppuhelper/bootstrap.hxx"
#include "comphelper/processfactory.hxx"
#include "ucbhelper/content.hxx"
@@ -76,6 +78,8 @@
#include "com/sun/star/uno/Any.hxx"
#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/deployment/thePackageManagerFactory.hpp"
+
#include <map>
#include <vector>
#include <boost/shared_ptr.hpp>
@@ -91,11 +95,7 @@ using ::rtl::OUString;
namespace dp_gui {
#define ICON_OFFSET 50
-#define ICON_HEIGHT 42
-#define SMALL_ICON_SIZE 16
-#define RIGHT_ICON_OFFSET 5
#define TOP_OFFSET 3
-#define SPACE_BETWEEN 3
#define LINE_SIZE 4
#define PROGRESS_WIDTH 60
#define PROGRESS_HEIGHT 14
@@ -113,112 +113,18 @@ struct StrAllFiles : public rtl::StaticWithInit< const OUString, StrAllFiles >
};
//------------------------------------------------------------------------------
-// struct Entry_Impl
-//------------------------------------------------------------------------------
-struct Entry_Impl;
-
-typedef ::boost::shared_ptr< Entry_Impl > TEntry_Impl;
-
-struct Entry_Impl
-{
- bool m_bActive;
- bool m_bLocked;
- bool m_bHasOptions;
- bool m_bShared;
- bool m_bNew;
- bool m_bChecked;
- PackageState m_eState;
- String m_sTitle;
- String m_sVersion;
- String m_sDescription;
- String m_sPublisher;
- String m_sPublisherURL;
- String m_sErrorText;
- Image m_aIcon;
- Image m_aIconHC;
- svt::FixedHyperlink *m_pPublisher;
-
- uno::Reference< deployment::XPackage> m_xPackage;
- uno::Reference< deployment::XPackageManager> m_xPackageManager;
-
- Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage,
- const uno::Reference< deployment::XPackageManager > &xPackageManager,
- PackageState eState );
- ~Entry_Impl();
-
- StringCompare CompareTo( const CollatorWrapper *pCollator, const TEntry_Impl pEntry ) const;
-};
-
-//------------------------------------------------------------------------------
-Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage,
- const uno::Reference< deployment::XPackageManager > &xPackageManager,
- PackageState eState ) :
- m_bActive( false ),
- m_bLocked( false ),
- m_bHasOptions( false ),
- m_bShared( false ),
- m_bNew( false ),
- m_bChecked( false ),
- m_eState( eState ),
- m_pPublisher( NULL ),
+UpdateListEntry::UpdateListEntry( const uno::Reference< deployment::XPackage > &xPackage,
+ const uno::Reference< deployment::XPackageManager > &xPackageManager ) :
m_xPackage( xPackage ),
m_xPackageManager( xPackageManager )
-{
- m_sTitle = xPackage->getDisplayName();
- m_sVersion = xPackage->getVersion();
- m_sDescription = xPackage->getDescription();
-
- beans::StringPair aInfo( m_xPackage->getPublisherInfo() );
- m_sPublisher = aInfo.First;
- m_sPublisherURL = aInfo.Second;
-
- // get the icons for the package if there are any
- uno::Reference< graphic::XGraphic > xGraphic = xPackage->getIcon( false );
- if ( xGraphic.is() )
- m_aIcon = Image( xGraphic );
-
- xGraphic = xPackage->getIcon( true );
- if ( xGraphic.is() )
- m_aIconHC = Image( xGraphic );
- else
- m_aIconHC = m_aIcon;
-
- m_bLocked = m_xPackageManager->isReadOnly();
-
- if ( eState == AMBIGUOUS )
- m_sErrorText = ExtMgrDialog::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS );
-}
-
-//------------------------------------------------------------------------------
-Entry_Impl::~Entry_Impl()
-{
- delete m_pPublisher;
-}
+{}
//------------------------------------------------------------------------------
-StringCompare Entry_Impl::CompareTo( const CollatorWrapper *pCollator, const TEntry_Impl pEntry ) const
-{
- StringCompare eCompare = (StringCompare) pCollator->compareString( m_sTitle, pEntry->m_sTitle );
- if ( eCompare == COMPARE_EQUAL )
- {
- eCompare = m_sVersion.CompareTo( pEntry->m_sVersion );
- if ( eCompare == COMPARE_EQUAL )
- {
- if ( m_xPackageManager != pEntry->m_xPackageManager )
- {
- sal_Int32 nCompare = m_xPackageManager->getContext().compareTo( pEntry->m_xPackageManager->getContext() );
- if ( nCompare < 0 )
- eCompare = COMPARE_LESS;
- else if ( nCompare > 0 )
- eCompare = COMPARE_GREATER;
- }
- }
- }
- return eCompare;
-}
+UpdateListEntry::~UpdateListEntry()
+{}
//------------------------------------------------------------------------------
-// ExtensionBox_Impl
+// ExtBoxWithBtns_Impl
//------------------------------------------------------------------------------
enum MENU_COMMAND
@@ -230,63 +136,21 @@ enum MENU_COMMAND
CMD_UPDATE
};
-class ExtensionBox_Impl : public ::svt::IExtensionListBox,
- public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener >
+class ExtBoxWithBtns_Impl : public ExtensionBox_Impl
{
- bool m_bHasScrollBar;
- bool m_bHasActive;
- bool m_bNeedsRecalc;
- bool m_bHasNew;
- bool m_bInCheckMode;
- bool m_bInterfaceLocked;
- //Must be guarded together with m_vEntries to ensure a valid index at all times.
- //Use m_entriesMutex as guard.
- long m_nActive;
- long m_nTopIndex;
- long m_nStdHeight;
- long m_nActiveHeight;
- long m_nBtnHeight;
Size m_aOutputSize;
- Image m_aLockedImage;
- Image m_aLockedImageHC;
- Image m_aWarningImage;
- Image m_aWarningImageHC;
- Image m_aDefaultImage;
- Image m_aDefaultImageHC;
+ bool m_bInterfaceLocked;
PushButton *m_pOptionsBtn;
PushButton *m_pEnableBtn;
PushButton *m_pRemoveBtn;
- ScrollBar *m_pScrollBar;
-
- ExtMgrDialog *m_pParent;
- TheExtensionManager *m_pManager;
- //This mutex is used for synchronizing access to m_vEntries.
- //Currently it is used to synchronize adding, removing entries and
- //functions like getItemName, getItemDescription, etc. to prevent
- //that m_vEntries is accessed at an invalid index.
- //ToDo: There are many more places where m_vEntries is read and which may
- //fail. For example the Paint method is probable called from the main thread
- //while new entries are added / removed in a separate thread.
- mutable ::osl::Mutex m_entriesMutex;
- std::vector< TEntry_Impl > m_vEntries;
-
- lang::Locale *m_pLocale;
- CollatorWrapper *m_pCollator;
-
- void CalcActiveHeight( const long nPos );
- long GetTotalHeight() const;
- Rectangle GetEntryRect( const long nPos ) const;
+
+ ExtMgrDialog *m_pParent;
+
void SetButtonPos( const Rectangle& rRect );
void SetButtonStatus( const TEntry_Impl pEntry );
- void SetupScrollBar();
- void DrawRow( const Rectangle& rRect, const TEntry_Impl pEntry );
bool HandleTabKey( bool bReverse );
- bool HandleCursorKey( USHORT nKeyCode );
MENU_COMMAND ShowPopupMenu( const Point &rPos, const long nPos );
- void RecalcAll();
- bool FindEntryPos( const TEntry_Impl pEntry, long nStart, long nEnd, long &nFound );
- bool isHCMode();
//-----------------
DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar * );
@@ -296,115 +160,29 @@ class ExtensionBox_Impl : public ::svt::IExtensionListBox,
DECL_DLLPRIVATE_LINK( HandleRemoveBtn, void * );
DECL_DLLPRIVATE_LINK( HandleHyperlink, svt::FixedHyperlink * );
- //Index starts with 1.
- //Throws an com::sun::star::lang::IllegalArgumentException, when the index is invalid.
- void checkIndex(sal_Int32 pos) const;
-
-
public:
- ExtensionBox_Impl( ExtMgrDialog* pParent, TheExtensionManager *pManager );
- ~ExtensionBox_Impl();
+ ExtBoxWithBtns_Impl( ExtMgrDialog* pParent, TheExtensionManager *pManager );
+ ~ExtBoxWithBtns_Impl();
virtual void MouseButtonDown( const MouseEvent& rMEvt );
- virtual void Paint( const Rectangle &rPaintRect );
- virtual void Resize();
virtual long Notify( NotifyEvent& rNEvt );
const Size GetMinOutputSizePixel() const;
+ virtual void RecalcAll();
+ virtual void selectEntry( const long nPos );
//-----------------
- long addEntry( const uno::Reference< deployment::XPackage > &xPackage,
- const uno::Reference< deployment::XPackageManager > &xPackageManager );
- void selectEntry( const long nPos );
void enableButtons( bool bEnable );
-
- void updateEntry( const uno::Reference< deployment::XPackage > &xPackage );
-
- void prepareChecking( const uno::Reference< deployment::XPackageManager > &xPackageMgr );
- void checkEntries();
-
- TheExtensionManager* getExtensionManager() const { return m_pManager; }
-
- //===================================================================================
- //These functions are used for automatic testing
-
- /** @return The count of the entries in the list box. */
- virtual sal_Int32 getItemCount() const;
-
- /** @return The index of the first selected entry in the list box.
- When nothing is selected, which is the case when getItemCount returns '0',
- then this function returns EXTENSION_LISTBOX_ENTRY_NOTFOUND */
- virtual sal_Int32 getSelIndex() const;
-
- /** @return The item name of the entry with the given index
- The index starts with 0.
- Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
- virtual OUString getItemName( sal_Int32 index ) const;
-
- /** @return The version string of the entry with the given index
- The index starts with 0.
- Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
- virtual OUString getItemVersion( sal_Int32 index ) const;
-
- /** @return The description string of the entry with the given index
- The index starts with 0.
- Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
- virtual OUString getItemDescription( sal_Int32 index ) const;
-
- /** @return The publisher string of the entry with the given index
- The index starts with 0.
- Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
- virtual ::rtl::OUString getItemPublisher( sal_Int32 index ) const;
-
- /** @return The link behind the publisher text of the entry with the given index
- The index starts with 0.
- Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
- virtual ::rtl::OUString getItemPublisherLink( sal_Int32 index ) const;
-
- /** The entry at the given position will be selected
- Index starts with 0.
- Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
- virtual void select( sal_Int32 pos );
-
- /** The first found entry with the given name will be selected
- When there was no entry found with the name, the selection doesn't change.
- Please note that there might be more than one entry with the same
- name, because:
- 1. the name is not unique
- 2. one extension can be installed as user and shared extension.
- */
- virtual void select( const OUString & sName );
-
- //===================================================================================
- // XEventListener
- virtual void SAL_CALL disposing( ::com::sun::star::lang::EventObject const & evt )
- throw (::com::sun::star::uno::RuntimeException);
};
//------------------------------------------------------------------------------
-ExtensionBox_Impl::ExtensionBox_Impl( ExtMgrDialog* pParent, TheExtensionManager *pManager ) :
- IExtensionListBox( pParent, WB_BORDER | WB_TABSTOP | WB_CHILDDLGCTRL ),
- m_bHasScrollBar( false ),
- m_bHasActive( false ),
- m_bNeedsRecalc( true ),
- m_bHasNew( false ),
- m_bInCheckMode( false ),
+ExtBoxWithBtns_Impl::ExtBoxWithBtns_Impl( ExtMgrDialog* pParent, TheExtensionManager *pManager ) :
+ ExtensionBox_Impl( pParent, pManager ),
m_bInterfaceLocked( false ),
- m_nActive( 0 ),
- m_nTopIndex( 0 ),
- m_nActiveHeight( 0 ),
- m_aLockedImage( ExtMgrDialog::getResId( RID_IMG_LOCKED ) ),
- m_aLockedImageHC( ExtMgrDialog::getResId( RID_IMG_LOCKED_HC ) ),
- m_aWarningImage( ExtMgrDialog::getResId( RID_IMG_WARNING ) ),
- m_aWarningImageHC( ExtMgrDialog::getResId( RID_IMG_WARNING_HC ) ),
- m_aDefaultImage( ExtMgrDialog::getResId( RID_IMG_EXTENSION ) ),
- m_aDefaultImageHC( ExtMgrDialog::getResId( RID_IMG_EXTENSION_HC ) ),
m_pOptionsBtn( NULL ),
m_pEnableBtn( NULL ),
m_pRemoveBtn( NULL ),
- m_pScrollBar( NULL ),
- m_pParent( pParent ),
- m_pManager( pManager )
+ m_pParent( pParent )
{
m_pOptionsBtn = new PushButton( this, WB_TABSTOP );
m_pEnableBtn = new PushButton( this, WB_TABSTOP );
@@ -415,17 +193,13 @@ ExtensionBox_Impl::ExtensionBox_Impl( ExtMgrDialog* pParent, TheExtensionManager
m_pEnableBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_DISABLE );
m_pRemoveBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_REMOVE );
- m_pOptionsBtn->SetClickHdl( LINK( this, ExtensionBox_Impl, HandleOptionsBtn ) );
- m_pEnableBtn->SetClickHdl( LINK( this, ExtensionBox_Impl, HandleEnableBtn ) );
- m_pRemoveBtn->SetClickHdl( LINK( this, ExtensionBox_Impl, HandleRemoveBtn ) );
+ m_pOptionsBtn->SetClickHdl( LINK( this, ExtBoxWithBtns_Impl, HandleOptionsBtn ) );
+ m_pEnableBtn->SetClickHdl( LINK( this, ExtBoxWithBtns_Impl, HandleEnableBtn ) );
+ m_pRemoveBtn->SetClickHdl( LINK( this, ExtBoxWithBtns_Impl, HandleRemoveBtn ) );
- m_pScrollBar = new ScrollBar( this, WB_VERT );
- m_pScrollBar->SetScrollHdl( LINK( this, ExtensionBox_Impl, ScrollHdl ) );
- m_pScrollBar->EnableDrag();
-
- m_pOptionsBtn->SetText( ExtMgrDialog::getResourceString( RID_CTX_ITEM_OPTIONS ) );
- m_pEnableBtn->SetText( ExtMgrDialog::getResourceString( RID_CTX_ITEM_DISABLE ) );
- m_pRemoveBtn->SetText( ExtMgrDialog::getResourceString( RID_CTX_ITEM_REMOVE ) );
+ m_pOptionsBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_OPTIONS ) );
+ m_pEnableBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) );
+ m_pRemoveBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) );
Size aSize = LogicToPixel( Size( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ),
MapMode( MAP_APPFONT ) );
@@ -433,288 +207,69 @@ ExtensionBox_Impl::ExtensionBox_Impl( ExtMgrDialog* pParent, TheExtensionManager
m_pEnableBtn->SetSizePixel( aSize );
m_pRemoveBtn->SetSizePixel( aSize );
- SetPaintTransparent( true );
- SetPosPixel( Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP ) );
- long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE;
- long nTitleHeight = 2*TOP_OFFSET + GetTextHeight();
- if ( nIconHeight < nTitleHeight )
- m_nStdHeight = nTitleHeight;
- else
- m_nStdHeight = nIconHeight;
- m_nStdHeight += GetTextHeight() + TOP_OFFSET;
-
- nIconHeight = ICON_HEIGHT + 2*TOP_OFFSET + 1;
- if ( m_nStdHeight < nIconHeight )
- m_nStdHeight = nIconHeight;
-
- m_nActiveHeight = m_nStdHeight;
- m_nBtnHeight = aSize.Height() + 2 * TOP_OFFSET;
-
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- if( IsControlBackground() )
- SetBackground( GetControlBackground() );
- else
- SetBackground( rStyleSettings.GetFieldColor() );
-
- m_pLocale = new lang::Locale( Application::GetSettings().GetLocale() );
- m_pCollator = new CollatorWrapper( ::comphelper::getProcessServiceFactory() );
- m_pCollator->loadDefaultCollator( *m_pLocale, i18n::CollatorOptions::CollatorOptions_IGNORE_CASE );
+ SetExtraSize( aSize.Height() + 2 * TOP_OFFSET );
- Show();
+ SetScrollHdl( LINK( this, ExtBoxWithBtns_Impl, ScrollHdl ) );
}
//------------------------------------------------------------------------------
-ExtensionBox_Impl::~ExtensionBox_Impl()
+ExtBoxWithBtns_Impl::~ExtBoxWithBtns_Impl()
{
- typedef std::vector< TEntry_Impl >::iterator ITER;
-
-// for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
-// (*iIndex)->m_xPackage->removeEventListener( this );
-
- m_vEntries.clear();
-
delete m_pOptionsBtn;
delete m_pEnableBtn;
delete m_pRemoveBtn;
- delete m_pScrollBar;
-
- delete m_pLocale;
- delete m_pCollator;
}
//------------------------------------------------------------------------------
-sal_Int32 ExtensionBox_Impl::getItemCount() const
-{
- return static_cast< sal_Int32 >( m_vEntries.size() );
-}
-
//------------------------------------------------------------------------------
-sal_Int32 ExtensionBox_Impl::getSelIndex() const
-{
- if ( m_bHasActive )
- {
- OSL_ASSERT( m_nActive >= -1);
- return static_cast< sal_Int32 >( m_nActive );
- }
- else
- return static_cast< sal_Int32 >( EXTENSION_LISTBOX_ENTRY_NOTFOUND );
-}
-
//------------------------------------------------------------------------------
-void ExtensionBox_Impl::checkIndex( sal_Int32 nIndex ) const
+const Size ExtBoxWithBtns_Impl::GetMinOutputSizePixel() const
{
- if ( nIndex < 0 )
- throw lang::IllegalArgumentException( OUSTR("The list index starts with 0"),0, 0 );
- if ( static_cast< sal_uInt32 >( nIndex ) >= m_vEntries.size())
- throw lang::IllegalArgumentException( OUSTR("There is no element at the provided position."
- "The position exceeds the number of available list entries"),0, 0 );
-}
-
-//------------------------------------------------------------------------------
-OUString ExtensionBox_Impl::getItemName( sal_Int32 nIndex ) const
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- checkIndex( nIndex );
- return m_vEntries[ nIndex ]->m_sTitle;
-}
-
-//------------------------------------------------------------------------------
-OUString ExtensionBox_Impl::getItemVersion( sal_Int32 nIndex ) const
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- checkIndex( nIndex );
- return m_vEntries[ nIndex ]->m_sVersion;
-}
-
-//------------------------------------------------------------------------------
-OUString ExtensionBox_Impl::getItemDescription( sal_Int32 nIndex ) const
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- checkIndex( nIndex );
- return m_vEntries[ nIndex ]->m_sDescription;
-}
-
-//------------------------------------------------------------------------------
-OUString ExtensionBox_Impl::getItemPublisher( sal_Int32 nIndex ) const
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- checkIndex( nIndex );
- return m_vEntries[ nIndex ]->m_sPublisher;
-}
-
-//------------------------------------------------------------------------------
-OUString ExtensionBox_Impl::getItemPublisherLink( sal_Int32 nIndex ) const
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- checkIndex( nIndex );
- return m_vEntries[ nIndex ]->m_sPublisherURL;
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::select( sal_Int32 nIndex )
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- checkIndex( nIndex );
- selectEntry( nIndex );
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::select( const OUString & sName )
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- typedef ::std::vector< TEntry_Impl >::const_iterator It;
-
- for ( It iIter = m_vEntries.begin(); iIter < m_vEntries.end(); iIter++ )
- {
- if ( sName.equals( (*iIter)->m_sTitle ) )
- {
- long nPos = iIter - m_vEntries.begin();
- selectEntry( nPos );
- break;
- }
- }
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-// Title + description + buttons height
-void ExtensionBox_Impl::CalcActiveHeight( const long nPos )
-{
- // get title height
- long aTextHeight;
- long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE;
- long nTitleHeight = 2*TOP_OFFSET + GetTextHeight();
- if ( nIconHeight < nTitleHeight )
- aTextHeight = nTitleHeight;
- else
- aTextHeight = nIconHeight;
-
- // calc description height
- Size aSize = GetOutputSizePixel();
- if ( m_bHasScrollBar )
- aSize.Width() -= m_pScrollBar->GetSizePixel().Width();
-
- aSize.Width() -= ICON_OFFSET;
- aSize.Height() = 10000;
-
- Rectangle aRect = GetTextRect( Rectangle( Point(), aSize ),
- m_vEntries[ nPos ]->m_sDescription,
- TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
- aTextHeight += aRect.GetHeight();
-
- if ( aTextHeight < m_nStdHeight )
- aTextHeight = m_nStdHeight;
-
- m_nActiveHeight = aTextHeight + m_nBtnHeight; // button bar height
-}
-
-//------------------------------------------------------------------------------
-const Size ExtensionBox_Impl::GetMinOutputSizePixel() const
-{
- long nHeight = m_nStdHeight;
+ Size aMinSize( ExtensionBox_Impl::GetMinOutputSizePixel() );
+ long nHeight = aMinSize.Height();
nHeight += m_pOptionsBtn->GetSizePixel().Height();
nHeight += 2 * TOP_OFFSET;
long nWidth = m_pOptionsBtn->GetSizePixel().Width();
nWidth *= 3;
- nWidth += 5*TOP_OFFSET;
- nWidth += m_pScrollBar->GetSizePixel().Width();
+ nWidth += 5*TOP_OFFSET + 20;
return Size( nWidth, nHeight );
}
-//------------------------------------------------------------------------------
-Rectangle ExtensionBox_Impl::GetEntryRect( const long nPos ) const
+// -----------------------------------------------------------------------
+void ExtBoxWithBtns_Impl::RecalcAll()
{
- Size aSize( GetOutputSizePixel() );
+ ExtensionBox_Impl::RecalcAll();
- if ( m_bHasScrollBar )
- aSize.Width() -= m_pScrollBar->GetSizePixel().Width();
+ const sal_Int32 nActive = getSelIndex();
- if ( m_vEntries[ nPos ]->m_bActive )
- aSize.Height() = m_nActiveHeight;
+ if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND )
+ SetButtonPos( GetEntryRect( nActive ) );
else
- aSize.Height() = m_nStdHeight;
-
- Point aPos( 0, -m_nTopIndex + nPos * m_nStdHeight );
- if ( m_bHasActive && ( nPos < m_nActive ) )
- aPos.Y() += m_nActiveHeight - m_nStdHeight;
-
- return Rectangle( aPos, aSize );
+ {
+ m_pOptionsBtn->Hide();
+ m_pEnableBtn->Hide();
+ m_pRemoveBtn->Hide();
+ }
}
+
//------------------------------------------------------------------------------
//This function may be called with nPos < 0
-void ExtensionBox_Impl::selectEntry( long nPos )
+void ExtBoxWithBtns_Impl::selectEntry( const long nPos )
{
- //ToDo whe should not use the guard at such a big scope here.
- //Currently it is used to gard m_vEntries and m_nActive. m_nActive will be
- //modified in this function.
- //It would be probably best to always use a copy of m_vEntries
- //and some other state variables from ExtensionBox_Impl for
- //the whole painting operation. See issue i86993
- ::osl::ClearableMutexGuard guard(m_entriesMutex);
-
- if ( m_bInCheckMode )
+ if ( HasActive() && ( nPos == getSelIndex() ) )
return;
- if ( m_bHasActive )
- {
- if ( nPos == m_nActive )
- return;
-
- m_bHasActive = false;
- m_vEntries[ m_nActive ]->m_bActive = false;
+ ExtensionBox_Impl::selectEntry( nPos );
- if ( IsReallyVisible() )
- Invalidate();
- }
-
- if ( ( nPos >= 0 ) && ( nPos < (long) m_vEntries.size() ) )
+ if ( ( nPos >= 0 ) && ( nPos < GetEntryCount() ) )
{
- m_bHasActive = true;
- m_nActive = nPos;
- m_vEntries[ nPos ]->m_bActive = true;
-
if ( IsReallyVisible() )
{
- Invalidate();
- CalcActiveHeight( nPos );
- SetupScrollBar();
- Rectangle aEntryRect = GetEntryRect( nPos );
-
- // If the top of the selected entry isn't visible, make it visible
- if ( aEntryRect.Top() < 0 )
- {
- m_nTopIndex += aEntryRect.Top();
- aEntryRect.Move( 0, -aEntryRect.Top() );
- }
-
- // If the bottom of the selected entry isn't visible, make it visible even if now the top
- // isn't visible any longer ( the buttons are more important )
- Size aOutputSize = GetOutputSizePixel();
- if ( aEntryRect.Bottom() > aOutputSize.Height() )
- {
- m_nTopIndex += ( aEntryRect.Bottom() - aOutputSize.Height() );
- aEntryRect.Move( 0, -( aEntryRect.Bottom() - aOutputSize.Height() ) );
- }
-
- // If there is unused space below the last entry but all entries don't fit into the box,
- // move the content down to use the whole space
- const long nTotalHeight = GetTotalHeight();
- if ( m_bHasScrollBar && ( aOutputSize.Height() + m_nTopIndex > nTotalHeight ) )
- {
- long nOffset = m_nTopIndex;
- m_nTopIndex = nTotalHeight - aOutputSize.Height();
- nOffset -= m_nTopIndex;
- aEntryRect.Move( 0, nOffset );
- }
-
- if ( m_bHasScrollBar )
- m_pScrollBar->SetThumbPos( m_nTopIndex );
-
- SetButtonPos( aEntryRect );
+ SetButtonPos( GetEntryRect( nPos ) );
}
- SetButtonStatus( m_vEntries[ nPos ] ); //dv
+ SetButtonStatus( GetEntryData( nPos) );
}
else
{
@@ -722,12 +277,10 @@ void ExtensionBox_Impl::selectEntry( long nPos )
m_pEnableBtn->Hide();
m_pRemoveBtn->Hide();
}
- guard.clear();
-
}
// -----------------------------------------------------------------------
-void ExtensionBox_Impl::SetButtonPos( const Rectangle& rRect )
+void ExtBoxWithBtns_Impl::SetButtonPos( const Rectangle& rRect )
{
Size aBtnSize( m_pOptionsBtn->GetSizePixel() );
Point aBtnPos( rRect.Left() + ICON_OFFSET,
@@ -741,20 +294,20 @@ void ExtensionBox_Impl::SetButtonPos( const Rectangle& rRect )
}
// -----------------------------------------------------------------------
-void ExtensionBox_Impl::SetButtonStatus( const TEntry_Impl pEntry )
+void ExtBoxWithBtns_Impl::SetButtonStatus( const TEntry_Impl pEntry )
{
if ( ( pEntry->m_eState == REGISTERED ) || ( pEntry->m_eState == NOT_AVAILABLE ) )
{
- m_pEnableBtn->SetText( ExtMgrDialog::getResourceString( RID_CTX_ITEM_DISABLE ) );
+ m_pEnableBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) );
m_pEnableBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_DISABLE );
}
else
{
- m_pEnableBtn->SetText( ExtMgrDialog::getResourceString( RID_CTX_ITEM_ENABLE ) );
+ m_pEnableBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) );
m_pEnableBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_ENABLE );
}
- if ( pEntry->m_eState == NOT_AVAILABLE )
+ if ( ( pEntry->m_eState == NOT_AVAILABLE ) || pEntry->m_bMissingDeps )
m_pEnableBtn->Hide();
else
{
@@ -775,183 +328,23 @@ void ExtensionBox_Impl::SetButtonStatus( const TEntry_Impl pEntry )
}
// -----------------------------------------------------------------------
-void ExtensionBox_Impl::DrawRow( const Rectangle& rRect, const TEntry_Impl pEntry )
+bool ExtBoxWithBtns_Impl::HandleTabKey( bool bReverse )
{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-
- if ( pEntry->m_bActive )
- SetTextColor( rStyleSettings.GetHighlightTextColor() );
- else if ( ( pEntry->m_eState != REGISTERED ) && ( pEntry->m_eState != NOT_AVAILABLE ) )
- SetTextColor( rStyleSettings.GetDisableColor() );
- else if ( IsControlForeground() )
- SetTextColor( GetControlForeground() );
- else
- SetTextColor( rStyleSettings.GetFieldTextColor() );
-
- if ( pEntry->m_bActive )
- {
- SetLineColor();
- SetFillColor( rStyleSettings.GetHighlightColor() );
- DrawRect( rRect );
- }
- else
- {
- if( IsControlBackground() )
- SetBackground( GetControlBackground() );
- else
- SetBackground( rStyleSettings.GetFieldColor() );
-
- SetTextFillColor();
- Erase( rRect );
- }
-
- // Draw extension icon
- Point aPos( rRect.TopLeft() );
- aPos += Point( TOP_OFFSET, TOP_OFFSET );
- Image aImage;
- if ( ! pEntry->m_aIcon )
- aImage = isHCMode() ? m_aDefaultImageHC : m_aDefaultImage;
- else
- aImage = isHCMode() ? pEntry->m_aIconHC : pEntry->m_aIcon;
- Size aImageSize = aImage.GetSizePixel();
- if ( ( aImageSize.Width() <= ICON_HEIGHT ) && ( aImageSize.Height() <= ICON_HEIGHT ) )
- DrawImage( Point( aPos.X()+((ICON_HEIGHT-aImageSize.Width())/2), aPos.Y()+((ICON_HEIGHT-aImageSize.Height())/2) ), aImage );
- else
- DrawImage( aPos, Size( ICON_HEIGHT, ICON_HEIGHT ), aImage );
-
- // Setup fonts
- Font aStdFont( GetFont() );
- Font aBoldFont( aStdFont );
- aBoldFont.SetWeight( WEIGHT_BOLD );
- SetFont( aBoldFont );
- long aTextHeight = GetTextHeight();
-
- // Init publisher link here
- if ( !pEntry->m_pPublisher && pEntry->m_sPublisher.Len() )
- {
- pEntry->m_pPublisher = new svt::FixedHyperlink( this );
- pEntry->m_pPublisher->SetBackground();
- pEntry->m_pPublisher->SetPaintTransparent( true );
- pEntry->m_pPublisher->SetURL( pEntry->m_sPublisherURL );
- pEntry->m_pPublisher->SetDescription( pEntry->m_sPublisher );
- Size aSize = FixedText::CalcMinimumTextSize( pEntry->m_pPublisher );
- pEntry->m_pPublisher->SetSizePixel( aSize );
- pEntry->m_pPublisher->SetClickHdl( LINK( this, ExtensionBox_Impl, HandleHyperlink ) );
- }
-
- // Get max title width
- long nMaxTitleWidth = rRect.GetWidth() - ICON_OFFSET;
- nMaxTitleWidth -= ( 2 * SMALL_ICON_SIZE ) + ( 4 * SPACE_BETWEEN );
- if ( pEntry->m_pPublisher )
- {
- nMaxTitleWidth -= pEntry->m_pPublisher->GetSizePixel().Width() + (2*SPACE_BETWEEN);
- }
-
- long aVersionWidth = GetTextWidth( pEntry->m_sVersion );
- long aTitleWidth = GetTextWidth( pEntry->m_sTitle ) + (aTextHeight / 3);
-
- aPos = rRect.TopLeft() + Point( ICON_OFFSET, TOP_OFFSET );
-
- if ( aTitleWidth > nMaxTitleWidth - aVersionWidth )
- {
- aTitleWidth = nMaxTitleWidth - aVersionWidth - (aTextHeight / 3);
- String aShortTitle = GetEllipsisString( pEntry->m_sTitle, aTitleWidth );
- DrawText( aPos, aShortTitle );
- aTitleWidth += (aTextHeight / 3);
- }
- else
- DrawText( aPos, pEntry->m_sTitle );
-
- SetFont( aStdFont );
- DrawText( Point( aPos.X() + aTitleWidth, aPos.Y() ), pEntry->m_sVersion );
-
- long nIconHeight = TOP_OFFSET + SMALL_ICON_SIZE;
- long nTitleHeight = TOP_OFFSET + GetTextHeight();
- if ( nIconHeight < nTitleHeight )
- aTextHeight = nTitleHeight;
- else
- aTextHeight = nIconHeight;
-
- // draw description
- String sDescription;
- if ( pEntry->m_sErrorText.Len() )
- {
- if ( pEntry->m_bActive )
- sDescription = pEntry->m_sErrorText + OUSTR("\n") + pEntry->m_sDescription;
- else
- sDescription = pEntry->m_sErrorText;
- }
- else
- sDescription = pEntry->m_sDescription;
-
- aPos.Y() += aTextHeight;
- if ( pEntry->m_bActive )
- {
- DrawText( Rectangle( aPos.X(), aPos.Y(), rRect.Right(), rRect.Bottom() - m_nBtnHeight ),
- sDescription, TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
- }
- else
- {
- const long nWidth = GetTextWidth( sDescription );
- if ( nWidth > rRect.GetWidth() - aPos.X() )
- sDescription = GetEllipsisString( sDescription, rRect.GetWidth() - aPos.X() );
- DrawText( aPos, sDescription );
- }
-
- // Draw publisher link
- if ( pEntry->m_pPublisher )
- {
- pEntry->m_pPublisher->Show();
- aPos = rRect.TopLeft() + Point( ICON_OFFSET + nMaxTitleWidth + (2*SPACE_BETWEEN), TOP_OFFSET );
- pEntry->m_pPublisher->SetPosPixel( aPos );
- }
+ sal_Int32 nIndex = getSelIndex();
- // Draw status icons
- if ( pEntry->m_bShared )
- {
- aPos = rRect.TopRight() + Point( -(RIGHT_ICON_OFFSET + SMALL_ICON_SIZE), TOP_OFFSET );
- DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aLockedImageHC : m_aLockedImage );
- }
- if ( pEntry->m_eState == AMBIGUOUS )
- {
- aPos = rRect.TopRight() + Point( -(RIGHT_ICON_OFFSET + SPACE_BETWEEN + 2*SMALL_ICON_SIZE), TOP_OFFSET );
- DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aWarningImageHC : m_aWarningImage );
- }
-
- SetLineColor( Color( COL_LIGHTGRAY ) );
- DrawLine( rRect.BottomLeft(), rRect.BottomRight() );
-}
-
-// -----------------------------------------------------------------------
-void ExtensionBox_Impl::RecalcAll()
-{
- if ( m_bHasActive )
- CalcActiveHeight( m_nActive );
-
- SetupScrollBar();
-
- if ( m_bHasActive )
- SetButtonPos( GetEntryRect( m_nActive ) );
-
- m_bNeedsRecalc = false;
-}
-
-// -----------------------------------------------------------------------
-bool ExtensionBox_Impl::HandleTabKey( bool bReverse )
-{
- if ( ! m_bHasActive )
+ if ( nIndex == EXTENSION_LISTBOX_ENTRY_NOTFOUND )
return false;
PushButton *pNext = NULL;
if ( m_pOptionsBtn->HasFocus() ) {
- if ( !bReverse && !m_vEntries[ m_nActive ]->m_bLocked )
+ if ( !bReverse && !GetEntryData( nIndex )->m_bLocked )
pNext = m_pEnableBtn;
}
else if ( m_pEnableBtn->HasFocus() ) {
if ( !bReverse )
pNext = m_pRemoveBtn;
- else if ( m_vEntries[ m_nActive ]->m_bHasOptions )
+ else if ( GetEntryData( nIndex )->m_bHasOptions )
pNext = m_pOptionsBtn;
}
else if ( m_pRemoveBtn->HasFocus() ) {
@@ -960,14 +353,14 @@ bool ExtensionBox_Impl::HandleTabKey( bool bReverse )
}
else {
if ( !bReverse ) {
- if ( m_vEntries[ m_nActive ]->m_bHasOptions )
+ if ( GetEntryData( nIndex )->m_bHasOptions )
pNext = m_pOptionsBtn;
- else if ( ! m_vEntries[ m_nActive ]->m_bLocked )
+ else if ( ! GetEntryData( nIndex )->m_bLocked )
pNext = m_pEnableBtn;
} else {
- if ( ! m_vEntries[ m_nActive ]->m_bLocked )
+ if ( ! GetEntryData( nIndex )->m_bLocked )
pNext = m_pRemoveBtn;
- else if ( m_vEntries[ m_nActive ]->m_bHasOptions )
+ else if ( GetEntryData( nIndex )->m_bHasOptions )
pNext = m_pOptionsBtn;
}
}
@@ -982,194 +375,67 @@ bool ExtensionBox_Impl::HandleTabKey( bool bReverse )
}
// -----------------------------------------------------------------------
-bool ExtensionBox_Impl::HandleCursorKey( USHORT nKeyCode )
-{
- if ( m_vEntries.empty() )
- return true;
-
- long nSelect = 0;
-
- if ( m_bHasActive )
- {
- long nPageSize = GetOutputSizePixel().Height() / m_nStdHeight;
- if ( nPageSize < 2 )
- nPageSize = 2;
-
- if ( ( nKeyCode == KEY_DOWN ) || ( nKeyCode == KEY_RIGHT ) )
- nSelect = m_nActive + 1;
- else if ( ( nKeyCode == KEY_UP ) || ( nKeyCode == KEY_LEFT ) )
- nSelect = m_nActive - 1;
- else if ( nKeyCode == KEY_HOME )
- nSelect = 0;
- else if ( nKeyCode == KEY_END )
- nSelect = m_vEntries.size() - 1;
- else if ( nKeyCode == KEY_PAGEUP )
- nSelect = m_nActive - nPageSize + 1;
- else if ( nKeyCode == KEY_PAGEDOWN )
- nSelect = m_nActive + nPageSize - 1;
- }
- else // when there is no selected entry, we will select the first or the last.
- {
- if ( ( nKeyCode == KEY_DOWN ) || ( nKeyCode == KEY_PAGEDOWN ) || ( nKeyCode == KEY_HOME ) )
- nSelect = 0;
- else if ( ( nKeyCode == KEY_UP ) || ( nKeyCode == KEY_PAGEUP ) || ( nKeyCode == KEY_END ) )
- nSelect = m_vEntries.size() - 1;
- }
-
- if ( nSelect < 0 )
- nSelect = 0;
- if ( nSelect >= (long) m_vEntries.size() )
- nSelect = m_vEntries.size() - 1;
-
- selectEntry( nSelect );
-
- return true;
-}
-
-// -----------------------------------------------------------------------
-MENU_COMMAND ExtensionBox_Impl::ShowPopupMenu( const Point & rPos, const long nPos )
+MENU_COMMAND ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const long nPos )
{
- if ( nPos >= (long) m_vEntries.size() )
+ if ( nPos >= (long) getItemCount() )
return CMD_NONE;
PopupMenu aPopup;
- aPopup.InsertItem( CMD_UPDATE, ExtMgrDialog::getResourceString( RID_CTX_ITEM_CHECK_UPDATE ) );
+ aPopup.InsertItem( CMD_UPDATE, DialogHelper::getResourceString( RID_CTX_ITEM_CHECK_UPDATE ) );
- if ( ! m_vEntries[ nPos ]->m_bLocked )
+ if ( ! GetEntryData( nPos )->m_bLocked )
{
- if ( m_vEntries[ nPos ]->m_eState == REGISTERED )
- aPopup.InsertItem( CMD_DISABLE, ExtMgrDialog::getResourceString( RID_CTX_ITEM_DISABLE ) );
- else if ( m_vEntries[ nPos ]->m_eState != NOT_AVAILABLE )
- aPopup.InsertItem( CMD_ENABLE, ExtMgrDialog::getResourceString( RID_CTX_ITEM_ENABLE ) );
+ if ( GetEntryData( nPos )->m_eState == REGISTERED )
+ aPopup.InsertItem( CMD_DISABLE, DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) );
+ else if ( GetEntryData( nPos )->m_eState != NOT_AVAILABLE )
+ aPopup.InsertItem( CMD_ENABLE, DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) );
- aPopup.InsertItem( CMD_REMOVE, ExtMgrDialog::getResourceString( RID_CTX_ITEM_REMOVE ) );
+ aPopup.InsertItem( CMD_REMOVE, DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) );
}
return (MENU_COMMAND) aPopup.Execute( this, rPos );
}
-// -----------------------------------------------------------------------
-void ExtensionBox_Impl::Paint( const Rectangle &/*rPaintRect*/ )
-{
- if ( m_bNeedsRecalc )
- RecalcAll();
-
- Point aStart( 0, -m_nTopIndex );
- Size aSize( GetOutputSizePixel() );
-
- if ( m_bHasScrollBar )
- aSize.Width() -= m_pScrollBar->GetSizePixel().Width();
-
- typedef std::vector< TEntry_Impl >::iterator ITER;
- for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
- {
- aSize.Height() = (*iIndex)->m_bActive ? m_nActiveHeight : m_nStdHeight;
- Rectangle aEntryRect( aStart, aSize );
-// if ( aEntryRect.IsOver( rPaintRect ) )
- DrawRow( aEntryRect, *iIndex );
- aStart.Y() += aSize.Height();
- }
-}
-
-// -----------------------------------------------------------------------
-long ExtensionBox_Impl::GetTotalHeight() const
-{
- long nHeight = m_vEntries.size() * m_nStdHeight;
-
- if ( m_bHasActive )
- {
- nHeight += m_nActiveHeight - m_nStdHeight;
- }
-
- return nHeight;
-}
-
-// -----------------------------------------------------------------------
-void ExtensionBox_Impl::SetupScrollBar()
-{
- const Size aSize = GetOutputSizePixel();
- const long nScrBarSize = GetSettings().GetStyleSettings().GetScrollBarSize();
- const long nTotalHeight = GetTotalHeight();
- const bool bNeedsScrollBar = ( nTotalHeight > aSize.Height() );
-
- if ( bNeedsScrollBar )
- {
- if ( m_nTopIndex + aSize.Height() > nTotalHeight )
- m_nTopIndex = nTotalHeight - aSize.Height();
-
- m_pScrollBar->SetPosSizePixel( Point( aSize.Width() - nScrBarSize, 0 ),
- Size( nScrBarSize, aSize.Height() ) );
- m_pScrollBar->SetRangeMax( nTotalHeight );
- m_pScrollBar->SetVisibleSize( aSize.Height() );
- m_pScrollBar->SetPageSize( ( aSize.Height() * 4 ) / 5 );
- m_pScrollBar->SetLineSize( m_nStdHeight );
- m_pScrollBar->SetThumbPos( m_nTopIndex );
-
- if ( !m_bHasScrollBar )
- m_pScrollBar->Show();
- }
- else if ( m_bHasScrollBar )
- {
- m_pScrollBar->Hide();
- m_nTopIndex = 0;
- }
-
- m_bHasScrollBar = bNeedsScrollBar;
-}
-
-// -----------------------------------------------------------------------
-void ExtensionBox_Impl::Resize()
-{
- RecalcAll();
-}
-
//------------------------------------------------------------------------------
-void ExtensionBox_Impl::MouseButtonDown( const MouseEvent& rMEvt )
+void ExtBoxWithBtns_Impl::MouseButtonDown( const MouseEvent& rMEvt )
{
if ( m_bInterfaceLocked )
return;
const Point aMousePos( rMEvt.GetPosPixel() );
- long nPos = ( aMousePos.Y() + m_nTopIndex ) / m_nStdHeight;
- if ( m_bHasActive && ( nPos > m_nActive ) )
- {
- if ( aMousePos.Y() + m_nTopIndex <= m_nActive*m_nStdHeight + m_nActiveHeight )
- nPos = m_nActive;
- else
- nPos = ( aMousePos.Y() + m_nTopIndex - (m_nActiveHeight - m_nStdHeight) ) / m_nStdHeight;
- }
+ const long nPos = PointToPos( aMousePos );
if ( rMEvt.IsRight() )
{
switch( ShowPopupMenu( aMousePos, nPos ) )
{
case CMD_NONE: break;
- case CMD_ENABLE: m_pParent->enablePackage( m_vEntries[ nPos ]->m_xPackageManager,
- m_vEntries[ nPos ]->m_xPackage, true );
+ case CMD_ENABLE: m_pParent->enablePackage( GetEntryData( nPos )->m_xPackageManager,
+ GetEntryData( nPos )->m_xPackage, true );
break;
- case CMD_DISABLE: m_pParent->enablePackage( m_vEntries[ nPos ]->m_xPackageManager,
- m_vEntries[ nPos ]->m_xPackage, false );
+ case CMD_DISABLE: m_pParent->enablePackage( GetEntryData( nPos )->m_xPackageManager,
+ GetEntryData( nPos )->m_xPackage, false );
break;
- case CMD_UPDATE: m_pParent->updatePackage( m_vEntries[ nPos ]->m_xPackageManager,
- m_vEntries[ nPos ]->m_xPackage );
+ case CMD_UPDATE: m_pParent->updatePackage( GetEntryData( nPos )->m_xPackageManager,
+ GetEntryData( nPos )->m_xPackage );
break;
- case CMD_REMOVE: m_pParent->removePackage( m_vEntries[ nPos ]->m_xPackageManager,
- m_vEntries[ nPos ]->m_xPackage );
+ case CMD_REMOVE: m_pParent->removePackage( GetEntryData( nPos )->m_xPackageManager,
+ GetEntryData( nPos )->m_xPackage );
break;
}
}
else if ( rMEvt.IsLeft() )
{
- if ( rMEvt.IsMod1() && m_bHasActive )
- selectEntry( m_vEntries.size() ); // Selecting an not existing entry will deselect the current one
+ if ( rMEvt.IsMod1() && HasActive() )
+ selectEntry( EXTENSION_LISTBOX_ENTRY_NOTFOUND ); // Selecting an not existing entry will deselect the current one
else
selectEntry( nPos );
}
}
//------------------------------------------------------------------------------
-long ExtensionBox_Impl::Notify( NotifyEvent& rNEvt )
+long ExtBoxWithBtns_Impl::Notify( NotifyEvent& rNEvt )
{
bool bHandled = false;
@@ -1181,364 +447,259 @@ long ExtensionBox_Impl::Notify( NotifyEvent& rNEvt )
if ( nKeyCode == KEY_TAB )
bHandled = HandleTabKey( aKeyCode.IsShift() );
- else if ( aKeyCode.GetGroup() == KEYGROUP_CURSOR )
- bHandled = HandleCursorKey( nKeyCode );
- }
-
- if ( rNEvt.GetType() == EVENT_COMMAND )
- {
- if ( m_bHasScrollBar &&
- ( rNEvt.GetCommandEvent()->GetCommand() == COMMAND_WHEEL ) )
- {
- const CommandWheelData* pData = rNEvt.GetCommandEvent()->GetWheelData();
- if ( pData->GetMode() == COMMAND_WHEEL_SCROLL )
- {
- long nThumbPos = m_pScrollBar->GetThumbPos();
- if ( pData->GetDelta() < 0 )
- m_pScrollBar->DoScroll( nThumbPos + m_nStdHeight );
- else
- m_pScrollBar->DoScroll( nThumbPos - m_nStdHeight );
- bHandled = true;
- }
- }
}
if ( !bHandled )
- return Control::Notify( rNEvt );
+ return ExtensionBox_Impl::Notify( rNEvt );
else
return true;
}
//------------------------------------------------------------------------------
-bool ExtensionBox_Impl::FindEntryPos( const TEntry_Impl pEntry, const long nStart,
- const long nEnd, long &nPos )
+void ExtBoxWithBtns_Impl::enableButtons( bool bEnable )
{
- nPos = nStart;
- if ( nStart > nEnd )
- return false;
-
- StringCompare eCompare;
+ m_bInterfaceLocked = ! bEnable;
- if ( nStart == nEnd )
+ if ( bEnable )
{
- eCompare = pEntry->CompareTo( m_pCollator, m_vEntries[ nStart ] );
- if ( eCompare == COMPARE_LESS )
- return false;
- else if ( eCompare == COMPARE_EQUAL )
- {
- //Workaround. See i86963.
- if (pEntry->m_xPackage != m_vEntries[nStart]->m_xPackage)
- return false;
-
- if ( m_bInCheckMode )
- m_vEntries[ nStart ]->m_bChecked = true;
- return true;
- }
- else
- {
- nPos = nStart + 1;
- return false;
- }
+ sal_Int32 nIndex = getSelIndex();
+ if ( nIndex != EXTENSION_LISTBOX_ENTRY_NOTFOUND )
+ SetButtonStatus( GetEntryData( nIndex ) );
}
-
- const long nMid = nStart + ( ( nEnd - nStart ) / 2 );
- eCompare = pEntry->CompareTo( m_pCollator, m_vEntries[ nMid ] );
-
- if ( eCompare == COMPARE_LESS )
- return FindEntryPos( pEntry, nStart, nMid-1, nPos );
- else if ( eCompare == COMPARE_GREATER )
- return FindEntryPos( pEntry, nMid+1, nEnd, nPos );
else
{
- //Workaround.See i86963.
- if (pEntry->m_xPackage != m_vEntries[nMid]->m_xPackage)
- return false;
-
- if ( m_bInCheckMode )
- m_vEntries[ nMid ]->m_bChecked = true;
- nPos = nMid;
- return true;
+ m_pOptionsBtn->Enable( false );
+ m_pRemoveBtn->Enable( false );
+ m_pEnableBtn->Enable( false );
}
}
-//------------------------------------------------------------------------------
-long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > &xPackage,
- const uno::Reference< deployment::XPackageManager > &xPackageManager )
+// -----------------------------------------------------------------------
+IMPL_LINK( ExtBoxWithBtns_Impl, ScrollHdl, ScrollBar*, pScrBar )
{
- long nPos = 0;
- PackageState eState = m_pManager->getPackageState( xPackage );
-
- TEntry_Impl pEntry( new Entry_Impl( xPackage, xPackageManager, eState ) );
- xPackage->addEventListener( this );
-
- ::osl::ClearableMutexGuard guard(m_entriesMutex);
- if ( m_vEntries.empty() )
- {
- pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage );
- pEntry->m_bShared = ( m_pManager->getSharedPkgMgr() == xPackageManager );
- pEntry->m_bNew = m_bInCheckMode;
- m_vEntries.push_back( pEntry );
- }
- else
- {
- if ( !FindEntryPos( pEntry, 0, m_vEntries.size()-1, nPos ) )
- {
- pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage );
- pEntry->m_bShared = ( m_pManager->getSharedPkgMgr() == xPackageManager );
- pEntry->m_bNew = m_bInCheckMode;
- m_vEntries.insert( m_vEntries.begin()+nPos, pEntry );
- }
- else if ( !m_bInCheckMode )
- {
- OSL_ENSURE( 0, "ExtensionBox_Impl::addEntry(): Will not add duplicate entries" );
- }
- }
- //access to m_nActive must be guarded
- if ( !m_bInCheckMode && m_bHasActive && ( m_nActive >= nPos ) )
- m_nActive += 1;
+ long nDelta = pScrBar->GetDelta();
- guard.clear();
+ Point aNewOptPt( m_pOptionsBtn->GetPosPixel() - Point( 0, nDelta ) );
+ Point aNewRemPt( m_pRemoveBtn->GetPosPixel() - Point( 0, nDelta ) );
+ Point aNewEnPt( m_pEnableBtn->GetPosPixel() - Point( 0, nDelta ) );
- if ( IsReallyVisible() )
- Invalidate();
+ DoScroll( nDelta );
- m_bNeedsRecalc = true;
+ m_pOptionsBtn->SetPosPixel( aNewOptPt );
+ m_pRemoveBtn->SetPosPixel( aNewRemPt );
+ m_pEnableBtn->SetPosPixel( aNewEnPt );
- return nPos;
+ return 1;
}
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::updateEntry( const uno::Reference< deployment::XPackage > &xPackage )
+// -----------------------------------------------------------------------
+IMPL_LINK( ExtBoxWithBtns_Impl, HandleOptionsBtn, void*, EMPTYARG )
{
- typedef std::vector< TEntry_Impl >::iterator ITER;
- for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ const sal_Int32 nActive = getSelIndex();
+
+ if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND )
{
- if ( (*iIndex)->m_xPackage == xPackage )
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+
+ if ( pFact )
{
- PackageState eState = m_pManager->getPackageState( xPackage );
- (*iIndex)->m_bHasOptions = m_pManager->supportsOptions( xPackage );
- (*iIndex)->m_eState = eState;
- (*iIndex)->m_sTitle = xPackage->getDisplayName();
- (*iIndex)->m_sVersion = xPackage->getVersion();
- (*iIndex)->m_sDescription = xPackage->getDescription();
-
- if ( eState == AMBIGUOUS )
- (*iIndex)->m_sErrorText = ExtMgrDialog::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS );
- else
- (*iIndex)->m_sErrorText = String();
+ OUString sExtensionId = GetEntryData( nActive )->m_xPackage->getIdentifier().Value;
+ VclAbstractDialog* pDlg = pFact->CreateOptionsDialog( this, sExtensionId, rtl::OUString() );
- if ( IsReallyVisible() )
- Invalidate();
- break;
+ pDlg->Execute();
+
+ delete pDlg;
}
}
+
+ return 1;
}
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::prepareChecking( const uno::Reference< deployment::XPackageManager > &xPackageMgr )
+// -----------------------------------------------------------------------
+IMPL_LINK( ExtBoxWithBtns_Impl, HandleEnableBtn, void*, EMPTYARG )
{
- m_bInCheckMode = true;
- typedef std::vector< TEntry_Impl >::iterator ITER;
- for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ const sal_Int32 nActive = getSelIndex();
+
+ if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND )
{
- if ( (*iIndex)->m_xPackageManager == xPackageMgr )
- (*iIndex)->m_bChecked = false;
- else
- (*iIndex)->m_bChecked = true;
- (*iIndex)->m_bNew = false;
+ TEntry_Impl pEntry = GetEntryData( nActive );
+ const bool bEnable( pEntry->m_eState != REGISTERED );
+
+ m_pParent->enablePackage( pEntry->m_xPackageManager,
+ pEntry->m_xPackage,
+ bEnable );
}
+
+ return 1;
}
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::checkEntries()
+// -----------------------------------------------------------------------
+IMPL_LINK( ExtBoxWithBtns_Impl, HandleRemoveBtn, void*, EMPTYARG )
{
- long nNewPos = -1;
- long nPos = 0;
- bool bNeedsUpdate = false;
+ const sal_Int32 nActive = getSelIndex();
- ::osl::ClearableMutexGuard guard(m_entriesMutex);
- typedef std::vector< TEntry_Impl >::iterator ITER;
- ITER iIndex = m_vEntries.begin();
- while ( iIndex < m_vEntries.end() )
+ if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND )
{
- if ( (*iIndex)->m_bChecked == false )
- {
- bNeedsUpdate = true;
- nPos = iIndex-m_vEntries.begin();
- if ( (*iIndex)->m_bNew )
- {
- if ( nNewPos == - 1)
- nNewPos = nPos;
- if ( nPos <= m_nActive )
- m_nActive += 1;
- }
- }
- iIndex++;
+ TEntry_Impl pEntry = GetEntryData( nActive );
+ m_pParent->removePackage( pEntry->m_xPackageManager,
+ pEntry->m_xPackage );
}
- guard.clear();
-
- m_bInCheckMode = false;
- if ( nNewPos != - 1)
- selectEntry( nNewPos );
+ return 1;
+}
- if ( bNeedsUpdate )
- {
- m_bNeedsRecalc = true;
- if ( IsReallyVisible() )
- Invalidate();
- }
+//------------------------------------------------------------------------------
+// DialogHelper
+//------------------------------------------------------------------------------
+DialogHelper::DialogHelper( const uno::Reference< uno::XComponentContext > &xContext,
+ Dialog *pWindow ) :
+ m_pVCLWindow( pWindow ),
+ m_nEventID( 0 ),
+ m_bIsBusy( false )
+{
+ m_xContext = xContext;
}
+
//------------------------------------------------------------------------------
-bool ExtensionBox_Impl::isHCMode()
+DialogHelper::~DialogHelper()
{
- return (bool)GetDisplayBackground().GetColor().IsDark();
+ if ( m_nEventID )
+ Application::RemoveUserEvent( m_nEventID );
}
//------------------------------------------------------------------------------
-void ExtensionBox_Impl::enableButtons( bool bEnable )
+ResId DialogHelper::getResId( USHORT nId )
{
- m_bInterfaceLocked = ! bEnable;
+ const ::vos::OGuard guard( Application::GetSolarMutex() );
+ return ResId( nId, *DeploymentGuiResMgr::get() );
+}
- if ( bEnable )
- {
- if ( m_bHasActive )
- SetButtonStatus( m_vEntries[ m_nActive ] );
- }
- else
- {
- m_pOptionsBtn->Enable( false );
- m_pRemoveBtn->Enable( false );
- m_pEnableBtn->Enable( false );
+//------------------------------------------------------------------------------
+String DialogHelper::getResourceString( USHORT id )
+{
+ // init with non-acquired solar mutex:
+ BrandName::get();
+ const ::vos::OGuard guard( Application::GetSolarMutex() );
+ String ret( ResId( id, *DeploymentGuiResMgr::get() ) );
+ if (ret.SearchAscii( "%PRODUCTNAME" ) != STRING_NOTFOUND) {
+ ret.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() );
}
+ return ret;
}
//------------------------------------------------------------------------------
-// XEventListener
-void ExtensionBox_Impl::disposing( lang::EventObject const & rEvt )
- throw ( uno::RuntimeException )
+bool DialogHelper::IsSharedPkgMgr( const uno::Reference< deployment::XPackageManager > &xPackageManager )
{
- uno::Reference< deployment::XPackage > xPackage( rEvt.Source, uno::UNO_QUERY );
+ if ( xPackageManager->getContext().equals( OUSTR("shared") ) )
+ return true;
+ else
+ return false;
+}
- if ( xPackage.is() )
+//------------------------------------------------------------------------------
+bool DialogHelper::continueOnSharedExtension( const uno::Reference< deployment::XPackageManager > &xPackageManager,
+ Window *pParent,
+ const USHORT nResID,
+ bool &bHadWarning )
+{
+ if ( !bHadWarning && IsSharedPkgMgr( xPackageManager ) )
{
- ::osl::ClearableMutexGuard aGuard( m_entriesMutex );
- typedef std::vector< TEntry_Impl >::iterator ITER;
+ const ::vos::OGuard guard( Application::GetSolarMutex() );
+ WarningBox aInfoBox( pParent, getResId( nResID ) );
+ String aMsgText = aInfoBox.GetMessText();
+ aMsgText.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() );
+ aInfoBox.SetMessText( aMsgText );
- for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
- {
- if ( (*iIndex)->m_xPackage == xPackage )
- {
- long nPos = iIndex - m_vEntries.begin();
-
- m_vEntries.erase( iIndex );
-
- if ( IsReallyVisible() )
- Invalidate();
-
- if ( m_bHasActive )
- {
- if ( nPos < m_nActive )
- m_nActive -= 1;
- else if ( ( nPos == m_nActive ) &&
- ( nPos == (long) m_vEntries.size() ) )
- m_nActive -= 1;
-
- m_bHasActive = false;
- //clear before calling out of this method
- aGuard.clear();
- selectEntry( m_nActive );
- }
- break;
- }
- }
+ bHadWarning = true;
+
+ if ( RET_OK == aInfoBox.Execute() )
+ return true;
+ else
+ return false;
}
+ else
+ return true;
}
-// -----------------------------------------------------------------------
-IMPL_LINK( ExtensionBox_Impl, ScrollHdl, ScrollBar*, pScrBar )
+//------------------------------------------------------------------------------
+void DialogHelper::openWebBrowser( const OUString & sURL, const OUString &sTitle ) const
{
- long nDelta = pScrBar->GetDelta();
+ if ( ! sURL.getLength() ) // Nothing to do, when the URL is empty
+ return;
- m_nTopIndex += nDelta;
- Point aNewOptPt( m_pOptionsBtn->GetPosPixel() - Point( 0, nDelta ) );
- Point aNewRemPt( m_pRemoveBtn->GetPosPixel() - Point( 0, nDelta ) );
- Point aNewEnPt( m_pEnableBtn->GetPosPixel() - Point( 0, nDelta ) );
- Point aNewSBPt( m_pScrollBar->GetPosPixel() );
+ try
+ {
+ uno::Reference< XSystemShellExecute > xSystemShellExecute(
+ m_xContext->getServiceManager()->createInstanceWithContext( OUSTR( "com.sun.star.system.SystemShellExecute" ), m_xContext), uno::UNO_QUERY_THROW);
+ //throws css::lang::IllegalArgumentException, css::system::SystemShellExecuteException
+ xSystemShellExecute->execute( sURL, OUString(), SystemShellExecuteFlags::DEFAULTS );
+ }
+ catch ( uno::Exception& )
+ {
+ uno::Any exc( ::cppu::getCaughtException() );
+ OUString msg( ::comphelper::anyToString( exc ) );
+ const ::vos::OGuard guard( Application::GetSolarMutex() );
+ ErrorBox aErrorBox( NULL, WB_OK, msg );
+ aErrorBox.SetText( sTitle );
+ aErrorBox.Execute();
+ }
+}
- Rectangle aScrRect( Point(), GetOutputSizePixel() );
- aScrRect.Right() -= pScrBar->GetSizePixel().Width();
- Scroll( 0, -nDelta, aScrRect );
+//------------------------------------------------------------------------------
+bool DialogHelper::installExtensionWarn( const OUString &rExtensionName ) const
+{
+ const ::vos::OGuard guard( Application::GetSolarMutex() );
+ WarningBox aInfo( m_pVCLWindow, getResId( RID_WARNINGBOX_INSTALL_EXTENSION ) );
- m_pOptionsBtn->SetPosPixel( aNewOptPt );
- m_pRemoveBtn->SetPosPixel( aNewRemPt );
- m_pEnableBtn->SetPosPixel( aNewEnPt );
- m_pScrollBar->SetPosPixel( aNewSBPt );
+ String sText( aInfo.GetMessText() );
+ sText.SearchAndReplaceAllAscii( "%NAME", rExtensionName );
+ aInfo.SetMessText( sText );
- return 1;
+ return ( RET_OK == aInfo.Execute() );
}
-// -----------------------------------------------------------------------
-IMPL_LINK( ExtensionBox_Impl, HandleOptionsBtn, void*, EMPTYARG )
+//------------------------------------------------------------------------------
+bool DialogHelper::installForAllUsers( bool &bInstallForAll ) const
{
- if ( m_bHasActive )
- {
- SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
-
- if ( pFact )
- {
- OUString sExtensionId = m_vEntries[ m_nActive ]->m_xPackage->getIdentifier().Value;
- VclAbstractDialog* pDlg = pFact->CreateOptionsDialog( this, sExtensionId, rtl::OUString() );
+ const ::vos::OGuard guard( Application::GetSolarMutex() );
+ QueryBox aQuery( m_pVCLWindow, getResId( RID_QUERYBOX_INSTALL_FOR_ALL ) );
- pDlg->Execute();
+ String sMsgText = aQuery.GetMessText();
+ sMsgText.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() );
+ aQuery.SetMessText( sMsgText );
- delete pDlg;
- }
- }
+ USHORT nYesBtnID = aQuery.GetButtonId( 0 );
+ USHORT nNoBtnID = aQuery.GetButtonId( 1 );
- return 1;
-}
+ if ( nYesBtnID != BUTTONDIALOG_BUTTON_NOTFOUND )
+ aQuery.SetButtonText( nYesBtnID, getResourceString( RID_STR_INSTALL_FOR_ME ) );
+ if ( nNoBtnID != BUTTONDIALOG_BUTTON_NOTFOUND )
+ aQuery.SetButtonText( nNoBtnID, getResourceString( RID_STR_INSTALL_FOR_ALL ) );
-// -----------------------------------------------------------------------
-IMPL_LINK( ExtensionBox_Impl, HandleEnableBtn, void*, EMPTYARG )
-{
- if ( m_bHasActive )
- {
- const bool bEnable( m_vEntries[ m_nActive ]->m_eState != REGISTERED );
+ short nRet = aQuery.Execute();
- m_pParent->enablePackage( m_vEntries[ m_nActive ]->m_xPackageManager,
- m_vEntries[ m_nActive ]->m_xPackage,
- bEnable );
- }
+ if ( nRet == RET_CANCEL )
+ return false;
- return 1;
+ bInstallForAll = ( nRet == RET_NO );
+ return true;
}
-// -----------------------------------------------------------------------
-IMPL_LINK( ExtensionBox_Impl, HandleRemoveBtn, void*, EMPTYARG )
+//------------------------------------------------------------------------------
+void DialogHelper::PostUserEvent( const Link& rLink, void* pCaller )
{
- if ( m_bHasActive )
- {
- m_pParent->removePackage( m_vEntries[ m_nActive ]->m_xPackageManager,
- m_vEntries[ m_nActive ]->m_xPackage );
- }
+ if ( m_nEventID )
+ Application::RemoveUserEvent( m_nEventID );
- return 1;
+ m_nEventID = Application::PostUserEvent( rLink, pCaller );
}
-// -----------------------------------------------------------------------
-IMPL_LINK( ExtensionBox_Impl, HandleHyperlink, svt::FixedHyperlink*, pHyperlink )
-{
- m_pParent->openWebBrowser( pHyperlink->GetURL() );
- return 1;
-}
-
-
//------------------------------------------------------------------------------
// ExtMgrDialog
//------------------------------------------------------------------------------
ExtMgrDialog::ExtMgrDialog( Window *pParent, TheExtensionManager *pManager ) :
ModelessDialog( pParent, getResId( RID_DLG_EXTENSION_MANAGER ) ),
+ DialogHelper( pManager->getContext(), (Dialog*) this ),
m_aAddBtn( this, getResId( RID_EM_BTN_ADD ) ),
m_aUpdateBtn( this, getResId( RID_EM_BTN_CHECK_UPDATES ) ),
m_aCloseBtn( this, getResId( RID_EM_BTN_CLOSE ) ),
@@ -1557,14 +718,14 @@ ExtMgrDialog::ExtMgrDialog( Window *pParent, TheExtensionManager *pManager ) :
m_bEnableWarning( false ),
m_bDisableWarning( false ),
m_bDeleteWarning( false ),
- m_bIsBusy( false ),
m_nProgress( 0 ),
m_pManager( pManager )
{
// free local resources (RID < 256):
FreeResource();
- m_pExtensionBox = new ExtensionBox_Impl( this, pManager );
+ m_pExtensionBox = new ExtBoxWithBtns_Impl( this, pManager );
+ m_pExtensionBox->SetHyperlinkHdl( LINK( this, ExtMgrDialog, HandleHyperlink ) );
m_aAddBtn.SetClickHdl( LINK( this, ExtMgrDialog, HandleAddBtn ) );
m_aUpdateBtn.SetClickHdl( LINK( this, ExtMgrDialog, HandleUpdateBtn ) );
@@ -1608,35 +769,6 @@ ExtMgrDialog::~ExtMgrDialog()
}
//------------------------------------------------------------------------------
-ResId ExtMgrDialog::getResId( USHORT id )
-{
- const ::vos::OGuard guard( Application::GetSolarMutex() );
- return ResId( id, *DeploymentGuiResMgr::get() );
-}
-
-//------------------------------------------------------------------------------
-String ExtMgrDialog::getResourceString( USHORT id )
-{
- // init with non-acquired solar mutex:
- BrandName::get();
- const ::vos::OGuard guard( Application::GetSolarMutex() );
- String ret( ResId( id, *DeploymentGuiResMgr::get() ) );
- if (ret.SearchAscii( "%PRODUCTNAME" ) != STRING_NOTFOUND) {
- ret.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() );
- }
- return ret;
-}
-
-//------------------------------------------------------------------------------
-bool ExtMgrDialog::IsSharedPkgMgr( const uno::Reference< deployment::XPackageManager > &xPackageManager )
-{
- if ( xPackageManager->getContext().equals( OUSTR("shared") ) )
- return true;
- else
- return false;
-}
-
-//------------------------------------------------------------------------------
void ExtMgrDialog::selectEntry( long nPos )
{
m_pExtensionBox->selectEntry( nPos );
@@ -1671,96 +803,6 @@ void ExtMgrDialog::checkEntries()
}
//------------------------------------------------------------------------------
-bool ExtMgrDialog::continueOnSharedExtension( const uno::Reference< deployment::XPackageManager > &xPackageManager,
- const USHORT nResID,
- bool &bHadWarning ) const
-{
- if ( IsSharedPkgMgr( xPackageManager ) && !bHadWarning )
- {
- const ::vos::OGuard guard( Application::GetSolarMutex() );
- WarningBox aInfoBox( const_cast< ExtMgrDialog* >(this), getResId( nResID ) );
- String aMsgText = aInfoBox.GetMessText();
- aMsgText.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() );
- aInfoBox.SetMessText( aMsgText );
-
- bHadWarning = true;
-
- if ( RET_OK == aInfoBox.Execute() )
- return true;
- else
- return false;
- }
- else
- return true;
-}
-
-//------------------------------------------------------------------------------
-void ExtMgrDialog::openWebBrowser( OUString const & sURL ) const
-{
- if ( ! sURL.getLength() ) // Nothing to do, when the URL is empty
- return;
-
- try
- {
- uno::Reference< uno::XComponentContext > xContext = m_pManager->getContext();
-
- uno::Reference< XSystemShellExecute > xSystemShellExecute(
- xContext->getServiceManager()->createInstanceWithContext( OUSTR( "com.sun.star.system.SystemShellExecute" ), xContext), uno::UNO_QUERY_THROW);
- //throws css::lang::IllegalArgumentException, css::system::SystemShellExecuteException
- xSystemShellExecute->execute( sURL, OUString(), SystemShellExecuteFlags::DEFAULTS );
- }
- catch ( uno::Exception& )
- {
- uno::Any exc( ::cppu::getCaughtException() );
- OUString msg( ::comphelper::anyToString( exc ) );
- const ::vos::OGuard guard( Application::GetSolarMutex() );
- ErrorBox aErrorBox( const_cast< ExtMgrDialog* >(this), WB_OK, msg );
- aErrorBox.SetText( GetText() );
- aErrorBox.Execute();
- }
-}
-
-//------------------------------------------------------------------------------
-bool ExtMgrDialog::installForAllUsers( bool &bInstallForAll ) const
-{
- const ::vos::OGuard guard( Application::GetSolarMutex() );
- QueryBox aQuery( const_cast< ExtMgrDialog* >(this), getResId( RID_QUERYBOX_INSTALL_FOR_ALL ) );
-
- String sMsgText = aQuery.GetMessText();
- sMsgText.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() );
- aQuery.SetMessText( sMsgText );
-
- USHORT nYesBtnID = aQuery.GetButtonId( 0 );
- USHORT nNoBtnID = aQuery.GetButtonId( 1 );
-
- if ( nYesBtnID != BUTTONDIALOG_BUTTON_NOTFOUND )
- aQuery.SetButtonText( nYesBtnID, getResourceString( RID_STR_INSTALL_FOR_ME ) );
- if ( nNoBtnID != BUTTONDIALOG_BUTTON_NOTFOUND )
- aQuery.SetButtonText( nNoBtnID, getResourceString( RID_STR_INSTALL_FOR_ALL ) );
-
- short nRet = aQuery.Execute();
-
- if ( nRet == RET_CANCEL )
- return false;
-
- bInstallForAll = ( nRet == RET_NO );
- return true;
-}
-
-//------------------------------------------------------------------------------
-bool ExtMgrDialog::installExtensionWarn( const OUString &rExtensionName ) const
-{
- const ::vos::OGuard guard( Application::GetSolarMutex() );
- WarningBox aInfo( const_cast< ExtMgrDialog* >(this), getResId( RID_WARNINGBOX_INSTALL_EXTENSION ) );
-
- String sText( aInfo.GetMessText() );
- sText.SearchAndReplaceAllAscii( "%NAME", rExtensionName );
- aInfo.SetMessText( sText );
-
- return ( RET_OK == aInfo.Execute() );
-}
-
-//------------------------------------------------------------------------------
bool ExtMgrDialog::removeExtensionWarn( const OUString &rExtensionName ) const
{
const ::vos::OGuard guard( Application::GetSolarMutex() );
@@ -1783,12 +825,12 @@ bool ExtMgrDialog::enablePackage( const uno::Reference< deployment::XPackageMana
if ( bEnable )
{
- if ( ! continueOnSharedExtension( xPackageManager, RID_WARNINGBOX_ENABLE_SHARED_EXTENSION, m_bEnableWarning ) )
+ if ( ! continueOnSharedExtension( xPackageManager, this, RID_WARNINGBOX_ENABLE_SHARED_EXTENSION, m_bEnableWarning ) )
return false;
}
else
{
- if ( ! continueOnSharedExtension( xPackageManager, RID_WARNINGBOX_DISABLE_SHARED_EXTENSION, m_bDisableWarning ) )
+ if ( ! continueOnSharedExtension( xPackageManager, this, RID_WARNINGBOX_DISABLE_SHARED_EXTENSION, m_bDisableWarning ) )
return false;
}
@@ -1810,7 +852,7 @@ bool ExtMgrDialog::removePackage( const uno::Reference< deployment::XPackageMana
return false;
}
- if ( ! continueOnSharedExtension( xPackageManager, RID_WARNINGBOX_REMOVE_SHARED_EXTENSION, m_bDeleteWarning ) )
+ if ( ! continueOnSharedExtension( xPackageManager, this, RID_WARNINGBOX_REMOVE_SHARED_EXTENSION, m_bDeleteWarning ) )
return false;
m_pManager->removePackage( xPackageManager, xPackage );
@@ -1825,7 +867,11 @@ bool ExtMgrDialog::updatePackage( const uno::Reference< deployment::XPackageMana
if ( !xPackageManager.is() || !xPackage.is() )
return false;
- m_pManager->updatePackage( xPackageManager, xPackage );
+ std::vector< TUpdateListEntry > vEntries;
+ TUpdateListEntry pEntry( new UpdateListEntry( xPackage, xPackageManager ) );
+ vEntries.push_back( pEntry );
+
+ m_pManager->updatePackages( vEntries );
return true;
}
@@ -1932,7 +978,7 @@ IMPL_LINK( ExtMgrDialog, startProgress, void*, _bLockInterface )
if ( m_aProgressBar.IsVisible() )
m_aProgressBar.SetValue( 100 );
m_xAbortChannel.clear();
-// bLockInterface = false;
+
OSL_TRACE( " startProgress handler: stop\n" );
}
else
@@ -1945,7 +991,8 @@ IMPL_LINK( ExtMgrDialog, startProgress, void*, _bLockInterface )
m_aUpdateBtn.Enable( !bLockInterface && m_pExtensionBox->getItemCount() );
m_pExtensionBox->enableButtons( !bLockInterface );
-// pCond->set();
+ clearEventID();
+
return 0;
}
@@ -1969,10 +1016,7 @@ void ExtMgrDialog::showProgress( bool _bStart )
OSL_TRACE( "showProgress stop!\n" );
}
- Application::PostUserEvent( LINK( this, ExtMgrDialog, startProgress ), (void*) bStart );
-// ::osl::Condition cond;
-// Application::PostUserEvent( LINK( this, ExtMgrDialog, startProgress ), &cond );
-// cond.wait();
+ DialogHelper::PostUserEvent( LINK( this, ExtMgrDialog, startProgress ), (void*) bStart );
}
// -----------------------------------------------------------------------
@@ -2003,7 +1047,7 @@ void ExtMgrDialog::updatePackageInfo( const uno::Reference< deployment::XPackage
// -----------------------------------------------------------------------
IMPL_LINK( ExtMgrDialog, HandleAddBtn, void*, EMPTYARG )
{
- m_bIsBusy = true;
+ setBusy( true );
uno::Reference< deployment::XPackageManager > xUserPkgMgr = m_pManager->getUserPkgMgr();
uno::Sequence< OUString > aFileList = raiseAddPicker( xUserPkgMgr );
@@ -2013,7 +1057,7 @@ IMPL_LINK( ExtMgrDialog, HandleAddBtn, void*, EMPTYARG )
m_pManager->installPackage( aFileList[0] );
}
- m_bIsBusy = false;
+ setBusy( false );
return 1;
}
@@ -2028,7 +1072,7 @@ IMPL_LINK( ExtMgrDialog, HandleUpdateBtn, void*, EMPTYARG )
// -----------------------------------------------------------------------
IMPL_LINK( ExtMgrDialog, HandleHyperlink, svt::FixedHyperlink*, pHyperlink )
{
- openWebBrowser( pHyperlink->GetURL() );
+ openWebBrowser( pHyperlink->GetURL(), GetText() );
return 1;
}
@@ -2191,6 +1235,554 @@ BOOL ExtMgrDialog::Close()
return bRet;
}
+//------------------------------------------------------------------------------
+// UpdateRequiredDialog
+//------------------------------------------------------------------------------
+UpdateRequiredDialog::UpdateRequiredDialog( Window *pParent, TheExtensionManager *pManager ) :
+ ModalDialog( pParent, getResId( RID_DLG_UPDATE_REQUIRED ) ),
+ DialogHelper( pManager->getContext(), (Dialog*) this ),
+ m_aUpdateNeeded( this, getResId( RID_EM_FT_MSG ) ),
+ m_aUpdateBtn( this, getResId( RID_EM_BTN_CHECK_UPDATES ) ),
+ m_aCloseBtn( this, getResId( RID_EM_BTN_CLOSE ) ),
+ m_aHelpBtn( this, getResId( RID_EM_BTN_HELP ) ),
+ m_aCancelBtn( this, getResId( RID_EM_BTN_CANCEL ) ),
+ m_aDivider( this ),
+ m_aProgressText( this, getResId( RID_EM_FT_PROGRESS ) ),
+ m_aProgressBar( this, WB_BORDER + WB_3DLOOK ),
+ m_sAddPackages( getResourceString( RID_STR_ADD_PACKAGES ) ),
+ m_sCloseText( getResourceString( RID_STR_CLOSE_BTN ) ),
+ m_bHasProgress( false ),
+ m_bProgressChanged( false ),
+ m_bStartProgress( false ),
+ m_bStopProgress( false ),
+ m_bUpdateWarning( false ),
+ m_bDisableWarning( false ),
+ m_bHasLockedEntries( false ),
+ m_nProgress( 0 ),
+ m_pManager( pManager )
+{
+ // free local resources (RID < 256):
+ FreeResource();
+
+ m_pExtensionBox = new ExtensionBox_Impl( this, pManager );
+ m_pExtensionBox->SetHyperlinkHdl( LINK( this, UpdateRequiredDialog, HandleHyperlink ) );
+
+ m_aUpdateBtn.SetClickHdl( LINK( this, UpdateRequiredDialog, HandleUpdateBtn ) );
+ m_aCloseBtn.SetClickHdl( LINK( this, UpdateRequiredDialog, HandleCloseBtn ) );
+ m_aCancelBtn.SetClickHdl( LINK( this, UpdateRequiredDialog, HandleCancelBtn ) );
+
+ String aText = m_aUpdateNeeded.GetText();
+ aText.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() );
+ m_aUpdateNeeded.SetText( aText );
+
+ // resize update button
+ Size aBtnSize = m_aUpdateBtn.GetSizePixel();
+ String sTitle = m_aUpdateBtn.GetText();
+ long nWidth = m_aUpdateBtn.GetCtrlTextWidth( sTitle );
+ nWidth += 2 * m_aUpdateBtn.GetTextHeight();
+ if ( nWidth > aBtnSize.Width() )
+ m_aUpdateBtn.SetSizePixel( Size( nWidth, aBtnSize.Height() ) );
+
+ // resize update button
+ aBtnSize = m_aCloseBtn.GetSizePixel();
+ sTitle = m_aCloseBtn.GetText();
+ nWidth = m_aCloseBtn.GetCtrlTextWidth( sTitle );
+ nWidth += 2 * m_aCloseBtn.GetTextHeight();
+ if ( nWidth > aBtnSize.Width() )
+ m_aCloseBtn.SetSizePixel( Size( nWidth, aBtnSize.Height() ) );
+
+ // minimum size:
+ SetMinOutputSizePixel(
+ Size( // width:
+ (5 * m_aHelpBtn.GetSizePixel().Width()) +
+ (5 * RSC_SP_DLG_INNERBORDER_LEFT ),
+ // height:
+ (1 * m_aHelpBtn.GetSizePixel().Height()) +
+ (1 * m_aUpdateNeeded.GetSizePixel().Height()) +
+ (1 * m_pExtensionBox->GetMinOutputSizePixel().Height()) +
+ (3 * RSC_SP_DLG_INNERBORDER_LEFT) ) );
+
+ m_aDivider.Show();
+ m_aProgressBar.Hide();
+ m_aUpdateBtn.Enable( false );
+ m_aCloseBtn.GrabFocus();
+
+ m_aTimeoutTimer.SetTimeout( 50 ); // mSec
+ m_aTimeoutTimer.SetTimeoutHdl( LINK( this, UpdateRequiredDialog, TimeOutHdl ) );
+}
+
+//------------------------------------------------------------------------------
+UpdateRequiredDialog::~UpdateRequiredDialog()
+{
+ m_aTimeoutTimer.Stop();
+
+ delete m_pExtensionBox;
+}
+
+//------------------------------------------------------------------------------
+long UpdateRequiredDialog::addPackageToList( const uno::Reference< deployment::XPackage > &xPackage,
+ const uno::Reference< deployment::XPackageManager > &xPackageManager )
+{
+ // We will only add entries to the list with unsatisfied dependencies
+ if ( !checkDependencies( xPackage ) )
+ {
+ m_bHasLockedEntries |= (bool) xPackageManager->isReadOnly();
+ m_aUpdateBtn.Enable( true );
+ return m_pExtensionBox->addEntry( xPackage, xPackageManager );
+ }
+ return 0;
+}
+
+//------------------------------------------------------------------------------
+void UpdateRequiredDialog::prepareChecking( const uno::Reference< deployment::XPackageManager > &xPackageManager )
+{
+ if ( xPackageManager.is() )
+ m_pExtensionBox->prepareChecking( xPackageManager );
+}
+
+//------------------------------------------------------------------------------
+void UpdateRequiredDialog::checkEntries()
+{
+ const ::vos::OGuard guard( Application::GetSolarMutex() );
+ m_pExtensionBox->checkEntries();
+
+ if ( ! hasActiveEntries() )
+ {
+ m_aCloseBtn.SetText( m_sCloseText );
+ m_aCloseBtn.GrabFocus();
+ }
+}
+
+//------------------------------------------------------------------------------
+bool UpdateRequiredDialog::enablePackage( const uno::Reference< deployment::XPackageManager > &,
+ const uno::Reference< deployment::XPackage > &xPackage,
+ bool bEnable )
+{
+ m_pManager->enablePackage( xPackage, bEnable );
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+IMPL_LINK( UpdateRequiredDialog, HandleCancelBtn, void*, EMPTYARG )
+{
+ // m_dialog->m_cmdEnv->m_aborted = true;
+ if ( m_xAbortChannel.is() )
+ {
+ try
+ {
+ m_xAbortChannel->sendAbort();
+ }
+ catch ( uno::RuntimeException & )
+ {
+ OSL_ENSURE( 0, "### unexpected RuntimeException!" );
+ }
+ }
+ return 1;
+}
+
+// ------------------------------------------------------------------------------
+IMPL_LINK( UpdateRequiredDialog, startProgress, void*, _bLockInterface )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ bool bLockInterface = (bool) _bLockInterface;
+
+ if ( m_bStartProgress && !m_bHasProgress )
+ m_aTimeoutTimer.Start();
+
+ if ( m_bStopProgress )
+ {
+ if ( m_aProgressBar.IsVisible() )
+ m_aProgressBar.SetValue( 100 );
+ m_xAbortChannel.clear();
+ OSL_TRACE( " startProgress handler: stop\n" );
+ }
+ else
+ {
+ OSL_TRACE( " startProgress handler: start\n" );
+ }
+
+ m_aCancelBtn.Enable( bLockInterface );
+ m_aUpdateBtn.Enable( false );
+ clearEventID();
+
+ return 0;
+}
+
+// ------------------------------------------------------------------------------
+void UpdateRequiredDialog::showProgress( bool _bStart )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ bool bStart = _bStart;
+
+ if ( bStart )
+ {
+ m_nProgress = 0;
+ m_bStartProgress = true;
+ OSL_TRACE( "showProgress start\n" );
+ }
+ else
+ {
+ m_nProgress = 100;
+ m_bStopProgress = true;
+ OSL_TRACE( "showProgress stop!\n" );
+ }
+
+ DialogHelper::PostUserEvent( LINK( this, UpdateRequiredDialog, startProgress ), (void*) bStart );
+}
+
+// -----------------------------------------------------------------------
+void UpdateRequiredDialog::updateProgress( const long nProgress )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ m_nProgress = nProgress;
+}
+
+// -----------------------------------------------------------------------
+void UpdateRequiredDialog::updateProgress( const OUString &rText,
+ const uno::Reference< task::XAbortChannel > &xAbortChannel)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ m_xAbortChannel = xAbortChannel;
+ m_sProgressText = rText;
+ m_bProgressChanged = true;
+}
+
+//------------------------------------------------------------------------------
+void UpdateRequiredDialog::updatePackageInfo( const uno::Reference< deployment::XPackage > &xPackage )
+{
+ // We will remove all updated packages with satisfied dependencies, but
+ // we will show all disabled entries so the user sees the result
+ // of the 'disable all' button
+ if ( isEnabled( xPackage ) && checkDependencies( xPackage ) )
+ m_pExtensionBox->removeEntry( xPackage );
+ else
+ m_pExtensionBox->updateEntry( xPackage );
+
+ if ( ! hasActiveEntries() )
+ {
+ m_aCloseBtn.SetText( m_sCloseText );
+ m_aCloseBtn.GrabFocus();
+ }
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( UpdateRequiredDialog, HandleUpdateBtn, void*, EMPTYARG )
+{
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ std::vector< TUpdateListEntry > vUpdateEntries;
+ sal_Int32 nCount = m_pExtensionBox->GetEntryCount();
+
+ for ( sal_Int32 i = 0; i < nCount; ++i )
+ {
+ TEntry_Impl pEntry = m_pExtensionBox->GetEntryData( i );
+ TUpdateListEntry pUpdateEntry( new UpdateListEntry( pEntry->m_xPackage,
+ pEntry->m_xPackageManager ) );
+ vUpdateEntries.push_back( pUpdateEntry );
+ }
+
+ aGuard.clear();
+
+ m_pManager->updatePackages( vUpdateEntries );
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( UpdateRequiredDialog, HandleCloseBtn, void*, EMPTYARG )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !isBusy() )
+ {
+ if ( m_bHasLockedEntries )
+ EndDialog( -1 );
+ else if ( hasActiveEntries() )
+ disableAllEntries();
+ else
+ EndDialog( 0 );
+ }
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( UpdateRequiredDialog, HandleHyperlink, svt::FixedHyperlink*, pHyperlink )
+{
+ openWebBrowser( pHyperlink->GetURL(), GetText() );
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( UpdateRequiredDialog, TimeOutHdl, Timer*, EMPTYARG )
+{
+ if ( m_bStopProgress )
+ {
+ m_bHasProgress = false;
+ m_bStopProgress = false;
+ m_aProgressText.Hide();
+ m_aProgressBar.Hide();
+ m_aCancelBtn.Hide();
+ }
+ else
+ {
+ if ( m_bProgressChanged )
+ {
+ m_bProgressChanged = false;
+ m_aProgressText.SetText( m_sProgressText );
+ }
+
+ if ( m_bStartProgress )
+ {
+ m_bStartProgress = false;
+ m_bHasProgress = true;
+ m_aProgressBar.Show();
+ m_aProgressText.Show();
+ m_aCancelBtn.Enable();
+ m_aCancelBtn.Show();
+ }
+
+ if ( m_aProgressBar.IsVisible() )
+ m_aProgressBar.SetValue( (USHORT) m_nProgress );
+
+ m_aTimeoutTimer.Start();
+ }
+
+ return 1;
+}
+
+//------------------------------------------------------------------------------
+// VCL::Window / Dialog
+void UpdateRequiredDialog::Resize()
+{
+ Size aTotalSize( GetOutputSizePixel() );
+ Size aBtnSize( m_aHelpBtn.GetSizePixel() );
+
+ Point aPos( RSC_SP_DLG_INNERBORDER_LEFT,
+ aTotalSize.Height() - RSC_SP_DLG_INNERBORDER_BOTTOM - aBtnSize.Height() );
+
+ m_aHelpBtn.SetPosPixel( aPos );
+
+ aPos.X() = aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_RIGHT - m_aCloseBtn.GetSizePixel().Width();
+ m_aCloseBtn.SetPosPixel( aPos );
+
+ aPos.X() -= ( RSC_SP_CTRL_X + m_aUpdateBtn.GetSizePixel().Width() );
+ m_aUpdateBtn.SetPosPixel( aPos );
+
+ Size aDivSize( aTotalSize.Width(), LINE_SIZE );
+ aPos = Point( 0, aPos.Y() - LINE_SIZE - RSC_SP_DLG_INNERBORDER_BOTTOM );
+ m_aDivider.SetPosSizePixel( aPos, aDivSize );
+
+ // Calc fixed text size
+ aPos = Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP );
+ Size aFTSize = m_aUpdateNeeded.CalcMinimumSize( aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_RIGHT - RSC_SP_DLG_INNERBORDER_LEFT );
+ m_aUpdateNeeded.SetPosSizePixel( aPos, aFTSize );
+
+ // Calc list box size
+ Size aSize( aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_LEFT - RSC_SP_DLG_INNERBORDER_RIGHT,
+ aTotalSize.Height() - 2*aBtnSize.Height() - LINE_SIZE -
+ 2*RSC_SP_DLG_INNERBORDER_TOP - 3*RSC_SP_DLG_INNERBORDER_BOTTOM - aFTSize.Height() );
+ aPos.Y() += aFTSize.Height()+RSC_SP_DLG_INNERBORDER_TOP;
+
+ m_pExtensionBox->SetPosSizePixel( aPos, aSize );
+
+ aPos.X() = aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_RIGHT - aBtnSize.Width();
+ aPos.Y() += aSize.Height()+RSC_SP_DLG_INNERBORDER_TOP;
+ m_aCancelBtn.SetPosPixel( aPos );
+
+ // Calc progress height
+ aFTSize = m_aProgressText.GetSizePixel();
+ long nProgressHeight = aFTSize.Height();
+
+ if( IsNativeControlSupported( CTRL_PROGRESS, PART_ENTIRE_CONTROL ) )
+ {
+ ImplControlValue aValue;
+ bool bNativeOK;
+ Region aControlRegion( Rectangle( (const Point&)Point(), m_aProgressBar.GetSizePixel() ) );
+ Region aNativeControlRegion, aNativeContentRegion;
+ if( (bNativeOK = GetNativeControlRegion( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion,
+ CTRL_STATE_ENABLED, aValue, rtl::OUString(),
+ aNativeControlRegion, aNativeContentRegion ) ) != FALSE )
+ {
+ nProgressHeight = aNativeControlRegion.GetBoundRect().GetHeight();
+ }
+ }
+
+ if ( nProgressHeight < PROGRESS_HEIGHT )
+ nProgressHeight = PROGRESS_HEIGHT;
+
+ aPos.X() -= ( RSC_SP_CTRL_GROUP_Y + PROGRESS_WIDTH );
+ m_aProgressBar.SetPosSizePixel( Point( aPos.X(), aPos.Y() + ((aBtnSize.Height()-nProgressHeight)/2) ),
+ Size( PROGRESS_WIDTH, nProgressHeight ) );
+
+ aFTSize.Width() = aPos.X() - 2*RSC_SP_DLG_INNERBORDER_LEFT;
+ aPos.X() = RSC_SP_DLG_INNERBORDER_LEFT;
+ aPos.Y() += ( aBtnSize.Height() - aFTSize.Height() - 1 ) / 2;
+ m_aProgressText.SetPosSizePixel( aPos, aFTSize );
+}
+
+//------------------------------------------------------------------------------
+// VCL::Dialog
+short UpdateRequiredDialog::Execute()
+{
+ if ( m_bHasLockedEntries )
+ {
+ // Set other text, disable update btn, remove not shared entries from list;
+ m_aUpdateNeeded.SetText( DialogHelper::getResourceString( RID_STR_NO_ADMIN_PRIVILEGE ) );
+ m_aCloseBtn.SetText( DialogHelper::getResourceString( RID_STR_EXIT_BTN ) );
+ m_aUpdateBtn.Enable( false );
+ m_pExtensionBox->RemoveUnlocked();
+ Resize();
+ }
+
+ return Dialog::Execute();
+}
+
+//------------------------------------------------------------------------------
+// VCL::Dialog
+BOOL UpdateRequiredDialog::Close()
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !isBusy() )
+ {
+ if ( m_bHasLockedEntries )
+ EndDialog( -1 );
+ else if ( hasActiveEntries() )
+ disableAllEntries();
+ else
+ EndDialog( 0 );
+ }
+
+ return false;
+}
+
+//------------------------------------------------------------------------------
+// Check dependencies of all packages
+//------------------------------------------------------------------------------
+bool UpdateRequiredDialog::isEnabled( const uno::Reference< deployment::XPackage > &xPackage ) const
+{
+ bool bRegistered = false;
+ try {
+ beans::Optional< beans::Ambiguous< sal_Bool > > option( xPackage->isRegistered( uno::Reference< task::XAbortChannel >(),
+ uno::Reference< ucb::XCommandEnvironment >() ) );
+ if ( option.IsPresent )
+ {
+ ::beans::Ambiguous< sal_Bool > const & reg = option.Value;
+ if ( reg.IsAmbiguous )
+ bRegistered = false;
+ else
+ bRegistered = reg.Value ? true : false;
+ }
+ else
+ bRegistered = false;
+ }
+ catch ( uno::RuntimeException & ) { throw; }
+ catch ( uno::Exception & exc) {
+ (void) exc;
+ OSL_ENSURE( 0, ::rtl::OUStringToOString( exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ bRegistered = false;
+ }
+
+ return bRegistered;
+}
+
+//------------------------------------------------------------------------------
+bool UpdateRequiredDialog::checkDependencies( const uno::Reference< deployment::XPackage > &xPackage ) const
+{
+ if ( isEnabled( xPackage ) )
+ {
+ bool bDependenciesValid = false;
+ try {
+ bDependenciesValid = xPackage->checkDependencies( uno::Reference< ucb::XCommandEnvironment >() );
+ }
+ catch ( deployment::DeploymentException & ) {}
+ if ( ! bDependenciesValid )
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool UpdateRequiredDialog::hasActiveEntries()
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ bool bRet = false;
+ long nCount = m_pExtensionBox->GetEntryCount();
+ for ( long nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ TEntry_Impl pEntry = m_pExtensionBox->GetEntryData( nIndex );
+
+ if ( !checkDependencies( pEntry->m_xPackage ) )
+ {
+ bRet = true;
+ break;
+ }
+ }
+
+ return bRet;
+}
+
+//------------------------------------------------------------------------------
+void UpdateRequiredDialog::disableAllEntries()
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ setBusy( true );
+
+ long nCount = m_pExtensionBox->GetEntryCount();
+ for ( long nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ TEntry_Impl pEntry = m_pExtensionBox->GetEntryData( nIndex );
+ enablePackage( pEntry->m_xPackageManager, pEntry->m_xPackage, false );
+ }
+
+ setBusy( false );
+
+ if ( ! hasActiveEntries() )
+ m_aCloseBtn.SetText( m_sCloseText );
+}
+
+//=================================================================================
+// UpdateRequiredDialogService
+//=================================================================================
+UpdateRequiredDialogService::UpdateRequiredDialogService( uno::Sequence< uno::Any > const&,
+ uno::Reference< uno::XComponentContext > const& xComponentContext )
+ : m_xComponentContext( xComponentContext )
+{
+}
+
+//------------------------------------------------------------------------------
+// XExecutableDialog
+//------------------------------------------------------------------------------
+void UpdateRequiredDialogService::setTitle( OUString const & ) throw ( uno::RuntimeException )
+{
+}
+
+//------------------------------------------------------------------------------
+sal_Int16 UpdateRequiredDialogService::execute() throw ( uno::RuntimeException )
+{
+ ::rtl::Reference< ::dp_gui::TheExtensionManager > xManager( TheExtensionManager::get(
+ m_xComponentContext,
+ uno::Reference< awt::XWindow >(),
+ OUString() ) );
+ xManager->createDialog( true );
+ sal_Int16 nRet = xManager->execute();
+
+ return nRet;
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
SelectedPackage::~SelectedPackage() {}
} //namespace dp_gui
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx
index bab8d52828a9..7536aa403cfe 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx
@@ -46,20 +46,71 @@
#include "rtl/ref.hxx"
#include "rtl/ustring.hxx"
+#include "cppuhelper/implbase1.hxx"
+
+#include "com/sun/star/awt/XWindow.hpp"
#include "com/sun/star/deployment/XPackage.hpp"
#include "com/sun/star/deployment/XPackageManager.hpp"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/ui/dialogs/XExecutableDialog.hpp"
#include "com/sun/star/util/XModifyListener.hpp"
namespace dp_gui {
//==============================================================================
+class ExtBoxWithBtns_Impl;
class ExtensionBox_Impl;
class TheExtensionManager;
//==============================================================================
-class ExtMgrDialog : public ModelessDialog
+class DialogHelper
{
- ExtensionBox_Impl *m_pExtensionBox;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ Dialog* m_pVCLWindow;
+ ULONG m_nEventID;
+ bool m_bIsBusy;
+
+public:
+ DialogHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &,
+ Dialog *pWindow );
+ virtual ~DialogHelper();
+
+ void openWebBrowser( const ::rtl::OUString & sURL, const ::rtl::OUString & sTitle ) const;
+ Dialog* getWindow() const { return m_pVCLWindow; };
+ void PostUserEvent( const Link& rLink, void* pCaller );
+ void clearEventID() { m_nEventID = 0; }
+
+ virtual void showProgress( bool bStart ) = 0;
+ virtual void updateProgress( const ::rtl::OUString &rText,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > &xAbortChannel) = 0;
+ virtual void updateProgress( const long nProgress ) = 0;
+
+ virtual void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) = 0;
+ virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > & ) = 0;
+
+ virtual void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager ) = 0;
+ virtual void checkEntries() = 0;
+
+ static ResId getResId( USHORT nId );
+ static String getResourceString( USHORT id );
+ static bool IsSharedPkgMgr( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &);
+ static bool continueOnSharedExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &,
+ Window *pParent,
+ const USHORT nResID,
+ bool &bHadWarning );
+
+ void setBusy( const bool bBusy ) { m_bIsBusy = bBusy; }
+ bool isBusy() const { return m_bIsBusy; }
+ bool installExtensionWarn( const ::rtl::OUString &rExtensionURL ) const;
+ bool installForAllUsers( bool &bInstallForAll ) const;
+};
+
+//==============================================================================
+class ExtMgrDialog : public ModelessDialog,
+ public DialogHelper
+{
+ ExtBoxWithBtns_Impl *m_pExtensionBox;
PushButton m_aAddBtn;
PushButton m_aUpdateBtn;
OKButton m_aCloseBtn;
@@ -81,16 +132,12 @@ class ExtMgrDialog : public ModelessDialog
bool m_bEnableWarning;
bool m_bDisableWarning;
bool m_bDeleteWarning;
- bool m_bIsBusy;
long m_nProgress;
Timer m_aTimeoutTimer;
TheExtensionManager *m_pManager;
::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > m_xAbortChannel;
- bool continueOnSharedExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &,
- const USHORT nResID,
- bool &bHadWarning ) const;
bool removeExtensionWarn( const ::rtl::OUString &rExtensionTitle ) const;
DECL_DLLPRIVATE_LINK( HandleAddBtn, void * );
@@ -108,9 +155,16 @@ public:
virtual long Notify( NotifyEvent& rNEvt );
virtual BOOL Close();
+ virtual void showProgress( bool bStart );
+ virtual void updateProgress( const ::rtl::OUString &rText,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > &xAbortChannel);
+ virtual void updateProgress( const long nProgress );
+
+ virtual void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
+
void setGetExtensionsURL( const ::rtl::OUString &rURL );
void selectEntry( long nPos );
- long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &,
+ virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &,
const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > & );
bool enablePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
@@ -120,27 +174,102 @@ public:
bool updatePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
- bool isBusy() { return m_bIsBusy; }
+ virtual void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
+ virtual void checkEntries();
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > raiseAddPicker( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
+};
+
+//==============================================================================
+class UpdateRequiredDialog : public ModalDialog,
+ public DialogHelper
+{
+ ExtensionBox_Impl *m_pExtensionBox;
+ FixedText m_aUpdateNeeded;
+ PushButton m_aUpdateBtn;
+ PushButton m_aCloseBtn;
+ HelpButton m_aHelpBtn;
+ CancelButton m_aCancelBtn;
+ FixedLine m_aDivider;
+ FixedText m_aProgressText;
+ ProgressBar m_aProgressBar;
+ const String m_sAddPackages;
+ const String m_sCloseText;
+ String m_sProgressText;
+ ::osl::Mutex m_aMutex;
+ bool m_bHasProgress;
+ bool m_bProgressChanged;
+ bool m_bStartProgress;
+ bool m_bStopProgress;
+ bool m_bUpdateWarning;
+ bool m_bDisableWarning;
+ bool m_bHasLockedEntries;
+ long m_nProgress;
+ Timer m_aTimeoutTimer;
+ TheExtensionManager *m_pManager;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > m_xAbortChannel;
+
+ DECL_DLLPRIVATE_LINK( HandleUpdateBtn, void * );
+ DECL_DLLPRIVATE_LINK( HandleCloseBtn, void * );
+ DECL_DLLPRIVATE_LINK( HandleCancelBtn, void * );
+ DECL_DLLPRIVATE_LINK( TimeOutHdl, Timer* );
+ DECL_DLLPRIVATE_LINK( startProgress, void * );
+ DECL_DLLPRIVATE_LINK( HandleHyperlink, svt::FixedHyperlink * );
- void showProgress( bool bStart );
- void updateProgress( const ::rtl::OUString &rText,
+ bool isEnabled( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const;
+ bool checkDependencies( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const;
+ bool hasActiveEntries();
+ void disableAllEntries();
+
+public:
+ UpdateRequiredDialog( Window * pParent, TheExtensionManager *pManager );
+ virtual ~UpdateRequiredDialog();
+
+ virtual short Execute();
+ virtual void Resize();
+ virtual BOOL Close();
+// virtual long Notify( NotifyEvent& rNEvt );
+
+ virtual void showProgress( bool bStart );
+ virtual void updateProgress( const ::rtl::OUString &rText,
const ::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > &xAbortChannel);
- void updateProgress( const long nProgress );
- void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
+ virtual void updateProgress( const long nProgress );
- void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
- void checkEntries();
+ virtual void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
- ::com::sun::star::uno::Sequence< ::rtl::OUString > raiseAddPicker( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
+ void selectEntry( long nPos );
+ virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > & );
+ bool enablePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
+ bool bEnable );
+ bool updatePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
- void openWebBrowser( ::rtl::OUString const &sURL ) const;
+ virtual void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
+ virtual void checkEntries();
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > raiseAddPicker( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
bool installForAllUsers( bool &bInstallForAll ) const;
bool installExtensionWarn( const ::rtl::OUString &rExtensionURL ) const;
+};
- static ResId getResId( USHORT id );
- static String getResourceString( USHORT id );
- static bool IsSharedPkgMgr( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &);
+//==============================================================================
+class UpdateRequiredDialogService : public ::cppu::WeakImplHelper1< ::com::sun::star::ui::dialogs::XExecutableDialog >
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const m_xComponentContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xParent;
+ ::rtl::OUString m_sInitialTitle;
+
+public:
+ UpdateRequiredDialogService( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > const & args,
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const & xComponentContext );
+
+ // XExecutableDialog
+ virtual void SAL_CALL setTitle( rtl::OUString const & title ) throw ( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Int16 SAL_CALL execute() throw ( ::com::sun::star::uno::RuntimeException );
};
} // namespace dp_gui
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.src b/desktop/source/deployment/gui/dp_gui_dialog2.src
index e82e8c762a9e..0ca9f9e74362 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.src
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.src
@@ -97,6 +97,66 @@ ModelessDialog RID_DLG_EXTENSION_MANAGER
};
};
+ModalDialog RID_DLG_UPDATE_REQUIRED
+{
+ HelpId = HID_PACKAGE_MANAGER_UPD_REQ;
+ Text [ en-US ] = "Extension Update Required";
+
+ Size = MAP_APPFONT( 300, 200 );
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Moveable = TRUE;
+ Closeable = TRUE;
+ Sizeable = TRUE;
+ Hide = TRUE;
+
+ FixedText RID_EM_FT_MSG
+ {
+ Text [ en-US ] = "%PRODUCTNAME has been updated to a new version. Some installed %PRODUCTNAME extensions are not compatible with this version and need to be updated before they can be used.";
+ WordBreak = TRUE;
+ NoLabel = TRUE;
+ Size = MAP_APPFONT( 280, 3*RSC_BS_CHARHEIGHT );
+ Pos = MAP_APPFONT( 5, 5 );
+ };
+
+ FixedText RID_EM_FT_PROGRESS
+ {
+ Hide = TRUE;
+ Right = TRUE;
+ Text [ en-US ] = "Adding %EXTENSION_NAME";
+ Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ };
+
+ HelpButton RID_EM_BTN_HELP
+ {
+ TabStop = TRUE;
+ Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ };
+
+ PushButton RID_EM_BTN_CHECK_UPDATES
+ {
+ TabStop = TRUE;
+ Text [ en-US ] = "Check for ~Updates...";
+ Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ };
+
+ PushButton RID_EM_BTN_CLOSE
+ {
+ TabStop = TRUE;
+ DefButton = TRUE;
+ Text [ en-US ] = "Disable all";
+ Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ };
+
+ CancelButton RID_EM_BTN_CANCEL
+ {
+ TabStop = TRUE;
+ Hide = TRUE;
+ Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ };
+
+};
+
Image RID_IMG_WARNING
{
ImageBitmap = Bitmap { File = "caution_16.png"; };
diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
index 5a247729082d..889fdc04c9e1 100644
--- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
@@ -136,7 +136,7 @@ class ProgressCmdEnv
uno::Reference< uno::XComponentContext > m_xContext;
uno::Reference< task::XAbortChannel> m_xAbortChannel;
- ExtMgrDialog *m_pDialog;
+ DialogHelper *m_pDialogHelper;
OUString m_sTitle;
bool m_bAborted;
bool m_bWarnUser;
@@ -157,16 +157,16 @@ public:
*/
ProgressCmdEnv( const uno::Reference< uno::XComponentContext > rContext,
- ExtMgrDialog *pDialog,
+ DialogHelper *pDialogHelper,
const OUString &rTitle )
: m_xContext( rContext ),
- m_pDialog( pDialog ),
+ m_pDialogHelper( pDialogHelper ),
m_sTitle( rTitle ),
m_bAborted( false ),
m_bWarnUser( false )
{}
- Dialog * activeDialog() { return m_pDialog; }
+ Dialog * activeDialog() { return m_pDialogHelper->getWindow(); }
void setTitle( const OUString& rNewTitle ) { m_sTitle = rNewTitle; }
void startProgress();
@@ -197,14 +197,14 @@ public:
//------------------------------------------------------------------------------
struct ExtensionCmd
{
- enum E_CMD_TYPE { ADD, ENABLE, DISABLE, REMOVE, CHECK_FOR_UPDATE, CHECK_FOR_UPDATES };
+ enum E_CMD_TYPE { ADD, ENABLE, DISABLE, REMOVE, CHECK_FOR_UPDATES };
E_CMD_TYPE m_eCmdType;
bool m_bWarnUser;
OUString m_sExtensionURL;
uno::Reference< deployment::XPackageManager > m_xPackageManager;
uno::Reference< deployment::XPackage > m_xPackage;
- uno::Sequence< uno::Reference< deployment::XPackageManager > > m_xPackageManagers;
+ std::vector< TUpdateListEntry > m_vExtensionList;
ExtensionCmd( const E_CMD_TYPE eCommand,
const uno::Reference< deployment::XPackageManager > &rPackageManager,
@@ -227,10 +227,10 @@ struct ExtensionCmd
m_bWarnUser( false ),
m_xPackage( rPackage ) {};
ExtensionCmd( const E_CMD_TYPE eCommand,
- const uno::Sequence< uno::Reference< deployment::XPackageManager > > &rPackageManagers )
+ const std::vector< TUpdateListEntry > &vExtensionList )
: m_eCmdType( eCommand ),
m_bWarnUser( false ),
- m_xPackageManagers( rPackageManagers ) {};
+ m_vExtensionList( vExtensionList ) {};
};
typedef ::boost::shared_ptr< ExtensionCmd > TExtensionCmd;
@@ -239,7 +239,7 @@ typedef ::boost::shared_ptr< ExtensionCmd > TExtensionCmd;
class ExtensionCmdQueue::Thread: public dp_gui::Thread
{
public:
- Thread( ExtMgrDialog *pDialog,
+ Thread( DialogHelper *pDialogHelper,
TheExtensionManager *pManager,
const uno::Reference< uno::XComponentContext > & rContext );
@@ -250,9 +250,7 @@ public:
const uno::Reference< deployment::XPackage > &rPackage );
void enableExtension( const uno::Reference< deployment::XPackage > &rPackage,
const bool bEnable );
- void checkForUpdates( const uno::Sequence< uno::Reference< deployment::XPackageManager > > &rPackageManagers );
- void checkForUpdate( const uno::Reference< deployment::XPackageManager > &rPackageManager,
- const uno::Reference< deployment::XPackage > &rPackage );
+ void checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList );
void stop();
bool hasTerminated();
bool isBusy();
@@ -280,16 +278,14 @@ private:
const uno::Reference< deployment::XPackage > &xPackage );
void _disableExtension( ::rtl::Reference< ProgressCmdEnv > &rCmdEnv,
const uno::Reference< deployment::XPackage > &xPackage );
- void _checkForUpdates( const uno::Sequence< uno::Reference< deployment::XPackageManager > > &rPackageManagers,
- const uno::Reference< deployment::XPackageManager > &xPackageManager,
- const uno::Reference< deployment::XPackage > &xPackage );
+ void _checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList );
enum Input { NONE, START, STOP };
uno::Reference< uno::XComponentContext > m_xContext;
std::queue< TExtensionCmd > m_queue;
- ExtMgrDialog *m_pDialog;
+ DialogHelper *m_pDialogHelper;
TheExtensionManager *m_pManager;
const OUString m_sEnablingPackages;
@@ -310,13 +306,15 @@ void ProgressCmdEnv::startProgress()
{
m_nCurrentProgress = 0;
- m_pDialog->showProgress( true );
+ if ( m_pDialogHelper )
+ m_pDialogHelper->showProgress( true );
}
//------------------------------------------------------------------------------
void ProgressCmdEnv::stopProgress()
{
- m_pDialog->showProgress( false );
+ if ( m_pDialogHelper )
+ m_pDialogHelper->showProgress( false );
}
//------------------------------------------------------------------------------
@@ -327,8 +325,11 @@ void ProgressCmdEnv::progressSection( const OUString &rText,
if (! m_bAborted)
{
m_nCurrentProgress = 0;
- m_pDialog->updateProgress( rText, xAbortChannel );
- m_pDialog->updateProgress( 5 );
+ if ( m_pDialogHelper )
+ {
+ m_pDialogHelper->updateProgress( rText, xAbortChannel );
+ m_pDialogHelper->updateProgress( 5 );
+ }
}
}
@@ -338,7 +339,8 @@ void ProgressCmdEnv::updateProgress()
if ( ! m_bAborted )
{
long nProgress = ((m_nCurrentProgress*5) % 100) + 5;
- m_pDialog->updateProgress( nProgress );
+ if ( m_pDialogHelper )
+ m_pDialogHelper->updateProgress( nProgress );
}
}
@@ -434,7 +436,7 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
}
{
vos::OGuard guard(Application::GetSolarMutex());
- short n = DependencyDialog( m_pDialog, deps ).Execute();
+ short n = DependencyDialog( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, deps ).Execute();
// Distinguish between closing the dialog and programatically
// canceling the dialog (headless VCL):
approve = n == RET_OK
@@ -445,19 +447,19 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
{
vos::OGuard aSolarGuard( Application::GetSolarMutex() );
ResId warnId(WARNINGBOX_NOSHAREDALLOWED, *DeploymentGuiResMgr::get());
- WarningBox warn( m_pDialog, warnId);
+ WarningBox warn( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, warnId);
String msgText = warn.GetMessText();
msgText.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() );
msgText.SearchAndReplaceAllAscii("%NAME", licAgreementExc.ExtensionName);
warn.SetMessText(msgText);
warn.Execute();
- abort = true;
+ abort = true;
}
else if (request >>= licExc)
{
uno::Reference< ui::dialogs::XExecutableDialog > xDialog(
deployment::ui::LicenseDialog::create(
- m_xContext, VCLUnoHelper::GetInterface( m_pDialog ), licExc.Text ) );
+ m_xContext, VCLUnoHelper::GetInterface( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL ), licExc.Text ) );
sal_Int16 res = xDialog->execute();
if ( res == ui::dialogs::ExecutableDialogResults::CANCEL )
abort = true;
@@ -488,7 +490,7 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
verExc.Deployed->getDisplayName());
{
vos::OGuard guard(Application::GetSolarMutex());
- WarningBox box( m_pDialog, ResId(id, *DeploymentGuiResMgr::get()));
+ WarningBox box( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, ResId(id, *DeploymentGuiResMgr::get()));
String s;
if (bEqualNames)
{
@@ -526,9 +528,14 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
}
else
{
- vos::OGuard guard(Application::GetSolarMutex());
+ if ( m_pDialogHelper )
+ {
+ vos::OGuard guard(Application::GetSolarMutex());
- approve = m_pDialog->installExtensionWarn( instExc.New->getDisplayName() );
+ approve = m_pDialogHelper->installExtensionWarn( instExc.New->getDisplayName() );
+ }
+ else
+ approve = false;
abort = !approve;
}
}
@@ -537,7 +544,7 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
vos::OGuard guard( Application::GetSolarMutex() );
String sMsg( ResId( RID_STR_UNSUPPORTED_PLATFORM, *DeploymentGuiResMgr::get() ) );
sMsg.SearchAndReplaceAllAscii( "%Name", platExc.package->getDisplayName() );
- ErrorBox box( m_pDialog, WB_OK, sMsg );
+ ErrorBox box( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, WB_OK, sMsg );
box.Execute();
approve = true;
}
@@ -609,7 +616,7 @@ void ProgressCmdEnv::update_( uno::Any const & rStatus )
text = ::comphelper::anyToString( rStatus ); // fallback
const ::vos::OGuard aGuard( Application::GetSolarMutex() );
- const ::std::auto_ptr< ErrorBox > aBox( new ErrorBox( m_pDialog, WB_OK, text ) );
+ const ::std::auto_ptr< ErrorBox > aBox( new ErrorBox( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, WB_OK, text ) );
aBox->Execute();
}
++m_nCurrentProgress;
@@ -631,23 +638,23 @@ void ProgressCmdEnv::pop()
}
//------------------------------------------------------------------------------
-ExtensionCmdQueue::Thread::Thread( ExtMgrDialog *pDialog,
+ExtensionCmdQueue::Thread::Thread( DialogHelper *pDialogHelper,
TheExtensionManager *pManager,
const uno::Reference< uno::XComponentContext > & rContext ) :
m_xContext( rContext ),
- m_pDialog( pDialog ),
+ m_pDialogHelper( pDialogHelper ),
m_pManager( pManager ),
- m_sEnablingPackages( ExtMgrDialog::getResourceString( RID_STR_ENABLING_PACKAGES ) ),
- m_sDisablingPackages( ExtMgrDialog::getResourceString( RID_STR_DISABLING_PACKAGES ) ),
- m_sAddingPackages( ExtMgrDialog::getResourceString( RID_STR_ADDING_PACKAGES ) ),
- m_sRemovingPackages( ExtMgrDialog::getResourceString( RID_STR_REMOVING_PACKAGES ) ),
- m_sDefaultCmd( ExtMgrDialog::getResourceString( RID_STR_ADD_PACKAGES ) ),
+ m_sEnablingPackages( DialogHelper::getResourceString( RID_STR_ENABLING_PACKAGES ) ),
+ m_sDisablingPackages( DialogHelper::getResourceString( RID_STR_DISABLING_PACKAGES ) ),
+ m_sAddingPackages( DialogHelper::getResourceString( RID_STR_ADDING_PACKAGES ) ),
+ m_sRemovingPackages( DialogHelper::getResourceString( RID_STR_REMOVING_PACKAGES ) ),
+ m_sDefaultCmd( DialogHelper::getResourceString( RID_STR_ADD_PACKAGES ) ),
m_eInput( NONE ),
m_bTerminated( false ),
m_bStopped( false ),
m_bWorking( false )
{
- OSL_ASSERT( pDialog );
+ OSL_ASSERT( pDialogHelper );
}
//------------------------------------------------------------------------------
@@ -713,41 +720,21 @@ void ExtensionCmdQueue::Thread::enableExtension( const uno::Reference< deploymen
}
//------------------------------------------------------------------------------
-void ExtensionCmdQueue::Thread::checkForUpdates( const uno::Sequence< uno::Reference< deployment::XPackageManager > > &rPackageManagers )
+void ExtensionCmdQueue::Thread::checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList )
{
::osl::MutexGuard aGuard( m_mutex );
- //If someone called stop then we do not remove the extension -> game over!
+ //If someone called stop then we do not update the extension -> game over!
if ( m_bStopped )
return;
- TExtensionCmd pEntry( new ExtensionCmd( ExtensionCmd::CHECK_FOR_UPDATES, rPackageManagers ) );
+ TExtensionCmd pEntry( new ExtensionCmd( ExtensionCmd::CHECK_FOR_UPDATES, vExtensionList ) );
m_queue.push( pEntry );
m_eInput = START;
m_wakeup.set();
}
//------------------------------------------------------------------------------
-void ExtensionCmdQueue::Thread::checkForUpdate( const uno::Reference< deployment::XPackageManager > &rPackageManager,
- const uno::Reference< deployment::XPackage > &rPackage )
-{
- ::osl::MutexGuard aGuard( m_mutex );
-
- //If someone called stop then we do not remove the extension -> game over!
- if ( m_bStopped )
- return;
-
- if ( rPackageManager.is() && rPackage.is() )
- {
- TExtensionCmd pEntry( new ExtensionCmd( ExtensionCmd::CHECK_FOR_UPDATE, rPackageManager, rPackage ) );
-
- m_queue.push( pEntry );
- m_eInput = START;
- m_wakeup.set();
- }
-}
-
-//------------------------------------------------------------------------------
//Stopping this thread will not abort the installation of extensions.
void ExtensionCmdQueue::Thread::stop()
{
@@ -779,7 +766,7 @@ void ExtensionCmdQueue::Thread::execute()
{
#ifdef WNT
//Needed for use of the service "com.sun.star.system.SystemShellExecute" in
- //ExtMgrDialog::openWebBrowser
+ //DialogHelper::openWebBrowser
CoUninitialize();
HRESULT r = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
#endif
@@ -813,7 +800,7 @@ void ExtensionCmdQueue::Thread::execute()
if ( eInput == STOP )
break;
- ::rtl::Reference< ProgressCmdEnv > currentCmdEnv( new ProgressCmdEnv( m_xContext, m_pDialog, m_sDefaultCmd ) );
+ ::rtl::Reference< ProgressCmdEnv > currentCmdEnv( new ProgressCmdEnv( m_xContext, m_pDialogHelper, m_sDefaultCmd ) );
// Do not lock the following part with addExtension. addExtension may be called in the main thread.
// If the message box "Do you want to install the extension (or similar)" is shown and then
@@ -836,8 +823,7 @@ void ExtensionCmdQueue::Thread::execute()
m_queue.pop();
}
- if ( bStartProgress && ( pEntry->m_eCmdType != ExtensionCmd::CHECK_FOR_UPDATE ) &&
- ( pEntry->m_eCmdType != ExtensionCmd::CHECK_FOR_UPDATES ) )
+ if ( bStartProgress && ( pEntry->m_eCmdType != ExtensionCmd::CHECK_FOR_UPDATES ) )
{
currentCmdEnv->startProgress();
bStartProgress = false;
@@ -856,9 +842,8 @@ void ExtensionCmdQueue::Thread::execute()
case ExtensionCmd::DISABLE :
_disableExtension( currentCmdEnv, pEntry->m_xPackage );
break;
- case ExtensionCmd::CHECK_FOR_UPDATE :
case ExtensionCmd::CHECK_FOR_UPDATES :
- _checkForUpdates( pEntry->m_xPackageManagers, pEntry->m_xPackageManager, pEntry->m_xPackage );
+ _checkForUpdates( pEntry->m_vExtensionList );
break;
}
}
@@ -908,7 +893,8 @@ void ExtensionCmdQueue::Thread::execute()
const ::vos::OGuard guard( Application::GetSolarMutex() );
::std::auto_ptr<ErrorBox> box(
new ErrorBox( currentCmdEnv->activeDialog(), WB_OK, msg ) );
- box->SetText( m_pDialog->GetText() );
+ if ( m_pDialogHelper )
+ box->SetText( m_pDialogHelper->getWindow()->GetText() );
box->Execute();
//Continue with installation of the remaining extensions
}
@@ -1009,21 +995,14 @@ void ExtensionCmdQueue::Thread::_removeExtension( ::rtl::Reference< ProgressCmdE
}
//------------------------------------------------------------------------------
-void ExtensionCmdQueue::Thread::_checkForUpdates( const uno::Sequence< uno::Reference< deployment::XPackageManager > > &rPackageManagers,
- const uno::Reference< deployment::XPackageManager > &xPackageManager,
- const uno::Reference< deployment::XPackage > &xPackage )
+void ExtensionCmdQueue::Thread::_checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList )
{
UpdateDialog* pUpdateDialog;
std::vector< UpdateData > vData;
const ::vos::OGuard guard( Application::GetSolarMutex() );
- if ( xPackageManager.is() && xPackage.is() )
- pUpdateDialog = new UpdateDialog( m_xContext, m_pDialog, new SelectedPackage( xPackage, xPackageManager ),
- uno::Sequence< uno::Reference< deployment::XPackageManager > >(), &vData );
- else
- pUpdateDialog = new UpdateDialog( m_xContext, m_pDialog, rtl::Reference< SelectedPackage >(),
- rPackageManagers, &vData );
+ pUpdateDialog = new UpdateDialog( m_xContext, m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, vExtensionList, &vData );
pUpdateDialog->notifyMenubar( true, false ); // prepare the checking, if there updates to be notified via menu bar icon
@@ -1046,7 +1025,7 @@ void ExtensionCmdQueue::Thread::_checkForUpdates( const uno::Sequence< uno::Refe
short nDialogResult = RET_OK;
if ( !dataDownload.empty() )
{
- nDialogResult = UpdateInstallDialog( m_pDialog, dataDownload, m_xContext ).Execute();
+ nDialogResult = UpdateInstallDialog( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, dataDownload, m_xContext ).Execute();
pUpdateDialog->notifyMenubar( false, true ); // Check, if there are still pending updates to be notified via menu bar icon
}
else
@@ -1057,8 +1036,8 @@ void ExtensionCmdQueue::Thread::_checkForUpdates( const uno::Sequence< uno::Refe
{
for ( cit i = vData.begin(); i < vData.end(); i++ )
{
- if ( i->sWebsiteURL.getLength() > 0 )
- m_pDialog->openWebBrowser( i->sWebsiteURL );
+ if ( m_pDialogHelper && ( i->sWebsiteURL.getLength() > 0 ) )
+ m_pDialogHelper->openWebBrowser( i->sWebsiteURL, m_pDialogHelper->getWindow()->GetText() );
}
}
}
@@ -1082,7 +1061,8 @@ void ExtensionCmdQueue::Thread::_enableExtension( ::rtl::Reference< ProgressCmdE
try
{
xPackage->registerPackage( xAbortChannel, rCmdEnv.get() );
- m_pDialog->updatePackageInfo( xPackage );
+ if ( m_pDialogHelper )
+ m_pDialogHelper->updatePackageInfo( xPackage );
}
catch ( ::ucb::CommandAbortedException & )
{}
@@ -1102,7 +1082,8 @@ void ExtensionCmdQueue::Thread::_disableExtension( ::rtl::Reference< ProgressCmd
try
{
xPackage->revokePackage( xAbortChannel, rCmdEnv.get() );
- m_pDialog->updatePackageInfo( xPackage );
+ if ( m_pDialogHelper )
+ m_pDialogHelper->updatePackageInfo( xPackage );
}
catch ( ::ucb::CommandAbortedException & )
{}
@@ -1139,10 +1120,10 @@ OUString ExtensionCmdQueue::Thread::searchAndReplaceAll( const OUString &rSource
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-ExtensionCmdQueue::ExtensionCmdQueue( ExtMgrDialog * pDialog,
+ExtensionCmdQueue::ExtensionCmdQueue( DialogHelper * pDialogHelper,
TheExtensionManager *pManager,
const uno::Reference< uno::XComponentContext > &rContext )
- : m_thread( new Thread( pDialog, pManager, rContext ) )
+ : m_thread( new Thread( pDialogHelper, pManager, rContext ) )
{
m_thread->launch();
}
@@ -1170,15 +1151,9 @@ void ExtensionCmdQueue::enableExtension( const uno::Reference< deployment::XPack
m_thread->enableExtension( rPackage, bEnable );
}
-void ExtensionCmdQueue::checkForUpdates( const uno::Sequence< uno::Reference< deployment::XPackageManager > > &rPackageManagers )
-{
- m_thread->checkForUpdates( rPackageManagers );
-}
-
-void ExtensionCmdQueue::checkForUpdate( const uno::Reference< deployment::XPackageManager > &rPackageManager,
- const uno::Reference< deployment::XPackage > &rPackage )
+void ExtensionCmdQueue::checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList )
{
- m_thread->checkForUpdate( rPackageManager, rPackage );
+ m_thread->checkForUpdates( vExtensionList );
}
void ExtensionCmdQueue::stop()
diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx
index 06ecefd7749b..2d24f00e3c8e 100644
--- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx
+++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx
@@ -32,19 +32,14 @@
#ifndef INCLUDED_DP_GUI_EXTENSIONCMDQUEUE_HXX
#define INCLUDED_DP_GUI_EXTENSIONCMDQUEUE_HXX
-#ifndef _SAL_CONFIG_H_
#include "sal/config.h"
-#endif
-#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
#include "com/sun/star/uno/Reference.hxx"
-#endif
-#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
-#include "com/sun/star/uno/Sequence.hxx"
-#endif
-#ifndef _RTL_REF_HXX_
#include "rtl/ref.hxx"
-#endif
+
+#include <vector>
+
+#include "dp_gui_updatedata.hxx"
/// @HTML
@@ -56,7 +51,7 @@ namespace com { namespace sun { namespace star {
namespace dp_gui {
-class ExtMgrDialog;
+class DialogHelper;
class TheExtensionManager;
/**
@@ -79,7 +74,7 @@ public:
/**
Create an instance.
*/
- ExtensionCmdQueue( ExtMgrDialog * pDialog,
+ ExtensionCmdQueue( DialogHelper * pDialogHelper,
TheExtensionManager *pManager,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rContext);
@@ -94,9 +89,7 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &rPackage );
void enableExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &rPackage,
const bool bEnable );
- void checkForUpdates( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > > &rPackageManagers );
- void checkForUpdate( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &rPackageManager,
- const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &rPackage );
+ void checkForUpdates( const std::vector< TUpdateListEntry > &vList );
/**
This call does not block. It signals the internal thread
that it should install the remaining extensions and then terminate.
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
new file mode 100644
index 000000000000..f4473c2c6fd8
--- /dev/null
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
@@ -0,0 +1,1175 @@
+/*************************************************************************
+ *
+ * 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_desktop.hxx"
+
+#include "svtools/controldims.hrc"
+
+#include "dp_gui.h"
+#include "dp_gui_extlistbox.hxx"
+#include "dp_gui_theextmgr.hxx"
+#include "dp_gui_dialog2.hxx"
+#include "dp_dependencies.hxx"
+
+#include "comphelper/processfactory.hxx"
+#include "com/sun/star/i18n/CollatorOptions.hpp"
+#include "com/sun/star/deployment/DependencyException.hpp"
+#include "com/sun/star/deployment/DeploymentException.hpp"
+
+
+#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
+
+using namespace ::com::sun::star;
+
+namespace dp_gui {
+
+//------------------------------------------------------------------------------
+// struct Entry_Impl
+//------------------------------------------------------------------------------
+Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage,
+ const uno::Reference< deployment::XPackageManager > &xPackageManager,
+ PackageState eState ) :
+ m_bActive( false ),
+ m_bLocked( false ),
+ m_bHasOptions( false ),
+ m_bShared( false ),
+ m_bNew( false ),
+ m_bChecked( false ),
+ m_bMissingDeps( false ),
+ m_eState( eState ),
+ m_pPublisher( NULL ),
+ m_xPackage( xPackage ),
+ m_xPackageManager( xPackageManager )
+{
+ m_sTitle = xPackage->getDisplayName();
+ m_sVersion = xPackage->getVersion();
+ m_sDescription = xPackage->getDescription();
+
+ beans::StringPair aInfo( m_xPackage->getPublisherInfo() );
+ m_sPublisher = aInfo.First;
+ m_sPublisherURL = aInfo.Second;
+
+ // get the icons for the package if there are any
+ uno::Reference< graphic::XGraphic > xGraphic = xPackage->getIcon( false );
+ if ( xGraphic.is() )
+ m_aIcon = Image( xGraphic );
+
+ xGraphic = xPackage->getIcon( true );
+ if ( xGraphic.is() )
+ m_aIconHC = Image( xGraphic );
+ else
+ m_aIconHC = m_aIcon;
+
+ m_bLocked = m_xPackageManager->isReadOnly();
+
+ if ( eState == AMBIGUOUS )
+ m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS );
+ else if ( eState == NOT_REGISTERED )
+ checkDependencies();
+}
+
+//------------------------------------------------------------------------------
+Entry_Impl::~Entry_Impl()
+{}
+
+//------------------------------------------------------------------------------
+StringCompare Entry_Impl::CompareTo( const CollatorWrapper *pCollator, const TEntry_Impl pEntry ) const
+{
+ StringCompare eCompare = (StringCompare) pCollator->compareString( m_sTitle, pEntry->m_sTitle );
+ if ( eCompare == COMPARE_EQUAL )
+ {
+ eCompare = m_sVersion.CompareTo( pEntry->m_sVersion );
+ if ( eCompare == COMPARE_EQUAL )
+ {
+ if ( m_xPackageManager != pEntry->m_xPackageManager )
+ {
+ sal_Int32 nCompare = m_xPackageManager->getContext().compareTo( pEntry->m_xPackageManager->getContext() );
+ if ( nCompare < 0 )
+ eCompare = COMPARE_LESS;
+ else if ( nCompare > 0 )
+ eCompare = COMPARE_GREATER;
+ }
+ }
+ }
+ return eCompare;
+}
+
+//------------------------------------------------------------------------------
+void Entry_Impl::checkDependencies()
+{
+ try {
+ m_xPackage->checkDependencies( uno::Reference< ucb::XCommandEnvironment >() );
+ }
+ catch ( deployment::DeploymentException &e )
+ {
+ deployment::DependencyException depExc;
+ if ( e.Cause >>= depExc )
+ {
+ rtl::OUString aMissingDep( DialogHelper::getResourceString( RID_STR_ERROR_MISSING_DEPENDENCIES ) );
+ for ( sal_Int32 i = 0; i < depExc.UnsatisfiedDependencies.getLength(); ++i )
+ {
+ aMissingDep += OUSTR("\n");
+ aMissingDep += dp_misc::Dependencies::getErrorText( depExc.UnsatisfiedDependencies[i]);
+ }
+ aMissingDep += OUSTR("\n");
+ m_sErrorText = aMissingDep;
+ m_bMissingDeps = true;
+ }
+ }
+}
+//------------------------------------------------------------------------------
+// ExtensionRemovedListener
+//------------------------------------------------------------------------------
+void ExtensionRemovedListener::disposing( lang::EventObject const & rEvt )
+ throw ( uno::RuntimeException )
+{
+ uno::Reference< deployment::XPackage > xPackage( rEvt.Source, uno::UNO_QUERY );
+
+ if ( xPackage.is() )
+ {
+ m_pParent->removeEntry( xPackage );
+ }
+}
+
+//------------------------------------------------------------------------------
+ExtensionRemovedListener::~ExtensionRemovedListener()
+{
+}
+
+//------------------------------------------------------------------------------
+// ExtensionBox_Impl
+//------------------------------------------------------------------------------
+ExtensionBox_Impl::ExtensionBox_Impl( Dialog* pParent, TheExtensionManager *pManager ) :
+ IExtensionListBox( pParent, WB_BORDER | WB_TABSTOP | WB_CHILDDLGCTRL ),
+ m_bHasScrollBar( false ),
+ m_bHasActive( false ),
+ m_bNeedsRecalc( true ),
+ m_bHasNew( false ),
+ m_bInCheckMode( false ),
+ m_bAdjustActive( false ),
+ m_bInDelete( false ),
+ m_nActive( 0 ),
+ m_nTopIndex( 0 ),
+ m_nActiveHeight( 0 ),
+ m_nExtraHeight( 2 ),
+ m_aLockedImage( DialogHelper::getResId( RID_IMG_LOCKED ) ),
+ m_aLockedImageHC( DialogHelper::getResId( RID_IMG_LOCKED_HC ) ),
+ m_aWarningImage( DialogHelper::getResId( RID_IMG_WARNING ) ),
+ m_aWarningImageHC( DialogHelper::getResId( RID_IMG_WARNING_HC ) ),
+ m_aDefaultImage( DialogHelper::getResId( RID_IMG_EXTENSION ) ),
+ m_aDefaultImageHC( DialogHelper::getResId( RID_IMG_EXTENSION_HC ) ),
+ m_pScrollBar( NULL ),
+ m_pManager( pManager )
+{
+ SetHelpId( HID_EXTENSION_MANAGER_LISTBOX );
+
+ m_pScrollBar = new ScrollBar( this, WB_VERT );
+ m_pScrollBar->SetScrollHdl( LINK( this, ExtensionBox_Impl, ScrollHdl ) );
+ m_pScrollBar->EnableDrag();
+
+ SetPaintTransparent( true );
+ SetPosPixel( Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP ) );
+ long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE;
+ long nTitleHeight = 2*TOP_OFFSET + GetTextHeight();
+ if ( nIconHeight < nTitleHeight )
+ m_nStdHeight = nTitleHeight;
+ else
+ m_nStdHeight = nIconHeight;
+ m_nStdHeight += GetTextHeight() + TOP_OFFSET;
+
+ nIconHeight = ICON_HEIGHT + 2*TOP_OFFSET + 1;
+ if ( m_nStdHeight < nIconHeight )
+ m_nStdHeight = nIconHeight;
+
+ m_nActiveHeight = m_nStdHeight;
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ if( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( rStyleSettings.GetFieldColor() );
+
+ m_xRemoveListener = new ExtensionRemovedListener( this );
+
+ m_pLocale = new lang::Locale( Application::GetSettings().GetLocale() );
+ m_pCollator = new CollatorWrapper( ::comphelper::getProcessServiceFactory() );
+ m_pCollator->loadDefaultCollator( *m_pLocale, i18n::CollatorOptions::CollatorOptions_IGNORE_CASE );
+
+ Show();
+}
+
+//------------------------------------------------------------------------------
+ExtensionBox_Impl::~ExtensionBox_Impl()
+{
+ if ( ! m_bInDelete )
+ DeleteRemoved();
+
+ m_bInDelete = true;
+
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+
+ for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ {
+ if ( (*iIndex)->m_pPublisher )
+ {
+ delete (*iIndex)->m_pPublisher;
+ (*iIndex)->m_pPublisher = NULL;
+ }
+ (*iIndex)->m_xPackage->removeEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) );
+ }
+
+ m_vEntries.clear();
+
+ delete m_pScrollBar;
+
+ m_xRemoveListener.clear();
+
+ delete m_pLocale;
+ delete m_pCollator;
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 ExtensionBox_Impl::getItemCount() const
+{
+ return static_cast< sal_Int32 >( m_vEntries.size() );
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 ExtensionBox_Impl::getSelIndex() const
+{
+ if ( m_bHasActive )
+ {
+ OSL_ASSERT( m_nActive >= -1);
+ return static_cast< sal_Int32 >( m_nActive );
+ }
+ else
+ return static_cast< sal_Int32 >( EXTENSION_LISTBOX_ENTRY_NOTFOUND );
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::checkIndex( sal_Int32 nIndex ) const
+{
+ if ( nIndex < 0 )
+ throw lang::IllegalArgumentException( OUSTR("The list index starts with 0"),0, 0 );
+ if ( static_cast< sal_uInt32 >( nIndex ) >= m_vEntries.size())
+ throw lang::IllegalArgumentException( OUSTR("There is no element at the provided position."
+ "The position exceeds the number of available list entries"),0, 0 );
+}
+
+//------------------------------------------------------------------------------
+rtl::OUString ExtensionBox_Impl::getItemName( sal_Int32 nIndex ) const
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ checkIndex( nIndex );
+ return m_vEntries[ nIndex ]->m_sTitle;
+}
+
+//------------------------------------------------------------------------------
+rtl::OUString ExtensionBox_Impl::getItemVersion( sal_Int32 nIndex ) const
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ checkIndex( nIndex );
+ return m_vEntries[ nIndex ]->m_sVersion;
+}
+
+//------------------------------------------------------------------------------
+rtl::OUString ExtensionBox_Impl::getItemDescription( sal_Int32 nIndex ) const
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ checkIndex( nIndex );
+ return m_vEntries[ nIndex ]->m_sDescription;
+}
+
+//------------------------------------------------------------------------------
+rtl::OUString ExtensionBox_Impl::getItemPublisher( sal_Int32 nIndex ) const
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ checkIndex( nIndex );
+ return m_vEntries[ nIndex ]->m_sPublisher;
+}
+
+//------------------------------------------------------------------------------
+rtl::OUString ExtensionBox_Impl::getItemPublisherLink( sal_Int32 nIndex ) const
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ checkIndex( nIndex );
+ return m_vEntries[ nIndex ]->m_sPublisherURL;
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::select( sal_Int32 nIndex )
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ checkIndex( nIndex );
+ selectEntry( nIndex );
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::select( const rtl::OUString & sName )
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ typedef ::std::vector< TEntry_Impl >::const_iterator It;
+
+ for ( It iIter = m_vEntries.begin(); iIter < m_vEntries.end(); iIter++ )
+ {
+ if ( sName.equals( (*iIter)->m_sTitle ) )
+ {
+ long nPos = iIter - m_vEntries.begin();
+ selectEntry( nPos );
+ break;
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+// Title + description
+void ExtensionBox_Impl::CalcActiveHeight( const long nPos )
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+
+ // get title height
+ long aTextHeight;
+ long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE;
+ long nTitleHeight = 2*TOP_OFFSET + GetTextHeight();
+ if ( nIconHeight < nTitleHeight )
+ aTextHeight = nTitleHeight;
+ else
+ aTextHeight = nIconHeight;
+
+ // calc description height
+ Size aSize = GetOutputSizePixel();
+ if ( m_bHasScrollBar )
+ aSize.Width() -= m_pScrollBar->GetSizePixel().Width();
+
+ aSize.Width() -= ICON_OFFSET;
+ aSize.Height() = 10000;
+
+ rtl::OUString aText( m_vEntries[ nPos ]->m_sErrorText );
+ aText += m_vEntries[ nPos ]->m_sDescription;
+
+ Rectangle aRect = GetTextRect( Rectangle( Point(), aSize ), aText,
+ TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
+ aTextHeight += aRect.GetHeight();
+
+ if ( aTextHeight < m_nStdHeight )
+ aTextHeight = m_nStdHeight;
+
+ m_nActiveHeight = aTextHeight + m_nExtraHeight;
+}
+
+//------------------------------------------------------------------------------
+const Size ExtensionBox_Impl::GetMinOutputSizePixel() const
+{
+ return Size( 200, 80 );
+}
+
+//------------------------------------------------------------------------------
+Rectangle ExtensionBox_Impl::GetEntryRect( const long nPos ) const
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+
+ Size aSize( GetOutputSizePixel() );
+
+ if ( m_bHasScrollBar )
+ aSize.Width() -= m_pScrollBar->GetSizePixel().Width();
+
+ if ( m_vEntries[ nPos ]->m_bActive )
+ aSize.Height() = m_nActiveHeight;
+ else
+ aSize.Height() = m_nStdHeight;
+
+ Point aPos( 0, -m_nTopIndex + nPos * m_nStdHeight );
+ if ( m_bHasActive && ( nPos < m_nActive ) )
+ aPos.Y() += m_nActiveHeight - m_nStdHeight;
+
+ return Rectangle( aPos, aSize );
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::DeleteRemoved()
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+
+ m_bInDelete = true;
+
+ if ( ! m_vRemovedEntries.empty() )
+ {
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+
+ for ( ITER iIndex = m_vRemovedEntries.begin(); iIndex < m_vRemovedEntries.end(); ++iIndex )
+ {
+ if ( (*iIndex)->m_pPublisher )
+ {
+ delete (*iIndex)->m_pPublisher;
+ (*iIndex)->m_pPublisher = NULL;
+ }
+ }
+
+ m_vRemovedEntries.clear();
+ }
+
+ m_bInDelete = false;
+}
+
+//------------------------------------------------------------------------------
+//This function may be called with nPos < 0
+void ExtensionBox_Impl::selectEntry( const long nPos )
+{
+ //ToDo whe should not use the guard at such a big scope here.
+ //Currently it is used to gard m_vEntries and m_nActive. m_nActive will be
+ //modified in this function.
+ //It would be probably best to always use a copy of m_vEntries
+ //and some other state variables from ExtensionBox_Impl for
+ //the whole painting operation. See issue i86993
+ ::osl::ClearableMutexGuard guard(m_entriesMutex);
+
+ if ( m_bInCheckMode )
+ return;
+
+ if ( m_bHasActive )
+ {
+ if ( nPos == m_nActive )
+ return;
+
+ m_bHasActive = false;
+ m_vEntries[ m_nActive ]->m_bActive = false;
+ }
+
+ if ( ( nPos >= 0 ) && ( nPos < (long) m_vEntries.size() ) )
+ {
+ m_bHasActive = true;
+ m_nActive = nPos;
+ m_vEntries[ nPos ]->m_bActive = true;
+
+ if ( IsReallyVisible() )
+ {
+ m_bNeedsRecalc = true;
+ m_bAdjustActive = true;
+ }
+ }
+
+ if ( IsReallyVisible() )
+ Invalidate();
+
+ guard.clear();
+}
+
+// -----------------------------------------------------------------------
+void ExtensionBox_Impl::DrawRow( const Rectangle& rRect, const TEntry_Impl pEntry )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if ( pEntry->m_bActive )
+ SetTextColor( rStyleSettings.GetHighlightTextColor() );
+ else if ( ( pEntry->m_eState != REGISTERED ) && ( pEntry->m_eState != NOT_AVAILABLE ) )
+ SetTextColor( rStyleSettings.GetDisableColor() );
+ else if ( IsControlForeground() )
+ SetTextColor( GetControlForeground() );
+ else
+ SetTextColor( rStyleSettings.GetFieldTextColor() );
+
+ if ( pEntry->m_bActive )
+ {
+ SetLineColor();
+ SetFillColor( rStyleSettings.GetHighlightColor() );
+ DrawRect( rRect );
+ }
+ else
+ {
+ if( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( rStyleSettings.GetFieldColor() );
+
+ SetTextFillColor();
+ Erase( rRect );
+ }
+
+ // Draw extension icon
+ Point aPos( rRect.TopLeft() );
+ aPos += Point( TOP_OFFSET, TOP_OFFSET );
+ Image aImage;
+ if ( ! pEntry->m_aIcon )
+ aImage = isHCMode() ? m_aDefaultImageHC : m_aDefaultImage;
+ else
+ aImage = isHCMode() ? pEntry->m_aIconHC : pEntry->m_aIcon;
+ Size aImageSize = aImage.GetSizePixel();
+ if ( ( aImageSize.Width() <= ICON_HEIGHT ) && ( aImageSize.Height() <= ICON_HEIGHT ) )
+ DrawImage( Point( aPos.X()+((ICON_HEIGHT-aImageSize.Width())/2), aPos.Y()+((ICON_HEIGHT-aImageSize.Height())/2) ), aImage );
+ else
+ DrawImage( aPos, Size( ICON_HEIGHT, ICON_HEIGHT ), aImage );
+
+ // Setup fonts
+ Font aStdFont( GetFont() );
+ Font aBoldFont( aStdFont );
+ aBoldFont.SetWeight( WEIGHT_BOLD );
+ SetFont( aBoldFont );
+ long aTextHeight = GetTextHeight();
+
+ // Init publisher link here
+ if ( !pEntry->m_pPublisher && pEntry->m_sPublisher.Len() )
+ {
+ pEntry->m_pPublisher = new svt::FixedHyperlink( this );
+ pEntry->m_pPublisher->SetBackground();
+ pEntry->m_pPublisher->SetPaintTransparent( true );
+ pEntry->m_pPublisher->SetURL( pEntry->m_sPublisherURL );
+ pEntry->m_pPublisher->SetDescription( pEntry->m_sPublisher );
+ Size aSize = FixedText::CalcMinimumTextSize( pEntry->m_pPublisher );
+ pEntry->m_pPublisher->SetSizePixel( aSize );
+
+ if ( m_aClickHdl.IsSet() )
+ pEntry->m_pPublisher->SetClickHdl( m_aClickHdl );
+ }
+
+ // Get max title width
+ long nMaxTitleWidth = rRect.GetWidth() - ICON_OFFSET;
+ nMaxTitleWidth -= ( 2 * SMALL_ICON_SIZE ) + ( 4 * SPACE_BETWEEN );
+ if ( pEntry->m_pPublisher )
+ {
+ nMaxTitleWidth -= pEntry->m_pPublisher->GetSizePixel().Width() + (2*SPACE_BETWEEN);
+ }
+
+ long aVersionWidth = GetTextWidth( pEntry->m_sVersion );
+ long aTitleWidth = GetTextWidth( pEntry->m_sTitle ) + (aTextHeight / 3);
+
+ aPos = rRect.TopLeft() + Point( ICON_OFFSET, TOP_OFFSET );
+
+ if ( aTitleWidth > nMaxTitleWidth - aVersionWidth )
+ {
+ aTitleWidth = nMaxTitleWidth - aVersionWidth - (aTextHeight / 3);
+ String aShortTitle = GetEllipsisString( pEntry->m_sTitle, aTitleWidth );
+ DrawText( aPos, aShortTitle );
+ aTitleWidth += (aTextHeight / 3);
+ }
+ else
+ DrawText( aPos, pEntry->m_sTitle );
+
+ SetFont( aStdFont );
+ DrawText( Point( aPos.X() + aTitleWidth, aPos.Y() ), pEntry->m_sVersion );
+
+ long nIconHeight = TOP_OFFSET + SMALL_ICON_SIZE;
+ long nTitleHeight = TOP_OFFSET + GetTextHeight();
+ if ( nIconHeight < nTitleHeight )
+ aTextHeight = nTitleHeight;
+ else
+ aTextHeight = nIconHeight;
+
+ // draw description
+ String sDescription;
+ if ( pEntry->m_sErrorText.Len() )
+ {
+ if ( pEntry->m_bActive )
+ sDescription = pEntry->m_sErrorText + OUSTR("\n") + pEntry->m_sDescription;
+ else
+ sDescription = pEntry->m_sErrorText;
+ }
+ else
+ sDescription = pEntry->m_sDescription;
+
+ aPos.Y() += aTextHeight;
+ if ( pEntry->m_bActive )
+ {
+ DrawText( Rectangle( aPos.X(), aPos.Y(), rRect.Right(), rRect.Bottom() - m_nExtraHeight ),
+ sDescription, TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
+ }
+ else
+ {
+ const long nWidth = GetTextWidth( sDescription );
+ if ( nWidth > rRect.GetWidth() - aPos.X() )
+ sDescription = GetEllipsisString( sDescription, rRect.GetWidth() - aPos.X() );
+ DrawText( aPos, sDescription );
+ }
+
+ // Draw publisher link
+ if ( pEntry->m_pPublisher )
+ {
+ pEntry->m_pPublisher->Show();
+ aPos = rRect.TopLeft() + Point( ICON_OFFSET + nMaxTitleWidth + (2*SPACE_BETWEEN), TOP_OFFSET );
+ pEntry->m_pPublisher->SetPosPixel( aPos );
+ }
+
+ // Draw status icons
+ if ( pEntry->m_bShared )
+ {
+ aPos = rRect.TopRight() + Point( -(RIGHT_ICON_OFFSET + SMALL_ICON_SIZE), TOP_OFFSET );
+ DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aLockedImageHC : m_aLockedImage );
+ }
+ if ( ( pEntry->m_eState == AMBIGUOUS ) || pEntry->m_bMissingDeps )
+ {
+ aPos = rRect.TopRight() + Point( -(RIGHT_ICON_OFFSET + SPACE_BETWEEN + 2*SMALL_ICON_SIZE), TOP_OFFSET );
+ DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aWarningImageHC : m_aWarningImage );
+ }
+
+ SetLineColor( Color( COL_LIGHTGRAY ) );
+ DrawLine( rRect.BottomLeft(), rRect.BottomRight() );
+}
+
+// -----------------------------------------------------------------------
+void ExtensionBox_Impl::RecalcAll()
+{
+ if ( m_bHasActive )
+ CalcActiveHeight( m_nActive );
+
+ SetupScrollBar();
+
+ if ( m_bHasActive )
+ {
+ Rectangle aEntryRect = GetEntryRect( m_nActive );
+
+ if ( m_bAdjustActive )
+ {
+ m_bAdjustActive = false;
+
+ // If the top of the selected entry isn't visible, make it visible
+ if ( aEntryRect.Top() < 0 )
+ {
+ m_nTopIndex += aEntryRect.Top();
+ aEntryRect.Move( 0, -aEntryRect.Top() );
+ }
+
+ // If the bottom of the selected entry isn't visible, make it visible even if now the top
+ // isn't visible any longer ( the buttons are more important )
+ Size aOutputSize = GetOutputSizePixel();
+ if ( aEntryRect.Bottom() > aOutputSize.Height() )
+ {
+ m_nTopIndex += ( aEntryRect.Bottom() - aOutputSize.Height() );
+ aEntryRect.Move( 0, -( aEntryRect.Bottom() - aOutputSize.Height() ) );
+ }
+
+ // If there is unused space below the last entry but all entries don't fit into the box,
+ // move the content down to use the whole space
+ const long nTotalHeight = GetTotalHeight();
+ if ( m_bHasScrollBar && ( aOutputSize.Height() + m_nTopIndex > nTotalHeight ) )
+ {
+ long nOffset = m_nTopIndex;
+ m_nTopIndex = nTotalHeight - aOutputSize.Height();
+ nOffset -= m_nTopIndex;
+ aEntryRect.Move( 0, nOffset );
+ }
+
+ if ( m_bHasScrollBar )
+ m_pScrollBar->SetThumbPos( m_nTopIndex );
+ }
+ }
+
+ m_bNeedsRecalc = false;
+}
+
+// -----------------------------------------------------------------------
+bool ExtensionBox_Impl::HandleTabKey( bool )
+{
+ return false;
+}
+
+// -----------------------------------------------------------------------
+bool ExtensionBox_Impl::HandleCursorKey( USHORT nKeyCode )
+{
+ if ( m_vEntries.empty() )
+ return true;
+
+ long nSelect = 0;
+
+ if ( m_bHasActive )
+ {
+ long nPageSize = GetOutputSizePixel().Height() / m_nStdHeight;
+ if ( nPageSize < 2 )
+ nPageSize = 2;
+
+ if ( ( nKeyCode == KEY_DOWN ) || ( nKeyCode == KEY_RIGHT ) )
+ nSelect = m_nActive + 1;
+ else if ( ( nKeyCode == KEY_UP ) || ( nKeyCode == KEY_LEFT ) )
+ nSelect = m_nActive - 1;
+ else if ( nKeyCode == KEY_HOME )
+ nSelect = 0;
+ else if ( nKeyCode == KEY_END )
+ nSelect = m_vEntries.size() - 1;
+ else if ( nKeyCode == KEY_PAGEUP )
+ nSelect = m_nActive - nPageSize + 1;
+ else if ( nKeyCode == KEY_PAGEDOWN )
+ nSelect = m_nActive + nPageSize - 1;
+ }
+ else // when there is no selected entry, we will select the first or the last.
+ {
+ if ( ( nKeyCode == KEY_DOWN ) || ( nKeyCode == KEY_PAGEDOWN ) || ( nKeyCode == KEY_HOME ) )
+ nSelect = 0;
+ else if ( ( nKeyCode == KEY_UP ) || ( nKeyCode == KEY_PAGEUP ) || ( nKeyCode == KEY_END ) )
+ nSelect = m_vEntries.size() - 1;
+ }
+
+ if ( nSelect < 0 )
+ nSelect = 0;
+ if ( nSelect >= (long) m_vEntries.size() )
+ nSelect = m_vEntries.size() - 1;
+
+ selectEntry( nSelect );
+
+ return true;
+}
+
+// -----------------------------------------------------------------------
+void ExtensionBox_Impl::Paint( const Rectangle &/*rPaintRect*/ )
+{
+ if ( !m_bInDelete )
+ DeleteRemoved();
+
+ if ( m_bNeedsRecalc )
+ RecalcAll();
+
+ Point aStart( 0, -m_nTopIndex );
+ Size aSize( GetOutputSizePixel() );
+
+ if ( m_bHasScrollBar )
+ aSize.Width() -= m_pScrollBar->GetSizePixel().Width();
+
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+ for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ {
+ aSize.Height() = (*iIndex)->m_bActive ? m_nActiveHeight : m_nStdHeight;
+ Rectangle aEntryRect( aStart, aSize );
+ DrawRow( aEntryRect, *iIndex );
+ aStart.Y() += aSize.Height();
+ }
+}
+
+// -----------------------------------------------------------------------
+long ExtensionBox_Impl::GetTotalHeight() const
+{
+ long nHeight = m_vEntries.size() * m_nStdHeight;
+
+ if ( m_bHasActive )
+ {
+ nHeight += m_nActiveHeight - m_nStdHeight;
+ }
+
+ return nHeight;
+}
+
+// -----------------------------------------------------------------------
+void ExtensionBox_Impl::SetupScrollBar()
+{
+ const Size aSize = GetOutputSizePixel();
+ const long nScrBarSize = GetSettings().GetStyleSettings().GetScrollBarSize();
+ const long nTotalHeight = GetTotalHeight();
+ const bool bNeedsScrollBar = ( nTotalHeight > aSize.Height() );
+
+ if ( bNeedsScrollBar )
+ {
+ if ( m_nTopIndex + aSize.Height() > nTotalHeight )
+ m_nTopIndex = nTotalHeight - aSize.Height();
+
+ m_pScrollBar->SetPosSizePixel( Point( aSize.Width() - nScrBarSize, 0 ),
+ Size( nScrBarSize, aSize.Height() ) );
+ m_pScrollBar->SetRangeMax( nTotalHeight );
+ m_pScrollBar->SetVisibleSize( aSize.Height() );
+ m_pScrollBar->SetPageSize( ( aSize.Height() * 4 ) / 5 );
+ m_pScrollBar->SetLineSize( m_nStdHeight );
+ m_pScrollBar->SetThumbPos( m_nTopIndex );
+
+ if ( !m_bHasScrollBar )
+ m_pScrollBar->Show();
+ }
+ else if ( m_bHasScrollBar )
+ {
+ m_pScrollBar->Hide();
+ m_nTopIndex = 0;
+ }
+
+ m_bHasScrollBar = bNeedsScrollBar;
+}
+
+// -----------------------------------------------------------------------
+void ExtensionBox_Impl::Resize()
+{
+ RecalcAll();
+}
+
+//------------------------------------------------------------------------------
+long ExtensionBox_Impl::PointToPos( const Point& rPos )
+{
+ long nPos = ( rPos.Y() + m_nTopIndex ) / m_nStdHeight;
+
+ if ( m_bHasActive && ( nPos > m_nActive ) )
+ {
+ if ( rPos.Y() + m_nTopIndex <= m_nActive*m_nStdHeight + m_nActiveHeight )
+ nPos = m_nActive;
+ else
+ nPos = ( rPos.Y() + m_nTopIndex - (m_nActiveHeight - m_nStdHeight) ) / m_nStdHeight;
+ }
+
+ return nPos;
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ long nPos = PointToPos( rMEvt.GetPosPixel() );
+
+ if ( rMEvt.IsLeft() )
+ {
+ if ( rMEvt.IsMod1() && m_bHasActive )
+ selectEntry( m_vEntries.size() ); // Selecting an not existing entry will deselect the current one
+ else
+ selectEntry( nPos );
+ }
+}
+
+//------------------------------------------------------------------------------
+long ExtensionBox_Impl::Notify( NotifyEvent& rNEvt )
+{
+ if ( !m_bInDelete )
+ DeleteRemoved();
+
+ bool bHandled = false;
+
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ KeyCode aKeyCode = pKEvt->GetKeyCode();
+ USHORT nKeyCode = aKeyCode.GetCode();
+
+ if ( nKeyCode == KEY_TAB )
+ bHandled = HandleTabKey( aKeyCode.IsShift() );
+ else if ( aKeyCode.GetGroup() == KEYGROUP_CURSOR )
+ bHandled = HandleCursorKey( nKeyCode );
+ }
+
+ if ( rNEvt.GetType() == EVENT_COMMAND )
+ {
+ if ( m_bHasScrollBar &&
+ ( rNEvt.GetCommandEvent()->GetCommand() == COMMAND_WHEEL ) )
+ {
+ const CommandWheelData* pData = rNEvt.GetCommandEvent()->GetWheelData();
+ if ( pData->GetMode() == COMMAND_WHEEL_SCROLL )
+ {
+ long nThumbPos = m_pScrollBar->GetThumbPos();
+ if ( pData->GetDelta() < 0 )
+ m_pScrollBar->DoScroll( nThumbPos + m_nStdHeight );
+ else
+ m_pScrollBar->DoScroll( nThumbPos - m_nStdHeight );
+ bHandled = true;
+ }
+ }
+ }
+
+ if ( !bHandled )
+ return Control::Notify( rNEvt );
+ else
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool ExtensionBox_Impl::FindEntryPos( const TEntry_Impl pEntry, const long nStart,
+ const long nEnd, long &nPos )
+{
+ nPos = nStart;
+ if ( nStart > nEnd )
+ return false;
+
+ StringCompare eCompare;
+
+ if ( nStart == nEnd )
+ {
+ eCompare = pEntry->CompareTo( m_pCollator, m_vEntries[ nStart ] );
+ if ( eCompare == COMPARE_LESS )
+ return false;
+ else if ( eCompare == COMPARE_EQUAL )
+ {
+ //Workaround. See i86963.
+ if (pEntry->m_xPackage != m_vEntries[nStart]->m_xPackage)
+ return false;
+
+ if ( m_bInCheckMode )
+ m_vEntries[ nStart ]->m_bChecked = true;
+ return true;
+ }
+ else
+ {
+ nPos = nStart + 1;
+ return false;
+ }
+ }
+
+ const long nMid = nStart + ( ( nEnd - nStart ) / 2 );
+ eCompare = pEntry->CompareTo( m_pCollator, m_vEntries[ nMid ] );
+
+ if ( eCompare == COMPARE_LESS )
+ return FindEntryPos( pEntry, nStart, nMid-1, nPos );
+ else if ( eCompare == COMPARE_GREATER )
+ return FindEntryPos( pEntry, nMid+1, nEnd, nPos );
+ else
+ {
+ //Workaround.See i86963.
+ if (pEntry->m_xPackage != m_vEntries[nMid]->m_xPackage)
+ return false;
+
+ if ( m_bInCheckMode )
+ m_vEntries[ nMid ]->m_bChecked = true;
+ nPos = nMid;
+ return true;
+ }
+}
+
+//------------------------------------------------------------------------------
+long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > &xPackage,
+ const uno::Reference< deployment::XPackageManager > &xPackageManager )
+{
+ long nPos = 0;
+ PackageState eState = m_pManager->getPackageState( xPackage );
+
+ TEntry_Impl pEntry( new Entry_Impl( xPackage, xPackageManager, eState ) );
+ xPackage->addEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) );
+
+ ::osl::ClearableMutexGuard guard(m_entriesMutex);
+ if ( m_vEntries.empty() )
+ {
+ pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage );
+ pEntry->m_bShared = ( m_pManager->getSharedPkgMgr() == xPackageManager );
+ pEntry->m_bNew = m_bInCheckMode;
+ m_vEntries.push_back( pEntry );
+ }
+ else
+ {
+ if ( !FindEntryPos( pEntry, 0, m_vEntries.size()-1, nPos ) )
+ {
+ pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage );
+ pEntry->m_bShared = ( m_pManager->getSharedPkgMgr() == xPackageManager );
+ pEntry->m_bNew = m_bInCheckMode;
+ m_vEntries.insert( m_vEntries.begin()+nPos, pEntry );
+ }
+ else if ( !m_bInCheckMode )
+ {
+ OSL_ENSURE( 0, "ExtensionBox_Impl::addEntry(): Will not add duplicate entries" );
+ }
+ }
+ //access to m_nActive must be guarded
+ if ( !m_bInCheckMode && m_bHasActive && ( m_nActive >= nPos ) )
+ m_nActive += 1;
+
+ guard.clear();
+
+ if ( IsReallyVisible() )
+ Invalidate();
+
+ m_bNeedsRecalc = true;
+
+ return nPos;
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::updateEntry( const uno::Reference< deployment::XPackage > &xPackage )
+{
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+ for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ {
+ if ( (*iIndex)->m_xPackage == xPackage )
+ {
+ PackageState eState = m_pManager->getPackageState( xPackage );
+ (*iIndex)->m_bHasOptions = m_pManager->supportsOptions( xPackage );
+ (*iIndex)->m_eState = eState;
+ (*iIndex)->m_sTitle = xPackage->getDisplayName();
+ (*iIndex)->m_sVersion = xPackage->getVersion();
+ (*iIndex)->m_sDescription = xPackage->getDescription();
+
+ if ( eState == AMBIGUOUS )
+ (*iIndex)->m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS );
+ else
+ (*iIndex)->m_sErrorText = String();
+
+ if ( IsReallyVisible() )
+ Invalidate();
+ break;
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::removeEntry( const uno::Reference< deployment::XPackage > &xPackage )
+{
+ if ( ! m_bInDelete )
+ {
+ ::osl::ClearableMutexGuard aGuard( m_entriesMutex );
+
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+
+ for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ {
+ if ( (*iIndex)->m_xPackage == xPackage )
+ {
+ long nPos = iIndex - m_vEntries.begin();
+
+ // Entries mustn't removed here, because they contain a hyperlink control
+ // which can only be deleted when the thread has the solar mutex. Therefor
+ // the entry will be moved into the m_vRemovedEntries list which will be
+ // cleared on the next paint event
+ m_vRemovedEntries.push_back( *iIndex );
+ m_vEntries.erase( iIndex );
+
+ m_bNeedsRecalc = true;
+
+ if ( IsReallyVisible() )
+ Invalidate();
+
+ if ( m_bHasActive )
+ {
+ if ( nPos < m_nActive )
+ m_nActive -= 1;
+ else if ( ( nPos == m_nActive ) &&
+ ( nPos == (long) m_vEntries.size() ) )
+ m_nActive -= 1;
+
+ m_bHasActive = false;
+ //clear before calling out of this method
+ aGuard.clear();
+ selectEntry( m_nActive );
+ }
+ break;
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::RemoveUnlocked()
+{
+ bool bAllRemoved = false;
+
+ while ( ! bAllRemoved )
+ {
+ bAllRemoved = true;
+
+ ::osl::ClearableMutexGuard aGuard( m_entriesMutex );
+
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+
+ for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ {
+ if ( !(*iIndex)->m_bLocked )
+ {
+ bAllRemoved = false;
+ uno::Reference< deployment::XPackage> xPackage = (*iIndex)->m_xPackage;
+ aGuard.clear();
+ removeEntry( xPackage );
+ break;
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::prepareChecking( const uno::Reference< deployment::XPackageManager > &xPackageMgr )
+{
+ m_bInCheckMode = true;
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+ for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ {
+ if ( (*iIndex)->m_xPackageManager == xPackageMgr )
+ (*iIndex)->m_bChecked = false;
+ else
+ (*iIndex)->m_bChecked = true;
+ (*iIndex)->m_bNew = false;
+ }
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::checkEntries()
+{
+ long nNewPos = -1;
+ long nPos = 0;
+ bool bNeedsUpdate = false;
+
+ ::osl::ClearableMutexGuard guard(m_entriesMutex);
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+ ITER iIndex = m_vEntries.begin();
+ while ( iIndex < m_vEntries.end() )
+ {
+ if ( (*iIndex)->m_bChecked == false )
+ {
+ bNeedsUpdate = true;
+ nPos = iIndex-m_vEntries.begin();
+ if ( (*iIndex)->m_bNew )
+ {
+ if ( nNewPos == - 1)
+ nNewPos = nPos;
+ if ( nPos <= m_nActive )
+ m_nActive += 1;
+ }
+ }
+ iIndex++;
+ }
+ guard.clear();
+
+ m_bInCheckMode = false;
+
+ if ( nNewPos != - 1)
+ selectEntry( nNewPos );
+
+ if ( bNeedsUpdate )
+ {
+ m_bNeedsRecalc = true;
+ if ( IsReallyVisible() )
+ Invalidate();
+ }
+}
+//------------------------------------------------------------------------------
+bool ExtensionBox_Impl::isHCMode()
+{
+ return (bool)GetDisplayBackground().GetColor().IsDark();
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::SetScrollHdl( const Link& rLink )
+{
+ if ( m_pScrollBar )
+ m_pScrollBar->SetScrollHdl( rLink );
+}
+
+// -----------------------------------------------------------------------
+void ExtensionBox_Impl::DoScroll( long nDelta )
+{
+ m_nTopIndex += nDelta;
+ Point aNewSBPt( m_pScrollBar->GetPosPixel() );
+
+ Rectangle aScrRect( Point(), GetOutputSizePixel() );
+ aScrRect.Right() -= m_pScrollBar->GetSizePixel().Width();
+ Scroll( 0, -nDelta, aScrRect );
+
+ m_pScrollBar->SetPosPixel( aNewSBPt );
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( ExtensionBox_Impl, ScrollHdl, ScrollBar*, pScrBar )
+{
+ DoScroll( pScrBar->GetDelta() );
+
+ return 1;
+}
+
+} //namespace dp_gui
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
new file mode 100644
index 000000000000..e1a17bb06dc9
--- /dev/null
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
@@ -0,0 +1,271 @@
+/*************************************************************************
+ *
+ * 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: dp_gui_dialog2.cxx,v $
+ *
+ * $Revision: 1.8.4.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.
+ *
+ ************************************************************************/
+
+#include "rtl/ustring.hxx"
+#include "vcl/scrbar.hxx"
+#include "vcl/fixed.hxx"
+#include "vcl/dialog.hxx"
+
+#include "svtools/extensionlistbox.hxx"
+#include "svtools/fixedhyper.hxx"
+#include "cppuhelper/implbase1.hxx"
+#include "unotools/collatorwrapper.hxx"
+
+#include "com/sun/star/lang/Locale.hpp"
+#include "com/sun/star/lang/XEventListener.hpp"
+#include "com/sun/star/deployment/XPackage.hpp"
+#include "com/sun/star/deployment/XPackageManager.hpp"
+
+#include <boost/shared_ptr.hpp>
+
+namespace dp_gui {
+
+#define SMALL_ICON_SIZE 16
+#define TOP_OFFSET 3
+#define ICON_HEIGHT 42
+#define ICON_OFFSET 50
+#define RIGHT_ICON_OFFSET 5
+#define SPACE_BETWEEN 3
+
+class TheExtensionManager;
+
+typedef ::boost::shared_ptr< svt::FixedHyperlink > TFixedHyperlink;
+
+//------------------------------------------------------------------------------
+// struct Entry_Impl
+//------------------------------------------------------------------------------
+struct Entry_Impl;
+
+typedef ::boost::shared_ptr< Entry_Impl > TEntry_Impl;
+
+struct Entry_Impl
+{
+ bool m_bActive;
+ bool m_bLocked;
+ bool m_bHasOptions;
+ bool m_bShared;
+ bool m_bNew;
+ bool m_bChecked;
+ bool m_bMissingDeps;
+ PackageState m_eState;
+ String m_sTitle;
+ String m_sVersion;
+ String m_sDescription;
+ String m_sPublisher;
+ String m_sPublisherURL;
+ String m_sErrorText;
+ Image m_aIcon;
+ Image m_aIconHC;
+ svt::FixedHyperlink *m_pPublisher;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> m_xPackage;
+ ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> m_xPackageManager;
+
+ Entry_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
+ PackageState eState );
+ ~Entry_Impl();
+
+ StringCompare CompareTo( const CollatorWrapper *pCollator, const TEntry_Impl pEntry ) const;
+ void checkDependencies();
+};
+
+//------------------------------------------------------------------------------
+// class ExtensionBox_Impl
+//------------------------------------------------------------------------------
+
+class ExtensionBox_Impl;
+
+//------------------------------------------------------------------------------
+class ExtensionRemovedListener : public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener >
+{
+ ExtensionBox_Impl *m_pParent;
+
+public:
+
+ ExtensionRemovedListener( ExtensionBox_Impl *pParent ) { m_pParent = pParent; }
+ ~ExtensionRemovedListener();
+
+ //===================================================================================
+ // XEventListener
+ virtual void SAL_CALL disposing( ::com::sun::star::lang::EventObject const & evt )
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+//------------------------------------------------------------------------------
+class ExtensionBox_Impl : public ::svt::IExtensionListBox
+{
+ bool m_bHasScrollBar;
+ bool m_bHasActive;
+ bool m_bNeedsRecalc;
+ bool m_bHasNew;
+ bool m_bInCheckMode;
+ bool m_bAdjustActive;
+ bool m_bInDelete;
+ //Must be guarded together with m_vEntries to ensure a valid index at all times.
+ //Use m_entriesMutex as guard.
+ long m_nActive;
+ long m_nTopIndex;
+ long m_nStdHeight;
+ long m_nActiveHeight;
+ long m_nExtraHeight;
+ Size m_aOutputSize;
+ Image m_aLockedImage;
+ Image m_aLockedImageHC;
+ Image m_aWarningImage;
+ Image m_aWarningImageHC;
+ Image m_aDefaultImage;
+ Image m_aDefaultImageHC;
+ Link m_aClickHdl;
+
+ ScrollBar *m_pScrollBar;
+
+ com::sun::star::uno::Reference< ExtensionRemovedListener > m_xRemoveListener;
+
+ TheExtensionManager *m_pManager;
+ //This mutex is used for synchronizing access to m_vEntries.
+ //Currently it is used to synchronize adding, removing entries and
+ //functions like getItemName, getItemDescription, etc. to prevent
+ //that m_vEntries is accessed at an invalid index.
+ //ToDo: There are many more places where m_vEntries is read and which may
+ //fail. For example the Paint method is probable called from the main thread
+ //while new entries are added / removed in a separate thread.
+ mutable ::osl::Mutex m_entriesMutex;
+ std::vector< TEntry_Impl > m_vEntries;
+ std::vector< TEntry_Impl > m_vRemovedEntries;
+
+ ::com::sun::star::lang::Locale *m_pLocale;
+ CollatorWrapper *m_pCollator;
+
+ void CalcActiveHeight( const long nPos );
+ long GetTotalHeight() const;
+ void SetupScrollBar();
+ void DrawRow( const Rectangle& rRect, const TEntry_Impl pEntry );
+ bool HandleTabKey( bool bReverse );
+ bool HandleCursorKey( USHORT nKeyCode );
+ bool FindEntryPos( const TEntry_Impl pEntry, long nStart, long nEnd, long &nFound );
+ bool isHCMode();
+ void DeleteRemoved();
+
+ //-----------------
+ DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar * );
+
+ //Index starts with 1.
+ //Throws an com::sun::star::lang::IllegalArgumentException, when the index is invalid.
+ void checkIndex(sal_Int32 pos) const;
+
+
+public:
+ ExtensionBox_Impl( Dialog* pParent, TheExtensionManager *pManager );
+ ~ExtensionBox_Impl();
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void Paint( const Rectangle &rPaintRect );
+ virtual void Resize();
+ virtual long Notify( NotifyEvent& rNEvt );
+
+ const Size GetMinOutputSizePixel() const;
+ void SetExtraSize( long nSize ) { m_nExtraHeight = nSize; }
+ TEntry_Impl GetEntryData( long nPos ) { return m_vEntries[ nPos ]; }
+ long GetEntryCount() { return (long) m_vEntries.size(); }
+ Rectangle GetEntryRect( const long nPos ) const;
+ bool HasActive() { return m_bHasActive; }
+ long PointToPos( const Point& rPos );
+ void SetScrollHdl( const Link& rLink );
+ void DoScroll( long nDelta );
+ void SetHyperlinkHdl( const Link& rLink ){ m_aClickHdl = rLink; }
+ virtual void RecalcAll();
+ void RemoveUnlocked();
+
+ //-----------------
+ virtual void selectEntry( const long nPos );
+ long addEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
+ void updateEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
+ void removeEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
+
+ void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageMgr );
+ void checkEntries();
+
+ TheExtensionManager* getExtensionManager() const { return m_pManager; }
+
+ //===================================================================================
+ //These functions are used for automatic testing
+
+ /** @return The count of the entries in the list box. */
+ virtual sal_Int32 getItemCount() const;
+
+ /** @return The index of the first selected entry in the list box.
+ When nothing is selected, which is the case when getItemCount returns '0',
+ then this function returns EXTENSION_LISTBOX_ENTRY_NOTFOUND */
+ virtual sal_Int32 getSelIndex() const;
+
+ /** @return The item name of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual ::rtl::OUString getItemName( sal_Int32 index ) const;
+
+ /** @return The version string of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual ::rtl::OUString getItemVersion( sal_Int32 index ) const;
+
+ /** @return The description string of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual ::rtl::OUString getItemDescription( sal_Int32 index ) const;
+
+ /** @return The publisher string of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual ::rtl::OUString getItemPublisher( sal_Int32 index ) const;
+
+ /** @return The link behind the publisher text of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual ::rtl::OUString getItemPublisherLink( sal_Int32 index ) const;
+
+ /** The entry at the given position will be selected
+ Index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual void select( sal_Int32 pos );
+
+ /** The first found entry with the given name will be selected
+ When there was no entry found with the name, the selection doesn't change.
+ Please note that there might be more than one entry with the same
+ name, because:
+ 1. the name is not unique
+ 2. one extension can be installed as user and shared extension.
+ */
+ virtual void select( const ::rtl::OUString & sName );
+};
+
+}
diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx
index 6e61e95f07cb..ee8c5d26c24f 100644
--- a/desktop/source/deployment/gui/dp_gui_service.cxx
+++ b/desktop/source/deployment/gui/dp_gui_service.cxx
@@ -48,6 +48,7 @@
#include "boost/bind.hpp"
#include "license_dialog.hxx"
+#include "dp_gui_dialog2.hxx"
using namespace ::dp_misc;
using namespace ::com::sun::star;
@@ -271,27 +272,28 @@ void ServiceImpl::startExecuteModal(
{
const ::vos::OGuard guard( Application::GetSolarMutex() );
- ::rtl::Reference< ::dp_gui::TheExtensionManager > dialog(
+ ::rtl::Reference< ::dp_gui::TheExtensionManager > myExtMgr(
::dp_gui::TheExtensionManager::get(
m_xComponentContext,
m_parent ? *m_parent : Reference<awt::XWindow>(),
m_extensionURL ? *m_extensionURL : OUString() ) );
+ myExtMgr->createDialog( false );
if (m_initialTitle.getLength() > 0) {
- dialog->SetText( m_initialTitle );
+ myExtMgr->SetText( m_initialTitle );
m_initialTitle = OUString();
}
if ( m_bShowUpdateOnly )
{
- dialog->checkUpdates( true, !bCloseDialog );
+ myExtMgr->checkUpdates( true, !bCloseDialog );
if ( bCloseDialog )
- dialog->Close();
+ myExtMgr->Close();
else
- dialog->ToTop( TOTOP_RESTOREWHENMIN );
+ myExtMgr->ToTop( TOTOP_RESTOREWHENMIN );
}
else
{
- dialog->Show();
- dialog->ToTop( TOTOP_RESTOREWHENMIN );
+ myExtMgr->Show();
+ myExtMgr->ToTop( TOTOP_RESTOREWHENMIN );
}
}
@@ -331,6 +333,12 @@ sdecl::ServiceDecl const licenseDecl(
licenseSI,
"com.sun.star.comp.deployment.ui.LicenseDialog",
"com.sun.star.deployment.ui.LicenseDialog" );
+
+sdecl::class_<UpdateRequiredDialogService, sdecl::with_args<true> > updateSI;
+sdecl::ServiceDecl const updateDecl(
+ updateSI,
+ "com.sun.star.comp.deployment.ui.UpdateRequiredDialog",
+ "com.sun.star.deployment.ui.UpdateRequiredDialog" );
} // namespace dp_gui
extern "C" {
@@ -346,7 +354,7 @@ sal_Bool SAL_CALL component_writeInfo(
registry::XRegistryKey * pRegistryKey )
{
return component_writeInfoHelper(
- pServiceManager, pRegistryKey, dp_gui::serviceDecl, dp_gui::licenseDecl );
+ pServiceManager, pRegistryKey, dp_gui::serviceDecl, dp_gui::licenseDecl, dp_gui::updateDecl );
}
void * SAL_CALL component_getFactory(
@@ -355,7 +363,7 @@ void * SAL_CALL component_getFactory(
registry::XRegistryKey * pRegistryKey )
{
return component_getFactoryHelper(
- pImplName, pServiceManager, pRegistryKey, dp_gui::serviceDecl, dp_gui::licenseDecl );
+ pImplName, pServiceManager, pRegistryKey, dp_gui::serviceDecl, dp_gui::licenseDecl, dp_gui::updateDecl );
}
} // extern "C"
diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
index 721d67c8f35b..3d994f31c395 100644
--- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
+++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
@@ -66,7 +66,10 @@ namespace dp_gui {
TheExtensionManager::TheExtensionManager( Window *pParent,
const uno::Reference< uno::XComponentContext > &xContext ) :
- m_xContext( xContext )
+ m_xContext( xContext ),
+ m_pParent( pParent ),
+ m_pExtMgrDialog( NULL ),
+ m_pUpdReqDialog( NULL )
{
if ( dp_misc::office_is_running() )
{
@@ -76,10 +79,6 @@ TheExtensionManager::TheExtensionManager( Window *pParent,
m_xDesktop->addTerminateListener( this );
}
- m_pDialog = new ExtMgrDialog( pParent, this );
-
- m_pExecuteCmdQueue.reset( new ExtensionCmdQueue( m_pDialog, this, xContext ) );
-
m_sPackageManagers.realloc(2);
m_sPackageManagers[0] = deployment::thePackageManagerFactory::get( m_xContext )->getPackageManager( OUSTR("user") );
m_sPackageManagers[1] = deployment::thePackageManagerFactory::get( m_xContext )->getPackageManager( OUSTR("shared") );;
@@ -110,21 +109,43 @@ TheExtensionManager::TheExtensionManager( Window *pParent,
uno::Sequence< uno::Any >( args, 1 )), uno::UNO_QUERY_THROW);
try
{ //throws css::container::NoSuchElementException, css::lang::WrappedTargetException
- OUString sURL;
uno::Any value = xNameAccessRepositories->getByName( OUSTR( "WebsiteLink" ) );
- sURL = value.get< OUString > ();
- m_pDialog->setGetExtensionsURL( sURL );
+ m_sGetExtensionsURL = value.get< OUString > ();
}
catch ( uno::Exception& )
{}
-
- createPackageList();
}
//------------------------------------------------------------------------------
TheExtensionManager::~TheExtensionManager()
{
- delete m_pDialog;
+ if ( m_pUpdReqDialog )
+ delete m_pUpdReqDialog;
+ if ( m_pExtMgrDialog )
+ delete m_pExtMgrDialog;
+}
+
+//------------------------------------------------------------------------------
+void TheExtensionManager::createDialog( const bool bCreateUpdDlg )
+{
+ const ::vos::OGuard guard( Application::GetSolarMutex() );
+
+ if ( bCreateUpdDlg )
+ {
+ if ( !m_pUpdReqDialog )
+ {
+ m_pUpdReqDialog = new UpdateRequiredDialog( NULL, this );
+ m_pExecuteCmdQueue.reset( new ExtensionCmdQueue( (DialogHelper*) m_pUpdReqDialog, this, m_xContext ) );
+ createPackageList();
+ }
+ }
+ else if ( !m_pExtMgrDialog )
+ {
+ m_pExtMgrDialog = new ExtMgrDialog( m_pParent, this );
+ m_pExecuteCmdQueue.reset( new ExtensionCmdQueue( (DialogHelper*) m_pExtMgrDialog, this, m_xContext ) );
+ m_pExtMgrDialog->setGetExtensionsURL( m_sGetExtensionsURL );
+ createPackageList();
+ }
}
//------------------------------------------------------------------------------
@@ -132,7 +153,7 @@ void TheExtensionManager::Show()
{
const ::vos::OGuard guard( Application::GetSolarMutex() );
- m_pDialog->Show();
+ getDialog()->Show();
}
//------------------------------------------------------------------------------
@@ -140,7 +161,7 @@ void TheExtensionManager::SetText( const ::rtl::OUString &rTitle )
{
const ::vos::OGuard guard( Application::GetSolarMutex() );
- m_pDialog->SetText( rTitle );
+ getDialog()->SetText( rTitle );
}
//------------------------------------------------------------------------------
@@ -148,25 +169,69 @@ void TheExtensionManager::ToTop( USHORT nFlags )
{
const ::vos::OGuard guard( Application::GetSolarMutex() );
- m_pDialog->ToTop( nFlags );
+ getDialog()->ToTop( nFlags );
}
//------------------------------------------------------------------------------
bool TheExtensionManager::Close()
{
- return m_pDialog->Close();
+ if ( m_pExtMgrDialog )
+ return m_pExtMgrDialog->Close();
+ else if ( m_pUpdReqDialog )
+ return m_pUpdReqDialog->Close();
+ else
+ return true;
+}
+
+//------------------------------------------------------------------------------
+sal_Int16 TheExtensionManager::execute()
+{
+ sal_Int16 nRet = 0;
+
+ if ( m_pUpdReqDialog )
+ {
+ nRet = m_pUpdReqDialog->Execute();
+ delete m_pUpdReqDialog;
+ m_pUpdReqDialog = NULL;
+ }
+
+ return nRet;
}
//------------------------------------------------------------------------------
bool TheExtensionManager::isVisible()
{
- return m_pDialog->IsVisible();
+ return getDialog()->IsVisible();
}
//------------------------------------------------------------------------------
bool TheExtensionManager::checkUpdates( bool /* bShowUpdateOnly */, bool /*bParentVisible*/ )
{
- m_pExecuteCmdQueue->checkForUpdates( m_sPackageManagers );
+ std::vector< TUpdateListEntry > vEntries;
+
+ for ( sal_Int32 i = 0; i < m_sPackageManagers.getLength(); ++i )
+ {
+ uno::Sequence< uno::Reference< deployment::XPackage > > xPackages;
+ try {
+ xPackages = m_sPackageManagers[i]->getDeployedPackages( uno::Reference< task::XAbortChannel >(),
+ uno::Reference< ucb::XCommandEnvironment >() );
+ for ( sal_Int32 k = 0; k < xPackages.getLength(); ++k )
+ {
+ TUpdateListEntry pEntry( new UpdateListEntry( xPackages[k], m_sPackageManagers[i] ) );
+ vEntries.push_back( pEntry );
+ }
+ } catch ( deployment::DeploymentException & ) {
+ continue;
+ } catch ( ucb::CommandFailedException & ) {
+ continue;
+ } catch ( ucb::CommandAbortedException & ) {
+ return true;
+ } catch ( lang::IllegalArgumentException & e ) {
+ throw uno::RuntimeException( e.Message, e.Context );
+ }
+ }
+
+ m_pExecuteCmdQueue->checkForUpdates( vEntries );
return true;
}
@@ -189,10 +254,9 @@ bool TheExtensionManager::removePackage( const uno::Reference< deployment::XPack
}
//------------------------------------------------------------------------------
-bool TheExtensionManager::updatePackage( const uno::Reference< deployment::XPackageManager > &xPackageManager,
- const uno::Reference< deployment::XPackage > &xPackage )
+bool TheExtensionManager::updatePackages( const std::vector< TUpdateListEntry > &vList )
{
- m_pExecuteCmdQueue->checkForUpdate( xPackageManager, xPackage );
+ m_pExecuteCmdQueue->checkForUpdates( vList );
return true;
}
@@ -203,6 +267,8 @@ bool TheExtensionManager::installPackage( const OUString &rPackageURL, bool bWar
if ( rPackageURL.getLength() == 0 )
return false;
+ createDialog( false );
+
uno::Reference< deployment::XPackageManager > xUserPkgMgr = getUserPkgMgr();
uno::Reference< deployment::XPackageManager > xSharedPkgMgr = getSharedPkgMgr();
@@ -210,7 +276,7 @@ bool TheExtensionManager::installPackage( const OUString &rPackageURL, bool bWar
bool bInstallForAll = false;
if ( !bWarnUser && ! xSharedPkgMgr->isReadOnly() )
- bInstall = m_pDialog->installForAllUsers( bInstallForAll );
+ bInstall = getDialogHelper()->installForAllUsers( bInstallForAll );
if ( !bInstall )
return false;
@@ -239,8 +305,10 @@ void TheExtensionManager::terminateDialog()
if ( ! dp_misc::office_is_running() )
{
const ::vos::OGuard guard( Application::GetSolarMutex() );
- delete m_pDialog;
- m_pDialog = NULL;
+ delete m_pExtMgrDialog;
+ m_pExtMgrDialog = NULL;
+ delete m_pUpdReqDialog;
+ m_pUpdReqDialog = NULL;
Application::Quit();
}
}
@@ -252,7 +320,7 @@ bool TheExtensionManager::createPackageList( const uno::Reference< deployment::X
try {
packages = xPackageManager->getDeployedPackages( uno::Reference< task::XAbortChannel >(),
- uno::Reference< ucb::XCommandEnvironment >() );
+ uno::Reference< ucb::XCommandEnvironment >() );
} catch ( deployment::DeploymentException & ) {
//handleGeneralError(e.Cause);
return true;
@@ -267,7 +335,7 @@ bool TheExtensionManager::createPackageList( const uno::Reference< deployment::X
for ( sal_Int32 j = 0; j < packages.getLength(); ++j )
{
- m_pDialog->addPackageToList( packages[j], xPackageManager );
+ getDialogHelper()->addPackageToList( packages[j], xPackageManager );
}
return true;
@@ -381,8 +449,10 @@ void TheExtensionManager::disposing( lang::EventObject const & rEvt )
if ( dp_misc::office_is_running() )
{
const ::vos::OGuard guard( Application::GetSolarMutex() );
- delete m_pDialog;
- m_pDialog = NULL;
+ delete m_pExtMgrDialog;
+ m_pExtMgrDialog = NULL;
+ delete m_pUpdReqDialog;
+ m_pUpdReqDialog = NULL;
}
s_ExtMgr.clear();
}
@@ -393,15 +463,22 @@ void TheExtensionManager::disposing( lang::EventObject const & rEvt )
void TheExtensionManager::queryTermination( ::lang::EventObject const & )
throw ( frame::TerminationVetoException, uno::RuntimeException )
{
- if ( m_pExecuteCmdQueue->isBusy() || ( m_pDialog && m_pDialog->isBusy() ) )
+ DialogHelper *pDialogHelper = getDialogHelper();
+
+ if ( m_pExecuteCmdQueue->isBusy() || ( pDialogHelper && pDialogHelper->isBusy() ) )
{
ToTop( TOTOP_RESTOREWHENMIN );
throw frame::TerminationVetoException(
OUSTR("The office cannot be closed while the Extension Manager is running"),
uno::Reference<XInterface>(static_cast<frame::XTerminateListener*>(this), uno::UNO_QUERY));
}
- else if ( m_pDialog )
- m_pDialog->Close();
+ else
+ {
+ if ( m_pExtMgrDialog )
+ m_pExtMgrDialog->Close();
+ if ( m_pUpdReqDialog )
+ m_pUpdReqDialog->Close();
+ }
}
//------------------------------------------------------------------------------
@@ -419,9 +496,9 @@ void TheExtensionManager::modified( ::lang::EventObject const & rEvt )
uno::Reference< deployment::XPackageManager > xPackageManager( rEvt.Source, uno::UNO_QUERY );
if ( xPackageManager.is() )
{
- m_pDialog->prepareChecking( xPackageManager );
+ getDialogHelper()->prepareChecking( xPackageManager );
createPackageList( xPackageManager );
- m_pDialog->checkEntries();
+ getDialogHelper()->checkEntries();
}
}
@@ -433,7 +510,8 @@ void TheExtensionManager::modified( ::lang::EventObject const & rEvt )
if ( s_ExtMgr.is() )
{
OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
- s_ExtMgr->installPackage( extensionURL, true );
+ if ( extensionURL.getLength() )
+ s_ExtMgr->installPackage( extensionURL, true );
return s_ExtMgr;
}
@@ -450,7 +528,8 @@ void TheExtensionManager::modified( ::lang::EventObject const & rEvt )
s_ExtMgr = that;
}
- s_ExtMgr->installPackage( extensionURL, true );
+ if ( extensionURL.getLength() )
+ s_ExtMgr->installPackage( extensionURL, true );
return s_ExtMgr;
}
diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx
index 21516c683cc8..4ce6005a9346 100644
--- a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx
+++ b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx
@@ -44,12 +44,13 @@
#include "com/sun/star/util/XModifyListener.hpp"
#include "dp_gui.h"
+#include "dp_gui_dialog2.hxx"
+#include "dp_gui_updatedata.hxx"
//==============================================================================
namespace dp_gui {
//------------------------------------------------------------------------------
-class ExtMgrDialog;
class ExtensionCmdQueue;
//------------------------------------------------------------------------------
@@ -65,7 +66,11 @@ private:
::std::auto_ptr< ExtensionCmdQueue > m_pExecuteCmdQueue;
- ExtMgrDialog *m_pDialog;
+ Window *m_pParent;
+ ExtMgrDialog *m_pExtMgrDialog;
+ UpdateRequiredDialog *m_pUpdReqDialog;
+
+ ::rtl::OUString m_sGetExtensionsURL;
// liste der packages ( xpackage?, mit parent manager, ... )
@@ -79,6 +84,12 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &xContext );
~TheExtensionManager();
+ void createDialog( const bool bCreateUpdDlg );
+ sal_Int16 execute();
+
+ Dialog* getDialog() { return m_pExtMgrDialog ? (Dialog*) m_pExtMgrDialog : (Dialog*) m_pUpdReqDialog; }
+ DialogHelper* getDialogHelper() { return m_pExtMgrDialog ? (DialogHelper*) m_pExtMgrDialog : (DialogHelper*) m_pUpdReqDialog; }
+
void SetText( const ::rtl::OUString &rTitle );
void Show();
void ToTop( USHORT nFlags );
@@ -87,12 +98,12 @@ public:
//-----------------
bool checkUpdates( bool showUpdateOnly, bool parentVisible );
+ bool updatePackages( const std::vector< TUpdateListEntry > &vList );
+
bool enablePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
bool bEnable );
bool removePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
- bool updatePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
- const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
bool installPackage( const ::rtl::OUString &rPackageURL, bool bWarnUser = false );
bool queryTermination();
diff --git a/desktop/source/deployment/gui/dp_gui_updatedata.hxx b/desktop/source/deployment/gui/dp_gui_updatedata.hxx
index ba78112a26f7..610960b99734 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedata.hxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedata.hxx
@@ -34,6 +34,8 @@
#include "rtl/ustring.hxx"
#include "com/sun/star/uno/Reference.hxx"
+#include <boost/shared_ptr.hpp>
+
namespace com { namespace sun { namespace star { namespace deployment {
class XPackageManager;
@@ -46,6 +48,19 @@ namespace com { namespace sun { namespace star { namespace xml { namespace dom {
namespace dp_gui {
+struct UpdateListEntry
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> m_xPackage;
+ ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> m_xPackageManager;
+
+ UpdateListEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
+ ~UpdateListEntry();
+};
+
+typedef ::boost::shared_ptr< UpdateListEntry > TUpdateListEntry;
+
+
struct UpdateData
{
::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > aInstalledPackage;
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
index 370d11c0de63..0e1955359bbc 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
@@ -229,9 +229,7 @@ public:
Thread(
css::uno::Reference< css::uno::XComponentContext > const & context,
UpdateDialog & dialog,
- rtl::Reference< dp_gui::SelectedPackage > const & selectedPackage,
- css::uno::Sequence< css::uno::Reference<
- css::deployment::XPackageManager > > const & packageManagers);
+ const std::vector< TUpdateListEntry > &vExtensionList);
void stop();
@@ -285,9 +283,7 @@ private:
css::uno::Reference< css::uno::XComponentContext > m_context;
UpdateDialog & m_dialog;
- rtl::Reference< dp_gui::SelectedPackage > m_selectedPackage;
- css::uno::Sequence< css::uno::Reference<
- css::deployment::XPackageManager > > m_packageManagers;
+ std::vector< dp_gui::TUpdateListEntry > m_vExtensionList;
css::uno::Reference< css::deployment::XUpdateInformationProvider >
m_updateInformation;
@@ -299,13 +295,10 @@ private:
UpdateDialog::Thread::Thread(
css::uno::Reference< css::uno::XComponentContext > const & context,
UpdateDialog & dialog,
- rtl::Reference< dp_gui::SelectedPackage > const & selectedPackage,
- css::uno::Sequence< css::uno::Reference<
- css::deployment::XPackageManager > > const & packageManagers):
+ const std::vector< dp_gui::TUpdateListEntry > &vExtensionList):
m_context(context),
m_dialog(dialog),
- m_selectedPackage(selectedPackage),
- m_packageManagers(packageManagers),
+ m_vExtensionList(vExtensionList),
m_updateInformation(
css::deployment::UpdateInformationProvider::create(context)),
m_stop(false)
@@ -336,55 +329,28 @@ UpdateDialog::Thread::Entry::Entry(
UpdateDialog::Thread::~Thread() {}
-void UpdateDialog::Thread::execute() {
- OSL_ASSERT(m_selectedPackage.is() != (m_packageManagers.getLength() != 0));
+void UpdateDialog::Thread::execute()
+{
+ OSL_ASSERT( ! m_vExtensionList.empty() );
Map map;
- if (m_selectedPackage.is()) {
- css::uno::Reference< css::deployment::XPackage > p = m_selectedPackage->getPackage();
- css::uno::Reference< css::deployment::XPackageManager > m= m_selectedPackage->getPackageManager();
+
+ typedef std::vector< TUpdateListEntry >::const_iterator ITER;
+ for ( ITER iIndex = m_vExtensionList.begin(); iIndex < m_vExtensionList.end(); ++iIndex )
+ {
+ css::uno::Reference< css::deployment::XPackage > p = (*iIndex)->m_xPackage;
+ css::uno::Reference< css::deployment::XPackageManager > m = (*iIndex)->m_xPackageManager;
if ( p.is() )
{
- handle(p, m, &map);
- }
- } else {
- for (sal_Int32 i = 0; i < m_packageManagers.getLength(); ++i) {
- css::uno::Reference< css::task::XAbortChannel > abort(
- m_packageManagers[i]->createAbortChannel());
{
- vos::OGuard g(Application::GetSolarMutex());
- if (m_stop) {
+ vos::OGuard g( Application::GetSolarMutex() );
+ if ( m_stop ) {
return;
}
- m_abort = abort;
- }
- css::uno::Sequence<
- css::uno::Reference< css::deployment::XPackage > > ps;
- try {
- ps = m_packageManagers[i]->getDeployedPackages(
- abort,
- css::uno::Reference< css::ucb::XCommandEnvironment >());
- } catch (css::deployment::DeploymentException & e) {
- handleGeneralError(e.Cause);
- continue;
- } catch (css::ucb::CommandFailedException & e) {
- handleGeneralError(e.Reason);
- continue;
- } catch (css::ucb::CommandAbortedException &) {
- return;
- } catch (css::lang::IllegalArgumentException & e) {
- throw css::uno::RuntimeException(e.Message, e.Context);
- }
- for (sal_Int32 j = 0; j < ps.getLength(); ++j) {
- {
- vos::OGuard g(Application::GetSolarMutex());
- if (m_stop) {
- return;
- }
- }
- handle(ps[j], m_packageManagers[i], &map);
}
+ handle( p, m, &map );
}
}
+
if (!map.empty()) {
const rtl::OUString sDefaultURL(dp_misc::getExtensionDefaultUpdateURL());
if (sDefaultURL.getLength())
@@ -597,9 +563,7 @@ bool UpdateDialog::Thread::update(
UpdateDialog::UpdateDialog(
css::uno::Reference< css::uno::XComponentContext > const & context,
Window * parent,
- rtl::Reference< dp_gui::SelectedPackage > const & selectedPackage,
- css::uno::Sequence< css::uno::Reference<
- css::deployment::XPackageManager > > const & packageManagers,
+ const std::vector< dp_gui::TUpdateListEntry > &vExtensionList,
std::vector< dp_gui::UpdateData > * updateData):
ModalDialog(parent,DpGuiResId(RID_DLG_UPDATE)),
m_context(context),
@@ -636,14 +600,12 @@ UpdateDialog::UpdateDialog(
m_updateData(*updateData),
m_thread(
new UpdateDialog::Thread(
- context, *this, selectedPackage,
- packageManagers)),
+ context, *this, vExtensionList)),
m_nFirstLineDelta(0),
m_nOneLineMissing(0)
// TODO: check!
// ,
// m_extensionManagerDialog(extensionManagerDialog)
-
{
OSL_ASSERT(updateData != NULL);
css::uno::Reference< css::awt::XToolkit > toolkit;
@@ -1310,4 +1272,3 @@ IMPL_LINK( UpdateDialog, hyperlink_clicked, svt::FixedHyperlink*, pHyperlink )
return 1;
}
-
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
index b038c0ef042f..578ad6b6f01d 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
@@ -48,6 +48,7 @@
#include <svtools/fixedhyper.hxx>
#include "descedit.hxx"
+#include "dp_gui_updatedata.hxx"
/// @HTML
@@ -56,18 +57,14 @@ class KeyEvent;
class MouseEvent;
class ResId;
class Window;
+
namespace com { namespace sun { namespace star {
namespace awt { class XThrobber; }
namespace deployment { class XPackageManager; }
namespace uno { class XComponentContext; }
} } }
-namespace dp_gui {
- class SelectedPackage;
- struct UpdateData;
-}
namespace dp_gui {
-
/**
The modal &ldquo;Check for Updates&rdquo; dialog.
*/
@@ -92,13 +89,9 @@ public:
if non-null, check for updates for all managed packages
*/
UpdateDialog(
- com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
- const & context,
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & context,
Window * parent,
- rtl::Reference< dp_gui::SelectedPackage > const & selectedPackage,
- com::sun::star::uno::Sequence< com::sun::star::uno::Reference<
- com::sun::star::deployment::XPackageManager > > const &
- packageManagers,
+ const std::vector< dp_gui::TUpdateListEntry > &vExtensionList,
std::vector< dp_gui::UpdateData > * updateData);
~UpdateDialog();
diff --git a/desktop/source/deployment/gui/makefile.mk b/desktop/source/deployment/gui/makefile.mk
index e3211ab7f73f..4d563ae1591a 100644
--- a/desktop/source/deployment/gui/makefile.mk
+++ b/desktop/source/deployment/gui/makefile.mk
@@ -50,6 +50,7 @@ DLLPRE =
SLOFILES = \
$(SLO)$/dp_gui_service.obj \
+ $(SLO)$/dp_gui_extlistbox.obj \
$(SLO)$/dp_gui_dialog2.obj \
$(SLO)$/dp_gui_theextmgr.obj \
$(SLO)$/license_dialog.obj \
diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx
index 7f6d003f8577..aa67536bd425 100644
--- a/desktop/source/deployment/registry/dp_backend.cxx
+++ b/desktop/source/deployment/registry/dp_backend.cxx
@@ -296,6 +296,7 @@ sal_Bool Package::isBundle() throw (RuntimeException)
return false; // default
}
+//______________________________________________________________________________
::sal_Bool Package::checkPrerequisites(
const css::uno::Reference< css::task::XAbortChannel >&,
const css::uno::Reference< css::ucb::XCommandEnvironment >&,
@@ -308,6 +309,16 @@ sal_Bool Package::isBundle() throw (RuntimeException)
return true;
}
+//______________________________________________________________________________
+::sal_Bool Package::checkDependencies(
+ const css::uno::Reference< css::ucb::XCommandEnvironment >& )
+ throw (css::deployment::DeploymentException,
+ css::ucb::CommandFailedException,
+ css::uno::RuntimeException)
+{
+ return true;
+}
+
//______________________________________________________________________________
Sequence< Reference<deployment::XPackage> > Package::getBundle(
diff --git a/desktop/source/deployment/registry/help/dp_help.src b/desktop/source/deployment/registry/help/dp_help.src
index ed65707badbd..be85542dc3b0 100644
--- a/desktop/source/deployment/registry/help/dp_help.src
+++ b/desktop/source/deployment/registry/help/dp_help.src
@@ -42,6 +42,6 @@ String RID_STR_HELPPROCESSING_GENERAL_ERROR
String RID_STR_HELPPROCESSING_XMLPARSING_ERROR
{
- Text [ en-US ] = "The extension will not be installed because an error occured in the Help files:\n";
+ Text [ en-US ] = "The extension will not be installed because an error occurred in the Help files:\n";
};
diff --git a/desktop/source/deployment/registry/inc/dp_backend.h b/desktop/source/deployment/registry/inc/dp_backend.h
index 02e1d79ce2c3..256d4680d795 100644
--- a/desktop/source/deployment/registry/inc/dp_backend.h
+++ b/desktop/source/deployment/registry/inc/dp_backend.h
@@ -177,6 +177,12 @@ public:
css::ucb::CommandAbortedException,
css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL checkDependencies(
+ const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv )
+ throw (css::deployment::DeploymentException,
+ css::ucb::CommandFailedException,
+ css::uno::RuntimeException);
+
virtual void SAL_CALL registerPackage(
css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx
index e39f5e80fc31..14075d0fca38 100644
--- a/desktop/source/deployment/registry/package/dp_package.cxx
+++ b/desktop/source/deployment/registry/package/dp_package.cxx
@@ -205,6 +205,12 @@ class BackendImpl : public ImplBaseT
css::ucb::CommandAbortedException,
css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL checkDependencies(
+ const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv )
+ throw (css::deployment::DeploymentException,
+ css::ucb::CommandFailedException,
+ css::uno::RuntimeException);
+
virtual beans::Optional<OUString> SAL_CALL getIdentifier()
throw (RuntimeException);
@@ -702,6 +708,22 @@ bool BackendImpl::PackageImpl::checkDependencies(
&& checkLicense(xCmdEnv, *spDescription, bInstalled, aContextName);
}
+::sal_Bool BackendImpl::PackageImpl::checkDependencies(
+ const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv )
+ throw (css::deployment::DeploymentException,
+ css::ucb::CommandFailedException,
+ css::uno::RuntimeException)
+{
+ std::auto_ptr<ExtensionDescription> spDescription;
+ try {
+ spDescription.reset(
+ new ExtensionDescription( getMyBackend()->getComponentContext(), m_url_expanded, xCmdEnv ));
+ } catch (NoDescriptionException& ) {
+ return sal_True;
+ }
+ return checkDependencies(xCmdEnv, *spDescription);
+}
+
beans::Optional<OUString> BackendImpl::PackageImpl::getIdentifier()
throw (RuntimeException)
{
diff --git a/desktop/source/inc/helpid.hrc b/desktop/source/inc/helpid.hrc
index 1d10a9f6fbbe..f2d096460bed 100644
--- a/desktop/source/inc/helpid.hrc
+++ b/desktop/source/inc/helpid.hrc
@@ -66,7 +66,11 @@
#define HID_EXTENSION_MANAGER_LISTBOX_DISABLE (HID_DESKTOP_START + 26)
#define HID_EXTENSION_MANAGER_LISTBOX_REMOVE (HID_DESKTOP_START + 27)
-#define ACT_DESKTOP_HID_END HID_EXTENSION_MANAGER_LISTBOX_REMOVE
+#define HID_EXTENSION_DEPENDENCIES (HID_DESKTOP_START + 28)
+
+#define HID_PACKAGE_MANAGER_UPD_REQ (HID_DESKTOP_START + 29)
+
+#define ACT_DESKTOP_HID_END HID_PACKAGE_MANAGER_UPD_REQ
// check bounds:
#if ACT_DESKTOP_HID_END > HID_DESKTOP_END
diff --git a/desktop/util/hidother.src b/desktop/util/hidother.src
index f4d06d3fa72b..6f5a86159d75 100644
--- a/desktop/util/hidother.src
+++ b/desktop/util/hidother.src
@@ -36,6 +36,8 @@ hidspecial HID_PACKAGE_MANAGER_TREELISTBOX { HelpID = HID_PACKAGE_MANAGER_TREELI
hidspecial HID_PACKAGE_MANAGER_PROGRESS { HelpID = HID_PACKAGE_MANAGER_PROGRESS; };
hidspecial HID_PACKAGE_MANAGER_PROGRESS_CANCEL { HelpID = HID_PACKAGE_MANAGER_PROGRESS_CANCEL; };
+hidspecial HID_PACKAGE_MANAGER_UPD_REQ { HelpID = HID_PACKAGE_MANAGER_UPD_REQ; };
+
hidspecial HID_FIRSTSTART_PREV { HelpId = HID_FIRSTSTART_PREV;};
hidspecial HID_FIRSTSTART_NEXT { HelpId = HID_FIRSTSTART_NEXT;};
hidspecial HID_FIRSTSTART_CANCEL { HelpId = HID_FIRSTSTART_CANCEL;};
@@ -45,7 +47,7 @@ hidspecial UID_FIRSTSTART_HELP { HelpId = UID_FIRSTSTART_HELP;};
hidspecial UID_BTN_LICENSE_ACCEPT { HelpId = UID_BTN_LICENSE_ACCEPT;};
hidspecial HID_DEPLOYMENT_GUI_UPDATE { HelpId = HID_DEPLOYMENT_GUI_UPDATE;};
-hidspecial HID_DEPLOYMENT_GUI_UPDATE { HelpId = HID_DEPLOYMENT_GUI_UPDATEINSTALL;};
+hidspecial HID_DEPLOYMENT_GUI_UPDATEINSTALL { HelpId = HID_DEPLOYMENT_GUI_UPDATEINSTALL;};
hidspecial HID_EXTENSION_MANAGER_LISTBOX { HelpId = HID_EXTENSION_MANAGER_LISTBOX; };
hidspecial HID_EXTENSION_MANAGER_LISTBOX_OPTIONS { HelpId = HID_EXTENSION_MANAGER_LISTBOX_OPTIONS; };
diff --git a/desktop/win32/source/guistdio/guistdio.inc b/desktop/win32/source/guistdio/guistdio.inc
index 6ee59c891bf0..024b456efa99 100644
--- a/desktop/win32/source/guistdio/guistdio.inc
+++ b/desktop/win32/source/guistdio/guistdio.inc
@@ -47,10 +47,6 @@
#include <stdio.h>
-//---------------------------------------------------------------------------
-// Thread that reads from child process standard output pipe
-//---------------------------------------------------------------------------
-
#ifdef UNOPKG
DWORD passOutputToConsole(HANDLE readPipe, HANDLE console)
@@ -169,21 +165,76 @@ DWORD WINAPI ErrorThread( LPVOID pParam )
// Thread that writes to child process standard input pipe
//---------------------------------------------------------------------------
#ifdef UNOPKG
+
DWORD WINAPI InputThread( LPVOID pParam )
{
- const DWORD dwBufferSize = 256;
- wchar_t aBuffer[dwBufferSize];
DWORD dwRead = 0;
HANDLE hWritePipe = (HANDLE)pParam;
-
- while (ReadConsoleW( GetStdHandle( STD_INPUT_HANDLE ), &aBuffer, dwBufferSize, &dwRead, NULL ) )
+
+ //We need to read in the complete input until we encounter a new line before
+ //converting to Unicode. This is necessary because the input string can use
+ //characters of one, two, and more bytes. If the last character is not
+ //complete, then it will not be converted properly.
+
+ //Find out how a new line (0xd 0xa) looks like with the used code page.
+ //Characters may have one or multiple bytes and different byte ordering
+ //can be used (little and big endian);
+ int cNewLine = WideCharToMultiByte(
+ GetConsoleCP(), 0, L"\r\n", 2, NULL, 0, NULL, NULL);
+ char * mbBuff = new char[cNewLine];
+ WideCharToMultiByte(
+ GetConsoleCP(), 0, L"\r\n", 2, mbBuff, cNewLine, NULL, NULL);
+
+ const size_t dwBufferSize = 256;
+ char* readBuf = (char*) malloc(dwBufferSize);
+ int readAll = 0;
+ size_t curBufSize = dwBufferSize;
+
+ while ( ReadFile( GetStdHandle( STD_INPUT_HANDLE ),
+ readBuf + readAll,
+ curBufSize - readAll, &dwRead, NULL ) )
{
- BOOL fSuccess;
+ readAll += dwRead;
+ int lastBufSize = curBufSize;
+ //Grow the buffer if necessary
+ if (readAll > curBufSize * 0.7)
+ {
+ curBufSize *= 2;
+ readBuf = (char *) realloc(readBuf, curBufSize);
+ }
+
+ //If the buffer was filled completely then
+ //there could be more input coming. But if we read from the console
+ //and the console input fits exactly in the buffer, then the next
+ //ReadFile would block until the users presses return, etc.
+ //Therefor we check if last character is a new line.
+ //To test this, set dwBufferSize to 4 and enter "no". This should produce
+ //4 bytes with most code pages.
+ if ( readAll == lastBufSize
+ && memcmp(readBuf + lastBufSize - cNewLine, mbBuff, cNewLine) != 0)
+ {
+ //The buffer was completely filled and the last byte(s) are no
+ //new line, so there is more to come.
+ continue;
+ }
+ //Obtain the size of the buffer for the converted string.
+ int sizeWBuf = MultiByteToWideChar(
+ GetConsoleCP(), MB_PRECOMPOSED, readBuf, readAll, NULL, 0);
+
+ wchar_t * wideBuf = new wchar_t[sizeWBuf];
+
+ //Do the conversion.
+ MultiByteToWideChar(
+ GetConsoleCP(), MB_PRECOMPOSED, readBuf, readAll, wideBuf, sizeWBuf);
+
+ BOOL fSuccess;
DWORD dwWritten;
-
- fSuccess = WriteFile( hWritePipe, aBuffer, dwRead * 2, &dwWritten, NULL );
+ fSuccess = WriteFile( hWritePipe, wideBuf, sizeWBuf * 2, &dwWritten, NULL );
+ delete[] wideBuf;
+ readAll = 0;
}
-
+ delete[] mbBuff;
+ free(readBuf);
return 0;
}
#else
diff --git a/desktop/win32/source/rebase/Resource.h b/desktop/win32/source/rebase/Resource.h
new file mode 100644
index 000000000000..2ebbc5c5bfb7
--- /dev/null
+++ b/desktop/win32/source/rebase/Resource.h
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * 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: Resource.h,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 _RESOURCE_H
+#define _RESOURCE_H
+
+#define IDS_APP_TITLE 10
+#define IDS_MSG_OPTIMIZED_FOR_CLIENT 11
+#define IDS_MSG_OPTIMIZED_FOR_SERVER 12
+#define IDS_MSG_NO_INSTALLATION_FOUND 13
+
+#define IDI_REBASEGUI 99
+
+#endif
diff --git a/desktop/win32/source/rebase/makefile.mk b/desktop/win32/source/rebase/makefile.mk
new file mode 100644
index 000000000000..dbab5a5d0921
--- /dev/null
+++ b/desktop/win32/source/rebase/makefile.mk
@@ -0,0 +1,93 @@
+#*************************************************************************
+#
+# 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.4 $
+#
+# 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=desktop
+TARGET=rebasegui
+LIBTARGET=NO
+TARGETTYPE=GUI
+UWINAPILIB=
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+OBJFILES = \
+ $(OBJ)$/rebase.obj \
+ $(OBJ)$/rebasegui.obj
+
+ULFFILES= rebasegui.ulf
+
+.IF "$(WITH_LANG)"!=""
+ULFDIR:=$(COMMONMISC)$/$(TARGET)
+.ELSE # "$(WITH_LANG)"!=""
+ULFDIR:=.
+.ENDIF # "$(WITH_LANG)"!=""
+
+RCFILES= $(RES)$/$(TARGET).rc
+
+# --- Targets ------------------------------------------------------
+
+APP1NOSAL= TRUE
+APP1TARGET= rebaseoo
+
+APP1STDLIBS= $(SHELL32LIB) $(SOLARLIBDIR)$/pathutils-obj.obj
+.IF "$(COM)"=="GCC"
+ APP1STDLIBS+=$(PSDK_HOME)$/lib$/imagehlp.lib
+.ELSE
+ APP1STDLIBS+=imagehlp.lib
+.ENDIF
+
+APP1OBJS= $(OBJ)$/rebase.obj
+
+APP1RPATH= BRAND
+
+APP2NOSAL= TRUE
+APP2TARGET= rebasegui
+APP2STDLIBS= $(SHELL32LIB) $(SOLARLIBDIR)$/pathutils-obj.obj
+
+APP2OBJS= $(OBJ)$/rebasegui.obj
+
+APP2DEF= $(MISC)$/$(TARGET).def
+APP2RPATH= BRAND
+
+APP2RES= $(RES)$/$(TARGET).res
+APP2NOSVRES= $(RES)$/$(TARGET).res
+
+# --- setup --------------------------------------------------------------
+
+.INCLUDE : target.mk
+
+$(RCFILES) : $(ULFDIR)$/rebasegui.ulf makefile.mk rcfooter.txt rcheader.txt rctmpl.txt
+ $(LNGCONVEX) -ulf $(ULFDIR)$/rebasegui.ulf -rc $(RCFILES) -rct rctmpl.txt -rch rcheader.txt -rcf rcfooter.txt
diff --git a/desktop/win32/source/rebase/rcfooter.txt b/desktop/win32/source/rebase/rcfooter.txt
new file mode 100644
index 000000000000..3237729437f5
--- /dev/null
+++ b/desktop/win32/source/rebase/rcfooter.txt
@@ -0,0 +1,2 @@
+
+// The end
diff --git a/desktop/win32/source/rebase/rcheader.txt b/desktop/win32/source/rebase/rcheader.txt
new file mode 100644
index 000000000000..56afc5377920
--- /dev/null
+++ b/desktop/win32/source/rebase/rcheader.txt
@@ -0,0 +1,39 @@
+#if defined(_MSC_VER) && (_MSC_VER < 1500)
+#include <winres.h>
+#else
+#define WINVER 0x0500
+#include <winresrc.h>
+#define IDC_STATIC (-1)
+#endif
+#include "resource.h"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,1,1,0
+ PRODUCTVERSION 1,1,1,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x9L
+#else
+ FILEFLAGS 0x8L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
diff --git a/desktop/win32/source/rebase/rctmpl.txt b/desktop/win32/source/rebase/rctmpl.txt
new file mode 100644
index 000000000000..97a2775e9b02
--- /dev/null
+++ b/desktop/win32/source/rebase/rctmpl.txt
@@ -0,0 +1,9 @@
+// String Table
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_APP_TITLE %APP_TITLE%
+ IDS_MSG_OPTIMIZED_FOR_CLIENT %MSG_OPTIMIZED_FOR_CLIENT%
+ IDS_MSG_OPTIMIZED_FOR_SERVER %MSG_OPTIMIZED_FOR_SERVER%
+ IDS_MSG_NO_INSTALLATION_FOUND %MSG_NO_INSTALLATION_FOUND%
+END
diff --git a/desktop/win32/source/rebase/rebase.cxx b/desktop/win32/source/rebase/rebase.cxx
new file mode 100644
index 000000000000..e651ad0affcc
--- /dev/null
+++ b/desktop/win32/source/rebase/rebase.cxx
@@ -0,0 +1,190 @@
+/*************************************************************************
+ *
+ * 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: md5.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.
+ *
+ ************************************************************************/
+
+#include "precompiled_desktop.hxx"
+#define UNICODE
+#define _UNICODE
+
+#define WIN32_LEAN_AND_MEAN
+#if defined _MSC_VER
+#pragma warning(push, 1)
+#endif
+#include <windows.h>
+#include <shellapi.h>
+#include <imagehlp.h>
+#include <wchar.h>
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
+
+#include <time.h>
+#include "sal/config.h"
+#include "tools/pathutils.hxx"
+
+#define MY_LENGTH(s) (sizeof (s) / sizeof *(s) - 1)
+#define MY_STRING(s) (s), MY_LENGTH(s)
+
+const int FORMAT_MESSAGE_SIZE = 4096;
+const DWORD PE_Signature = 0x00004550;
+const DWORD BASEVIRTUALADDRESS = 0x10000000;
+
+namespace
+{
+
+bool IsValidHandle( HANDLE handle )
+{
+ return ((NULL != handle) && (INVALID_HANDLE_VALUE != handle));
+}
+
+void fail()
+{
+ LPWSTR buf = NULL;
+ FormatMessageW(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
+ GetLastError(), 0, reinterpret_cast< LPWSTR >(&buf), 0, NULL);
+ MessageBoxW(NULL, buf, NULL, MB_OK | MB_ICONERROR);
+ LocalFree(buf);
+ TerminateProcess(GetCurrentProcess(), 255);
+}
+
+bool rebaseImage( wchar_t* pszFilePath, ULONG nNewImageBase)
+{
+ ULONG ulOldImageSize;
+ ULONG_PTR lpOldImageBase;
+ ULONG ulNewImageSize;
+ ULONG_PTR lpNewImageBase = nNewImageBase;
+ ULONG ulDateTimeStamp = 0;
+ bool bResult(false);
+
+ char cszFilePath[_MAX_PATH+1] = {0};
+ int nResult = WideCharToMultiByte(CP_ACP, 0, pszFilePath, -1, cszFilePath, _MAX_PATH, NULL, NULL);
+
+ if (nResult != 0)
+ {
+ BOOL bResult = ReBaseImage(
+ cszFilePath,
+ "",
+ TRUE,
+ FALSE,
+ FALSE,
+ 0,
+ &ulOldImageSize,
+ &lpOldImageBase,
+ &ulNewImageSize,
+ &lpNewImageBase,
+ ulDateTimeStamp );
+ }
+
+ return bResult;
+}
+
+wchar_t* getBrandPath(wchar_t * path)
+{
+ DWORD n = GetModuleFileNameW(NULL, path, MAX_PATH);
+ if (n == 0 || n >= MAX_PATH) {
+ exit(EXIT_FAILURE);
+ }
+ return tools::filename(path);
+}
+
+void rebaseImagesInFolder( wchar_t* pszFolder, DWORD nNewImageBase )
+{
+ wchar_t szPattern[MAX_PATH];
+ wchar_t *lpLastSlash = wcsrchr( pszFolder, '\\' );
+ if ( lpLastSlash )
+ {
+ size_t len = lpLastSlash - pszFolder + 1;
+ wcsncpy( szPattern, pszFolder, len );
+ wcsncpy( szPattern + len, TEXT("*.dll"), sizeof(szPattern)/sizeof(szPattern[0]) - len );
+ }
+
+ WIN32_FIND_DATA aFindFileData;
+ HANDLE hFind = FindFirstFile( szPattern, &aFindFileData );
+
+ if ( IsValidHandle(hFind) )
+ {
+ BOOL fSuccess = false;
+
+ do
+ {
+ wchar_t szLibFilePath[MAX_PATH];
+ wchar_t *lpLastSlash = wcsrchr( pszFolder, '\\' );
+ if ( lpLastSlash )
+ {
+ size_t len = lpLastSlash - pszFolder + 1;
+ wcsncpy( szLibFilePath, pszFolder, len );
+ wcsncpy( szLibFilePath + len, aFindFileData.cFileName, sizeof(szLibFilePath)/sizeof(szLibFilePath[0]) - len );
+ }
+
+ rebaseImage( szLibFilePath, nNewImageBase );
+ fSuccess = FindNextFile( hFind, &aFindFileData );
+ }
+ while ( fSuccess );
+
+ FindClose( hFind );
+ }
+}
+
+}
+
+extern "C" int APIENTRY WinMain( HINSTANCE, HINSTANCE, LPSTR, int )
+{
+ wchar_t path[MAX_PATH];
+
+ wchar_t * pathEnd = getBrandPath(path);
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"")) == NULL)
+ fail();
+ rebaseImagesInFolder(path, BASEVIRTUALADDRESS);
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"..\\basis-link")) == NULL)
+ fail();
+ pathEnd = tools::resolveLink(path);
+
+ if ( pathEnd == NULL )
+ return 0;
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\program\\")) == NULL)
+ fail();
+ rebaseImagesInFolder(path, BASEVIRTUALADDRESS);
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\ure-link")) == NULL)
+ fail();
+ pathEnd = tools::resolveLink(path);
+
+ if ( pathEnd == NULL )
+ return 0;
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\bin\\")) == NULL)
+ fail();
+ rebaseImagesInFolder(path, BASEVIRTUALADDRESS);
+
+ return 0;
+}
diff --git a/desktop/win32/source/rebase/rebasegui.cxx b/desktop/win32/source/rebase/rebasegui.cxx
new file mode 100644
index 000000000000..feba7556b74c
--- /dev/null
+++ b/desktop/win32/source/rebase/rebasegui.cxx
@@ -0,0 +1,200 @@
+/*************************************************************************
+ *
+ * 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: md5.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.
+ *
+ ************************************************************************/
+
+#include "precompiled_desktop.hxx"
+
+#define UNICODE 1
+#define _UNICODE 1
+
+#ifndef _WINDOWS_
+# define WIN32_LEAN_AND_MEAN
+#if defined _MSC_VER
+#pragma warning(push, 1)
+#endif
+# include <windows.h>
+# include <shellapi.h>
+# include <wchar.h>
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
+#endif
+
+#include "Resource.h"
+#include <time.h>
+#include "sal/config.h"
+#include "tools/pathutils.hxx"
+
+const DWORD PE_Signature = 0x00004550;
+
+#define MY_LENGTH(s) (sizeof (s) / sizeof *(s) - 1)
+#define MY_STRING(s) (s), MY_LENGTH(s)
+#define MAX_STR_CAPTION 256
+#define MAX_TEXT_LENGTH 1024
+
+static void failPath(wchar_t* pszAppTitle, wchar_t* pszMsg)
+{
+ MessageBoxW(NULL, pszMsg, pszAppTitle, MB_OK | MB_ICONERROR);
+ TerminateProcess(GetCurrentProcess(), 255);
+}
+
+static void fail()
+{
+ LPWSTR buf = NULL;
+ FormatMessageW(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
+ GetLastError(), 0, reinterpret_cast< LPWSTR >(&buf), 0, NULL);
+ MessageBoxW(NULL, buf, NULL, MB_OK | MB_ICONERROR);
+ LocalFree(buf);
+ TerminateProcess(GetCurrentProcess(), 255);
+}
+
+static LPVOID getVirtualBaseAddress( wchar_t* pszFilePath )
+{
+ HANDLE hFile;
+ HANDLE hFileMapping;
+ LPVOID lpFileBase = 0;
+ PIMAGE_DOS_HEADER lpDosHeader;
+ PIMAGE_NT_HEADERS lpNTHeader;
+
+ hFile = CreateFile(pszFilePath,
+ GENERIC_READ, FILE_SHARE_READ, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
+ 0);
+
+ if ( hFile == INVALID_HANDLE_VALUE )
+ {
+ return NULL;
+ }
+
+ hFileMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
+ if ( hFileMapping == 0 )
+ {
+ CloseHandle(hFile);
+ return NULL;
+ }
+
+ lpFileBase = MapViewOfFile(hFileMapping, FILE_MAP_READ, 0, 0, 0);
+ if ( lpFileBase == 0 )
+ {
+ CloseHandle(hFileMapping);
+ CloseHandle(hFile);
+ return NULL;
+ }
+
+ lpDosHeader = (PIMAGE_DOS_HEADER)lpFileBase;
+ if ( lpDosHeader->e_magic == IMAGE_DOS_SIGNATURE )
+ {
+ lpNTHeader = (PIMAGE_NT_HEADERS)((char*)lpDosHeader + lpDosHeader->e_lfanew);
+ if (lpNTHeader->Signature == PE_Signature )
+ lpFileBase = reinterpret_cast<LPVOID>( lpNTHeader->OptionalHeader.ImageBase );
+ }
+
+ UnmapViewOfFile(lpFileBase);
+ CloseHandle(hFileMapping);
+ CloseHandle(hFile);
+
+ return lpFileBase;
+}
+
+static bool checkImageVirtualBaseAddress(wchar_t* pszFilePath, LPVOID lpVBA)
+{
+ LPVOID lpImageVBA = getVirtualBaseAddress(pszFilePath);
+ if ( lpImageVBA == lpVBA )
+ return true;
+ else
+ return false;
+}
+
+static wchar_t* getBrandPath(wchar_t * pszPath)
+{
+ DWORD n = GetModuleFileNameW(NULL, pszPath, MAX_PATH);
+ if (n == 0 || n >= MAX_PATH) {
+ exit(EXIT_FAILURE);
+ }
+ return tools::filename(pszPath);
+}
+
+extern "C" int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, int )
+{
+ wchar_t* pAppTitle = new wchar_t[ MAX_STR_CAPTION ];
+ pAppTitle[0] = '\0';
+ LoadString( hInst, IDS_APP_TITLE, pAppTitle, MAX_STR_CAPTION );
+
+ wchar_t* pTextServer = new wchar_t[ MAX_TEXT_LENGTH ];
+ pTextServer[0] = '\0';
+ LoadString( hInst, IDS_MSG_OPTIMIZED_FOR_SERVER, pTextServer, MAX_TEXT_LENGTH );
+
+ wchar_t* pTextClient = new wchar_t[ MAX_TEXT_LENGTH ];
+ pTextClient[0] = '\0';
+ LoadString( hInst, IDS_MSG_OPTIMIZED_FOR_CLIENT, pTextClient, MAX_TEXT_LENGTH );
+
+ wchar_t* pTextNoInstallation = new wchar_t[ MAX_TEXT_LENGTH ];
+ pTextNoInstallation[0] = '\0';
+ LoadString( hInst, IDS_MSG_NO_INSTALLATION_FOUND, pTextNoInstallation, MAX_TEXT_LENGTH );
+
+ LPVOID VBA = (void*)0x10000000;
+ wchar_t path[MAX_PATH];
+
+ wchar_t * pathEnd = getBrandPath(path);
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"libxml2.dll")) == NULL)
+ fail();
+ bool bFast = checkImageVirtualBaseAddress(path, VBA);
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"..\\basis-link")) == NULL)
+ fail();
+ pathEnd = tools::resolveLink(path);
+
+ if (pathEnd == NULL)
+ failPath(pAppTitle, pTextNoInstallation);
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\program\\vclmi.dll")) == NULL)
+ fail();
+ bFast &= checkImageVirtualBaseAddress(path, VBA);
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\ure-link")) == NULL)
+ fail();
+ pathEnd = tools::resolveLink(path);
+
+ if (pathEnd == NULL)
+ failPath(pAppTitle, pTextNoInstallation);
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\bin\\sal3.dll")) == NULL)
+ fail();
+ bFast &= checkImageVirtualBaseAddress(path, VBA);
+
+ const wchar_t* pOutput = pTextClient;
+ if (!bFast)
+ pOutput = pTextServer;
+
+ MessageBoxW( NULL, pOutput, pAppTitle, MB_OK );
+
+ return 0;
+}
diff --git a/desktop/win32/source/rebase/rebasegui.ulf b/desktop/win32/source/rebase/rebasegui.ulf
new file mode 100644
index 000000000000..ee6b6e828ac1
--- /dev/null
+++ b/desktop/win32/source/rebase/rebasegui.ulf
@@ -0,0 +1,11 @@
+[%APP_TITLE%]
+en-US = "Installation Status"
+
+[%MSG_OPTIMIZED_FOR_CLIENT%]
+en-US = "Installation is optimized for clients."
+
+[%MSG_OPTIMIZED_FOR_SERVER%]
+en-US = "Installation is optimized for servers."
+
+[%MSG_NO_INSTALLATION_FOUND%]
+en-US = "Cannot find Office installation."
diff --git a/desktop/win32/source/setup/makefile.mk b/desktop/win32/source/setup/makefile.mk
index 1453e896679f..d26c9c953861 100644
--- a/desktop/win32/source/setup/makefile.mk
+++ b/desktop/win32/source/setup/makefile.mk
@@ -91,5 +91,5 @@ APP1NOSVRES= $(RES)$/$(TARGET).res
.INCLUDE : target.mk
$(RCFILES) : $(ULFDIR)$/setup.ulf makefile.mk rcfooter.txt rcheader.txt rctmpl.txt
- $(WRAPCMD) lngconvex.exe -ulf $(ULFDIR)$/setup.ulf -rc $(RCFILES) -rct rctmpl.txt -rch rcheader.txt -rcf rcfooter.txt
+ $(LNGCONVEX) -ulf $(ULFDIR)$/setup.ulf -rc $(RCFILES) -rct rctmpl.txt -rch rcheader.txt -rcf rcfooter.txt
diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrallattribute3d.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrallattribute3d.hxx
index d15fef450931..0763c2129f0d 100644
--- a/drawinglayer/inc/drawinglayer/attribute/sdrallattribute3d.hxx
+++ b/drawinglayer/inc/drawinglayer/attribute/sdrallattribute3d.hxx
@@ -64,11 +64,11 @@ namespace drawinglayer
public:
SdrLineFillShadowAttribute(
- SdrLineAttribute* pLine = 0L,
- SdrFillAttribute* pFill = 0L,
- SdrLineStartEndAttribute* pLineStartEnd = 0L,
- SdrShadowAttribute* pShadow = 0L,
- FillGradientAttribute* pFillFloatTransGradient = 0L);
+ SdrLineAttribute* pLine = 0,
+ SdrFillAttribute* pFill = 0,
+ SdrLineStartEndAttribute* pLineStartEnd = 0,
+ SdrShadowAttribute* pShadow = 0,
+ FillGradientAttribute* pFillFloatTransGradient = 0);
~SdrLineFillShadowAttribute();
// copy constructor and assigment operator
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/chartprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/chartprimitive2d.hxx
index 2decc0bed799..95c53347debb 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/chartprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/chartprimitive2d.hxx
@@ -67,6 +67,8 @@ namespace drawinglayer
// provide unique ID
DeclPrimitrive2DIDBlock()
+
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
};
} // end of namespace primitive2d
} // end of namespace drawinglayer
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
index d9d784f56b41..8d5d089f5800 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
@@ -102,6 +102,7 @@
#define PRIMITIVE2D_ID_BORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 51)
#define PRIMITIVE2D_ID_POLYPOLYGONMARKERPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 52)
#define PRIMITIVE2D_ID_HITTESTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 53)
+#define PRIMITIVE2D_ID_INVERTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 54)
//////////////////////////////////////////////////////////////////////////////
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx
new file mode 100644
index 000000000000..ae7a316e03da
--- /dev/null
+++ b/drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: unifiedalphaprimitive2d.hxx,v $
+ *
+ * $Revision: 1.3 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11:17 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_INVERTPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_INVERTPRIMITIVE2D_HXX
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class InvertPrimitive2D : public GroupPrimitive2D
+ {
+ public:
+ InvertPrimitive2D(const Primitive2DSequence& rChildren);
+
+ // provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_INVERTPRIMITIVE2D_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx
new file mode 100644
index 000000000000..bd561cbab21a
--- /dev/null
+++ b/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: baseprimitive2d.hxx,v $
+ *
+ * $Revision: 1.8 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVE2DTOOLS_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVE2DTOOLS_HXX
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// tooling class for BasePrimitive2D baseed classes which are view-dependent
+// regarding the size of a discrete unit. The implementation of get2DDecomposition
+// guards the buffered local decomposition and ensures that a createLocalDecomposition
+// implementation may use an up-to-date DiscreteUnit accessible using getDiscreteUnit()
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class DiscreteMetricDependentPrimitive2D : public BasePrimitive2D
+ {
+ private:
+ // the last used fDiscreteUnit definitions for decomposition. Since this
+ // is checked and updated from get2DDecomposition() it will be current and
+ // usable in createLocalDecomposition()
+ double mfDiscreteUnit;
+
+ public:
+ DiscreteMetricDependentPrimitive2D()
+ : BasePrimitive2D(),
+ mfDiscreteUnit(0.0)
+ {
+ }
+
+ // data access
+ double getDiscreteUnit() const { return mfDiscreteUnit; }
+
+ // get local decomposition. Overloaded since this decomposition is view-dependent
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// tooling class for BasePrimitive2D baseed classes which are view-dependent
+// regarding the viewport. The implementation of get2DDecomposition
+// guards the buffered local decomposition and ensures that a createLocalDecomposition
+// implementation may use an up-to-date Viewport accessible using getViewport()
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class ViewportDependentPrimitive2D : public BasePrimitive2D
+ {
+ private:
+ // the last used Viewport definition for decomposition. Since this
+ // is checked and updated from get2DDecomposition() it will be current and
+ // usable in createLocalDecomposition()
+ basegfx::B2DRange maViewport;
+
+ public:
+ ViewportDependentPrimitive2D()
+ : BasePrimitive2D(),
+ maViewport()
+ {
+ }
+
+ // data access
+ const basegfx::B2DRange& getViewport() const { return maViewport; }
+
+ // get local decomposition. Overloaded since this decomposition is view-dependent
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVE2DTOOLS_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx
index 7a559d864229..d7fbfd4deaee 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx
@@ -86,7 +86,7 @@ namespace drawinglayer
// public helpers
// Geometry extractor. Shadow will be added as in createLocalDecomposition, but
// the 3D content is not converted to a bitmap visualisation but to projected 2D gemetry. This
- // helper is useful for Contour extraction.
+ // helper is useful e.g. for Contour extraction or HitTests.
Primitive2DSequence getGeometry2D(const geometry::ViewInformation2D& rViewInformation) const;
// constructor/destructor
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx
index fa3746108136..b9639aeacc50 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx
@@ -41,6 +41,7 @@
#include <tools/poly.hxx>
#include <basegfx/range/b2drange.hxx>
#include <vector>
+#include <com/sun/star/lang/Locale.hpp>
//////////////////////////////////////////////////////////////////////////////
// predefines
@@ -75,8 +76,8 @@ namespace drawinglayer
~TextLayouterDevice();
void setFont(const Font& rFont);
- void setFontAttributes(const FontAttributes& rFontAttributes, const basegfx::B2DHomMatrix& rTransform);
- void setFontAttributes(const FontAttributes& rFontAttributes, double fFontScaleX, double fFontScaleY);
+ void setFontAttributes(const FontAttributes& rFontAttributes, const basegfx::B2DHomMatrix& rTransform, const ::com::sun::star::lang::Locale & rLocale);
+ void setFontAttributes(const FontAttributes& rFontAttributes, double fFontScaleX, double fFontScaleY, const ::com::sun::star::lang::Locale & rLocale);
double getTextHeight() const;
double getOverlineHeight() const;
@@ -97,7 +98,10 @@ namespace drawinglayer
basegfx::B2DPolyPolygonVector&,
const String& rText,
xub_StrLen nIndex,
- xub_StrLen nLength);
+ xub_StrLen nLength,
+ // #i89784# added suppirt for DXArray for justified text
+ const ::std::vector< double >& rDXArray,
+ double fFontScaleWidth);
basegfx::B2DRange getTextBoundRect(
const String& rText,
@@ -119,11 +123,13 @@ namespace drawinglayer
double fFontScaleX,
double fFontScaleY,
double fFontRotation,
+ const ::com::sun::star::lang::Locale & rLocale,
const OutputDevice& rOutDev);
Font getVclFontFromFontAttributes(
const FontAttributes& rFontAttributes,
const basegfx::B2DHomMatrix& rTransform,
+ const ::com::sun::star::lang::Locale & rLocale,
const OutputDevice& rOutDev);
FontAttributes getFontAttributesFromVclFont(basegfx::B2DVector& rSize, const Font& rFont, bool bRTL, bool bBiDiStrong);
diff --git a/drawinglayer/inc/drawinglayer/processor2d/hittestprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/hittestprocessor2d.hxx
new file mode 100644
index 000000000000..1eeaefd2dade
--- /dev/null
+++ b/drawinglayer/inc/drawinglayer/processor2d/hittestprocessor2d.hxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: contourextractor2d.hxx,v $
+ *
+ * $Revision: 1.3 $
+ *
+ * last change: $Author: aw $ $Date: 2008-06-24 15:30:17 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_HITTESTPROCESSOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_HITTESTPROCESSOR2D_HXX
+
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+namespace basegfx { class B2DPolygon; }
+namespace basegfx { class B2DPolyPolygon; }
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ class HitTestProcessor2D : public BaseProcessor2D
+ {
+ private:
+ // discrete HitTest position
+ basegfx::B2DPoint maDiscreteHitPosition;
+
+ // discrete HitTolerance
+ double mfDiscreteHitTolerance;
+
+ // bitfield
+ unsigned mbHit : 1;
+ unsigned mbHitToleranceUsed : 1;
+
+ // this flag decides if primitives of type HitTestPrimitive2D
+ // will be taken into account for HitTesting or not. Those primitives
+ // are created for objects which are else completely invisible and normally
+ // their content exists of hairline primitives describing the object's contour
+ unsigned mbUseHitTestPrimitiveContent : 1;
+
+ // flag to concentraze on text hits only
+ unsigned mbHitTextOnly : 1;
+
+ // tooling methods
+ void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
+ bool checkHairlineHitWithTolerance(
+ const basegfx::B2DPolygon& rPolygon,
+ double fDiscreteHitTolerance);
+ bool checkFillHitWithTolerance(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ double fDiscreteHitTolerance);
+
+ public:
+ HitTestProcessor2D(
+ const geometry::ViewInformation2D& rViewInformation,
+ const basegfx::B2DPoint& rLogicHitPosition,
+ double fLogicHitTolerance,
+ bool bHitTextOnly);
+ virtual ~HitTestProcessor2D();
+
+ // data write access
+ void setUseHitTestPrimitiveContent(bool bNew)
+ {
+ if((bool)mbUseHitTestPrimitiveContent != bNew) mbUseHitTestPrimitiveContent = bNew;
+ }
+
+ // data read access
+ const basegfx::B2DPoint& getDiscreteHitPosition() const { return maDiscreteHitPosition; }
+ double getDiscreteHitTolerance() const { return mfDiscreteHitTolerance; }
+ bool getHit() const { return mbHit; }
+ bool getHitToleranceUsed() const { return mbHitToleranceUsed; }
+ bool getUseHitTestPrimitiveContent() const { return mbUseHitTestPrimitiveContent;}
+ bool getHitTextOnly() const { return mbHitTextOnly; }
+ };
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_HITTESTPROCESSOR2D_HXX
+
+// eof
diff --git a/drawinglayer/inc/drawinglayer/processor2d/linegeometryextractor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/linegeometryextractor2d.hxx
index bcd321d2fab3..b2697abece66 100644
--- a/drawinglayer/inc/drawinglayer/processor2d/linegeometryextractor2d.hxx
+++ b/drawinglayer/inc/drawinglayer/processor2d/linegeometryextractor2d.hxx
@@ -48,8 +48,8 @@ namespace drawinglayer
class LineGeometryExtractor2D : public BaseProcessor2D
{
private:
- basegfx::B2DPolyPolygon maExtractedHairlines;
- basegfx::B2DPolyPolygon maExtractedLineFills;
+ std::vector< basegfx::B2DPolygon > maExtractedHairlines;
+ std::vector< basegfx::B2DPolyPolygon > maExtractedLineFills;
// bitfield
unsigned mbInLineGeometry : 1;
@@ -61,8 +61,8 @@ namespace drawinglayer
LineGeometryExtractor2D(const geometry::ViewInformation2D& rViewInformation);
virtual ~LineGeometryExtractor2D();
- const basegfx::B2DPolyPolygon& getExtractedHairlines() const { return maExtractedHairlines; }
- const basegfx::B2DPolyPolygon& getExtractedLineFills() const { return maExtractedLineFills; }
+ const std::vector< basegfx::B2DPolygon >& getExtractedHairlines() const { return maExtractedHairlines; }
+ const std::vector< basegfx::B2DPolyPolygon >& getExtractedLineFills() const { return maExtractedLineFills; }
};
} // end of namespace processor2d
} // end of namespace drawinglayer
diff --git a/drawinglayer/inc/drawinglayer/processor2d/textaspolygonextractor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/textaspolygonextractor2d.hxx
new file mode 100644
index 000000000000..88d9416b612a
--- /dev/null
+++ b/drawinglayer/inc/drawinglayer/processor2d/textaspolygonextractor2d.hxx
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: linegeometryextractor2d.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: aw $ $Date: 2008-06-24 15:44:27 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_TEXTASPOLYGONEXTRACTOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_TEXTASPOLYGONEXTRACTOR2D_HXX
+
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/color/bcolormodifier.hxx>
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ // helper data structure for returning the result
+ struct TextAsPolygonDataNode
+ {
+ private:
+ basegfx::B2DPolyPolygon maB2DPolyPolygon;
+ basegfx::BColor maBColor;
+ bool mbIsFilled;
+
+ public:
+ TextAsPolygonDataNode(
+ const basegfx::B2DPolyPolygon& rB2DPolyPolygon,
+ const basegfx::BColor& rBColor,
+ bool bIsFilled)
+ : maB2DPolyPolygon(rB2DPolyPolygon),
+ maBColor(rBColor),
+ mbIsFilled(bIsFilled)
+ {
+ }
+
+ // data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maB2DPolyPolygon; }
+ const basegfx::BColor& getBColor() const { return maBColor; }
+ bool getIsFilled() const { return mbIsFilled; }
+ };
+
+ // typedef for a vector of that helper data
+ typedef ::std::vector< TextAsPolygonDataNode > TextAsPolygonDataNodeVector;
+
+ class TextAsPolygonExtractor2D : public BaseProcessor2D
+ {
+ private:
+ // extraction target
+ TextAsPolygonDataNodeVector maTarget;
+
+ // the modifiedColorPrimitive stack
+ basegfx::BColorModifierStack maBColorModifierStack;
+
+ // flag if we are in a decomposed text
+ sal_uInt32 mnInText;
+
+ // tooling methods
+ void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
+
+ public:
+ TextAsPolygonExtractor2D(const geometry::ViewInformation2D& rViewInformation);
+ virtual ~TextAsPolygonExtractor2D();
+
+ // data read access
+ const TextAsPolygonDataNodeVector& getTarget() const { return maTarget; }
+ };
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_TEXTASPOLYGONEXTRACTOR2D_HXX
+
+// eof
diff --git a/drawinglayer/prj/d.lst b/drawinglayer/prj/d.lst
index 213e787e4074..0068b32c24ae 100644
--- a/drawinglayer/prj/d.lst
+++ b/drawinglayer/prj/d.lst
@@ -25,6 +25,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d
..\inc\drawinglayer\primitive2d\groupprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\groupprimitive2d.hxx
..\inc\drawinglayer\primitive2d\helplineprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\helplineprimitive2d.hxx
..\inc\drawinglayer\primitive2d\hittestprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\hittestprimitive2d.hxx
+..\inc\drawinglayer\primitive2d\invertprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\invertprimitive2d.hxx
..\inc\drawinglayer\primitive2d\markerarrayprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\markerarrayprimitive2d.hxx
..\inc\drawinglayer\primitive2d\maskprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\maskprimitive2d.hxx
..\inc\drawinglayer\primitive2d\mediaprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\mediaprimitive2d.hxx
@@ -34,6 +35,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d
..\inc\drawinglayer\primitive2d\pointarrayprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\pointarrayprimitive2d.hxx
..\inc\drawinglayer\primitive2d\polygonprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\polygonprimitive2d.hxx
..\inc\drawinglayer\primitive2d\polypolygonprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\polypolygonprimitive2d.hxx
+..\inc\drawinglayer\primitive2d\primitivetools2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\primitivetools2d.hxx
..\inc\drawinglayer\primitive2d\sceneprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\sceneprimitive2d.hxx
..\inc\drawinglayer\primitive2d\shadowprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\shadowprimitive2d.hxx
..\inc\drawinglayer\primitive2d\structuretagprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\structuretagprimitive2d.hxx
@@ -83,6 +85,8 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\processor2d
..\inc\drawinglayer\processor2d\canvasprocessor.hxx %_DEST%\inc%_EXT%\drawinglayer\processor2d\canvasprocessor.hxx
..\inc\drawinglayer\processor2d\contourextractor2d.hxx %_DEST%\inc%_EXT%\drawinglayer\processor2d\contourextractor2d.hxx
..\inc\drawinglayer\processor2d\linegeometryextractor2d.hxx %_DEST%\inc%_EXT%\drawinglayer\processor2d\linegeometryextractor2d.hxx
+..\inc\drawinglayer\processor2d\hittestprocessor2d.hxx %_DEST%\inc%_EXT%\drawinglayer\processor2d\hittestprocessor2d.hxx
+..\inc\drawinglayer\processor2d\textaspolygonextractor2d.hxx %_DEST%\inc%_EXT%\drawinglayer\processor2d\textaspolygonextractor2d.hxx
mkdir: %_DEST%\inc%_EXT%\drawinglayer\processor3d
..\inc\drawinglayer\processor3d\baseprocessor3d.hxx %_DEST%\inc%_EXT%\drawinglayer\processor3d\baseprocessor3d.hxx
diff --git a/drawinglayer/source/attribute/sdrallattribute3d.cxx b/drawinglayer/source/attribute/sdrallattribute3d.cxx
index 44875dda2d19..264d8d0432d1 100644
--- a/drawinglayer/source/attribute/sdrallattribute3d.cxx
+++ b/drawinglayer/source/attribute/sdrallattribute3d.cxx
@@ -64,17 +64,15 @@ namespace drawinglayer
{
}
- SdrLineFillShadowAttribute::SdrLineFillShadowAttribute(const SdrLineFillShadowAttribute& rCandidate)
- : mpShadow(0L),
- mpLine(0L),
- mpLineStartEnd(0L),
- mpFill(0L),
- mpFillFloatTransGradient(0L)
+ SdrLineFillShadowAttribute::SdrLineFillShadowAttribute(
+ const SdrLineFillShadowAttribute& rCandidate)
+ : mpShadow(0),
+ mpLine(0),
+ mpLineStartEnd(0),
+ mpFill(0),
+ mpFillFloatTransGradient(0)
{
- if(!(*this == rCandidate))
- {
- *this = rCandidate;
- }
+ *this = rCandidate;
}
SdrLineFillShadowAttribute::~SdrLineFillShadowAttribute()
@@ -91,14 +89,14 @@ namespace drawinglayer
// handle mpShadow
{
// delete local mpShadow if necessary
- if(mpShadow && ((!rCandidate.mpShadow) || (!(*mpShadow == *rCandidate.mpShadow))))
+ if(mpShadow)
{
delete mpShadow;
- mpShadow = 0L;
+ mpShadow = 0;
}
// copy mpShadow if necessary
- if(!mpShadow && rCandidate.mpShadow)
+ if(rCandidate.mpShadow)
{
mpShadow = new SdrShadowAttribute(*rCandidate.mpShadow);
}
@@ -107,14 +105,14 @@ namespace drawinglayer
// handle mpLine
{
// delete local mpLine if necessary
- if(mpLine && ((!rCandidate.mpLine) || (!(*mpLine == *rCandidate.mpLine))))
+ if(mpLine)
{
delete mpLine;
- mpLine = 0L;
+ mpLine = 0;
}
// copy mpLine if necessary
- if(!mpLine && rCandidate.mpLine)
+ if(rCandidate.mpLine)
{
mpLine = new SdrLineAttribute(*rCandidate.mpLine);
}
@@ -123,14 +121,14 @@ namespace drawinglayer
// handle mpLineStartEnd
{
// delete local mpLineStartEnd if necessary
- if(mpLineStartEnd && ((!rCandidate.mpLineStartEnd) || (!(*mpLineStartEnd == *rCandidate.mpLineStartEnd))))
+ if(mpLineStartEnd)
{
delete mpLineStartEnd;
- mpLineStartEnd = 0L;
+ mpLineStartEnd = 0;
}
// copy mpLineStartEnd if necessary
- if(!mpLineStartEnd && rCandidate.mpLineStartEnd)
+ if(rCandidate.mpLineStartEnd)
{
mpLineStartEnd = new SdrLineStartEndAttribute(*rCandidate.mpLineStartEnd);
}
@@ -139,14 +137,14 @@ namespace drawinglayer
// handle mpFill
{
// delete local mpFill if necessary
- if(mpFill && ((!rCandidate.mpFill) || (!(*mpFill == *rCandidate.mpFill))))
+ if(mpFill)
{
delete mpFill;
- mpFill = 0L;
+ mpFill = 0;
}
// copy mpFill if necessary
- if(!mpFill && rCandidate.mpFill)
+ if(rCandidate.mpFill)
{
mpFill = new SdrFillAttribute(*rCandidate.mpFill);
}
@@ -155,14 +153,14 @@ namespace drawinglayer
// handle mpFillFloatTransGradient
{
// delete local mpFillFloatTransGradient if necessary
- if(mpFillFloatTransGradient && ((!rCandidate.mpFillFloatTransGradient) || (!(*mpFillFloatTransGradient == *rCandidate.mpFillFloatTransGradient))))
+ if(mpFillFloatTransGradient)
{
delete mpFillFloatTransGradient;
- mpFillFloatTransGradient = 0L;
+ mpFillFloatTransGradient = 0;
}
// copy mpFillFloatTransGradient if necessary
- if(!mpFillFloatTransGradient && rCandidate.mpFillFloatTransGradient)
+ if(rCandidate.mpFillFloatTransGradient)
{
mpFillFloatTransGradient = new FillGradientAttribute(*rCandidate.mpFillFloatTransGradient);
}
diff --git a/drawinglayer/source/primitive2d/chartprimitive2d.cxx b/drawinglayer/source/primitive2d/chartprimitive2d.cxx
index 6086b54000a1..3df6464f8aeb 100644
--- a/drawinglayer/source/primitive2d/chartprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/chartprimitive2d.cxx
@@ -76,6 +76,13 @@ namespace drawinglayer
// provide unique ID
ImplPrimitrive2DIDBlock(ChartPrimitive2D, PRIMITIVE2D_ID_CHARTPRIMITIVE2D)
+ basegfx::B2DRange ChartPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0);
+ aRetval.transform(getTransformation());
+ return aRetval;
+ }
+
} // end of namespace primitive2d
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/primitive2d/invertprimitive2d.cxx b/drawinglayer/source/primitive2d/invertprimitive2d.cxx
new file mode 100644
index 000000000000..374ec578113d
--- /dev/null
+++ b/drawinglayer/source/primitive2d/invertprimitive2d.cxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: unifiedalphaprimitive2d.cxx,v $
+ *
+ * $Revision: 1.5 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <drawinglayer/primitive2d/invertprimitive2d.hxx>
+#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ InvertPrimitive2D::InvertPrimitive2D(
+ const Primitive2DSequence& rChildren)
+ : GroupPrimitive2D(rChildren)
+ {
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(InvertPrimitive2D, PRIMITIVE2D_ID_INVERTPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/source/primitive2d/makefile.mk b/drawinglayer/source/primitive2d/makefile.mk
index b909d0fde9f5..e10d1ddbcc71 100644
--- a/drawinglayer/source/primitive2d/makefile.mk
+++ b/drawinglayer/source/primitive2d/makefile.mk
@@ -62,6 +62,7 @@ SLOFILES= \
$(SLO)$/groupprimitive2d.obj \
$(SLO)$/helplineprimitive2d.obj \
$(SLO)$/hittestprimitive2d.obj \
+ $(SLO)$/invertprimitive2d.obj \
$(SLO)$/markerarrayprimitive2d.obj \
$(SLO)$/pointarrayprimitive2d.obj \
$(SLO)$/maskprimitive2d.obj \
@@ -71,6 +72,7 @@ SLOFILES= \
$(SLO)$/pagepreviewprimitive2d.obj \
$(SLO)$/polypolygonprimitive2d.obj \
$(SLO)$/polygonprimitive2d.obj \
+ $(SLO)$/primitivetools2d.obj \
$(SLO)$/sceneprimitive2d.obj \
$(SLO)$/shadowprimitive2d.obj \
$(SLO)$/structuretagprimitive2d.obj \
diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
index a795e84ed433..b5212da54688 100644
--- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
@@ -116,7 +116,7 @@ namespace drawinglayer
const basegfx::B2DVector aDashVector(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(getDiscreteDashLength(), 0.0));
const double fLogicDashLength(aDashVector.getX());
- if(fLogicDashLength > 0.0)
+ if(fLogicDashLength > 0.0 && !getRGBColorA().equal(getRGBColorB()))
{
// apply dashing; get line and gap snippets
::std::vector< double > aDash;
@@ -239,17 +239,19 @@ namespace drawinglayer
{
if(getB2DPolygon().count())
{
+ // #i102241# try to simplify before usage
+ const basegfx::B2DPolygon aB2DPolygon(basegfx::tools::simplifyCurveSegments(getB2DPolygon()));
basegfx::B2DPolyPolygon aHairLinePolyPolygon;
if(0.0 == getStrokeAttribute().getFullDotDashLen())
{
// no line dashing, just copy
- aHairLinePolyPolygon.append(getB2DPolygon());
+ aHairLinePolyPolygon.append(aB2DPolygon);
}
else
{
// apply LineStyle
- basegfx::tools::applyLineDashing(getB2DPolygon(), getStrokeAttribute().getDotDashArray(), &aHairLinePolyPolygon, 0, getStrokeAttribute().getFullDotDashLen());
+ basegfx::tools::applyLineDashing(aB2DPolygon, getStrokeAttribute().getDotDashArray(), &aHairLinePolyPolygon, 0, getStrokeAttribute().getFullDotDashLen());
}
const sal_uInt32 nCount(aHairLinePolyPolygon.count());
@@ -263,12 +265,9 @@ namespace drawinglayer
for(sal_uInt32 a(0L); a < nCount; a++)
{
- // AW: New version of createAreaGeometry; now creates bezier polygons
+ // New version of createAreaGeometry; now creates bezier polygons
aAreaPolyPolygon.append(basegfx::tools::createAreaGeometry(
aHairLinePolyPolygon.getB2DPolygon(a), fHalfLineWidth, aLineJoin));
- //const basegfx::B2DPolyPolygon aNewPolyPolygon(basegfx::tools::createAreaGeometryForPolygon(
- // aHairLinePolyPolygon.getB2DPolygon(a), fHalfLineWidth, aLineJoin, fMiterMinimumAngle));
- //aAreaPolyPolygon.append(aNewPolyPolygon);
}
// prepare return value
diff --git a/drawinglayer/source/primitive2d/primitivetools2d.cxx b/drawinglayer/source/primitive2d/primitivetools2d.cxx
new file mode 100644
index 000000000000..d288a697d729
--- /dev/null
+++ b/drawinglayer/source/primitive2d/primitivetools2d.cxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: baseprimitive2d.cxx,v $
+ *
+ * $Revision: 1.6 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence DiscreteMetricDependentPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ // get the current DiscreteUnit
+ const double fDiscreteUnit((rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)).getLength());
+
+ if(getLocalDecomposition().hasElements() && !basegfx::fTools::equal(fDiscreteUnit, getDiscreteUnit()))
+ {
+ // conditions of last local decomposition have changed, delete
+ const_cast< DiscreteMetricDependentPrimitive2D* >(this)->setLocalDecomposition(Primitive2DSequence());
+ }
+
+ if(!getLocalDecomposition().hasElements())
+ {
+ // remember new valid DiscreteUnit
+ const_cast< DiscreteMetricDependentPrimitive2D* >(this)->mfDiscreteUnit = fDiscreteUnit;
+ }
+
+ // call base implementation
+ return BasePrimitive2D::get2DDecomposition(rViewInformation);
+ }
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence ViewportDependentPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ // get the current Viewport
+ const basegfx::B2DRange& rViewport = rViewInformation.getViewport();
+
+ if(getLocalDecomposition().hasElements() && !rViewport.equal(getViewport()))
+ {
+ // conditions of last local decomposition have changed, delete
+ const_cast< ViewportDependentPrimitive2D* >(this)->setLocalDecomposition(Primitive2DSequence());
+ }
+
+ if(!getLocalDecomposition().hasElements())
+ {
+ // remember new valid DiscreteUnit
+ const_cast< ViewportDependentPrimitive2D* >(this)->maViewport = rViewport;
+ }
+
+ // call base implementation
+ return BasePrimitive2D::get2DDecomposition(rViewInformation);
+ }
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
index 73d26a71fa4c..f52af2da6a6d 100644
--- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
@@ -363,11 +363,13 @@ namespace drawinglayer
basegfx::B2DRange aDiscreteRange;
basegfx::B2DRange aUnitVisibleRange;
bool bNeedNewDecomposition(false);
+ bool bDiscreteSizesAreCalculated(false);
if(getLocalDecomposition().hasElements())
{
basegfx::B2DRange aVisibleDiscreteRange;
calculateDsicreteSizes(rViewInformation, aDiscreteRange, aVisibleDiscreteRange, aUnitVisibleRange);
+ bDiscreteSizesAreCalculated = true;
// display has changed and cannot be reused when resolution did change
if(!basegfx::fTools::equal(aDiscreteRange.getWidth(), mfOldDiscreteSizeX) ||
@@ -395,6 +397,12 @@ namespace drawinglayer
if(!getLocalDecomposition().hasElements())
{
+ if(!bDiscreteSizesAreCalculated)
+ {
+ basegfx::B2DRange aVisibleDiscreteRange;
+ calculateDsicreteSizes(rViewInformation, aDiscreteRange, aVisibleDiscreteRange, aUnitVisibleRange);
+ }
+
// remember last used NewDiscreteSize and NewUnitVisiblePart
ScenePrimitive2D* pThat = const_cast< ScenePrimitive2D* >(this);
pThat->mfOldDiscreteSizeX = aDiscreteRange.getWidth();
diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
index 4faa85fe898c..94e92a149e50 100644
--- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
@@ -305,7 +305,7 @@ namespace drawinglayer
// TextLayouterDevice is needed to get metrics for text decorations like
// underline/strikeout/emphasis marks from it. For setup, the font size is needed
- aTextLayouter.setFontAttributes(getFontAttributes(), rDecTrans.getScale().getX(), rDecTrans.getScale().getY());
+ aTextLayouter.setFontAttributes(getFontAttributes(), rDecTrans.getScale().getX(), rDecTrans.getScale().getY(), getLocale());
// get text width
double fTextWidth(0.0);
@@ -526,7 +526,7 @@ namespace drawinglayer
if(bNoDXArray)
{
// ..but only completely when no DXArray
- aTextLayouter.setFontAttributes(getFontAttributes(), rDecTrans.getScale().getX(), rDecTrans.getScale().getY());
+ aTextLayouter.setFontAttributes(getFontAttributes(), rDecTrans.getScale().getX(), rDecTrans.getScale().getY(),getLocale());
}
// do iterate over single words
diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
index b8f7d59e6f05..75e66a5422d2 100644
--- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx
+++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
@@ -41,6 +41,7 @@
#include <vcl/virdev.hxx>
#include <vcl/font.hxx>
#include <vcl/metric.hxx>
+#include <i18npool/mslangid.hxx>
#include <drawinglayer/primitive2d/textprimitive2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -165,14 +166,14 @@ namespace drawinglayer
mrDevice.SetFont( rFont );
}
- void TextLayouterDevice::setFontAttributes(const FontAttributes& rFontAttributes, const basegfx::B2DHomMatrix& rTransform)
+ void TextLayouterDevice::setFontAttributes(const FontAttributes& rFontAttributes, const basegfx::B2DHomMatrix& rTransform, const ::com::sun::star::lang::Locale & rLocale)
{
- setFont(getVclFontFromFontAttributes(rFontAttributes, rTransform, mrDevice));
+ setFont(getVclFontFromFontAttributes(rFontAttributes, rTransform, rLocale, mrDevice));
}
- void TextLayouterDevice::setFontAttributes(const FontAttributes& rFontAttributes, double fFontScaleX, double fFontScaleY)
+ void TextLayouterDevice::setFontAttributes(const FontAttributes& rFontAttributes, double fFontScaleX, double fFontScaleY, const ::com::sun::star::lang::Locale & rLocale)
{
- setFont(getVclFontFromFontAttributes(rFontAttributes, fFontScaleX, fFontScaleY, 0.0, mrDevice));
+ setFont(getVclFontFromFontAttributes(rFontAttributes, fFontScaleX, fFontScaleY, 0.0, rLocale, mrDevice));
}
double TextLayouterDevice::getOverlineOffset() const
@@ -239,8 +240,25 @@ namespace drawinglayer
basegfx::B2DPolyPolygonVector& rB2DPolyPolyVector,
const String& rText,
xub_StrLen nIndex,
- xub_StrLen nLength)
+ xub_StrLen nLength,
+ // #i89784# added suppirt for DXArray for justified text
+ const ::std::vector< double >& rDXArray,
+ double fFontScaleWidth)
{
+ std::vector< sal_Int32 > aTransformedDXArray;
+ const sal_uInt32 nDXArraySize(rDXArray.size());
+
+ if(nDXArraySize && basegfx::fTools::more(fFontScaleWidth, 0.0))
+ {
+ OSL_ENSURE(nDXArraySize == nLength, "DXArray size does not correspond to text portion size (!)");
+ aTransformedDXArray.reserve(nDXArraySize);
+
+ for(std::vector< double >::const_iterator aStart(rDXArray.begin()); aStart != rDXArray.end(); aStart++)
+ {
+ aTransformedDXArray.push_back(basegfx::fround((*aStart) * fFontScaleWidth));
+ }
+ }
+
return mrDevice.GetTextOutlines(
rB2DPolyPolyVector,
rText,
@@ -249,7 +267,7 @@ namespace drawinglayer
nLength,
true,
0,
- 0);
+ nDXArraySize ? &(aTransformedDXArray[0]) : 0);
}
basegfx::B2DRange TextLayouterDevice::getTextBoundRect(
@@ -288,6 +306,7 @@ namespace drawinglayer
Font getVclFontFromFontAttributes(
const FontAttributes& rFontAttributes,
const basegfx::B2DHomMatrix& rTransform,
+ const ::com::sun::star::lang::Locale & rLocale,
const OutputDevice& rOutDev)
{
// decompose matrix to have position and size of text
@@ -296,7 +315,7 @@ namespace drawinglayer
rTransform.decompose(aScale, aTranslate, fRotate, fShearX);
- return getVclFontFromFontAttributes(rFontAttributes, aScale.getX(), aScale.getY(), fRotate, rOutDev);
+ return getVclFontFromFontAttributes(rFontAttributes, aScale.getX(), aScale.getY(), fRotate, rLocale, rOutDev);
}
Font getVclFontFromFontAttributes(
@@ -304,6 +323,7 @@ namespace drawinglayer
double fFontScaleX,
double fFontScaleY,
double fFontRotation,
+ const ::com::sun::star::lang::Locale & rLocale,
const OutputDevice& /*rOutDev*/)
{
sal_uInt32 nWidth(basegfx::fround(fabs(fFontScaleX)));
@@ -323,6 +343,7 @@ namespace drawinglayer
aRetval.SetWeight(static_cast<FontWeight>(rFontAttributes.getWeight()));
aRetval.SetItalic(rFontAttributes.getItalic() ? ITALIC_NORMAL : ITALIC_NONE);
aRetval.SetOutline(rFontAttributes.getOutline());
+ aRetval.SetLanguage(MsLangId::convertLocaleToLanguage(rLocale));
#ifdef WIN32
// #100424# use higher precision
diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx
index bf46f4ab21d0..8188265ff8e7 100644
--- a/drawinglayer/source/primitive2d/textprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx
@@ -145,17 +145,25 @@ namespace drawinglayer
// prepare textlayoutdevice
TextLayouterDevice aTextLayouter;
- aTextLayouter.setFontAttributes(getFontAttributes(), aFontScale.getX(), aFontScale.getY());
+ aTextLayouter.setFontAttributes(getFontAttributes(), aFontScale.getX(), aFontScale.getY(), getLocale());
#ifdef WIN32
// when under Windows and the font is unequally scaled, need to correct font X-Scaling factor
if(bCorrectScale)
{
- aScale.setX(aScale.getX() * aTextLayouter.getCurrentFontRelation());
+ const double fFontRelation(aTextLayouter.getCurrentFontRelation());
+ aScale.setX(aScale.getX() * fFontRelation);
+ aFontScale.setX(aFontScale.getX() / fFontRelation);
}
#endif
// get the text outlines. No DXArray is given (would contain integers equal to unit vector
// transformed by object's transformation), let VCL do the job
- aTextLayouter.getTextOutlines(rTarget, getText(), getTextPosition(), getTextLength());
+ aTextLayouter.getTextOutlines(
+ rTarget, getText(),
+ getTextPosition(),
+ getTextLength(),
+ // #i89784# added support for DXArray for justified text
+ getDXArray(),
+ aFontScale.getX());
// create primitives for the outlines
const sal_uInt32 nCount(rTarget.size());
@@ -300,7 +308,7 @@ namespace drawinglayer
// prepare textlayoutdevice
TextLayouterDevice aTextLayouter;
- aTextLayouter.setFontAttributes(getFontAttributes(), aFontScale.getX(), aFontScale.getY());
+ aTextLayouter.setFontAttributes(getFontAttributes(), aFontScale.getX(), aFontScale.getY(), getLocale());
// get basic text range
basegfx::B2DRange aNewRange(aTextLayouter.getTextBoundRect(getText(), getTextPosition(), getTextLength()));
diff --git a/drawinglayer/source/processor2d/canvasprocessor.cxx b/drawinglayer/source/processor2d/canvasprocessor.cxx
index f4a8a7b5282d..a60162de6ee0 100644
--- a/drawinglayer/source/processor2d/canvasprocessor.cxx
+++ b/drawinglayer/source/processor2d/canvasprocessor.cxx
@@ -2106,7 +2106,10 @@ namespace drawinglayer
mpOutputDevice->Push(PUSH_MAPMODE);
mpOutputDevice->SetMapMode(maOriginalMapMode);
- if(!renderChartPrimitive2D(rChartPrimitive, *mpOutputDevice))
+ if(!renderChartPrimitive2D(
+ rChartPrimitive,
+ *mpOutputDevice,
+ getViewInformation2D()))
{
// fallback to decomposition (MetaFile)
process(rChartPrimitive.get2DDecomposition(getViewInformation2D()));
diff --git a/drawinglayer/source/processor2d/helperchartrenderer.cxx b/drawinglayer/source/processor2d/helperchartrenderer.cxx
index c2d99604469b..ffa8917ddec8 100644
--- a/drawinglayer/source/processor2d/helperchartrenderer.cxx
+++ b/drawinglayer/source/processor2d/helperchartrenderer.cxx
@@ -41,6 +41,7 @@
#include <svtools/chartprettypainter.hxx>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <drawinglayer/geometry/viewinformation2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -50,7 +51,10 @@ using namespace com::sun::star;
namespace drawinglayer
{
- bool renderChartPrimitive2D(const primitive2d::ChartPrimitive2D& rChartCandidate, OutputDevice& rOutputDevice)
+ bool renderChartPrimitive2D(
+ const primitive2d::ChartPrimitive2D& rChartCandidate,
+ OutputDevice& rOutputDevice,
+ const geometry::ViewInformation2D& rViewInformation2D)
{
bool bChartRendered(false);
@@ -73,14 +77,74 @@ namespace drawinglayer
if( pPrettyPainter )
{
- // create logic object range
+ // create logic object range; do NOT use ObjectTransformation for this
+ // (rViewInformation2D.getObjectTransformation()), only the logic object
+ // size is wanted
basegfx::B2DRange aObjectRange(0.0, 0.0, 1.0, 1.0);
aObjectRange.transform(rChartCandidate.getTransformation());
const Rectangle aRectangle(
(sal_Int32)aObjectRange.getMinX(), (sal_Int32)aObjectRange.getMinY(),
(sal_Int32)aObjectRange.getMaxX(), (sal_Int32)aObjectRange.getMaxY());
- bChartRendered = pPrettyPainter->DoPaint(&rOutputDevice, aRectangle);
+ // #i101811#
+ if(rViewInformation2D.getObjectTransformation().isIdentity())
+ {
+ // no embedding in another transfromation, just paint with existing
+ // MapMode. This is just a shortcut; using the below code will also
+ // work; it has just a neutral ObjectTransformation
+ bChartRendered = pPrettyPainter->DoPaint(&rOutputDevice, aRectangle);
+ }
+ else
+ {
+ // rViewInformation2D.getObjectTransformation() is used and
+ // needs to be expressed in the MapMode for the PrettyPainter;
+ // else it would call ChartModelHelper::setPageSize(...) with the
+ // changed size what really will change the chart model and leads
+ // to re-layouts and re-formattings
+ const MapMode aOldMapMode(rOutputDevice.GetMapMode());
+ basegfx::B2DVector aVTScale, aScale, aTranslate;
+ double fRotate, fShearX;
+
+ // get basic scaling with current MapMode (aVTScale), containing
+ // mapping for set MapUnit (e.g. for 100th mm, the basic scale is
+ // not 1.0, 1.0). This is needed since this scale is included in
+ // the ObjectToView Transformation and needs to be removed (see
+ // correction below) to re-create a MapMode
+ rOutputDevice.SetMapMode(aOldMapMode.GetMapUnit());
+ rOutputDevice.GetViewTransformation().decompose(aVTScale, aTranslate, fRotate, fShearX);
+
+ // get complete ObjectToView Transformation scale and translate from current
+ // transformation chain (combined view and object transform)
+ rViewInformation2D.getObjectToViewTransformation().decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // assert when shear and/or rotation is used
+ OSL_ENSURE(basegfx::fTools::equalZero(fRotate), "Chart PrettyPrinting with unsupportable rotation (!)");
+ OSL_ENSURE(basegfx::fTools::equalZero(fShearX), "Chart PrettyPrinting with unsupportable shear (!)");
+
+ // clean scale and translate from basic scaling (DPI, etc...)
+ // since this will implicitely be part of the to-be-created MapMode
+ const basegfx::B2DTuple aBasicCleaner(
+ basegfx::fTools::equalZero(aVTScale.getX()) ? 1.0 : 1.0 / aVTScale.getX(),
+ basegfx::fTools::equalZero(aVTScale.getY()) ? 1.0 : 1.0 / aVTScale.getY());
+ aScale *= aBasicCleaner;
+ aTranslate *= aBasicCleaner;
+
+ // for MapMode, take scale out of translation
+ const basegfx::B2DTuple aScaleRemover(
+ basegfx::fTools::equalZero(aScale.getX()) ? 1.0 : 1.0 / aScale.getX(),
+ basegfx::fTools::equalZero(aScale.getY()) ? 1.0 : 1.0 / aScale.getY());
+ aTranslate *= aScaleRemover;
+
+ // build new MapMode
+ const MapMode aNewMapMode(aOldMapMode.GetMapUnit(),
+ Point(basegfx::fround(aTranslate.getX()), basegfx::fround(aTranslate.getY())),
+ Fraction(aScale.getX()), Fraction(aScale.getY()));
+
+ // use, paint, restore
+ rOutputDevice.SetMapMode(aNewMapMode);
+ bChartRendered = pPrettyPainter->DoPaint(&rOutputDevice, aRectangle);
+ rOutputDevice.SetMapMode(aOldMapMode);
+ }
}
}
}
diff --git a/drawinglayer/source/processor2d/helperchartrenderer.hxx b/drawinglayer/source/processor2d/helperchartrenderer.hxx
index de13431c79c0..4677698129c2 100644
--- a/drawinglayer/source/processor2d/helperchartrenderer.hxx
+++ b/drawinglayer/source/processor2d/helperchartrenderer.hxx
@@ -43,16 +43,21 @@
class OutputDevice;
-namespace drawinglayer { namespace primitive2d {
- class ChartPrimitive2D;
-}}
+namespace drawinglayer { namespace primitive2d { class ChartPrimitive2D; }}
+namespace drawinglayer { namespace geometry { class ViewInformation2D; }}
//////////////////////////////////////////////////////////////////////////////
// support chart PrettyPrinter usage from primitives
namespace drawinglayer
{
- bool renderChartPrimitive2D(const primitive2d::ChartPrimitive2D& rChartCandidate, OutputDevice& rOutputDevice);
+ // #i101811#
+ // Added current ViewInformation2D to take evtl. changed
+ // ObjectTransformation into account
+ bool renderChartPrimitive2D(
+ const primitive2d::ChartPrimitive2D& rChartCandidate,
+ OutputDevice& rOutputDevice,
+ const geometry::ViewInformation2D& rViewInformation2D);
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx b/drawinglayer/source/processor2d/hittestprocessor2d.cxx
new file mode 100644
index 000000000000..8a2d732cbb2f
--- /dev/null
+++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx
@@ -0,0 +1,451 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: contourextractor2d.cxx,v $
+ *
+ * $Revision: 1.6 $
+ *
+ * last change: $Author: aw $ $Date: 2008-06-24 15:31:08 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <drawinglayer/processor2d/hittestprocessor2d.hxx>
+#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <drawinglayer/primitive2d/alphaprimitive2d.hxx>
+#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
+#include <drawinglayer/primitive2d/sceneprimitive2d.hxx>
+#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
+#include <drawinglayer/primitive2d/pointarrayprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ HitTestProcessor2D::HitTestProcessor2D(const geometry::ViewInformation2D& rViewInformation,
+ const basegfx::B2DPoint& rLogicHitPosition,
+ double fLogicHitTolerance,
+ bool bHitTextOnly)
+ : BaseProcessor2D(rViewInformation),
+ maDiscreteHitPosition(),
+ mfDiscreteHitTolerance(0.0),
+ mbHit(false),
+ mbHitToleranceUsed(false),
+ mbUseHitTestPrimitiveContent(true),
+ mbHitTextOnly(bHitTextOnly)
+ {
+ // init hit tolerance
+ mfDiscreteHitTolerance = fLogicHitTolerance;
+
+ if(basegfx::fTools::less(mfDiscreteHitTolerance, 0.0))
+ {
+ // ensure input parameter for hit tolerance is >= 0.0
+ mfDiscreteHitTolerance = 0.0;
+ }
+ else if(basegfx::fTools::more(mfDiscreteHitTolerance, 0.0))
+ {
+ // generate discrete hit tolerance
+ mfDiscreteHitTolerance = (getViewInformation2D().getObjectToViewTransformation()
+ * basegfx::B2DVector(mfDiscreteHitTolerance, 0.0)).getLength();
+ }
+
+ // gererate discrete hit position
+ maDiscreteHitPosition = getViewInformation2D().getObjectToViewTransformation() * rLogicHitPosition;
+
+ // check if HitTolerance is used
+ mbHitToleranceUsed = basegfx::fTools::more(getDiscreteHitTolerance(), 0.0);
+ }
+
+ HitTestProcessor2D::~HitTestProcessor2D()
+ {
+ }
+
+ bool HitTestProcessor2D::checkHairlineHitWithTolerance(
+ const basegfx::B2DPolygon& rPolygon,
+ double fDiscreteHitTolerance)
+ {
+ basegfx::B2DPolygon aLocalPolygon(rPolygon);
+ aLocalPolygon.transform(getViewInformation2D().getObjectToViewTransformation());
+
+ // get discrete range
+ basegfx::B2DRange aPolygonRange(aLocalPolygon.getB2DRange());
+
+ if(basegfx::fTools::more(fDiscreteHitTolerance, 0.0))
+ {
+ aPolygonRange.grow(fDiscreteHitTolerance);
+ }
+
+ // do rough range test first
+ if(aPolygonRange.isInside(getDiscreteHitPosition()))
+ {
+ // check if a polygon edge is hit
+ return basegfx::tools::isInEpsilonRange(
+ aLocalPolygon,
+ getDiscreteHitPosition(),
+ fDiscreteHitTolerance);
+ }
+
+ return false;
+ }
+
+ bool HitTestProcessor2D::checkFillHitWithTolerance(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ double fDiscreteHitTolerance)
+ {
+ bool bRetval(false);
+ basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolyPolygon);
+ aLocalPolyPolygon.transform(getViewInformation2D().getObjectToViewTransformation());
+
+ // get discrete range
+ basegfx::B2DRange aPolygonRange(aLocalPolyPolygon.getB2DRange());
+ const bool bDiscreteHitToleranceUsed(basegfx::fTools::more(fDiscreteHitTolerance, 0.0));
+
+ if(bDiscreteHitToleranceUsed)
+ {
+ aPolygonRange.grow(fDiscreteHitTolerance);
+ }
+
+ // do rough range test first
+ if(aPolygonRange.isInside(getDiscreteHitPosition()))
+ {
+ // if a HitTolerance is given, check for polygon edge hit in epsilon first
+ if(bDiscreteHitToleranceUsed &&
+ basegfx::tools::isInEpsilonRange(
+ aLocalPolyPolygon,
+ getDiscreteHitPosition(),
+ fDiscreteHitTolerance))
+ {
+ bRetval = true;
+ }
+
+ // check for hit in filled polyPolygon
+ if(!bRetval && basegfx::tools::isInside(
+ aLocalPolyPolygon,
+ getDiscreteHitPosition(),
+ true))
+ {
+ bRetval = true;
+ }
+ }
+
+ return bRetval;
+ }
+
+ void HitTestProcessor2D::processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate)
+ {
+ if(getHit())
+ {
+ // stop processing as soon as a hit was recognized
+ return;
+ }
+
+ switch(rCandidate.getPrimitiveID())
+ {
+ case PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D :
+ {
+ // remember current ViewInformation2D
+ const primitive2d::TransformPrimitive2D& rTransformCandidate(static_cast< const primitive2d::TransformPrimitive2D& >(rCandidate));
+ const geometry::ViewInformation2D aLastViewInformation2D(getViewInformation2D());
+
+ // create new local ViewInformation2D containing transformation
+ const geometry::ViewInformation2D aViewInformation2D(
+ getViewInformation2D().getObjectTransformation() * rTransformCandidate.getTransformation(),
+ getViewInformation2D().getViewTransformation(),
+ getViewInformation2D().getViewport(),
+ getViewInformation2D().getVisualizedPage(),
+ getViewInformation2D().getViewTime(),
+ getViewInformation2D().getExtendedInformationSequence());
+ updateViewInformation(aViewInformation2D);
+
+ // proccess child content recursively
+ process(rTransformCandidate.getChildren());
+
+ // restore transformations
+ updateViewInformation(aLastViewInformation2D);
+
+ break;
+ }
+ case PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D :
+ {
+ if(!getHitTextOnly())
+ {
+ // create hairline in discrete coordinates
+ const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate(static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate));
+
+ // use hairline test
+ mbHit = checkHairlineHitWithTolerance(rPolygonCandidate.getB2DPolygon(), getDiscreteHitTolerance());
+ }
+
+ break;
+ }
+ case PRIMITIVE2D_ID_POLYGONMARKERPRIMITIVE2D :
+ {
+ if(!getHitTextOnly())
+ {
+ // handle marker like hairline; no need to decompose in dashes
+ const primitive2d::PolygonMarkerPrimitive2D& rPolygonCandidate(static_cast< const primitive2d::PolygonMarkerPrimitive2D& >(rCandidate));
+
+ // use hairline test
+ mbHit = checkHairlineHitWithTolerance(rPolygonCandidate.getB2DPolygon(), getDiscreteHitTolerance());
+ }
+
+ break;
+ }
+ case PRIMITIVE2D_ID_POLYGONSTROKEPRIMITIVE2D :
+ {
+ if(!getHitTextOnly())
+ {
+ // handle stroke evtl. directly; no need to decompose to filled polygon outlines
+ const primitive2d::PolygonStrokePrimitive2D& rPolygonCandidate(static_cast< const primitive2d::PolygonStrokePrimitive2D& >(rCandidate));
+ const attribute::LineAttribute& rLineAttribute = rPolygonCandidate.getLineAttribute();
+
+ if(basegfx::fTools::more(rLineAttribute.getWidth(), 0.0))
+ {
+ if(basegfx::B2DLINEJOIN_MITER == rLineAttribute.getLineJoin())
+ {
+ // if line is mitered, use decomposition since mitered line
+ // geometry may use more space than the geometry grown by half line width
+ process(rCandidate.get2DDecomposition(getViewInformation2D()));
+ }
+ else
+ {
+ // for all other B2DLINEJOIN_* do a hairline HitTest with expanded tolerance
+ const basegfx::B2DVector aDiscreteHalfLineVector(getViewInformation2D().getObjectToViewTransformation()
+ * basegfx::B2DVector(rLineAttribute.getWidth() * 0.5, 0.0));
+ mbHit = checkHairlineHitWithTolerance(
+ rPolygonCandidate.getB2DPolygon(),
+ getDiscreteHitTolerance() + aDiscreteHalfLineVector.getLength());
+ }
+ }
+ else
+ {
+ // hairline; fallback to hairline test. Do not decompose
+ // since this may decompose the hairline to dashes
+ mbHit = checkHairlineHitWithTolerance(rPolygonCandidate.getB2DPolygon(), getDiscreteHitTolerance());
+ }
+ }
+
+ break;
+ }
+ case PRIMITIVE2D_ID_POLYGONWAVEPRIMITIVE2D :
+ {
+ if(!getHitTextOnly())
+ {
+ // do not use decompose; just handle like a line with width
+ const primitive2d::PolygonWavePrimitive2D& rPolygonCandidate(static_cast< const primitive2d::PolygonWavePrimitive2D& >(rCandidate));
+ double fLogicHitTolerance(0.0);
+
+ // if WaveHeight, grow by it
+ if(basegfx::fTools::more(rPolygonCandidate.getWaveHeight(), 0.0))
+ {
+ fLogicHitTolerance += rPolygonCandidate.getWaveHeight();
+ }
+
+ // if line width, grow by it
+ if(basegfx::fTools::more(rPolygonCandidate.getLineAttribute().getWidth(), 0.0))
+ {
+ fLogicHitTolerance += rPolygonCandidate.getLineAttribute().getWidth() * 0.5;
+ }
+
+ const basegfx::B2DVector aDiscreteHalfLineVector(getViewInformation2D().getObjectToViewTransformation()
+ * basegfx::B2DVector(fLogicHitTolerance, 0.0));
+
+ mbHit = checkHairlineHitWithTolerance(
+ rPolygonCandidate.getB2DPolygon(),
+ getDiscreteHitTolerance() + aDiscreteHalfLineVector.getLength());
+ }
+
+ break;
+ }
+ case PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D :
+ {
+ if(!getHitTextOnly())
+ {
+ // create filled polyPolygon in discrete coordinates
+ const primitive2d::PolyPolygonColorPrimitive2D& rPolygonCandidate(static_cast< const primitive2d::PolyPolygonColorPrimitive2D& >(rCandidate));
+
+ // use fill hit test
+ mbHit = checkFillHitWithTolerance(rPolygonCandidate.getB2DPolyPolygon(), getDiscreteHitTolerance());
+ }
+
+ break;
+ }
+ case PRIMITIVE2D_ID_ALPHAPRIMITIVE2D :
+ {
+ // sub-transparence group
+ const primitive2d::AlphaPrimitive2D& rTransCandidate(static_cast< const primitive2d::AlphaPrimitive2D& >(rCandidate));
+
+ // Currently the transparence content is not taken into account; only
+ // the children are recursively checked for hit. This may be refined for
+ // parts where the content is completely transparent if needed.
+ process(rTransCandidate.getChildren());
+
+ break;
+ }
+ case PRIMITIVE2D_ID_MASKPRIMITIVE2D :
+ {
+ // create mask in discrete coordinates; only recursively continue
+ // with content when HitTest position is inside the mask
+ const primitive2d::MaskPrimitive2D& rMaskCandidate(static_cast< const primitive2d::MaskPrimitive2D& >(rCandidate));
+
+ // use fill hit test
+ if(checkFillHitWithTolerance(rMaskCandidate.getMask(), getDiscreteHitTolerance()))
+ {
+ // recursively HitTest children
+ process(rMaskCandidate.getChildren());
+ }
+
+ break;
+ }
+ case PRIMITIVE2D_ID_SCENEPRIMITIVE2D :
+ {
+ if(!getHitTextOnly())
+ {
+ // 2D Scene primitive containing 3D stuff; extract 2D contour in world coordinates
+ // This may be refined later to an own 3D HitTest renderer which processes the 3D
+ // geometry directly
+ const primitive2d::ScenePrimitive2D& rScenePrimitive2DCandidate(static_cast< const primitive2d::ScenePrimitive2D& >(rCandidate));
+ const primitive2d::Primitive2DSequence xExtracted2DSceneGeometry(rScenePrimitive2DCandidate.getGeometry2D(getViewInformation2D()));
+
+ if(xExtracted2DSceneGeometry.hasElements())
+ {
+ // proccess extracted 2D content
+ process(xExtracted2DSceneGeometry);
+ }
+ else
+ {
+ // empty 3D scene; Check for border hit
+ const basegfx::B2DRange aRange(rCandidate.getB2DRange(getViewInformation2D()));
+ basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange));
+
+ mbHit = checkHairlineHitWithTolerance(aOutline, getDiscreteHitTolerance());
+ }
+ }
+
+ break;
+ }
+ case PRIMITIVE2D_ID_WRONGSPELLPRIMITIVE2D :
+ case PRIMITIVE2D_ID_MARKERARRAYPRIMITIVE2D :
+ case PRIMITIVE2D_ID_GRIDPRIMITIVE2D :
+ case PRIMITIVE2D_ID_HELPLINEPRIMITIVE2D :
+ {
+ // ignorable primitives
+ break;
+ }
+ case PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D :
+ case PRIMITIVE2D_ID_TEXTDECORATEDPORTIONPRIMITIVE2D :
+ {
+ // for text use the BoundRect of the primitive itself
+ const basegfx::B2DRange aRange(rCandidate.getB2DRange(getViewInformation2D()));
+ basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange));
+
+ mbHit = checkFillHitWithTolerance(basegfx::B2DPolyPolygon(aOutline), getDiscreteHitTolerance());
+
+ break;
+ }
+ case PRIMITIVE2D_ID_BITMAPPRIMITIVE2D :
+ case PRIMITIVE2D_ID_METAFILEPRIMITIVE2D :
+ case PRIMITIVE2D_ID_CONTROLPRIMITIVE2D :
+ case PRIMITIVE2D_ID_FILLGRADIENTPRIMITIVE2D :
+ case PRIMITIVE2D_ID_FILLHATCHPRIMITIVE2D :
+ case PRIMITIVE2D_ID_PAGEPREVIEWPRIMITIVE2D :
+ {
+ if(!getHitTextOnly())
+ {
+ // Class of primitives for which just the BoundRect of the primitive itself
+ // will be used for HitTest currently.
+ //
+ // This may be refined in the future, e.g:
+ // - For Bitamps, the mask and/or alpha information may be used
+ // - For MetaFiles, the MetaFile content may be used
+ const basegfx::B2DRange aRange(rCandidate.getB2DRange(getViewInformation2D()));
+ basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange));
+
+ mbHit = checkFillHitWithTolerance(basegfx::B2DPolyPolygon(aOutline), getDiscreteHitTolerance());
+ }
+
+ break;
+ }
+ case PRIMITIVE2D_ID_HITTESTPRIMITIVE2D :
+ {
+ // HitTest primitive; the default decomposition would return an empty seqence,
+ // so force this primitive to process it's children directly if the switch is set
+ // (which is the default). Else, ignore invisible content
+ if(getUseHitTestPrimitiveContent())
+ {
+ const primitive2d::HitTestPrimitive2D& rHitTestCandidate(static_cast< const primitive2d::HitTestPrimitive2D& >(rCandidate));
+ process(rHitTestCandidate.getChildren());
+ }
+
+ break;
+ }
+ case PRIMITIVE2D_ID_POINTARRAYPRIMITIVE2D :
+ {
+ if(!getHitTextOnly())
+ {
+ const primitive2d::PointArrayPrimitive2D& rPointArrayCandidate(static_cast< const primitive2d::PointArrayPrimitive2D& >(rCandidate));
+ const std::vector< basegfx::B2DPoint >& rPositions = rPointArrayCandidate.getPositions();
+ const sal_uInt32 nCount(rPositions.size());
+
+ for(sal_uInt32 a(0); !getHit() && a < nCount; a++)
+ {
+ const basegfx::B2DPoint aPosition(getViewInformation2D().getObjectToViewTransformation() * rPositions[a]);
+ const basegfx::B2DVector aDistance(aPosition - getDiscreteHitPosition());
+
+ if(aDistance.getLength() <= getDiscreteHitTolerance())
+ {
+ mbHit = true;
+ }
+ }
+ }
+
+ break;
+ }
+ default :
+ {
+ // process recursively
+ process(rCandidate.get2DDecomposition(getViewInformation2D()));
+
+ break;
+ }
+ }
+ }
+
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/source/processor2d/linegeometryextractor2d.cxx b/drawinglayer/source/processor2d/linegeometryextractor2d.cxx
index 89e0999d361d..5f0ab63ee1b3 100644
--- a/drawinglayer/source/processor2d/linegeometryextractor2d.cxx
+++ b/drawinglayer/source/processor2d/linegeometryextractor2d.cxx
@@ -86,7 +86,7 @@ namespace drawinglayer
const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate(static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate));
basegfx::B2DPolygon aLocalPolygon(rPolygonCandidate.getB2DPolygon());
aLocalPolygon.transform(getViewInformation2D().getObjectTransformation());
- maExtractedHairlines.append(aLocalPolygon);
+ maExtractedHairlines.push_back(aLocalPolygon);
}
break;
}
@@ -98,7 +98,7 @@ namespace drawinglayer
const primitive2d::PolyPolygonColorPrimitive2D& rPolygonCandidate(static_cast< const primitive2d::PolyPolygonColorPrimitive2D& >(rCandidate));
basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolygonCandidate.getB2DPolyPolygon());
aLocalPolyPolygon.transform(getViewInformation2D().getObjectTransformation());
- maExtractedLineFills.append(aLocalPolyPolygon);
+ maExtractedLineFills.push_back(aLocalPolyPolygon);
}
break;
}
diff --git a/drawinglayer/source/processor2d/makefile.mk b/drawinglayer/source/processor2d/makefile.mk
index 38dcb42cd4a0..fcbf2413b61f 100644
--- a/drawinglayer/source/processor2d/makefile.mk
+++ b/drawinglayer/source/processor2d/makefile.mk
@@ -57,7 +57,9 @@ SLOFILES= \
$(SLO)$/vclmetafileprocessor2d.obj \
$(SLO)$/contourextractor2d.obj \
$(SLO)$/linegeometryextractor2d.obj \
- $(SLO)$/canvasprocessor.obj
+ $(SLO)$/canvasprocessor.obj \
+ $(SLO)$/hittestprocessor2d.obj \
+ $(SLO)$/textaspolygonextractor2d.obj
# --- Targets ----------------------------------
diff --git a/drawinglayer/source/processor2d/textaspolygonextractor2d.cxx b/drawinglayer/source/processor2d/textaspolygonextractor2d.cxx
new file mode 100644
index 000000000000..9358c7f39c57
--- /dev/null
+++ b/drawinglayer/source/processor2d/textaspolygonextractor2d.cxx
@@ -0,0 +1,255 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: contourextractor2d.cxx,v $
+ *
+ * $Revision: 1.6 $
+ *
+ * last change: $Author: aw $ $Date: 2008-06-24 15:31:08 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <drawinglayer/processor2d/textaspolygonextractor2d.hxx>
+#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx>
+#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ void TextAsPolygonExtractor2D::processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate)
+ {
+ switch(rCandidate.getPrimitiveID())
+ {
+ case PRIMITIVE2D_ID_TEXTDECORATEDPORTIONPRIMITIVE2D :
+ {
+ // TextDecoratedPortionPrimitive2D can produce the following primitives
+ // when being decomposed:
+ //
+ // - TextSimplePortionPrimitive2D
+ // - PolygonWavePrimitive2D
+ // - PolygonStrokePrimitive2D
+ // - PolygonStrokePrimitive2D
+ // - PolyPolygonColorPrimitive2D
+ // - PolyPolygonHairlinePrimitive2D
+ // - PolygonHairlinePrimitive2D
+ // - ShadowPrimitive2D
+ // - ModifiedColorPrimitive2D
+ // - TransformPrimitive2D
+ // - TextEffectPrimitive2D
+ // - ModifiedColorPrimitive2D
+ // - TransformPrimitive2D
+ // - GroupPrimitive2D
+
+ // encapsulate with flag and use decomposition
+ mnInText++;
+ process(rCandidate.get2DDecomposition(getViewInformation2D()));
+ mnInText--;
+
+ break;
+ }
+ case PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D :
+ {
+ // TextSimplePortionPrimitive2D can produce the following primitives
+ // when being decomposed:
+ //
+ // - PolyPolygonColorPrimitive2D
+ // - TextEffectPrimitive2D
+ // - ModifiedColorPrimitive2D
+ // - TransformPrimitive2D
+ // - GroupPrimitive2D
+
+ // encapsulate with flag and use decomposition
+ mnInText++;
+ process(rCandidate.get2DDecomposition(getViewInformation2D()));
+ mnInText--;
+
+ break;
+ }
+
+ // as can be seen from the TextSimplePortionPrimitive2D and the
+ // TextDecoratedPortionPrimitive2D, inside of the mnInText marks
+ // the following primitives can occurr containing geometry data
+ // from text decomposition:
+ //
+ // - PolyPolygonColorPrimitive2D
+ // - PolygonHairlinePrimitive2D
+ // - PolyPolygonHairlinePrimitive2D (for convenience)
+ //
+ case PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D :
+ {
+ if(mnInText)
+ {
+ const primitive2d::PolyPolygonColorPrimitive2D& rPoPoCoCandidate(static_cast< const primitive2d::PolyPolygonColorPrimitive2D& >(rCandidate));
+ basegfx::B2DPolyPolygon aPolyPolygon(rPoPoCoCandidate.getB2DPolyPolygon());
+
+ if(aPolyPolygon.count())
+ {
+ // transform the PolyPolygon
+ aPolyPolygon.transform(getViewInformation2D().getObjectToViewTransformation());
+
+ // get evtl. corrected color
+ const basegfx::BColor aColor(maBColorModifierStack.getModifiedColor(rPoPoCoCandidate.getBColor()));
+
+ // add to result vector
+ maTarget.push_back(TextAsPolygonDataNode(aPolyPolygon, aColor, true));
+ }
+ }
+
+ break;
+ }
+ case PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D :
+ {
+ if(mnInText)
+ {
+ const primitive2d::PolygonHairlinePrimitive2D& rPoHaCandidate(static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate));
+ basegfx::B2DPolygon aPolygon(rPoHaCandidate.getB2DPolygon());
+
+ if(aPolygon.count())
+ {
+ // transform the Polygon
+ aPolygon.transform(getViewInformation2D().getObjectToViewTransformation());
+
+ // get evtl. corrected color
+ const basegfx::BColor aColor(maBColorModifierStack.getModifiedColor(rPoHaCandidate.getBColor()));
+
+ // add to result vector
+ maTarget.push_back(TextAsPolygonDataNode(basegfx::B2DPolyPolygon(aPolygon), aColor, false));
+ }
+ }
+
+ break;
+ }
+ case PRIMITIVE2D_ID_POLYPOLYGONHAIRLINEPRIMITIVE2D :
+ {
+ if(mnInText)
+ {
+ const primitive2d::PolyPolygonHairlinePrimitive2D& rPoPoHaCandidate(static_cast< const primitive2d::PolyPolygonHairlinePrimitive2D& >(rCandidate));
+ basegfx::B2DPolyPolygon aPolyPolygon(rPoPoHaCandidate.getB2DPolyPolygon());
+
+ if(aPolyPolygon.count())
+ {
+ // transform the Polygon
+ aPolyPolygon.transform(getViewInformation2D().getObjectToViewTransformation());
+
+ // get evtl. corrected color
+ const basegfx::BColor aColor(maBColorModifierStack.getModifiedColor(rPoPoHaCandidate.getBColor()));
+
+ // add to result vector
+ maTarget.push_back(TextAsPolygonDataNode(aPolyPolygon, aColor, false));
+ }
+ }
+
+ break;
+ }
+
+ // usage of color modification stack is needed
+ case PRIMITIVE2D_ID_MODIFIEDCOLORPRIMITIVE2D :
+ {
+ const primitive2d::ModifiedColorPrimitive2D& rModifiedColorCandidate(static_cast< const primitive2d::ModifiedColorPrimitive2D& >(rCandidate));
+
+ if(rModifiedColorCandidate.getChildren().hasElements())
+ {
+ maBColorModifierStack.push(rModifiedColorCandidate.getColorModifier());
+ process(rModifiedColorCandidate.getChildren());
+ maBColorModifierStack.pop();
+ }
+
+ break;
+ }
+
+ // usage of transformation stack is needed
+ case PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D :
+ {
+ // remember current transformation and ViewInformation
+ const primitive2d::TransformPrimitive2D& rTransformCandidate(static_cast< const primitive2d::TransformPrimitive2D& >(rCandidate));
+ const geometry::ViewInformation2D aLastViewInformation2D(getViewInformation2D());
+
+ // create new transformations for CurrentTransformation and for local ViewInformation2D
+ const geometry::ViewInformation2D aViewInformation2D(
+ getViewInformation2D().getObjectTransformation() * rTransformCandidate.getTransformation(),
+ getViewInformation2D().getViewTransformation(),
+ getViewInformation2D().getViewport(),
+ getViewInformation2D().getVisualizedPage(),
+ getViewInformation2D().getViewTime(),
+ getViewInformation2D().getExtendedInformationSequence());
+ updateViewInformation(aViewInformation2D);
+
+ // proccess content
+ process(rTransformCandidate.getChildren());
+
+ // restore transformations
+ updateViewInformation(aLastViewInformation2D);
+
+ break;
+ }
+
+ // ignorable primitives
+ case PRIMITIVE2D_ID_SCENEPRIMITIVE2D :
+ case PRIMITIVE2D_ID_WRONGSPELLPRIMITIVE2D :
+ case PRIMITIVE2D_ID_MARKERARRAYPRIMITIVE2D :
+ case PRIMITIVE2D_ID_POINTARRAYPRIMITIVE2D :
+ case PRIMITIVE2D_ID_BITMAPPRIMITIVE2D :
+ case PRIMITIVE2D_ID_METAFILEPRIMITIVE2D :
+ case PRIMITIVE2D_ID_MASKPRIMITIVE2D :
+ {
+ break;
+ }
+
+ default :
+ {
+ // process recursively
+ process(rCandidate.get2DDecomposition(getViewInformation2D()));
+ break;
+ }
+ }
+ }
+
+ TextAsPolygonExtractor2D::TextAsPolygonExtractor2D(const geometry::ViewInformation2D& rViewInformation)
+ : BaseProcessor2D(rViewInformation),
+ maTarget(),
+ maBColorModifierStack(),
+ mnInText(0)
+ {
+ }
+
+ TextAsPolygonExtractor2D::~TextAsPolygonExtractor2D()
+ {
+ }
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 172413105b1c..24f54d3ddc58 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -247,8 +247,8 @@ namespace drawinglayer
if(rB2DPolygon.count() && !mnSvtGraphicStrokeCount)
{
basegfx::BColor aStrokeColor;
- PolyPolygon aStartPolyPolygon;
- PolyPolygon aEndPolyPolygon;
+ basegfx::B2DPolyPolygon aStartArrow;
+ basegfx::B2DPolyPolygon aEndArrow;
if(pColor)
{
@@ -271,11 +271,9 @@ namespace drawinglayer
{
fPolyLength = basegfx::tools::getLength(rB2DPolygon);
- const basegfx::B2DPolyPolygon aStartArrow(basegfx::tools::createAreaGeometryForLineStartEnd(
+ aStartArrow = basegfx::tools::createAreaGeometryForLineStartEnd(
rB2DPolygon, pStart->getB2DPolyPolygon(), true, pStart->getWidth(),
- fPolyLength, pStart->isCentered() ? 0.5 : 0.0, 0));
-
- aStartPolyPolygon = PolyPolygon(aStartArrow);
+ fPolyLength, pStart->isCentered() ? 0.5 : 0.0, 0);
}
if(pEnd && pEnd->isActive())
@@ -285,11 +283,9 @@ namespace drawinglayer
fPolyLength = basegfx::tools::getLength(rB2DPolygon);
}
- const basegfx::B2DPolyPolygon aEndArrow(basegfx::tools::createAreaGeometryForLineStartEnd(
+ aEndArrow = basegfx::tools::createAreaGeometryForLineStartEnd(
rB2DPolygon, pEnd->getB2DPolyPolygon(), false, pEnd->getWidth(),
- fPolyLength, pEnd->isCentered() ? 0.5 : 0.0, 0));
-
- aEndPolyPolygon = PolyPolygon(aEndArrow);
+ fPolyLength, pEnd->isCentered() ? 0.5 : 0.0, 0);
}
}
@@ -341,10 +337,23 @@ namespace drawinglayer
aDashArray = pStrokeAttribute->getDotDashArray();
}
+ // #i101734# apply current object transformation to created geometry.
+ // This is a partial fix. When a object transformation is used which
+ // e.g. contains a scaleX != scaleY, an unproportional scaling would
+ // have to be applied to the evtl. existing fat line. The current
+ // concept of PDF export and SvtGraphicStroke usage does simply not
+ // allow handling such definitions. The only clean way would be to
+ // add the transformation to SvtGraphicStroke and to handle it there
+ basegfx::B2DPolygon aB2DPolygon(rB2DPolygon);
+
+ aB2DPolygon.transform(maCurrentTransformation);
+ aStartArrow.transform(maCurrentTransformation);
+ aEndArrow.transform(maCurrentTransformation);
+
pRetval = new SvtGraphicStroke(
- Polygon(rB2DPolygon),
- aStartPolyPolygon,
- aEndPolyPolygon,
+ Polygon(aB2DPolygon),
+ PolyPolygon(aStartArrow),
+ PolyPolygon(aEndArrow),
mfCurrentUnifiedTransparence,
fLineWidth,
SvtGraphicStroke::capButt,
@@ -1001,7 +1010,68 @@ namespace drawinglayer
adaptLineToFillDrawMode();
impStartSvtGraphicStroke(pSvtGraphicStroke);
- process(rCandidate.get2DDecomposition(getViewInformation2D()));
+
+ // #i101491#
+ // Change default of fat line generation for MetaFiles: Create MetaPolyLineAction
+ // instead of decomposing all geometries when the polygon has more than given amount of
+ // points; else the decomposition will get too expensive quiclky. OTOH
+ // the decomposition provides the better quality e.g. taking edge roundings
+ // into account which will NOT be taken into account with LineInfo-based actions
+ const sal_uInt32 nSubPolygonCount(rStrokePrimitive.getB2DPolygon().count());
+ bool bDone(0 == nSubPolygonCount);
+
+ if(!bDone && nSubPolygonCount > 1000)
+ {
+ // create MetaPolyLineActions, but without LINE_DASH
+ const attribute::LineAttribute& rLine = rStrokePrimitive.getLineAttribute();
+
+ if(basegfx::fTools::more(rLine.getWidth(), 0.0))
+ {
+ const attribute::StrokeAttribute& rStroke = rStrokePrimitive.getStrokeAttribute();
+ basegfx::B2DPolyPolygon aHairLinePolyPolygon;
+
+ if(0.0 == rStroke.getFullDotDashLen())
+ {
+ aHairLinePolyPolygon.append(rStrokePrimitive.getB2DPolygon());
+ }
+ else
+ {
+ basegfx::tools::applyLineDashing(
+ rStrokePrimitive.getB2DPolygon(), rStroke.getDotDashArray(),
+ &aHairLinePolyPolygon, 0, rStroke.getFullDotDashLen());
+ }
+
+ const basegfx::BColor aHairlineColor(maBColorModifierStack.getModifiedColor(rLine.getColor()));
+ mpOutputDevice->SetLineColor(Color(aHairlineColor));
+ mpOutputDevice->SetFillColor();
+
+ aHairLinePolyPolygon.transform(maCurrentTransformation);
+
+ const LineInfo aLineInfo(LINE_SOLID, basegfx::fround(rLine.getWidth()));
+
+ for(sal_uInt32 a(0); a < aHairLinePolyPolygon.count(); a++)
+ {
+ const basegfx::B2DPolygon aCandidate(aHairLinePolyPolygon.getB2DPolygon(a));
+
+ if(aCandidate.count() > 1)
+ {
+ const Polygon aToolsPolygon(aCandidate);
+
+ mrMetaFile.AddAction(new MetaPolyLineAction(aToolsPolygon, aLineInfo));
+ }
+ }
+
+ bDone = true;
+ }
+ }
+
+ if(!bDone)
+ {
+ // use decomposition (creates line geometry as filled polygon
+ // geometry)
+ process(rCandidate.get2DDecomposition(getViewInformation2D()));
+ }
+
impEndSvtGraphicStroke(pSvtGraphicStroke);
// restore DrawMode
@@ -1623,7 +1693,10 @@ namespace drawinglayer
// ChartPrimitive2D
const primitive2d::ChartPrimitive2D& rChartPrimitive = static_cast< const primitive2d::ChartPrimitive2D& >(rCandidate);
- if(!renderChartPrimitive2D(rChartPrimitive, *mpOutputDevice))
+ if(!renderChartPrimitive2D(
+ rChartPrimitive,
+ *mpOutputDevice,
+ getViewInformation2D()))
{
// fallback to decomposition (MetaFile)
process(rChartPrimitive.get2DDecomposition(getViewInformation2D()));
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 559974682463..8e2f89bb82a6 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -64,6 +64,7 @@
#include <vcl/hatch.hxx>
#include <tools/diagnose_ex.h>
#include <com/sun/star/awt/PosSize.hpp>
+#include <drawinglayer/primitive2d/invertprimitive2d.hxx>
#include <cstdio>
#include <drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx>
@@ -425,7 +426,10 @@ namespace drawinglayer
mpOutputDevice->Push(PUSH_MAPMODE);
mpOutputDevice->SetMapMode(maOriginalMapMode);
- if(!renderChartPrimitive2D(rChartPrimitive, *mpOutputDevice))
+ if(!renderChartPrimitive2D(
+ rChartPrimitive,
+ *mpOutputDevice,
+ getViewInformation2D()))
{
// fallback to decomposition (MetaFile)
process(rChartPrimitive.get2DDecomposition(getViewInformation2D()));
@@ -532,6 +536,28 @@ namespace drawinglayer
// Action: Ignore here, do nothing.
break;
}
+ case PRIMITIVE2D_ID_INVERTPRIMITIVE2D :
+ {
+ // invert primitive (currently only used for HighContrast fallback for selection in SW and SC).
+ // Set OutDev to XOR
+ mpOutputDevice->Push();
+ mpOutputDevice->SetRasterOp( ROP_XOR );
+
+ // force paint color to white by using ColorModifierStack
+ const basegfx::BColor aColWhite(1.0, 1.0, 1.0);
+ const basegfx::BColorModifier aColorModifier(aColWhite, 0.0, basegfx::BCOLORMODIFYMODE_REPLACE);
+ maBColorModifierStack.push(aColorModifier);
+
+ // process content recursively
+ process(rCandidate.get2DDecomposition(getViewInformation2D()));
+
+ // restore ColorModifierStack
+ maBColorModifierStack.pop();
+
+ // restore OutDev
+ mpOutputDevice->Pop();
+ break;
+ }
default :
{
// process recursively
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index e7820804f0e6..d6eb6e1695b2 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -189,6 +189,7 @@ namespace drawinglayer
aScale.getY(),
fRotate,
+ rTextCandidate.getLocale(),
*mpOutputDevice));
if(!basegfx::fTools::equal(aScale.getX(), aScale.getY()))
@@ -210,6 +211,7 @@ namespace drawinglayer
aScale.getX(),
aScale.getY(),
fRotate,
+ rTextCandidate.getLocale(),
*mpOutputDevice);
}
}
@@ -220,11 +222,12 @@ namespace drawinglayer
if( pTCPP != NULL )
{
+
// set the color of text decorations
const basegfx::BColor aTextlineColor = maBColorModifierStack.getModifiedColor(pTCPP->getTextlineColor());
mpOutputDevice->SetTextLineColor( Color(aTextlineColor) );
- // set Overline attribute
+ // set Overline attribute
FontUnderline eFontOverline = mapTextLineStyle( pTCPP->getFontOverline() );
if( eFontOverline != UNDERLINE_NONE )
{
@@ -1010,6 +1013,8 @@ namespace drawinglayer
void VclProcessor2D::RenderPolygonStrokePrimitive2D(const primitive2d::PolygonStrokePrimitive2D& rPolygonStrokeCandidate)
{
+ // #i101491# method restructured to clearly use the DrawPolyLine
+ // calls starting from a deined line width
const attribute::LineAttribute& rLineAttribute = rPolygonStrokeCandidate.getLineAttribute();
const double fLineWidth(rLineAttribute.getWidth());
bool bDone(false);
@@ -1018,154 +1023,160 @@ namespace drawinglayer
{
const basegfx::B2DVector aDiscreteUnit(maCurrentTransformation * basegfx::B2DVector(fLineWidth, 0.0));
const double fDiscreteLineWidth(aDiscreteUnit.getLength());
- const bool bAntiAliased(getOptionsDrawinglayer().IsAntiAliasing());
- const double fAllowedUpperBound(bAntiAliased ? 3.0 : 2.5);
+ const attribute::StrokeAttribute& rStrokeAttribute = rPolygonStrokeCandidate.getStrokeAttribute();
+ const basegfx::BColor aHairlineColor(maBColorModifierStack.getModifiedColor(rLineAttribute.getColor()));
+ basegfx::B2DPolyPolygon aHairlinePolyPolygon;
+
+ mpOutputDevice->SetLineColor(Color(aHairlineColor));
+ mpOutputDevice->SetFillColor();
- if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, fAllowedUpperBound))
+ if(0.0 == rStrokeAttribute.getFullDotDashLen())
+ {
+ // no line dashing, just copy
+ aHairlinePolyPolygon.append(rPolygonStrokeCandidate.getB2DPolygon());
+ }
+ else
{
- // force to hairline
- const attribute::StrokeAttribute& rStrokeAttribute = rPolygonStrokeCandidate.getStrokeAttribute();
- const basegfx::BColor aHairlineColor(maBColorModifierStack.getModifiedColor(rLineAttribute.getColor()));
- basegfx::B2DPolyPolygon aHairlinePolyPolygon;
+ // else apply LineStyle
+ basegfx::tools::applyLineDashing(rPolygonStrokeCandidate.getB2DPolygon(),
+ rStrokeAttribute.getDotDashArray(),
+ &aHairlinePolyPolygon, 0, rStrokeAttribute.getFullDotDashLen());
+ }
- mpOutputDevice->SetLineColor(Color(aHairlineColor));
- mpOutputDevice->SetFillColor();
+ const sal_uInt32 nCount(aHairlinePolyPolygon.count());
- if(0.0 == rStrokeAttribute.getFullDotDashLen())
- {
- // no line dashing, just copy
- aHairlinePolyPolygon.append(rPolygonStrokeCandidate.getB2DPolygon());
- }
- else
- {
- // else apply LineStyle
- basegfx::tools::applyLineDashing(rPolygonStrokeCandidate.getB2DPolygon(),
- rStrokeAttribute.getDotDashArray(),
- &aHairlinePolyPolygon, 0, rStrokeAttribute.getFullDotDashLen());
- }
-
- const sal_uInt32 nCount(aHairlinePolyPolygon.count());
+ if(nCount)
+ {
+ const bool bAntiAliased(getOptionsDrawinglayer().IsAntiAliasing());
+ aHairlinePolyPolygon.transform(maCurrentTransformation);
- if(nCount)
+ for(sal_uInt32 a(0); a < nCount; a++)
{
- aHairlinePolyPolygon.transform(maCurrentTransformation);
+ basegfx::B2DPolygon aCandidate(aHairlinePolyPolygon.getB2DPolygon(a));
if(bAntiAliased)
{
- for(sal_uInt32 a(0); a < nCount; a++)
+ if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 1.0))
{
- basegfx::B2DPolygon aCandidate(aHairlinePolyPolygon.getB2DPolygon(a));
-
- if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 1.0))
- {
- // line in range ]0.0 .. 1.0[
- // paint as simple hairline
- mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
- }
- else if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 2.0))
- {
- // line in range [1.0 .. 2.0[
- // paint as 2x2 with dynamic line distance
- basegfx::B2DHomMatrix aMat;
- const double fDistance(fDiscreteLineWidth - 1.0);
- const double fHalfDistance(fDistance * 0.5);
-
- aMat.set(0, 2, -fHalfDistance);
- aMat.set(1, 2, -fHalfDistance);
- aCandidate.transform(aMat);
- mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
- aMat.set(0, 2, fDistance);
- aMat.set(1, 2, 0.0);
- aCandidate.transform(aMat);
- mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
- aMat.set(0, 2, 0.0);
- aMat.set(1, 2, fDistance);
- aCandidate.transform(aMat);
- mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
- aMat.set(0, 2, -fDistance);
- aMat.set(1, 2, 0.0);
- aCandidate.transform(aMat);
- mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
- }
- else
- {
- // line in range [2.0 .. 3.0]
- // paint as cross in a 3x3 with dynamic line distance
- basegfx::B2DHomMatrix aMat;
- const double fDistance((fDiscreteLineWidth - 1.0) * 0.5);
-
- mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
- aMat.set(0, 2, -fDistance);
- aMat.set(1, 2, 0.0);
- aCandidate.transform(aMat);
- mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
- aMat.set(0, 2, fDistance);
- aMat.set(1, 2, -fDistance);
- aCandidate.transform(aMat);
- mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
- aMat.set(0, 2, fDistance);
- aMat.set(1, 2, fDistance);
- aCandidate.transform(aMat);
- mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
- aMat.set(0, 2, -fDistance);
- aMat.set(1, 2, fDistance);
- aCandidate.transform(aMat);
- mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
- }
+ // line in range ]0.0 .. 1.0[
+ // paint as simple hairline
+ mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+ bDone = true;
+ }
+ else if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 2.0))
+ {
+ // line in range [1.0 .. 2.0[
+ // paint as 2x2 with dynamic line distance
+ basegfx::B2DHomMatrix aMat;
+ const double fDistance(fDiscreteLineWidth - 1.0);
+ const double fHalfDistance(fDistance * 0.5);
+
+ aMat.set(0, 2, -fHalfDistance);
+ aMat.set(1, 2, -fHalfDistance);
+ aCandidate.transform(aMat);
+ mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+
+ aMat.set(0, 2, fDistance);
+ aMat.set(1, 2, 0.0);
+ aCandidate.transform(aMat);
+ mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+
+ aMat.set(0, 2, 0.0);
+ aMat.set(1, 2, fDistance);
+ aCandidate.transform(aMat);
+ mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+
+ aMat.set(0, 2, -fDistance);
+ aMat.set(1, 2, 0.0);
+ aCandidate.transform(aMat);
+ mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+ bDone = true;
+ }
+ else if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 3.0))
+ {
+ // line in range [2.0 .. 3.0]
+ // paint as cross in a 3x3 with dynamic line distance
+ basegfx::B2DHomMatrix aMat;
+ const double fDistance((fDiscreteLineWidth - 1.0) * 0.5);
+
+ mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+
+ aMat.set(0, 2, -fDistance);
+ aMat.set(1, 2, 0.0);
+ aCandidate.transform(aMat);
+ mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+
+ aMat.set(0, 2, fDistance);
+ aMat.set(1, 2, -fDistance);
+ aCandidate.transform(aMat);
+ mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+
+ aMat.set(0, 2, fDistance);
+ aMat.set(1, 2, fDistance);
+ aCandidate.transform(aMat);
+ mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+
+ aMat.set(0, 2, -fDistance);
+ aMat.set(1, 2, fDistance);
+ aCandidate.transform(aMat);
+ mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+ bDone = true;
+ }
+ else
+ {
+ // #i101491# line width above 3.0
}
}
else
{
- if(basegfx::fTools::more(fDiscreteLineWidth, 1.5))
+ if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 1.5))
+ {
+ // line width below 1.5, draw the basic hairline polygon
+ mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+ bDone = true;
+ }
+ else if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 2.5))
{
// line width is in range ]1.5 .. 2.5], use four hairlines
// drawn in a square
basegfx::B2DHomMatrix aMat;
+ mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
- for(sal_uInt32 a(0); a < nCount; a++)
- {
- basegfx::B2DPolygon aCandidate(aHairlinePolyPolygon.getB2DPolygon(a));
- mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
- aMat.set(0, 2, 1.0);
- aMat.set(1, 2, 0.0);
- aCandidate.transform(aMat);
+ aMat.set(0, 2, 1.0);
+ aMat.set(1, 2, 0.0);
+ aCandidate.transform(aMat);
- mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+ mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
- aMat.set(0, 2, 0.0);
- aMat.set(1, 2, 1.0);
- aCandidate.transform(aMat);
+ aMat.set(0, 2, 0.0);
+ aMat.set(1, 2, 1.0);
+ aCandidate.transform(aMat);
- mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+ mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
- aMat.set(0, 2, -1.0);
- aMat.set(1, 2, 0.0);
- aCandidate.transform(aMat);
+ aMat.set(0, 2, -1.0);
+ aMat.set(1, 2, 0.0);
+ aCandidate.transform(aMat);
- mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
- }
+ mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+ bDone = true;
}
else
{
- for(sal_uInt32 a(0); a < nCount; a++)
- {
- // draw the basic hairline polygon
- const basegfx::B2DPolygon aCandidate(aHairlinePolyPolygon.getB2DPolygon(a));
- mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
- }
+ // #i101491# line width is above 2.5
}
}
- }
- bDone = true;
+ if(!bDone && rPolygonStrokeCandidate.getB2DPolygon().count() > 1000)
+ {
+ // #i101491# If the polygon complexity uses more than a given amount, do
+ // use OuputDevice::DrawPolyLine directly; this will avoid buffering all
+ // decompositions in primtives (memory) and fallback to old line painting
+ // for very complex polygons, too
+ mpOutputDevice->DrawPolyLine(aCandidate, fDiscreteLineWidth, rLineAttribute.getLineJoin());
+ bDone = true;
+ }
+ }
}
}
diff --git a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx
index 24015903de4c..0a15ff224073 100644
--- a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx
+++ b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx
@@ -141,6 +141,10 @@ namespace
}
aRetval = BitmapEx(aContent, aAlpha);
+
+ // #i101811# set PrefMapMode and PrefSize at newly created Bitmap
+ aRetval.SetPrefMapMode(MAP_100TH_MM);
+ aRetval.SetPrefSize(Size(nWidth, nHeight));
}
return aRetval;
diff --git a/drawinglayer/util/makefile.mk b/drawinglayer/util/makefile.mk
index 3d29625cb0e6..5356ee0cef54 100644
--- a/drawinglayer/util/makefile.mk
+++ b/drawinglayer/util/makefile.mk
@@ -72,6 +72,7 @@ SHL1STDLIBS=\
$(CPPUHELPERLIB) \
$(CPPULIB) \
$(AVMEDIALIB) \
+ $(I18NISOLANGLIB) \
$(COMPHELPERLIB)
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
diff --git a/embeddedobj/source/msole/makefile.mk b/embeddedobj/source/msole/makefile.mk
index 3e8a55c7219c..2af3f28183d2 100644
--- a/embeddedobj/source/msole/makefile.mk
+++ b/embeddedobj/source/msole/makefile.mk
@@ -39,14 +39,10 @@ TARGET=emboleobj
.INCLUDE : settings.mk
-.IF "$(DISABLE_ATL)"==""
+# .IF "$(DISABLE_ATL)"==""
LIBTARGET=NO
USE_DEFFILE=YES
-INCPRE+=$(ATL_INCLUDE)
-.IF "$(MFC_INCLUDE)"!=""
-INCPRE+=$(MFC_INCLUDE)
-.ENDIF
# --- Files --------------------------------------------------------
@@ -134,7 +130,7 @@ SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
-.ENDIF
+# .ENDIF
# --- Targets -------------------------------------------------------
.INCLUDE : target.mk
diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx
index 8648d793b3f1..4402c94e097f 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -58,6 +58,120 @@ using namespace ::comphelper;
#define MAX_ENUM_ELE 20
#define FORMATS_NUM 3
+// ============ class ComSmart =====================
+namespace {
+
+template< class T > class ComSmart
+{
+ T* m_pInterface;
+
+ void OwnRelease()
+ {
+ if ( m_pInterface )
+ {
+ T* pInterface = m_pInterface;
+ m_pInterface = NULL;
+ pInterface->Release();
+ }
+ }
+
+public:
+ ComSmart()
+ : m_pInterface( NULL )
+ {}
+
+ ComSmart( const ComSmart<T>& rObj )
+ : m_pInterface( rObj.m_pInterface )
+ {
+ if ( m_pInterface != NULL )
+ m_pInterface->AddRef();
+ }
+
+ ComSmart( T* pInterface )
+ : m_pInterface( pInterface )
+ {
+ if ( m_pInterface != NULL )
+ m_pInterface->AddRef();
+ }
+
+ ~ComSmart()
+ {
+ OwnRelease();
+ }
+
+ ComSmart& operator=( const ComSmart<T>& rObj )
+ {
+ OwnRelease();
+
+ m_pInterface = rObj.m_pInterface;
+
+ if ( m_pInterface != NULL )
+ m_pInterface->AddRef();
+
+ return *this;
+ }
+
+ ComSmart<T>& operator=( T* pInterface )
+ {
+ OwnRelease();
+
+ m_pInterface = pInterface;
+
+ if ( m_pInterface != NULL )
+ m_pInterface->AddRef();
+
+ return *this;
+ }
+
+ operator T*() const
+ {
+ return m_pInterface;
+ }
+
+ T& operator*() const
+ {
+ return *m_pInterface;
+ }
+
+ T** operator&()
+ {
+ OwnRelease();
+
+ m_pInterface = NULL;
+
+ return &m_pInterface;
+ }
+
+ T* operator->() const
+ {
+ return m_pInterface;
+ }
+
+ BOOL operator==( const ComSmart<T>& rObj ) const
+ {
+ return ( m_pInterface == rObj.m_pInterface );
+ }
+
+ BOOL operator!=( const ComSmart<T>& rObj ) const
+ {
+ return ( m_pInterface != rObj.m_pInterface );
+ }
+
+ BOOL operator==( const T* pInterface ) const
+ {
+ return ( m_pInterface == pInterface );
+ }
+
+ BOOL operator!=( const T* pInterface ) const
+ {
+ return ( m_pInterface != pInterface );
+ }
+};
+
+}
+
+// ============ class ComSmart =====================
+
sal_Bool ConvertBufferToFormat( void* pBuf,
sal_uInt32 nBufSize,
const ::rtl::OUString& aFormatShortName,
@@ -74,10 +188,10 @@ FORMATETC pFormatTemplates[FORMATS_NUM] = {
struct OleComponentNative_Impl {
- CComPtr< IUnknown > m_pObj;
- CComPtr< IOleObject > m_pOleObject;
- CComPtr< IViewObject2 > m_pViewObject2;
- CComPtr< IStorage > m_pIStorage;
+ ComSmart< IUnknown > m_pObj;
+ ComSmart< IOleObject > m_pOleObject;
+ ComSmart< IViewObject2 > m_pViewObject2;
+ ComSmart< IStorage > m_pIStorage;
FormatEtcList m_aFormatsList;
uno::Sequence< datatransfer::DataFlavor > m_aSupportedGraphFormats;
uno::Sequence< ::rtl::OUString > m_aGraphShortFormats; //short names for formats from previous sequence
@@ -509,11 +623,11 @@ void OleComponent::RetrieveObjectDataFlavors_Impl()
if ( !m_aDataFlavors.getLength() )
{
- CComPtr< IDataObject > pDataObject;
+ ComSmart< IDataObject > pDataObject;
HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IDataObject, (void**)&pDataObject );
if ( SUCCEEDED( hr ) && pDataObject )
{
- CComPtr< IEnumFORMATETC > pFormatEnum;
+ ComSmart< IEnumFORMATETC > pFormatEnum;
hr = pDataObject->EnumFormatEtc( DATADIR_GET, &pFormatEnum );
if ( SUCCEEDED( hr ) && pFormatEnum )
{
@@ -561,11 +675,11 @@ sal_Bool OleComponent::InitializeObject_Impl()
return sal_False;
// the linked object will be detected here
- CComPtr< IOleLink > pOleLink;
+ ComSmart< IOleLink > pOleLink;
HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IOleLink, (void**)&pOleLink );
OSL_ENSURE( m_pUnoOleObject, "Unexpected object absence!" );
if ( m_pUnoOleObject )
- m_pUnoOleObject->SetObjectIsLink_Impl( pOleLink != NULL );
+ m_pUnoOleObject->SetObjectIsLink_Impl( sal_Bool( pOleLink != NULL ) );
hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IViewObject2, (void**)&m_pNativeImpl->m_pViewObject2 );
@@ -799,7 +913,7 @@ void OleComponent::InitEmbeddedCopyOfLink( OleComponent* pOleLinkComponent )
if ( m_pNativeImpl->m_pIStorage )
throw io::IOException(); // TODO:the object is already initialized
- CComPtr< IDataObject > pDataObject;
+ ComSmart< IDataObject > pDataObject;
HRESULT hr = pOleLinkComponent->m_pNativeImpl->m_pObj->QueryInterface( IID_IDataObject, (void**)&pDataObject );
if ( SUCCEEDED( hr ) && pDataObject && SUCCEEDED( OleQueryCreateFromData( pDataObject ) ) )
{
@@ -819,12 +933,12 @@ void OleComponent::InitEmbeddedCopyOfLink( OleComponent* pOleLinkComponent )
if ( !m_pNativeImpl->m_pObj )
{
- CComPtr< IOleLink > pOleLink;
+ ComSmart< IOleLink > pOleLink;
hr = pOleLinkComponent->m_pNativeImpl->m_pObj->QueryInterface( IID_IOleLink, (void**)&pOleLink );
if ( FAILED( hr ) || !pOleLink )
throw io::IOException(); // TODO: the object doesn't support IOleLink
- CComPtr< IMoniker > pMoniker;
+ ComSmart< IMoniker > pMoniker;
hr = pOleLink->GetSourceMoniker( &pMoniker );
if ( FAILED( hr ) || !pMoniker )
throw io::IOException(); // TODO: can not retrieve moniker
@@ -834,7 +948,7 @@ void OleComponent::InitEmbeddedCopyOfLink( OleComponent* pOleLinkComponent )
hr = pMoniker->IsSystemMoniker( &aMonType );
if ( SUCCEEDED( hr ) && aMonType == MKSYS_FILEMONIKER )
{
- CComPtr< IMalloc > pMalloc;
+ ComSmart< IMalloc > pMalloc;
CoGetMalloc( 1, &pMalloc ); // if fails there will be a memory leak
OSL_ENSURE( pMalloc, "CoGetMalloc() failed!" );
@@ -860,11 +974,11 @@ void OleComponent::InitEmbeddedCopyOfLink( OleComponent* pOleLinkComponent )
// in case of other moniker types the only way is to get storage
if ( !m_pNativeImpl->m_pObj )
{
- CComPtr< IBindCtx > pBindCtx;
+ ComSmart< IBindCtx > pBindCtx;
hr = CreateBindCtx( 0, ( LPBC FAR* )&pBindCtx );
if ( SUCCEEDED( hr ) && pBindCtx )
{
- CComPtr< IStorage > pObjectStorage;
+ ComSmart< IStorage > pObjectStorage;
hr = pMoniker->BindToStorage( pBindCtx, NULL, IID_IStorage, (void**)&pObjectStorage );
if ( SUCCEEDED( hr ) && pObjectStorage )
{
@@ -948,7 +1062,7 @@ uno::Sequence< embed::VerbDescriptor > OleComponent::GetVerbList()
if( !m_aVerbList.getLength() )
{
- CComPtr< IEnumOLEVERB > pEnum;
+ ComSmart< IEnumOLEVERB > pEnum;
if( SUCCEEDED( m_pNativeImpl->m_pOleObject->EnumVerbs( &pEnum ) ) )
{
OLEVERB szEle[ MAX_ENUM_ELE ];
@@ -1045,7 +1159,7 @@ awt::Size OleComponent::GetExtent( sal_Int64 nAspect )
if ( nMSAspect == DVASPECT_CONTENT )
{
// Try to get the size from the replacement image first
- CComPtr< IDataObject > pDataObject;
+ ComSmart< IDataObject > pDataObject;
HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IDataObject, (void**)&pDataObject );
if ( SUCCEEDED( hr ) || pDataObject )
{
@@ -1190,7 +1304,7 @@ sal_Bool OleComponent::IsDirty()
if ( IsWorkaroundActive() )
return sal_True;
- CComPtr< IPersistStorage > pPersistStorage;
+ ComSmart< IPersistStorage > pPersistStorage;
HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IPersistStorage, (void**)&pPersistStorage );
if ( FAILED( hr ) || !pPersistStorage )
throw io::IOException(); // TODO
@@ -1205,7 +1319,7 @@ void OleComponent::StoreOwnTmpIfNecessary()
if ( !m_pNativeImpl->m_pOleObject )
throw embed::WrongStateException(); // TODO: the object is in wrong state
- CComPtr< IPersistStorage > pPersistStorage;
+ ComSmart< IPersistStorage > pPersistStorage;
HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IPersistStorage, (void**)&pPersistStorage );
if ( FAILED( hr ) || !pPersistStorage )
throw io::IOException(); // TODO
@@ -1439,7 +1553,7 @@ uno::Any SAL_CALL OleComponent::getTransferData( const datatransfer::DataFlavor&
DWORD nRequestedAspect = GetAspectFromFlavor( aFlavor );
// if own icon is set and icon aspect is requested the own icon can be returned directly
- CComPtr< IDataObject > pDataObject;
+ ComSmart< IDataObject > pDataObject;
HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IDataObject, (void**)&pDataObject );
if ( FAILED( hr ) || !pDataObject )
throw io::IOException(); // TODO: transport error code
diff --git a/embeddedobj/source/msole/platform.h b/embeddedobj/source/msole/platform.h
index 1c089fb884bf..a3700ca146b3 100644
--- a/embeddedobj/source/msole/platform.h
+++ b/embeddedobj/source/msole/platform.h
@@ -41,16 +41,9 @@
#pragma warning(push, 1)
#pragma warning(disable: 4548 4555 4917)
#endif
+
#include "windows.h"
-#ifdef __MINGW32__
-#include <atlbase.h>
-#else
-#if defined(_MSC_VER) && (_MSC_VER > 1310)
-#include <atldbcli.h>
-#else
-#include "atlcomcli.h"
-#endif
-#endif
+
#if defined _MSC_VER
#pragma warning(pop)
#endif
diff --git a/formula/inc/formula/FormulaCompiler.hxx b/formula/inc/formula/FormulaCompiler.hxx
index 1fc77e2db01e..009e5df7dfb7 100644
--- a/formula/inc/formula/FormulaCompiler.hxx
+++ b/formula/inc/formula/FormulaCompiler.hxx
@@ -219,6 +219,9 @@ public:
*/
OpCode GetEnglishOpCode( const String& rName ) const;
+ void SetCompileForFAP( BOOL bVal )
+ { bCompileForFAP = bVal; bIgnoreErrors = bVal; }
+
static BOOL DeQuote( String& rStr );
static const String& GetNativeSymbol( OpCode eOp );
diff --git a/formula/inc/formula/IFunctionDescription.hxx b/formula/inc/formula/IFunctionDescription.hxx
index 3db1e6d49a94..5be54237a956 100644
--- a/formula/inc/formula/IFunctionDescription.hxx
+++ b/formula/inc/formula/IFunctionDescription.hxx
@@ -153,6 +153,7 @@ namespace formula
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser> getFormulaParser() const = 0;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const = 0;
+ virtual ::com::sun::star::table::CellAddress getReferencePosition() const = 0;
virtual void setDispatcherLock( BOOL bLock ) = 0;
virtual void dispatch(BOOL _bOK,BOOL _bMartixChecked) = 0;
diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index 004f2f03cee4..1e5b55b7b67f 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -132,7 +132,7 @@ namespace formula
void UpdateFunctionDesc();
void ResizeArgArr( const IFunctionDescription* pNewFunc );
void FillListboxes();
- void FillControls();
+ void FillControls(BOOL &rbNext, BOOL &rbPrev);
FormulaDlgMode SetMeText(const String& _sText,xub_StrLen PrivStart, xub_StrLen PrivEnd,BOOL bMatrix,BOOL _bSelect,BOOL _bUpdate);
void SetMeText(const String& _sText);
@@ -497,6 +497,7 @@ xub_StrLen FormulaDlg_Impl::GetFunctionPos(xub_StrLen nPos)
if ( m_aTokenList.getLength() )
{
const uno::Reference< sheet::XFormulaParser > xParser(m_pHelper->getFormulaParser());
+ const table::CellAddress aRefPos(m_pHelper->getReferencePosition());
const sheet::FormulaToken* pIter = m_aTokenList.getConstArray();
const sheet::FormulaToken* pEnd = pIter + m_aTokenList.getLength();
@@ -509,7 +510,7 @@ xub_StrLen FormulaDlg_Impl::GetFunctionPos(xub_StrLen nPos)
const sal_Int32 eOp = pIter->OpCode;
uno::Sequence<sheet::FormulaToken> aArgs(1);
aArgs[0] = *pIter;
- const String aString = xParser->printFormula(aArgs);
+ const String aString = xParser->printFormula(aArgs, aRefPos);
const sheet::FormulaToken* pNextToken = pIter + 1;
if(!bUserMatrixFlag && FormulaCompiler::IsMatrixFunction((OpCode)eOp) )
@@ -533,7 +534,7 @@ xub_StrLen FormulaDlg_Impl::GetFunctionPos(xub_StrLen nPos)
if ( pNextToken != pEnd )
{
aArgs[0] = *pNextToken;
- const String a2String = xParser->printFormula(aArgs);
+ const String a2String = xParser->printFormula(aArgs, aRefPos);
const xub_StrLen n3 = aFormString.Search(a2String,nXXX);
if ( n3 < nTokPos )
nTokPos = n3;
@@ -675,11 +676,14 @@ void FormulaDlg_Impl::MakeTree(IStructHelper* _pTree,SvLBoxEntry* pParent,Formul
long nParas = _pToken->GetParamCount();
OpCode eOp = _pToken->GetOpCode();
+ // #i101512# for output, the original token is needed
+ FormulaToken* pOrigToken = (_pToken->GetType() == svFAP) ? _pToken->GetFAPOrigToken() : _pToken;
uno::Sequence<sheet::FormulaToken> aArgs(1);
- aArgs[0] = m_aTokenMap.find(_pToken)->second;
+ aArgs[0] = m_aTokenMap.find(pOrigToken)->second;
try
{
- const String aResult = m_pHelper->getFormulaParser()->printFormula(aArgs);
+ const table::CellAddress aRefPos(m_pHelper->getReferencePosition());
+ const String aResult = m_pHelper->getFormulaParser()->printFormula(aArgs, aRefPos);
if ( nParas > 0 )
{
@@ -747,7 +751,8 @@ void FormulaDlg_Impl::UpdateTokenArray( const String& rStrExp)
m_aTokenList.realloc(0);
try
{
- m_aTokenList = m_pHelper->getFormulaParser()->parseFormula(rStrExp);
+ const table::CellAddress aRefPos(m_pHelper->getReferencePosition());
+ m_aTokenList = m_pHelper->getFormulaParser()->parseFormula(rStrExp, aRefPos);
}
catch(const uno::Exception&)
{
@@ -766,14 +771,21 @@ void FormulaDlg_Impl::UpdateTokenArray( const String& rStrExp)
} // if ( pTokens && nLen == m_aTokenList.getLength() )
FormulaCompiler aCompiler(*m_pTokenArray.get());
+ aCompiler.SetCompileForFAP(TRUE); // #i101512# special handling is needed
aCompiler.CompileTokenArray();
}
void FormulaDlg_Impl::FillDialog(BOOL nFlag)
{
- if ( nFlag )
- FillControls();
+ BOOL bNext=TRUE, bPrev=TRUE;
+ if(nFlag)
+ FillControls(bNext, bPrev);
FillListboxes();
+ if(nFlag)
+ {
+ aBtnBackward.Enable(bPrev);
+ aBtnForward.Enable(bNext);
+ }
String aStrResult;
@@ -821,7 +833,7 @@ void FormulaDlg_Impl::FillListboxes()
m_pParent->SetUniqueId( nOldUnique );
}
// -----------------------------------------------------------------------------
-void FormulaDlg_Impl::FillControls()
+void FormulaDlg_Impl::FillControls(BOOL &rbNext, BOOL &rbPrev)
{
// Umschalten zwischen den "Seiten"
FormEditData* pData = m_pHelper->getFormEditData();
@@ -917,12 +929,10 @@ void FormulaDlg_Impl::FillControls()
// Test, ob vorne/hinten noch mehr Funktionen sind
xub_StrLen nTempStart = m_aFormulaHelper.GetArgStart( aFormula, nFStart, 0 );
- BOOL bNext = m_aFormulaHelper.GetNextFunc( aFormula, FALSE, nTempStart );
+ rbNext = m_aFormulaHelper.GetNextFunc( aFormula, FALSE, nTempStart );
nTempStart=(xub_StrLen)pMEdit->GetSelection().Min();
pData->SetFStart(nTempStart);
- BOOL bPrev = m_aFormulaHelper.GetNextFunc( aFormula, TRUE, nTempStart );
- aBtnBackward.Enable(bPrev);
- aBtnForward.Enable(bNext);
+ rbPrev = m_aFormulaHelper.GetNextFunc( aFormula, TRUE, nTempStart );
}
// -----------------------------------------------------------------------------
@@ -955,7 +965,8 @@ String FormulaDlg_Impl::RepairFormula(const String& aFormula)
if ( m_aTokenList.getLength() )
{
- const String sFormula(m_pHelper->getFormulaParser()->printFormula(m_aTokenList));
+ const table::CellAddress aRefPos(m_pHelper->getReferencePosition());
+ const String sFormula(m_pHelper->getFormulaParser()->printFormula(m_aTokenList, aRefPos));
if ( !sFormula.Len() || sFormula.GetChar(0) != '=' )
aResult += sFormula;
else
diff --git a/fpicker/prj/build.lst b/fpicker/prj/build.lst
index 7f4ee87af3ba..434f22660f33 100644
--- a/fpicker/prj/build.lst
+++ b/fpicker/prj/build.lst
@@ -1,8 +1,9 @@
-fp fpicker : rdbmaker svtools NULL
+fp fpicker : l10n rdbmaker svtools NULL
fp fpicker\inc nmake - all fp_inc NULL
fp fpicker\source\generic nmake - all fp_generic fp_inc NULL
fp fpicker\source\office nmake - all fp_office fp_inc NULL
fp fpicker\source\unx\gnome nmake - u fp_gnome_filepicker fp_inc NULL
+fp fpicker\source\unx\kde4 nmake - u fp_kde4_filepicker fp_inc NULL
fp fpicker\source\aqua nmake - u fp_macosx_filepicker NULL
fp fpicker\source\win32\filepicker nmake - w fp_win32_filepicker fp_inc NULL
fp fpicker\source\win32\folderpicker nmake - w fp_win32_folderpicker fp_inc NULL
diff --git a/fpicker/prj/d.lst b/fpicker/prj/d.lst
index 05ab72c01208..7c4e0bf6024a 100644
--- a/fpicker/prj/d.lst
+++ b/fpicker/prj/d.lst
@@ -10,4 +10,5 @@ mkdir: %COMMON_DEST%\bin%_EXT%\hid
..\source\win32\filepicker\*.xml %_DEST%\xml%_EXT%\*.xml
..\source\win32\folderpicker\*.xml %_DEST%\xml%_EXT%\*.xml
..\source\unx\gnome\fps-gnome-ucd.txt %_DEST%\bin%_EXT%\fps-gnome-ucd.txt
+..\source\unx\kde4\fps-kde4-ucd.txt %_DEST%\bin%_EXT%\fps-kde4-ucd.txt
..\source\aqua\fps-aqua-ucd.txt %_DEST%\bin%_EXT%\fps-aqua-ucd.txt
diff --git a/fpicker/source/aqua/AquaFilePickerDelegate.mm b/fpicker/source/aqua/AquaFilePickerDelegate.mm
index 2bece2d90eb8..7a557495191b 100644
--- a/fpicker/source/aqua/AquaFilePickerDelegate.mm
+++ b/fpicker/source/aqua/AquaFilePickerDelegate.mm
@@ -59,8 +59,10 @@
- (MacOSBOOL)panel:(id)sender shouldShowFilename:(NSString *)filename
{
- if (filterHelper == NULL)
+ if( filterHelper == NULL )
return true;
+ if( filename == nil )
+ return false;
return filterHelper->filenameMatchesFilter(filename);
}
diff --git a/fpicker/source/generic/fpicker.cxx b/fpicker/source/generic/fpicker.cxx
index dec3488211c5..9bdb870ebcc8 100644
--- a/fpicker/source/generic/fpicker.cxx
+++ b/fpicker/source/generic/fpicker.cxx
@@ -60,6 +60,8 @@ static OUString FilePicker_getSystemPickerServiceName()
return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.GtkFilePicker"));
else if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("kde"))
return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.KDEFilePicker"));
+ else if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("kde4"))
+ return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.KDE4FilePicker"));
else if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("macosx"))
return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.AquaFilePicker"));
else
diff --git a/fpicker/source/unx/kde4/FPServiceInfo.hxx b/fpicker/source/unx/kde4/FPServiceInfo.hxx
new file mode 100644
index 000000000000..d0a465102768
--- /dev/null
+++ b/fpicker/source/unx/kde4/FPServiceInfo.hxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma once
+
+// the service names
+#define FILE_PICKER_SERVICE_NAME "com.sun.star.ui.dialogs.KDE4FilePicker"
+
+// the implementation names
+#define FILE_PICKER_IMPL_NAME "com.sun.star.ui.dialogs.KDE4FilePicker"
+
+// the registry key names
+// a key under which this service will be registered,
+// Format: -> "/ImplName/UNO/SERVICES/ServiceName"
+// <Implementation-Name></UNO/SERVICES/><Service-Name>
+#define FILE_PICKER_REGKEY_NAME "/com.sun.star.ui.dialogs.KDE4FilePickerImpl/UNO/SERVICES/com.sun.star.ui.dialogs.KDE4FilePicker"
diff --git a/fpicker/source/unx/kde4/KDE4FPEntry.cxx b/fpicker/source/unx/kde4/KDE4FPEntry.cxx
new file mode 100644
index 000000000000..268c01b600b3
--- /dev/null
+++ b/fpicker/source/unx/kde4/KDE4FPEntry.cxx
@@ -0,0 +1,136 @@
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <cppuhelper/factory.hxx>
+
+#include <com/sun/star/container/XSet.hpp>
+
+#include <osl/diagnose.h>
+
+#include "KDE4FilePicker.hxx"
+#include "FPServiceInfo.hxx"
+
+using namespace ::rtl;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+using namespace ::cppu;
+using ::com::sun::star::ui::dialogs::XFilePicker;
+
+static Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& serviceManager )
+{
+ return Reference< XInterface >(static_cast< XFilePicker* >( new KDE4FilePicker( serviceManager ) ) );
+}
+
+// the three uno functions that will be exported
+extern "C"
+{
+ void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
+ {
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+ }
+
+ sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pRegistryKey )
+ {
+ sal_Bool bRetVal = sal_True;
+
+ if ( pRegistryKey )
+ {
+ try
+ {
+ Reference< XRegistryKey > pXNewKey( static_cast< XRegistryKey* >( pRegistryKey ) );
+ pXNewKey->createKey( OUString::createFromAscii( FILE_PICKER_REGKEY_NAME ) );
+ }
+ catch( InvalidRegistryException& )
+ {
+ OSL_ENSURE( sal_False, "InvalidRegistryException caught" );
+ bRetVal = sal_False;
+ }
+ }
+
+ return bRetVal;
+ }
+
+ void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* pRegistryKey )
+ {
+ void* pRet = 0;
+
+ if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, FILE_PICKER_IMPL_NAME ) ) )
+ {
+ Sequence< OUString > aSNS( 1 );
+ aSNS.getArray( )[0] = OUString::createFromAscii( FILE_PICKER_SERVICE_NAME );
+
+ Reference< XSingleServiceFactory > xFactory ( createSingleFactory(
+ reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
+ OUString::createFromAscii( pImplName ),
+ createInstance,
+ aSNS ) );
+ if ( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+
+ return pRet;
+ }
+}
diff --git a/fpicker/source/unx/kde4/KDE4FilePicker.cxx b/fpicker/source/unx/kde4/KDE4FilePicker.cxx
new file mode 100644
index 000000000000..d6d852c71d93
--- /dev/null
+++ b/fpicker/source/unx/kde4/KDE4FilePicker.cxx
@@ -0,0 +1,717 @@
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): Jan Holesovsky <kendy@openoffice.org>
+ *
+ *
+ ************************************************************************/
+
+//////////////////////////////////////////////////////////////////////////
+// includes
+//////////////////////////////////////////////////////////////////////////
+
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <cppuhelper/interfacecontainer.h>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
+#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
+#include <com/sun/star/ui/dialogs/ControlActions.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+
+#include <svtools/svtools.hrc>
+
+#include <vos/mutex.hxx>
+
+#include <vcl/svapp.hxx>
+#include <vcl/sysdata.hxx>
+#include <vcl/syswin.hxx>
+
+#include "KDE4FilePicker.hxx"
+#include "FPServiceInfo.hxx"
+
+/* ********* Hack, but needed because of conflicting types... */
+#define Region QtXRegion
+
+//kde has an enum that uses this...OO does too
+#undef SETTINGS_MOUSE
+
+#include <kfiledialog.h>
+#include <kwindowsystem.h>
+#include <kapplication.h>
+#include <kfilefiltercombo.h>
+
+#include <QWidget>
+#include <QCheckBox>
+#include <QGridLayout>
+
+#undef Region
+
+using namespace ::com::sun::star;
+
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::com::sun::star::ui::dialogs::TemplateDescription;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::com::sun::star::ui::dialogs::TemplateDescription;
+using namespace ::com::sun::star::ui::dialogs::ExtendedFilePickerElementIds;
+using namespace ::com::sun::star::ui::dialogs::CommonFilePickerElementIds;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::uno;
+
+//////////////////////////////////////////////////////////////////////////
+// helper functions
+//////////////////////////////////////////////////////////////////////////
+
+namespace
+{
+ // controling event notifications
+ const bool STARTUP_SUSPENDED = true;
+ const bool STARTUP_ALIVE = false;
+
+ uno::Sequence<rtl::OUString> SAL_CALL FilePicker_getSupportedServiceNames()
+ {
+ uno::Sequence<rtl::OUString> aRet(3);
+ aRet[0] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.FilePicker");
+ aRet[1] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.SystemFilePicker");
+ aRet[2] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.KDE4FilePicker");
+ return aRet;
+ }
+}
+
+rtl::OUString toOUString(const QString& s)
+{
+ return rtl::OUString(s.toUtf8().data(), s.length(), RTL_TEXTENCODING_UTF8);
+}
+
+QString toQString(const rtl::OUString& s)
+{
+ return QString::fromUtf16(s.getStr(), s.getLength());
+}
+
+//////////////////////////////////////////////////////////////////////////
+// KDE4FilePicker
+//////////////////////////////////////////////////////////////////////////
+
+KDE4FilePicker::KDE4FilePicker( const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr )
+ : cppu::WeakComponentImplHelper8<
+ XFilterManager,
+ XFilterGroupManager,
+ XFilePickerControlAccess,
+ XFilePickerNotifier,
+// TODO XFilePreview,
+ lang::XInitialization,
+ util::XCancellable,
+ lang::XEventListener,
+ lang::XServiceInfo>( _helperMutex ),
+ m_xServiceMgr( xServiceMgr ),
+ _resMgr( CREATEVERSIONRESMGR( fps_office ) )
+{
+ _extraControls = new QWidget();
+
+ _layout = new QGridLayout(_extraControls);
+
+ _dialog = new KFileDialog(KUrl(""), QString(""), 0, _extraControls);
+ _dialog->setMode(KFile::File | KFile::LocalOnly);
+
+ //default mode
+ _dialog->setOperationMode(KFileDialog::Opening);
+}
+
+KDE4FilePicker::~KDE4FilePicker()
+{
+ delete _resMgr;
+ delete _dialog;
+}
+
+void SAL_CALL KDE4FilePicker::addFilePickerListener( const uno::Reference<XFilePickerListener>& xListener )
+ throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ m_xListener = xListener;
+}
+
+void SAL_CALL KDE4FilePicker::removeFilePickerListener( const uno::Reference<XFilePickerListener>& )
+ throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ m_xListener.clear();
+}
+
+void SAL_CALL KDE4FilePicker::setTitle( const rtl::OUString &title )
+ throw( uno::RuntimeException )
+{
+ _dialog->setCaption(toQString(title));
+}
+
+sal_Int16 SAL_CALL KDE4FilePicker::execute()
+ throw( uno::RuntimeException )
+{
+ //get the window id of the main OO window to set it for the dialog as a parent
+ Window *pParentWin = Application::GetDefDialogParent();
+ if ( pParentWin )
+ {
+ const SystemEnvData* pSysData = ((SystemWindow *)pParentWin)->GetSystemData();
+ if ( pSysData )
+ {
+ KWindowSystem::setMainWindow( _dialog, pSysData->aWindow); // unx only
+ }
+ }
+
+ _dialog->setFilter(_filter);
+ _dialog->exec();
+
+ //nasty hack to get a local qt event loop going to process the dialog
+ //otherwise the dialog returns immediately
+ while (_dialog->isVisible())
+ {
+ kapp->processEvents(QEventLoop::WaitForMoreEvents);
+ }
+
+ //block and wait for user input
+ if (_dialog->result() == KFileDialog::Accepted)
+ {
+ return ExecutableDialogResults::OK;
+ }
+
+ return ExecutableDialogResults::CANCEL;
+}
+
+void SAL_CALL KDE4FilePicker::setMultiSelectionMode( sal_Bool multiSelect )
+ throw( uno::RuntimeException )
+{
+ if (multiSelect)
+ {
+ _dialog->setMode(KFile::Files | KFile::LocalOnly);
+ }
+ else
+ {
+ _dialog->setMode(KFile::File | KFile::LocalOnly);
+ }
+}
+
+void SAL_CALL KDE4FilePicker::setDefaultName( const ::rtl::OUString &name )
+ throw( uno::RuntimeException )
+{
+ const QString url = toQString(name);
+ _dialog->setSelection(url);
+}
+
+void SAL_CALL KDE4FilePicker::setDisplayDirectory( const rtl::OUString &dir )
+ throw( uno::RuntimeException )
+{
+ const QString url = toQString(dir);
+ _dialog->setStartDir(KUrl(url));
+}
+
+rtl::OUString SAL_CALL KDE4FilePicker::getDisplayDirectory()
+ throw( uno::RuntimeException )
+{
+ QString dir = _dialog->baseUrl().url();
+ return toOUString(dir);
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL KDE4FilePicker::getFiles()
+ throw( uno::RuntimeException )
+{
+ QStringList files = _dialog->selectedFiles();
+
+ uno::Sequence< ::rtl::OUString > seq(files.size());
+
+ for (int i=0 ; i<files.size() ; ++i)
+ {
+ const QString fileName = "file:" + files[i];
+ seq[i] = toOUString(fileName);
+ }
+
+ return seq;
+}
+
+void SAL_CALL KDE4FilePicker::appendFilter( const ::rtl::OUString &title, const ::rtl::OUString &filter )
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ QString t = toQString(title);
+ QString f = toQString(filter);
+
+ if (!_filter.isNull())
+ {
+ _filter.append("\n");
+ }
+
+ //add to hash map for reverse lookup in getCurrentFilter
+ _filters.insert(f, t);
+
+ // '/' meed to be escaped to else they are assumed to be mime types by kfiledialog
+ //see the docs
+ t.replace("/", "\\/");
+
+ _filter.append(QString("%1|%2").arg(f).arg(t));
+}
+
+void SAL_CALL KDE4FilePicker::setCurrentFilter( const rtl::OUString &title )
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ QString filter = toQString(title);
+ filter.replace("/", "\\/");
+ _dialog->filterWidget()->setCurrentFilter(filter);
+}
+
+rtl::OUString SAL_CALL KDE4FilePicker::getCurrentFilter()
+ throw( uno::RuntimeException )
+{
+ QString filter = _filters[_dialog->currentFilter()];
+
+ //default if not found
+ if (filter.isNull())
+ {
+ filter = "ODF Text Document (.odt)";
+ }
+
+ return toOUString(filter);
+}
+
+void SAL_CALL KDE4FilePicker::appendFilterGroup( const rtl::OUString&, const uno::Sequence<beans::StringPair>& )
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ //TODO
+}
+
+void SAL_CALL KDE4FilePicker::setValue( sal_Int16 controlId, sal_Int16, const uno::Any &value )
+ throw( uno::RuntimeException )
+{
+ QWidget* widget = _customWidgets[controlId];
+
+ if (widget)
+ {
+ switch (controlId)
+ {
+ case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION:
+ case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD:
+ case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS:
+ case ExtendedFilePickerElementIds::CHECKBOX_READONLY:
+ case ExtendedFilePickerElementIds::CHECKBOX_LINK:
+ case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW:
+ case ExtendedFilePickerElementIds::CHECKBOX_SELECTION:
+ {
+ QCheckBox* cb = dynamic_cast<QCheckBox*>(widget);
+ cb->setChecked(value.getValue());
+ break;
+ }
+ case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY:
+ case ExtendedFilePickerElementIds::LISTBOX_VERSION:
+ case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE:
+ case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE:
+ case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL:
+ case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL:
+ case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL:
+ case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR:
+ break;
+ }
+ }
+}
+
+uno::Any SAL_CALL KDE4FilePicker::getValue( sal_Int16 controlId, sal_Int16 )
+ throw( uno::RuntimeException )
+{
+ uno::Any res(false);
+
+ QWidget* widget = _customWidgets[controlId];
+
+ if (widget)
+ {
+ switch (controlId)
+ {
+ case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION:
+ case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD:
+ case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS:
+ case ExtendedFilePickerElementIds::CHECKBOX_READONLY:
+ case ExtendedFilePickerElementIds::CHECKBOX_LINK:
+ case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW:
+ case ExtendedFilePickerElementIds::CHECKBOX_SELECTION:
+ {
+ QCheckBox* cb = dynamic_cast<QCheckBox*>(widget);
+ res = uno::Any(cb->isChecked());
+ break;
+ }
+ case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY:
+ case ExtendedFilePickerElementIds::LISTBOX_VERSION:
+ case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE:
+ case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE:
+ case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL:
+ case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL:
+ case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL:
+ case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR:
+ break;
+ }
+ }
+
+ return res;
+}
+
+void SAL_CALL KDE4FilePicker::enableControl( sal_Int16 controlId, sal_Bool enable )
+ throw( uno::RuntimeException )
+{
+ QWidget* widget = _customWidgets[controlId];
+
+ if (widget)
+ {
+ widget->setEnabled(enable);
+ }
+}
+
+void SAL_CALL KDE4FilePicker::setLabel( sal_Int16 controlId, const ::rtl::OUString &label )
+ throw( uno::RuntimeException )
+{
+ QWidget* widget = _customWidgets[controlId];
+
+ if (widget)
+ {
+ switch (controlId)
+ {
+ case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION:
+ case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD:
+ case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS:
+ case ExtendedFilePickerElementIds::CHECKBOX_READONLY:
+ case ExtendedFilePickerElementIds::CHECKBOX_LINK:
+ case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW:
+ case ExtendedFilePickerElementIds::CHECKBOX_SELECTION:
+ {
+ QCheckBox* cb = dynamic_cast<QCheckBox*>(widget);
+ cb->setText(toQString(label));
+ break;
+ }
+ case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY:
+ case ExtendedFilePickerElementIds::LISTBOX_VERSION:
+ case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE:
+ case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE:
+ case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL:
+ case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL:
+ case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL:
+ case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR:
+ break;
+ }
+ }
+}
+
+rtl::OUString SAL_CALL KDE4FilePicker::getLabel(sal_Int16 controlId)
+ throw ( uno::RuntimeException )
+{
+ QWidget* widget = _customWidgets[controlId];
+ QString label;
+
+ if (widget)
+ {
+ switch (controlId)
+ {
+ case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION:
+ case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD:
+ case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS:
+ case ExtendedFilePickerElementIds::CHECKBOX_READONLY:
+ case ExtendedFilePickerElementIds::CHECKBOX_LINK:
+ case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW:
+ case ExtendedFilePickerElementIds::CHECKBOX_SELECTION:
+ {
+ QCheckBox* cb = dynamic_cast<QCheckBox*>(widget);
+ label = cb->text();
+ break;
+ }
+ case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY:
+ case ExtendedFilePickerElementIds::LISTBOX_VERSION:
+ case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE:
+ case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE:
+ case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL:
+ case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL:
+ case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL:
+ case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR:
+ break;
+ }
+ }
+ return toOUString(label);
+}
+
+void KDE4FilePicker::addCustomControl(sal_Int16 controlId)
+{
+ QWidget* widget = 0;
+ sal_Int32 resId = -1;
+
+ switch (controlId)
+ {
+ case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION:
+ resId = STR_SVT_FILEPICKER_AUTO_EXTENSION;
+ break;
+ case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD:
+ resId = STR_SVT_FILEPICKER_PASSWORD;
+ break;
+ case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS:
+ resId = STR_SVT_FILEPICKER_FILTER_OPTIONS;
+ break;
+ case ExtendedFilePickerElementIds::CHECKBOX_READONLY:
+ resId = STR_SVT_FILEPICKER_READONLY;
+ break;
+ case ExtendedFilePickerElementIds::CHECKBOX_LINK:
+ resId = STR_SVT_FILEPICKER_INSERT_AS_LINK;
+ break;
+ case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW:
+ resId = STR_SVT_FILEPICKER_SHOW_PREVIEW;
+ break;
+ case ExtendedFilePickerElementIds::CHECKBOX_SELECTION:
+ resId = STR_SVT_FILEPICKER_SELECTION;
+ break;
+ case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY:
+ resId = STR_SVT_FILEPICKER_PLAY;
+ break;
+ case ExtendedFilePickerElementIds::LISTBOX_VERSION:
+ resId = STR_SVT_FILEPICKER_VERSION;
+ break;
+ case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE:
+ resId = STR_SVT_FILEPICKER_TEMPLATES;
+ break;
+ case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE:
+ resId = STR_SVT_FILEPICKER_IMAGE_TEMPLATE;
+ break;
+ case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL:
+ case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL:
+ case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL:
+ case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR:
+ break;
+ }
+
+ switch (controlId)
+ {
+ case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION:
+ case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD:
+ case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS:
+ case ExtendedFilePickerElementIds::CHECKBOX_READONLY:
+ case ExtendedFilePickerElementIds::CHECKBOX_LINK:
+ case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW:
+ case ExtendedFilePickerElementIds::CHECKBOX_SELECTION:
+ {
+ QString label;
+
+ if (_resMgr && resId != -1)
+ {
+ rtl::OUString s = String(ResId( resId, *_resMgr ));
+ label = toQString(s);
+ label.replace("~", "&");
+ }
+
+ widget = new QCheckBox(label, _extraControls);
+
+ break;
+ }
+ case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY:
+ case ExtendedFilePickerElementIds::LISTBOX_VERSION:
+ case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE:
+ case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE:
+ case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL:
+ case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL:
+ case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL:
+ case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR:
+ break;
+ }
+
+ if (widget)
+ {
+ _layout->addWidget(widget);
+ _customWidgets.insert(controlId, widget);
+ }
+}
+
+void SAL_CALL KDE4FilePicker::initialize( const uno::Sequence<uno::Any> &args )
+ throw( uno::Exception, uno::RuntimeException )
+{
+ _filter.clear();
+ _filters.clear();
+
+ // parameter checking
+ uno::Any arg;
+ if (args.getLength() == 0)
+ {
+ throw lang::IllegalArgumentException(
+ rtl::OUString::createFromAscii( "no arguments" ),
+ static_cast< XFilePicker* >( this ), 1 );
+ }
+
+ arg = args[0];
+
+ if (( arg.getValueType() != ::getCppuType((sal_Int16*)0)) &&
+ ( arg.getValueType() != ::getCppuType((sal_Int8*)0)))
+ {
+ throw lang::IllegalArgumentException(
+ rtl::OUString::createFromAscii( "invalid argument type" ),
+ static_cast< XFilePicker* >( this ), 1 );
+ }
+
+ sal_Int16 templateId = -1;
+ arg >>= templateId;
+
+ //default is opening
+ KFileDialog::OperationMode operationMode = KFileDialog::Opening;
+
+ switch ( templateId )
+ {
+ case FILEOPEN_SIMPLE:
+ break;
+
+ case FILESAVE_SIMPLE:
+ operationMode = KFileDialog::Saving;
+ break;
+
+ case FILESAVE_AUTOEXTENSION:
+ operationMode = KFileDialog::Saving;
+ addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
+ break;
+
+ case FILESAVE_AUTOEXTENSION_PASSWORD:
+ {
+ operationMode = KFileDialog::Saving;
+ addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
+ addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PASSWORD );
+ break;
+ }
+ case FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS:
+ {
+ operationMode = KFileDialog::Saving;
+ addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
+ addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PASSWORD );
+ addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS );
+ break;
+ }
+ case FILESAVE_AUTOEXTENSION_SELECTION:
+ operationMode = KFileDialog::Saving;
+ addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
+ addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_SELECTION );
+ break;
+
+ case FILESAVE_AUTOEXTENSION_TEMPLATE:
+ operationMode = KFileDialog::Saving;
+ addCustomControl( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE );
+ break;
+
+ case FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE:
+ addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_LINK );
+ addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PREVIEW );
+ addCustomControl( ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE );
+ break;
+
+ case FILEOPEN_PLAY:
+ addCustomControl( ExtendedFilePickerElementIds::PUSHBUTTON_PLAY );
+ break;
+
+ case FILEOPEN_READONLY_VERSION:
+ addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_READONLY );
+ addCustomControl( ExtendedFilePickerElementIds::LISTBOX_VERSION );
+ break;
+
+ case FILEOPEN_LINK_PREVIEW:
+ addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_LINK );
+ addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PREVIEW );
+ break;
+
+ default:
+ throw lang::IllegalArgumentException(
+ rtl::OUString::createFromAscii( "Unknown template" ),
+ static_cast< XFilePicker* >( this ),
+ 1 );
+ }
+
+ _dialog->setOperationMode(operationMode);
+}
+
+void SAL_CALL KDE4FilePicker::cancel()
+ throw ( uno::RuntimeException )
+{
+
+}
+
+void SAL_CALL KDE4FilePicker::disposing( const lang::EventObject &rEvent )
+ throw( uno::RuntimeException )
+{
+ uno::Reference<XFilePickerListener> xFilePickerListener( rEvent.Source, uno::UNO_QUERY );
+
+ if ( xFilePickerListener.is() )
+ {
+ removeFilePickerListener( xFilePickerListener );
+ }
+}
+
+rtl::OUString SAL_CALL KDE4FilePicker::getImplementationName()
+ throw( uno::RuntimeException )
+{
+ return rtl::OUString::createFromAscii( FILE_PICKER_IMPL_NAME );
+}
+
+sal_Bool SAL_CALL KDE4FilePicker::supportsService( const rtl::OUString& ServiceName )
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< ::rtl::OUString > SupportedServicesNames = FilePicker_getSupportedServiceNames();
+
+ for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; )
+ {
+ if ( SupportedServicesNames[n].compareTo( ServiceName ) == 0 )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL KDE4FilePicker::getSupportedServiceNames()
+ throw( uno::RuntimeException )
+{
+ return FilePicker_getSupportedServiceNames();
+}
diff --git a/fpicker/source/unx/kde4/KDE4FilePicker.hxx b/fpicker/source/unx/kde4/KDE4FilePicker.hxx
new file mode 100644
index 000000000000..da355852798a
--- /dev/null
+++ b/fpicker/source/unx/kde4/KDE4FilePicker.hxx
@@ -0,0 +1,205 @@
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): Jan Holesovsky <kendy@openoffice.org>
+ *
+ *
+ ************************************************************************/
+
+#pragma once
+
+#include <cppuhelper/compbase8.hxx>
+
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp>
+#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
+#include <com/sun/star/ui/dialogs/XFilterGroupManager.hpp>
+#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
+//#include <com/sun/star/ui/dialogs/XFilePreview.hpp>
+#include <com/sun/star/util/XCancellable.hpp>
+
+#include <osl/conditn.hxx>
+#include <osl/mutex.hxx>
+
+#include <rtl/ustrbuf.hxx>
+
+#include <QString>
+#include <QHash>
+
+class KFileDialog;
+class QWidget;
+class QLayout;
+
+class ResMgr;
+
+class KDE4FilePicker :
+ public cppu::WeakComponentImplHelper8<
+ ::com::sun::star::ui::dialogs::XFilterManager,
+ ::com::sun::star::ui::dialogs::XFilterGroupManager,
+ ::com::sun::star::ui::dialogs::XFilePickerControlAccess,
+ ::com::sun::star::ui::dialogs::XFilePickerNotifier,
+// TODO ::com::sun::star::ui::dialogs::XFilePreview,
+ ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::util::XCancellable,
+ ::com::sun::star::lang::XEventListener,
+ ::com::sun::star::lang::XServiceInfo >
+{
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceMgr; // to instanciate own services
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener > m_xListener;
+
+ ResMgr *_resMgr;
+
+ //the dialog to display
+ KFileDialog* _dialog;
+
+ osl::Mutex _helperMutex;
+
+ //running filter string to add to dialog
+ QString _filter;
+
+ //filter for reverse lookup of filter text
+ QHash<QString, QString> _filters;
+
+ //mapping of SAL control ID's to created custom controls
+ QHash<sal_Int16, QWidget*> _customWidgets;
+
+ //widget to contain extra custom controls
+ QWidget* _extraControls;
+
+ //layout for extra custom controls
+ QLayout* _layout;
+
+public:
+ KDE4FilePicker( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceMgr );
+ virtual ~KDE4FilePicker();
+
+ // XFilePickerNotifier
+
+ virtual void SAL_CALL addFilePickerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >& xListener ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeFilePickerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >& xListener ) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XExecutableDialog functions
+
+ virtual void SAL_CALL setTitle( const ::rtl::OUString &rTitle ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Int16 SAL_CALL execute() throw( ::com::sun::star::uno::RuntimeException );
+
+ // XFilePicker functions
+
+ virtual void SAL_CALL setMultiSelectionMode( sal_Bool bMode ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setDefaultName( const ::rtl::OUString &rName ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setDisplayDirectory( const ::rtl::OUString &rDirectory ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL getDisplayDirectory() throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFiles() throw( ::com::sun::star::uno::RuntimeException );
+
+ // XFilterManager functions
+
+ virtual void SAL_CALL appendFilter( const ::rtl::OUString &rTitle, const ::rtl::OUString &rFilter ) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setCurrentFilter( const ::rtl::OUString &rTitle ) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL getCurrentFilter() throw( ::com::sun::star::uno::RuntimeException );
+
+ // XFilterGroupManager functions
+
+ virtual void SAL_CALL appendFilterGroup( const ::rtl::OUString &rGroupTitle, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > &rFilters ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ // XFilePickerControlAccess functions
+
+ virtual void SAL_CALL setValue( sal_Int16 nControlId, sal_Int16 nControlAction, const ::com::sun::star::uno::Any &rValue ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getValue( sal_Int16 nControlId, sal_Int16 nControlAction ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL enableControl( sal_Int16 nControlId, sal_Bool bEnable ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setLabel( sal_Int16 nControlId, const ::rtl::OUString &rLabel ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getLabel( sal_Int16 nControlId ) throw (::com::sun::star::uno::RuntimeException);
+
+ /* TODO XFilePreview
+
+ virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getTargetColorDepth( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAvailableWidth( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAvailableHeight( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setImage( sal_Int16 aImageFormat, const ::com::sun::star::uno::Any &rImage ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setShowState( sal_Bool bShowState ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getShowState( ) throw (::com::sun::star::uno::RuntimeException);
+ */
+
+ // XInitialization
+
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > &rArguments ) throw( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException );
+
+ // XCancellable
+
+ virtual void SAL_CALL cancel( ) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XEventListener
+
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject &rEvent ) 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 &rServiceName ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
+
+private:
+ // prevent copy and assignment
+ KDE4FilePicker( const KDE4FilePicker& );
+ KDE4FilePicker& operator=( const KDE4FilePicker& );
+
+ //add a custom control widget to the file dialog
+ void addCustomControl(sal_Int16 controlId);
+
+};
diff --git a/fpicker/source/unx/kde4/fps-kde4-ucd.txt b/fpicker/source/unx/kde4/fps-kde4-ucd.txt
new file mode 100644
index 000000000000..8ecc4e0a0a52
--- /dev/null
+++ b/fpicker/source/unx/kde4/fps-kde4-ucd.txt
@@ -0,0 +1,6 @@
+[ComponentDescriptor]
+ImplementationName=com.sun.star.ui.dialogs.KDE4FilePicker
+ComponentName=fps_kde4.uno.so
+LoaderName=com.sun.star.loader.SharedLibrary
+[SupportedServices]
+com.sun.star.ui.dialogs.KDE4FilePicker
diff --git a/fpicker/source/unx/kde4/fps_kde4.xml b/fpicker/source/unx/kde4/fps_kde4.xml
new file mode 100644
index 000000000000..a12bf894186a
--- /dev/null
+++ b/fpicker/source/unx/kde4/fps_kde4.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd">
+<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
+ <module-name>fps_kde4</module-name>
+ <component-description>
+ <author> Jan Holesovsky </author>
+ <name> com.sun.star.comp.ui.dialogs.FilePicker </name>
+ <description>
+ The KDE implementation of the FilePicker service.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language> c++ </language>
+ <status value="beta"/>
+ <supported-service> com.sun.star.ui.dialogs.FilePicker </supported-service>
+ <service-dependency>...</service-dependency>
+ <type> com.sun.star.ui.dialogs.XExecutableDialog </type>
+ <type> com.sun.star.ui.dialogs.XFilePicker </type>
+ <type> com.sun.star.ui.dialogs.XFilterManager </type>
+ <type> com.sun.star.ui.dialogs.XFilterGroupManager </type>
+ <type> com.sun.star.ui.dialogs.XFilePickerListener </type>
+ <type> com.sun.star.ui.dialogs.ExecutableDialogException </type>
+ <type> com.sun.star.ui.dialogs.XFilePickerNotifier </type>
+ <type> com.sun.star.ui.dialogs.XFilePickerControlAccess </type>
+ <type> com.sun.star.ui.dialogs.XFilePreview </type>
+ <type> com.sun.star.ui.dialogs.ExtendedFilePickerElementIds </type>
+ <type> com.sun.star.ui.dialogs.ExecutableDialogResults </type>
+ <type> com.sun.star.ui.dialogs.FilePickerEvent </type>
+ <type> com.sun.star.ui.dialogs.CommonFilePickerElementIds </type>
+ <type> com.sun.star.ui.dialogs.ListboxControlActions </type>
+ <type> com.sun.star.ui.dialogs.TemplateDescription </type>
+ <type> com.sun.star.ui.dialogs.FilePreviewImageFormats </type>
+ <type> com.sun.star.util.XCancellable </type>
+ <type> com.sun.star.lang.XComponent </type>
+ <type> com.sun.star.lang.XMultiServiceFactory </type>
+ <type> com.sun.star.lang.XSingleServiceFactory </type>
+ <type> com.sun.star.lang.XServiceInfo </type>
+ <type> com.sun.star.lang.XTypeProvider </type>
+ <type> com.sun.star.lang.IllegalArgumentException </type>
+ <type> com.sun.star.uno.TypeClass </type>
+ <type> com.sun.star.uno.XWeak </type>
+ <type> com.sun.star.uno.XAggregation </type>
+ <type> com.sun.star.registry.XRegistryKey </type>
+ <type> com.sun.star.container.XSet </type>
+ </component-description>
+ <project-build-dependency> cppuhelper </project-build-dependency>
+ <project-build-dependency> cppu </project-build-dependency>
+ <project-build-dependency> sal </project-build-dependency>
+ <runtime-module-dependency> cppuhelper </runtime-module-dependency>
+ <runtime-module-dependency> cppu2 </runtime-module-dependency>
+ <runtime-module-dependency> sal2 </runtime-module-dependency>
+</module-description>
diff --git a/fpicker/source/unx/kde4/makefile.mk b/fpicker/source/unx/kde4/makefile.mk
new file mode 100644
index 000000000000..6f9db777bcb6
--- /dev/null
+++ b/fpicker/source/unx/kde4/makefile.mk
@@ -0,0 +1,117 @@
+#*************************************************************************
+#
+#
+#
+#
+#
+#
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=fpicker
+TARGET=fps_kde4.uno
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+DLLPRE=
+
+# ------------------------------------------------------------------
+
+# Currently just KDE is supported...
+.IF "$(GUIBASE)" != "unx" || "$(ENABLE_KDE4)" != "TRUE"
+
+dummy:
+ @echo "Nothing to build. GUIBASE == $(GUIBASE), ENABLE_KDE4 is not set"
+
+.ELSE # we build for KDE
+
+CFLAGS+= $(KDE4_CFLAGS)
+
+# --- Files --------------------------------------------------------
+
+SLOFILES =\
+ $(SLO)$/KDE4FilePicker.obj \
+ $(SLO)$/KDE4FilePicker.moc.obj \
+ $(SLO)$/KDE4FPEntry.obj
+
+SHL1NOCHECK=TRUE
+SHL1TARGET=$(TARGET)
+SHL1STDLIBS=$(CPPULIB)\
+ $(CPPUHELPERLIB)\
+ $(SALLIB)\
+ $(VCLLIB)\
+ $(TOOLSLIB) \
+ $(KDE4_LIBS) -lkio -lkfile
+
+
+SHL1OBJS=$(SLOFILES)
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+DEF1VERSIONMAP=exports.map
+
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+$(MISC)$/KDE4FilePicker.moc.cxx : KDE4FilePicker.hxx
+ $(MOC4) $< -o $@
diff --git a/fpicker/source/win32/filepicker/FPentry.cxx b/fpicker/source/win32/filepicker/FPentry.cxx
index 48cc3cc53a50..bc3d020baaad 100644
--- a/fpicker/source/win32/filepicker/FPentry.cxx
+++ b/fpicker/source/win32/filepicker/FPentry.cxx
@@ -66,9 +66,9 @@ static Reference< XInterface > SAL_CALL createInstance(
const Reference< XMultiServiceFactory >& rServiceManager )
{
Reference< XInterface > xDlg;
- bool bVista = IsWindowsVista();
+ bool bVistaOrNewer = IsWindowsVistaOrNewer();
- if (bVista)
+ if (bVistaOrNewer)
{
fprintf(stdout, "use special (vista) system file picker ...\n");
xDlg.set(
diff --git a/fpicker/source/win32/filepicker/SolarMutex.cxx b/fpicker/source/win32/filepicker/SolarMutex.cxx
new file mode 100644
index 000000000000..3c446f412e46
--- /dev/null
+++ b/fpicker/source/win32/filepicker/SolarMutex.cxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * 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: asynceventnotifier.cxx,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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_fpicker.hxx"
+
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <osl/thread.hxx>
+
+int ReleaseSolarMutexOnMainThreadContext(unsigned nThreadId)
+{
+ int nAcquireCount = 0;
+ vos::IMutex& rSolarMutex = Application::GetSolarMutex();
+ vos::OThread::TThreadIdentifier nMainThreadId = Application::GetMainThreadIdentifier();
+
+ if ( nMainThreadId == nThreadId )
+ {
+ ::vos::IMutex& rMutex = Application::GetSolarMutex();
+ if ( rMutex.tryToAcquire() )
+ nAcquireCount = Application::ReleaseSolarMutex() - 1;
+ }
+
+ return nAcquireCount;
+}
+
+void AcquireSolarMutex(int nAcquireCount)
+{
+ if ( nAcquireCount )
+ Application::AcquireSolarMutex( nAcquireCount );
+}
diff --git a/fpicker/source/win32/filepicker/SolarMutex.hxx b/fpicker/source/win32/filepicker/SolarMutex.hxx
new file mode 100644
index 000000000000..95dcf13ecc3b
--- /dev/null
+++ b/fpicker/source/win32/filepicker/SolarMutex.hxx
@@ -0,0 +1,33 @@
+/*************************************************************************
+ *
+ * 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: asynceventnotifier.cxx,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.
+ *
+ ************************************************************************/
+
+int ReleaseSolarMutexOnMainThreadContext(unsigned nThreadId);
+
+void AcquireSolarMutex(int nAcquireCount);
diff --git a/fpicker/source/win32/filepicker/VistaFilePicker.cxx b/fpicker/source/win32/filepicker/VistaFilePicker.cxx
index 1fe559c74282..84d17dbbc0b1 100644
--- a/fpicker/source/win32/filepicker/VistaFilePicker.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePicker.cxx
@@ -51,6 +51,7 @@
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <cppuhelper/interfacecontainer.h>
+#include <comphelper/configurationhelper.hxx>
#include <osl/diagnose.h>
#include <osl/mutex.hxx>
#include <osl/file.hxx>
@@ -165,6 +166,7 @@ VistaFilePicker::VistaFilePicker(const css::uno::Reference< css::lang::XMultiSer
, m_rDialog (new VistaFilePickerImpl())
, m_aAsyncExecute (m_rDialog )
, m_nFilePickerThreadId (0 )
+ , m_bInitialized (false )
{
}
@@ -293,9 +295,24 @@ void SAL_CALL VistaFilePicker::setDisplayDirectory(const ::rtl::OUString& sDirec
throw (css::lang::IllegalArgumentException,
css::uno::RuntimeException )
{
+ const ::rtl::OUString aPackage( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/"));
+ const ::rtl::OUString aRelPath( RTL_CONSTASCII_USTRINGPARAM("Path/Info"));
+ const ::rtl::OUString aKey( RTL_CONSTASCII_USTRINGPARAM("WorkPathChanged"));
+
+ css::uno::Any aValue = ::comphelper::ConfigurationHelper::readDirectKey(
+ m_xSMGR, aPackage, aRelPath, aKey, ::comphelper::ConfigurationHelper::E_READONLY);
+
+ bool bChanged(false);
+ if (( aValue >>= bChanged ) && bChanged )
+ {
+ ::comphelper::ConfigurationHelper::writeDirectKey(
+ m_xSMGR, aPackage, aRelPath, aKey, css::uno::makeAny(false), ::comphelper::ConfigurationHelper::E_STANDARD);
+ }
+
RequestRef rRequest(new Request());
rRequest->setRequest (VistaFilePickerImpl::E_SET_DIRECTORY);
rRequest->setArgument(PROP_DIRECTORY, sDirectory);
+ rRequest->setArgument(PROP_FORCE, bChanged);
m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED);
}
@@ -345,6 +362,20 @@ css::uno::Sequence< ::rtl::OUString > SAL_CALL VistaFilePicker::getSelectedFiles
::sal_Int16 SAL_CALL VistaFilePicker::execute()
throw(css::uno::RuntimeException)
{
+ bool bInitialized(false);
+ {
+ osl::MutexGuard aGuard(m_aMutex);
+ bInitialized = m_bInitialized;
+ }
+
+ if ( !bInitialized )
+ {
+ sal_Int16 nTemplateDescription = css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE;
+ css::uno::Sequence < css::uno::Any > aInitArguments(1);
+ aInitArguments[0] <<= nTemplateDescription;
+ initialize(aInitArguments);
+ }
+
RequestRef rRequest(new Request());
rRequest->setRequest (VistaFilePickerImpl::E_SHOW_DIALOG_MODAL);
@@ -640,6 +671,11 @@ void SAL_CALL VistaFilePicker::initialize(const css::uno::Sequence< css::uno::An
if ( ! m_aAsyncExecute.isRunning())
m_aAsyncExecute.create();
m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED);
+
+ {
+ osl::MutexGuard aGuard(m_aMutex);
+ m_bInitialized = true;
+ }
}
//------------------------------------------------------------------------------------
diff --git a/fpicker/source/win32/filepicker/VistaFilePicker.hxx b/fpicker/source/win32/filepicker/VistaFilePicker.hxx
index 825444cd52f9..4e3a73cb939f 100644
--- a/fpicker/source/win32/filepicker/VistaFilePicker.hxx
+++ b/fpicker/source/win32/filepicker/VistaFilePicker.hxx
@@ -305,6 +305,8 @@ public:
//---------------------------------------------------------------------
oslThreadIdentifier m_nFilePickerThreadId;
+
+ bool m_bInitialized;
};
} // namespace vista
diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
index a22ef2bea143..23467f148f4b 100644
--- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
@@ -40,6 +40,7 @@
#include <comphelper/sequenceasvector.hxx>
#include <osl/file.hxx>
#include <osl/mutex.hxx>
+#include "..\misc\WinImplHelper.hxx"
inline bool is_current_process_window(HWND hwnd)
{
@@ -401,7 +402,6 @@ void VistaFilePickerImpl::impl_sta_CreateOpenDialog(const RequestRef& rRequest)
nFlags |= FOS_FILEMUSTEXIST;
nFlags |= FOS_OVERWRITEPROMPT;
nFlags |= FOS_DONTADDTORECENT;
- nFlags |= FOS_ALLOWMULTISELECT;
iDialog->SetOptions ( nFlags );
@@ -462,6 +462,14 @@ static const ::sal_Int32 GROUP_IMAGETEMPLATE = 3;
static const ::sal_Int32 GROUP_CHECKBOXES = 4;
//-------------------------------------------------------------------------------
+static void setLabelToControl(CResourceProvider& rResourceProvider, TFileDialogCustomize iCustom, sal_uInt16 nControlId)
+{
+ ::rtl::OUString aLabel = rResourceProvider.getResString(nControlId);
+ aLabel = SOfficeToWindowsLabel(aLabel);
+ iCustom->SetControlLabel(nControlId, reinterpret_cast<LPCWSTR>(aLabel.getStr()) );
+}
+
+//-------------------------------------------------------------------------------
void VistaFilePickerImpl::impl_sta_enableFeatures(::sal_Int32 nFeatures, ::sal_Int32 nTemplate)
{
GUID aGUID = {};
@@ -536,23 +544,48 @@ void VistaFilePickerImpl::impl_sta_enableFeatures(::sal_Int32 nFeatures, ::sal_I
iCustom->StartVisualGroup (GROUP_CHECKBOXES, L"");
+ sal_uInt16 nControlId(0);
if ((nFeatures & FEATURE_AUTOEXTENSION) == FEATURE_AUTOEXTENSION)
- iCustom->AddCheckButton (css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, L"Auto Extension", true);
+ {
+ nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION;
+ iCustom->AddCheckButton (nControlId, L"Auto Extension", true);
+ setLabelToControl(m_ResProvider, iCustom, nControlId);
+ }
if ((nFeatures & FEATURE_PASSWORD) == FEATURE_PASSWORD)
- iCustom->AddCheckButton (css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_PASSWORD, L"Password", false);
+ {
+ nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_PASSWORD;
+ iCustom->AddCheckButton (nControlId, L"Password", false);
+ setLabelToControl(m_ResProvider, iCustom, nControlId);
+ }
if ((nFeatures & FEATURE_READONLY) == FEATURE_READONLY)
- iCustom->AddCheckButton (css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_READONLY, L"Readonly", false);
+ {
+ nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_READONLY;
+ iCustom->AddCheckButton (nControlId, L"Readonly", false);
+ setLabelToControl(m_ResProvider, iCustom, nControlId);
+ }
if ((nFeatures & FEATURE_FILTEROPTIONS) == FEATURE_FILTEROPTIONS)
- iCustom->AddCheckButton (css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS, L"Filter Options", false);
+ {
+ nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS;
+ iCustom->AddCheckButton (nControlId, L"Filter Options", false);
+ setLabelToControl(m_ResProvider, iCustom, nControlId);
+ }
if ((nFeatures & FEATURE_LINK) == FEATURE_LINK)
- iCustom->AddCheckButton (css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK, L"Link", false);
+ {
+ nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK;
+ iCustom->AddCheckButton (nControlId, L"Link", false);
+ setLabelToControl(m_ResProvider, iCustom, nControlId);
+ }
if ((nFeatures & FEATURE_SELECTION) == FEATURE_SELECTION)
- iCustom->AddCheckButton (css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_SELECTION, L"Selection", false);
+ {
+ nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_SELECTION;
+ iCustom->AddCheckButton (nControlId, L"Selection", false);
+ setLabelToControl(m_ResProvider, iCustom, nControlId);
+ }
/* can be ignored ... new COM dialog supports preview native now !
if ((nFeatures & FEATURE_PREVIEW) == FEATURE_PREVIEW)
@@ -620,8 +653,9 @@ void VistaFilePickerImpl::impl_sta_SetFileName(const RequestRef& rRequest)
void VistaFilePickerImpl::impl_sta_SetDirectory(const RequestRef& rRequest)
{
::rtl::OUString sDirectory = rRequest->getArgumentOrDefault(PROP_DIRECTORY, ::rtl::OUString());
+ bool bForce = rRequest->getArgumentOrDefault(PROP_FORCE, false);
- if( !m_bInExecute )
+ if( !m_bInExecute)
{
// Vista stores last used folders for file dialogs
// so we don't want the application to change the folder
@@ -629,7 +663,6 @@ void VistaFilePickerImpl::impl_sta_SetDirectory(const RequestRef& rRequest)
// Store the requested folder in the mean time and decide later
// what to do
m_sDirectory = sDirectory;
- return;
}
// SYNCHRONIZED->
@@ -647,7 +680,13 @@ void VistaFilePickerImpl::impl_sta_SetDirectory(const RequestRef& rRequest)
if ( FAILED(hResult) )
return;
- iDialog->SetFolder(pFolder);
+ if ( m_bInExecute || bForce )
+ iDialog->SetFolder(pFolder);
+ else
+ {
+ // Use set default folder as Microsoft recommends in the IFileDialog documentation.
+ iDialog->SetDefaultFolder(pFolder);
+ }
}
void VistaFilePickerImpl::impl_sta_GetDirectory(const RequestRef& rRequest)
@@ -815,21 +854,62 @@ void VistaFilePickerImpl::impl_sta_ShowDialogModal(const RequestRef& rRequest)
aLock.clear();
// <- SYNCHRONIZED
+ // we set the directory only if we have a save dialog and a filename
+ // for the other cases, the file dialog remembers its last location
+ // according to its client guid.
if( m_sDirectory.getLength())
{
- // we set the directory only if we have a save dialog and a filename
- // for the other cases, the file dialog remembers its last location
- // according to its client guid.
- if (iSave.is() && m_sFilename.getLength())
+ ComPtr< IShellItem > pFolder;
+ #ifdef __MINGW32__
+ HRESULT hResult = SHCreateItemFromParsingName ( reinterpret_cast<LPCTSTR>(m_sDirectory.getStr()), NULL, IID_IShellItem, (void**)(&pFolder) );
+ #else
+ HRESULT hResult = SHCreateItemFromParsingName ( m_sDirectory, NULL, IID_PPV_ARGS(&pFolder) );
+ #endif
+ if ( SUCCEEDED(hResult) )
{
- ComPtr< IShellItem > pFolder;
- #ifdef __MINGW32__
- HRESULT hResult = SHCreateItemFromParsingName ( reinterpret_cast<LPCTSTR>(m_sDirectory.getStr()), NULL, IID_IShellItem, (void**)(&pFolder) );
- #else
- HRESULT hResult = SHCreateItemFromParsingName ( m_sDirectory, NULL, IID_PPV_ARGS(&pFolder) );
- #endif
- if ( SUCCEEDED(hResult) )
- iDialog->SetFolder(pFolder);
+ if (m_sFilename.getLength())
+ {
+ ::rtl::OUString aFileURL(m_sDirectory);
+ sal_Int32 nIndex = aFileURL.lastIndexOf('/');
+ if (nIndex != aFileURL.getLength()-1)
+ aFileURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/"));
+ aFileURL += m_sFilename;
+
+ TFileDialogCustomize iCustom = impl_getCustomizeInterface();
+
+ BOOL bValue = FALSE;
+ HRESULT hResult = iCustom->GetCheckButtonState( css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, &bValue);
+ if ( bValue )
+ {
+ ::rtl::OUString aExt;
+ UINT nFileType;
+ hResult = iDialog->GetFileTypeIndex(&nFileType);
+ if ( SUCCEEDED(hResult) )
+ {
+ ::std::vector< COMDLG_FILTERSPEC > lFilters = lcl_buildFilterList(m_lFilters);
+ LPCWSTR lpFilterExt = lFilters[nFileType].pszSpec;
+
+ lpFilterExt = wcsrchr( lpFilterExt, '.' );
+ if ( lpFilterExt )
+ aFileURL += reinterpret_cast<const sal_Unicode*>(lpFilterExt);
+ }
+ }
+
+ // Check existence of file. Set folder only for this special case
+ ::rtl::OUString aSystemPath;
+ osl_getSystemPathFromFileURL( aFileURL.pData, &aSystemPath.pData );
+
+ WIN32_FIND_DATA aFindFileData;
+ HANDLE hFind = FindFirstFile( reinterpret_cast<LPCWSTR>(aSystemPath.getStr()), &aFindFileData );
+ if (hFind != INVALID_HANDLE_VALUE)
+ iDialog->SetFolder(pFolder);
+ else
+ hResult = iDialog->AddPlace(pFolder, FDAP_TOP);
+
+ FindClose( hFind );
+ }
+ else
+ hResult = iDialog->AddPlace(pFolder, FDAP_TOP);
}
}
@@ -1048,7 +1128,7 @@ void VistaFilePickerImpl::impl_sta_SetControlLabel(const RequestRef& rRequest)
}
//-------------------------------------------------------------------------------
-void VistaFilePickerImpl::impl_sta_GetControlLabel(const RequestRef& rRequest)
+void VistaFilePickerImpl::impl_sta_GetControlLabel(const RequestRef& /*rRequest*/)
{
}
diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx
index 6046876207fc..b15b5c24c52d 100644
--- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx
+++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx
@@ -42,6 +42,7 @@
#include "FilterContainer.hxx"
#include "VistaFilePickerEventHandler.hxx"
#include "IVistaFilePickerInternalNotify.hxx"
+#include "..\misc\resourceprovider.hxx"
#include <com/sun/star/uno/Sequence.hxx>
@@ -101,6 +102,7 @@ static const ::rtl::OUString PROP_FEATURES = ::rtl::OUString::createF
static const ::rtl::OUString PROP_TEMPLATE_DESCR = ::rtl::OUString::createFromAscii("templatedescription"); // [sal_Int32]
static const ::rtl::OUString PROP_FILTER_TITLE = ::rtl::OUString::createFromAscii("filter_title" ); // [OUString]
static const ::rtl::OUString PROP_FILTER_VALUE = ::rtl::OUString::createFromAscii("filter_value" ); // [OUString]
+static const ::rtl::OUString PROP_FORCE = ::rtl::OUString::createFromAscii("force" ); // [sal_Bool]
static const ::rtl::OUString PROP_CONTROL_ID = ::rtl::OUString::createFromAscii("control_id" ); // [sal_Int16]
static const ::rtl::OUString PROP_CONTROL_ACTION = ::rtl::OUString::createFromAscii("control_action" ); // [sal_Int16]
@@ -334,6 +336,9 @@ class VistaFilePickerImpl : private ::cppu::BaseMutex
//
::rtl::OUString m_sFilename;
+
+ // Resource provider
+ CResourceProvider m_ResProvider;
};
} // namespace vista
diff --git a/fpicker/source/win32/filepicker/asynceventnotifier.cxx b/fpicker/source/win32/filepicker/asynceventnotifier.cxx
index a780eeaea52d..b715457b76dd 100644
--- a/fpicker/source/win32/filepicker/asynceventnotifier.cxx
+++ b/fpicker/source/win32/filepicker/asynceventnotifier.cxx
@@ -41,6 +41,7 @@
#include <process.h>
#include <memory>
+#include "SolarMutex.hxx"
//------------------------------------------------
//
@@ -159,7 +160,9 @@ bool SAL_CALL CAsyncEventNotifier::startup(bool bCreateSuspended)
void SAL_CALL CAsyncEventNotifier::shutdown()
{
- OSL_PRECOND(GetCurrentThreadId() != m_ThreadId, "Method called in wrong thread context!");
+ unsigned nThreadId = GetCurrentThreadId();
+
+ OSL_PRECOND(nThreadId != m_ThreadId, "Method called in wrong thread context!");
osl::ResettableMutexGuard aGuard(m_Mutex);
diff --git a/fpicker/source/win32/filepicker/asyncrequests.cxx b/fpicker/source/win32/filepicker/asyncrequests.cxx
index 4e277899e1cc..dad19a629f7f 100644
--- a/fpicker/source/win32/filepicker/asyncrequests.cxx
+++ b/fpicker/source/win32/filepicker/asyncrequests.cxx
@@ -30,6 +30,7 @@
#include "asyncrequests.hxx"
#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
//-----------------------------------------------------------------------------
// namespace
@@ -53,7 +54,7 @@ void lcl_sleep(::osl::Condition& aCondition ,
{
TimeValue aTime;
aTime.Seconds = (nMilliSeconds / 1000);
- aTime.Nanosec = (nMilliSeconds % 1000);
+ aTime.Nanosec = (nMilliSeconds % 1000) * 1000000;
aCondition.wait(&aTime);
}
@@ -68,6 +69,7 @@ void Request::wait(::sal_Int32 nMilliSeconds)
void Request::waitProcessMessages()
{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
while (!m_aJoiner.check())
Application::Yield();
}
diff --git a/fpicker/source/win32/filepicker/filepickerstate.cxx b/fpicker/source/win32/filepicker/filepickerstate.cxx
index ee7cd363794e..bd945a2d7939 100644
--- a/fpicker/source/win32/filepicker/filepickerstate.cxx
+++ b/fpicker/source/win32/filepicker/filepickerstate.cxx
@@ -220,6 +220,26 @@ OUString MatchFixBrokenPath(const OUString& path)
return path;
}
+//-----------------------------------------------------------------------------------------
+//
+//-----------------------------------------------------------------------------------------
+static ::rtl::OUString trimTrailingSpaces(const ::rtl::OUString& rString)
+{
+ rtl::OUString aResult(rString);
+
+ sal_Int32 nIndex = rString.lastIndexOf(' ');
+ if (nIndex == rString.getLength()-1)
+ {
+ while (nIndex >= 0 && rString[nIndex] == ' ')
+ nIndex--;
+ if (nIndex >= 0)
+ aResult = rString.copy(0,nIndex+1);
+ else
+ aResult = ::rtl::OUString();
+ }
+ return aResult;
+}
+
Sequence< OUString > SAL_CALL CNonExecuteFilePickerState::getFiles( CFileOpenDialog* aFileOpenDialog )
{
OSL_PRECOND( aFileOpenDialog, "invalid parameter" );
@@ -258,8 +278,9 @@ Sequence< OUString > SAL_CALL CNonExecuteFilePickerState::getFiles( CFileOpenDia
for ( sal_Int32 i = 0; i < lenFileList; i++ )
{
+ aFilePath = trimTrailingSpaces(aFilePathList[i]);
rc = ::osl::FileBase::getFileURLFromSystemPath(
- aFilePathList[i], aFilePathURL );
+ aFilePath, aFilePathURL );
// we do return all or nothing, that means
// in case of failures we destroy the sequence
diff --git a/fpicker/source/win32/filepicker/makefile.mk b/fpicker/source/win32/filepicker/makefile.mk
index de9ee56ccc15..de192879b629 100644
--- a/fpicker/source/win32/filepicker/makefile.mk
+++ b/fpicker/source/win32/filepicker/makefile.mk
@@ -48,9 +48,6 @@ CDEFS+=-DUNICODE
#CDEFS+=-DWIN32_LEAN_AND_MEAN
#CDEFS+=-DWIN32
-.IF "$(COM)"=="GCC"
-CDEFS+=-UWINVER -DWINVER=0x500
-.ENDIF
# --- Resources ----------------------------------------------------
@@ -82,7 +79,8 @@ SLOFILES=$(SLO)$/FileOpenDlg.obj\
$(SLO)$/asyncrequests.obj\
$(SLO)$/VistaFilePickerEventHandler.obj\
$(SLO)$/VistaFilePickerImpl.obj\
- $(SLO)$/VistaFilePicker.obj
+ $(SLO)$/VistaFilePicker.obj\
+ $(SLO)$/SolarMutex.obj
# --- Targets ------------------------------------------------------
diff --git a/fpicker/source/win32/folderpicker/MtaFop.cxx b/fpicker/source/win32/folderpicker/MtaFop.cxx
index 573036c74252..147e0ef09cdd 100644
--- a/fpicker/source/win32/folderpicker/MtaFop.cxx
+++ b/fpicker/source/win32/folderpicker/MtaFop.cxx
@@ -448,34 +448,22 @@ LPITEMIDLIST SAL_CALL CMtaFolderPicker::getItemIdListFromPath( const rtl::OUStri
if ( !aDirectory.getLength( ) )
return NULL;
- IMallocPtr pIMalloc;
- SHGetMalloc(&pIMalloc);
+ LPITEMIDLIST lpItemIdList(NULL);
- LPITEMIDLIST lpItemIdList = static_cast<LPITEMIDLIST>(
- pIMalloc->Alloc(sizeof(ITEMIDLIST)));
+ IShellFolderPtr pIShellFolder;
+ SHGetDesktopFolder(&pIShellFolder);
- if (lpItemIdList)
+ if (pIShellFolder.is())
{
- IShellFolderPtr pIShellFolder;
- SHGetDesktopFolder(&pIShellFolder);
-
- if (pIShellFolder.is())
- {
- pIShellFolder->ParseDisplayName(
- NULL,
- NULL,
- reinterpret_cast<LPOLESTR>(const_cast< sal_Unicode* >( aDirectory.getStr( ) )),
- NULL,
- &lpItemIdList,
- NULL );
- }
+ pIShellFolder->ParseDisplayName(
+ NULL,
+ NULL,
+ reinterpret_cast<LPWSTR>(const_cast< sal_Unicode* >( aDirectory.getStr( ) )),
+ NULL,
+ &lpItemIdList,
+ NULL );
}
- if (pIMalloc.is())
- pIMalloc->Free(lpItemIdList);
-
- lpItemIdList = NULL;
-
return lpItemIdList;
}
diff --git a/fpicker/source/win32/misc/WinImplHelper.cxx b/fpicker/source/win32/misc/WinImplHelper.cxx
index befd02352243..e253385a3c3d 100644
--- a/fpicker/source/win32/misc/WinImplHelper.cxx
+++ b/fpicker/source/win32/misc/WinImplHelper.cxx
@@ -69,6 +69,7 @@ const sal_Unicode AMPERSAND_SIGN = L'&';
// Windows 2000 VER_PLATFORM_WIN32_NT 5 0
// Windows XP VER_PLATFORM_WIN32_NT 5 1
// Windows Vista VER_PLATFORM_WIN32_NT 6 0
+// Windows 7 VER_PLATFORM_WIN32_NT 6 1
// Windows 95 VER_PLATFORM_WIN32_WINDOWS 4 0
// Windows 98 VER_PLATFORM_WIN32_WINDOWS 4 10
// Windows ME VER_PLATFORM_WIN32_WINDOWS 4 90
@@ -94,25 +95,47 @@ bool SAL_CALL IsWindowsVersion(unsigned int PlatformId, unsigned int MajorVersio
}
//------------------------------------------------------------
-// determine if we are running under Win2000
+// determine if we are running under Vista or newer OS
//------------------------------------------------------------
-bool SAL_CALL IsWindowsVista()
+bool SAL_CALL IsWindowsVistaOrNewer()
{
- return IsWindowsVersion(VER_PLATFORM_WIN32_NT, 6, 0);
+ OSVERSIONINFO osvi;
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+
+ if(!GetVersionEx(&osvi))
+ return false;
+
+ bool bRet = (VER_PLATFORM_WIN32_NT == osvi.dwPlatformId) &&
+ (osvi.dwMajorVersion >= 6);
+
+ bRet = bRet &&
+ (osvi.dwMinorVersion >=
+ sal::static_int_cast< unsigned int >(0));
+
+ return bRet;
}
//------------------------------------------------------------
-// determine if we are running under Win2000
+// determine if we are running under Windows 7
//------------------------------------------------------------
-bool SAL_CALL IsWindows2000()
+bool SAL_CALL IsWindows7()
{
- return IsWindowsVersion(VER_PLATFORM_WIN32_NT, 5, 0);
+ return IsWindowsVersion(VER_PLATFORM_WIN32_NT, 6, 1);
}
//------------------------------------------------------------
-//
+// determine if we are running under Windows Vista
+//------------------------------------------------------------
+
+bool SAL_CALL IsWindowsVista()
+{
+ return IsWindowsVersion(VER_PLATFORM_WIN32_NT, 6, 0);
+}
+
+//------------------------------------------------------------
+// determine if we are running under Windows XP
//------------------------------------------------------------
bool SAL_CALL IsWindowsXP()
@@ -121,6 +144,15 @@ bool SAL_CALL IsWindowsXP()
}
//------------------------------------------------------------
+// determine if we are running under Windows 2000
+//------------------------------------------------------------
+
+bool SAL_CALL IsWindows2000()
+{
+ return IsWindowsVersion(VER_PLATFORM_WIN32_NT, 5, 0);
+}
+
+//------------------------------------------------------------
//
//------------------------------------------------------------
diff --git a/fpicker/source/win32/misc/WinImplHelper.hxx b/fpicker/source/win32/misc/WinImplHelper.hxx
index 3a8bd3179c81..6f29a2bb1226 100644
--- a/fpicker/source/win32/misc/WinImplHelper.hxx
+++ b/fpicker/source/win32/misc/WinImplHelper.hxx
@@ -53,6 +53,8 @@
// deklarations
//------------------------------------------------------------------------
+bool SAL_CALL IsWindowsVistaOrNewer();
+bool SAL_CALL IsWindows7();
bool SAL_CALL IsWindowsVista();
bool SAL_CALL IsWindows2000();
bool SAL_CALL IsWindowsXP();
diff --git a/framework/inc/helper/mischelper.hxx b/framework/inc/helper/mischelper.hxx
new file mode 100644
index 000000000000..1d9df9caa4ff
--- /dev/null
+++ b/framework/inc/helper/mischelper.hxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * 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: acceleratorinfo.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 __MISC_HELPER_HXX_
+#define __MISC_HELPER_HXX_
+
+#include <com/sun/star/linguistic2/XLanguageGuessing.hpp>
+
+#include <i18npool/lang.h>
+#include <svtools/languageoptions.hxx>
+
+namespace framework
+{
+
+inline bool IsScriptTypeMatchingToLanguage( sal_Int16 nScriptType, LanguageType nLang )
+{
+ return 0 != (nScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage( nLang ));
+}
+
+
+class LanguageGuessingHelper
+{
+ mutable ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLanguageGuessing > m_xLanguageGuesser;
+
+public:
+ LanguageGuessingHelper() {}
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLanguageGuessing > GetGuesser() const;
+};
+
+} // namespace framework
+
+#endif // __MISC_HELPER_HXX_
+
diff --git a/framework/inc/uielement/langselectionmenucontroller.hxx b/framework/inc/uielement/langselectionmenucontroller.hxx
index 724b75eba3d8..f9cec2dfb814 100644
--- a/framework/inc/uielement/langselectionmenucontroller.hxx
+++ b/framework/inc/uielement/langselectionmenucontroller.hxx
@@ -58,6 +58,8 @@
#include <cppuhelper/weak.hxx>
#include <rtl/ustring.hxx>
+#include "helper/mischelper.hxx"
+
namespace framework
{
class LanguageSelectionMenuController : public PopupMenuControllerBase
@@ -97,7 +99,6 @@ namespace framework
};
sal_Bool m_bShowMenu;
- ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLanguageGuessing > m_xLanguageGuesser;
::rtl::OUString m_aLangStatusCommandURL;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xLanguageDispatch;
::rtl::OUString m_aMenuCommandURL_Lang;
@@ -111,6 +112,7 @@ namespace framework
sal_Int16 m_nScriptType;
::rtl::OUString m_aKeyboardLang;
::rtl::OUString m_aGuessedText;
+ LanguageGuessingHelper m_aLangGuessHelper;
void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu, const Mode rMode );
};
diff --git a/framework/inc/uielement/langselectionstatusbarcontroller.hxx b/framework/inc/uielement/langselectionstatusbarcontroller.hxx
index b2f1a9306ea3..4e886f89adfb 100644
--- a/framework/inc/uielement/langselectionstatusbarcontroller.hxx
+++ b/framework/inc/uielement/langselectionstatusbarcontroller.hxx
@@ -39,6 +39,8 @@
#include <com/sun/star/linguistic2/XLanguageGuessing.hpp>
#include <svtools/statusbarcontroller.hxx>
+#include "helper/mischelper.hxx"
+
// component helper namespace
namespace framework {
@@ -92,7 +94,7 @@ class LangSelectionStatusbarController : public svt::StatusbarController
::rtl::OUString m_aCurLang;
::rtl::OUString m_aKeyboardLang;
::rtl::OUString m_aGuessedText;
- ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLanguageGuessing > m_xLanguageGuesser;
+ LanguageGuessingHelper m_aLangGuessHelper;
void LangMenu() throw (::com::sun::star::uno::RuntimeException);
};
diff --git a/framework/prj/build.lst b/framework/prj/build.lst
index d7fc1496c42a..b9814037e729 100644
--- a/framework/prj/build.lst
+++ b/framework/prj/build.lst
@@ -1,4 +1,4 @@
-fr framework : svtools NULL
+fr framework : l10n svtools NULL
fr framework usr1 - all fr_mkout NULL
fr framework\inc nmake - all fr_inc NULL
fr framework\source\constant nmake - all fr_constant fr_inc NULL
diff --git a/framework/source/helper/makefile.mk b/framework/source/helper/makefile.mk
index 29db41747e83..7a2fc1816869 100644
--- a/framework/source/helper/makefile.mk
+++ b/framework/source/helper/makefile.mk
@@ -66,7 +66,8 @@ SLOFILES= $(SLO)$/ocomponentaccess.obj \
$(SLO)$/configimporter.obj \
$(SLO)$/tagwindowasmodified.obj \
$(SLO)$/titlebarupdate.obj \
- $(SLO)$/titlehelper.obj
+ $(SLO)$/titlehelper.obj \
+ $(SLO)$/mischelper.obj
# --- Targets ------------------------------------------------------
diff --git a/framework/source/helper/mischelper.cxx b/framework/source/helper/mischelper.cxx
new file mode 100644
index 000000000000..395d59259286
--- /dev/null
+++ b/framework/source/helper/mischelper.cxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * 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: langselectionstatusbarcontroller.cxx,v $
+ * $Revision: 1.6.40.1 $
+ *
+ * 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_framework.hxx"
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <tools/debug.hxx>
+#include <comphelper/processfactory.hxx>
+#include <helper/mischelper.hxx>
+
+
+using namespace ::com::sun::star;
+
+namespace framework
+{
+
+uno::Reference< linguistic2::XLanguageGuessing > LanguageGuessingHelper::GetGuesser() const
+{
+ if (!m_xLanguageGuesser.is())
+ {
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMgr ( comphelper::getProcessServiceFactory() );
+ if (xMgr.is())
+ {
+ m_xLanguageGuesser = uno::Reference< linguistic2::XLanguageGuessing >(
+ xMgr->createInstance(
+ rtl::OUString::createFromAscii( "com.sun.star.linguistic2.LanguageGuessing" ) ),
+ uno::UNO_QUERY );
+ }
+ }
+ catch (uno::Exception &r)
+ {
+ (void) r;
+ DBG_ASSERT( 0, "failed to get language guessing component" );
+ }
+ }
+ return m_xLanguageGuesser;
+}
+
+} // namespace framework
+
diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx
index 427c2b4dc6d6..3d7b28697dd9 100644
--- a/framework/source/services/frame.cxx
+++ b/framework/source/services/frame.cxx
@@ -350,6 +350,15 @@ css::uno::Reference< css::lang::XComponent > SAL_CALL Frame::loadComponentFromUR
css::lang::IllegalArgumentException ,
css::uno::RuntimeException )
{
+ {
+ // If the frame is closed the call might lead to crash even with target "_blank",
+ // so the DisposedException should be thrown in this case
+ // It still looks to be too dangerous to set the transaction for the whole loading process
+ // so the guard is used in scopes to let the standard check be used
+
+ TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
+ }
+
ReadGuard aReadLock(m_aLock);
css::uno::Reference< css::frame::XComponentLoader > xThis(static_cast< css::frame::XComponentLoader* >(this), css::uno::UNO_QUERY);
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xFactory;
diff --git a/framework/source/uielement/langselectionmenucontroller.cxx b/framework/source/uielement/langselectionmenucontroller.cxx
index e7d3fad09ac1..84323b3bb7ef 100644
--- a/framework/source/uielement/langselectionmenucontroller.cxx
+++ b/framework/source/uielement/langselectionmenucontroller.cxx
@@ -79,6 +79,8 @@
#endif
#include <dispatch/uieventloghelper.hxx>
+#include "helper/mischelper.hxx"
+
//_________________________________________________________________________________________________________________
// Defines
//_________________________________________________________________________________________________________________
@@ -106,17 +108,6 @@ LanguageSelectionMenuController::LanguageSelectionMenuController( const ::com::s
PopupMenuControllerBase( xServiceManager ),
m_bShowMenu( sal_True )
{
- if (!m_xLanguageGuesser.is())
- {
- uno::Reference< lang::XMultiServiceFactory > xMgr ( comphelper::getProcessServiceFactory() );
- if (xMgr.is())
- {
- m_xLanguageGuesser = uno::Reference< linguistic2::XLanguageGuessing >(
- xMgr->createInstance(
- rtl::OUString::createFromAscii( "com.sun.star.linguistic2.LanguageGuessing" ) ),
- uno::UNO_QUERY );
- }
- }
}
LanguageSelectionMenuController::~LanguageSelectionMenuController()
@@ -301,12 +292,6 @@ void SAL_CALL LanguageSelectionMenuController::setPopupMenu( const Reference< cs
}
}
-//match ScriptType
-bool lcl_checkScriptType(sal_Int16 nScriptType,LanguageType nLang)
-{
- return 0 != (nScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage( nLang ));
-}
-
void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPopupMenu , const Mode eMode )
{
VCLXPopupMenu* pVCLPopupMenu = (VCLXPopupMenu *)VCLXMenu::GetImplementation( rPopupMenu );
@@ -358,7 +343,7 @@ void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopup
LanguageType rSystemLanguage = rAllSettings.GetLanguage();
if(rSystemLanguage!=LANGUAGE_DONTKNOW)
{
- if (lcl_checkScriptType(m_nScriptType,rSystemLanguage ))
+ if (IsScriptTypeMatchingToLanguage(m_nScriptType,rSystemLanguage ))
LangItems[::rtl::OUString(aLangTable.GetString(rSystemLanguage))]=::rtl::OUString(aLangTable.GetString(rSystemLanguage));
}
@@ -366,24 +351,25 @@ void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopup
LanguageType rUILanguage = rAllSettings.GetUILanguage();
if(rUILanguage!=LANGUAGE_DONTKNOW)
{
- if (lcl_checkScriptType(m_nScriptType, rUILanguage ))
+ if (IsScriptTypeMatchingToLanguage(m_nScriptType, rUILanguage ))
LangItems[::rtl::OUString(aLangTable.GetString(rUILanguage))]=::rtl::OUString(aLangTable.GetString(rUILanguage));
}
//4--guessed language
- if (m_xLanguageGuesser.is() && m_aGuessedText.getLength() > 0)
+ uno::Reference< linguistic2::XLanguageGuessing > xLangGuesser( m_aLangGuessHelper.GetGuesser() );
+ if (xLangGuesser.is() && m_aGuessedText.getLength() > 0)
{
- ::com::sun::star::lang::Locale aLocale(m_xLanguageGuesser->guessPrimaryLanguage( m_aGuessedText, 0, m_aGuessedText.getLength()) );
+ ::com::sun::star::lang::Locale aLocale(xLangGuesser->guessPrimaryLanguage( m_aGuessedText, 0, m_aGuessedText.getLength()) );
LanguageType nLang = MsLangId::convertLocaleToLanguageWithFallback( aLocale );
- if ((nLang != LANGUAGE_DONTKNOW) && (nLang != LANGUAGE_NONE) && (nLang != LANGUAGE_SYSTEM)
- && (lcl_checkScriptType( m_nScriptType, nLang )))
+ if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_NONE && nLang != LANGUAGE_SYSTEM
+ && IsScriptTypeMatchingToLanguage( m_nScriptType, nLang ))
LangItems[aLangTable.GetString(nLang)]=aLangTable.GetString(nLang);
}
//5--keyboard language
if(m_aKeyboardLang!=::rtl::OUString::createFromAscii(""))
{
- if (lcl_checkScriptType(m_nScriptType, aLanguageTable.GetType(m_aKeyboardLang)))
+ if (IsScriptTypeMatchingToLanguage(m_nScriptType, aLanguageTable.GetType(m_aKeyboardLang)))
LangItems[m_aKeyboardLang] = m_aKeyboardLang;
}
@@ -417,7 +403,7 @@ void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopup
if (LangItems.size()==7)
break;
const Locale& rLocale=rLocales[i];
- if(lcl_checkScriptType(m_nScriptType, aLanguageTable.GetType(rLocale.Language)))
+ if(IsScriptTypeMatchingToLanguage(m_nScriptType, aLanguageTable.GetType(rLocale.Language)))
LangItems[::rtl::OUString(rLocale.Language)]=::rtl::OUString(rLocale.Language);
}
}
diff --git a/framework/source/uielement/langselectionstatusbarcontroller.cxx b/framework/source/uielement/langselectionstatusbarcontroller.cxx
index 63bd51d27525..6eee84328315 100644
--- a/framework/source/uielement/langselectionstatusbarcontroller.cxx
+++ b/framework/source/uielement/langselectionstatusbarcontroller.cxx
@@ -75,6 +75,8 @@
#include <com/sun/star/linguistic2/XLanguageGuessing.hpp>
#include <dispatch/uieventloghelper.hxx>
+#include "helper/mischelper.hxx"
+
using namespace ::cppu;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -99,17 +101,6 @@ LangSelectionStatusbarController::LangSelectionStatusbarController( const uno::R
m_bShowMenu( sal_True ),
m_nScriptType( 7 )
{
- if (!m_xLanguageGuesser.is())
- {
- uno::Reference< lang::XMultiServiceFactory > xMgr ( comphelper::getProcessServiceFactory() );
- if (xMgr.is())
- {
- m_xLanguageGuesser = uno::Reference< linguistic2::XLanguageGuessing >(
- xMgr->createInstance(
- rtl::OUString::createFromAscii( "com.sun.star.linguistic2.LanguageGuessing" ) ),
- uno::UNO_QUERY );
- }
- }
}
// XInterface
@@ -183,12 +174,6 @@ throw (::com::sun::star::uno::RuntimeException)
return sal_False;
}
-//match ScriptType
-bool checkScriptType( sal_Int16 nScriptType, LanguageType nLang )
-{
- return 0 != ( nScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage( nLang ));
-}
-
void LangSelectionStatusbarController::LangMenu()throw (::com::sun::star::uno::RuntimeException)
{
if (!m_bShowMenu)
@@ -215,7 +200,7 @@ void LangSelectionStatusbarController::LangMenu()throw (::com::sun::star::uno::R
LanguageType rSystemLanguage = rAllSettings.GetLanguage();
if( rSystemLanguage != LANGUAGE_DONTKNOW )
{
- if ( checkScriptType( m_nScriptType, rSystemLanguage ))
+ if ( IsScriptTypeMatchingToLanguage( m_nScriptType, rSystemLanguage ))
LangItems.insert( ::rtl::OUString( aLangTable.GetString( rSystemLanguage )) );
}
@@ -223,24 +208,25 @@ void LangSelectionStatusbarController::LangMenu()throw (::com::sun::star::uno::R
LanguageType rUILanguage = rAllSettings.GetUILanguage();
if( rUILanguage != LANGUAGE_DONTKNOW )
{
- if ( checkScriptType( m_nScriptType, rUILanguage ))
+ if ( IsScriptTypeMatchingToLanguage( m_nScriptType, rUILanguage ))
LangItems.insert( ::rtl::OUString( aLangTable.GetString( rUILanguage )) );
}
//4--guessed language
- if ( m_xLanguageGuesser.is() && m_aGuessedText.getLength() > 0)
+ uno::Reference< linguistic2::XLanguageGuessing > xLangGuesser( m_aLangGuessHelper.GetGuesser() );
+ if ( xLangGuesser.is() && m_aGuessedText.getLength() > 0)
{
- ::com::sun::star::lang::Locale aLocale(m_xLanguageGuesser->guessPrimaryLanguage( m_aGuessedText, 0, m_aGuessedText.getLength()) );
+ ::com::sun::star::lang::Locale aLocale(xLangGuesser->guessPrimaryLanguage( m_aGuessedText, 0, m_aGuessedText.getLength()) );
LanguageType nLang = MsLangId::convertLocaleToLanguageWithFallback( aLocale );
- if (( nLang != LANGUAGE_DONTKNOW ) && ( nLang != LANGUAGE_NONE ) && (nLang != LANGUAGE_SYSTEM)
- && ( checkScriptType( m_nScriptType, nLang )))
+ if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_NONE && nLang != LANGUAGE_SYSTEM
+ && IsScriptTypeMatchingToLanguage( m_nScriptType, nLang ))
LangItems.insert( aLangTable.GetString( nLang ));
}
//5--keyboard language
if( m_aKeyboardLang != ::rtl::OUString::createFromAscii( "" ))
{
- if ( checkScriptType( m_nScriptType, aLanguageTable.GetType( m_aKeyboardLang )))
+ if ( IsScriptTypeMatchingToLanguage( m_nScriptType, aLanguageTable.GetType( m_aKeyboardLang )))
LangItems.insert( m_aKeyboardLang );
}
@@ -274,7 +260,7 @@ void LangSelectionStatusbarController::LangMenu()throw (::com::sun::star::uno::R
if ( LangItems.size() == 7 )
break;
const Locale& rLocale=rLocales[i];
- if( checkScriptType( m_nScriptType, aLangTable.GetType( rLocale.Language )))
+ if( IsScriptTypeMatchingToLanguage( m_nScriptType, aLangTable.GetType( rLocale.Language )))
LangItems.insert( ::rtl::OUString( rLocale.Language ) );
}
}
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index a85cee3178c3..a105f7b281a1 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -336,11 +336,21 @@ void ToolBarManager::Destroy()
delete static_cast< AddonsParams* >( m_pToolBar->GetItemData( nItemId ));
}
- /* #i99167# removed change for i93173 since there is some weird crash
+ /* #i99167# removed change for i93173 since there is some weird crash */
// #i93173# delete toolbar lazily as we can still be in one of its handlers
m_pToolBar->doLazyDelete();
- */
- delete m_pToolBar;
+
+ Link aEmpty;
+ m_pToolBar->SetSelectHdl( aEmpty );
+ m_pToolBar->SetActivateHdl( aEmpty );
+ m_pToolBar->SetDeactivateHdl( aEmpty );
+ m_pToolBar->SetClickHdl( aEmpty );
+ m_pToolBar->SetDropdownClickHdl( aEmpty );
+ m_pToolBar->SetDoubleClickHdl( aEmpty );
+ m_pToolBar->SetStateChangedHdl( aEmpty );
+ m_pToolBar->SetDataChangedHdl( aEmpty );
+
+// delete m_pToolBar;
m_pToolBar = 0;
}
diff --git a/framework/util/makefile.mk b/framework/util/makefile.mk
index cb788809b0d9..94409ace992e 100644
--- a/framework/util/makefile.mk
+++ b/framework/util/makefile.mk
@@ -272,6 +272,7 @@ SHL4OBJS= \
$(SLO)$/menubarwrapper.obj \
$(SLO)$/menudispatcher.obj \
$(SLO)$/menumanager.obj \
+ $(SLO)$/mischelper.obj \
$(SLO)$/moduleacceleratorconfiguration.obj \
$(SLO)$/moduleimagemanager.obj \
$(SLO)$/modulemanager.obj \
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index f1df871618f8..bb63e9bb8c8b 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -191,7 +191,7 @@ static sal_Int32 lcl_SkipWhiteSpaces( const OUString &rText, sal_Int32 nStartPos
static sal_Int32 lcl_BacktraceWhiteSpaces( const OUString &rText, sal_Int32 nStartPos )
{
- // note having nStartPos point right behind the string is OK since that one
+ // note: having nStartPos point right behind the string is OK since that one
// is a correct end-of-sentence position to be returned from a grammar checker...
const sal_Int32 nLen = rText.getLength();
@@ -215,14 +215,16 @@ static sal_Int32 lcl_BacktraceWhiteSpaces( const OUString &rText, sal_Int32 nSta
sal_Int32 nPosBefore = nStartPos - 1;
const sal_Unicode *pStart = rText.getStr();
if (0 <= nPosBefore && nPosBefore < nLen && lcl_IsWhiteSpace( pStart[ nPosBefore ] ))
- nStartPos = nPosBefore;
- if (0 <= nStartPos && nStartPos < nLen)
{
- const sal_Unicode *pText = rText.getStr() + nStartPos;
- while (pText > pStart && lcl_IsWhiteSpace( *pText ))
- --pText;
- // now add 1 since we wnat to point to the first char after the last char in the sentence...
- nRes = pText - pStart + 1;
+ nStartPos = nPosBefore;
+ if (0 <= nStartPos && nStartPos < nLen)
+ {
+ const sal_Unicode *pText = rText.getStr() + nStartPos;
+ while (pText > pStart && lcl_IsWhiteSpace( *pText ))
+ --pText;
+ // now add 1 since we want to point to the first char after the last char in the sentence...
+ nRes = pText - pStart + 1;
+ }
}
DBG_ASSERT( 0 <= nRes && nRes <= nLen, "lcl_BacktraceWhiteSpaces return value out of range" );
@@ -577,6 +579,7 @@ void GrammarCheckingIterator::DequeueAndCheck()
sal_Int32 nStartPos = aFPEntryItem.m_nStartIndex;
sal_Int32 nSuggestedEnd = GetSuggestedEndOfSentence( aCurTxt, nStartPos, aCurLocale );
+ DBG_ASSERT( nSuggestedEnd > nStartPos, "nSuggestedEndOfSentencePos calculation failed?" );
linguistic2::ProofreadingResult aRes;
@@ -586,6 +589,15 @@ void GrammarCheckingIterator::DequeueAndCheck()
aGuard.clear();
uno::Sequence< beans::PropertyValue > aEmptyProps;
aRes = xGC->doProofreading( aCurDocId, aCurTxt, aCurLocale, nStartPos, nSuggestedEnd, aEmptyProps );
+
+ //!! work-around to prevent looping if the grammar checker
+ //!! failed to properly identify the sentence end
+ if (aRes.nBehindEndOfSentencePosition <= nStartPos)
+ {
+ DBG_ASSERT( 0, "!! Grammarchecker failed to provide end of sentence !!" );
+ aRes.nBehindEndOfSentencePosition = nSuggestedEnd;
+ }
+
aRes.xFlatParagraph = xFlatPara;
aRes.nStartOfSentencePosition = nStartPos;
}
@@ -718,6 +730,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
::osl::ClearableGuard< ::osl::Mutex > aGuard( MyMutex::get() );
aDocId = GetOrCreateDocId( xComponent );
nSuggestedEndOfSentencePos = GetSuggestedEndOfSentence( rText, nStartPos, aCurLocale );
+ DBG_ASSERT( nSuggestedEndOfSentencePos > nStartPos, "nSuggestedEndOfSentencePos calculation failed?" );
xGC = GetGrammarChecker( aCurLocale );
}
@@ -727,6 +740,15 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
{
uno::Sequence< beans::PropertyValue > aEmptyProps;
aTmpRes = xGC->doProofreading( aDocId, rText, aCurLocale, nStartPos, nSuggestedEndOfSentencePos, aEmptyProps );
+
+ //!! work-around to prevent looping if the grammar checker
+ //!! failed to properly identify the sentence end
+ if (aTmpRes.nBehindEndOfSentencePosition <= nStartPos)
+ {
+ DBG_ASSERT( 0, "!! Grammarchecker failed to provide end of sentence !!" );
+ aTmpRes.nBehindEndOfSentencePosition = nSuggestedEndOfSentencePos;
+ }
+
aTmpRes.xFlatParagraph = xFlatPara;
aTmpRes.nStartOfSentencePosition = nStartPos;
nEndPos = aTmpRes.nBehindEndOfSentencePosition;
diff --git a/officecfg/prj/build.lst b/officecfg/prj/build.lst
index 88495a6e722b..dba837c643a7 100644
--- a/officecfg/prj/build.lst
+++ b/officecfg/prj/build.lst
@@ -1,17 +1,18 @@
-oc officecfg : soltools solenv transex3 LIBXSLT:libxslt NULL
-oc officecfg usr30073 - none NULL
-oc officecfg usr1 - all oc_mkout NULL
-oc officecfg\registry\schema nmake - all oc_reg_schema NULL
-oc officecfg\registry nmake - all oc_reg NULL
-oc officecfg\registry\schema\org\openoffice nmake - all oc_reg_schema_ooo NULL
-oc officecfg\registry\schema\org\openoffice\Office nmake - all oc_reg_schema_ooo_office NULL
-oc officecfg\registry\schema\org\openoffice\Office\UI nmake - all oc_reg_schema_ooo_office_ui NULL
-oc officecfg\registry\schema\org\openoffice\Office\OOoImprovement nmake - all oc_reg_schema_ooo_office_oooimprovement NULL
-oc officecfg\registry\schema\org\openoffice\TypeDetection nmake - all oc_reg_schema_ooo_td NULL
-oc officecfg\registry\schema\org\openoffice\ucb nmake - all oc_reg_schema_ooo_ucb NULL
-oc officecfg\registry\data\org\openoffice nmake - all oc_reg_data_ooo oc_reg NULL
-oc officecfg\registry\data\org\openoffice\Office nmake - all oc_reg_data_ooo_office oc_reg NULL
-oc officecfg\registry\data\org\openoffice\Office\UI nmake - all oc_reg_data_ooo_office_ui oc_reg NULL
-oc officecfg\registry\data\org\openoffice\TypeDetection nmake - all oc_reg_data_ooo_td oc_reg NULL
-oc officecfg\registry\data\org\openoffice\ucb nmake - all oc_reg_data_ooo_ucb oc_reg NULL
-oc officecfg\util nmake - all oc_util oc_reg_schema oc_reg_schema_ooo oc_reg_schema_ooo_office oc_reg_schema_ooo_office_ui oc_reg_schema_ooo_office_oooimprovement oc_reg_schema_ooo_td oc_reg_schema_ooo_ucb oc_reg_data_ooo oc_reg_data_ooo_office oc_reg_data_ooo_office_ui oc_reg_data_ooo_td oc_reg_data_ooo_ucb NULL
+oc officecfg : l10n soltools solenv LIBXSLT:libxslt NULL
+oc officecfg usr30073 - none NULL
+oc officecfg usr1 - all oc_mkout NULL
+oc officecfg\registry\schema nmake - all oc_reg_schema NULL
+oc officecfg\registry nmake - all oc_reg NULL
+oc officecfg\registry\schema\org\openoffice nmake - all oc_reg_schema_ooo NULL
+oc officecfg\registry\schema\org\openoffice\Office nmake - all oc_reg_schema_ooo_office NULL
+oc officecfg\registry\schema\org\openoffice\Office\UI nmake - all oc_reg_schema_ooo_office_ui NULL
+oc officecfg\registry\schema\org\openoffice\Office\DataAccess nmake - all oc_reg_schema_ooo_office_dataaccess NULL
+oc officecfg\registry\schema\org\openoffice\Office\OOoImprovement nmake - all oc_reg_schema_ooo_office_oooimprovement NULL
+oc officecfg\registry\schema\org\openoffice\TypeDetection nmake - all oc_reg_schema_ooo_td NULL
+oc officecfg\registry\schema\org\openoffice\ucb nmake - all oc_reg_schema_ooo_ucb NULL
+oc officecfg\registry\data\org\openoffice nmake - all oc_reg_data_ooo oc_reg NULL
+oc officecfg\registry\data\org\openoffice\Office nmake - all oc_reg_data_ooo_office oc_reg NULL
+oc officecfg\registry\data\org\openoffice\Office\UI nmake - all oc_reg_data_ooo_office_ui oc_reg NULL
+oc officecfg\registry\data\org\openoffice\TypeDetection nmake - all oc_reg_data_ooo_td oc_reg NULL
+oc officecfg\registry\data\org\openoffice\ucb nmake - all oc_reg_data_ooo_ucb oc_reg NULL
+oc officecfg\util nmake - all oc_util oc_reg_schema oc_reg_schema_ooo oc_reg_schema_ooo_office oc_reg_schema_ooo_office_ui oc_reg_schema_ooo_office_dataaccess oc_reg_schema_ooo_office_oooimprovement oc_reg_schema_ooo_td oc_reg_schema_ooo_ucb oc_reg_data_ooo oc_reg_data_ooo_office oc_reg_data_ooo_office_ui oc_reg_data_ooo_td oc_reg_data_ooo_ucb NULL
diff --git a/officecfg/prj/d.lst b/officecfg/prj/d.lst
index d36f18660611..66ba41abd60e 100644
--- a/officecfg/prj/d.lst
+++ b/officecfg/prj/d.lst
@@ -4,6 +4,7 @@ mkdir: %_DEST%\xml%_EXT%\registry\schema\org
mkdir: %_DEST%\xml%_EXT%\registry\schema\org\openoffice
mkdir: %_DEST%\xml%_EXT%\registry\schema\org\openoffice\Office
mkdir: %_DEST%\xml%_EXT%\registry\schema\org\openoffice\Office\UI
+mkdir: %_DEST%\xml%_EXT%\registry\schema\org\openoffice\Office\DataAccess
mkdir: %_DEST%\xml%_EXT%\registry\schema\org\openoffice\Office\OOoImprovement
mkdir: %_DEST%\xml%_EXT%\registry\schema\org\openoffice\ucb
mkdir: %_DEST%\xml%_EXT%\registry\schema\org\openoffice\TypeDetection
@@ -11,6 +12,7 @@ mkdir: %_DEST%\xml%_EXT%\registry\schema\org\openoffice\TypeDetection
..\%__SRC%\misc\registry\schema\org\openoffice\*.xcs %_DEST%\xml%_EXT%\registry\schema\org\openoffice
..\%__SRC%\misc\registry\schema\org\openoffice\Office\*.xcs %_DEST%\xml%_EXT%\registry\schema\org\openoffice\Office
..\%__SRC%\misc\registry\schema\org\openoffice\Office\UI\*.xcs %_DEST%\xml%_EXT%\registry\schema\org\openoffice\Office\UI
+..\%__SRC%\misc\registry\schema\org\openoffice\Office\DataAccess\*.xcs %_DEST%\xml%_EXT%\registry\schema\org\openoffice\Office\DataAccess
..\%__SRC%\misc\registry\schema\org\openoffice\Office\OOoImprovement\*.xcs %_DEST%\xml%_EXT%\registry\schema\org\openoffice\Office\OOoImprovement
..\%__SRC%\misc\registry\schema\org\openoffice\ucb\*.xcs %_DEST%\xml%_EXT%\registry\schema\org\openoffice\ucb
..\%__SRC%\misc\registry\schema\org\openoffice\TypeDetection\*.xcs %_DEST%\xml%_EXT%\registry\schema\org\openoffice\TypeDetection
@@ -20,6 +22,7 @@ mkdir: %_DEST%\xml%_EXT%\registry\data\org
mkdir: %_DEST%\xml%_EXT%\registry\data\org\openoffice
mkdir: %_DEST%\xml%_EXT%\registry\data\org\openoffice\Office
mkdir: %_DEST%\xml%_EXT%\registry\data\org\openoffice\Office\UI
+mkdir: %_DEST%\xml%_EXT%\registry\data\org\openoffice\Office\DataAccess
mkdir: %_DEST%\xml%_EXT%\registry\data\org\openoffice\Office\OOoImprovement
mkdir: %_DEST%\xml%_EXT%\registry\data\org\openoffice\ucb
mkdir: %_DEST%\xml%_EXT%\registry\data\org\openoffice\TypeDetection
@@ -32,6 +35,7 @@ mkdir: %_DEST%\xml%_EXT%\registry\data\org\openoffice\TypeDetection
..\%__SRC%\misc\registry\data\org\openoffice\*.xcu %_DEST%\xml%_EXT%\registry\data\org\openoffice
..\%__SRC%\misc\registry\data\org\openoffice\Office\*.xcu %_DEST%\xml%_EXT%\registry\data\org\openoffice\Office
..\%__SRC%\misc\registry\data\org\openoffice\Office\UI\*.xcu %_DEST%\xml%_EXT%\registry\data\org\openoffice\Office\UI
+..\%__SRC%\misc\registry\data\org\openoffice\Office\DataAccess\*.xcu %_DEST%\xml%_EXT%\registry\data\org\openoffice\Office\DataAccess
..\%__SRC%\misc\registry\data\org\openoffice\ucb\*.xcu %_DEST%\xml%_EXT%\registry\data\org\openoffice\ucb
..\%__SRC%\misc\registry\data\org\openoffice\TypeDetection\*.xcu %_DEST%\xml%_EXT%\registry\data\org\openoffice\TypeDetection
diff --git a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
index 31f69d80a5f0..26143aa76407 100644
--- a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
@@ -2852,6 +2852,11 @@
<value xml:lang="de">.uno:Underline</value>
</prop>
</node>
+ <node oor:name="V_SHIFT_MOD1_MOD2" oor:op="replace">
+ <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value>
+ <value xml:lang="en-US">.uno:PasteUnformatted</value>
+ </prop>
+ </node>
<node oor:name="V_SHIFT_MOD1" oor:op="replace">
<prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value>
<value xml:lang="en-US">.uno:PasteSpecial</value>
@@ -4683,6 +4688,11 @@
<value xml:lang="de">.uno:Underline</value>
</prop>
</node>
+ <node oor:name="V_SHIFT_MOD1_MOD2" oor:op="replace">
+ <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value>
+ <value xml:lang="en-US">.uno:PasteUnformatted</value>
+ </prop>
+ </node>
<node oor:name="V_SHIFT_MOD1" oor:op="replace">
<prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value>
<value xml:lang="en-US">.uno:PasteSpecial</value>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
index 46abbb8aa3d0..104fb106836c 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
@@ -1925,7 +1925,12 @@
<value>1</value>
</prop>
</node>
- <node oor:name=".uno:InsertColumns" oor:op="replace">
+ <node oor:name=".uno:InsertRowDialog" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">~Rows...</value>
+ </prop>
+ </node>
+ <node oor:name=".uno:InsertColumns" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="de">Spalte einfügen</value>
<value xml:lang="en-US">Insert Column</value>
@@ -1934,7 +1939,12 @@
<value>1</value>
</prop>
</node>
- <node oor:name=".uno:DeleteRows" oor:op="replace">
+ <node oor:name=".uno:InsertColumnDialog" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">~Columns...</value>
+ </prop>
+ </node>
+ <node oor:name=".uno:DeleteRows" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="de">Zeile löschen</value>
<value xml:lang="en-US">Delete Row</value>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index 9fd1976adc08..55365975b790 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -1039,6 +1039,11 @@
<value>1</value>
</prop>
</node>
+ <node oor:name=".uno:PasteUnformatted" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Paste Unformatted Text</value>
+ </prop>
+ </node>
<node oor:name=".uno:PasteSpecial" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Paste ~Special...</value>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index f71c6dcd7f2c..a9f0b854198e 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -1455,6 +1455,18 @@ Dymamic border coloring means that when the mouse is hovered over a control, and
<author>MBA</author>
<desc>Contains the current and default path settings used by the Office.</desc>
</info>
+ <group oor:name="Info">
+ <info>
+ <author>CD</author>
+ <desc>Contains various properties information purpose only.</desc>
+ </info>
+ <prop oor:name="WorkPathChanged" oor:type="xs:boolean">
+ <info>
+ <desc>A flag which is set by the tools options dialog whenever a user changed the work path.</desc>
+ </info>
+ <value>true</value>
+ </prop>
+ </group>
<group oor:name="Current">
<info>
<author>MBA</author>
@@ -2334,6 +2346,13 @@ Dymamic border coloring means that when the mouse is hovered over a control, and
</info>
<value>true</value>
</prop>
+ <prop oor:name="ShowOfficeUpdateDialog" oor:type="xs:boolean">
+ <info>
+ <author>MAV</author>
+ <desc>Specifies whether the office update dialog should be shown in case the loaded document has newer ODF version than the maximal supported one.</desc>
+ </info>
+ <value>true</value>
+ </prop>
</group>
<group oor:name="Security">
<info>
@@ -5624,11 +5643,17 @@ Dymamic border coloring means that when the mouse is hovered over a control, and
<prop oor:name="UseDocumentSystemFileLocking" oor:type="xs:boolean">
<info>
<author>MAV</author>
- <desc>Allows to specify whether the OOo document file locking mechanics should use the system file locking additionaly.</desc>
+ <desc>Allows to specify whether the OOo document file locking mechanics should use the system file locking.</desc>
+ </info>
+ <value>true</value>
+ </prop>
+ <prop oor:name="UseDocumentOOoLockFile" oor:type="xs:boolean">
+ <info>
+ <author>MAV</author>
+ <desc>Allows to specify whether the OOo document file locking mechanics should use the lock file for locking.</desc>
</info>
<value>true</value>
</prop>
-
<prop oor:name="UseSystemPrintDialog" oor:type="xs:boolean">
<info>
<author>PL</author>
diff --git a/officecfg/registry/schema/org/openoffice/Office/DataAccess/Drivers.xcs b/officecfg/registry/schema/org/openoffice/Office/DataAccess/Drivers.xcs
new file mode 100755
index 000000000000..d0b54e71498b
--- /dev/null
+++ b/officecfg/registry/schema/org/openoffice/Office/DataAccess/Drivers.xcs
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * 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: DataAccess.xcs,v $
+ * $Revision: 1.43 $
+ *
+ * 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.
+ *
+ ************************************************************************ -->
+<!DOCTYPE oor:component-schema SYSTEM "../../../../../component-schema.dtd">
+<oor:component-schema xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xml:lang="en-US">
+ <info>
+ <desc>Contains the installed OpenOffice.org Base database drivers.</desc>
+ </info>
+ <templates>
+ <group oor:name="Property">
+ <info>
+ <desc>Describes a property of a driver.</desc>
+ </info>
+ <prop oor:name="Value" oor:type="oor:any" oor:localized="true">
+ <info>
+ <desc>Describes the value.</desc>
+ </info>
+ </prop>
+ </group>
+ <group oor:name="Feature">
+ <info>
+ <desc>Describes a feature a driver supports.</desc>
+ </info>
+ <prop oor:name="Value" oor:type="xs:boolean" oor:localized="true">
+ <info>
+ <desc>The feature value.</desc>
+ </info>
+ </prop>
+ </group>
+ <group oor:name="URLPattern">
+ <info>
+ <desc>Specifies a database driver.</desc>
+ </info>
+ <prop oor:name="ParentURLPattern" oor:type="xs:string">
+ <info>
+ <desc>Specifies the URL pattern of the parent which settings should be used if not present.</desc>
+ </info>
+ </prop>
+ <prop oor:name="Driver" oor:type="xs:string">
+ <info>
+ <desc>Specifies the factory name of the database driver.</desc>
+ </info>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string" oor:localized="true">
+ <info>
+ <desc>Specifies the UI name of the database driver.</desc>
+ </info>
+ </prop>
+ <set oor:name="Properties" oor:node-type="Property">
+ <info>
+ <desc>Defines a list of all properties which are different from default.</desc>
+ </info>
+ </set>
+ <set oor:name="Features" oor:node-type="Feature">
+ <info>
+ <desc>Defines a list of all properties which are different from default.</desc>
+ </info>
+ </set>
+ <set oor:name="MetaData" oor:node-type="Property">
+ <info>
+ <desc>Defines a list of all meta data properties which the database application should supports.</desc>
+ </info>
+ </set>
+ </group>
+ </templates>
+ <component>
+ <set oor:name="Installed" oor:node-type="URLPattern">
+ <info>
+ <desc>Contains a list of URLs supported by installed database drivers.</desc>
+ </info>
+ </set>
+ </component>
+</oor:component-schema>
diff --git a/officecfg/registry/schema/org/openoffice/Office/DataAccess/makefile.mk b/officecfg/registry/schema/org/openoffice/Office/DataAccess/makefile.mk
new file mode 100755
index 000000000000..906bbe5108e9
--- /dev/null
+++ b/officecfg/registry/schema/org/openoffice/Office/DataAccess/makefile.mk
@@ -0,0 +1,46 @@
+#*************************************************************************
+#
+# 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: $
+#
+# $Revision: $
+#
+# 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=officecfg
+TARGET=schema_ooODataAccess
+PACKAGE=org.openoffice.Office.DataAccess
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Targets ------------------------------------------------------
+
+XCSFILES= \
+ Drivers.xcs
+
+.INCLUDE : target.mk
+
diff --git a/officecfg/registry/schema/org/openoffice/Office/ExtendedColorScheme.xcs b/officecfg/registry/schema/org/openoffice/Office/ExtendedColorScheme.xcs
index 4f44ec04de5c..7105c0be5d1d 100644
--- a/officecfg/registry/schema/org/openoffice/Office/ExtendedColorScheme.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/ExtendedColorScheme.xcs
@@ -64,7 +64,7 @@
<info>
<desc>Specifies the UI name for the color or group name of the component.</desc>
</info>
- <prop oor:name="DisplayName" oor:type="xs:string">
+ <prop oor:name="DisplayName" oor:type="xs:string" oor:localized="true">
<info>
<desc>Specifies the localized name that is used when presenting the entry to the user.</desc>
</info>
@@ -74,7 +74,7 @@
<info>
<desc>Specifies the ui strings for the component.</desc>
</info>
- <prop oor:name="DisplayName" oor:type="xs:string">
+ <prop oor:name="DisplayName" oor:type="xs:string" oor:localized="true">
<info>
<desc>Specifies the localized name that is used when presenting the entry to the user.</desc>
</info>
diff --git a/officecfg/registry/schema/org/openoffice/Setup.xcs b/officecfg/registry/schema/org/openoffice/Setup.xcs
index 7572879528da..ad6b4d9ce425 100644
--- a/officecfg/registry/schema/org/openoffice/Setup.xcs
+++ b/officecfg/registry/schema/org/openoffice/Setup.xcs
@@ -352,6 +352,13 @@
</info>
<value>false</value>
</prop>
+ <prop oor:name="LastCompatibilityCheckID" oor:type="xs:string">
+ <info>
+ <author>DV</author>
+ <desc>The build ID of the office. On startup the office will compare this ID with the current build id to decide if the extensions dependencies need to be checked.</desc>
+ </info>
+ <value>not checked</value>
+ </prop>
<set oor:name="Factories" oor:node-type="Factory">
<info>
<author>AS</author>
diff --git a/readlicense_oo/prj/build.lst b/readlicense_oo/prj/build.lst
index e302b5d8a81b..987672db4ebe 100644
--- a/readlicense_oo/prj/build.lst
+++ b/readlicense_oo/prj/build.lst
@@ -1,4 +1,4 @@
-ro readlicense_oo : solenv transex3 LIBXSLT:libxslt NULL
+ro readlicense_oo : l10n solenv LIBXSLT:libxslt NULL
ro readlicense_oo usr1 - all ro_root NULL
ro readlicense_oo\docs\readme nmake - all ro_readme NULL
ro readlicense_oo\html nmake - all ro_html NULL
diff --git a/sfx2/inc/sfx2/DocumentMetadataAccess.hxx b/sfx2/inc/sfx2/DocumentMetadataAccess.hxx
new file mode 100644
index 000000000000..1f0d3d38e44e
--- /dev/null
+++ b/sfx2/inc/sfx2/DocumentMetadataAccess.hxx
@@ -0,0 +1,218 @@
+/*************************************************************************
+ *
+ * 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: DocumentMetadataAccess.hxx,v $
+ * $Revision: 1.1.2.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 _SFX_DOCUMENTMETADATAACCESS_HXX_
+#define _SFX_DOCUMENTMETADATAACCESS_HXX_
+
+#include <sal/config.h>
+
+#include <sfx2/dllapi.h>
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/rdf/XDocumentMetadataAccess.hpp>
+#include <com/sun/star/rdf/XRepositorySupplier.hpp>
+
+#include <cppuhelper/implbase1.hxx>
+
+#include <boost/utility.hpp>
+
+#include <memory>
+
+
+/** Implementation of the interface com.sun.star.rdf.XDocumentMetadataAccess
+
+ This is not a service only because it needs some kind of XML ID registry
+ from the document, and i do not like defining an API for that.
+ Also, the implementation does _no_ locking, so make sure access is
+ protected externally.
+
+ @author mst
+ */
+
+namespace com { namespace sun { namespace star { namespace embed {
+ class XStorage;
+} } } }
+
+namespace sfx2 {
+
+
+/** create a base URI for loading metadata from an ODF (sub)document.
+
+ @param i_xContext component context
+ @param i_xStorage storage for the document; FileSystemStorage is allowed
+ @param i_rPkgURI the URI for the package
+ @param i_rSubDocument (optional) path of the subdocument in package
+
+ @return a base URI suitable for XDocumentMetadataAccess::loadFromStorage
+ */
+::com::sun::star::uno::Reference< ::com::sun::star::rdf::XURI> SFX2_DLLPUBLIC
+createBaseURI(
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>
+ const & i_xContext,
+ ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage>
+ const & i_xStorage,
+ ::rtl::OUString const & i_rPkgURI,
+ ::rtl::OUString const & i_rSubDocument = ::rtl::OUString());
+
+
+class IXmlIdRegistrySupplier;
+struct DocumentMetadataAccess_Impl;
+
+
+class SFX2_DLLPUBLIC DocumentMetadataAccess :
+ private boost::noncopyable,
+ public ::cppu::WeakImplHelper1<
+ ::com::sun::star::rdf::XDocumentMetadataAccess>
+{
+public:
+ explicit DocumentMetadataAccess(::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & i_xContext,
+ IXmlIdRegistrySupplier const & i_rRegistrySupplier,
+ ::rtl::OUString const & i_rBaseURI);
+ // N.B.: in contrast to previous, this constructor does _not_ initialize!
+ // caller must immediately call loadFromStorage/Medium!
+ explicit DocumentMetadataAccess(::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & i_xContext,
+ IXmlIdRegistrySupplier const & i_rRegistrySupplier);
+ virtual ~DocumentMetadataAccess();
+
+ // ::com::sun::star::rdf::XNode:
+ virtual ::rtl::OUString SAL_CALL getStringValue()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::rdf::XURI:
+ virtual ::rtl::OUString SAL_CALL getNamespace()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getLocalName()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::rdf::XRepositorySupplier:
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XRepository > SAL_CALL getRDFRepository()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::rdf::XDocumentMetadataAccess:
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XMetadatable > SAL_CALL
+ getElementByMetadataReference(
+ const ::com::sun::star::beans::StringPair & i_rReference)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XMetadatable > SAL_CALL
+ getElementByURI(const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XURI > & i_xURI)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XURI > > SAL_CALL getMetadataGraphsWithType(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XURI > & i_xType)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XURI> SAL_CALL
+ addMetadataFile(const ::rtl::OUString & i_rFileName,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XURI >
+ > & i_rTypes)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::ElementExistException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XURI> SAL_CALL
+ importMetadataFile(::sal_Int16 i_Format,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream > & i_xInStream,
+ const ::rtl::OUString & i_rFileName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XURI > & i_xBaseURI,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XURI >
+ > & i_rTypes)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::datatransfer::UnsupportedFlavorException,
+ ::com::sun::star::container::ElementExistException,
+ ::com::sun::star::rdf::ParseException,
+ ::com::sun::star::io::IOException);
+ virtual void SAL_CALL removeMetadataFile(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XURI > & i_xGraphName)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException);
+ virtual void SAL_CALL addContentOrStylesFile(
+ const ::rtl::OUString & i_rFileName)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::ElementExistException);
+ virtual void SAL_CALL removeContentOrStylesFile(
+ const ::rtl::OUString & i_rFileName)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException);
+
+ virtual void SAL_CALL loadMetadataFromStorage(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::embed::XStorage > & i_xStorage,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XURI > & i_xBaseURI,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::task::XInteractionHandler> & i_xHandler)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException);
+ virtual void SAL_CALL storeMetadataToStorage(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::embed::XStorage > & i_xStorage)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException);
+ virtual void SAL_CALL loadMetadataFromMedium(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > & i_rMedium)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException);
+ virtual void SAL_CALL storeMetadataToMedium(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > & i_rMedium)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException);
+
+private:
+ std::auto_ptr<DocumentMetadataAccess_Impl> m_pImpl;
+};
+
+} // namespace sfx2
+
+#endif // _SFX_DOCUMENTMETADATAACCESS_HXX_
+
diff --git a/sfx2/inc/sfx2/Metadatable.hxx b/sfx2/inc/sfx2/Metadatable.hxx
new file mode 100644
index 000000000000..c190abd0471b
--- /dev/null
+++ b/sfx2/inc/sfx2/Metadatable.hxx
@@ -0,0 +1,190 @@
+/*************************************************************************
+ *
+ * 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: SwMetadatable.hxx,v $
+ * $Revision: 1.1.2.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 METADATABLE_HXX
+#define METADATABLE_HXX
+
+#include <sal/config.h>
+
+#include <sfx2/dllapi.h>
+
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/rdf/XMetadatable.hpp>
+
+#include <boost/utility.hpp>
+#include <boost/shared_ptr.hpp>
+
+
+namespace com { namespace sun { namespace star {
+ namespace frame { class XModel; }
+} } }
+
+namespace sfx2 {
+ class IXmlIdRegistry;
+}
+
+namespace sfx2 {
+
+class XmlIdRegistry;
+class MetadatableUndo;
+
+
+// XML ID handling ---------------------------------------------------
+
+
+/// create a sfx2::XmlIdRegistryDocument or a sfx2::XmlIdRegistryClipboard
+SFX2_DLLPUBLIC ::sfx2::IXmlIdRegistry *
+createXmlIdRegistry(const bool i_DocIsClipboard);
+
+
+/** base class for core objects that may have xml:id.
+
+ <p>The interface of this class consists of 3 parts:
+ <ul><li>implementations that are used by the <type>MetadatableMixin</type>
+ below</li>
+ <li>hooks to be called by the sw core whenever actions that are
+ relevant to the uniqueness of xml:ids are taken (copying,
+ splitting, merging, deletion, undo, etc.)</li>
+ <li>abstract methods that are called by the implementation of the
+ previous hooks</li></ul>
+ </p>
+ */
+class SFX2_DLLPUBLIC Metadatable : private boost::noncopyable
+{
+
+public:
+ Metadatable() : m_pReg(0) {}
+
+ // destructor calls RemoveMetadataReference
+ virtual ~Metadatable();
+
+ // for MetadatableMixin ----------------------------------------------
+
+ ::com::sun::star::beans::StringPair GetMetadataReference() const;
+ void SetMetadataReference(
+ const ::com::sun::star::beans::StringPair & i_rReference);
+ void EnsureMetadataReference();
+
+ // hooks -------------------------------------------------------------
+
+ // called from dtor!
+ void RemoveMetadataReference();
+
+ /** register this as a copy of i_rSource */
+ void RegisterAsCopyOf(Metadatable const & i_rSource,
+ const bool i_bCopyPrecedesSource = false);
+
+ /** create an Undo Metadatable, which remembers this' reference */
+ ::boost::shared_ptr<MetadatableUndo> CreateUndo(
+ const bool i_isDelete = false);
+
+ /** restore this from Undo Metadatable */
+ void RestoreMetadata(::boost::shared_ptr<MetadatableUndo> const& i_pUndo);
+
+ /** merge this and i_rOther into this */
+ void JoinMetadatable(Metadatable const & i_rOther,
+ const bool i_isMergedEmpty, const bool i_isOtherEmpty);
+
+ // abstract methods --------------------------------------------------
+
+ /** get the registry from the SwDoc */
+ virtual ::sfx2::IXmlIdRegistry& GetRegistry() = 0;
+
+ /** is this in a clipboard document? */
+ virtual bool IsInClipboard() const = 0;
+
+ /** is this in undo array? */
+ virtual bool IsInUndo() const = 0;
+
+ /** which stream is this in? true: content.xml; false: styles.xml */
+ virtual bool IsInContent() const = 0;
+
+ /** create XMetadatable from this.
+ note: if IsInUndo or IsInClipboard return true,
+ MakeUnoObject <em>must not</em> be called!
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XMetadatable > MakeUnoObject() = 0;
+
+private:
+ friend class MetadatableClipboard;
+ friend class MetadatableUndo;
+
+ // note that Reg may be a XmlIdRegistryDocument or a XmlIdRegistryClipboard
+ XmlIdRegistry* m_pReg; // null => no XmlId
+};
+
+
+/** base class for UNO objects that implement <type>XMetadatable</type>.
+
+ <p>An instance of this base class is associated with an instance of
+ <type>Metadatable</type>.</p>
+ */
+class SFX2_DLLPUBLIC MetadatableMixin :
+ public ::cppu::WeakImplHelper1<
+ ::com::sun::star::rdf::XMetadatable>
+{
+
+public:
+ MetadatableMixin() {};
+
+ virtual ~MetadatableMixin() {}
+
+ // ::com::sun::star::rdf::XNode:
+ virtual ::rtl::OUString SAL_CALL getStringValue()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::rdf::XURI:
+ virtual ::rtl::OUString SAL_CALL getLocalName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getNamespace()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::rdf::XMetadatable:
+ virtual ::com::sun::star::beans::StringPair SAL_CALL getMetadataReference()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMetadataReference(
+ const ::com::sun::star::beans::StringPair & i_rReference)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException);
+ virtual void SAL_CALL ensureMetadataReference()
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ /// get the core object corresponding to this UNO object.
+ virtual Metadatable * GetCoreObject() = 0;
+ /// get the <type>XModel</type> for the document
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
+ GetModel() = 0;
+
+};
+
+} // namespace sfx2
+
+#endif // METADATABLE_HXX
diff --git a/sfx2/inc/sfx2/XmlIdRegistry.hxx b/sfx2/inc/sfx2/XmlIdRegistry.hxx
new file mode 100644
index 000000000000..0ae6fbb75193
--- /dev/null
+++ b/sfx2/inc/sfx2/XmlIdRegistry.hxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * 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: XmlIdRegistry.hxx,v $
+ * $Revision: 1.1.2.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 _SFX_XMLIDREGISTRY_HXX_
+#define _SFX_XMLIDREGISTRY_HXX_
+
+#include <sal/config.h>
+
+#include <sfx2/dllapi.h>
+
+#include <com/sun/star/beans/StringPair.hpp>
+
+
+namespace com { namespace sun { namespace star { namespace rdf {
+ class XMetadatable;
+} } } }
+
+namespace sfx2 {
+
+// XML ID utilities --------------------------------------------------
+
+/** is i_rIdref a valid NCName ? */
+bool SFX2_DLLPUBLIC isValidNCName(::rtl::OUString const & i_rIdref);
+
+extern inline bool
+isValidXmlId(::rtl::OUString const & i_rStreamName,
+ ::rtl::OUString const & i_rIdref)
+{
+ return isValidNCName(i_rIdref) &&
+ (i_rStreamName.equalsAscii("content.xml") ||
+ i_rStreamName.equalsAscii("styles.xml"));
+}
+
+
+// XML ID handling ---------------------------------------------------
+
+/** interface for getElementByMetadataReference;
+ for use by sfx2::DocumentMetadataAccess
+ */
+class SFX2_DLLPUBLIC IXmlIdRegistry
+{
+
+public:
+ virtual ~IXmlIdRegistry() { }
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XMetadatable > SAL_CALL
+ GetElementByMetadataReference(
+ const ::com::sun::star::beans::StringPair & i_rXmlId) const = 0;
+
+};
+
+/** supplier interface for the registry.
+
+ This indirection is unfortunately necessary, because the SwDocShell
+ is not always connected to a SwDoc, so we cannot guarantee that a
+ registry given to a SfxBaseModel/DocumentMetadataAccess remains valid;
+ it has to be retrieved from this supplier interface on access.
+ */
+class SFX2_DLLPUBLIC IXmlIdRegistrySupplier
+{
+
+public:
+ virtual ~IXmlIdRegistrySupplier() { }
+
+ /** override this if you have a XmlIdRegistry. */
+ virtual const IXmlIdRegistry* GetXmlIdRegistry() const { return 0; }
+
+};
+
+} // namespace sfx2
+
+#endif // _SFX_XMLIDREGISTRY_HXX_
+
diff --git a/sfx2/inc/sfx2/app.hxx b/sfx2/inc/sfx2/app.hxx
index ceac3c18ba5e..99deee0c97a3 100644
--- a/sfx2/inc/sfx2/app.hxx
+++ b/sfx2/inc/sfx2/app.hxx
@@ -262,6 +262,7 @@ public:
BOOL bActivate,
BOOL bForbidVisible = FALSE,
const String* pPostStr = 0);
+ void ResetLastDir();
//#if 0 // _SOLAR__PRIVATE
SAL_DLLPRIVATE static SfxApplication* Is_Impl() { return pApp;}
diff --git a/sfx2/inc/sfx2/dinfdlg.hxx b/sfx2/inc/sfx2/dinfdlg.hxx
index ae7439bcde44..1873c6e6c88e 100644
--- a/sfx2/inc/sfx2/dinfdlg.hxx
+++ b/sfx2/inc/sfx2/dinfdlg.hxx
@@ -50,9 +50,6 @@
#include "tabdlg.hxx"
namespace com { namespace sun { namespace star {
- namespace beans {
- class XPropertyContainer;
- }
namespace document {
class XDocumentProperties;
}
@@ -75,7 +72,7 @@ private:
::com::sun::star::util::DateTime m_CreationDate;
::rtl::OUString m_ModifiedBy;
::com::sun::star::util::DateTime m_ModificationDate;
- String m_PrintedBy;
+ ::rtl::OUString m_PrintedBy;
::com::sun::star::util::DateTime m_PrintDate;
sal_Int16 m_EditingCycles;
sal_Int32 m_EditingDuration;
@@ -83,11 +80,9 @@ private:
::rtl::OUString m_Keywords;
::rtl::OUString m_Subject;
::rtl::OUString m_Title;
- ::rtl::OUString m_UserDefinedFieldTitles[4];
- ::rtl::OUString m_UserDefinedFieldValues[4];
- sal_Bool bHasTemplate;
- sal_Bool bDeleteUserData;
- sal_Bool bIsUseUserData;
+ sal_Bool m_bHasTemplate;
+ sal_Bool m_bDeleteUserData;
+ sal_Bool m_bUseUserData;
std::vector< CustomProperty* > m_aCustomProperties;
public:
@@ -101,9 +96,10 @@ public:
virtual ~SfxDocumentInfoItem();
/// update i_xDocProps with the data in this object
- void updateDocumentInfo(
+ void UpdateDocumentInfo(
const ::com::sun::star::uno::Reference<
- ::com::sun::star::document::XDocumentProperties> & i_xDocProps)
+ ::com::sun::star::document::XDocumentProperties> & i_xDocProps,
+ bool i_bDoNotUpdateUserDefined = false)
const;
sal_Bool isAutoloadEnabled() const { return m_isAutoloadEnabled; }
@@ -151,25 +147,21 @@ public:
void setSubject(::rtl::OUString i_val) { m_Subject = i_val; }
::rtl::OUString getTitle() const { return m_Title; }
void setTitle(::rtl::OUString i_val) { m_Title = i_val; }
- ::rtl::OUString getUserDefinedFieldTitle(size_t i_ix) const;
- void setUserDefinedFieldTitle(size_t i_ix, ::rtl::OUString i_val);
- ::rtl::OUString getUserDefinedFieldValue(size_t i_ix) const;
- void setUserDefinedFieldValue(size_t i_ix, ::rtl::OUString i_val);
/// reset user-specific data (author, modified-by, ...)
void resetUserData(const ::rtl::OUString & i_rAuthor);
- void SetTemplate( BOOL b ) { bHasTemplate = b; }
- FASTBOOL HasTemplate() const { return bHasTemplate; }
- void SetDeleteUserData( BOOL bSet );
- void SetUseUserData( BOOL bSet );
- BOOL IsDeleteUserData() const;
- BOOL IsUseUserData() const;
+ void SetTemplate( sal_Bool b ) { m_bHasTemplate = b; }
+ sal_Bool HasTemplate() const { return m_bHasTemplate; }
+ void SetDeleteUserData( sal_Bool bSet );
+ void SetUseUserData( sal_Bool bSet );
+ sal_Bool IsDeleteUserData() const;
+ sal_Bool IsUseUserData() const;
std::vector< CustomProperty* > GetCustomProperties() const;
- void ClearCustomProperties();
- void AddCustomProperty( const ::rtl::OUString& sName,
- const com::sun::star::uno::Any& rValue );
+ void ClearCustomProperties();
+ void AddCustomProperty( const ::rtl::OUString& sName,
+ const com::sun::star::uno::Any& rValue );
virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
virtual int operator==( const SfxPoolItem& ) const;
@@ -262,41 +254,6 @@ public:
static SfxTabPage* Create( Window* pParent, const SfxItemSet& );
};
-// class SfxDocumentUserPage ---------------------------------------------
-
-class SfxDocumentUserPage : public SfxTabPage
-{
-private:
- BOOL bLabelModified;
-
- FixedText aInfo1Ft;
- Edit aInfo1Ed;
- FixedText aInfo2Ft;
- Edit aInfo2Ed;
- FixedText aInfo3Ft;
- Edit aInfo3Ed;
- FixedText aInfo4Ft;
- Edit aInfo4Ed;
- PushButton aEditLabelBtn;
- SfxDocumentInfoItem* pInfoItem;
-
-#if _SOLAR__PRIVATE
- DECL_LINK( EditLabelHdl, PushButton * );
-
- String GetLabelText_Impl( FixedText* pLabel );
- void SetLabelText_Impl( FixedText* pLabel, const String& rNewLabel );
-#endif
-
-protected:
- SfxDocumentUserPage( Window* pParent, const SfxItemSet& );
-
- virtual BOOL FillItemSet( SfxItemSet& );
- virtual void Reset( const SfxItemSet& );
-
-public:
- static SfxTabPage* Create( Window* pParent, const SfxItemSet& );
-};
-
// class SfxInternetPage -------------------------------------------------
class TargetList;
diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx
index 75900531a70f..bebcdc684d89 100644
--- a/sfx2/inc/sfx2/docfile.hxx
+++ b/sfx2/inc/sfx2/docfile.hxx
@@ -1,4 +1,4 @@
- /*************************************************************************
+/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -183,7 +183,8 @@ public:
#endif
void CheckFileDate( const ::com::sun::star::util::DateTime& aInitDate );
- ::com::sun::star::util::DateTime GetInitFileDate();
+ sal_Bool DocNeedsFileDateCheck();
+ ::com::sun::star::util::DateTime GetInitFileDate( sal_Bool bIgnoreOldValue );
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent > GetContent() const;
const String& GetPhysicalName() const;
@@ -206,7 +207,9 @@ public:
{ return ERRCODE_TOERROR(GetErrorCode()); }
sal_uInt32 GetLastStorageCreationState();
- void SetError( sal_uInt32 nError ) { eError = nError; }
+ void SetError( sal_uInt32 nError, const ::rtl::OUString& aLogMessage );
+
+ void AddLog( const ::rtl::OUString& aMessage );
void CloseInStream();
sal_Bool CloseOutStream();
@@ -360,89 +363,5 @@ SV_DECL_COMPAT_WEAK( SfxMedium )
DECLARE_LIST( SfxMediumList, SfxMedium* )
#endif
-/*========================================================================
- *
- * SvKeyValue.
- *
- *======================================================================*/
-
-#ifndef COPYCTOR_API
-#define COPYCTOR_API(C) C (const C&); C& operator= (const C&)
-#endif
-SV_DECL_REF(SvKeyValueIterator)
-
-class SvKeyValue
-{
- /** Representation.
- */
- String m_aKey;
- String m_aValue;
-
-public:
- /** Construction.
- */
- SvKeyValue (void)
- {}
-
- SvKeyValue (const String &rKey, const String &rValue)
- : m_aKey (rKey), m_aValue (rValue)
- {}
-
- SvKeyValue (const SvKeyValue &rOther)
- : m_aKey (rOther.m_aKey), m_aValue (rOther.m_aValue)
- {}
-
- /** Assignment.
- */
- SvKeyValue& operator= (SvKeyValue &rOther)
- {
- m_aKey = rOther.m_aKey;
- m_aValue = rOther.m_aValue;
- return *this;
- }
-
- /** Operation.
- */
- const String& GetKey (void) const { return m_aKey; }
- const String& GetValue (void) const { return m_aValue; }
-
- void SetKey (const String &rKey ) { m_aKey = rKey; }
- void SetValue (const String &rValue) { m_aValue = rValue; }
-};
-
-/*========================================================================
- *
- * SvKeyValueIterator.
- *
- *======================================================================*/
-class SvKeyValueList_Impl;
-class SFX2_DLLPUBLIC SvKeyValueIterator : public SvRefBase
-{
- /** Representation.
- */
- SvKeyValueList_Impl* m_pList;
- USHORT m_nPos;
-
- /** Not implemented.
- */
- COPYCTOR_API(SvKeyValueIterator);
-
-public:
- /** Construction/Destruction.
- */
- SvKeyValueIterator (void);
- virtual ~SvKeyValueIterator (void);
-
- /** Operation.
- */
- virtual BOOL GetFirst (SvKeyValue &rKeyVal);
- virtual BOOL GetNext (SvKeyValue &rKeyVal);
- virtual void Append (const SvKeyValue &rKeyVal);
-};
-
-SV_IMPL_REF(SvKeyValueIterator);
-
-
-
#endif
diff --git a/sfx2/inc/sfx2/filedlghelper.hxx b/sfx2/inc/sfx2/filedlghelper.hxx
index c93af303158c..f9377f9908ea 100644
--- a/sfx2/inc/sfx2/filedlghelper.hxx
+++ b/sfx2/inc/sfx2/filedlghelper.hxx
@@ -229,8 +229,16 @@ public:
void SetTitle( const String& rNewTitle );
String GetPath() const;
+ /** @deprected: Don't use this method to retrieve the selected files
+ There are file picker which can provide multiple selected file which belong
+ to different folders. As this method always provides the root folder for all selected
+ files this cannot work.
+ */
::com::sun::star::uno::Sequence< ::rtl::OUString > GetMPath() const;
+ /** Provides the selected files with full path information */
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > GetSelectedFiles() const;
+
void AddFilter( const String& rFilterName, const String& rExtension );
void SetCurrentFilter( const String& rFilter );
diff --git a/sfx2/inc/sfx2/msg.hxx b/sfx2/inc/sfx2/msg.hxx
index 8147a9f67df1..66e8c07ba357 100644
--- a/sfx2/inc/sfx2/msg.hxx
+++ b/sfx2/inc/sfx2/msg.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: msg.hxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.82.2 $
*
* This file is part of OpenOffice.org.
*
@@ -155,11 +155,17 @@ SFX_DECL_TYPE(5);
SFX_DECL_TYPE(6);
SFX_DECL_TYPE(7);
SFX_DECL_TYPE(8);
+SFX_DECL_TYPE(10); // for SfxDocInfoItem
SFX_DECL_TYPE(11);
+SFX_DECL_TYPE(13); // for SwAddPrinterItem, Sd...
SFX_DECL_TYPE(14);
-SFX_DECL_TYPE(17); // fuer SvxAddressItem, SvxSearchItem
-SFX_DECL_TYPE(18); // fuer SfxDocInfoItem
+SFX_DECL_TYPE(16); // for SwDocDisplayItem
+SFX_DECL_TYPE(17); // for SvxAddressItem
+SFX_DECL_TYPE(18); // for SvxSearchItem
+
+// all SfxTypes must be in this header
+#undef SFX_DECL_TYPE
#define SFX_SLOT_ARG( aShellClass, id, GroupId, ExecMethodPtr, StateMethodPtr, Flags, ItemClass, nArg0, nArgs, Name, Prop ) \
{ id, GroupId, id, Flags | Prop, \
diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx
index 3f2d710cfe51..71f1729840c0 100644
--- a/sfx2/inc/sfx2/objsh.hxx
+++ b/sfx2/inc/sfx2/objsh.hxx
@@ -63,6 +63,7 @@
#include <sot/storage.hxx>
#include <rsc/rscsfx.hxx>
+#include <sfx2/XmlIdRegistry.hxx>
#include <sfx2/shell.hxx>
#include <comphelper/embeddedobjectcontainer.hxx>
#include <com/sun/star/frame/XModel.hpp>
@@ -207,11 +208,13 @@ enum SfxTitleQuery
class SfxToolBoxConfig;
struct TransferableObjectDescriptor;
-class SFX2_DLLPUBLIC SfxObjectShell: public SfxShell, virtual public SotObject, public ::comphelper::IEmbeddedHelper
+class SFX2_DLLPUBLIC SfxObjectShell :
+ public SfxShell, virtual public SotObject,
+ public ::comphelper::IEmbeddedHelper, public ::sfx2::IXmlIdRegistrySupplier
{
friend struct ModifyBlocker_Impl;
-public:
+private:
struct SfxObjectShell_Impl* pImp; // interne Daten
SfxMedium * pMedium; // Beschreibung der Datei bzw. des Storage, in dem sich das Objekt befindet
@@ -325,7 +328,10 @@ public:
void ResetError();
sal_uInt32 GetError() const;
sal_uInt32 GetErrorCode() const;
- void SetError(sal_uInt32 rErr);
+ void SetError( sal_uInt32 rErr, const ::rtl::OUString& aLogMessage );
+
+ void AddLog( const ::rtl::OUString& aMessage );
+ void StoreLog();
sal_Bool DoInitNew( SfxMedium* pMedium=0 );
sal_Bool DoLoad( SfxMedium* pMedium );
@@ -521,6 +527,7 @@ public:
//determine the position of the "Automatic" filter in the stylist
void SetAutoStyleFilterIndex(sal_uInt16 nSet);
+ sal_uInt16 GetAutoStyleFilterIndex();
virtual sal_Bool HasBasic() const;
BasicManager* GetBasicManager() const;
com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer >
diff --git a/sfx2/inc/sfx2/passwd.hxx b/sfx2/inc/sfx2/passwd.hxx
index 4efde4dc4a73..bb4e1b8c1561 100644
--- a/sfx2/inc/sfx2/passwd.hxx
+++ b/sfx2/inc/sfx2/passwd.hxx
@@ -81,6 +81,7 @@ public:
String GetConfirm() const { return maConfirmED.GetText(); }
void SetMinLen( USHORT Len );
+ void SetMaxLen( USHORT Len );
void SetEditHelpId( ULONG nId ) { maPasswordED.SetHelpId( nId ); }
void ShowExtras( USHORT nExtras ) { mnExtras = nExtras; }
diff --git a/sfx2/inc/sfx2/sfx.hrc b/sfx2/inc/sfx2/sfx.hrc
index c29d0797bf81..fbc5e6f58d1c 100644
--- a/sfx2/inc/sfx2/sfx.hrc
+++ b/sfx2/inc/sfx2/sfx.hrc
@@ -367,14 +367,6 @@
#define MID_DOCINFO_KEYWORDS 0x17
#define MID_DOCINFO_SUBJECT 0x1b
#define MID_DOCINFO_TITLE 0x1d
-#define MID_DOCINFO_FIELD1TITLE 0x20
-#define MID_DOCINFO_FIELD2TITLE 0x21
-#define MID_DOCINFO_FIELD3TITLE 0x22
-#define MID_DOCINFO_FIELD4TITLE 0x23
-#define MID_DOCINFO_FIELD1 0x24
-#define MID_DOCINFO_FIELD2 0x25
-#define MID_DOCINFO_FIELD3 0x26
-#define MID_DOCINFO_FIELD4 0x27
#define MID_DOCINFO_AUTOLOADENABLED 0x2d
#define MID_DOCINFO_AUTOLOADURL 0x2e
#define MID_DOCINFO_AUTOLOADSECS 0x2f
diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx
index 7cbd6e069d66..324080484c81 100644
--- a/sfx2/inc/sfx2/sfxbasemodel.hxx
+++ b/sfx2/inc/sfx2/sfxbasemodel.hxx
@@ -47,6 +47,9 @@
#include <com/sun/star/document/XDocumentInfo.hpp>
#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+
+#include <com/sun/star/rdf/XDocumentMetadataAccess.hpp>
+
#include <com/sun/star/document/XEventBroadcaster.hpp>
#include <com/sun/star/document/XEventListener.hpp>
#include <com/sun/star/document/XEventsSupplier.hpp>
@@ -79,13 +82,12 @@
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <cppuhelper/weak.hxx>
+#include <cppuhelper/basemutex.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <com/sun/star/script/XStarBasicAccess.hpp>
#include <osl/mutex.hxx>
-#ifndef _LINK_HXX_
#include <tools/link.hxx>
-#endif
#include <com/sun/star/document/XViewDataSupplier.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
@@ -93,9 +95,9 @@
#include <com/sun/star/task/XInteractionHandler.hpp>
//________________________________________________________________________________________________________
-#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_28)
-#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_28
-#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 28
+#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_29)
+#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_29
+#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 29
#include <comphelper/implbase_var.hxx>
#endif
@@ -204,11 +206,6 @@ struct IMPL_SfxBaseModel_DataContainer ; // impl. struct to hold member o
// class declarations
//________________________________________________________________________________________________________
-struct IMPL_SfxBaseModel_MutexContainer
-{
- MUTEX m_aMutex ;
-} ;
-
/**_______________________________________________________________________________________________________
@short -
@@ -217,7 +214,8 @@ struct IMPL_SfxBaseModel_MutexContainer
@implements XChild
XComponent
XDocumentInfoSupplier
- XDocumentPropertiesSupplier
+ document::XDocumentPropertiesSupplier
+ rdf::XDocumentMetadataAccess
XEventListener
XModel
XModifiable2
@@ -230,13 +228,14 @@ struct IMPL_SfxBaseModel_MutexContainer
XCloseable
XCloseBroadcaster
- @base IMPL_MutexContainer
+ @base cppu::BaseMutex
SfxListener
*/
-typedef ::comphelper::WeakImplHelper28 < XCHILD
+typedef ::comphelper::WeakImplHelper29 < XCHILD
, XDOCUMENTINFOSUPPLIER
, ::com::sun::star::document::XDocumentPropertiesSupplier
+ , ::com::sun::star::rdf::XDocumentMetadataAccess
, XEVENTBROADCASTER
, XEVENTLISTENER
, XEVENTSSUPPLIER
@@ -264,8 +263,8 @@ typedef ::comphelper::WeakImplHelper28 < XCHILD
, XUNTITLEDNUMBERS
> SfxBaseModel_Base;
-class SFX2_DLLPUBLIC SfxBaseModel : public SfxBaseModel_Base
- , public IMPL_SfxBaseModel_MutexContainer
+class SFX2_DLLPUBLIC SfxBaseModel : protected ::cppu::BaseMutex
+ , public SfxBaseModel_Base
, public SfxListener
{
@@ -1290,6 +1289,114 @@ public:
throw (css::uno::RuntimeException);
//____________________________________________________________________________________________________
+
+ // ::com::sun::star::rdf::XNode:
+ virtual ::rtl::OUString SAL_CALL getStringValue()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::rdf::XURI:
+ virtual ::rtl::OUString SAL_CALL getNamespace()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getLocalName()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::rdf::XRepositorySupplier:
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XRepository > SAL_CALL getRDFRepository()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::rdf::XDocumentMetadataAccess:
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XMetadatable > SAL_CALL
+ getElementByMetadataReference(
+ const ::com::sun::star::beans::StringPair & i_rReference)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XMetadatable > SAL_CALL
+ getElementByURI(const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XURI > & i_xURI)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XURI > > SAL_CALL getMetadataGraphsWithType(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XURI > & i_xType)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XURI> SAL_CALL
+ addMetadataFile(const ::rtl::OUString & i_rFileName,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XURI >
+ > & i_rTypes)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::ElementExistException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XURI> SAL_CALL
+ importMetadataFile(::sal_Int16 i_Format,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream > & i_xInStream,
+ const ::rtl::OUString & i_rFileName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XURI > & i_xBaseURI,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XURI >
+ > & i_rTypes)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::datatransfer::UnsupportedFlavorException,
+ ::com::sun::star::container::ElementExistException,
+ ::com::sun::star::rdf::ParseException,
+ ::com::sun::star::io::IOException);
+ virtual void SAL_CALL removeMetadataFile(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XURI > & i_xGraphName)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException);
+ virtual void SAL_CALL addContentOrStylesFile(
+ const ::rtl::OUString & i_rFileName)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::ElementExistException);
+ virtual void SAL_CALL removeContentOrStylesFile(
+ const ::rtl::OUString & i_rFileName)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException);
+
+ virtual void SAL_CALL loadMetadataFromStorage(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::embed::XStorage > & i_xStorage,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XURI > & i_xBaseURI,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::task::XInteractionHandler> & i_xHandler)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException);
+ virtual void SAL_CALL storeMetadataToStorage(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::embed::XStorage > & i_xStorage)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException);
+ virtual void SAL_CALL loadMetadataFromMedium(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > & i_rMedium)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException);
+ virtual void SAL_CALL storeMetadataToMedium(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > & i_rMedium)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException);
+
+
+ //____________________________________________________________________________________________________
// SfxListener
//____________________________________________________________________________________________________
@@ -1370,6 +1477,7 @@ public:
/** returns true if someone added a XEventListener to this XEventBroadcaster */
sal_Bool hasEventListeners() const;
+
protected:
/* returns a unique id for the model that is valid as long as the document
diff --git a/sfx2/inc/sfx2/sfxhtml.hxx b/sfx2/inc/sfx2/sfxhtml.hxx
index 41689cd72729..899edd2cd201 100644
--- a/sfx2/inc/sfx2/sfxhtml.hxx
+++ b/sfx2/inc/sfx2/sfxhtml.hxx
@@ -38,16 +38,10 @@
#include <svtools/parhtml.hxx>
#include <svtools/macitem.hxx>
-namespace com { namespace sun { namespace star {
- namespace document {
- class XDocumentProperties;
- }
-} } }
class ImageMap;
class SfxMedium;
class SfxObjectShell;
-class SvKeyValueIterator;
class SFX2_DLLPUBLIC SfxHTMLParser : public HTMLParser
{
@@ -67,7 +61,7 @@ protected:
SfxHTMLParser( SvStream& rStream, BOOL bNewDoc=TRUE, SfxMedium *pMedium=0 );
- ~SfxHTMLParser();
+ virtual ~SfxHTMLParser();
public:
// Lesen der Optionen einer Image-Map
@@ -85,24 +79,14 @@ public:
USHORT nEventMouseOver = 0,
USHORT nEventMouseOut = 0);
- /// parse meta options into XDocumentProperties
- static BOOL ParseMetaOptions( const ::com::sun::star::uno::Reference<
- ::com::sun::star::document::XDocumentProperties>&,
- SvKeyValueIterator*,
- const HTMLOptions*,
- rtl_TextEncoding& rEnc );
-
// <TD SDVAL="..." SDNUM="...">
static double GetTableDataOptionsValNum( sal_uInt32& nNumForm,
LanguageType& eNumLang, const String& aValStr,
const String& aNumStr, SvNumberFormatter& rFormatter );
static rtl_TextEncoding GetEncodingByHttpHeader( SvKeyValueIterator *pHTTPHeader );
-protected:
- BOOL ParseMetaOptions( const ::com::sun::star::uno::Reference<
- ::com::sun::star::document::XDocumentProperties>&,
- SvKeyValueIterator* );
+protected:
// Start eines File-Downloads. Dieser erfolgt synchron oder asynchron.
// Im synchronen Fall befindet sich der Parser nach dem Aufruf im
@@ -141,8 +125,6 @@ protected:
ScriptType GetScriptType( SvKeyValueIterator* ) const;
const String& GetScriptTypeString( SvKeyValueIterator* ) const;
- static rtl_TextEncoding GetEncodingByMIME( const String& rMime );
-
BOOL SetEncodingByHTTPHeader( SvKeyValueIterator *pHTTPHeader );
};
diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc
index 5efa13713133..e600c812a373 100644
--- a/sfx2/inc/sfx2/sfxsids.hrc
+++ b/sfx2/inc/sfx2/sfxsids.hrc
@@ -143,6 +143,7 @@
#define SID_CURRENTTIME (SID_SFX_START + 311)
#define SID_CURRENTDATE (SID_SFX_START + 312)
#define SID_VERSION_VISIBLE (SID_SFX_START + 313)
+#define SID_PASTE_UNFORMATTED (SID_SFX_START + 314)
#define SID_PRINTER_NOTFOUND_WARN (SID_SFX_START + 320)
#define SID_PRINTER_USETHREAD (SID_SFX_START + 321)
#define SID_PRINTER_NAME (SID_SFX_START + 322)
diff --git a/sfx2/prj/build.lst b/sfx2/prj/build.lst
index 72ba4ac0af64..89e618e8fc12 100644
--- a/sfx2/prj/build.lst
+++ b/sfx2/prj/build.lst
@@ -1,4 +1,4 @@
-sf sfx2 : idl basic xmlscript framework shell setup_native sax SYSTRAY_GTK:libegg NULL
+sf sfx2 : l10n idl basic xmlscript framework shell setup_native sax SYSTRAY_GTK:libegg LIBXML2:libxml2 NULL
sf sfx2 usr1 - all sf_mkout NULL
sf sfx2\inc nmake - all sf_inc NULL
sf sfx2\prj get - all sf_prj NULL
diff --git a/sfx2/prj/d.lst b/sfx2/prj/d.lst
index 03ae35e5c3d7..77acce9a7be9 100644
--- a/sfx2/prj/d.lst
+++ b/sfx2/prj/d.lst
@@ -128,3 +128,6 @@ mkdir: %_DEST%\inc%_EXT%\sfx2
..\inc\sfx2\layout-tabdlg.hxx %_DEST%\inc%_EXT%\sfx2\layout-tabdlg.hxx
..\inc\sfx2\layout-post.hxx %_DEST%\inc%_EXT%\sfx2\layout-post.hxx
..\inc\sfx2\layout-pre.hxx %_DEST%\inc%_EXT%\sfx2\layout-pre.hxx
+..\inc\sfx2\XmlIdRegistry.hxx %_DEST%\inc%_EXT%\sfx2\XmlIdRegistry.hxx
+..\inc\sfx2\DocumentMetadataAccess.hxx %_DEST%\inc%_EXT%\sfx2\DocumentMetadataAccess.hxx
+..\inc\sfx2\Metadatable.hxx %_DEST%\inc%_EXT%\sfx2\Metadatable.hxx
diff --git a/sfx2/qa/complex/DocumentMetadataAccessTest.java b/sfx2/qa/complex/DocumentMetadataAccessTest.java
new file mode 100644
index 000000000000..0983aec1bd37
--- /dev/null
+++ b/sfx2/qa/complex/DocumentMetadataAccessTest.java
@@ -0,0 +1,1270 @@
+/*************************************************************************
+ * 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: DocumentMetadataAccessTest.java,v $
+ *
+ * $Revision: 1.1.2.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.
+ ************************************************************************/
+
+package complex.framework;
+
+import complexlib.ComplexTestCase;
+import helper.StreamSimulator;
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.uno.Any;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XInitialization;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.WrappedTargetRuntimeException;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.StringPair;
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XEnumeration;
+import com.sun.star.container.ElementExistException;
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.io.XInputStream;
+import com.sun.star.io.XOutputStream;
+import com.sun.star.util.XCloseable;
+import com.sun.star.frame.XStorable;
+import com.sun.star.frame.XLoadable;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.text.XTextRange;
+import com.sun.star.text.XText;
+import com.sun.star.rdf.*;
+
+/**
+ * Test case for interface com.sun.star.rdf.XDocumentMetadataAccess
+ * Currently, this service is implemented in
+ * sfx2/source/doc/DocumentMetadataAccess.cxx
+ *
+ * Actually, this is not a service, so we need to create a document and
+ * go from there...
+ *
+ * @author mst
+ */
+public class DocumentMetadataAccessTest extends ComplexTestCase
+{
+ XMultiServiceFactory xMSF;
+ XComponentContext xContext;
+ String tempDir;
+
+ String nsRDF = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+ String nsRDFS = "http://www.w3.org/2000/01/rdf-schema#";
+ String nsPkg="http://docs.oasis-open.org/opendocument/meta/package/common#";
+ String nsODF ="http://docs.oasis-open.org/opendocument/meta/package/odf#";
+
+ XURI foo;
+ XURI bar;
+ XURI baz;
+
+ static XURI rdf_type;
+ static XURI rdfs_label;
+ static XURI pkg_Document;
+ static XURI pkg_hasPart;
+ static XURI pkg_MetadataFile;
+ static XURI odf_ContentFile;
+ static XURI odf_StylesFile;
+ static XURI odf_Element;
+ static XBlankNode blank1;
+ static XBlankNode blank2;
+ static XBlankNode blank3;
+ static XBlankNode blank4;
+ static String manifestPath = "manifest.rdf";
+ static String contentPath = "content.xml";
+ static String stylesPath = "styles.xml";
+ static String fooPath = "foo.rdf";
+ static String fooBarPath = "meta/foo/bar.rdf";
+
+ XRepository xRep;
+ XRepositorySupplier xRS;
+ XDocumentMetadataAccess xDMA;
+
+ public String[] getTestMethodNames ()
+ {
+ return new String[] { "check", "checkRDFa" };
+ }
+
+ public void before()
+ {
+ try {
+
+ xMSF = (XMultiServiceFactory) param.getMSF();
+ assure("could not create MultiServiceFactory.", xMSF != null);
+ XPropertySet xPropertySet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xMSF);
+ Object defaultCtx = xPropertySet.getPropertyValue("DefaultContext");
+ xContext = (XComponentContext)
+ UnoRuntime.queryInterface(XComponentContext.class, defaultCtx);
+ assure("could not get component context.", xContext != null);
+
+ tempDir = util.utils.getOfficeTemp/*Dir*/(xMSF);
+ log.println("tempdir: " + tempDir);
+
+ foo = URI.create(xContext, "uri:foo");
+ assure("foo", null != foo);
+ bar = URI.create(xContext, "uri:bar");
+ assure("bar", null != bar);
+ baz = URI.create(xContext, "uri:baz");
+ assure("baz", null != baz);
+
+ blank1 = BlankNode.create(xContext, "_:1");
+ assure("blank1", null != blank1);
+ blank2 = BlankNode.create(xContext, "_:2");
+ assure("blank2", null != blank2);
+ blank3 = BlankNode.create(xContext, "_:3");
+ assure("blank3", null != blank3);
+ blank4 = BlankNode.create(xContext, "_:4");
+ assure("blank4", null != blank4);
+ rdf_type = URI.createKnown(xContext, URIs.RDF_TYPE);
+ assure("rdf_type", null != rdf_type);
+ rdfs_label = URI.createKnown(xContext, URIs.RDFS_LABEL);
+ assure("rdfs_label", null != rdfs_label);
+ pkg_Document = URI.createKnown(xContext, URIs.PKG_DOCUMENT);
+ assure("pkg_Document", null != pkg_Document);
+ pkg_hasPart = URI.createKnown(xContext, URIs.PKG_HASPART);
+ assure("pkg_hasPart", null != pkg_hasPart);
+ pkg_MetadataFile = URI.createKnown(xContext, URIs.PKG_METADATAFILE);
+ assure("pkg_MetadataFile", null != pkg_MetadataFile);
+ odf_ContentFile = URI.createKnown(xContext, URIs.ODF_CONTENTFILE);
+ assure("odf_ContentFile", null != odf_ContentFile);
+ odf_StylesFile = URI.createKnown(xContext, URIs.ODF_STYLESFILE);
+ assure("odf_StylesFile", null != odf_StylesFile);
+ odf_Element = URI.createKnown(xContext, URIs.ODF_ELEMENT);
+ assure("odf_Element", null != odf_Element);
+
+ } catch (Exception e) {
+ report(e);
+ }
+ }
+
+ public void after()
+ {
+ xRep = null;
+ xRS = null;
+ xDMA = null;
+ }
+
+ public void check()
+ {
+ XComponent xComp = null;
+ XComponent xComp2 = null;
+ try {
+ XEnumeration xStmtsEnum;
+ XNamedGraph xManifest;
+
+ log.println("Creating document with Repository...");
+
+ // we cannot create a XDMA directly, we must create
+ // a document and get it from there :(
+ // create document
+ PropertyValue[] loadProps = new PropertyValue[1];
+ loadProps[0] = new PropertyValue();
+ loadProps[0].Name = "Hidden";
+ loadProps[0].Value = new Boolean(true);
+ xComp = util.DesktopTools.openNewDoc(xMSF, "swriter", loadProps);
+ XTextDocument xText = (XTextDocument) UnoRuntime.queryInterface(
+ XTextDocument.class, xComp);
+
+ XRepositorySupplier xRS = (XRepositorySupplier)
+ UnoRuntime.queryInterface(XRepositorySupplier.class, xComp);
+ assure("xRS null", null != xRS);
+ XDocumentMetadataAccess xDMA = (XDocumentMetadataAccess)
+ UnoRuntime.queryInterface(XDocumentMetadataAccess.class, xRS);
+ assure("xDMA null", null != xDMA);
+ xRep = xRS.getRDFRepository();
+ assure("xRep null", null != xRep);
+
+ log.println("...done");
+
+ log.println("Checking that new repository is initialized...");
+
+ XURI xBaseURI = (XURI) xDMA;
+ String baseURI = xBaseURI.getStringValue();
+ assure("new: baseURI",
+ null != xBaseURI && !xBaseURI.getStringValue().equals(""));
+
+ assure("new: # graphs", 1 == xRep.getGraphNames().length);
+ XURI manifest = URI.createNS(xContext, xBaseURI.getStringValue(),
+ manifestPath);
+ xManifest = xRep.getGraph(manifest);
+ assure("new: manifest graph", null != xManifest);
+
+ Statement[] manifestStmts = getManifestStmts(xBaseURI);
+ xStmtsEnum = xRep.getStatements(null, null, null);
+ assure("new: manifest graph", eq(xStmtsEnum, manifestStmts));
+
+ log.println("...done");
+
+ log.println("Checking some invalid args...");
+
+ String content = "behold, for i am the content.";
+ XTextRange xTR = new TestRange(content);
+ XMetadatable xM = (XMetadatable) xTR;
+
+ try {
+ xDMA.getElementByURI(null);
+ assure("getElementByURI: null allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.getMetadataGraphsWithType(null);
+ assure("getMetadataGraphsWithType: null URI allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addMetadataFile("", new XURI[0]);
+ assure("addMetadataFile: empty filename allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addMetadataFile("/foo", new XURI[0]);
+ assure("addMetadataFile: absolute filename allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addMetadataFile("fo\"o", new XURI[0]);
+ assure("addMetadataFile: invalid filename allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addMetadataFile("../foo", new XURI[0]);
+ assure("addMetadataFile: filename with .. allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addMetadataFile("foo/../../bar", new XURI[0]);
+ assure("addMetadataFile: filename with nest .. allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addMetadataFile("foo/././bar", new XURI[0]);
+ assure("addMetadataFile: filename with nest . allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addMetadataFile("content.xml", new XURI[0]);
+ assure("addMetadataFile: content.xml allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addMetadataFile("styles.xml", new XURI[0]);
+ assure("addMetadataFile: styles.xml allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addMetadataFile("meta.xml", new XURI[0]);
+ assure("addMetadataFile: meta.xml allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addMetadataFile("settings.xml", new XURI[0]);
+ assure("addMetadataFile: settings.xml allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.importMetadataFile(FileFormat.RDF_XML, null, "foo",
+ foo, new XURI[0]);
+ assure("importMetadataFile: null stream allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ XInputStream xFooIn =
+ new StreamSimulator(tempDir + "empty.rdf", true, param);
+ xDMA.importMetadataFile(FileFormat.RDF_XML, xFooIn, "",
+ foo, new XURI[0]);
+ assure("importMetadataFile: empty filename allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ XInputStream xFooIn =
+ new StreamSimulator(tempDir + "empty.rdf", true, param);
+ xDMA.importMetadataFile(FileFormat.RDF_XML, xFooIn, "meta.xml",
+ foo, new XURI[0]);
+ assure("importMetadataFile: meta.xml filename allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ XInputStream xFooIn =
+ new StreamSimulator(tempDir + "empty.rdf", true, param);
+ xDMA.importMetadataFile(FileFormat.RDF_XML,
+ xFooIn, "foo", null, new XURI[0]);
+ assure("importMetadataFile: null base URI allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ XInputStream xFooIn =
+ new StreamSimulator(tempDir + "empty.rdf", true, param);
+ xDMA.importMetadataFile(FileFormat.RDF_XML,
+ xFooIn, "foo", rdf_type, new XURI[0]);
+ assure("importMetadataFile: non-absolute base URI allowed",
+ false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.removeMetadataFile(null);
+ assure("removeMetadataFile: null URI allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addContentOrStylesFile("");
+ assure("addContentOrStylesFile: empty filename allowed",
+ false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addContentOrStylesFile("/content.xml");
+ assure("addContentOrStylesFile: absolute filename allowed",
+ false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addContentOrStylesFile("foo.rdf");
+ assure("addContentOrStylesFile: invalid filename allowed",
+ false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.removeContentOrStylesFile("");
+ assure("removeContentOrStylesFile: empty filename allowed",
+ false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.loadMetadataFromStorage(null, foo, null);
+ assure("loadMetadataFromStorage: null storage allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.storeMetadataToStorage(null/*, base*/);
+ assure("storeMetadataToStorage: null storage allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.loadMetadataFromMedium(new PropertyValue[0]);
+ assure("loadMetadataFromMedium: empty medium allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.storeMetadataToMedium(new PropertyValue[0]);
+ assure("storeMetadataToMedium: empty medium allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+
+ log.println("...done");
+
+ log.println("Checking file addition/removal...");
+
+ xDMA.removeContentOrStylesFile(contentPath);
+ xStmtsEnum = xManifest.getStatements(null, null, null);
+ assure("removeContentOrStylesFile (content)",
+ eq(xStmtsEnum, new Statement[] {
+ manifestStmts[0], manifestStmts[2], manifestStmts[4]
+ }));
+
+ xDMA.addContentOrStylesFile(contentPath);
+ xStmtsEnum = xManifest.getStatements(null, null, null);
+ assure("addContentOrStylesFile (content)",
+ eq(xStmtsEnum, manifestStmts));
+
+ xDMA.removeContentOrStylesFile(stylesPath);
+ xStmtsEnum = xManifest.getStatements(null, null, null);
+ assure("removeContentOrStylesFile (styles)",
+ eq(xStmtsEnum, new Statement[] {
+ manifestStmts[0], manifestStmts[1], manifestStmts[3]
+ }));
+
+ xDMA.addContentOrStylesFile(stylesPath);
+ xStmtsEnum = xManifest.getStatements(null, null, null);
+ assure("addContentOrStylesFile (styles)",
+ eq(xStmtsEnum, manifestStmts));
+
+ XURI xFoo = URI.createNS(xContext, xBaseURI.getStringValue(),
+ fooPath);
+ Statement xM_BaseHaspartFoo =
+ new Statement(xBaseURI, pkg_hasPart, xFoo, manifest);
+ Statement xM_FooTypeMetadata =
+ new Statement(xFoo, rdf_type, pkg_MetadataFile, manifest);
+ Statement xM_FooTypeBar =
+ new Statement(xFoo, rdf_type, bar, manifest);
+ xDMA.addMetadataFile(fooPath, new XURI[] { bar });
+ xStmtsEnum = xManifest.getStatements(null, null, null);
+ assure("addMetadataFile",
+ eq(xStmtsEnum, merge(manifestStmts, new Statement[] {
+ xM_BaseHaspartFoo, xM_FooTypeMetadata, xM_FooTypeBar
+ })));
+
+ XURI[] graphsBar = xDMA.getMetadataGraphsWithType(bar);
+ assure("getMetadataGraphsWithType",
+ graphsBar.length == 1 && eq(graphsBar[0], xFoo));
+
+
+ xDMA.removeMetadataFile(xFoo);
+ xStmtsEnum = xManifest.getStatements(null, null, null);
+ assure("removeMetadataFile",
+ eq(xStmtsEnum, manifestStmts));
+
+ log.println("...done");
+
+ log.println("Checking mapping...");
+
+ XEnumerationAccess xTextEnum = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class,
+ xText.getText());
+ Object o = xTextEnum.createEnumeration().nextElement();
+ XMetadatable xMeta1 = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, o);
+
+ XURI uri;
+ XMetadatable xMeta;
+ xMeta = xDMA.getElementByURI(xMeta1);
+ assure("getElementByURI: null", null != xMeta);
+ String XmlId = xMeta.getMetadataReference().Second;
+ String XmlId1 = xMeta1.getMetadataReference().Second;
+ assure("getElementByURI: no xml id", !XmlId.equals(""));
+ assure("getElementByURI: different xml id", XmlId.equals(XmlId1));
+
+ log.println("...done");
+
+ log.println("Checking storing and loading...");
+
+ XURI xFoobar = URI.createNS(xContext, xBaseURI.getStringValue(),
+ fooBarPath);
+ Statement[] metadataStmts = getMetadataFileStmts(xBaseURI,
+ fooBarPath);
+ xDMA.addMetadataFile(fooBarPath, new XURI[0]);
+ xStmtsEnum = xRep.getStatements(null, null, null);
+ assure("addMetadataFile",
+ eq(xStmtsEnum, merge(manifestStmts, metadataStmts )));
+
+ Statement xFoobar_FooBarFoo =
+ new Statement(foo, bar, foo, xFoobar);
+ xRep.getGraph(xFoobar).addStatement(foo, bar, foo);
+ xStmtsEnum = xRep.getStatements(null, null, null);
+ assure("addStatement",
+ eq(xStmtsEnum, merge(manifestStmts, merge(metadataStmts,
+ new Statement[] { xFoobar_FooBarFoo }))));
+
+ PropertyValue noMDNoContentFile = new PropertyValue();
+ noMDNoContentFile.Name = "URL";
+ noMDNoContentFile.Value = util.utils.getFullTestURL("CUSTOM.odt");
+ PropertyValue noMDFile = new PropertyValue();
+ noMDFile.Name = "URL";
+ noMDFile.Value = util.utils.getFullTestURL("TEST.odt");
+ PropertyValue file = new PropertyValue();
+ file.Name = "URL";
+ file.Value = tempDir + "TESTDMA.odt";
+ /*
+ PropertyValue baseURL = new PropertyValue();
+ baseURL.Name = "DocumentBaseURL";
+ baseURL.Value = tempDir + "TMP.odt";
+ */
+ PropertyValue mimetype = new PropertyValue();
+ mimetype.Name = "MediaType";
+ mimetype.Value = "application/vnd.oasis.opendocument.text";
+ PropertyValue[] argsEmptyNoContent = { mimetype, noMDNoContentFile};
+ PropertyValue[] argsEmpty = { mimetype, noMDFile };
+ PropertyValue[] args = { mimetype, file };
+
+ xStmtsEnum = xRep.getStatements(null, null, null);
+ XURI[] graphs = xRep.getGraphNames();
+
+ xDMA.storeMetadataToMedium(args);
+
+ // this should re-init
+ xDMA.loadMetadataFromMedium(argsEmptyNoContent);
+ xRep = xRS.getRDFRepository();
+ assure("xRep null", null != xRep);
+ assure("baseURI still tdoc?",
+ !baseURI.equals(xDMA.getStringValue()));
+ Statement[] manifestStmts2 = getManifestStmts((XURI) xDMA);
+ xStmtsEnum = xRep.getStatements(null, null, null);
+ // there is no content or styles file in here, so we have just
+ // the package stmt
+ assure("loadMetadataFromMedium (no metadata, no content)",
+ eq(xStmtsEnum, new Statement[] { manifestStmts2[0] }));
+
+ // this should re-init
+ xDMA.loadMetadataFromMedium(argsEmpty);
+ xRep = xRS.getRDFRepository();
+ assure("xRep null", null != xRep);
+ assure("baseURI still tdoc?",
+ !baseURI.equals(xDMA.getStringValue()));
+ Statement[] manifestStmts3 = getManifestStmts((XURI) xDMA);
+
+ xStmtsEnum = xRep.getStatements(null, null, null);
+ assure("loadMetadataFromMedium (no metadata)",
+ eq(xStmtsEnum, manifestStmts3));
+
+ xDMA.loadMetadataFromMedium(args);
+ xRep = xRS.getRDFRepository();
+ assure("xRep null", null != xRep);
+ Statement[] manifestStmts4 = getManifestStmts((XURI) xDMA);
+ Statement[] metadataStmts4 = getMetadataFileStmts((XURI) xDMA,
+ fooBarPath);
+
+ xStmtsEnum = xRep.getStatements(null, null, null);
+ assure("some graph(s) not reloaded",
+ graphs.length == xRep.getGraphNames().length);
+
+ XURI xFoobar4 = URI.createNS(xContext, xDMA.getStringValue(),
+ fooBarPath);
+ Statement xFoobar_FooBarFoo4 =
+ new Statement(foo, bar, foo, xFoobar4);
+ assure("loadMetadataFromMedium (re-load)",
+ eq(xStmtsEnum, merge(manifestStmts4, merge(metadataStmts4,
+ new Statement[] { xFoobar_FooBarFoo4 }))));
+
+ log.println("...done");
+
+ log.println("Checking storing and loading via model...");
+
+ String f = tempDir + "TESTPARA.odt";
+
+ XStorable xStor = (XStorable) UnoRuntime.queryInterface(
+ XStorable.class, xRS);
+
+ xStor.storeToURL(f, new PropertyValue[0]);
+
+ xComp2 = util.DesktopTools.loadDoc(xMSF, f, loadProps);
+
+ XDocumentMetadataAccess xDMA2 = (XDocumentMetadataAccess)
+ UnoRuntime.queryInterface(XDocumentMetadataAccess.class,
+ xComp2);
+ assure("xDMA2 null", null != xDMA2);
+
+ XRepositorySupplier xRS2 = (XRepositorySupplier)
+ UnoRuntime.queryInterface(XRepositorySupplier.class, xComp2);
+ assure("xRS2 null", null != xRS2);
+
+ XRepository xRep2 = xRS2.getRDFRepository();
+ assure("xRep2 null", null != xRep2);
+
+ Statement[] manifestStmts5 = getManifestStmts((XURI) xDMA2);
+ Statement[] metadataStmts5 = getMetadataFileStmts((XURI) xDMA2,
+ fooBarPath);
+ XURI xFoobar5 = URI.createNS(xContext, xDMA2.getStringValue(),
+ fooBarPath);
+ Statement xFoobar_FooBarFoo5 =
+ new Statement(foo, bar, foo, xFoobar5);
+ xStmtsEnum = xRep.getStatements(null, null, null);
+ XEnumeration xStmtsEnum2 = xRep2.getStatements(null, null, null);
+ assure("load: repository differs",
+ eq(xStmtsEnum2, merge(manifestStmts5, merge(metadataStmts5,
+ new Statement[] { xFoobar_FooBarFoo5 }))));
+
+ log.println("...done");
+
+ } catch (Exception e) {
+ report(e);
+ } finally {
+ close(xComp);
+ close(xComp2);
+ }
+ }
+
+ public void checkRDFa()
+ {
+ XComponent xComp = null;
+ String file;
+ try {
+ file = util.utils.getFullTestURL("TESTRDFA.odt");
+ xComp = loadRDFa(file);
+ if (xComp != null)
+ {
+ file = tempDir + "TESTRDFA.odt";
+ storeRDFa(xComp, file);
+ close(xComp);
+ xComp = loadRDFa(file);
+ }
+ } finally {
+ close(xComp);
+ }
+ }
+
+ public void storeRDFa(XComponent xComp, String file)
+ {
+ try {
+
+ log.println("Storing test document...");
+
+ XStorable xStor = (XStorable) UnoRuntime.queryInterface(
+ XStorable.class, xComp);
+
+ xStor.storeToURL(file, new PropertyValue[0]);
+
+ log.println("...done");
+
+ } catch (Exception e) {
+ report(e);
+ }
+ }
+
+ public XComponent loadRDFa(String file)
+ {
+ XComponent xComp = null;
+ try {
+
+ log.println("Loading test document...");
+
+ PropertyValue[] loadProps = new PropertyValue[1];
+ loadProps[0] = new PropertyValue();
+ loadProps[0].Name = "Hidden";
+ loadProps[0].Value = new Boolean(true);
+
+
+
+ xComp = util.DesktopTools.loadDoc(xMSF, file, loadProps);
+
+ XRepositorySupplier xRS = (XRepositorySupplier)
+ UnoRuntime.queryInterface(XRepositorySupplier.class, xComp);
+ assure("xRS null", null != xRS);
+
+ XDocumentRepository xRep = (XDocumentRepository)
+ UnoRuntime.queryInterface(XDocumentRepository.class,
+ xRS.getRDFRepository());
+ assure("xRep null", null != xRep);
+
+ XTextDocument xTextDoc = (XTextDocument)
+ UnoRuntime.queryInterface(XTextDocument.class, xComp);
+
+ XText xText = xTextDoc.getText();
+
+ XEnumerationAccess xEA = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class, xText);
+ XEnumeration xEnum = xEA.createEnumeration();
+
+ log.println("...done");
+
+ log.println("Checking RDFa in loaded test document...");
+
+ XMetadatable xPara;
+ Statement[] stmts;
+
+ Statement x_FooBarLit1 = new Statement(foo, bar, mkLit("1"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 1",
+ eq(stmts, new Statement[] {
+ x_FooBarLit1
+ }));
+
+ Statement x_FooBarLit2 = new Statement(foo, bar, mkLit("2"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 2",
+ eq(stmts, new Statement[] {
+ x_FooBarLit2
+ }));
+
+ Statement x_BlankBarLit3 =
+ new Statement(blank1, bar, mkLit("3"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 3",
+ eq(stmts, new Statement[] {
+ x_BlankBarLit3
+ }));
+ XBlankNode b3 = (XBlankNode) UnoRuntime.queryInterface(
+ XBlankNode.class, stmts[0].Subject);
+
+ Statement x_BlankBarLit4 =
+ new Statement(blank2, bar, mkLit("4"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 4",
+ eq(stmts, new Statement[] {
+ x_BlankBarLit4
+ }));
+ XBlankNode b4 = (XBlankNode) UnoRuntime.queryInterface(
+ XBlankNode.class, stmts[0].Subject);
+
+ Statement x_BlankBarLit5 =
+ new Statement(blank1, bar, mkLit("5"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 5",
+ eq(stmts, new Statement[] {
+ x_BlankBarLit5
+ }));
+ XBlankNode b5 = (XBlankNode) UnoRuntime.queryInterface(
+ XBlankNode.class, stmts[0].Subject);
+
+ assure("RDFa: 3 != 4",
+ !b3.getStringValue().equals(b4.getStringValue()));
+ assure("RDFa: 3 == 5",
+ b3.getStringValue().equals(b5.getStringValue()));
+
+ Statement x_FooBarLit6 = new Statement(foo, bar, mkLit("6"), null);
+ Statement x_FooBazLit6 = new Statement(foo, baz, mkLit("6"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 6",
+ eq(stmts, new Statement[] {
+ x_FooBarLit6, x_FooBazLit6
+ }));
+
+ Statement x_FooBarLit7 = new Statement(foo, bar, mkLit("7"), null);
+ Statement x_FooBazLit7 = new Statement(foo, baz, mkLit("7"), null);
+ Statement x_FooFooLit7 = new Statement(foo, foo, mkLit("7"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 7",
+ eq(stmts, new Statement[] {
+ x_FooBarLit7, x_FooBazLit7, x_FooFooLit7
+ }));
+
+ XNode lit = mkLit("a fooish bar");
+ XNode lit_type= mkLit("a fooish bar", bar);
+ Statement x_FooBarLit = new Statement(foo, bar, lit, null);
+ Statement x_FooBarLittype = new Statement(foo, bar, lit_type, null);
+
+ Statement x_FooLabelLit8 =
+ new Statement(foo, rdfs_label, mkLit("8"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 8",
+ eq(stmts, new Statement[] {
+ x_FooBarLit, x_FooLabelLit8
+ }));
+
+ Statement x_FooLabelLit9 =
+ new Statement(foo, rdfs_label, mkLit("9"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 9",
+ eq(stmts, new Statement[] {
+ x_FooBarLit, x_FooLabelLit9
+ }));
+
+ Statement x_FooLabelLit10 =
+ new Statement(foo, rdfs_label, mkLit("10"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 10",
+ eq(stmts, new Statement[] {
+ x_FooBarLittype, x_FooLabelLit10
+ }));
+
+ Statement x_FooBarLit11
+ = new Statement(foo, bar, mkLit("11", bar), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 11",
+ eq(stmts, new Statement[] {
+ x_FooBarLit11
+ }));
+
+ XURI xFile = URI.createNS(xContext, file, "/" + contentPath);
+ Statement x_FileBarLit12 =
+ new Statement(xFile, bar, mkLit("12"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 12",
+ eq(stmts, new Statement[] {
+ x_FileBarLit12
+ }));
+
+ Statement x_FooLabelLit13 =
+ new Statement(foo, rdfs_label, mkLit("13"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 13",
+ eq(stmts, new Statement[] {
+ x_FooBarLit, x_FooLabelLit13
+ }));
+
+ Statement x_FooLabelLit14 =
+ new Statement(foo, rdfs_label, mkLit("14"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 14",
+ eq(stmts, new Statement[] {
+ x_FooBarLit, x_FooLabelLit14
+ }));
+
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 15", eq(stmts, new Statement[] { } ));
+
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 16", eq(stmts, new Statement[] { } ));
+
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 17", eq(stmts, new Statement[] { } ));
+
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 18", eq(stmts, new Statement[] { } ));
+
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 19", eq(stmts, new Statement[] { } ));
+
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 20", eq(stmts, new Statement[] { } ));
+
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 21", eq(stmts, new Statement[] { } ));
+
+ log.println("...done");
+
+ } catch (Exception e) {
+ report(e);
+ close(xComp);
+ }
+ return xComp;
+ }
+
+
+// utilities -------------------------------------------------------------
+
+ public void report2(Exception e)
+ {
+ if (e instanceof WrappedTargetException)
+ {
+ log.println("Cause:");
+ Exception cause = (Exception)
+ (((WrappedTargetException)e).TargetException);
+ log.println(cause.toString());
+ report2(cause);
+ } else if (e instanceof WrappedTargetRuntimeException) {
+ log.println("Cause:");
+ Exception cause = (Exception)
+ (((WrappedTargetRuntimeException)e).TargetException);
+ log.println(cause.toString());
+ report2(cause);
+ }
+ }
+
+ public void report(Exception e) {
+ log.println("Exception occurred:");
+ e.printStackTrace((java.io.PrintWriter) log);
+ report2(e);
+ failed();
+ }
+
+ static void close(XComponent i_comp)
+ {
+ try {
+ XCloseable xClos = (XCloseable) UnoRuntime.queryInterface(
+ XCloseable.class, i_comp);
+ if (xClos != null) xClos.close(true);
+ } catch (Exception e) {
+ }
+ }
+
+ XLiteral mkLit(String i_content)
+ {
+ return Literal.create(xContext, i_content);
+ }
+
+ XLiteral mkLit(String i_content, XURI i_uri)
+ {
+ return Literal.createWithType(xContext, i_content, i_uri);
+ }
+
+ static Statement[] merge(Statement[] i_A1, Statement[] i_A2)
+ {
+ // bah, java sucks...
+ Statement[] ret = new Statement[i_A1.length + i_A2.length];
+ for (int i = 0; i < i_A1.length; ++i) {
+ ret[i] = i_A1[i];
+ }
+ for (int i = 0; i < i_A2.length; ++i) {
+ ret[i+i_A1.length] = i_A2[i];
+ }
+ return ret;
+ }
+
+ public static String toS(XNode n) {
+ if (null == n) return "< null >";
+ return n.getStringValue();
+ }
+
+ static boolean isBlank(XNode i_node)
+ {
+ XBlankNode blank = (XBlankNode) UnoRuntime.queryInterface(
+ XBlankNode.class, i_node);
+ return blank != null;
+ }
+
+/*
+ static class Statement implements XStatement
+ {
+ XResource m_Subject;
+ XResource m_Predicate;
+ XNode m_Object;
+ XURI m_Graph;
+
+ Statement(XResource i_Subject, XResource i_Predicate, XNode i_Object,
+ XURI i_Graph)
+ {
+ m_Subject = i_Subject;
+ m_Predicate = i_Predicate;
+ m_Object = i_Object;
+ m_Graph = i_Graph;
+ }
+
+ public XResource getSubject() { return m_Subject; }
+ public XResource getPredicate() { return m_Predicate; }
+ public XNode getObject() { return m_Object; }
+ public XURI getGraph() { return m_Graph; }
+ }
+*/
+
+ static Statement[] toSeq(XEnumeration i_Enum) throws Exception
+ {
+ java.util.Collection c = new java.util.Vector();
+ while (i_Enum.hasMoreElements()) {
+ Statement s = (Statement) i_Enum.nextElement();
+//log.println("toSeq: " + s.getSubject().getStringValue() + " " + s.getPredicate().getStringValue() + " " + s.getObject().getStringValue() + ".");
+ c.add(s);
+ }
+// return (Statement[]) c.toArray();
+ // java sucks
+ Object[] arr = c.toArray();
+ Statement[] ret = new Statement[arr.length];
+ for (int i = 0; i < arr.length; ++i) {
+ ret[i] = (Statement) arr[i];
+ }
+ return ret;
+ }
+
+ static XNode[][] toSeqs(XEnumeration i_Enum) throws Exception
+ {
+ java.util.Collection c = new java.util.Vector();
+ while (i_Enum.hasMoreElements()) {
+ XNode[] s = (XNode[]) i_Enum.nextElement();
+ c.add(s);
+ }
+// return (XNode[][]) c.toArray();
+ Object[] arr = c.toArray();
+ XNode[][] ret = new XNode[arr.length][];
+ for (int i = 0; i < arr.length; ++i) {
+ ret[i] = (XNode[]) arr[i];
+ }
+ return ret;
+ }
+
+ static class BindingComp implements java.util.Comparator
+ {
+ public int compare(Object i_Left, Object i_Right)
+ {
+ XNode[] left = (XNode[]) i_Left;
+ XNode[] right = (XNode[]) i_Right;
+ if (left.length != right.length) throw new RuntimeException();
+ for (int i = 0; i < left.length; ++i) {
+ int eq = (left[i].getStringValue().compareTo(
+ right[i].getStringValue()));
+ if (eq != 0) return eq;
+ }
+ return 0;
+ }
+ }
+
+ static class StmtComp implements java.util.Comparator
+ {
+ public int compare(Object i_Left, Object i_Right)
+ {
+ int eq;
+ Statement left = (Statement) i_Left;
+ Statement right = (Statement) i_Right;
+ if ((eq = cmp(left.Graph, right.Graph )) != 0) return eq;
+ if ((eq = cmp(left.Subject, right.Subject )) != 0) return eq;
+ if ((eq = cmp(left.Predicate, right.Predicate)) != 0) return eq;
+ if ((eq = cmp(left.Object, right.Object )) != 0) return eq;
+ return 0;
+ }
+
+ public int cmp(XNode i_Left, XNode i_Right)
+ {
+ if (isBlank(i_Left)) {
+ return isBlank(i_Right) ? 0 : 1;
+ } else {
+ if (isBlank(i_Right)) {
+ return -1;
+ } else {
+ return toS(i_Left).compareTo(toS(i_Right));
+ }
+ }
+ }
+ }
+
+ static boolean eq(Statement i_Left, Statement i_Right)
+ {
+ XURI lG = i_Left.Graph;
+ XURI rG = i_Right.Graph;
+ if (!eq(lG, rG)) {
+ log.println("Graphs differ: " + toS(lG) + " != " + toS(rG));
+ return false;
+ }
+ if (!eq(i_Left.Subject, i_Right.Subject)) {
+ log.println("Subjects differ: " +
+ i_Left.Subject.getStringValue() + " != " +
+ i_Right.Subject.getStringValue());
+ return false;
+ }
+ if (!eq(i_Left.Predicate, i_Right.Predicate)) {
+ log.println("Predicates differ: " +
+ i_Left.Predicate.getStringValue() + " != " +
+ i_Right.Predicate.getStringValue());
+ return false;
+ }
+ if (!eq(i_Left.Object, i_Right.Object)) {
+ log.println("Objects differ: " +
+ i_Left.Object.getStringValue() + " != " +
+ i_Right.Object.getStringValue());
+ return false;
+ }
+ return true;
+ }
+
+ static boolean eq(Statement[] i_Result, Statement[] i_Expected)
+ {
+ if (i_Result.length != i_Expected.length) {
+ log.println("eq: different lengths: " + i_Result.length + " " +
+ i_Expected.length);
+ return false;
+ }
+ Statement[] expected = (Statement[])
+ java.util.Arrays.asList(i_Expected).toArray();
+ java.util.Arrays.sort(i_Result, new StmtComp());
+ java.util.Arrays.sort(expected, new StmtComp());
+ for (int i = 0; i < expected.length; ++i) {
+ if (!eq(i_Result[i], expected[i])) return false;
+ }
+ return true;
+ }
+
+ static boolean eq(XEnumeration i_Enum, Statement[] i_Expected)
+ throws Exception
+ {
+ Statement[] current = toSeq(i_Enum);
+ return eq(current, i_Expected);
+ }
+
+ static boolean eq(XNode i_Left, XNode i_Right)
+ {
+ if (i_Left == null) {
+ return (i_Right == null);
+ } else {
+ return (i_Right != null) &&
+ (i_Left.getStringValue().equals(i_Right.getStringValue())
+ // FIXME: hack: blank nodes considered equal
+ || (isBlank(i_Left) && isBlank(i_Right)));
+ }
+ }
+
+ static boolean eq(XQuerySelectResult i_Result,
+ String[] i_Vars, XNode[][] i_Bindings) throws Exception
+ {
+ String[] vars = (String[]) i_Result.getBindingNames();
+ XEnumeration iter = (XEnumeration) i_Result;
+ XNode[][] bindings = toSeqs(iter);
+ if (vars.length != i_Vars.length) {
+ log.println("var lengths differ");
+ return false;
+ }
+ if (bindings.length != i_Bindings.length) {
+ log.println("binding lengths differ: " + i_Bindings.length +
+ " vs " + bindings.length );
+ return false;
+ }
+ java.util.Arrays.sort(bindings, new BindingComp());
+ java.util.Arrays.sort(i_Bindings, new BindingComp());
+ for (int i = 0; i < i_Bindings.length; ++i) {
+ if (i_Bindings[i].length != i_Vars.length) {
+ log.println("TEST ERROR!");
+ throw new Exception();
+ }
+ if (bindings[i].length != i_Vars.length) {
+ log.println("binding length and var length differ");
+ return false;
+ }
+ for (int j = 0; j < i_Vars.length; ++j) {
+ if (!eq(bindings[i][j], i_Bindings[i][j])) {
+ log.println("bindings differ: " +
+ toS(bindings[i][j]) + " != " + toS(i_Bindings[i][j]));
+ return false;
+ }
+ }
+ }
+ for (int i = 0; i < i_Vars.length; ++i) {
+ if (!vars[i].equals(i_Vars[i])) {
+ log.println("variable names differ: " +
+ vars[i] + " != " + i_Vars[i]);
+ return false;
+ }
+ }
+ return true;
+ }
+
+ static boolean eq(StringPair i_Left, StringPair i_Right)
+ {
+ return ((i_Left.First).equals(i_Right.First)) &&
+ ((i_Left.Second).equals(i_Right.Second));
+ }
+
+ static String mkNamespace(String i_prefix, String i_namespace)
+ {
+ return "PREFIX " + i_prefix + ": <" + i_namespace + ">\n";
+ }
+
+ static String mkNss()
+ {
+ String namespaces = mkNamespace("rdf",
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
+ namespaces += mkNamespace("pkg",
+ "http://docs.oasis-open.org/opendocument/meta/package/common#");
+ namespaces += mkNamespace("odf",
+ "http://docs.oasis-open.org/opendocument/meta/package/odf#");
+ return namespaces;
+ }
+
+ Statement[] getManifestStmts(XURI xBaseURI) throws Exception
+ {
+ XURI xManifest = URI.createNS(xContext, xBaseURI.getStringValue(),
+ manifestPath);
+ XURI xContent = URI.createNS(xContext, xBaseURI.getStringValue(),
+ contentPath);
+ XURI xStyles = URI.createNS(xContext, xBaseURI.getStringValue(),
+ stylesPath);
+ Statement xM_BaseTypeDoc =
+ new Statement(xBaseURI, rdf_type, pkg_Document, xManifest);
+ Statement xM_BaseHaspartContent =
+ new Statement(xBaseURI, pkg_hasPart, xContent, xManifest);
+ Statement xM_BaseHaspartStyles =
+ new Statement(xBaseURI, pkg_hasPart, xStyles, xManifest);
+ Statement xM_ContentTypeContent =
+ new Statement(xContent, rdf_type, odf_ContentFile, xManifest);
+ Statement xM_StylesTypeStyles =
+ new Statement(xStyles, rdf_type, odf_StylesFile, xManifest);
+ return new Statement[] {
+ xM_BaseTypeDoc, xM_BaseHaspartContent, xM_BaseHaspartStyles,
+ xM_ContentTypeContent, xM_StylesTypeStyles
+ };
+ }
+
+ Statement[] getMetadataFileStmts(XURI xBaseURI, String Path)
+ throws Exception
+ {
+ XURI xManifest = URI.createNS(xContext, xBaseURI.getStringValue(),
+ manifestPath);
+ XURI xGraph = URI.createNS(xContext, xBaseURI.getStringValue(), Path);
+ Statement xM_BaseHaspartGraph =
+ new Statement(xBaseURI, pkg_hasPart, xGraph, xManifest);
+ Statement xM_GraphTypeMetadata =
+ new Statement(xGraph, rdf_type, pkg_MetadataFile, xManifest);
+ return new Statement[] { xM_BaseHaspartGraph, xM_GraphTypeMetadata };
+ }
+
+ class TestRange implements XTextRange, XMetadatable, XServiceInfo
+ {
+ String m_Stream;
+ String m_XmlId;
+ String m_Text;
+ TestRange(String i_Str) { m_Text = i_Str; }
+
+ public String getStringValue() { return ""; }
+ public String getNamespace() { return ""; }
+ public String getLocalName() { return ""; }
+
+ public StringPair getMetadataReference()
+ { return new StringPair(m_Stream, m_XmlId); }
+ public void setMetadataReference(StringPair i_Ref)
+ throws IllegalArgumentException
+ { m_Stream = (String)i_Ref.First; m_XmlId = (String)i_Ref.Second; }
+ public void ensureMetadataReference()
+ { m_Stream = "content.xml"; m_XmlId = "42"; }
+
+ public String getImplementationName() { return null; }
+ public String[] getSupportedServiceNames() { return null; }
+ public boolean supportsService(String i_Svc)
+ { return i_Svc.equals("com.sun.star.text.Paragraph"); }
+
+ public XText getText() { return null; }
+ public XTextRange getStart() { return null; }
+ public XTextRange getEnd() { return null; }
+ public String getString() { return m_Text; }
+ public void setString(String i_Str) { m_Text = i_Str; }
+ }
+}
+
diff --git a/sfx2/qa/complex/makefile.mk b/sfx2/qa/complex/makefile.mk
index 102c641f2732..5c0006df9e04 100644
--- a/sfx2/qa/complex/makefile.mk
+++ b/sfx2/qa/complex/makefile.mk
@@ -42,7 +42,9 @@ PACKAGE = complex$/framework
JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
JAVAFILES = CheckGlobalEventBroadcaster_writer1.java \
- DocumentMetaData.java
+ DocumentMetaData.java \
+ DocumentMetadataAccessTest.java
+
JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
SUBDIRS = DocHelper
diff --git a/sfx2/qa/complex/testdocuments/TESTRDFA.odt b/sfx2/qa/complex/testdocuments/TESTRDFA.odt
new file mode 100644
index 000000000000..d59739142df6
--- /dev/null
+++ b/sfx2/qa/complex/testdocuments/TESTRDFA.odt
Binary files differ
diff --git a/sfx2/qa/complex/tests.sce b/sfx2/qa/complex/tests.sce
index e95f6db8848d..c38852927ede 100644
--- a/sfx2/qa/complex/tests.sce
+++ b/sfx2/qa/complex/tests.sce
@@ -1,2 +1,3 @@
-o complex.framework.DocumentMetaData
+-o complex.framework.DocumentMetadataAccessTest
#-o complex.framework.CheckGlobalEventBroadcaster_writer1
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index b8597d853ddd..32db454b17e5 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -8777,3 +8777,29 @@ SfxBoolItem DockingWindow9 SID_DOCKWIN_9
ToolBoxConfig = FALSE,
GroupId = GID_APPLICATION;
]
+
+//--------------------------------------------------------------------------
+SfxInt16Item PasteUnformatted SID_PASTE_UNFORMATTED
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Volatile,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
diff --git a/sfx2/sdi/sfxslots.sdi b/sfx2/sdi/sfxslots.sdi
index c7667f36c02e..27336865be73 100644
--- a/sfx2/sdi/sfxslots.sdi
+++ b/sfx2/sdi/sfxslots.sdi
@@ -88,14 +88,6 @@ TypeLibFile( "sfxslots.tlb" )
INT32 AutoReloadTime MID_DOCINFO_AUTOLOADSECS;
String AutoReloadURL MID_DOCINFO_AUTOLOADURL;
String AutoReloadFrame MID_DOCINFO_DEFAULTTARGET;
- String Field1Title MID_DOCINFO_FIELD1TITLE;
- String Field2Title MID_DOCINFO_FIELD2TITLE;
- String Field3Title MID_DOCINFO_FIELD3TITLE;
- String Field4Title MID_DOCINFO_FIELD4TITLE;
- String Field1 MID_DOCINFO_FIELD1;
- String Field2 MID_DOCINFO_FIELD2;
- String Field3 MID_DOCINFO_FIELD3;
- String Field4 MID_DOCINFO_FIELD4;
};
item DocInfo SfxDocumentInfoItem;
diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx
index b7f0ab91feee..d74bbd0961d9 100644
--- a/sfx2/source/appl/app.cxx
+++ b/sfx2/source/appl/app.cxx
@@ -460,6 +460,14 @@ void SfxApplication::SetLastDir_Impl
//--------------------------------------------------------------------
+void SfxApplication::ResetLastDir()
+{
+ String aEmpty;
+ pAppData_Impl->aLastDir = aEmpty;
+}
+
+//--------------------------------------------------------------------
+
SfxDispatcher* SfxApplication::GetDispatcher_Impl()
{
return pAppData_Impl->pViewFrame? pAppData_Impl->pViewFrame->GetDispatcher(): pAppData_Impl->pAppDispat;
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx
index 89314944c18d..60beac537e53 100644
--- a/sfx2/source/appl/childwin.cxx
+++ b/sfx2/source/appl/childwin.cxx
@@ -807,6 +807,9 @@ sal_Bool SfxChildWindow::QueryClose()
bAllow = xCtrl->suspend( sal_True );
}
+ if ( bAllow )
+ bAllow = !GetWindow()->IsInModalMode();
+
return bAllow;
}
diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx
index 3dddea833123..995b8250e072 100644
--- a/sfx2/source/appl/shutdownicon.cxx
+++ b/sfx2/source/appl/shutdownicon.cxx
@@ -495,8 +495,12 @@ IMPL_STATIC_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, EMPTYAR
}
#ifdef WNT
- LeaveModalMode();
+ // #103346 Destroy dialog to prevent problems with custom controls
+ delete pThis->m_pFileDlg;
+ pThis->m_pFileDlg = NULL;
#endif
+
+ LeaveModalMode();
return 0;
}
diff --git a/sfx2/source/bastyp/progress.cxx b/sfx2/source/bastyp/progress.cxx
index 22a3be63dc19..62bc5533e1a9 100644
--- a/sfx2/source/bastyp/progress.cxx
+++ b/sfx2/source/bastyp/progress.cxx
@@ -117,7 +117,7 @@ struct SfxProgress_Impl : public SfxCancellable
#define aTypeLibInfo aProgressTypeLibImpl
//========================================================================
-#if (_MSC_VER < 1300)
+#if defined(_MSC_VER) && (_MSC_VER < 1300)
inline ULONG Get10ThSec()
{
#if defined (MSC) && defined (WIN)
diff --git a/sfx2/source/bastyp/sfxhtml.cxx b/sfx2/source/bastyp/sfxhtml.cxx
index 4e69228de644..13a75eb05693 100644
--- a/sfx2/source/bastyp/sfxhtml.cxx
+++ b/sfx2/source/bastyp/sfxhtml.cxx
@@ -37,7 +37,6 @@
#include <sfx2/docfile.hxx>
#include "openflag.hxx"
-#include <comphelper/string.hxx>
#include <svtools/htmlkywd.hxx>
#include <svtools/htmltokn.h>
#include <svtools/imap.hxx>
@@ -50,15 +49,13 @@
#include <svtools/svstdarr.hxx>
#endif
#include <svtools/zforlist.hxx>
-#include <svtools/inettype.hxx>
#include <rtl/tencinfo.h>
#include <tools/tenccvt.hxx>
#include <sfx2/sfxhtml.hxx>
-#include <com/sun/star/document/XDocumentProperties.hpp>
#include <com/sun/star/beans/XPropertyContainer.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
+
using namespace ::com::sun::star;
@@ -67,20 +64,6 @@ sal_Char __FAR_DATA sHTML_MIME_text[] = "text/";
sal_Char __FAR_DATA sHTML_MIME_application[] = "application/";
sal_Char __FAR_DATA sHTML_MIME_experimental[] = "x-";
-#define HTML_META_NONE 0
-#define HTML_META_AUTHOR 1
-#define HTML_META_DESCRIPTION 2
-#define HTML_META_KEYWORDS 3
-#define HTML_META_REFRESH 4
-#define HTML_META_CLASSIFICATION 5
-#define HTML_META_CREATED 6
-#define HTML_META_CHANGEDBY 7
-#define HTML_META_CHANGED 8
-#define HTML_META_GENERATOR 9
-#define HTML_META_SDFOOTNOTE 10
-#define HTML_META_SDENDNOTE 11
-#define HTML_META_CONTENT_TYPE 12
-
// <INPUT TYPE=xxx>
#ifdef __MINGW32__ // for runtime pseudo reloc
static HTMLOptionEnum aAreaShapeOptEnums[] =
@@ -97,28 +80,6 @@ static HTMLOptionEnum __READONLY_DATA aAreaShapeOptEnums[] =
{ 0, 0 }
};
-// <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 },
- { OOO_STRING_SVTOOLS_HTML_META_changedby, HTML_META_CHANGEDBY },
- { OOO_STRING_SVTOOLS_HTML_META_classification,HTML_META_CLASSIFICATION},
- { OOO_STRING_SVTOOLS_HTML_META_content_type, HTML_META_CONTENT_TYPE },
- { OOO_STRING_SVTOOLS_HTML_META_created, HTML_META_CREATED },
- { OOO_STRING_SVTOOLS_HTML_META_description, HTML_META_DESCRIPTION },
- { OOO_STRING_SVTOOLS_HTML_META_keywords, HTML_META_KEYWORDS },
- { OOO_STRING_SVTOOLS_HTML_META_generator, HTML_META_GENERATOR },
- { OOO_STRING_SVTOOLS_HTML_META_refresh, HTML_META_REFRESH },
- { OOO_STRING_SVTOOLS_HTML_META_sdendnote, HTML_META_SDENDNOTE },
- { OOO_STRING_SVTOOLS_HTML_META_sdfootnote, HTML_META_SDFOOTNOTE },
- { 0, 0 }
-};
-
SfxHTMLParser::SfxHTMLParser( SvStream& rStream, BOOL bIsNewDoc,
SfxMedium *pMed ) :
HTMLParser( rStream, bIsNewDoc ),
@@ -288,169 +249,6 @@ IMAPOBJ_SETEVENT:
return bNewArea;
}
-BOOL SfxHTMLParser::ParseMetaOptions(
- const uno::Reference<document::XDocumentProperties> & i_xDocProps,
- SvKeyValueIterator *pHTTPHeader,
- const HTMLOptions *pOptions,
- rtl_TextEncoding& rEnc )
-{
- String aName, aContent;
- USHORT nAction = HTML_META_NONE;
- BOOL bHTTPEquiv = FALSE, bChanged = FALSE;
-
- for( USHORT i = pOptions->Count(); i; )
- {
- const HTMLOption *pOption = (*pOptions)[ --i ];
- switch( pOption->GetToken() )
- {
- case HTML_O_NAME:
- aName = pOption->GetString();
- if( HTML_META_NONE==nAction )
- pOption->GetEnum( nAction, aHTMLMetaNameTable );
- break;
- case HTML_O_HTTPEQUIV:
- aName = pOption->GetString();
- pOption->GetEnum( nAction, aHTMLMetaNameTable );
- bHTTPEquiv = TRUE;
- break;
- case HTML_O_CONTENT:
- aContent = pOption->GetString();
- break;
- }
- }
-
- if( bHTTPEquiv || HTML_META_DESCRIPTION!=nAction )
- {
- // wenn's keine Description ist CRs und LFs aus dem CONTENT entfernen
- aContent.EraseAllChars( _CR );
- aContent.EraseAllChars( _LF );
- }
- else
- {
- // fuer die Beschreibung die Zeilen-Umbrueche entsprechen wandeln
- aContent.ConvertLineEnd();
- }
-
-
- if( bHTTPEquiv && pHTTPHeader )
- {
- // #57232#: Netscape scheint ein abschliessendes " einfach zu
- // ignorieren, also tun wir das auch.
- if( aContent.Len() && '"' == aContent.GetChar( aContent.Len()-1 ) )
- aContent.Erase( aContent.Len() - 1 );
- SvKeyValue aKeyValue( aName, aContent );
- pHTTPHeader->Append( aKeyValue );
- }
-
- switch( nAction )
- {
- case HTML_META_AUTHOR:
- if (i_xDocProps.is()) {
- i_xDocProps->setAuthor( aContent );
- bChanged = TRUE;
- }
- break;
- case HTML_META_DESCRIPTION:
- if (i_xDocProps.is()) {
- i_xDocProps->setDescription( aContent );
- bChanged = TRUE;
- }
- break;
- case HTML_META_KEYWORDS:
- if (i_xDocProps.is()) {
- i_xDocProps->setKeywords(
- ::comphelper::string::convertCommaSeparated(aContent));
- bChanged = TRUE;
- }
- break;
- case HTML_META_CLASSIFICATION:
- if (i_xDocProps.is()) {
- i_xDocProps->setSubject( aContent );
- bChanged = TRUE;
- }
- break;
-
- case HTML_META_CHANGEDBY:
- if (i_xDocProps.is()) {
- i_xDocProps->setModifiedBy( aContent );
- bChanged = TRUE;
- }
- break;
-
- case HTML_META_CREATED:
- case HTML_META_CHANGED:
- if( i_xDocProps.is() && aContent.Len() && aContent.GetTokenCount()==2 )
- {
- Date aDate( (ULONG)aContent.GetToken(0).ToInt32() );
- Time aTime( (ULONG)aContent.GetToken(1).ToInt32() );
- DateTime aDateTime( aDate, aTime );
- ::util::DateTime uDT(aDateTime.Get100Sec(),
- aDateTime.GetSec(), aDateTime.GetMin(),
- aDateTime.GetHour(), aDateTime.GetDay(),
- aDateTime.GetMonth(), aDateTime.GetYear());
- if( HTML_META_CREATED==nAction )
- i_xDocProps->setCreationDate( uDT );
- else
- i_xDocProps->setModificationDate( uDT );
- bChanged = TRUE;
- }
- break;
-
- case HTML_META_REFRESH:
- DBG_ASSERT( !bHTTPEquiv || pHTTPHeader,
- "Reload-URL aufgrund unterlsassener MUSS-Aenderung verlorengegangen" );
- break;
-
- case HTML_META_CONTENT_TYPE:
- if( aContent.Len() )
- rEnc = GetEncodingByMIME( aContent );
- bChanged = TRUE;
- break;
-
- case HTML_META_NONE:
- if( !bHTTPEquiv )
- {
- if (i_xDocProps.is()) {
- uno::Reference<beans::XPropertyContainer> xUDProps
- = i_xDocProps->getUserDefinedProperties();
- try {
- xUDProps->addProperty(aName,
- beans::PropertyAttribute::REMOVEABLE,
- uno::makeAny(::rtl::OUString(aContent)));
- bChanged = TRUE;
- } catch (uno::Exception &) {
- // ignore
- }
- }
- }
- break;
- }
-
- return bChanged;
-}
-
-BOOL SfxHTMLParser::ParseMetaOptions(
- const uno::Reference<document::XDocumentProperties> & i_xDocProps,
- SvKeyValueIterator *pHeader )
-{
- USHORT nContentOption = HTML_O_CONTENT;
- rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW;
-
- BOOL bRet = ParseMetaOptions( i_xDocProps, pHeader,
- GetOptions(&nContentOption),
- eEnc );
-
- // If the encoding is set by a META tag, it may only overwrite the
- // current encoding if both, the current and the new encoding, are 1-BYTE
- // encodings. Everything else cannot lead to reasonable results.
- if( RTL_TEXTENCODING_DONTKNOW != eEnc &&
- rtl_isOctetTextEncoding( eEnc ) &&
- rtl_isOctetTextEncoding( GetSrcEncoding() ) )
- SetSrcEncoding( eEnc );
-
- return bRet;
-}
-
void SfxHTMLParser::StartFileDownload( const String& rURL, int nToken,
SfxObjectShell *pSh )
@@ -559,24 +357,6 @@ IMPL_STATIC_LINK( SfxHTMLParser, FileDownloadDone, void*, EMPTYARG )
return 0;
}
-rtl_TextEncoding SfxHTMLParser::GetEncodingByMIME( const String& rMime )
-{
- ByteString sType;
- ByteString sSubType;
- INetContentTypeParameterList aParameters;
- ByteString sMime( rMime, RTL_TEXTENCODING_ASCII_US );
- if (INetContentTypes::parse(sMime, sType, sSubType, &aParameters))
- {
- const INetContentTypeParameter * pCharset
- = aParameters.find("charset");
- if (pCharset != 0)
- {
- ByteString sValue( pCharset->m_sValue, RTL_TEXTENCODING_ASCII_US );
- return GetExtendedCompatibilityTextEncoding(rtl_getTextEncodingFromMimeCharset( sValue.GetBuffer() ) );
- }
- }
- return RTL_TEXTENCODING_DONTKNOW;
-}
rtl_TextEncoding SfxHTMLParser::GetEncodingByHttpHeader( SvKeyValueIterator *pHTTPHeader )
{
rtl_TextEncoding eRet = RTL_TEXTENCODING_DONTKNOW;
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index 1c893d7f32f2..f57ca40e8519 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -270,8 +270,6 @@ int SfxDispatcher::Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest
}
}
- SfxBindings *pBindings = GetBindings();
-
// Alles holen, was gebraucht wird, da der Slot den Execute evtl. nicht
// "uberlebt, falls es ein 'Pseudoslot' f"ur Macros oder Verben ist
sal_Bool bAutoUpdate = rSlot.IsMode(SFX_SLOT_AUTOUPDATE);
@@ -308,9 +306,17 @@ int SfxDispatcher::Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest
// falls 'this' noch lebt
if ( bThisDispatcherAlive )
pImp->pInCallAliveFlag = pOldInCallAliveFlag;
- else if ( pOldInCallAliveFlag )
- // auch verschachtelte Stack-Frames sch"utzen
- *pOldInCallAliveFlag = sal_False;
+ else
+ {
+ if ( pOldInCallAliveFlag )
+ {
+ // auch verschachtelte Stack-Frames sch"utzen
+ *pOldInCallAliveFlag = sal_False;
+ }
+
+ // do nothing after this object is dead
+ return rReq.IsDone();
+ }
}
// TabPage-ID und Executing-SID zurueck setzen
@@ -325,6 +331,8 @@ int SfxDispatcher::Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest
if ( rReq.IsDone() )
{
+ SfxBindings *pBindings = GetBindings();
+
// bei AutoUpdate sofort updaten; "Pseudoslots" d"urfen nicht
// Autoupdate sein!
if ( bAutoUpdate && pBindings )
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 64aa1a7d9d26..190cc47dc2f6 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -765,6 +765,8 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util
sal_Bool bFailure = sal_False;
const SfxPoolItem* pItem = NULL;
SfxShell* pShell( 0 );
+ // #i102619# Retrieve metric from shell before execution - the shell could be destroyed after execution
+ SfxMapUnit eMapUnit( SFX_MAPUNIT_100TH_MM );
if ( pDispatcher->GetBindings() )
{
if ( !pDispatcher->IsLocked( GetId() ) )
@@ -783,6 +785,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util
lNewArgs[nIndex].Value = makeAny( SfxDispatchController_Impl::getSlaveCommand( aDispatchURL ));
}
+ eMapUnit = GetCoreMetric( pShell->GetPool(), GetId() );
SfxAllItemSet aSet( pShell->GetPool() );
TransformParameters( GetId(), lNewArgs, aSet, pSlot );
if ( aSet.Count() )
@@ -811,6 +814,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util
}
else
{
+ eMapUnit = GetCoreMetric( SFX_APP()->GetPool(), GetId() );
// AppDispatcher
SfxAllItemSet aSet( SFX_APP()->GetPool() );
TransformParameters( GetId(), lNewArgs, aSet );
@@ -850,13 +854,6 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util
aEvent.Source = (::com::sun::star::frame::XDispatch*) pDispatch;
if ( bSuccess && pItem && !pItem->ISA(SfxVoidItem) )
{
- // Retrieve metric from pool to have correct sub ID when calling QueryValue
- SfxMapUnit eMapUnit( SFX_MAPUNIT_100TH_MM );
- if ( pShell )
- eMapUnit = GetCoreMetric( pShell->GetPool(), GetId() );
- else
- eMapUnit = GetCoreMetric( SFX_APP()->GetPool(), GetId() );
-
USHORT nSubId( 0 );
if ( eMapUnit == SFX_MAPUNIT_TWIP )
nSubId |= CONVERT_TWIPS;
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index cb442caa6f1f..6de52384a90c 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -223,9 +223,9 @@ SfxDocumentInfoItem::SfxDocumentInfoItem()
, m_Keywords()
, m_Subject()
, m_Title()
- , bHasTemplate( sal_True )
- , bDeleteUserData( sal_False )
- , bIsUseUserData( sal_True )
+ , m_bHasTemplate( sal_True )
+ , m_bDeleteUserData( sal_False )
+ , m_bUseUserData( sal_True )
{
}
@@ -253,9 +253,9 @@ SfxDocumentInfoItem::SfxDocumentInfoItem( const String& rFile,
i_xDocProps->getKeywords()) )
, m_Subject( i_xDocProps->getSubject() )
, m_Title( i_xDocProps->getTitle() )
- , bHasTemplate( TRUE )
- , bDeleteUserData( sal_False )
- , bIsUseUserData( bIs )
+ , m_bHasTemplate( sal_True )
+ , m_bDeleteUserData( sal_False )
+ , m_bUseUserData( bIs )
{
try
{
@@ -302,15 +302,10 @@ SfxDocumentInfoItem::SfxDocumentInfoItem( const SfxDocumentInfoItem& rItem )
, m_Keywords( rItem.getKeywords() )
, m_Subject( rItem.getSubject() )
, m_Title( rItem.getTitle() )
- , bHasTemplate( rItem.bHasTemplate )
- , bDeleteUserData( rItem.bDeleteUserData )
- , bIsUseUserData( rItem.bIsUseUserData )
+ , m_bHasTemplate( rItem.m_bHasTemplate )
+ , m_bDeleteUserData( rItem.m_bDeleteUserData )
+ , m_bUseUserData( rItem.m_bUseUserData )
{
- for (size_t i = 0; i < 4; ++i) {
- m_UserDefinedFieldTitles[i] = rItem.getUserDefinedFieldTitle(i);
- m_UserDefinedFieldValues[i] = rItem.getUserDefinedFieldValue(i);
- }
-
for ( sal_uInt32 i = 0; i < rItem.m_aCustomProperties.size(); i++ )
{
CustomProperty* pProp = new CustomProperty( rItem.m_aCustomProperties[i]->m_sName,
@@ -384,8 +379,9 @@ void SfxDocumentInfoItem::resetUserData(const ::rtl::OUString & i_rAuthor)
//------------------------------------------------------------------------
-void SfxDocumentInfoItem::updateDocumentInfo(
- const uno::Reference<document::XDocumentProperties>& i_xDocProps) const
+void SfxDocumentInfoItem::UpdateDocumentInfo(
+ const uno::Reference<document::XDocumentProperties>& i_xDocProps,
+ bool i_bDoNotUpdateUserDefined) const
{
if (isAutoloadEnabled()) {
i_xDocProps->setAutoloadSecs(getAutoloadDelay());
@@ -410,6 +406,15 @@ void SfxDocumentInfoItem::updateDocumentInfo(
i_xDocProps->setSubject(getSubject());
i_xDocProps->setTitle(getTitle());
+ // this is necessary in case of replaying a recorded macro:
+ // in this case, the macro may contain the 4 old user-defined DocumentInfo
+ // fields, but not any of the DocumentInfo properties;
+ // as a consequence, most of the UserDefined properties of the
+ // DocumentProperties would be summarily deleted here, which does not
+ // seem like a good idea.
+ if (i_bDoNotUpdateUserDefined)
+ return;
+
try
{
Reference< beans::XPropertyContainer > xContainer = i_xDocProps->getUserDefinedProperties();
@@ -442,24 +447,24 @@ void SfxDocumentInfoItem::updateDocumentInfo(
//------------------------------------------------------------------------
-BOOL SfxDocumentInfoItem::IsDeleteUserData() const
+sal_Bool SfxDocumentInfoItem::IsDeleteUserData() const
{
- return bDeleteUserData;
+ return m_bDeleteUserData;
}
-void SfxDocumentInfoItem::SetDeleteUserData( BOOL bSet )
+void SfxDocumentInfoItem::SetDeleteUserData( sal_Bool bSet )
{
- bDeleteUserData = bSet;
+ m_bDeleteUserData = bSet;
}
-BOOL SfxDocumentInfoItem::IsUseUserData() const
+sal_Bool SfxDocumentInfoItem::IsUseUserData() const
{
- return bIsUseUserData;
+ return m_bUseUserData;
}
-void SfxDocumentInfoItem::SetUseUserData( BOOL bSet )
+void SfxDocumentInfoItem::SetUseUserData( sal_Bool bSet )
{
- bIsUseUserData = bSet;
+ m_bUseUserData = bSet;
}
std::vector< CustomProperty* > SfxDocumentInfoItem::GetCustomProperties() const
@@ -488,38 +493,11 @@ void SfxDocumentInfoItem::AddCustomProperty( const ::rtl::OUString& sName, const
m_aCustomProperties.push_back( pProp );
}
-::rtl::OUString SfxDocumentInfoItem::getUserDefinedFieldTitle(size_t i_ix) const
-{
- DBG_ASSERT(i_ix < 4, "SfxDocumentInfoItem: invalid index");
- return m_UserDefinedFieldTitles[i_ix];
-}
-
-::rtl::OUString SfxDocumentInfoItem::getUserDefinedFieldValue(size_t i_ix) const
-{
- DBG_ASSERT(i_ix < 4, "SfxDocumentInfoItem: invalid index");
- return m_UserDefinedFieldValues[i_ix];
-}
-
-void SfxDocumentInfoItem::setUserDefinedFieldTitle(size_t i_ix,
- ::rtl::OUString i_val)
-{
- DBG_ASSERT(i_ix < 4, "SfxDocumentInfoItem: invalid index");
- m_UserDefinedFieldTitles[i_ix] = i_val;
-}
-
-void SfxDocumentInfoItem::setUserDefinedFieldValue(size_t i_ix,
- ::rtl::OUString i_val)
-{
- DBG_ASSERT(i_ix < 4, "SfxDocumentInfoItem: invalid index");
- m_UserDefinedFieldValues[i_ix] = i_val;
-}
-
sal_Bool SfxDocumentInfoItem::QueryValue( Any& rVal, BYTE nMemberId ) const
{
String aValue;
sal_Int32 nValue = 0;
sal_Bool bValue = sal_False;
- BOOL bField = FALSE;
BOOL bIsInt = FALSE;
BOOL bIsString = FALSE;
nMemberId &= ~CONVERT_TWIPS;
@@ -562,43 +540,6 @@ sal_Bool SfxDocumentInfoItem::QueryValue( Any& rVal, BYTE nMemberId ) const
bIsString = TRUE;
aValue = getTitle();
break;
- case MID_DOCINFO_FIELD1:
- case MID_DOCINFO_FIELD2:
- case MID_DOCINFO_FIELD3:
- case MID_DOCINFO_FIELD4:
- bField = TRUE;
- // no break here
- case MID_DOCINFO_FIELD1TITLE:
- case MID_DOCINFO_FIELD2TITLE:
- case MID_DOCINFO_FIELD3TITLE:
- case MID_DOCINFO_FIELD4TITLE:
- {
- bIsString = TRUE;
- USHORT nSub = MID_DOCINFO_FIELD1TITLE;
- if ( bField )
- {
- nSub = MID_DOCINFO_FIELD1;
- }
- if ( bField )
- {
- DBG_ASSERT( nMemberId == MID_DOCINFO_FIELD1 ||
- nMemberId == MID_DOCINFO_FIELD2 ||
- nMemberId == MID_DOCINFO_FIELD3 ||
- nMemberId == MID_DOCINFO_FIELD4,
- "SfxDocumentInfoItem:Anpassungsfehler" );
- aValue = getUserDefinedFieldValue( nMemberId - nSub );
- }
- else
- {
- DBG_ASSERT( nMemberId == MID_DOCINFO_FIELD1TITLE ||
- nMemberId == MID_DOCINFO_FIELD2TITLE ||
- nMemberId == MID_DOCINFO_FIELD3TITLE ||
- nMemberId == MID_DOCINFO_FIELD4TITLE,
- "SfxDocumentInfoItem:Anpassungsfehler" );
- aValue = getUserDefinedFieldTitle( nMemberId - nSub );
- }
- break;
- }
default:
DBG_ERROR("Wrong MemberId!");
return sal_False;
@@ -673,28 +614,6 @@ sal_Bool SfxDocumentInfoItem::PutValue( const Any& rVal, BYTE nMemberId )
if ( bRet )
setTitle(aValue);
break;
- case MID_DOCINFO_FIELD1TITLE:
- case MID_DOCINFO_FIELD2TITLE:
- case MID_DOCINFO_FIELD3TITLE:
- case MID_DOCINFO_FIELD4TITLE:
- {
- bRet = (rVal >>= aValue);
- if ( bRet )
- setUserDefinedFieldTitle(
- nMemberId - MID_DOCINFO_FIELD1TITLE, String(aValue));
- break;
- }
- case MID_DOCINFO_FIELD1:
- case MID_DOCINFO_FIELD2:
- case MID_DOCINFO_FIELD3:
- case MID_DOCINFO_FIELD4:
- {
- bRet = (rVal >>= aValue);
- if ( bRet )
- setUserDefinedFieldValue(
- nMemberId - MID_DOCINFO_FIELD1, String(aValue));
- break;
- }
default:
DBG_ERROR("Wrong MemberId!");
return sal_False;
@@ -1178,7 +1097,7 @@ void SfxDocumentPage::Reset( const SfxItemSet& rSet )
aFileValFt.SetText( aURL.GetPartBeforeLastName() );
// handle access data
- BOOL bIsUseUserData = pInfoItem->IsUseUserData();
+ sal_Bool m_bUseUserData = pInfoItem->IsUseUserData();
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
aCreateValFt.SetText( ConvertDateTime_Impl( pInfoItem->getAuthor(),
pInfoItem->getCreationDate(), aLocaleWrapper ) );
@@ -1193,7 +1112,7 @@ void SfxDocumentPage::Reset( const SfxItemSet& rSet )
aPrintValFt.SetText( ConvertDateTime_Impl( pInfoItem->getPrintedBy(),
aTime, aLocaleWrapper ) );
const long nTime = pInfoItem->getEditingDuration();
- if( bIsUseUserData )
+ if ( m_bUseUserData )
{
const Time aT( nTime/3600, (nTime%3600)/60, nTime%60 );
aTimeLogValFt.SetText( aLocaleWrapper.getDuration( aT ) );
@@ -1201,7 +1120,7 @@ void SfxDocumentPage::Reset( const SfxItemSet& rSet )
pInfoItem->getEditingCycles() ) );
}
- TriState eState = (TriState)bIsUseUserData;
+ TriState eState = (TriState)m_bUseUserData;
if ( STATE_DONTKNOW == eState )
aUseUserDataCB.EnableTriState( TRUE );
@@ -1558,192 +1477,6 @@ int SfxInternetPage::DeactivatePage( SfxItemSet* /*pSet*/ )
//------------------------------------------------------------------------
-SfxDocumentUserPage::SfxDocumentUserPage( Window* pParent,
- const SfxItemSet& rItemSet ) :
-
- SfxTabPage( pParent, SfxResId( TP_DOCINFOUSER ), rItemSet ),
-
- bLabelModified ( FALSE ),
- aInfo1Ft ( this, SfxResId( FT_INFO1 ) ),
- aInfo1Ed ( this, SfxResId( ED_INFO1 ) ),
- aInfo2Ft ( this, SfxResId( FT_INFO2 ) ),
- aInfo2Ed ( this, SfxResId( ED_INFO2 ) ),
- aInfo3Ft ( this, SfxResId( FT_INFO3 ) ),
- aInfo3Ed ( this, SfxResId( ED_INFO3 ) ),
- aInfo4Ft ( this, SfxResId( FT_INFO4 ) ),
- aInfo4Ed ( this, SfxResId( ED_INFO4 ) ),
- aEditLabelBtn ( this, SfxResId( BTN_EDITLABEL ) ),
-
- pInfoItem ( NULL )
-
-{
- FreeResource();
- //increase button width in case of long labels
- Size aButtonSize = aEditLabelBtn.GetOutputSizePixel();
- sal_Int32 nTextWidth = aEditLabelBtn.GetTextWidth(aEditLabelBtn.GetText());
- //add some additional space
- sal_Int32 nDiff = nTextWidth + 4 - aButtonSize.Width();
- if( nDiff > 0)
- {
- Point aPos(aEditLabelBtn.GetPosPixel());
- aPos.X() -= nDiff;
- aButtonSize.Width() += nDiff;
- aEditLabelBtn.SetPosSizePixel(aPos, aButtonSize);
- }
-
- aEditLabelBtn.SetClickHdl( LINK( this, SfxDocumentUserPage, EditLabelHdl ) );
-}
-
-//------------------------------------------------------------------------
-
-IMPL_LINK( SfxDocumentUserPage, EditLabelHdl, PushButton *, pPushButton )
-{
- (void)pPushButton; //unused
- SfxDocInfoEditDlg* pDlg = new SfxDocInfoEditDlg( this );
- pDlg->SetText1( GetLabelText_Impl( &aInfo1Ft ) );
- pDlg->SetText2( GetLabelText_Impl( &aInfo2Ft ) );
- pDlg->SetText3( GetLabelText_Impl( &aInfo3Ft ) );
- pDlg->SetText4( GetLabelText_Impl( &aInfo4Ft ) );
-
- if ( RET_OK == pDlg->Execute() )
- {
- SetLabelText_Impl( &aInfo1Ft, pDlg->GetText1() );
- SetLabelText_Impl( &aInfo2Ft, pDlg->GetText2() );
- SetLabelText_Impl( &aInfo3Ft, pDlg->GetText3() );
- SetLabelText_Impl( &aInfo4Ft, pDlg->GetText4() );
- bLabelModified = TRUE;
- }
- delete pDlg;
- return 0;
-}
-
-//------------------------------------------------------------------------
-
-String SfxDocumentUserPage::GetLabelText_Impl( FixedText* pLabel )
-{
- DBG_ASSERT( pLabel, "SfxDocumentUserPage::SetLabelText_Impl(): invalid label" );
- String aLabel = pLabel->GetText();
- aLabel.Erase( 0, aLabel.Search( ' ' ) + 1 );
- return aLabel;
-}
-
-//------------------------------------------------------------------------
-
-void SfxDocumentUserPage::SetLabelText_Impl( FixedText* pLabel, const String& rNewLabel )
-{
- String aLabel( '~' );
- sal_Int32 nNumber = 0;
- if ( &aInfo1Ft == pLabel )
- nNumber = 1;
- else if ( &aInfo2Ft == pLabel )
- nNumber = 2;
- else if ( &aInfo3Ft == pLabel )
- nNumber = 3;
- else if ( &aInfo4Ft == pLabel )
- nNumber = 4;
- DBG_ASSERT( nNumber > 0, "SfxDocumentUserPage::SetLabelText_Impl(): wrong label" );
- aLabel += String::CreateFromInt32( nNumber );
- aLabel += String( DEFINE_CONST_UNICODE(": ") );
- aLabel += rNewLabel;
- DBG_ASSERT( pLabel, "SfxDocumentUserPage::SetLabelText_Impl(): invalid label" );
- pLabel->SetText( aLabel );
-}
-
-//------------------------------------------------------------------------
-
-SfxTabPage* SfxDocumentUserPage::Create( Window* pParent, const SfxItemSet& rItemSet )
-{
- return new SfxDocumentUserPage(pParent, rItemSet);
-}
-
-//------------------------------------------------------------------------
-
-BOOL SfxDocumentUserPage::FillItemSet( SfxItemSet& rSet )
-{
- const BOOL bMod = bLabelModified ||
- aInfo1Ed.IsModified() || aInfo2Ed.IsModified() ||
- aInfo3Ed.IsModified() || aInfo4Ed.IsModified();
- if ( !bMod )
- return FALSE;
-
- const SfxPoolItem* pItem = NULL;
- SfxDocumentInfoItem* pInfo = NULL;
- SfxTabDialog* pDlg = GetTabDialog();
- const SfxItemSet* pExSet = NULL;
-
- if ( pDlg )
- pExSet = pDlg->GetExampleSet();
-
- if ( pExSet && SFX_ITEM_SET != pExSet->GetItemState( SID_DOCINFO, TRUE, &pItem ) )
- pInfo = pInfoItem;
- else if ( pItem )
- pInfo = new SfxDocumentInfoItem( *(const SfxDocumentInfoItem*)pItem );
-
- if ( !pInfo )
- {
- DBG_ERRORFILE( "SfxDocumentUserPage::FillItemSet(): no item found" );
- return FALSE;
- }
-
- if ( bLabelModified || aInfo1Ed.IsModified() )
- {
- XubString aTitle = GetLabelText_Impl( &aInfo1Ft );
- pInfo->setUserDefinedFieldTitle( 0, aTitle );
- pInfo->setUserDefinedFieldValue( 0, aInfo1Ed.GetText() );
- }
- if ( bLabelModified || aInfo2Ed.IsModified() )
- {
- XubString aTitle = GetLabelText_Impl( &aInfo2Ft );
- pInfo->setUserDefinedFieldTitle( 1, aTitle );
- pInfo->setUserDefinedFieldValue( 1, aInfo2Ed.GetText() );
- }
- if ( bLabelModified || aInfo3Ed.IsModified() )
- {
- XubString aTitle = GetLabelText_Impl( &aInfo3Ft );
- pInfo->setUserDefinedFieldTitle( 2, aTitle );
- pInfo->setUserDefinedFieldValue( 2, aInfo3Ed.GetText() );
- }
- if ( bLabelModified || aInfo4Ed.IsModified() )
- {
- XubString aTitle = GetLabelText_Impl( &aInfo4Ft );
- pInfo->setUserDefinedFieldTitle( 3, aTitle );
- pInfo->setUserDefinedFieldValue( 3, aInfo4Ed.GetText() );
- }
- rSet.Put( *pInfo );
- if ( pInfo != pInfoItem )
- delete pInfo;
- return bMod;
-}
-
-//------------------------------------------------------------------------
-
-void SfxDocumentUserPage::Reset(const SfxItemSet &rSet)
-{
- pInfoItem = &(SfxDocumentInfoItem&)rSet.Get( SID_DOCINFO );
-
- SetLabelText_Impl( &aInfo1Ft, pInfoItem->getUserDefinedFieldTitle(0) );
- aInfo1Ed.SetText( pInfoItem->getUserDefinedFieldValue(0) );
- SetLabelText_Impl( &aInfo2Ft, pInfoItem->getUserDefinedFieldTitle(1) );
- aInfo2Ed.SetText( pInfoItem->getUserDefinedFieldValue(1) );
- SetLabelText_Impl( &aInfo3Ft, pInfoItem->getUserDefinedFieldTitle(2) );
- aInfo3Ed.SetText( pInfoItem->getUserDefinedFieldValue(2) );
- SetLabelText_Impl( &aInfo4Ft, pInfoItem->getUserDefinedFieldTitle(3) );
- aInfo4Ed.SetText( pInfoItem->getUserDefinedFieldValue(3) );
- bLabelModified = FALSE;
-
- SFX_ITEMSET_ARG( &rSet, pROItem, SfxBoolItem, SID_DOC_READONLY, FALSE );
- if ( pROItem && pROItem->GetValue() )
- {
- aInfo1Ed.SetReadOnly( TRUE );
- aInfo2Ed.SetReadOnly( TRUE );
- aInfo3Ed.SetReadOnly( TRUE );
- aInfo4Ed.SetReadOnly( TRUE );
- aEditLabelBtn.Disable();
- }
-}
-
-//------------------------------------------------------------------------
-
SfxDocumentInfoDialog::SfxDocumentInfoDialog( Window* pParent,
const SfxItemSet& rItemSet ) :
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index de74d88ab631..33359a45ec96 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -87,6 +87,7 @@
#endif
#include <svtools/pickerhelper.hxx>
#include <svtools/docpasswdrequest.hxx>
+#include <svtools/docmspasswdrequest.hxx>
#include <ucbhelper/content.hxx>
#include <ucbhelper/commandenvironment.hxx>
#include <comphelper/storagehelper.hxx>
@@ -556,13 +557,34 @@ void FileDialogHelper_Impl::updateSelectionBox()
}
// ------------------------------------------------------------------------
+struct CheckMSPasswordCapability
+{
+ sal_Bool operator() ( const String rFilterName )
+ {
+ return rFilterName.EqualsAscii("MS Word 97");
+ }
+};
+
+// ------------------------------------------------------------------------
struct CheckPasswordCapability
{
sal_Bool operator() ( const SfxFilter* _pFilter )
{
- return _pFilter && _pFilter->IsOwnFormat()
- && _pFilter->UsesStorage()
- && ( SOFFICE_FILEFORMAT_60 <= _pFilter->GetVersion() );
+ if (!_pFilter)
+ return false;
+
+#if 0 // to be enabled in the future
+ if (_pFilter->GetFilterName().EqualsAscii("MS Excel 97"))
+ // For now, we eanble password protection for Excel 97 as a
+ // special case. If we start having more filters supporting
+ // export encryption with password, we should probably switch to
+ // using a filter flag instead.
+ return true;
+#endif
+
+ return ( _pFilter->IsOwnFormat() && _pFilter->UsesStorage()
+ && ( SOFFICE_FILEFORMAT_60 <= _pFilter->GetVersion() ) )
+ || CheckMSPasswordCapability()( _pFilter->GetFilterName() );
}
};
@@ -1347,6 +1369,7 @@ sal_Int16 FileDialogHelper_Impl::implDoExecute()
//On MacOSX the native file picker has to run in the primordial thread because of drawing issues
//On Linux the native gtk file picker, when backed by gnome-vfs2, needs to be run in the same
//primordial thread as the ucb gnome-vfs2 provider was initialized in.
+/*
#ifdef WNT
if ( mbSystemPicker )
{
@@ -1360,9 +1383,18 @@ sal_Int16 FileDialogHelper_Impl::implDoExecute()
}
else
#endif
+*/
{
try
{
+#ifdef WNT
+ if ( mbSystemPicker )
+ {
+ OReleaseSolarMutex aSolarMutex;
+ nRet = mxFileDlg->execute();
+ }
+ else
+#endif
nRet = mxFileDlg->execute();
}
catch( const Exception& )
@@ -1633,20 +1665,36 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList,
sal_Bool bPassWord = sal_False;
if ( ( aValue >>= bPassWord ) && bPassWord )
{
- // ask for the password
+ // ask for a password
uno::Reference < ::com::sun::star::task::XInteractionHandler > xInteractionHandler( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.comp.uui.UUIInteractionHandler")), UNO_QUERY );
if( xInteractionHandler.is() )
{
- RequestDocumentPassword* pPasswordRequest = new RequestDocumentPassword(
- ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)) );
-
- uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest );
- xInteractionHandler->handle( rRequest );
- if ( pPasswordRequest->isPassword() )
- rpSet->Put( SfxStringItem( SID_PASSWORD, pPasswordRequest->getPassword() ) );
+ // TODO: find out a way to set the 1-15 char limits on MS Excel 97 filter.
+ if ( CheckMSPasswordCapability()( rFilter ) )
+ {
+ RequestMSDocumentPassword* pMSPasswordRequest = new RequestMSDocumentPassword(
+ ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)) );
+
+ uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pMSPasswordRequest );
+ xInteractionHandler->handle( rRequest );
+ if ( pMSPasswordRequest->isPassword() )
+ rpSet->Put( SfxStringItem( SID_PASSWORD, pMSPasswordRequest->getPassword() ) );
+ else
+ return ERRCODE_ABORT;
+ }
else
- return ERRCODE_ABORT;
+ {
+ RequestDocumentPassword* pPasswordRequest = new RequestDocumentPassword(
+ ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)) );
+
+ uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest );
+ xInteractionHandler->handle( rRequest );
+ if ( pPasswordRequest->isPassword() )
+ rpSet->Put( SfxStringItem( SID_PASSWORD, pPasswordRequest->getPassword() ) );
+ else
+ return ERRCODE_ABORT;
+ }
}
}
}
@@ -2570,6 +2618,46 @@ Sequence < OUString > FileDialogHelper::GetMPath() const
}
// ------------------------------------------------------------------------
+Sequence< ::rtl::OUString > FileDialogHelper::GetSelectedFiles() const
+{
+ // a) the new way (optional!)
+ uno::Sequence< ::rtl::OUString > aResultSeq;
+ uno::Reference< XFilePicker2 > xPickNew(mpImp->mxFileDlg, UNO_QUERY);
+ if (xPickNew.is())
+ {
+ aResultSeq = xPickNew->getSelectedFiles();
+ }
+ // b) the olde way ... non optional.
+ else
+ {
+ uno::Reference< XFilePicker > xPickOld(mpImp->mxFileDlg, UNO_QUERY_THROW);
+ Sequence< OUString > lFiles = xPickOld->getFiles();
+ ::sal_Int32 nFiles = lFiles.getLength();
+ if ( nFiles > 1 )
+ {
+ aResultSeq = Sequence< ::rtl::OUString >( nFiles-1 );
+
+ INetURLObject aPath( lFiles[0] );
+ aPath.setFinalSlash();
+
+ for (::sal_Int32 i = 1; i < nFiles; i++)
+ {
+ if (i == 1)
+ aPath.Append( lFiles[i] );
+ else
+ aPath.setName( lFiles[i] );
+
+ aResultSeq[i-1] = ::rtl::OUString(aPath.GetMainURL( INetURLObject::NO_DECODE ));
+ }
+ }
+ else
+ aResultSeq = lFiles;
+ }
+
+ return aResultSeq;
+}
+
+// ------------------------------------------------------------------------
String FileDialogHelper::GetDisplayDirectory() const
{
return mpImp->getPath();
diff --git a/sfx2/source/dialog/passwd.cxx b/sfx2/source/dialog/passwd.cxx
index b4d0e49d92c5..cbe47d39b704 100644
--- a/sfx2/source/dialog/passwd.cxx
+++ b/sfx2/source/dialog/passwd.cxx
@@ -112,6 +112,15 @@ void SfxPasswordDialog::SetMinLen( USHORT nLen )
// -----------------------------------------------------------------------
+void SfxPasswordDialog::SetMaxLen( USHORT nLen )
+{
+ maPasswordED.SetMaxTextLen( nLen );
+ maConfirmED.SetMaxTextLen( nLen );
+ EditModifyHdl( NULL );
+}
+
+// -----------------------------------------------------------------------
+
short SfxPasswordDialog::Execute()
{
if ( mnExtras < SHOWEXTRAS_ALL )
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index c0ee288eb882..2f3ccf86e344 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -79,7 +79,6 @@
#include "imgmgr.hxx"
#include "helpid.hrc"
#include "appdata.hxx"
-#include "objshimp.hxx"
#include <sfx2/viewfrm.hxx>
#include <comphelper/configurationhelper.hxx>
@@ -883,7 +882,7 @@ void SfxCommonTemplateDialog_Impl::ReadResource()
nActFilter = pCurObjShell ? static_cast< USHORT >( LoadFactoryStyleFilter( pCurObjShell ) ) : 0xFFFF;
if ( pCurObjShell && 0xFFFF == nActFilter )
- nActFilter = pCurObjShell->pImp->nStyleFilter;
+ nActFilter = pCurObjShell->GetAutoStyleFilterIndex();
// Einfuegen in die Toolbox
// umgekehrte Reihenfolge, da immer vorne eingefuegt wird.
@@ -1504,7 +1503,7 @@ void SfxCommonTemplateDialog_Impl::Update_Impl()
CheckItem( nActFamily, TRUE );
nActFilter = static_cast< USHORT >( LoadFactoryStyleFilter( pDocShell ) );
if ( 0xFFFF == nActFilter )
- nActFilter = pDocShell->pImp->nStyleFilter;
+ nActFilter = pDocShell->GetAutoStyleFilterIndex();
nAppFilter = pItem->GetValue();
if(!pTreeBox)
@@ -1674,7 +1673,7 @@ void SfxCommonTemplateDialog_Impl::FilterSelect(
SfxObjectShell *pDocShell = pViewFrame->GetObjectShell();
if (pDocShell)
{
- pDocShell->Get_Impl()->nStyleFilter = nActFilter;
+ pDocShell->SetAutoStyleFilterIndex(nActFilter);
SaveFactoryStyleFilter( pDocShell, nActFilter );
}
@@ -1885,8 +1884,8 @@ void SfxCommonTemplateDialog_Impl::ActionSelect(USHORT nEntry)
pStyleSheetPool->SetSearchMask( eFam, SFXSTYLEBIT_USERDEF );
SfxNewStyleDlg *pDlg =
- // FloatingWindow must not be parent of a modal dialog
- new SfxNewStyleDlg(SFX_APP()->GetTopWindow(), *pStyleSheetPool);
+ // why? : FloatingWindow must not be parent of a modal dialog
+ new SfxNewStyleDlg(pWindow, *pStyleSheetPool);
if(RET_OK == pDlg->Execute())
{
pStyleSheetPool->SetSearchMask(eFam, nFilter);
diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx
new file mode 100644
index 000000000000..112183a4efbe
--- /dev/null
+++ b/sfx2/source/doc/DocumentMetadataAccess.cxx
@@ -0,0 +1,1414 @@
+/*************************************************************************
+ *
+ * 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: DocumentMetadataAccess.cxx,v $
+ * $Revision: 1.1.2.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.
+ *
+ ************************************************************************/
+
+#include "precompiled_sfx2.hxx"
+
+#include <sfx2/DocumentMetadataAccess.hxx>
+
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/task/ErrorCodeIOException.hpp>
+#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
+#include <com/sun/star/rdf/FileFormat.hpp>
+#include <com/sun/star/rdf/URIs.hpp>
+#include <com/sun/star/rdf/Statement.hpp>
+#include <com/sun/star/rdf/Literal.hpp>
+#include <com/sun/star/rdf/URI.hpp>
+#include <com/sun/star/rdf/Repository.hpp>
+
+#include <rtl/uuid.h>
+#include <rtl/ustrbuf.hxx>
+
+#include <comphelper/interaction.hxx>
+#include <comphelper/makesequence.hxx>
+#include <comphelper/mediadescriptor.hxx>
+#include <comphelper/sequenceasvector.hxx>
+#include <comphelper/storagehelper.hxx>
+
+#include <sfx2/docfile.hxx>
+#include <sfx2/XmlIdRegistry.hxx>
+
+#include <libxml/tree.h> // for xmlValidateNCName
+
+#include <boost/bind.hpp>
+#include <boost/shared_array.hpp>
+#include <boost/tuple/tuple.hpp>
+
+#include <vector>
+#include <set>
+#include <map>
+#include <functional>
+#include <algorithm>
+
+#include <unotools/ucbhelper.hxx>
+#include <com/sun/star/uri/XUriReference.hpp>
+#include <com/sun/star/uri/XUriReferenceFactory.hpp>
+#include <com/sun/star/uri/XVndSunStarPkgUrlReferenceFactory.hpp>
+
+
+/*
+ Note: in the context of this implementation, all rdf.QueryExceptions and
+ rdf.RepositoryExceptions are RuntimeExceptions, and will be reported as such.
+
+ This implementation assumes that it is only used with ODF documents, not mere
+ ODF packages. In other words, we enforce that metadata files must not be
+ called reserved names.
+ */
+
+using namespace ::com::sun::star;
+
+namespace sfx2 {
+
+
+bool isValidNCName(::rtl::OUString const & i_rIdref)
+{
+ const ::rtl::OString id(
+ ::rtl::OUStringToOString(i_rIdref, RTL_TEXTENCODING_UTF8) );
+ return !(xmlValidateNCName(
+ reinterpret_cast<const unsigned char*>(id.getStr()), 0));
+}
+
+////////////////////////////////////////////////////////////////////////////
+
+static const char s_content [] = "content.xml";
+static const char s_styles [] = "styles.xml";
+static const char s_meta [] = "meta.xml";
+static const char s_settings[] = "settings.xml";
+static const char s_manifest[] = "manifest.rdf";
+static const char s_rdfxml [] = "application/rdf+xml";
+static const char s_odfmime [] = "application/vnd.oasis.opendocument.";
+
+////////////////////////////////////////////////////////////////////////////
+
+static bool isContentFile(::rtl::OUString const & i_rPath)
+{
+ return i_rPath.equalsAscii(s_content);
+}
+
+static bool isStylesFile (::rtl::OUString const & i_rPath)
+{
+ return i_rPath.equalsAscii(s_styles);
+}
+
+static bool isReservedFile(::rtl::OUString const & i_rPath)
+{
+ return isContentFile(i_rPath)
+ || isStylesFile(i_rPath)
+ || i_rPath.equalsAscii(s_meta)
+ || i_rPath.equalsAscii(s_settings);
+}
+
+////////////////////////////////////////////////////////////////////////////
+
+uno::Reference<rdf::XURI> createBaseURI(
+ uno::Reference<uno::XComponentContext> const & i_xContext,
+ uno::Reference<embed::XStorage> const & i_xStorage,
+ ::rtl::OUString const & i_rPkgURI, ::rtl::OUString const & i_rSubDocument)
+{
+ if (!i_xContext.is() || !i_xStorage.is() || !i_rPkgURI.getLength()) {
+ throw uno::RuntimeException();
+ }
+
+ const uno::Reference<lang::XMultiComponentFactory> xServiceFactory(
+ i_xContext->getServiceManager(), uno::UNO_SET_THROW);
+ const uno::Reference<uri::XUriReferenceFactory> xUriFactory(
+ xServiceFactory->createInstanceWithContext(
+ ::rtl::OUString::createFromAscii(
+ "com.sun.star.uri.UriReferenceFactory"), i_xContext),
+ uno::UNO_QUERY_THROW);
+ uno::Reference< uri::XUriReference > xBaseURI;
+
+ const uno::Reference< uri::XUriReference > xPkgURI(
+ xUriFactory->parse(i_rPkgURI), uno::UNO_SET_THROW );
+ xPkgURI->clearFragment();
+ // need to know whether the storage is a FileSystemStorage
+ // XServiceInfo would be better, but it is not implemented
+// if ( i_rPkgURI.getLength() && ::utl::UCBContentHelper::IsFolder(i_rPkgURI) )
+ if (true) {
+ xBaseURI.set( xPkgURI, uno::UNO_SET_THROW );
+#if 0
+ } else {
+ const uno::Reference<uri::XVndSunStarPkgUrlReferenceFactory>
+ xPkgUriFactory( xServiceFactory->createInstanceWithContext(
+ ::rtl::OUString::createFromAscii(
+ "com.sun.star.uri.VndSunStarPkgUrlReferenceFactory"),
+ i_xContext),
+ uno::UNO_QUERY_THROW);
+ xBaseURI.set( xPkgUriFactory->createVndSunStarPkgUrlReference(xPkgURI),
+ uno::UNO_SET_THROW );
+#endif
+ }
+ ::rtl::OUStringBuffer buf;
+ if (!xBaseURI->getUriReference().endsWithAsciiL("/", 1))
+ {
+ const sal_Int32 count( xBaseURI->getPathSegmentCount() );
+ if (count > 0)
+ {
+ const ::rtl::OUString last( xBaseURI->getPathSegment(count - 1) );
+ buf.append(last);
+ }
+ buf.append(static_cast<sal_Unicode>('/'));
+ }
+ if (i_rSubDocument.getLength())
+ {
+ buf.append(i_rSubDocument);
+ buf.append(static_cast<sal_Unicode>('/'));
+ }
+ const ::rtl::OUString Path(buf.makeStringAndClear());
+ if (Path.getLength())
+ {
+ const uno::Reference< uri::XUriReference > xPathURI(
+ xUriFactory->parse(Path), uno::UNO_SET_THROW );
+ xBaseURI.set(
+ xUriFactory->makeAbsolute(xBaseURI, xPathURI,
+ true, uri::RelativeUriExcessParentSegments_ERROR),
+ uno::UNO_SET_THROW);
+ }
+
+ return rdf::URI::create(i_xContext, xBaseURI->getUriReference());
+}
+
+////////////////////////////////////////////////////////////////////////////
+
+struct DocumentMetadataAccess_Impl
+{
+ // note: these are all initialized in constructor, and loadFromStorage
+ const uno::Reference<uno::XComponentContext> m_xContext;
+ const IXmlIdRegistrySupplier & m_rXmlIdRegistrySupplier;
+ uno::Reference<rdf::XURI> m_xBaseURI;
+ uno::Reference<rdf::XRepository> m_xRepository;
+ uno::Reference<rdf::XNamedGraph> m_xManifest;
+ DocumentMetadataAccess_Impl(
+ uno::Reference<uno::XComponentContext> const& i_xContext,
+ IXmlIdRegistrySupplier const & i_rRegistrySupplier)
+ : m_xContext(i_xContext)
+ , m_rXmlIdRegistrySupplier(i_rRegistrySupplier)
+ , m_xBaseURI()
+ , m_xRepository()
+ , m_xManifest()
+ {
+ OSL_ENSURE(m_xContext.is(), "context null");
+ }
+};
+
+// this is... a hack.
+template<sal_Int16 Constant>
+/*static*/ uno::Reference<rdf::XURI>
+getURI(uno::Reference< uno::XComponentContext > const & i_xContext)
+{
+ static uno::Reference< rdf::XURI > xURI(
+ rdf::URI::createKnown(i_xContext, Constant), uno::UNO_QUERY_THROW);
+ return xURI;
+}
+
+
+/** would storing the file to a XStorage succeed? */
+static bool isFileNameValid(const ::rtl::OUString & i_rFileName)
+{
+ if (i_rFileName.getLength() <= 0) return false;
+ if (i_rFileName[0] == '/') return false; // no absolute paths!
+ sal_Int32 idx(0);
+ do {
+ const ::rtl::OUString segment(
+ i_rFileName.getToken(0, static_cast<sal_Unicode> ('/'), idx) );
+ if (!segment.getLength() || // no empty segments
+ segment.equalsAscii(".") || // no . segments
+ segment.equalsAscii("..") || // no .. segments
+ !::comphelper::OStorageHelper::IsValidZipEntryFileName(
+ segment, sal_False)) // no invalid characters
+ return false;
+ } while (idx >= 0);
+ return true;
+}
+
+/** split a uri hierarchy into first segment and rest */
+static bool
+splitPath(::rtl::OUString const & i_rPath,
+ ::rtl::OUString & o_rDir, ::rtl::OUString& o_rRest)
+{
+ const sal_Int32 idx(i_rPath.indexOf(static_cast<sal_Unicode>('/')));
+ if (idx < 0 || idx >= i_rPath.getLength()) {
+ o_rDir = ::rtl::OUString();
+ o_rRest = i_rPath;
+ return true;
+ } else if (idx == 0 || idx == i_rPath.getLength() - 1) {
+ // input must not start or end with '/'
+ return false;
+ } else {
+ o_rDir = (i_rPath.copy(0, idx));
+ o_rRest = (i_rPath.copy(idx+1));
+ return true;
+ }
+}
+
+static bool
+splitXmlId(::rtl::OUString const & i_XmlId,
+ ::rtl::OUString & o_StreamName, ::rtl::OUString& o_Idref )
+{
+ const sal_Int32 idx(i_XmlId.indexOf(static_cast<sal_Unicode>('#')));
+ if ((idx <= 0) || (idx >= i_XmlId.getLength() - 1)) {
+ return false;
+ } else {
+ o_StreamName = (i_XmlId.copy(0, idx));
+ o_Idref = (i_XmlId.copy(idx+1));
+ return isValidXmlId(o_StreamName, o_Idref);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////
+
+static uno::Reference<rdf::XURI>
+getURIForStream(struct DocumentMetadataAccess_Impl& i_rImpl,
+ ::rtl::OUString const& i_rPath)
+{
+ const uno::Reference<rdf::XURI> xURI(
+ rdf::URI::createNS( i_rImpl.m_xContext,
+ i_rImpl.m_xBaseURI->getStringValue(), i_rPath),
+ uno::UNO_SET_THROW);
+ return xURI;
+}
+
+/** add statements declaring i_xResource to be a file of type i_xType with
+ path i_rPath to manifest, with optional additional types i_pTypes */
+static void
+addFile(struct DocumentMetadataAccess_Impl & i_rImpl,
+ uno::Reference<rdf::XURI> const& i_xType,
+ ::rtl::OUString const & i_rPath,
+ const uno::Sequence < uno::Reference< rdf::XURI > > * i_pTypes = 0)
+{
+ try {
+ const uno::Reference<rdf::XURI> xURI( getURIForStream(
+ i_rImpl, i_rPath) );
+
+ i_rImpl.m_xManifest->addStatement(i_rImpl.m_xBaseURI.get(),
+ getURI<rdf::URIs::PKG_HASPART>(i_rImpl.m_xContext),
+ xURI.get());
+ i_rImpl.m_xManifest->addStatement(xURI.get(),
+ getURI<rdf::URIs::RDF_TYPE>(i_rImpl.m_xContext),
+ i_xType.get());
+ if (i_pTypes) {
+ for (sal_Int32 i = 0; i < i_pTypes->getLength(); ++i) {
+ i_rImpl.m_xManifest->addStatement(xURI.get(),
+ getURI<rdf::URIs::RDF_TYPE>(i_rImpl.m_xContext),
+ (*i_pTypes)[i].get());
+ }
+ }
+ } catch (uno::RuntimeException &) {
+ throw;
+ } catch (uno::Exception & e) {
+ throw lang::WrappedTargetRuntimeException(
+ ::rtl::OUString::createFromAscii(
+ "addFile: exception"), /*this*/0, uno::makeAny(e));
+ }
+}
+
+/** add content.xml or styles.xml to manifest */
+static bool
+addContentOrStylesFileImpl(struct DocumentMetadataAccess_Impl & i_rImpl,
+ const ::rtl::OUString & i_rPath)
+{
+ uno::Reference<rdf::XURI> xType;
+ if (isContentFile(i_rPath)) {
+ xType.set(getURI<rdf::URIs::ODF_CONTENTFILE>(i_rImpl.m_xContext));
+ } else if (isStylesFile(i_rPath)) {
+ xType.set(getURI<rdf::URIs::ODF_STYLESFILE>(i_rImpl.m_xContext));
+ } else {
+ return false;
+ }
+ addFile(i_rImpl, xType.get(), i_rPath);
+ return true;
+}
+
+/** add metadata file to manifest */
+static void
+addMetadataFileImpl(struct DocumentMetadataAccess_Impl & i_rImpl,
+ const ::rtl::OUString & i_rPath,
+ const uno::Sequence < uno::Reference< rdf::XURI > > & i_rTypes)
+{
+ addFile(i_rImpl,
+ getURI<rdf::URIs::PKG_METADATAFILE>(i_rImpl.m_xContext),
+ i_rPath, &i_rTypes);
+}
+
+/** remove a file from the manifest */
+static void
+removeFile(struct DocumentMetadataAccess_Impl & i_rImpl,
+ uno::Reference<rdf::XURI> const& i_xPart)
+{
+ if (!i_xPart.is()) throw uno::RuntimeException();
+ try {
+ i_rImpl.m_xManifest->removeStatements(i_rImpl.m_xBaseURI.get(),
+ getURI<rdf::URIs::PKG_HASPART>(i_rImpl.m_xContext),
+ i_xPart.get());
+ i_rImpl.m_xManifest->removeStatements(i_xPart.get(),
+ getURI<rdf::URIs::RDF_TYPE>(i_rImpl.m_xContext), 0);
+ } catch (uno::RuntimeException &) {
+ throw;
+ } catch (uno::Exception & e) {
+ throw lang::WrappedTargetRuntimeException(
+ ::rtl::OUString::createFromAscii("removeFile: exception"),
+ 0, uno::makeAny(e));
+ }
+}
+
+static ::std::vector< uno::Reference< rdf::XURI > >
+getAllParts(struct DocumentMetadataAccess_Impl & i_rImpl)
+{
+ ::std::vector< uno::Reference< rdf::XURI > > ret;
+ try {
+ const uno::Reference<container::XEnumeration> xEnum(
+ i_rImpl.m_xManifest->getStatements( i_rImpl.m_xBaseURI.get(),
+ getURI<rdf::URIs::PKG_HASPART>(i_rImpl.m_xContext), 0),
+ uno::UNO_SET_THROW);
+ while (xEnum->hasMoreElements()) {
+ rdf::Statement stmt;
+ if (!(xEnum->nextElement() >>= stmt)) {
+ throw uno::RuntimeException();
+ }
+ const uno::Reference<rdf::XURI> xPart(stmt.Object,
+ uno::UNO_QUERY);
+ if (!xPart.is()) continue;
+ ret.push_back(xPart);
+ }
+ return ret;
+ } catch (uno::RuntimeException &) {
+ throw;
+ } catch (uno::Exception & e) {
+ throw lang::WrappedTargetRuntimeException(
+ ::rtl::OUString::createFromAscii("getAllParts: exception"),
+ 0, uno::makeAny(e));
+ }
+}
+
+static bool
+isPartOfType(struct DocumentMetadataAccess_Impl & i_rImpl,
+ uno::Reference<rdf::XURI> const & i_xPart,
+ uno::Reference<rdf::XURI> const & i_xType)
+{
+ if (!i_xPart.is() || !i_xType.is()) throw uno::RuntimeException();
+ try {
+ const uno::Reference<container::XEnumeration> xEnum(
+ i_rImpl.m_xManifest->getStatements(i_xPart.get(),
+ getURI<rdf::URIs::RDF_TYPE>(i_rImpl.m_xContext),
+ i_xType.get()),
+ uno::UNO_SET_THROW);
+ return (xEnum->hasMoreElements());
+ } catch (uno::RuntimeException &) {
+ throw;
+ } catch (uno::Exception & e) {
+ throw lang::WrappedTargetRuntimeException(
+ ::rtl::OUString::createFromAscii("isPartOfType: exception"),
+ 0, uno::makeAny(e));
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////
+
+static ucb::InteractiveAugmentedIOException
+mkException( ::rtl::OUString const & i_rMessage,
+ ucb::IOErrorCode const i_ErrorCode,
+ ::rtl::OUString const & i_rUri, ::rtl::OUString const & i_rResource)
+{
+ ucb::InteractiveAugmentedIOException iaioe;
+ iaioe.Message = i_rMessage;
+ iaioe.Classification = task::InteractionClassification_ERROR;
+ iaioe.Code = i_ErrorCode;
+
+ const beans::PropertyValue uriProp(::rtl::OUString::createFromAscii("Uri"),
+ -1, uno::makeAny(i_rUri), static_cast<beans::PropertyState>(0));
+ const beans::PropertyValue rnProp(
+ ::rtl::OUString::createFromAscii("ResourceName"),
+ -1, uno::makeAny(i_rResource), static_cast<beans::PropertyState>(0));
+ iaioe.Arguments = ::comphelper::makeSequence(
+ uno::makeAny(uriProp), uno::makeAny(rnProp));
+ return iaioe;
+}
+
+/** error handling policy.
+ <p>If a handler is given, ask it how to proceed:
+ <ul><li>(default:) cancel import, raise exception</li>
+ <li>ignore the error and continue</li>
+ <li>retry the action that led to the error</li></ul></p>
+ N.B.: must not be called before DMA is fully initalized!
+ @returns true iff caller should retry
+ */
+static bool
+handleError( ucb::InteractiveAugmentedIOException const & i_rException,
+ const uno::Reference<task::XInteractionHandler> & i_xHandler)
+{
+ if (!i_xHandler.is()) {
+ throw lang::WrappedTargetException(::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::loadMetadataFromStorage: exception"),
+ /* *this*/ 0, uno::makeAny(i_rException));
+ }
+
+ ::rtl::Reference< ::comphelper::OInteractionRequest > pRequest(
+ new ::comphelper::OInteractionRequest(uno::makeAny(i_rException)) );
+ ::rtl::Reference< ::comphelper::OInteractionRetry > pRetry(
+ new ::comphelper::OInteractionRetry );
+ ::rtl::Reference< ::comphelper::OInteractionApprove > pApprove(
+ new ::comphelper::OInteractionApprove );
+ ::rtl::Reference< ::comphelper::OInteractionAbort > pAbort(
+ new ::comphelper::OInteractionAbort );
+ /* this does not seem to work
+ if (i_rException.Code != ucb::IOErrorCode_WRONG_FORMAT) {
+ pRequest->addContinuation( pRetry.get() );
+ }
+ */
+ pRequest->addContinuation( pApprove.get() );
+ pRequest->addContinuation( pAbort.get() );
+ // actually call the handler
+ i_xHandler->handle( pRequest.get() );
+ if (pRetry->wasSelected()) {
+ return true;
+ } else if (pApprove->wasSelected()) {
+ return false;
+ } else {
+ OSL_ENSURE(pAbort->wasSelected(), "no continuation selected?");
+ throw lang::WrappedTargetException(::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::loadMetadataFromStorage: exception"),
+ /* *this*/ 0, uno::makeAny(i_rException));
+ }
+}
+
+/** check if storage has content.xml/styles.xml;
+ e.g. ODB files seem to only have content.xml */
+static void
+collectFilesFromStorage(uno::Reference<embed::XStorage> const& i_xStorage,
+ ::rtl::OUString i_Path,
+ std::set< ::rtl::OUString > & o_rFiles)
+{
+ static ::rtl::OUString content(::rtl::OUString::createFromAscii(s_content));
+ static ::rtl::OUString styles (::rtl::OUString::createFromAscii(s_styles ));
+ try {
+ if (i_xStorage->hasByName(content) &&
+ i_xStorage->isStreamElement(content))
+ {
+ o_rFiles.insert(i_Path + content);
+ }
+ if (i_xStorage->hasByName(styles) &&
+ i_xStorage->isStreamElement(styles))
+ {
+ o_rFiles.insert(i_Path + styles);
+ }
+ } catch (uno::Exception &) {
+ OSL_TRACE("collectFilesFromStorage: exception?");
+ }
+}
+
+/** import a metadata file into repository */
+static void
+readStream(struct DocumentMetadataAccess_Impl & i_rImpl,
+ uno::Reference< embed::XStorage > const & i_xStorage,
+ ::rtl::OUString const & i_rPath,
+ ::rtl::OUString const & i_rBaseURI)
+{
+ ::rtl::OUString dir;
+ ::rtl::OUString rest;
+ try {
+ if (!splitPath(i_rPath, dir, rest)) throw uno::RuntimeException();
+ if (dir.equalsAscii("")) {
+ if (i_xStorage->isStreamElement(i_rPath)) {
+ const uno::Reference<io::XStream> xStream(
+ i_xStorage->openStreamElement(i_rPath,
+ embed::ElementModes::READ), uno::UNO_SET_THROW);
+ const uno::Reference<io::XInputStream> xInStream(
+ xStream->getInputStream(), uno::UNO_SET_THROW );
+ const uno::Reference<rdf::XURI> xBaseURI(
+ rdf::URI::create(i_rImpl.m_xContext, i_rBaseURI));
+ const uno::Reference<rdf::XURI> xURI(
+ rdf::URI::createNS(i_rImpl.m_xContext,
+ i_rBaseURI, i_rPath));
+ i_rImpl.m_xRepository->importGraph(rdf::FileFormat::RDF_XML,
+ xInStream, xURI, xBaseURI);
+ } else {
+ throw mkException(::rtl::OUString::createFromAscii(
+ "readStream: is not a stream"),
+ ucb::IOErrorCode_NO_FILE, i_rBaseURI + i_rPath, i_rPath);
+ }
+ } else {
+ if (i_xStorage->isStorageElement(dir)) {
+ const uno::Reference<embed::XStorage> xDir(
+ i_xStorage->openStorageElement(dir,
+ embed::ElementModes::READ));
+ const uno::Reference< beans::XPropertySet > xDirProps(xDir,
+ uno::UNO_QUERY_THROW);
+ try {
+ ::rtl::OUString mimeType;
+ xDirProps->getPropertyValue(
+ ::comphelper::MediaDescriptor::PROP_MEDIATYPE() )
+ >>= mimeType;
+ if (mimeType.matchAsciiL(s_odfmime, sizeof(s_odfmime) - 1))
+ {
+ OSL_TRACE("readStream: "
+ "refusing to recurse into embedded document");
+ return;
+ }
+ } catch (uno::Exception &) { }
+ ::rtl::OUStringBuffer buf(i_rBaseURI);
+ buf.append(dir).append(static_cast<sal_Unicode>('/'));
+ readStream(i_rImpl, xDir, rest, buf.makeStringAndClear() );
+ } else {
+ throw mkException(::rtl::OUString::createFromAscii(
+ "readStream: is not a directory"),
+ ucb::IOErrorCode_NO_DIRECTORY, i_rBaseURI + dir, dir);
+ }
+ }
+ } catch (container::NoSuchElementException & e) {
+ throw mkException(e.Message, ucb::IOErrorCode_NOT_EXISTING_PATH,
+ i_rBaseURI + i_rPath, i_rPath);
+ } catch (io::IOException & e) {
+ throw mkException(e.Message, ucb::IOErrorCode_CANT_READ,
+ i_rBaseURI + i_rPath, i_rPath);
+ } catch (rdf::ParseException & e) {
+ throw mkException(e.Message, ucb::IOErrorCode_WRONG_FORMAT,
+ i_rBaseURI + i_rPath, i_rPath);
+ }
+}
+
+/** import a metadata file into repository */
+static void
+importFile(struct DocumentMetadataAccess_Impl & i_rImpl,
+ uno::Reference<embed::XStorage> const & i_xStorage,
+ ::rtl::OUString const & i_rBaseURI,
+ uno::Reference<task::XInteractionHandler> const & i_xHandler,
+ ::rtl::OUString i_rPath)
+{
+retry:
+ try {
+ readStream(i_rImpl, i_xStorage, i_rPath, i_rBaseURI);
+ } catch (ucb::InteractiveAugmentedIOException & e) {
+ if (handleError(e, i_xHandler)) goto retry;
+ } catch (uno::RuntimeException &) {
+ throw;
+ } catch (uno::Exception & e) {
+ throw lang::WrappedTargetRuntimeException(
+ ::rtl::OUString::createFromAscii("importFile: exception"),
+ 0, uno::makeAny(e));
+ }
+}
+
+/** actually write a metadata file to the storage */
+static void
+exportStream(struct DocumentMetadataAccess_Impl & i_rImpl,
+ uno::Reference< embed::XStorage > const & i_xStorage,
+ uno::Reference<rdf::XURI> const & i_xGraphName,
+ ::rtl::OUString const & i_rFileName,
+ ::rtl::OUString const & i_rBaseURI)
+{
+ const uno::Reference<io::XStream> xStream(
+ i_xStorage->openStreamElement(i_rFileName,
+ embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE),
+ uno::UNO_SET_THROW);
+ const uno::Reference< beans::XPropertySet > xStreamProps(xStream,
+ uno::UNO_QUERY);
+ if (xStreamProps.is()) { // this is NOT supported in FileSystemStorage
+ xStreamProps->setPropertyValue(
+ ::rtl::OUString::createFromAscii("MediaType"),
+ uno::makeAny(::rtl::OUString::createFromAscii(s_rdfxml)));
+ }
+ const uno::Reference<io::XOutputStream> xOutStream(
+ xStream->getOutputStream(), uno::UNO_SET_THROW );
+ const uno::Reference<rdf::XURI> xBaseURI(
+ rdf::URI::create(i_rImpl.m_xContext, i_rBaseURI));
+ i_rImpl.m_xRepository->exportGraph(rdf::FileFormat::RDF_XML,
+ xOutStream, i_xGraphName, xBaseURI);
+}
+
+/** write a metadata file to the storage */
+static void
+writeStream(struct DocumentMetadataAccess_Impl & i_rImpl,
+ uno::Reference< embed::XStorage > const & i_xStorage,
+ uno::Reference<rdf::XURI> const & i_xGraphName,
+ ::rtl::OUString const & i_rPath,
+ ::rtl::OUString const & i_rBaseURI)
+{
+ ::rtl::OUString dir;
+ ::rtl::OUString rest;
+ if (!splitPath(i_rPath, dir, rest)) throw uno::RuntimeException();
+ try {
+ if (dir.equalsAscii("")) {
+ exportStream(i_rImpl, i_xStorage, i_xGraphName, i_rPath,
+ i_rBaseURI);
+ } else {
+ const uno::Reference<embed::XStorage> xDir(
+ i_xStorage->openStorageElement(dir,
+ embed::ElementModes::WRITE));
+ const uno::Reference< beans::XPropertySet > xDirProps(xDir,
+ uno::UNO_QUERY_THROW);
+ try {
+ ::rtl::OUString mimeType;
+ xDirProps->getPropertyValue(
+ ::comphelper::MediaDescriptor::PROP_MEDIATYPE() )
+ >>= mimeType;
+ if (mimeType.matchAsciiL(s_odfmime, sizeof(s_odfmime) - 1)) {
+ OSL_TRACE("writeStream: "
+ "refusing to recurse into embedded document");
+ return;
+ }
+ } catch (uno::Exception &) { }
+ ::rtl::OUStringBuffer buf(i_rBaseURI);
+ buf.append(dir).append(static_cast<sal_Unicode>('/'));
+ writeStream(i_rImpl, xDir, i_xGraphName, rest,
+ buf.makeStringAndClear());
+ }
+ const uno::Reference<embed::XTransactedObject> xTransaction(
+ i_xStorage, uno::UNO_QUERY);
+ if (xTransaction.is()) {
+ xTransaction->commit();
+ }
+ } catch (uno::RuntimeException &) {
+ throw;
+ } catch (io::IOException &) {
+ throw;
+ }
+}
+
+static void
+initLoading(struct DocumentMetadataAccess_Impl & i_rImpl,
+ const uno::Reference< embed::XStorage > & i_xStorage,
+ const uno::Reference<rdf::XURI> & i_xBaseURI,
+ const uno::Reference<task::XInteractionHandler> & i_xHandler)
+{
+retry:
+ // clear old data
+ i_rImpl.m_xManifest.clear();
+ // init BaseURI
+ i_rImpl.m_xBaseURI = i_xBaseURI;
+
+ // create repository
+ i_rImpl.m_xRepository.clear();
+ i_rImpl.m_xRepository.set(rdf::Repository::create(i_rImpl.m_xContext),
+ uno::UNO_SET_THROW);
+
+ const ::rtl::OUString manifest (
+ ::rtl::OUString::createFromAscii(s_manifest));
+ const ::rtl::OUString baseURI( i_xBaseURI->getStringValue() );
+ // try to delay raising errors until after initialization is done
+ uno::Any rterr;
+ ucb::InteractiveAugmentedIOException iaioe;
+ bool err(false);
+
+ const uno::Reference <rdf::XURI> xManifest(
+ getURIForStream(i_rImpl, manifest));
+ try {
+ readStream(i_rImpl, i_xStorage, manifest, baseURI);
+ } catch (ucb::InteractiveAugmentedIOException & e) {
+ // no manifest.rdf: this is not an error in ODF < 1.2
+ if (!(ucb::IOErrorCode_NOT_EXISTING_PATH == e.Code)) {
+ iaioe = e;
+ err = true;
+ }
+ } catch (uno::Exception & e) {
+ rterr <<= e;
+ }
+
+ // init manifest graph
+ const uno::Reference<rdf::XNamedGraph> xManifestGraph(
+ i_rImpl.m_xRepository->getGraph(xManifest));
+ i_rImpl.m_xManifest.set(xManifestGraph.is() ? xManifestGraph :
+ i_rImpl.m_xRepository->createGraph(xManifest), uno::UNO_SET_THROW);
+ const uno::Reference<container::XEnumeration> xEnum(
+ i_rImpl.m_xManifest->getStatements(0,
+ getURI<rdf::URIs::RDF_TYPE>(i_rImpl.m_xContext),
+ getURI<rdf::URIs::PKG_DOCUMENT>(i_rImpl.m_xContext).get()));
+
+ // document statement
+ i_rImpl.m_xManifest->addStatement(i_rImpl.m_xBaseURI.get(),
+ getURI<rdf::URIs::RDF_TYPE>(i_rImpl.m_xContext),
+ getURI<rdf::URIs::PKG_DOCUMENT>(i_rImpl.m_xContext).get());
+
+ OSL_ENSURE(i_rImpl.m_xBaseURI.is(), "base URI is null");
+ OSL_ENSURE(i_rImpl.m_xRepository.is(), "repository is null");
+ OSL_ENSURE(i_rImpl.m_xManifest.is(), "manifest is null");
+
+ if (rterr.hasValue()) {
+ throw lang::WrappedTargetRuntimeException(
+ ::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::loadMetadataFromStorage: "
+ "exception"), 0, rterr);
+ }
+
+ if (err) {
+ if (handleError(iaioe, i_xHandler)) goto retry;
+ }
+}
+
+/** init Impl struct */
+static void init(struct DocumentMetadataAccess_Impl & i_rImpl)
+{
+ try {
+
+ i_rImpl.m_xManifest.set(i_rImpl.m_xRepository->createGraph(
+ getURIForStream(i_rImpl,
+ ::rtl::OUString::createFromAscii(s_manifest))),
+ uno::UNO_SET_THROW);
+
+ // insert the document statement
+ i_rImpl.m_xManifest->addStatement(i_rImpl.m_xBaseURI.get(),
+ getURI<rdf::URIs::RDF_TYPE>(i_rImpl.m_xContext),
+ getURI<rdf::URIs::PKG_DOCUMENT>(i_rImpl.m_xContext).get());
+ } catch (uno::Exception & e) {
+ throw lang::WrappedTargetRuntimeException(
+ ::rtl::OUString::createFromAscii("init: unexpected exception"), 0,
+ uno::makeAny(e));
+ }
+
+ // add top-level content files
+ if (!addContentOrStylesFileImpl(i_rImpl,
+ ::rtl::OUString::createFromAscii(s_content))) {
+ throw uno::RuntimeException();
+ }
+ if (!addContentOrStylesFileImpl(i_rImpl,
+ ::rtl::OUString::createFromAscii(s_styles))) {
+ throw uno::RuntimeException();
+ }
+}
+
+
+////////////////////////////////////////////////////////////////////////////
+
+DocumentMetadataAccess::DocumentMetadataAccess(
+ uno::Reference< uno::XComponentContext > const & i_xContext,
+ const IXmlIdRegistrySupplier & i_rRegistrySupplier)
+ : m_pImpl(new DocumentMetadataAccess_Impl(i_xContext, i_rRegistrySupplier))
+{
+ // no initalization: must call loadFrom...
+}
+
+DocumentMetadataAccess::DocumentMetadataAccess(
+ uno::Reference< uno::XComponentContext > const & i_xContext,
+ const IXmlIdRegistrySupplier & i_rRegistrySupplier,
+ ::rtl::OUString const & i_rURI)
+ : m_pImpl(new DocumentMetadataAccess_Impl(i_xContext, i_rRegistrySupplier))
+{
+ OSL_ENSURE(i_rURI.getLength(), "DMA::DMA: no URI given!");
+ OSL_ENSURE(i_rURI.endsWithAsciiL("/", 1), "DMA::DMA: URI without / given!");
+ if (!i_rURI.endsWithAsciiL("/", 1)) throw uno::RuntimeException();
+ m_pImpl->m_xBaseURI.set(rdf::URI::create(m_pImpl->m_xContext, i_rURI));
+ m_pImpl->m_xRepository.set(rdf::Repository::create(m_pImpl->m_xContext),
+ uno::UNO_SET_THROW);
+
+ // init repository
+ init(*m_pImpl);
+
+ OSL_ENSURE(m_pImpl->m_xBaseURI.is(), "base URI is null");
+ OSL_ENSURE(m_pImpl->m_xRepository.is(), "repository is null");
+ OSL_ENSURE(m_pImpl->m_xManifest.is(), "manifest is null");
+}
+
+DocumentMetadataAccess::~DocumentMetadataAccess()
+{
+}
+
+
+// ::com::sun::star::rdf::XRepositorySupplier:
+uno::Reference< rdf::XRepository > SAL_CALL
+DocumentMetadataAccess::getRDFRepository() throw (uno::RuntimeException)
+{
+ OSL_ENSURE(m_pImpl->m_xRepository.is(), "repository not initialized");
+ return m_pImpl->m_xRepository;
+}
+
+// ::com::sun::star::rdf::XNode:
+::rtl::OUString SAL_CALL
+DocumentMetadataAccess::getStringValue() throw (uno::RuntimeException)
+{
+ return m_pImpl->m_xBaseURI->getStringValue();
+}
+
+// ::com::sun::star::rdf::XURI:
+::rtl::OUString SAL_CALL
+DocumentMetadataAccess::getNamespace() throw (uno::RuntimeException)
+{
+ return m_pImpl->m_xBaseURI->getNamespace();
+}
+
+::rtl::OUString SAL_CALL
+DocumentMetadataAccess::getLocalName() throw (uno::RuntimeException)
+{
+ return m_pImpl->m_xBaseURI->getLocalName();
+}
+
+// ::com::sun::star::rdf::XDocumentMetadataAccess:
+uno::Reference< rdf::XMetadatable > SAL_CALL
+DocumentMetadataAccess::getElementByMetadataReference(
+ const ::com::sun::star::beans::StringPair & i_rReference)
+throw (uno::RuntimeException)
+{
+ const IXmlIdRegistry * pReg(
+ m_pImpl->m_rXmlIdRegistrySupplier.GetXmlIdRegistry() );
+ if (!pReg) {
+ throw uno::RuntimeException(::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::getElementByXmlId: no registry"), *this);
+ }
+ return pReg->GetElementByMetadataReference(i_rReference);
+}
+
+uno::Reference< rdf::XMetadatable > SAL_CALL
+DocumentMetadataAccess::getElementByURI(
+ const uno::Reference< rdf::XURI > & i_xURI )
+throw (uno::RuntimeException, lang::IllegalArgumentException)
+{
+ if (!i_xURI.is()) {
+ throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::getElementByURI: URI is null"), *this, 0);
+ }
+
+ const ::rtl::OUString baseURI( m_pImpl->m_xBaseURI->getStringValue() );
+ const ::rtl::OUString name( i_xURI->getStringValue() );
+ if (!name.match(baseURI)) {
+ return 0;
+ }
+ const ::rtl::OUString relName( name.copy(baseURI.getLength()) );
+ ::rtl::OUString path;
+ ::rtl::OUString idref;
+ if (!splitXmlId(relName, path, idref)) {
+ return 0;
+ }
+
+ return getElementByMetadataReference( beans::StringPair(path, idref) );
+}
+
+
+uno::Sequence< uno::Reference< rdf::XURI > > SAL_CALL
+DocumentMetadataAccess::getMetadataGraphsWithType(
+ const uno::Reference<rdf::XURI> & i_xType)
+throw (uno::RuntimeException, lang::IllegalArgumentException)
+{
+ if (!i_xType.is()) {
+ throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::getMetadataGraphsWithType: "
+ "type is null"), *this, 0);
+ }
+
+ ::comphelper::SequenceAsVector< uno::Reference< rdf::XURI > > ret;
+ const ::std::vector< uno::Reference< rdf::XURI > > parts(
+ getAllParts(*m_pImpl) );
+ ::std::remove_copy_if(parts.begin(), parts.end(),
+ ::std::back_inserter(ret),
+ ::boost::bind(
+ ::std::logical_not<bool>(),
+ ::boost::bind(&isPartOfType, ::boost::ref(*m_pImpl), _1, i_xType) ));
+ return ret.getAsConstList();
+}
+
+uno::Reference<rdf::XURI> SAL_CALL
+DocumentMetadataAccess::addMetadataFile(const ::rtl::OUString & i_rFileName,
+ const uno::Sequence < uno::Reference< rdf::XURI > > & i_rTypes)
+throw (uno::RuntimeException, lang::IllegalArgumentException,
+ container::ElementExistException)
+{
+ if (!isFileNameValid(i_rFileName)) {
+ throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::addMetadataFile: invalid FileName"),
+ *this, 0);
+ }
+ if (isReservedFile(i_rFileName)) {
+ throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::addMetadataFile:"
+ "invalid FileName: reserved"), *this, 0);
+ }
+ for (sal_Int32 i = 0; i < i_rTypes.getLength(); ++i) {
+ if (!i_rTypes[i].is()) {
+ throw lang::IllegalArgumentException(
+ ::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::addMetadataFile: "
+ "null type"), *this, 2);
+ }
+ }
+
+ const uno::Reference<rdf::XURI> xGraphName(
+ getURIForStream(*m_pImpl, i_rFileName) );
+
+ try {
+ m_pImpl->m_xRepository->createGraph(xGraphName);
+ } catch (rdf::RepositoryException & e) {
+ throw lang::WrappedTargetRuntimeException(
+ ::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::addMetadataFile: exception"),
+ *this, uno::makeAny(e));
+ // note: all other exceptions are propagated
+ }
+
+ addMetadataFileImpl(*m_pImpl, i_rFileName, i_rTypes);
+ return xGraphName;
+}
+
+uno::Reference<rdf::XURI> SAL_CALL
+DocumentMetadataAccess::importMetadataFile(::sal_Int16 i_Format,
+ const uno::Reference< io::XInputStream > & i_xInStream,
+ const ::rtl::OUString & i_rFileName,
+ const uno::Reference< rdf::XURI > & i_xBaseURI,
+ const uno::Sequence < uno::Reference< rdf::XURI > > & i_rTypes)
+throw (uno::RuntimeException, lang::IllegalArgumentException,
+ datatransfer::UnsupportedFlavorException,
+ container::ElementExistException, rdf::ParseException, io::IOException)
+{
+ if (!isFileNameValid(i_rFileName)) {
+ throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::importMetadataFile: invalid FileName"),
+ *this, 0);
+ }
+ if (isReservedFile(i_rFileName)) {
+ throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::importMetadataFile:"
+ "invalid FileName: reserved"), *this, 0);
+ }
+ for (sal_Int32 i = 0; i < i_rTypes.getLength(); ++i) {
+ if (!i_rTypes[i].is()) {
+ throw lang::IllegalArgumentException(
+ ::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::importMetadataFile: null type"),
+ *this, 5);
+ }
+ }
+
+ const uno::Reference<rdf::XURI> xGraphName(
+ getURIForStream(*m_pImpl, i_rFileName) );
+
+ try {
+ m_pImpl->m_xRepository->importGraph(
+ i_Format, i_xInStream, xGraphName, i_xBaseURI);
+ } catch (rdf::RepositoryException & e) {
+ throw lang::WrappedTargetRuntimeException(
+ ::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::importMetadataFile: "
+ "RepositoryException"), *this, uno::makeAny(e));
+ // note: all other exceptions are propagated
+ }
+
+ // add to manifest
+ addMetadataFileImpl(*m_pImpl, i_rFileName, i_rTypes);
+ return xGraphName;
+}
+
+void SAL_CALL
+DocumentMetadataAccess::removeMetadataFile(
+ const uno::Reference< rdf::XURI > & i_xGraphName)
+throw (uno::RuntimeException, lang::IllegalArgumentException,
+ container::NoSuchElementException)
+{
+ try {
+ m_pImpl->m_xRepository->destroyGraph(i_xGraphName);
+ } catch (rdf::RepositoryException & e) {
+ throw lang::WrappedTargetRuntimeException(
+ ::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::removeMetadataFile: "
+ "RepositoryException"), *this, uno::makeAny(e));
+ // note: all other exceptions are propagated
+ }
+
+ // remove file from manifest
+ removeFile(*m_pImpl, i_xGraphName.get());
+}
+
+void SAL_CALL
+DocumentMetadataAccess::addContentOrStylesFile(
+ const ::rtl::OUString & i_rFileName)
+throw (uno::RuntimeException, lang::IllegalArgumentException,
+ container::ElementExistException)
+{
+ if (!isFileNameValid(i_rFileName)) {
+ throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::addContentOrStylesFile: "
+ "invalid FileName"), *this, 0);
+ }
+
+ if (!addContentOrStylesFileImpl(*m_pImpl, i_rFileName)) {
+ throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::addContentOrStylesFile: "
+ "invalid FileName: must end with content.xml or styles.xml"),
+ *this, 0);
+ }
+}
+
+void SAL_CALL
+DocumentMetadataAccess::removeContentOrStylesFile(
+ const ::rtl::OUString & i_rFileName)
+throw (uno::RuntimeException, lang::IllegalArgumentException,
+ container::NoSuchElementException)
+{
+ if (!isFileNameValid(i_rFileName)) {
+ throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::removeContentOrStylesFile: "
+ "invalid FileName"), *this, 0);
+ }
+
+ try {
+ const uno::Reference<rdf::XURI> xPart(
+ getURIForStream(*m_pImpl, i_rFileName) );
+ const uno::Reference<container::XEnumeration> xEnum(
+ m_pImpl->m_xManifest->getStatements( m_pImpl->m_xBaseURI.get(),
+ getURI<rdf::URIs::PKG_HASPART>(m_pImpl->m_xContext),
+ xPart.get()),
+ uno::UNO_SET_THROW);
+ if (!xEnum->hasMoreElements()) {
+ throw container::NoSuchElementException(
+ ::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::removeContentOrStylesFile: "
+ "cannot find stream in manifest graph: ") + i_rFileName,
+ *this);
+ }
+
+ // remove file from manifest
+ removeFile(*m_pImpl, xPart);
+
+ } catch (uno::RuntimeException &) {
+ throw;
+ } catch (uno::Exception & e) {
+ throw lang::WrappedTargetRuntimeException(
+ ::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::removeContentOrStylesFile: exception"),
+ *this, uno::makeAny(e));
+ }
+}
+
+void SAL_CALL DocumentMetadataAccess::loadMetadataFromStorage(
+ const uno::Reference< embed::XStorage > & i_xStorage,
+ const uno::Reference<rdf::XURI> & i_xBaseURI,
+ const uno::Reference<task::XInteractionHandler> & i_xHandler)
+throw (uno::RuntimeException, lang::IllegalArgumentException,
+ lang::WrappedTargetException)
+{
+ if (!i_xStorage.is()) {
+ throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::loadMetadataFromStorage: "
+ "storage is null"), *this, 0);
+ }
+ if (!i_xBaseURI.is()) {
+ throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::loadMetadataFromStorage: "
+ "base URI is null"), *this, 1);
+ }
+ const ::rtl::OUString baseURI( i_xBaseURI->getStringValue());
+ if (baseURI.indexOf('#') >= 0) {
+ throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::loadMetadataFromStorage: "
+ "base URI not absolute"), *this, 1);
+ }
+ if (!baseURI.getLength() || !baseURI.endsWithAsciiL("/", 1)) {
+ throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::loadMetadataFromStorage: "
+ "base URI does not end with slash"), *this, 1);
+ }
+
+ initLoading(*m_pImpl, i_xStorage, i_xBaseURI, i_xHandler);
+
+ std::set< ::rtl::OUString > StgFiles;
+ collectFilesFromStorage(i_xStorage,
+ ::rtl::OUString::createFromAscii(""), StgFiles);
+
+ std::vector< ::rtl::OUString > MfstMetadataFiles;
+
+ try {
+ const ::std::vector< uno::Reference< rdf::XURI > > parts(
+ getAllParts(*m_pImpl) );
+ const uno::Reference<rdf::XURI> xContentFile(
+ getURI<rdf::URIs::ODF_CONTENTFILE>(m_pImpl->m_xContext));
+ const uno::Reference<rdf::XURI> xStylesFile(
+ getURI<rdf::URIs::ODF_STYLESFILE>(m_pImpl->m_xContext));
+ const uno::Reference<rdf::XURI> xMetadataFile(
+ getURI<rdf::URIs::PKG_METADATAFILE>(m_pImpl->m_xContext));
+ const sal_Int32 len( baseURI.getLength() );
+ const ::rtl::OUString manifest (
+ ::rtl::OUString::createFromAscii(s_manifest));
+ for (::std::vector< uno::Reference< rdf::XURI > >::const_iterator it
+ = parts.begin();
+ it != parts.end(); ++it) {
+ const ::rtl::OUString name((*it)->getStringValue());
+ if (!name.match(baseURI)) {
+ OSL_TRACE("loadMetadataFromStorage: graph not in document: %s",
+ ::rtl::OUStringToOString(name, RTL_TEXTENCODING_UTF8)
+ .getStr());
+ continue;
+ }
+ const ::rtl::OUString relName( name.copy(len) );
+ if (relName == manifest) {
+ OSL_TRACE("loadMetadataFromStorage: "
+ "found ourselves a recursive manifest!");
+ continue;
+ }
+ // remove found items from StgFiles
+ StgFiles.erase(relName);
+ if (isContentFile(relName)) {
+ if (!isPartOfType(*m_pImpl, *it, xContentFile)) {
+ const uno::Reference <rdf::XURI> xName(
+ getURIForStream(*m_pImpl, relName) );
+ // add missing type statement
+ m_pImpl->m_xManifest->addStatement(xName.get(),
+ getURI<rdf::URIs::RDF_TYPE>(m_pImpl->m_xContext),
+ xContentFile.get());
+ }
+ } else if (isStylesFile(relName)) {
+ if (!isPartOfType(*m_pImpl, *it, xStylesFile)) {
+ const uno::Reference <rdf::XURI> xName(
+ getURIForStream(*m_pImpl, relName) );
+ // add missing type statement
+ m_pImpl->m_xManifest->addStatement(xName.get(),
+ getURI<rdf::URIs::RDF_TYPE>(m_pImpl->m_xContext),
+ xStylesFile.get());
+ }
+ } else if (isReservedFile(relName)) {
+ OSL_TRACE("loadMetadataFromStorage: "
+ "reserved file name in manifest");
+ } else {
+ if (isPartOfType(*m_pImpl, *it, xMetadataFile)) {
+ MfstMetadataFiles.push_back(relName);
+ }
+ // do not add statement for MetadataFile; it could be
+ // something else! just ignore it...
+ }
+ }
+ } catch (uno::RuntimeException &) {
+ throw;
+ } catch (uno::Exception & e) {
+ throw lang::WrappedTargetRuntimeException(
+ ::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::loadMetadataFromStorage: "
+ "exception"), *this, uno::makeAny(e));
+ }
+
+ std::for_each(StgFiles.begin(), StgFiles.end(),
+ boost::bind(addContentOrStylesFileImpl, boost::ref(*m_pImpl), _1));
+
+ std::for_each(MfstMetadataFiles.begin(), MfstMetadataFiles.end(),
+ boost::bind(importFile, boost::ref(*m_pImpl),
+ i_xStorage, baseURI, i_xHandler, _1));
+}
+
+void SAL_CALL DocumentMetadataAccess::storeMetadataToStorage(
+ const uno::Reference< embed::XStorage > & i_xStorage)
+throw (uno::RuntimeException, lang::IllegalArgumentException,
+ lang::WrappedTargetException)
+{
+ if (!i_xStorage.is()) {
+ throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::storeMetadataToStorage: "
+ "storage is null"), *this, 0);
+ }
+
+ // export manifest
+ const ::rtl::OUString manifest (
+ ::rtl::OUString::createFromAscii(s_manifest));
+ const uno::Reference <rdf::XURI> xManifest(
+ getURIForStream(*m_pImpl, manifest) );
+ const ::rtl::OUString baseURI( m_pImpl->m_xBaseURI->getStringValue() );
+ try {
+ writeStream(*m_pImpl, i_xStorage, xManifest, manifest, baseURI);
+ } catch (uno::RuntimeException &) {
+ throw;
+ } catch (io::IOException & e) {
+ throw lang::WrappedTargetException( ::rtl::OUString::createFromAscii(
+ "storeMetadataToStorage: IO exception"), *this, uno::makeAny(e));
+ } catch (uno::Exception & e) {
+ throw lang::WrappedTargetRuntimeException(
+ ::rtl::OUString::createFromAscii(
+ "storeMetadataToStorage: exception"), *this, uno::makeAny(e));
+ }
+
+ // export metadata streams
+ try {
+ const uno::Sequence<uno::Reference<rdf::XURI> > graphs(
+ m_pImpl->m_xRepository->getGraphNames());
+ const sal_Int32 len( baseURI.getLength() );
+ for (sal_Int32 i = 0; i < graphs.getLength(); ++i) {
+ const uno::Reference<rdf::XURI> xName(graphs[i]);
+ const ::rtl::OUString name(xName->getStringValue());
+ if (!name.match(baseURI)) {
+ OSL_TRACE("storeMetadataToStorage: graph not in document: %s",
+ ::rtl::OUStringToOString(name, RTL_TEXTENCODING_UTF8)
+ .getStr());
+ continue;
+ }
+ const ::rtl::OUString relName( name.copy(len) );
+ if (relName == manifest) {
+ continue;
+ }
+ if (!isFileNameValid(relName) || isReservedFile(relName)) {
+ OSL_TRACE("storeMetadataToStorage: invalid file name: %s",
+ ::rtl::OUStringToOString(relName, RTL_TEXTENCODING_UTF8)
+ .getStr());
+ continue;
+ }
+ try {
+ writeStream(*m_pImpl, i_xStorage, xName, relName, baseURI);
+ } catch (uno::RuntimeException &) {
+ throw;
+ } catch (io::IOException & e) {
+ throw lang::WrappedTargetException(
+ ::rtl::OUString::createFromAscii(
+ "storeMetadataToStorage: IO exception"),
+ *this, uno::makeAny(e));
+ } catch (uno::Exception & e) {
+ throw lang::WrappedTargetRuntimeException(
+ ::rtl::OUString::createFromAscii(
+ "storeMetadataToStorage: exception"),
+ *this, uno::makeAny(e));
+ }
+ }
+ } catch (rdf::RepositoryException & e) {
+ throw lang::WrappedTargetRuntimeException(
+ ::rtl::OUString::createFromAscii(
+ "storeMetadataToStorage: exception"), *this, uno::makeAny(e));
+ }
+}
+
+void SAL_CALL
+DocumentMetadataAccess::loadMetadataFromMedium(
+ const uno::Sequence< beans::PropertyValue > & i_rMedium)
+throw (uno::RuntimeException, lang::IllegalArgumentException,
+ lang::WrappedTargetException)
+{
+ uno::Reference<io::XInputStream> xIn;
+ ::comphelper::MediaDescriptor md(i_rMedium);
+ ::rtl::OUString URL;
+ md[ ::comphelper::MediaDescriptor::PROP_URL() ] >>= URL;
+ ::rtl::OUString BaseURL;
+ md[ ::comphelper::MediaDescriptor::PROP_DOCUMENTBASEURL() ] >>= BaseURL;
+ if (md.addInputStream()) {
+ md[ ::comphelper::MediaDescriptor::PROP_INPUTSTREAM() ] >>= xIn;
+ }
+ if (!xIn.is() && URL.equalsAscii("")) {
+ throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::loadMetadataFromMedium: "
+ "inalid medium: no URL, no input stream"), *this, 0);
+ }
+ uno::Reference<embed::XStorage> xStorage;
+ try {
+ const uno::Reference<lang::XMultiServiceFactory> xMsf (
+ m_pImpl->m_xContext->getServiceManager(), uno::UNO_QUERY_THROW);
+ if (xIn.is()) {
+ xStorage = ::comphelper::OStorageHelper::GetStorageFromInputStream(
+ xIn, xMsf);
+ } else { // fallback to url
+ xStorage = ::comphelper::OStorageHelper::GetStorageFromURL2(
+ URL, embed::ElementModes::READ, xMsf);
+ }
+ } catch (uno::RuntimeException &) {
+ throw;
+ } catch (io::IOException &) {
+ throw;
+ } catch (uno::Exception & e) {
+ throw lang::WrappedTargetException(
+ ::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::loadMetadataFromMedium: "
+ "exception"), *this, uno::makeAny(e));
+ }
+ if (!xStorage.is()) {
+ throw uno::RuntimeException(::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::loadMetadataFromMedium: "
+ "cannot get Storage"), *this);
+ }
+ uno::Reference<rdf::XURI> xBaseURI;
+ try {
+ xBaseURI = createBaseURI(m_pImpl->m_xContext, xStorage, BaseURL);
+ } catch (uno::Exception &) {
+ // fall back to URL
+ try {
+ xBaseURI = createBaseURI(m_pImpl->m_xContext, xStorage, URL);
+ } catch (uno::Exception &) {
+ OSL_ENSURE(false, "cannot create base URI");
+ }
+ }
+ uno::Reference<task::XInteractionHandler> xIH;
+ md[ ::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER() ] >>= xIH;
+ loadMetadataFromStorage(xStorage, xBaseURI, xIH);
+}
+
+void SAL_CALL
+DocumentMetadataAccess::storeMetadataToMedium(
+ const uno::Sequence< beans::PropertyValue > & i_rMedium)
+throw (uno::RuntimeException, lang::IllegalArgumentException,
+ lang::WrappedTargetException)
+{
+ ::comphelper::MediaDescriptor md(i_rMedium);
+ ::rtl::OUString URL;
+ md[ ::comphelper::MediaDescriptor::PROP_URL() ] >>= URL;
+ if (URL.equalsAscii("")) {
+ throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::storeMetadataToMedium: "
+ "invalid medium: no URL"), *this, 0);
+ }
+
+ SfxMedium aMedium(i_rMedium);
+ uno::Reference<embed::XStorage> xStorage(aMedium.GetOutputStorage());
+
+ bool sfx(false);
+ if (xStorage.is()) {
+ sfx = true;
+ } else {
+ const uno::Reference<lang::XMultiServiceFactory> xMsf (
+ m_pImpl->m_xContext->getServiceManager(), uno::UNO_QUERY_THROW);
+ xStorage = ::comphelper::OStorageHelper::GetStorageFromURL2(
+ URL, embed::ElementModes::WRITE, xMsf);
+ }
+
+ if (!xStorage.is()) {
+ throw uno::RuntimeException(::rtl::OUString::createFromAscii(
+ "DocumentMetadataAccess::storeMetadataToMedium: "
+ "cannot get Storage"), *this);
+ }
+ // set MIME type of the storage
+ ::comphelper::MediaDescriptor::const_iterator iter
+ = md.find(::comphelper::MediaDescriptor::PROP_MEDIATYPE());
+ if (iter != md.end()) {
+ uno::Reference< beans::XPropertySet > xProps(xStorage,
+ uno::UNO_QUERY_THROW);
+ try {
+ // this is NOT supported in FileSystemStorage
+ xProps->setPropertyValue(
+ ::comphelper::MediaDescriptor::PROP_MEDIATYPE(),
+ iter->second);
+ } catch (uno::Exception &) { }
+ }
+ storeMetadataToStorage(xStorage);
+
+ if (sfx) {
+ const sal_Bool bOk = aMedium.Commit();
+ aMedium.Close();
+ if ( !bOk ) {
+ sal_uInt32 nError = aMedium.GetError();
+ if ( nError == ERRCODE_NONE ) {
+ nError = ERRCODE_IO_GENERAL;
+ }
+ task::ErrorCodeIOException ex( ::rtl::OUString(),
+ uno::Reference< uno::XInterface >(), nError);
+ throw lang::WrappedTargetException(::rtl::OUString(), *this,
+ uno::makeAny(ex));
+ }
+ }
+}
+
+} // namespace sfx2
+
diff --git a/sfx2/source/doc/Metadatable.cxx b/sfx2/source/doc/Metadatable.cxx
new file mode 100644
index 000000000000..2ad27856c7cc
--- /dev/null
+++ b/sfx2/source/doc/Metadatable.cxx
@@ -0,0 +1,1860 @@
+/*************************************************************************
+ *
+ * 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: SwMetadatable.cxx,v $
+ * $Revision: 1.1.2.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.
+ *
+ ************************************************************************/
+
+#include "precompiled_sfx2.hxx"
+
+#include <sfx2/Metadatable.hxx>
+#include <sfx2/XmlIdRegistry.hxx>
+
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx> // solarmutex
+
+#include <boost/bind.hpp>
+
+#include <memory>
+#include <hash_map>
+#include <list>
+#include <algorithm>
+#if OSL_DEBUG_LEVEL > 0
+#include <typeinfo>
+#endif
+
+
+/** XML ID handling.
+
+ There is an abstract base class <type>XmlIdRegistry</type>, with
+ 2 subclasses <type>XmlIdRegistryDocument</type> for "normal" documents,
+ and <type>XmlIdRegistryClipboard</type> for clipboard documents.
+ These classes are responsible for managing XML IDs for all elements
+ of the model. Only the implementation of the <type>Metadatable</type>
+ base class needs to know the registries, so they are not in the header.
+
+ The handling of XML IDs differs between clipboard and non-clipboard
+ documents in several aspects. Most importantly, non-clipboard documents
+ can have several elements associated with one XML ID.
+ This is necessary because of the weird undo implementation:
+ deleting a text node moves the deleted node to the undo array, but
+ executing undo will then create a <em>copy</em> of that node in the
+ document array. These 2 nodes must have the same XML ID, because
+ we cannot know whether the user will do a redo next, or something else.
+
+ Because we need to have a mechanism for several objects per XML ID anyway,
+ we use that also to enable some usability features:
+ The document registry has a list of Metadatables per XML ID.
+ This list is sorted by priority, i.e., the first element has highest
+ priority. When inserting copies, care must be taken that they are inserted
+ at the right position: either before or after the source.
+ This is done by <method>Metadatable::RegisterAsCopyOf</method>.
+ When a text node is split, then both resulting text nodes are inserted
+ into the list. If the user then deletes one text node, the other one
+ will have the XML ID.
+ Also, when a Metadatable is copied to the clipboard and then pasted,
+ the copy is inserted into the list. If the user then deletes the source,
+ the XML ID is not lost.
+ The goal is that it should be hard to lose an XML ID by accident, which
+ is especially important as long as we do not have an UI that displays them.
+
+ There are two subclasses of <type>Metadatable</type>:
+ <ul><li><type>MetadatableClipboard</type>: for copies in the clipboard</li>
+ <li><type>MetadatableUndo</type>: for undo, because a Metadatable
+ may be destroyed on delete and a new one created on undo.</li></ul>
+ These serve only to track the position in an XML ID list in a document
+ registry, so that future actions can insert objects at the right position.
+ Unfortunately, inserting dummy objects seems to be necessary:
+ <ul><li>it is not sufficent to just remember the saved id, because then
+ the relative priorities might change when executing the undo</li>
+ <li>it is not sufficient to record the position as an integer, because
+ if we delete a text node and then undo, the node will be copied(!),
+ and we will have one more node in the list.<li>
+ <li>it is not sufficient to record the pointer of the previous/next
+ Metadatable, because if we delete a text node, undo, and then
+ do something to clear the redo array, the original text node is
+ destroyed, and is replaced by the copy created by undo</li></ul>
+
+ If content from a non-clipboard document is copied into a clipboard
+ document, a dummy <type>MetadatableClipboard</type> is inserted into the
+ non-clipboard document registry in order to track the position of the
+ source element. When the clipboard content is pasted back into the source
+ document, this dummy object is used to associate the pasted element with
+ that same XML ID.
+
+ If a <type>Metadatable</type> is deleted or merged,
+ <method>Metadatable::CreateUndo</method> is called, and returns a
+ <type>MetadatableUndo<type> instance, which can be used to undo the action
+ by passing it to <method>Metadatable::RestoreMetadata</method>.
+
+ @author mst
+ */
+
+
+using namespace ::com::sun::star;
+
+using ::sfx2::isValidXmlId;
+
+
+namespace sfx2 {
+
+static const char s_content [] = "content.xml";
+static const char s_styles [] = "styles.xml";
+static const char s_prefix [] = "id"; // prefix for generated xml:id
+
+static bool isContentFile(::rtl::OUString const & i_rPath)
+{
+ return i_rPath.equalsAscii(s_content);
+}
+
+static bool isStylesFile (::rtl::OUString const & i_rPath)
+{
+ return i_rPath.equalsAscii(s_styles);
+}
+
+
+//=============================================================================
+// XML ID handling ---------------------------------------------------
+
+/** handles registration of XMetadatable.
+
+ This class is responsible for guaranteeing that XMetadatable objects
+ always have XML IDs that are unique within a stream.
+
+ This is an abstract base class; see subclasses XmlIdRegistryDocument and
+ XmlIdRegistryClipboard.
+
+ @see SwDoc::GetXmlIdRegistry
+ @see SwDocShell::GetXmlIdRegistry
+ */
+class XmlIdRegistry : public sfx2::IXmlIdRegistry
+{
+
+public:
+ XmlIdRegistry();
+
+ virtual ~XmlIdRegistry();
+
+ /** get the ODF element with the given metadata reference. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XMetadatable > SAL_CALL
+ GetElementByMetadataReference(
+ const ::com::sun::star::beans::StringPair & i_rReference) const;
+
+ /** register an ODF element at a newly generated, unique metadata reference.
+
+ <p>
+ Find a fresh XML ID, and register it for the element.
+ The generated ID does not occur in any stream of the document.
+ </p>
+ */
+ virtual void RegisterMetadatableAndCreateID(Metadatable& i_xObject) = 0;
+
+ /** try to register an ODF element at a given XML ID, or update its
+ registation to a different XML ID.
+
+ <p>
+ If the given new metadata reference is not already occupied in the
+ document, unregister the element at its old metadata reference if
+ it has one, and register the new metadata reference for the element.
+ Note that this method only ensures that XML IDs are unique per stream,
+ so using the same XML ID in both content.xml and styles.xml is allowed.
+ </p>
+
+ @returns
+ true iff the element has successfully been registered
+ */
+ virtual bool TryRegisterMetadatable(Metadatable& i_xObject,
+ ::rtl::OUString const& i_rStreamName, ::rtl::OUString const& i_rIdref)
+ = 0;
+
+ /** unregister an ODF element.
+
+ <p>
+ Unregister the element at its metadata reference.
+ Does not remove the metadata reference from the element.
+ </p>
+
+ @see RemoveXmlIdForElement
+ */
+ virtual void UnregisterMetadatable(Metadatable const&) = 0;
+
+ /** get the metadata reference for the given element. */
+ ::com::sun::star::beans::StringPair
+ GetXmlIdForElement(Metadatable const&) const;
+
+ /** remove the metadata reference for the given element. */
+ virtual void RemoveXmlIdForElement(Metadatable const&) = 0;
+
+protected:
+
+ virtual bool LookupXmlId(const Metadatable& i_xObject,
+ ::rtl::OUString & o_rStream, ::rtl::OUString & o_rIdref) const = 0;
+
+ virtual Metadatable* LookupElement(const ::rtl::OUString & i_rStreamName,
+ const ::rtl::OUString & i_rIdref) const = 0;
+};
+
+// XmlIdRegistryDocument ---------------------------------------------
+
+/** non-clipboard documents */
+class XmlIdRegistryDocument : public XmlIdRegistry
+{
+
+public:
+ XmlIdRegistryDocument();
+
+ virtual ~XmlIdRegistryDocument();
+
+ virtual void RegisterMetadatableAndCreateID(Metadatable& i_xObject);
+
+ virtual bool TryRegisterMetadatable(Metadatable& i_xObject,
+ ::rtl::OUString const& i_rStreamName, ::rtl::OUString const& i_rIdref);
+
+ virtual void UnregisterMetadatable(Metadatable const&);
+
+ virtual void RemoveXmlIdForElement(Metadatable const&);
+
+ /** register i_rCopy as a copy of i_rSource,
+ with precedence iff i_bCopyPrecedesSource is true */
+ void RegisterCopy(Metadatable const& i_rSource, Metadatable & i_rCopy,
+ const bool i_bCopyPrecedesSource);
+
+ /** create a Undo Metadatable for i_rObject. */
+ ::boost::shared_ptr<MetadatableUndo> CreateUndo(
+ Metadatable const& i_rObject);
+
+ /** merge i_rMerged and i_rOther into i_rMerged. */
+ void JoinMetadatables(Metadatable & i_rMerged, Metadatable const& i_rOther);
+
+ // unfortunately public, Metadatable::RegisterAsCopyOf needs this
+ virtual bool LookupXmlId(const Metadatable& i_xObject,
+ ::rtl::OUString & o_rStream, ::rtl::OUString & o_rIdref) const;
+
+private:
+
+ virtual Metadatable* LookupElement(const ::rtl::OUString & i_rStreamName,
+ const ::rtl::OUString & i_rIdref) const;
+
+ struct XmlIdRegistry_Impl;
+ ::std::auto_ptr<XmlIdRegistry_Impl> m_pImpl;
+};
+
+// MetadatableUndo ---------------------------------------------------
+
+/** the horrible Undo Metadatable: is inserted into lists to track position */
+class MetadatableUndo : public Metadatable
+{
+ /// as determined by the stream of the source in original document
+ const bool m_isInContent;
+public:
+ MetadatableUndo(const bool i_isInContent)
+ : m_isInContent(i_isInContent) { }
+ virtual ::sfx2::XmlIdRegistry& GetRegistry()
+ {
+ // N.B. for Undo, m_pReg is initialized by registering this as copy in
+ // CreateUndo; it is never cleared
+ OSL_ENSURE(m_pReg, "no m_pReg in MetadatableUndo ?");
+ return *m_pReg;
+ }
+ virtual bool IsInClipboard() const { return false; }
+ virtual bool IsInUndo() const { return true; }
+ virtual bool IsInContent() const { return m_isInContent; }
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XMetadatable > MakeUnoObject()
+ { OSL_ENSURE(false, "MetadatableUndo::MakeUnoObject"); throw; }
+};
+
+// MetadatableClipboard ----------------------------------------------
+
+/** the horrible Clipboard Metadatable: inserted into lists to track position */
+class MetadatableClipboard : public Metadatable
+{
+ /// as determined by the stream of the source in original document
+ const bool m_isInContent;
+public:
+ MetadatableClipboard(const bool i_isInContent)
+ : m_isInContent(i_isInContent) { }
+ virtual ::sfx2::XmlIdRegistry& GetRegistry()
+ {
+ // N.B. for Clipboard, m_pReg is initialized by registering this as copy in
+ // RegisterAsCopyOf; it is only cleared by OriginNoLongerInBusinessAnymore
+ OSL_ENSURE(m_pReg, "no m_pReg in MetadatableClipboard ?");
+ return *m_pReg;
+ }
+ virtual bool IsInClipboard() const { return true; }
+ virtual bool IsInUndo() const { return false; }
+ virtual bool IsInContent() const { return m_isInContent; }
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XMetadatable > MakeUnoObject()
+ { OSL_ENSURE(false, "MetadatableClipboard::MakeUnoObject"); throw; }
+ void OriginNoLongerInBusinessAnymore() { m_pReg = 0; }
+};
+
+// XmlIdRegistryClipboard --------------------------------------------
+
+class XmlIdRegistryClipboard : public XmlIdRegistry
+{
+
+public:
+ XmlIdRegistryClipboard();
+ virtual ~XmlIdRegistryClipboard();
+
+ virtual void RegisterMetadatableAndCreateID(Metadatable& i_xObject);
+
+ virtual bool TryRegisterMetadatable(Metadatable& i_xObject,
+ ::rtl::OUString const& i_rStreamName, ::rtl::OUString const& i_rIdref);
+
+ virtual void UnregisterMetadatable(Metadatable const&);
+
+ virtual void RemoveXmlIdForElement(Metadatable const&);
+
+ /** register i_rCopy as a copy of i_rSource */
+ MetadatableClipboard & RegisterCopyClipboard(Metadatable & i_rCopy,
+ beans::StringPair const & i_rReference,
+ const bool i_isLatent);
+
+ /** get the Metadatable that links i_rObject to its origin registry */
+ MetadatableClipboard const* SourceLink(Metadatable const& i_rObject);
+
+private:
+ virtual bool LookupXmlId(const Metadatable& i_xObject,
+ ::rtl::OUString & o_rStream, ::rtl::OUString & o_rIdref) const;
+
+ virtual Metadatable* LookupElement(const ::rtl::OUString & i_rStreamName,
+ const ::rtl::OUString & i_rIdref) const;
+
+ /** create a Clipboard Metadatable for i_rObject. */
+ ::boost::shared_ptr<MetadatableClipboard> CreateClipboard(
+ const bool i_isInContent);
+
+ struct XmlIdRegistry_Impl;
+ ::std::auto_ptr<XmlIdRegistry_Impl> m_pImpl;
+};
+
+
+//=============================================================================
+// XmlIdRegistry
+
+::sfx2::IXmlIdRegistry * createXmlIdRegistry(const bool i_DocIsClipboard)
+{
+ return i_DocIsClipboard
+ ? static_cast<XmlIdRegistry*>( new XmlIdRegistryClipboard )
+ : static_cast<XmlIdRegistry*>( new XmlIdRegistryDocument );
+}
+
+XmlIdRegistry::XmlIdRegistry()
+{
+}
+
+XmlIdRegistry::~XmlIdRegistry()
+{
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::rdf::XMetadatable > SAL_CALL
+XmlIdRegistry::GetElementByMetadataReference(
+ const beans::StringPair & i_rReference) const
+{
+ Metadatable* pObject( LookupElement(i_rReference.First,
+ i_rReference.Second) );
+ return pObject ? pObject->MakeUnoObject() : 0;
+}
+
+beans::StringPair
+XmlIdRegistry::GetXmlIdForElement(const Metadatable& i_rObject) const
+{
+ ::rtl::OUString path;
+ ::rtl::OUString idref;
+ if (LookupXmlId(i_rObject, path, idref))
+ {
+ if (LookupElement(path, idref) == &i_rObject)
+ {
+ return beans::StringPair(path, idref);
+ }
+ }
+ return beans::StringPair();
+}
+
+
+/// generate unique xml:id
+template< typename T >
+/*static*/ ::rtl::OUString create_id(const
+ ::std::hash_map< ::rtl::OUString, T, ::rtl::OUStringHash > & i_rXmlIdMap)
+{
+ const ::rtl::OUString prefix( ::rtl::OUString::createFromAscii(s_prefix) );
+ typename ::std::hash_map< ::rtl::OUString, T, ::rtl::OUStringHash >
+ ::const_iterator iter;
+ ::rtl::OUString id;
+ do
+ {
+ const int n( rand() );
+ id = prefix + ::rtl::OUString::valueOf(static_cast<sal_Int64>(n));
+ iter = i_rXmlIdMap.find(id);
+ }
+ while (iter != i_rXmlIdMap.end());
+ return id;
+}
+
+//=============================================================================
+// Document XML ID Registry (_Impl)
+
+/// element list
+typedef ::std::list< Metadatable* > XmlIdList_t;
+
+/// Idref -> (content.xml element list, styles.xml element list)
+typedef ::std::hash_map< ::rtl::OUString,
+ ::std::pair< XmlIdList_t, XmlIdList_t >, ::rtl::OUStringHash > XmlIdMap_t;
+
+/// pointer hash template
+template<typename T> struct PtrHash
+{
+ size_t operator() (T const * i_pT) const
+ {
+ return reinterpret_cast<size_t>(i_pT);
+ }
+};
+
+/// element -> (stream name, idref)
+typedef ::std::hash_map< const Metadatable*,
+ ::std::pair< ::rtl::OUString, ::rtl::OUString>, PtrHash<Metadatable> >
+ XmlIdReverseMap_t;
+
+struct XmlIdRegistryDocument::XmlIdRegistry_Impl
+{
+ XmlIdRegistry_Impl()
+ : m_XmlIdMap(), m_XmlIdReverseMap() { }
+
+ bool TryInsertMetadatable(Metadatable& i_xObject,
+ const ::rtl::OUString & i_rStream, const ::rtl::OUString & i_rIdref);
+
+ bool LookupXmlId(const Metadatable& i_xObject,
+ ::rtl::OUString & o_rStream, ::rtl::OUString & o_rIdref) const;
+
+ Metadatable* LookupElement(const ::rtl::OUString & i_rStreamName,
+ const ::rtl::OUString & i_rIdref) const;
+
+ const XmlIdList_t * LookupElementList(
+ const ::rtl::OUString & i_rStreamName,
+ const ::rtl::OUString & i_rIdref) const;
+
+ XmlIdList_t * LookupElementList(
+ const ::rtl::OUString & i_rStreamName,
+ const ::rtl::OUString & i_rIdref)
+ {
+ return const_cast<XmlIdList_t*>(
+ const_cast<const XmlIdRegistry_Impl*>(this)
+ ->LookupElementList(i_rStreamName, i_rIdref));
+ }
+
+ XmlIdMap_t m_XmlIdMap;
+ XmlIdReverseMap_t m_XmlIdReverseMap;
+};
+
+// -------------------------------------------------------------------
+
+static void
+rmIter(XmlIdMap_t & i_rXmlIdMap, XmlIdMap_t::iterator const& i_rIter,
+ ::rtl::OUString const & i_rStream, Metadatable const& i_rObject)
+{
+ if (i_rIter != i_rXmlIdMap.end())
+ {
+ XmlIdList_t & rList( isContentFile(i_rStream)
+ ? i_rIter->second.first : i_rIter->second.second );
+ rList.remove(&const_cast<Metadatable&>(i_rObject));
+ if (i_rIter->second.first.empty() && i_rIter->second.second.empty())
+ {
+ i_rXmlIdMap.erase(i_rIter);
+ }
+ }
+}
+
+// -------------------------------------------------------------------
+
+const XmlIdList_t *
+XmlIdRegistryDocument::XmlIdRegistry_Impl::LookupElementList(
+ const ::rtl::OUString & i_rStreamName,
+ const ::rtl::OUString & i_rIdref) const
+{
+ const XmlIdMap_t::const_iterator iter( m_XmlIdMap.find(i_rIdref) );
+ if (iter != m_XmlIdMap.end())
+ {
+ OSL_ENSURE(!iter->second.first.empty() || !iter->second.second.empty(),
+ "null entry in m_XmlIdMap");
+ return (isContentFile(i_rStreamName))
+ ? &iter->second.first
+ : &iter->second.second;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+Metadatable*
+XmlIdRegistryDocument::XmlIdRegistry_Impl::LookupElement(
+ const ::rtl::OUString & i_rStreamName,
+ const ::rtl::OUString & i_rIdref) const
+{
+ if (!isValidXmlId(i_rStreamName, i_rIdref))
+ {
+ throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ "illegal XmlId"), 0, 0);
+ }
+
+ const XmlIdList_t * pList( LookupElementList(i_rStreamName, i_rIdref) );
+ if (pList)
+ {
+ const XmlIdList_t::const_iterator iter(
+ ::std::find_if(pList->begin(), pList->end(),
+ ::boost::bind(
+ ::std::logical_not<bool>(),
+ ::boost::bind(
+ ::std::logical_or<bool>(),
+ ::boost::bind( &Metadatable::IsInUndo, _1 ),
+ ::boost::bind( &Metadatable::IsInClipboard, _1 )
+ ) ) ) );
+ if (iter != pList->end())
+ {
+ return *iter;
+ }
+ }
+ return 0;
+}
+
+bool
+XmlIdRegistryDocument::XmlIdRegistry_Impl::LookupXmlId(
+ const Metadatable& i_rObject,
+ ::rtl::OUString & o_rStream, ::rtl::OUString & o_rIdref) const
+{
+ const XmlIdReverseMap_t::const_iterator iter(
+ m_XmlIdReverseMap.find(&i_rObject) );
+ if (iter != m_XmlIdReverseMap.end())
+ {
+ OSL_ENSURE(!iter->second.first.equalsAscii(""),
+ "null stream in m_XmlIdReverseMap");
+ OSL_ENSURE(!iter->second.second.equalsAscii(""),
+ "null id in m_XmlIdReverseMap");
+ o_rStream = iter->second.first;
+ o_rIdref = iter->second.second;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+bool
+XmlIdRegistryDocument::XmlIdRegistry_Impl::TryInsertMetadatable(
+ Metadatable & i_rObject,
+ const ::rtl::OUString & i_rStreamName, const ::rtl::OUString & i_rIdref)
+{
+ const bool bContent( isContentFile(i_rStreamName) );
+ OSL_ENSURE(isContentFile(i_rStreamName) || isStylesFile(i_rStreamName),
+ "invalid stream");
+
+ XmlIdList_t * pList( LookupElementList(i_rStreamName, i_rIdref) );
+ if (pList)
+ {
+ if (pList->empty())
+ {
+ pList->push_back( &i_rObject );
+ return true;
+ }
+ else
+ {
+ // this is only called from TryRegister now, so check
+ // if all elements in the list are deleted (in undo) or
+ // placeholders, then "steal" the id from them
+ if ( pList->end() == ::std::find_if(pList->begin(), pList->end(),
+ ::boost::bind(
+ ::std::logical_not<bool>(),
+ ::boost::bind(
+ ::std::logical_or<bool>(),
+ ::boost::bind( &Metadatable::IsInUndo, _1 ),
+ ::boost::bind( &Metadatable::IsInClipboard, _1 )
+ ) ) ) )
+ {
+// ??? this is not undoable
+// pList->clear();
+// pList->push_back( &i_rObject );
+ pList->push_front( &i_rObject );
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ }
+ else
+ {
+ m_XmlIdMap.insert(::std::make_pair(i_rIdref, bContent
+ ? ::std::make_pair( XmlIdList_t( 1, &i_rObject ), XmlIdList_t() )
+ : ::std::make_pair( XmlIdList_t(), XmlIdList_t( 1, &i_rObject ) )));
+ return true;
+ }
+}
+
+//=============================================================================
+// Document XML ID Registry
+
+
+XmlIdRegistryDocument::XmlIdRegistryDocument()
+ : m_pImpl( new XmlIdRegistry_Impl )
+{
+}
+
+static void
+removeLink(Metadatable* i_pObject)
+{
+ OSL_ENSURE(i_pObject, "null in list ???");
+ if (!i_pObject) return;
+ if (i_pObject->IsInClipboard())
+ {
+ MetadatableClipboard* pLink(
+ dynamic_cast<MetadatableClipboard*>( i_pObject ) );
+ OSL_ENSURE(pLink, "IsInClipboard, but no MetadatableClipboard ?");
+ if (pLink)
+ {
+ pLink->OriginNoLongerInBusinessAnymore();
+ }
+ }
+}
+
+XmlIdRegistryDocument::~XmlIdRegistryDocument()
+{
+ // notify all list elements that are actually in the clipboard
+ for (XmlIdMap_t::iterator iter(m_pImpl->m_XmlIdMap.begin());
+ iter != m_pImpl->m_XmlIdMap.end(); ++iter)
+ {
+ ::std::for_each(iter->second.first.begin(), iter->second.first.end(),
+ removeLink);
+ ::std::for_each(iter->second.second.begin(), iter->second.second.end(),
+ removeLink);
+ }
+}
+
+bool
+XmlIdRegistryDocument::LookupXmlId(
+ const Metadatable& i_rObject,
+ ::rtl::OUString & o_rStream, ::rtl::OUString & o_rIdref) const
+{
+ return m_pImpl->LookupXmlId(i_rObject, o_rStream, o_rIdref);
+}
+
+Metadatable*
+XmlIdRegistryDocument::LookupElement(
+ const ::rtl::OUString & i_rStreamName,
+ const ::rtl::OUString & i_rIdref) const
+{
+ return m_pImpl->LookupElement(i_rStreamName, i_rIdref);
+}
+
+bool
+XmlIdRegistryDocument::TryRegisterMetadatable(Metadatable & i_rObject,
+ ::rtl::OUString const& i_rStreamName, ::rtl::OUString const& i_rIdref)
+{
+ OSL_TRACE("TryRegisterMetadatable: %p (%s#%s)\n", &i_rObject,
+ ::rtl::OUStringToOString(i_rStreamName, RTL_TEXTENCODING_UTF8).getStr(),
+ ::rtl::OUStringToOString(i_rIdref, RTL_TEXTENCODING_UTF8).getStr());
+
+ OSL_ENSURE(!dynamic_cast<MetadatableUndo*>(&i_rObject),
+ "TryRegisterMetadatable called for MetadatableUndo?");
+ OSL_ENSURE(!dynamic_cast<MetadatableClipboard*>(&i_rObject),
+ "TryRegisterMetadatable called for MetadatableClipboard?");
+
+ if (!isValidXmlId(i_rStreamName, i_rIdref))
+ {
+ throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ "illegal XmlId"), 0, 0);
+ }
+ if (i_rObject.IsInContent()
+ ? !isContentFile(i_rStreamName)
+ : !isStylesFile(i_rStreamName))
+ {
+ throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ "illegal XmlId: wrong stream"), 0, 0);
+ }
+
+ ::rtl::OUString old_path;
+ ::rtl::OUString old_idref;
+ m_pImpl->LookupXmlId(i_rObject, old_path, old_idref);
+ if (old_path == i_rStreamName && old_idref == i_rIdref)
+ {
+ return (m_pImpl->LookupElement(old_path, old_idref) == &i_rObject);
+ }
+ XmlIdMap_t::iterator old_id( m_pImpl->m_XmlIdMap.end() );
+ if (!old_idref.equalsAscii(""))
+ {
+ old_id = m_pImpl->m_XmlIdMap.find(old_idref);
+ OSL_ENSURE(old_id != m_pImpl->m_XmlIdMap.end(), "old id not found");
+ }
+ if (m_pImpl->TryInsertMetadatable(i_rObject, i_rStreamName, i_rIdref))
+ {
+ rmIter(m_pImpl->m_XmlIdMap, old_id, old_path, i_rObject);
+ m_pImpl->m_XmlIdReverseMap[&i_rObject] =
+ ::std::make_pair(i_rStreamName, i_rIdref);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+void
+XmlIdRegistryDocument::RegisterMetadatableAndCreateID(Metadatable & i_rObject)
+{
+ OSL_TRACE("RegisterMetadatableAndCreateID: %p\n", &i_rObject);
+
+ OSL_ENSURE(!dynamic_cast<MetadatableUndo*>(&i_rObject),
+ "RegisterMetadatableAndCreateID called for MetadatableUndo?");
+ OSL_ENSURE(!dynamic_cast<MetadatableClipboard*>(&i_rObject),
+ "RegisterMetadatableAndCreateID called for MetadatableClipboard?");
+
+ const bool isInContent( i_rObject.IsInContent() );
+ const ::rtl::OUString stream( ::rtl::OUString::createFromAscii(
+ isInContent ? s_content : s_styles ) );
+ // check if we have a latent xmlid, and if yes, remove it
+ ::rtl::OUString old_path;
+ ::rtl::OUString old_idref;
+ m_pImpl->LookupXmlId(i_rObject, old_path, old_idref);
+
+ XmlIdMap_t::iterator old_id( m_pImpl->m_XmlIdMap.end() );
+ if (!old_idref.equalsAscii(""))
+ {
+ old_id = m_pImpl->m_XmlIdMap.find(old_idref);
+ OSL_ENSURE(old_id != m_pImpl->m_XmlIdMap.end(), "old id not found");
+ if (m_pImpl->LookupElement(old_path, old_idref) == &i_rObject)
+ {
+ return;
+ }
+ else
+ {
+ // remove latent xmlid
+ rmIter(m_pImpl->m_XmlIdMap, old_id, old_path, i_rObject);
+ }
+ }
+
+ // create id
+ const ::rtl::OUString id( create_id(m_pImpl->m_XmlIdMap) );
+ OSL_ENSURE(m_pImpl->m_XmlIdMap.find(id) == m_pImpl->m_XmlIdMap.end(),
+ "created id is in use");
+ m_pImpl->m_XmlIdMap.insert(::std::make_pair(id, isInContent
+ ? ::std::make_pair( XmlIdList_t( 1, &i_rObject ), XmlIdList_t() )
+ : ::std::make_pair( XmlIdList_t(), XmlIdList_t( 1, &i_rObject ) )));
+ m_pImpl->m_XmlIdReverseMap[&i_rObject] = ::std::make_pair(stream, id);
+}
+
+void XmlIdRegistryDocument::UnregisterMetadatable(const Metadatable& i_rObject)
+{
+ OSL_TRACE("UnregisterMetadatable: %p\n", &i_rObject);
+
+ ::rtl::OUString path;
+ ::rtl::OUString idref;
+ if (!m_pImpl->LookupXmlId(i_rObject, path, idref))
+ {
+ OSL_ENSURE(false, "unregister: no xml id?");
+ return;
+ }
+ const XmlIdMap_t::iterator iter( m_pImpl->m_XmlIdMap.find(idref) );
+ if (iter != m_pImpl->m_XmlIdMap.end())
+ {
+ rmIter(m_pImpl->m_XmlIdMap, iter, path, i_rObject);
+ }
+}
+
+void XmlIdRegistryDocument::RemoveXmlIdForElement(const Metadatable& i_rObject)
+{
+ OSL_TRACE("RemoveXmlIdForElement: %p\n", &i_rObject);
+
+ const XmlIdReverseMap_t::iterator iter(
+ m_pImpl->m_XmlIdReverseMap.find(&i_rObject) );
+ if (iter != m_pImpl->m_XmlIdReverseMap.end())
+ {
+ OSL_ENSURE(!iter->second.second.equalsAscii(""),
+ "null id in m_XmlIdReverseMap");
+ m_pImpl->m_XmlIdReverseMap.erase(iter);
+ }
+}
+
+// -------------------------------------------------------------------
+
+void XmlIdRegistryDocument::RegisterCopy(Metadatable const& i_rSource,
+ Metadatable & i_rCopy, const bool i_bCopyPrecedesSource)
+{
+ OSL_TRACE("RegisterCopy: %p -> %p (%d)\n",
+ &i_rSource, &i_rCopy, i_bCopyPrecedesSource);
+
+ // potential sources: clipboard, undo array, splitNode
+ // assumption: stream change can only happen via clipboard, and is handled
+ // by Metadatable::RegisterAsCopyOf
+ OSL_ENSURE(i_rSource.IsInUndo() || i_rCopy.IsInUndo() ||
+ (i_rSource.IsInContent() == i_rCopy.IsInContent()),
+ "RegisterCopy: not in same stream?");
+
+ ::rtl::OUString path;
+ ::rtl::OUString idref;
+ if (!m_pImpl->LookupXmlId( i_rSource, path, idref ))
+ {
+ OSL_ENSURE(false, "no xml id?");
+ return;
+ }
+ XmlIdList_t * pList ( m_pImpl->LookupElementList(path, idref) );
+ OSL_ENSURE( ::std::find( pList->begin(), pList->end(), &i_rCopy )
+ == pList->end(), "copy already registered???");
+ XmlIdList_t::iterator srcpos(
+ ::std::find( pList->begin(), pList->end(), &i_rSource ) );
+ OSL_ENSURE(srcpos != pList->end(), "source not in list???");
+ if (srcpos == pList->end())
+ {
+ return;
+ }
+ if (i_bCopyPrecedesSource)
+ {
+ pList->insert( srcpos, &i_rCopy );
+ }
+ else
+ {
+ // for undo push_back does not work! must insert right after source
+ pList->insert( ++srcpos, &i_rCopy );
+ }
+ m_pImpl->m_XmlIdReverseMap.insert(::std::make_pair(&i_rCopy,
+ ::std::make_pair(path, idref)));
+}
+
+::boost::shared_ptr<MetadatableUndo>
+XmlIdRegistryDocument::CreateUndo(Metadatable const& i_rObject)
+{
+ OSL_TRACE("CreateUndo: %p\n", &i_rObject);
+
+ return ::boost::shared_ptr<MetadatableUndo>(
+ new MetadatableUndo(i_rObject.IsInContent()) );
+}
+
+/*
+i_rMerged is both a source and the target node of the merge
+i_rOther is the other source, and will be deleted after the merge
+
+dimensions: none|latent|actual empty|nonempty
+i_rMerged(1) i_rOther(2) result
+ *|empty *|empty => 1|2 (arbitrary)
+ *|empty *|nonempty => 2
+ *|nonempty *|empty => 1
+ none|nonempty none|nonempty => none
+ none|nonempty latent|nonempty => 2
+latent|nonempty none|nonempty => 1
+latent|nonempty latent|nonempty => 1|2
+ *|nonempty actual|nonempty => 2
+actual|nonempty *|nonempty => 1
+actual|nonempty actual|nonempty => 1|2
+*/
+void
+XmlIdRegistryDocument::JoinMetadatables(
+ Metadatable & i_rMerged, Metadatable const & i_rOther)
+{
+ OSL_TRACE("JoinMetadatables: %p <- %p\n", &i_rMerged, &i_rOther);
+
+ bool mergedOwnsRef;
+ ::rtl::OUString path;
+ ::rtl::OUString idref;
+ if (m_pImpl->LookupXmlId(i_rMerged, path, idref))
+ {
+ mergedOwnsRef = (m_pImpl->LookupElement(path, idref) == &i_rMerged);
+ }
+ else
+ {
+ OSL_ENSURE(false, "JoinMetadatables: no xmlid?");
+ return;
+ }
+ if (!mergedOwnsRef)
+ {
+ i_rMerged.RemoveMetadataReference();
+ i_rMerged.RegisterAsCopyOf(i_rOther, true);
+ return;
+ }
+ // other cases: merged has actual ref and is nonempty,
+ // other has latent/actual ref and is nonempty: other loses => nothing to do
+}
+
+
+//=============================================================================
+// Clipboard XML ID Registry (_Impl)
+
+struct RMapEntry
+{
+ RMapEntry() : m_pLink() { }
+ RMapEntry(::rtl::OUString const& i_rStream,
+ ::rtl::OUString const& i_rXmlId,
+ ::boost::shared_ptr<MetadatableClipboard> const& i_pLink
+ = ::boost::shared_ptr<MetadatableClipboard>())
+ : m_Stream(i_rStream), m_XmlId(i_rXmlId), m_pLink(i_pLink)
+ {}
+ ::rtl::OUString m_Stream;
+ ::rtl::OUString m_XmlId;
+ // this would have been an auto_ptr, if only that would have compiled...
+ ::boost::shared_ptr<MetadatableClipboard> m_pLink;
+};
+
+/// element -> (stream name, idref, source)
+typedef ::std::hash_map< const Metadatable*,
+ struct RMapEntry,
+ PtrHash<Metadatable> >
+ ClipboardXmlIdReverseMap_t;
+
+/// Idref -> (content.xml element, styles.xml element)
+typedef ::std::hash_map< ::rtl::OUString,
+ ::std::pair< Metadatable*, Metadatable* >, ::rtl::OUStringHash >
+ ClipboardXmlIdMap_t;
+
+struct XmlIdRegistryClipboard::XmlIdRegistry_Impl
+{
+ XmlIdRegistry_Impl()
+ : m_XmlIdMap(), m_XmlIdReverseMap() { }
+
+ bool TryInsertMetadatable(Metadatable& i_xObject,
+ const ::rtl::OUString & i_rStream, const ::rtl::OUString & i_rIdref);
+
+ bool LookupXmlId(const Metadatable& i_xObject,
+ ::rtl::OUString & o_rStream, ::rtl::OUString & o_rIdref,
+ MetadatableClipboard const* &o_rpLink) const;
+
+ Metadatable* LookupElement(const ::rtl::OUString & i_rStreamName,
+ const ::rtl::OUString & i_rIdref) const;
+
+ Metadatable* const* LookupEntry(const ::rtl::OUString & i_rStreamName,
+ const ::rtl::OUString & i_rIdref) const;
+
+ Metadatable* * LookupEntry(const ::rtl::OUString & i_rStreamName,
+ const ::rtl::OUString & i_rIdref)
+ {
+ return const_cast<Metadatable**>(
+ const_cast<const XmlIdRegistry_Impl*>(this)
+ ->LookupEntry(i_rStreamName, i_rIdref));
+ }
+
+ ClipboardXmlIdMap_t m_XmlIdMap;
+ ClipboardXmlIdReverseMap_t m_XmlIdReverseMap;
+};
+
+// -------------------------------------------------------------------
+
+static void
+rmIter(ClipboardXmlIdMap_t & i_rXmlIdMap,
+ ClipboardXmlIdMap_t::iterator const& i_rIter,
+ ::rtl::OUString const & i_rStream, Metadatable const& i_rObject)
+{
+ if (i_rIter != i_rXmlIdMap.end())
+ {
+ Metadatable *& rMeta = isContentFile(i_rStream)
+ ? i_rIter->second.first : i_rIter->second.second;
+ if (rMeta == &i_rObject)
+ {
+ rMeta = 0;
+ }
+ if (!i_rIter->second.first && !i_rIter->second.second)
+ {
+ i_rXmlIdMap.erase(i_rIter);
+ }
+ }
+}
+
+// -------------------------------------------------------------------
+
+Metadatable* const*
+XmlIdRegistryClipboard::XmlIdRegistry_Impl::LookupEntry(
+ const ::rtl::OUString & i_rStreamName,
+ const ::rtl::OUString & i_rIdref) const
+{
+ if (!isValidXmlId(i_rStreamName, i_rIdref))
+ {
+ throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ "illegal XmlId"), 0, 0);
+ }
+
+ const ClipboardXmlIdMap_t::const_iterator iter( m_XmlIdMap.find(i_rIdref) );
+ if (iter != m_XmlIdMap.end())
+ {
+ OSL_ENSURE(iter->second.first || iter->second.second,
+ "null entry in m_XmlIdMap");
+ return (isContentFile(i_rStreamName))
+ ? &iter->second.first
+ : &iter->second.second;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+Metadatable*
+XmlIdRegistryClipboard::XmlIdRegistry_Impl::LookupElement(
+ const ::rtl::OUString & i_rStreamName,
+ const ::rtl::OUString & i_rIdref) const
+{
+ Metadatable * const * ppEntry = LookupEntry(i_rStreamName, i_rIdref);
+ return ppEntry ? *ppEntry : 0;
+}
+
+bool
+XmlIdRegistryClipboard::XmlIdRegistry_Impl::LookupXmlId(
+ const Metadatable& i_rObject,
+ ::rtl::OUString & o_rStream, ::rtl::OUString & o_rIdref,
+ MetadatableClipboard const* &o_rpLink) const
+{
+ const ClipboardXmlIdReverseMap_t::const_iterator iter(
+ m_XmlIdReverseMap.find(&i_rObject) );
+ if (iter != m_XmlIdReverseMap.end())
+ {
+ OSL_ENSURE(!iter->second.m_Stream.equalsAscii(""),
+ "null stream in m_XmlIdReverseMap");
+ OSL_ENSURE(!iter->second.m_XmlId.equalsAscii(""),
+ "null id in m_XmlIdReverseMap");
+ o_rStream = iter->second.m_Stream;
+ o_rIdref = iter->second.m_XmlId;
+ o_rpLink = iter->second.m_pLink.get();
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+bool
+XmlIdRegistryClipboard::XmlIdRegistry_Impl::TryInsertMetadatable(
+ Metadatable & i_rObject,
+ const ::rtl::OUString & i_rStreamName, const ::rtl::OUString & i_rIdref)
+{
+ bool bContent( isContentFile(i_rStreamName) );
+ OSL_ENSURE(isContentFile(i_rStreamName) || isStylesFile(i_rStreamName),
+ "invalid stream");
+
+ //wntmsci12 won't parse this:
+// Metadatable ** ppEntry( LookupEntry(i_rStreamName, i_rIdref) );
+ Metadatable ** ppEntry = LookupEntry(i_rStreamName, i_rIdref);
+ if (ppEntry)
+ {
+ if (*ppEntry)
+ {
+ return false;
+ }
+ else
+ {
+ *ppEntry = &i_rObject;
+ return true;
+ }
+ }
+ else
+ {
+ m_XmlIdMap.insert(::std::make_pair(i_rIdref, bContent
+ ? ::std::make_pair( &i_rObject, static_cast<Metadatable*>(0) )
+ : ::std::make_pair( static_cast<Metadatable*>(0), &i_rObject )));
+ return true;
+ }
+}
+
+//=============================================================================
+// Clipboard XML ID Registry
+
+
+XmlIdRegistryClipboard::XmlIdRegistryClipboard()
+ : m_pImpl( new XmlIdRegistry_Impl )
+{
+}
+
+XmlIdRegistryClipboard::~XmlIdRegistryClipboard()
+{
+}
+
+bool
+XmlIdRegistryClipboard::LookupXmlId(
+ const Metadatable& i_rObject,
+ ::rtl::OUString & o_rStream, ::rtl::OUString & o_rIdref) const
+{
+ const MetadatableClipboard * pLink;
+ return m_pImpl->LookupXmlId(i_rObject, o_rStream, o_rIdref, pLink);
+}
+
+Metadatable*
+XmlIdRegistryClipboard::LookupElement(
+ const ::rtl::OUString & i_rStreamName,
+ const ::rtl::OUString & i_rIdref) const
+{
+ return m_pImpl->LookupElement(i_rStreamName, i_rIdref);
+}
+
+bool
+XmlIdRegistryClipboard::TryRegisterMetadatable(Metadatable & i_rObject,
+ ::rtl::OUString const& i_rStreamName, ::rtl::OUString const& i_rIdref)
+{
+ OSL_TRACE("TryRegisterMetadatable: %p (%s#%s)\n", &i_rObject,
+ ::rtl::OUStringToOString(i_rStreamName, RTL_TEXTENCODING_UTF8).getStr(),
+ ::rtl::OUStringToOString(i_rIdref, RTL_TEXTENCODING_UTF8).getStr());
+
+ OSL_ENSURE(!dynamic_cast<MetadatableUndo*>(&i_rObject),
+ "TryRegisterMetadatable called for MetadatableUndo?");
+ OSL_ENSURE(!dynamic_cast<MetadatableClipboard*>(&i_rObject),
+ "TryRegisterMetadatable called for MetadatableClipboard?");
+
+ if (!isValidXmlId(i_rStreamName, i_rIdref))
+ {
+ throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ "illegal XmlId"), 0, 0);
+ }
+ if (i_rObject.IsInContent()
+ ? !isContentFile(i_rStreamName)
+ : !isStylesFile(i_rStreamName))
+ {
+ throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ "illegal XmlId: wrong stream"), 0, 0);
+ }
+
+ ::rtl::OUString old_path;
+ ::rtl::OUString old_idref;
+ const MetadatableClipboard * pLink;
+ m_pImpl->LookupXmlId(i_rObject, old_path, old_idref, pLink);
+ if (old_path == i_rStreamName && old_idref == i_rIdref)
+ {
+ return (m_pImpl->LookupElement(old_path, old_idref) == &i_rObject);
+ }
+ ClipboardXmlIdMap_t::iterator old_id( m_pImpl->m_XmlIdMap.end() );
+ if (!old_idref.equalsAscii(""))
+ {
+ old_id = m_pImpl->m_XmlIdMap.find(old_idref);
+ OSL_ENSURE(old_id != m_pImpl->m_XmlIdMap.end(), "old id not found");
+ }
+ if (m_pImpl->TryInsertMetadatable(i_rObject, i_rStreamName, i_rIdref))
+ {
+ rmIter(m_pImpl->m_XmlIdMap, old_id, old_path, i_rObject);
+ m_pImpl->m_XmlIdReverseMap[&i_rObject] =
+ RMapEntry(i_rStreamName, i_rIdref);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+void
+XmlIdRegistryClipboard::RegisterMetadatableAndCreateID(Metadatable & i_rObject)
+{
+ OSL_TRACE("RegisterMetadatableAndCreateID: %p\n", &i_rObject);
+
+ OSL_ENSURE(!dynamic_cast<MetadatableUndo*>(&i_rObject),
+ "RegisterMetadatableAndCreateID called for MetadatableUndo?");
+ OSL_ENSURE(!dynamic_cast<MetadatableClipboard*>(&i_rObject),
+ "RegisterMetadatableAndCreateID called for MetadatableClipboard?");
+
+ bool isInContent( i_rObject.IsInContent() );
+ ::rtl::OUString stream( ::rtl::OUString::createFromAscii(
+ isInContent ? s_content : s_styles ) );
+
+ ::rtl::OUString old_path;
+ ::rtl::OUString old_idref;
+ LookupXmlId(i_rObject, old_path, old_idref);
+ if (!old_idref.equalsAscii("") &&
+ (m_pImpl->LookupElement(old_path, old_idref) == &i_rObject))
+ {
+ return;
+ }
+
+ // create id
+ const ::rtl::OUString id( create_id(m_pImpl->m_XmlIdMap) );
+ OSL_ENSURE(m_pImpl->m_XmlIdMap.find(id) == m_pImpl->m_XmlIdMap.end(),
+ "created id is in use");
+ m_pImpl->m_XmlIdMap.insert(::std::make_pair(id, isInContent
+ ? ::std::make_pair( &i_rObject, static_cast<Metadatable*>(0) )
+ : ::std::make_pair( static_cast<Metadatable*>(0), &i_rObject )));
+ // N.B.: if i_rObject had a latent XmlId, then we implicitly delete the
+ // MetadatableClipboard and thus the latent XmlId here
+ m_pImpl->m_XmlIdReverseMap[&i_rObject] = RMapEntry(stream, id);
+}
+
+void XmlIdRegistryClipboard::UnregisterMetadatable(const Metadatable& i_rObject)
+{
+ OSL_TRACE("UnregisterMetadatable: %p\n", &i_rObject);
+
+ ::rtl::OUString path;
+ ::rtl::OUString idref;
+ const MetadatableClipboard * pLink;
+ if (!m_pImpl->LookupXmlId(i_rObject, path, idref, pLink))
+ {
+ OSL_ENSURE(false, "unregister: no xml id?");
+ return;
+ }
+ const ClipboardXmlIdMap_t::iterator iter( m_pImpl->m_XmlIdMap.find(idref) );
+ if (iter != m_pImpl->m_XmlIdMap.end())
+ {
+ rmIter(m_pImpl->m_XmlIdMap, iter, path, i_rObject);
+ }
+}
+
+
+void XmlIdRegistryClipboard::RemoveXmlIdForElement(const Metadatable& i_rObject)
+{
+ OSL_TRACE("RemoveXmlIdForElement: %p\n", &i_rObject);
+
+ ClipboardXmlIdReverseMap_t::iterator iter(
+ m_pImpl->m_XmlIdReverseMap.find(&i_rObject) );
+ if (iter != m_pImpl->m_XmlIdReverseMap.end())
+ {
+ OSL_ENSURE(!iter->second.m_XmlId.equalsAscii(""),
+ "null id in m_XmlIdReverseMap");
+ m_pImpl->m_XmlIdReverseMap.erase(iter);
+ }
+}
+
+// -------------------------------------------------------------------
+
+::boost::shared_ptr<MetadatableClipboard>
+XmlIdRegistryClipboard::CreateClipboard(const bool i_isInContent)
+{
+ OSL_TRACE("CreateClipboard: \n");
+
+ return ::boost::shared_ptr<MetadatableClipboard>(
+ new MetadatableClipboard(i_isInContent) );
+}
+
+MetadatableClipboard &
+XmlIdRegistryClipboard::RegisterCopyClipboard(Metadatable & i_rCopy,
+ beans::StringPair const & i_rReference,
+ const bool i_isLatent)
+{
+ OSL_TRACE("RegisterCopyClipboard: %p -> "/*"%p"*/"(%s#%s) (%d)\n",
+ /*&i_rSource,*/ &i_rCopy,
+ ::rtl::OUStringToOString(i_rReference.First,
+ RTL_TEXTENCODING_UTF8).getStr(),
+ ::rtl::OUStringToOString(i_rReference.Second,
+ RTL_TEXTENCODING_UTF8).getStr(),
+ i_isLatent);
+
+ // N.B.: when copying to the clipboard, the selection is always inserted
+ // into the body, even if the source is a header/footer!
+ // so we do not check whether the stream is right in this function
+
+ if (!isValidXmlId(i_rReference.First, i_rReference.Second))
+ {
+ throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ "illegal XmlId"), 0, 0);
+ }
+
+ if (!i_isLatent)
+ {
+ // this should succeed assuming clipboard has a single source document
+ const bool success( m_pImpl->TryInsertMetadatable(i_rCopy,
+ i_rReference.First, i_rReference.Second) );
+ OSL_ENSURE(success, "RegisterCopyClipboard: TryInsert failed?");
+ (void) success;
+ }
+ const ::boost::shared_ptr<MetadatableClipboard> pLink(
+ CreateClipboard( isContentFile(i_rReference.First)) );
+ m_pImpl->m_XmlIdReverseMap.insert(::std::make_pair(&i_rCopy,
+ RMapEntry(i_rReference.First, i_rReference.Second, pLink)));
+ return *pLink.get();
+}
+
+MetadatableClipboard const*
+XmlIdRegistryClipboard::SourceLink(Metadatable const& i_rObject)
+{
+ ::rtl::OUString path;
+ ::rtl::OUString idref;
+ const MetadatableClipboard * pLink( 0 );
+ m_pImpl->LookupXmlId(i_rObject, path, idref, pLink);
+ return pLink;
+}
+
+
+//=============================================================================
+// Metadatable mixin
+
+
+Metadatable::~Metadatable()
+{
+ RemoveMetadataReference();
+}
+
+void Metadatable::RemoveMetadataReference()
+{
+ try
+ {
+ if (m_pReg)
+ {
+ m_pReg->UnregisterMetadatable( *this );
+ m_pReg->RemoveXmlIdForElement( *this );
+ m_pReg = 0;
+ }
+ }
+ catch (uno::Exception &)
+ {
+ OSL_ENSURE(false, "Metadatable::RemoveMetadataReference: exception");
+ }
+}
+
+// ::com::sun::star::rdf::XMetadatable:
+beans::StringPair
+Metadatable::GetMetadataReference() const
+{
+ if (m_pReg)
+ {
+ return m_pReg->GetXmlIdForElement(*this);
+ }
+ return beans::StringPair();
+}
+
+void
+Metadatable::SetMetadataReference(
+ const ::com::sun::star::beans::StringPair & i_rReference)
+{
+ if (i_rReference.Second.equalsAscii(""))
+ {
+ RemoveMetadataReference();
+ }
+ else
+ {
+ ::rtl::OUString streamName( i_rReference.First );
+ if (streamName.equalsAscii(""))
+ {
+ // handle empty stream name as auto-detect.
+ // necessary for importing flat file format.
+ streamName = ::rtl::OUString::createFromAscii(
+ IsInContent() ? s_content : s_styles );
+ }
+ XmlIdRegistry & rReg( dynamic_cast<XmlIdRegistry&>( GetRegistry() ) );
+ if (rReg.TryRegisterMetadatable(*this, streamName, i_rReference.Second))
+ {
+ m_pReg = &rReg;
+ }
+ else
+ {
+ throw lang::IllegalArgumentException(
+ ::rtl::OUString::createFromAscii("Metadatable::"
+ "SetMetadataReference: argument is invalid"), /*this*/0, 0);
+ }
+ }
+}
+
+void Metadatable::EnsureMetadataReference()
+{
+ XmlIdRegistry& rReg(
+ m_pReg ? *m_pReg : dynamic_cast<XmlIdRegistry&>( GetRegistry() ) );
+ rReg.RegisterMetadatableAndCreateID( *this );
+ m_pReg = &rReg;
+}
+
+const ::sfx2::IXmlIdRegistry& GetRegistryConst(Metadatable const& i_rObject)
+{
+ return const_cast< Metadatable& >( i_rObject ).GetRegistry();
+}
+
+void
+Metadatable::RegisterAsCopyOf(Metadatable const & i_rSource,
+ const bool i_bCopyPrecedesSource)
+{
+ OSL_ENSURE(typeid(*this) == typeid(i_rSource)
+ || typeid(i_rSource) == typeid(MetadatableUndo)
+ || typeid(*this) == typeid(MetadatableUndo)
+ || typeid(i_rSource) == typeid(MetadatableClipboard)
+ || typeid(*this) == typeid(MetadatableClipboard),
+ "RegisterAsCopyOf element with different class?");
+ OSL_ENSURE(!this->m_pReg, "RegisterAsCopyOf called on element with XmlId?");
+
+ if (this->m_pReg)
+ {
+ RemoveMetadataReference();
+ }
+
+ try
+ {
+ if (i_rSource.m_pReg)
+ {
+ XmlIdRegistry & rReg(
+ dynamic_cast<XmlIdRegistry&>( GetRegistry() ) );
+ if (i_rSource.m_pReg == &rReg)
+ {
+ OSL_ENSURE(!IsInClipboard(),
+ "RegisterAsCopy: both in clipboard?");
+ if (!IsInClipboard())
+ {
+ XmlIdRegistryDocument & rRegDoc(
+ dynamic_cast<XmlIdRegistryDocument&>( rReg ) );
+ rRegDoc.RegisterCopy(i_rSource, *this,
+ i_bCopyPrecedesSource);
+ this->m_pReg = &rRegDoc;
+ }
+ return;
+ }
+ // source is in different document
+ XmlIdRegistryDocument * pRegDoc(
+ dynamic_cast<XmlIdRegistryDocument *>(&rReg) );
+ XmlIdRegistryClipboard * pRegClp(
+ dynamic_cast<XmlIdRegistryClipboard*>(&rReg) );
+
+ if (pRegClp)
+ {
+ beans::StringPair SourceRef(
+ i_rSource.m_pReg->GetXmlIdForElement(i_rSource) );
+ bool isLatent( SourceRef.Second.equalsAscii("") );
+ XmlIdRegistryDocument * pSourceRegDoc(
+ dynamic_cast<XmlIdRegistryDocument*>(i_rSource.m_pReg) );
+ OSL_ENSURE(pSourceRegDoc, "RegisterAsCopyOf: 2 clipboards?");
+ if (!pSourceRegDoc) return;
+ // this is a copy _to_ the clipboard
+ if (isLatent)
+ {
+ pSourceRegDoc->LookupXmlId(i_rSource,
+ SourceRef.First, SourceRef.Second);
+ }
+ Metadatable & rLink(
+ pRegClp->RegisterCopyClipboard(*this, SourceRef, isLatent));
+ this->m_pReg = pRegClp;
+ // register as copy in the non-clipboard registry
+ pSourceRegDoc->RegisterCopy(i_rSource, rLink,
+ false); // i_bCopyPrecedesSource);
+ rLink.m_pReg = pSourceRegDoc;
+ }
+ else if (pRegDoc)
+ {
+ XmlIdRegistryClipboard * pSourceRegClp(
+ dynamic_cast<XmlIdRegistryClipboard*>(i_rSource.m_pReg) );
+ OSL_ENSURE(pSourceRegClp,
+ "RegisterAsCopyOf: 2 non-clipboards?");
+ if (!pSourceRegClp) return;
+ const MetadatableClipboard * pLink(
+ pSourceRegClp->SourceLink(i_rSource) );
+ // may happen if src got its id via UNO call
+ if (!pLink) return;
+ // only register copy if clipboard content is from this SwDoc!
+ if (pLink && (&GetRegistryConst(*pLink) == pRegDoc))
+ {
+ // this is a copy _from_ the clipboard; check if the
+ // element is still in the same stream
+ // N.B.: we check the stream of pLink, not of i_rSource!
+ bool srcInContent( pLink->IsInContent() );
+ bool tgtInContent( this->IsInContent() );
+ if (srcInContent == tgtInContent)
+ {
+ pRegDoc->RegisterCopy(*pLink, *this,
+ true); // i_bCopyPrecedesSource);
+ this->m_pReg = pRegDoc;
+ }
+ // otherwise: stream change! do not register!
+ }
+ }
+ else
+ {
+ OSL_ENSURE(false, "neither RegDoc nor RegClp cannot happen");
+ }
+#if 0
+ {
+ //FIXME: do we need this at all???
+ XmlIdRegistryDocument & rRegDoc(
+ dynamic_cast<XmlIdRegistryDocument&>( rReg ) );
+ {
+ if (rRegDoc.TryRegisterMetadatable(*this, SourceRef))
+ {
+ this->m_pReg = &rRegDoc;
+ }
+ }
+ }
+#endif
+ }
+ }
+ catch (uno::Exception &)
+ {
+ OSL_ENSURE(false, "Metadatable::RegisterAsCopyOf: exception");
+ }
+}
+
+::boost::shared_ptr<MetadatableUndo> Metadatable::CreateUndo(
+ const bool i_isDelete)
+{
+ OSL_ENSURE(!IsInUndo(), "CreateUndo called for object in undo?");
+ OSL_ENSURE(!IsInClipboard(), "CreateUndo called for object in clipboard?");
+ try
+ {
+ if (!IsInClipboard() && !IsInUndo() && m_pReg)
+ {
+ XmlIdRegistryDocument * pRegDoc(
+ dynamic_cast<XmlIdRegistryDocument*>( m_pReg ) );
+ ::boost::shared_ptr<MetadatableUndo> pUndo(
+ pRegDoc->CreateUndo(*this) );
+ pRegDoc->RegisterCopy(*this, *pUndo, false);
+ pUndo->m_pReg = pRegDoc;
+
+ if (i_isDelete)
+ {
+ RemoveMetadataReference();
+ }
+ return pUndo;
+ }
+ }
+ catch (uno::Exception &)
+ {
+ OSL_ENSURE(false, "Metadatable::CreateUndo: exception");
+ }
+ return ::boost::shared_ptr<MetadatableUndo>();
+}
+
+void Metadatable::RestoreMetadata(
+ ::boost::shared_ptr<MetadatableUndo> const& i_pUndo)
+{
+ OSL_ENSURE(!IsInUndo(), "RestoreMetadata called for object in undo?");
+ OSL_ENSURE(!IsInClipboard(),
+ "RestoreMetadata called for object in clipboard?");
+ if (IsInClipboard() || IsInUndo()) return;
+ RemoveMetadataReference();
+ if (i_pUndo)
+ {
+ this->RegisterAsCopyOf(*i_pUndo, true);
+ }
+}
+
+void
+Metadatable::JoinMetadatable(Metadatable const & i_rOther,
+ const bool i_isMergedEmpty, const bool i_isOtherEmpty)
+{
+ OSL_ENSURE(!IsInUndo(), "JoinMetadatables called for object in undo?");
+ OSL_ENSURE(!IsInClipboard(),
+ "JoinMetadatables called for object in clipboard?");
+ if (IsInClipboard() || IsInUndo()) return;
+
+ if (i_isOtherEmpty && !i_isMergedEmpty)
+ {
+ // other is empty, thus loses => nothing to do
+ return;
+ }
+ if (i_isMergedEmpty && !i_isOtherEmpty)
+ {
+ this->RemoveMetadataReference();
+ this->RegisterAsCopyOf(i_rOther, true);
+ return;
+ }
+
+ if (!i_rOther.m_pReg)
+ {
+ // other doesn't have xmlid, thus loses => nothing to do
+ return;
+ }
+ if (!m_pReg)
+ {
+ this->RegisterAsCopyOf(i_rOther, true);
+ // assumption: i_rOther will be deleted, so don't unregister it here
+ return;
+ }
+ try
+ {
+ XmlIdRegistryDocument * pRegDoc(
+ dynamic_cast<XmlIdRegistryDocument*>( m_pReg ) );
+ OSL_ENSURE(pRegDoc, "JoinMetadatable: no pRegDoc?");
+ if (pRegDoc)
+ {
+ pRegDoc->JoinMetadatables(*this, i_rOther);
+ }
+ }
+ catch (uno::Exception &)
+ {
+ OSL_ENSURE(false, "Metadatable::JoinMetadatable: exception");
+ }
+}
+
+
+//=============================================================================
+// XMetadatable mixin
+
+// ::com::sun::star::rdf::XNode:
+::rtl::OUString SAL_CALL MetadatableMixin::getStringValue()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return getNamespace() + getLocalName();
+}
+
+// ::com::sun::star::rdf::XURI:
+::rtl::OUString SAL_CALL MetadatableMixin::getLocalName()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ beans::StringPair mdref( getMetadataReference() );
+ if (!mdref.Second.getLength())
+ {
+ ensureMetadataReference(); // N.B.: side effect!
+ mdref = getMetadataReference();
+ }
+ ::rtl::OUStringBuffer buf;
+ buf.append(mdref.First);
+ buf.append(static_cast<sal_Unicode>('#'));
+ buf.append(mdref.Second);
+ return buf.makeStringAndClear();
+}
+
+::rtl::OUString SAL_CALL MetadatableMixin::getNamespace()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ const uno::Reference< frame::XModel > xModel( GetModel() );
+ const uno::Reference< rdf::XURI > xDMA( xModel, uno::UNO_QUERY_THROW );
+ return xDMA->getStringValue();
+}
+
+// ::com::sun::star::rdf::XMetadatable:
+beans::StringPair SAL_CALL
+MetadatableMixin::getMetadataReference()
+throw (uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ Metadatable* pObject( GetCoreObject() );
+ if (pObject)
+ {
+ return pObject->GetMetadataReference();
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+}
+
+void SAL_CALL
+MetadatableMixin::setMetadataReference(
+ const beans::StringPair & i_rReference)
+throw (uno::RuntimeException, lang::IllegalArgumentException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ Metadatable* pObject( GetCoreObject() );
+ if (pObject)
+ {
+ return pObject->SetMetadataReference(i_rReference);
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+}
+
+void SAL_CALL MetadatableMixin::ensureMetadataReference()
+throw (uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ Metadatable* pObject( GetCoreObject() );
+ if (pObject)
+ {
+ return pObject->EnsureMetadataReference();
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+}
+
+} // namespace sfx2
+
+
+//=============================================================================
+
+#if OSL_DEBUG_LEVEL > 1
+
+static ::sfx2::XmlIdRegistryDocument s_Reg;
+static ::sfx2::XmlIdRegistryClipboard s_RegClip;
+
+class MockMetadatable : public ::sfx2::Metadatable
+{
+public:
+ MockMetadatable(bool i_isInClip = false) :
+ m_bInClipboard(i_isInClip), m_bInUndo(false), m_bInContent(true) {}
+ bool m_bInClipboard;
+ bool m_bInUndo;
+ bool m_bInContent;
+ virtual bool IsInClipboard() const { return m_bInClipboard; }
+ virtual bool IsInUndo() const { return m_bInUndo; }
+ virtual bool IsInContent() const { return m_bInContent; }
+ virtual ::sfx2::XmlIdRegistry& GetRegistry() { return m_bInClipboard ? static_cast< ::sfx2::XmlIdRegistry&>(s_RegClip) : static_cast< ::sfx2::XmlIdRegistry&>(s_Reg); }
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XMetadatable > MakeUnoObject() { return 0; }
+};
+
+bool operator==(beans::StringPair p1, beans::StringPair p2)
+{
+ return p1.First == p2.First && p1.Second == p2.Second;
+}
+
+void test()
+{
+ OSL_TRACE("SwMetadatable test(): start\n");
+ MockMetadatable m1;
+ MockMetadatable m2;
+ MockMetadatable m3;
+ MockMetadatable m4;
+ MockMetadatable m5;
+ ::rtl::OUString empty;
+ ::rtl::OUString content( ::rtl::OUString::createFromAscii("content.xml") );
+ ::rtl::OUString styles ( ::rtl::OUString::createFromAscii("styles.xml") );
+ ::rtl::OUString sid1( ::rtl::OUString::createFromAscii("id1") );
+ ::rtl::OUString sid2( ::rtl::OUString::createFromAscii("id2") );
+ ::rtl::OUString sid3( ::rtl::OUString::createFromAscii("id3") );
+ ::rtl::OUString sid4( ::rtl::OUString::createFromAscii("id4") );
+ beans::StringPair id1(content, sid1);
+ beans::StringPair id2(content, sid2);
+ beans::StringPair id3(content, sid3);
+ beans::StringPair id4(styles, sid4);
+ beans::StringPair id3e(empty, sid3);
+ beans::StringPair id4e(empty, sid4);
+ m1.SetMetadataReference(id1);
+ OSL_ENSURE(m1.GetMetadataReference() == id1, "set failed");
+ try {
+ m2.SetMetadataReference(id1);
+ OSL_ENSURE(false, "set duplicate succeeded");
+ } catch (lang::IllegalArgumentException) { }
+ m1.SetMetadataReference(id1);
+ OSL_ENSURE(m1.GetMetadataReference() == id1, "set failed (existing)");
+ m1.EnsureMetadataReference();
+ OSL_ENSURE(m1.GetMetadataReference() == id1, "ensure failed (existing)");
+
+ m2.EnsureMetadataReference();
+ beans::StringPair m2id(m2.GetMetadataReference());
+ OSL_ENSURE(m2id.Second.getLength(), "ensure failed");
+ m2.EnsureMetadataReference();
+ OSL_ENSURE(m2.GetMetadataReference() == m2id, "ensure failed (idempotent)");
+
+ m1.m_bInUndo = true;
+ OSL_ENSURE(!m1.GetMetadataReference().Second.getLength(), "move to undo failed");
+
+ m1.m_bInUndo = false;
+ OSL_ENSURE(m1.GetMetadataReference() == id1, "move from undo failed");
+
+ m1.m_bInUndo = true;
+ try {
+ m2.SetMetadataReference(id1); // steal!
+ } catch (lang::IllegalArgumentException &) {
+ OSL_ENSURE(false, "set duplicate to undo failed");
+ }
+ m1.m_bInUndo = false;
+ OSL_ENSURE(!m1.GetMetadataReference().Second.getLength(), "move from undo: duplicate");
+
+ m3.RegisterAsCopyOf(m2);
+ OSL_ENSURE(m2.GetMetadataReference() == id1, "copy: source");
+ OSL_ENSURE(!m3.GetMetadataReference().Second.getLength(), "copy: duplicate");
+ m4.RegisterAsCopyOf(m3);
+ OSL_ENSURE(m2.GetMetadataReference() == id1, "copy: source");
+ OSL_ENSURE(!m3.GetMetadataReference().Second.getLength(), "copy: duplicate");
+ OSL_ENSURE(!m4.GetMetadataReference().Second.getLength(), "copy: duplicate");
+ m2.m_bInUndo = true;
+ OSL_ENSURE(m3.GetMetadataReference() == id1, "duplicate to undo");
+ OSL_ENSURE(!m2.GetMetadataReference().Second.getLength(), "duplicate to undo");
+ m2.m_bInUndo = false;
+ OSL_ENSURE(m2.GetMetadataReference() == id1, "duplicate from undo");
+ OSL_ENSURE(!m3.GetMetadataReference().Second.getLength(), "duplicate from undo");
+
+ m4.EnsureMetadataReference(); // new!
+ beans::StringPair m4id(m4.GetMetadataReference());
+ OSL_ENSURE(m4id.Second.getLength() && !(m4id == id1), "ensure on duplicate");
+
+ MockMetadatable mc1(true); // in clipboard
+ MockMetadatable mc2(true);
+ MockMetadatable mc3(true);
+ MockMetadatable mc4(true);
+ MockMetadatable m2p;
+ MockMetadatable m3p;
+
+ mc1.SetMetadataReference(id2);
+ OSL_ENSURE(mc1.GetMetadataReference() == id2, "set failed");
+ try {
+ mc2.SetMetadataReference(id2);
+ OSL_ENSURE(false, "set duplicate succeeded");
+ } catch (lang::IllegalArgumentException) { }
+ mc1.SetMetadataReference(id2);
+ OSL_ENSURE(mc1.GetMetadataReference() == id2, "set failed (existing)");
+ mc1.EnsureMetadataReference();
+ OSL_ENSURE(mc1.GetMetadataReference() == id2, "ensure failed (existing)");
+ mc2.EnsureMetadataReference();
+ beans::StringPair mc2id(mc2.GetMetadataReference());
+ OSL_ENSURE(mc2id.Second.getLength(), "ensure failed");
+ mc2.EnsureMetadataReference();
+ OSL_ENSURE(mc2.GetMetadataReference() == mc2id, "ensure failed (idempotent)");
+ mc2.RemoveMetadataReference();
+ OSL_ENSURE(!mc2.GetMetadataReference().Second.getLength(), "remove failed");
+
+ // set up mc2 as copy of m2 and mc3 as copy of m3
+ mc3.RegisterAsCopyOf(m3);
+ OSL_ENSURE(!mc3.GetMetadataReference().Second.getLength() , "copy to clipboard (latent)");
+ mc2.RegisterAsCopyOf(m2);
+ OSL_ENSURE(mc2.GetMetadataReference() == id1, "copy to clipboard (non-latent)");
+ // paste mc2 to m2p and mc3 to m3p
+ m2p.RegisterAsCopyOf(mc2);
+ OSL_ENSURE(!m2p.GetMetadataReference().Second.getLength() , "paste from clipboard (non-latent)");
+ m3p.RegisterAsCopyOf(mc3);
+ OSL_ENSURE(!m3p.GetMetadataReference().Second.getLength() , "paste from clipboard (latent)");
+ // delete m2, m2p, m3
+ m2.RemoveMetadataReference();
+ OSL_ENSURE(!m2.GetMetadataReference().Second.getLength(), "remove failed");
+ OSL_ENSURE(m2p.GetMetadataReference() == id1, "paste-remove (non-latent)");
+ m2p.RemoveMetadataReference();
+ OSL_ENSURE(!m2p.GetMetadataReference().Second.getLength(), "remove failed");
+ OSL_ENSURE(m3.GetMetadataReference() == id1, "paste-remove2 (non-latent)");
+ m3.RemoveMetadataReference();
+ OSL_ENSURE(!m3.GetMetadataReference().Second.getLength(), "remove failed");
+ OSL_ENSURE(m3p.GetMetadataReference() == id1, "paste-remove (latent)");
+ // delete mc2
+ mc2.SetMetadataReference(beans::StringPair());
+ OSL_ENSURE(!mc3.GetMetadataReference().Second.getLength() , "in clipboard becomes non-latent");
+ // paste mc2
+ m2p.RegisterAsCopyOf(mc2);
+ OSL_ENSURE(!m2p.GetMetadataReference().Second.getLength(), "remove-paste");
+ OSL_ENSURE(m3p.GetMetadataReference() == id1, "remove-paste (stolen)");
+
+ // auto-detect stream
+ m5.SetMetadataReference(id3e);
+ OSL_ENSURE(m5.GetMetadataReference() == id3, "auto-detect (content)");
+ m5.m_bInContent = false;
+ m5.SetMetadataReference(id4e);
+ OSL_ENSURE(m5.GetMetadataReference() == id4, "auto-detect (styles)");
+
+ OSL_TRACE("sfx2::Metadatable test(): finished\n");
+}
+
+struct Test { Test() { test(); } };
+static Test s_test;
+
+
+#include <stdio.h>
+
+static void dump(sfx2::XmlIdList_t * pList)
+#ifdef GCC
+__attribute__ ((unused))
+#endif
+;
+static void dump(sfx2::XmlIdList_t * pList)
+{
+ fprintf(stderr, "\nXmlIdList(%p): ", pList);
+ for (sfx2::XmlIdList_t::iterator i = pList->begin(); i != pList->end(); ++i)
+ {
+ fprintf(stderr, "%p ", *i);
+ }
+ fprintf(stderr, "\n");
+}
+
+#endif
+
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index c530c59851ec..23093bfa066f 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -71,6 +71,7 @@
#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
#include <com/sun/star/ucb/OpenMode.hpp>
#include <com/sun/star/ucb/NameClashException.hpp>
+#include <com/sun/star/logging/XSimpleLogRing.hpp>
#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#ifndef _COM_SUN_STAR_SECURITY_DOCUMENTSIGNATURESINFORMATION_HPP_
@@ -82,6 +83,7 @@
#include <tools/urlobj.hxx>
#include <unotools/tempfile.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
#include <unotools/streamhelper.hxx>
#include <unotools/localedatawrapper.hxx>
#ifndef _MSGBOX_HXX //autogen
@@ -93,6 +95,7 @@
#include <svtools/sfxecode.hxx>
#include <svtools/itemset.hxx>
#include <svtools/intitem.hxx>
+#include <svtools/svparser.hxx> // SvKeyValue
#include <cppuhelper/weakref.hxx>
#include <cppuhelper/implbase1.hxx>
@@ -149,12 +152,73 @@ using namespace ::com::sun::star::io;
#define MAX_REDIRECT 5
+
+//==========================================================
namespace {
- static const sal_Int8 LOCK_UI_NOLOCK = 0;
- static const sal_Int8 LOCK_UI_SUCCEEDED = 1;
- static const sal_Int8 LOCK_UI_TRY = 2;
+
+static const sal_Int8 LOCK_UI_NOLOCK = 0;
+static const sal_Int8 LOCK_UI_SUCCEEDED = 1;
+static const sal_Int8 LOCK_UI_TRY = 2;
+
+//----------------------------------------------------------------
+sal_Bool IsSystemFileLockingUsed()
+{
+ // check whether system file locking has been used, the default value is false
+ sal_Bool bUseSystemLock = sal_False;
+ try
+ {
+
+ uno::Reference< uno::XInterface > xCommonConfig = ::comphelper::ConfigurationHelper::openConfig(
+ ::comphelper::getProcessServiceFactory(),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common" ) ),
+ ::comphelper::ConfigurationHelper::E_STANDARD );
+ if ( !xCommonConfig.is() )
+ throw uno::RuntimeException();
+
+ ::comphelper::ConfigurationHelper::readRelativeKey(
+ xCommonConfig,
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Misc/" ) ),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseDocumentSystemFileLocking" ) ) ) >>= bUseSystemLock;
+ }
+ catch( const uno::Exception& )
+ {
+ }
+
+ return bUseSystemLock;
+}
+
+//----------------------------------------------------------------
+sal_Bool IsOOoLockFileUsed()
+{
+ // check whether system file locking has been used, the default value is false
+ sal_Bool bOOoLockFileUsed = sal_False;
+ try
+ {
+
+ uno::Reference< uno::XInterface > xCommonConfig = ::comphelper::ConfigurationHelper::openConfig(
+ ::comphelper::getProcessServiceFactory(),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common" ) ),
+ ::comphelper::ConfigurationHelper::E_STANDARD );
+ if ( !xCommonConfig.is() )
+ throw uno::RuntimeException();
+
+ ::comphelper::ConfigurationHelper::readRelativeKey(
+ xCommonConfig,
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Misc/" ) ),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseDocumentOOoLockFile" ) ) ) >>= bOOoLockFileUsed;
+ }
+ catch( const uno::Exception& )
+ {
+ }
+
+ return bOOoLockFileUsed;
}
+} // anonymous namespace
+//==========================================================
+
+
+//----------------------------------------------------------------
class SfxMediumHandler_Impl : public ::cppu::WeakImplHelper1< com::sun::star::task::XInteractionHandler >
{
com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > m_xInter;
@@ -170,10 +234,12 @@ public:
~SfxMediumHandler_Impl();
};
+//----------------------------------------------------------------
SfxMediumHandler_Impl::~SfxMediumHandler_Impl()
{
}
+//----------------------------------------------------------------
void SAL_CALL SfxMediumHandler_Impl::handle( const com::sun::star::uno::Reference< com::sun::star::task::XInteractionRequest >& xRequest )
throw( com::sun::star::uno::RuntimeException )
{
@@ -192,6 +258,7 @@ void SAL_CALL SfxMediumHandler_Impl::handle( const com::sun::star::uno::Referenc
m_xInter->handle( xRequest );
}
+//----------------------------------------------------------------
class SfxPoolCancelManager_Impl : public SfxCancelManager ,
public SfxCancellable ,
public SfxListener ,
@@ -208,6 +275,7 @@ public:
virtual void Cancel();
};
+//----------------------------------------------------------------
SV_DECL_IMPL_REF( SfxPoolCancelManager_Impl )
@@ -327,6 +395,8 @@ public:
util::DateTime m_aDateTime;
+ uno::Reference< logging::XSimpleLogRing > m_xLogRing;
+
SfxPoolCancelManager_Impl* GetCancelManager();
SfxMedium_Impl( SfxMedium* pAntiImplP );
@@ -341,7 +411,7 @@ void SfxMedium::DataAvailable_Impl()
void SfxMedium::Cancel_Impl()
{
- SetError( ERRCODE_IO_GENERAL );
+ SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
SfxPoolCancelManager_Impl* SfxMedium_Impl::GetCancelManager()
@@ -449,6 +519,33 @@ sal_uInt32 SfxMedium::GetLastStorageCreationState()
}
//------------------------------------------------------------------
+void SfxMedium::AddLog( const ::rtl::OUString& aMessage )
+{
+ if ( !pImp->m_xLogRing.is() )
+ {
+ try
+ {
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ if ( aContext.is() )
+ pImp->m_xLogRing.set( aContext.getSingleton( "com.sun.star.logging.DocumentIOLogRing" ), UNO_QUERY_THROW );
+ }
+ catch( uno::Exception& )
+ {}
+ }
+
+ if ( pImp->m_xLogRing.is() )
+ pImp->m_xLogRing->logString( aMessage );
+}
+
+//------------------------------------------------------------------
+void SfxMedium::SetError( sal_uInt32 nError, const ::rtl::OUString& aLogMessage )
+{
+ eError = nError;
+ if ( eError != ERRCODE_NONE && aLogMessage.getLength() )
+ AddLog( aLogMessage );
+}
+
+//------------------------------------------------------------------
sal_uInt32 SfxMedium::GetErrorCode() const
{
sal_uInt32 lError=eError;
@@ -471,7 +568,7 @@ long SfxMedium::GetFileVersion() const
//------------------------------------------------------------------
void SfxMedium::CheckFileDate( const util::DateTime& aInitDate )
{
- GetInitFileDate();
+ GetInitFileDate( sal_True );
if ( pImp->m_aDateTime.Seconds != aInitDate.Seconds
|| pImp->m_aDateTime.Minutes != aInitDate.Minutes
|| pImp->m_aDateTime.Hours != aInitDate.Hours
@@ -479,61 +576,43 @@ void SfxMedium::CheckFileDate( const util::DateTime& aInitDate )
|| pImp->m_aDateTime.Month != aInitDate.Month
|| pImp->m_aDateTime.Year != aInitDate.Year )
{
- // check whether system file locking has been used, the default value is false
- sal_Bool bUseSystemLock = sal_False;
- try
- {
-
- uno::Reference< uno::XInterface > xCommonConfig = ::comphelper::ConfigurationHelper::openConfig(
- ::comphelper::getProcessServiceFactory(),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common" ) ),
- ::comphelper::ConfigurationHelper::E_STANDARD );
- if ( !xCommonConfig.is() )
- throw uno::RuntimeException();
-
- ::comphelper::ConfigurationHelper::readRelativeKey(
- xCommonConfig,
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Misc/" ) ),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseDocumentSystemFileLocking" ) ) ) >>= bUseSystemLock;
- }
- catch( const uno::Exception& )
- {
- }
+ uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler();
- if ( !bUseSystemLock )
+ if ( xHandler.is() )
{
- uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler();
-
- if ( xHandler.is() )
+ try
{
- try
- {
- ::rtl::Reference< ::ucbhelper::InteractionRequest > xInteractionRequestImpl = new ::ucbhelper::InteractionRequest( uno::makeAny(
- document::ChangedByOthersRequest() ) );
- uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 3 );
- aContinuations[0] = new ::ucbhelper::InteractionAbort( xInteractionRequestImpl.get() );
- aContinuations[1] = new ::ucbhelper::InteractionApprove( xInteractionRequestImpl.get() );
- xInteractionRequestImpl->setContinuations( aContinuations );
+ ::rtl::Reference< ::ucbhelper::InteractionRequest > xInteractionRequestImpl = new ::ucbhelper::InteractionRequest( uno::makeAny(
+ document::ChangedByOthersRequest() ) );
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 3 );
+ aContinuations[0] = new ::ucbhelper::InteractionAbort( xInteractionRequestImpl.get() );
+ aContinuations[1] = new ::ucbhelper::InteractionApprove( xInteractionRequestImpl.get() );
+ xInteractionRequestImpl->setContinuations( aContinuations );
- xHandler->handle( xInteractionRequestImpl.get() );
+ xHandler->handle( xInteractionRequestImpl.get() );
- ::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xInteractionRequestImpl->getSelection();
- if ( uno::Reference< task::XInteractionAbort >( xSelected.get(), uno::UNO_QUERY ).is() )
- {
- SetError( ERRCODE_ABORT );
- }
+ ::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xInteractionRequestImpl->getSelection();
+ if ( uno::Reference< task::XInteractionAbort >( xSelected.get(), uno::UNO_QUERY ).is() )
+ {
+ SetError( ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
- catch ( uno::Exception& )
- {}
}
+ catch ( uno::Exception& )
+ {}
}
}
}
//------------------------------------------------------------------
-util::DateTime SfxMedium::GetInitFileDate()
+sal_Bool SfxMedium::DocNeedsFileDateCheck()
+{
+ return ( !IsReadOnly() && ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) );
+}
+
+//------------------------------------------------------------------
+util::DateTime SfxMedium::GetInitFileDate( sal_Bool bIgnoreOldValue )
{
- if ( !pImp->m_bGotDateTime && GetContent().is() )
+ if ( ( bIgnoreOldValue || !pImp->m_bGotDateTime ) && GetContent().is() )
{
try
{
@@ -790,11 +869,8 @@ sal_Bool SfxMedium::Commit()
sal_Bool bResult = ( GetError() == SVSTREAM_OK );
- if ( bResult )
- {
- pImp->m_bGotDateTime = sal_False;
- GetInitFileDate();
- }
+ if ( bResult && DocNeedsFileDateCheck() )
+ GetInitFileDate( sal_True );
// remove truncation mode from the flags
nStorOpenMode &= (~STREAM_TRUNC);
@@ -946,7 +1022,7 @@ void SfxMedium::StorageBackup_Impl()
{
DoInternalBackup_Impl( aOriginalContent );
if( !pImp->m_aBackupURL.getLength() )
- SetError( ERRCODE_SFX_CANTCREATEBACKUP );
+ SetError( ERRCODE_SFX_CANTCREATEBACKUP, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
@@ -1021,7 +1097,7 @@ void SfxMedium::SetPasswordToStorage_Impl()
{
OSL_ENSURE( sal_False, "It must be possible to set a common password for the storage" );
// TODO/LATER: set the error code in case of problem
- // SetError( ERRCODE_IO_GENERAL );
+ // SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
}
@@ -1090,7 +1166,7 @@ sal_Int8 SfxMedium::ShowLockedDocumentDialog( const uno::Sequence< ::rtl::OUStri
::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xInteractionRequestImpl->getSelection();
if ( uno::Reference< task::XInteractionAbort >( xSelected.get(), uno::UNO_QUERY ).is() )
{
- SetError( ERRCODE_ABORT );
+ SetError( ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
else if ( uno::Reference< task::XInteractionDisapprove >( xSelected.get(), uno::UNO_QUERY ).is() )
{
@@ -1129,7 +1205,7 @@ sal_Int8 SfxMedium::ShowLockedDocumentDialog( const uno::Sequence< ::rtl::OUStri
GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) );
}
else
- SetError( ERRCODE_IO_ACCESSDENIED );
+ SetError( ERRCODE_IO_ACCESSDENIED, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
@@ -1184,24 +1260,7 @@ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI )
sal_Int8 bUIStatus = LOCK_UI_NOLOCK;
// check whether system file locking has been used, the default value is false
- sal_Bool bUseSystemLock = sal_False;
- try
- {
- uno::Reference< uno::XInterface > xCommonConfig = ::comphelper::ConfigurationHelper::openConfig(
- ::comphelper::getProcessServiceFactory(),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common" ) ),
- ::comphelper::ConfigurationHelper::E_STANDARD );
- if ( !xCommonConfig.is() )
- throw uno::RuntimeException();
-
- ::comphelper::ConfigurationHelper::readRelativeKey(
- xCommonConfig,
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Misc/" ) ),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseDocumentSystemFileLocking" ) ) ) >>= bUseSystemLock;
- }
- catch( const uno::Exception& )
- {
- }
+ sal_Bool bUseSystemLock = IsSystemFileLockingUsed();
// TODO/LATER: This implementation does not allow to detect the system lock on saving here, actually this is no big problem
// if system lock is used the writeable stream should be available
@@ -1220,35 +1279,55 @@ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI )
}
catch ( ucb::InteractiveIOException& e )
{
- if ( e.Code == IOErrorCode_INVALID_PARAMETER )
+ // exception means that the lock file can not be successfuly accessed
+ // in this case it should be ignored if system file locking is anyway active
+ if ( bUseSystemLock || !IsOOoLockFileUsed() )
{
- // it looks like the lock file name is not accepted by the content
- if ( !bUseSystemLock )
- {
- // system file locking is not active, ask user whether he wants to open the document without any locking
- uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler();
+ bResult = sal_True;
+ // take the ownership over the lock file
+ aLockFile.OverwriteOwnLockFile();
+ }
+ else if ( e.Code == IOErrorCode_INVALID_PARAMETER )
+ {
+ // system file locking is not active, ask user whether he wants to open the document without any locking
+ uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler();
- if ( xHandler.is() )
- {
- ::rtl::Reference< ::ucbhelper::InteractionRequest > xIgnoreRequestImpl
- = new ::ucbhelper::InteractionRequest( uno::makeAny( document::LockFileIgnoreRequest() ) );
+ if ( xHandler.is() )
+ {
+ ::rtl::Reference< ::ucbhelper::InteractionRequest > xIgnoreRequestImpl
+ = new ::ucbhelper::InteractionRequest( uno::makeAny( document::LockFileIgnoreRequest() ) );
- uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 2 );
- aContinuations[0] = new ::ucbhelper::InteractionAbort( xIgnoreRequestImpl.get() );
- aContinuations[1] = new ::ucbhelper::InteractionApprove( xIgnoreRequestImpl.get() );
- xIgnoreRequestImpl->setContinuations( aContinuations );
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 2 );
+ aContinuations[0] = new ::ucbhelper::InteractionAbort( xIgnoreRequestImpl.get() );
+ aContinuations[1] = new ::ucbhelper::InteractionApprove( xIgnoreRequestImpl.get() );
+ xIgnoreRequestImpl->setContinuations( aContinuations );
- xHandler->handle( xIgnoreRequestImpl.get() );
+ xHandler->handle( xIgnoreRequestImpl.get() );
- ::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xIgnoreRequestImpl->getSelection();
- bResult = ( uno::Reference< task::XInteractionApprove >( xSelected.get(), uno::UNO_QUERY ).is() );
- }
+ ::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xIgnoreRequestImpl->getSelection();
+ bResult = ( uno::Reference< task::XInteractionApprove >( xSelected.get(), uno::UNO_QUERY ).is() );
}
- else
- bResult = sal_True;
}
- else
- throw;
+ }
+ catch ( uno::Exception& )
+ {
+ // exception means that the lock file can not be successfuly accessed
+ // in this case it should be ignored if system file locking is anyway active
+ if ( bUseSystemLock || !IsOOoLockFileUsed() )
+ {
+ bResult = sal_True;
+ // take the ownership over the lock file
+ aLockFile.OverwriteOwnLockFile();
+ }
+ }
+
+ // in case OOo locking is turned off the lock file is still written if possible
+ // but it is ignored while deciding whether the document should be opened for editing or not
+ if ( !bResult && !IsOOoLockFileUsed() )
+ {
+ bResult = sal_True;
+ // take the ownership over the lock file
+ aLockFile.OverwriteOwnLockFile();
}
}
@@ -1316,11 +1395,15 @@ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI )
SFX_ITEMSET_ARG( pSet, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY, FALSE );
if ( !bLoading || (pReadOnlyItem && !pReadOnlyItem->GetValue()) )
- SetError( ERRCODE_IO_ACCESSDENIED );
+ SetError( ERRCODE_IO_ACCESSDENIED, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
else
GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) );
}
+ // when the file is locked, get the current file date
+ if ( bResult && DocNeedsFileDateCheck() )
+ GetInitFileDate( sal_True );
+
return bResult;
}
@@ -1816,13 +1899,13 @@ sal_Bool SfxMedium::StorageCommit_Impl()
}
if ( !GetError() )
- SetError( ERRCODE_IO_GENERAL );
+ SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
catch ( uno::Exception& )
{
//TODO/LATER: improve error handling
- SetError( ERRCODE_IO_GENERAL );
+ SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
}
@@ -2102,7 +2185,7 @@ void SfxMedium::Transfer_Impl()
else
{
DBG_ERROR( "Illegal Output stream parameter!\n" );
- SetError( ERRCODE_IO_GENERAL );
+ SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
// free the reference
@@ -2147,7 +2230,7 @@ void SfxMedium::Transfer_Impl()
{
//TODO/MBA: error handling
//if ( !GetError() )
- // SetError( xStor->GetError() );
+ // SetError( xStor->GetError(, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) )) );
}
return;
}
@@ -2192,7 +2275,7 @@ void SfxMedium::Transfer_Impl()
SetStorage_Impl( xStor );
}
else if ( !GetError() )
- SetError( xStor->GetError() );
+ SetError( xStor->GetError(, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) )) );
return;
}*/
}
@@ -2573,7 +2656,7 @@ void SfxMedium::GetMedium_Impl()
//TODO/MBA: ErrorHandling - how to transport error from MediaDescriptor
if ( !GetError() && !pImp->xStream.is() && !pImp->xInputStream.is() )
- SetError( ERRCODE_IO_ACCESSDENIED );
+ SetError( ERRCODE_IO_ACCESSDENIED, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
if ( !GetError() )
{
@@ -2583,8 +2666,6 @@ void SfxMedium::GetMedium_Impl()
pInStream = utl::UcbStreamHelper::CreateStream( pImp->xInputStream );
}
- GetInitFileDate();
-
pImp->bDownloadDone = sal_True;
pImp->aDoneLink.ClearPendingCall();
pImp->aDoneLink.Call( (void*) GetError() );
@@ -3226,6 +3307,7 @@ SfxMedium::SfxMedium( const ::com::sun::star::uno::Sequence< ::com::sun::star::b
// that must be copied here
SFX_ITEMSET_ARG( pSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, FALSE );
+ if (!pFileNameItem) throw uno::RuntimeException();
::rtl::OUString aNewTempFileURL = SfxMedium::CreateTempCopyWithExt( pFileNameItem->GetValue() );
if ( aNewTempFileURL.getLength() )
{
@@ -3247,6 +3329,7 @@ SfxMedium::SfxMedium( const ::com::sun::star::uno::Sequence< ::com::sun::star::b
bReadOnly = TRUE;
SFX_ITEMSET_ARG( pSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, FALSE );
+ if (!pFileNameItem) throw uno::RuntimeException();
aLogicName = pFileNameItem->GetValue();
nStorOpenMode = bReadOnly ? SFX_STREAM_READONLY : SFX_STREAM_READWRITE;
bDirect = FALSE;
@@ -3696,17 +3779,17 @@ void SfxMedium::TryToSwitchToRepairedTemp()
catch ( uno::Exception& )
{
//TODO/MBA: error handling
- //SetError( aNewStorage->GetError() );
+ //SetError( aNewStorage->GetError(, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) )) );
}
}
else
- SetError( ERRCODE_IO_CANTWRITE );
+ SetError( ERRCODE_IO_CANTWRITE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
if (pImp->pTempFile != pTmpFile)
delete pTmpFile;
}
else
- SetError( ERRCODE_IO_CANTREAD );
+ SetError( ERRCODE_IO_CANTREAD, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
@@ -3756,7 +3839,7 @@ void SfxMedium::CreateTempFile()
aName = pImp->pTempFile->GetFileName();
if ( !aName.Len() )
{
- SetError( ERRCODE_IO_CANTWRITE );
+ SetError( ERRCODE_IO_CANTWRITE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
return;
}
@@ -3800,7 +3883,7 @@ void SfxMedium::CreateTempFileNoCopy()
aName = pImp->pTempFile->GetFileName();
if ( !aName.Len() )
{
- SetError( ERRCODE_IO_CANTWRITE );
+ SetError( ERRCODE_IO_CANTWRITE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
return;
}
@@ -4005,61 +4088,6 @@ sal_Bool SfxMedium::EqualURLs( const ::rtl::OUString& aFirstURL, const ::rtl::OU
return bResult;
}
-SV_DECL_PTRARR_DEL(SvKeyValueList_Impl, SvKeyValue*, 0, 4)
-SV_IMPL_PTRARR(SvKeyValueList_Impl, SvKeyValue*);
-
-/*
- * SvKeyValueIterator.
- */
-SvKeyValueIterator::SvKeyValueIterator (void)
- : m_pList (new SvKeyValueList_Impl),
- m_nPos (0)
-{
-}
-
-/*
- * ~SvKeyValueIterator.
- */
-SvKeyValueIterator::~SvKeyValueIterator (void)
-{
- delete m_pList;
-}
-
-/*
- * GetFirst.
- */
-BOOL SvKeyValueIterator::GetFirst (SvKeyValue &rKeyVal)
-{
- m_nPos = m_pList->Count();
- return GetNext (rKeyVal);
-}
-
-/*
- * GetNext.
- */
-BOOL SvKeyValueIterator::GetNext (SvKeyValue &rKeyVal)
-{
- if (m_nPos > 0)
- {
- rKeyVal = *m_pList->GetObject(--m_nPos);
- return TRUE;
- }
- else
- {
- // Nothing to do.
- return FALSE;
- }
-}
-
-/*
- * Append.
- */
-void SvKeyValueIterator::Append (const SvKeyValue &rKeyVal)
-{
- SvKeyValue *pKeyVal = new SvKeyValue (rKeyVal);
- m_pList->C40_INSERT(SvKeyValue, pKeyVal, m_pList->Count());
-}
-
BOOL SfxMedium::HasStorage_Impl() const
{
return pImp->xStorage.is();
diff --git a/sfx2/source/doc/docinsert.cxx b/sfx2/source/doc/docinsert.cxx
index 8fae29a1847c..ecd9ae7aee42 100644
--- a/sfx2/source/doc/docinsert.cxx
+++ b/sfx2/source/doc/docinsert.cxx
@@ -177,33 +177,17 @@ void impl_FillURLList( sfx2::FileDialogHelper* _pFileDlg, SvStringsDtor*& _rpURL
{
DBG_ASSERT( _pFileDlg, "DocumentInserter::fillURLList(): invalid file dialog" );
DBG_ASSERT( !_rpURLList, "DocumentInserter::fillURLList(): URLList already exists" );
- Sequence < ::rtl::OUString > aPathSeq = _pFileDlg->GetMPath();
+ Sequence < ::rtl::OUString > aPathSeq = _pFileDlg->GetSelectedFiles();
if ( aPathSeq.getLength() )
{
_rpURLList = new SvStringsDtor;
- if ( aPathSeq.getLength() == 1 )
+ for ( USHORT i = 0; i < aPathSeq.getLength(); ++i )
{
- ::rtl::OUString sFileURL( aPathSeq[0] );
- String* pURL = new String( sFileURL );
- _rpURLList->Insert( pURL, 0 );
- }
- else
- {
- INetURLObject aPathObj( aPathSeq[0] );
- aPathObj.setFinalSlash();
-
- for ( USHORT i = 1; i < aPathSeq.getLength(); ++i )
- {
- if ( i == 1 )
- aPathObj.Append( aPathSeq[i] );
- else
- aPathObj.setName( aPathSeq[i] );
-
- String* pURL = new String( aPathObj.GetMainURL( INetURLObject::NO_DECODE ) );
- _rpURLList->Insert( pURL, _rpURLList->Count() );
- }
+ INetURLObject aPathObj( aPathSeq[i] );
+ String* pURL = new String( aPathObj.GetMainURL( INetURLObject::NO_DECODE ) );
+ _rpURLList->Insert( pURL, _rpURLList->Count() );
}
}
}
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index 7940e0e3e79a..7df93afaa63e 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -1220,10 +1220,14 @@ void SfxDocTplService_Impl::doUpdate()
// the last directory in the list must be writable
sal_Bool bWriteableDirectory = sal_True;
+
+ // the target folder might not exist, for this reason no interaction handler should be used
+ uno::Reference< XCommandEnvironment > aQuietEnv;
+
while ( nCountDir )
{
nCountDir--;
- if ( Content::create( pDirs[ nCountDir ], maCmdEnv, aDirContent ) )
+ if ( Content::create( pDirs[ nCountDir ], aQuietEnv, aDirContent ) )
{
createFromContent( aGroupList, aDirContent, sal_False, bWriteableDirectory );
}
@@ -2060,7 +2064,7 @@ sal_Bool SfxDocTplService_Impl::addTemplate( const OUString& rGroupName,
Content aResultContent;
if ( Content::create( aNewTemplateTargetURL, xEnv, aResultContent ) )
{
- ::rtl::OUString aPropertyName( RTL_CONSTASCII_USTRINGPARAM( "IsReadonly" ) );
+ ::rtl::OUString aPropertyName( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) );
uno::Any aProperty;
sal_Bool bReadOnly = sal_False;
if ( getProperty( aResultContent, aPropertyName, aProperty ) && ( aProperty >>= bReadOnly ) && bReadOnly )
@@ -2535,7 +2539,10 @@ void SfxDocTplService_Impl::addFsysGroup( GroupList_Impl& rList,
try
{
- aContent = Content( rOwnURL, maCmdEnv );
+ // this method is only used during checking of the available template-folders
+ // that should happen quietly
+ uno::Reference< XCommandEnvironment > aQuietEnv;
+ aContent = Content( rOwnURL, aQuietEnv );
ResultSetInclude eInclude = INCLUDE_DOCUMENTS_ONLY;
xResultSet = aContent.createCursor( aProps, eInclude );
}
diff --git a/sfx2/source/doc/makefile.mk b/sfx2/source/doc/makefile.mk
index b46ee5aa30e8..4c893288ebb8 100644
--- a/sfx2/source/doc/makefile.mk
+++ b/sfx2/source/doc/makefile.mk
@@ -40,6 +40,10 @@ ENABLE_EXCEPTIONS=TRUE
.INCLUDE : settings.mk
.INCLUDE : $(PRJ)$/util$/makefile.pmk
+.IF "$(SYSTEM_LIBXML)" == "YES"
+CFLAGS+=-DSYSTEM_LIBXML $(LIBXML_CFLAGS)
+.ENDIF
+
# --- Files --------------------------------------------------------
SRS1NAME=$(TARGET)
@@ -80,10 +84,13 @@ SLOFILES = \
$(SLO)$/docinsert.obj \
$(SLO)$/docmacromode.obj \
$(SLO)$/SfxDocumentMetaData.obj \
+ $(SLO)$/DocumentMetadataAccess.obj \
+ $(SLO)$/Metadatable.obj \
$(SLO)$/sfxmodelfactory.obj \
$(SLO)$/docstoragemodifylistener.obj \
$(SLO)$/querytemplate.obj
+
# --- Tagets -------------------------------------------------------
.INCLUDE : target.mk
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 7bb988f6d80e..a7910c463cf9 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -38,6 +38,7 @@
#include <svtools/eitem.hxx>
#include <svtools/stritem.hxx>
#include <svtools/intitem.hxx>
+#include <svtools/svparser.hxx> // SvKeyValue
#include <vos/mutex.hxx>
#include <cppuhelper/exc_hlp.hxx>
@@ -64,6 +65,7 @@
#include <com/sun/star/embed/XEmbedPersist.hpp>
#include <com/sun/star/util/XModifiable.hpp>
#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
#include <com/sun/star/script/provider/XScript.hpp>
@@ -82,6 +84,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/componentcontext.hxx>
+#include <comphelper/configurationhelper.hxx>
#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
#include <com/sun/star/frame/XModel.hpp>
@@ -113,6 +116,7 @@ using namespace ::com::sun::star::container;
#include <svtools/inettype.hxx>
#include <svtools/sharecontrolfile.hxx>
#include <osl/file.hxx>
+#include <rtl/bootstrap.hxx>
#include <vcl/svapp.hxx>
#include <framework/interaction.hxx>
#include <comphelper/storagehelper.hxx>
@@ -256,10 +260,15 @@ void SfxObjectShell::FlushDocInfo()
//-------------------------------------------------------------------------
-void SfxObjectShell::SetError(sal_uInt32 lErr)
+void SfxObjectShell::SetError( sal_uInt32 lErr, const ::rtl::OUString& aLogMessage )
{
if(pImp->lErr==ERRCODE_NONE)
+ {
pImp->lErr=lErr;
+
+ if( lErr != ERRCODE_NONE && aLogMessage.getLength() )
+ AddLog( aLogMessage );
+ }
}
//-------------------------------------------------------------------------
@@ -285,6 +294,9 @@ sal_uInt32 SfxObjectShell::GetErrorCode() const
void SfxObjectShell::ResetError()
{
+ if( pImp->lErr != ERRCODE_NONE )
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Resetting Error." ) ) );
+
pImp->lErr=0;
SfxMedium * pMed = GetMedium();
if( pMed )
@@ -669,7 +681,7 @@ void SfxObjectShell::DisconnectFromShared()
SfxMedium* pTmpMedium = pMedium;
ForgetMedium();
if( !DoSaveCompleted( pTmpMedium ) )
- SetError( ERRCODE_IO_GENERAL );
+ SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
else
{
// the medium should not dispose the storage, DoSaveCompleted() has let it to do so
@@ -1444,7 +1456,7 @@ void SfxObjectShell::TemplateDisconnectionAfterLoad()
ForgetMedium();
if( !DoSaveCompleted( pTmpMedium ) )
- SetError( ERRCODE_IO_GENERAL );
+ SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
else
{
SFX_ITEMSET_ARG( pMedium->GetItemSet(), pSalvageItem, SfxStringItem, SID_DOC_SALVAGE, sal_False );
@@ -2240,6 +2252,33 @@ sal_Bool SfxObjectShell::UseInteractionToHandleError(
return bResult;
}
+sal_Bool SfxObjectShell_Impl::NeedsOfficeUpdateDialog()
+{
+ // if the configuration is not available for any reason, the default behavior is to show the message
+ sal_Bool bResult = sal_True;
+
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xServiceManager( ::comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW );
+ uno::Reference< uno::XInterface > xCommonConfig(
+ ::comphelper::ConfigurationHelper::openConfig(
+ xServiceManager,
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common" ) ),
+ ::comphelper::ConfigurationHelper::E_STANDARD ),
+ uno::UNO_SET_THROW );
+
+ ::comphelper::ConfigurationHelper::readRelativeKey(
+ xCommonConfig,
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Load/" ) ),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ShowOfficeUpdateDialog" ) ) ) >>= bResult;
+ }
+ catch( uno::Exception& )
+ {
+ }
+
+ return bResult;
+}
+
sal_Int16 SfxObjectShell_Impl::getCurrentMacroExecMode() const
{
sal_Int16 nImposedExecMode( MacroExecMode::NEVER_EXECUTE );
@@ -2330,3 +2369,89 @@ void SfxObjectShell_Impl::showBrokenSignatureWarning( const uno::Reference< task
const_cast< SfxObjectShell_Impl* >( this )->bSignatureErrorIsShown = sal_True;
}
}
+
+void SfxObjectShell::AddLog( const ::rtl::OUString& aMessage )
+{
+ if ( !pImp->m_xLogRing.is() )
+ {
+ try
+ {
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ if ( aContext.is() )
+ pImp->m_xLogRing.set( aContext.getSingleton( "com.sun.star.logging.DocumentIOLogRing" ), UNO_QUERY_THROW );
+ }
+ catch( uno::Exception& )
+ {}
+ }
+
+ if ( pImp->m_xLogRing.is() )
+ pImp->m_xLogRing->logString( aMessage );
+}
+
+namespace {
+
+void WriteStringInStream( const uno::Reference< io::XOutputStream >& xOutStream, const ::rtl::OUString& aString )
+{
+ if ( xOutStream.is() )
+ {
+ ::rtl::OString aStrLog = ::rtl::OUStringToOString( aString, RTL_TEXTENCODING_UTF8 );
+ uno::Sequence< sal_Int8 > aLogData( (const sal_Int8*)aStrLog.getStr(), aStrLog.getLength() );
+ xOutStream->writeBytes( aLogData );
+
+ aLogData.realloc( 1 );
+ aLogData[0] = '\n';
+ xOutStream->writeBytes( aLogData );
+ }
+}
+
+}
+
+void SfxObjectShell::StoreLog()
+{
+ if ( !pImp->m_xLogRing.is() )
+ {
+ try
+ {
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ if ( aContext.is() )
+ pImp->m_xLogRing.set( aContext.getSingleton( "com.sun.star.logging.DocumentIOLogRing" ), UNO_QUERY_THROW );
+ }
+ catch( uno::Exception& )
+ {}
+ }
+
+ if ( pImp->m_xLogRing.is() )
+ {
+ ::rtl::OUString aFileURL =
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "${$BRAND_BASE_DIR/program/bootstrap.ini:UserInstallation}" ) );
+ ::rtl::Bootstrap::expandMacros( aFileURL );
+
+ ::rtl::OUString aBuildID =
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "${$BRAND_BASE_DIR/program/setup.ini:buildid}" ) );
+ ::rtl::Bootstrap::expandMacros( aBuildID );
+
+ if ( aFileURL.getLength() )
+ {
+ aFileURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/temp/document_io_logring.txt" ) );
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW );
+ uno::Reference< ucb::XSimpleFileAccess > xSimpleFileAccess( xFactory->createInstance( DEFINE_CONST_UNICODE( "com.sun.star.ucb.SimpleFileAccess" ) ), uno::UNO_QUERY_THROW );
+ uno::Reference< io::XStream > xStream( xSimpleFileAccess->openFileReadWrite( aFileURL ), uno::UNO_SET_THROW );
+ uno::Reference< io::XOutputStream > xOutStream( xStream->getOutputStream(), uno::UNO_SET_THROW );
+ uno::Reference< io::XTruncate > xTruncate( xOutStream, uno::UNO_QUERY_THROW );
+ xTruncate->truncate();
+
+ if ( aBuildID.getLength() )
+ WriteStringInStream( xOutStream, aBuildID );
+
+ uno::Sequence< ::rtl::OUString > aLogSeq = pImp->m_xLogRing->getCollectedLog();
+ for ( sal_Int32 nInd = 0; nInd < aLogSeq.getLength(); nInd++ )
+ WriteStringInStream( xOutStream, aLogSeq[nInd] );
+ }
+ catch( uno::Exception& )
+ {}
+ }
+ }
+}
+
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index a9d992a9afda..a47fc1bf4747 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -415,7 +415,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
if ( pDocInfItem )
{
// parameter, e.g. from replayed macro
- pDocInfItem->updateDocumentInfo(getDocProperties());
+ pDocInfItem->UpdateDocumentInfo(getDocProperties(), true);
SetUseUserData( pDocInfItem->IsUseUserData() );
}
else
@@ -478,7 +478,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
if ( pDocInfoItem )
{
// user has done some changes to DocumentInfo
- pDocInfoItem->updateDocumentInfo(getDocProperties());
+ pDocInfoItem->UpdateDocumentInfo(getDocProperties());
SetUseUserData( ((const SfxDocumentInfoItem *)pDocInfoItem)->IsUseUserData() );
// add data from dialog for possible recording purposes
@@ -639,11 +639,20 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
SfxStoringHelper aHelper( xEmptyFactory );
if ( QueryHiddenInformation( bIsPDFExport ? WhenCreatingPDF : WhenSaving, NULL ) == RET_YES )
+ {
bDialogUsed = aHelper.GUIStoreModel( GetModel(),
- ::rtl::OUString::createFromAscii( pSlot->GetUnoName() ),
- aDispatchArgs,
- bPreselectPassword,
- GetSharedFileURL() );
+ ::rtl::OUString::createFromAscii( pSlot->GetUnoName() ),
+ aDispatchArgs,
+ bPreselectPassword,
+ GetSharedFileURL() );
+ }
+ else
+ {
+ // the user has decided not to store the document
+ throw task::ErrorCodeIOException( ::rtl::OUString(),
+ uno::Reference< uno::XInterface >(),
+ ERRCODE_IO_ABORT );
+ }
// the scripting signature might be preserved
// pImp->nScriptingSignatureState = SIGNATURESTATE_NOSIGNATURES;
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 4eb5c6f417fd..89f2fe74e2f9 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -282,7 +282,7 @@ sal_Bool SfxObjectShell::PutURLContentsToVersionStream_Impl(
catch( uno::Exception& )
{
// TODO/LATER: handle the error depending on exception
- SetError( ERRCODE_IO_GENERAL );
+ SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
return bResult;
@@ -314,7 +314,7 @@ sal_Bool SfxObjectShell::PutURLContentsToVersionStream_Impl(
aTempURL = ::rtl::OUString();
// TODO/LATER: may need error code setting based on exception
- SetError( ERRCODE_IO_GENERAL );
+ SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
@@ -356,7 +356,7 @@ void SfxObjectShell::SetupStorage( const uno::Reference< embed::XStorage >& xSto
}
catch( uno::Exception& )
{
- const_cast<SfxObjectShell*>( this )->SetError( ERRCODE_IO_GENERAL );
+ const_cast<SfxObjectShell*>( this )->SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
::rtl::OUString aVersion;
@@ -412,7 +412,7 @@ sal_Bool SfxObjectShell::GeneralInit_Impl( const uno::Reference< embed::XStorage
{
if ( bTypeMustBeSetAlready )
{
- SetError( ERRCODE_IO_BROKENPACKAGE );
+ SetError( ERRCODE_IO_BROKENPACKAGE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
return sal_False;
}
@@ -621,6 +621,7 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed )
else
aBaseURL = pMed->GetBaseURL();
}
+ pMed->GetItemSet()->Put( SfxStringItem( SID_DOC_BASEURL, aBaseURL ) );
pImp->nLoadedFlags = 0;
pImp->bModelInitialized = sal_False;
@@ -632,7 +633,7 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed )
{
sal_uInt32 nError = HandleFilter( pMedium, this );
if ( nError != ERRCODE_NONE )
- SetError( nError );
+ SetError( nError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
EnableSetModified( sal_False );
@@ -666,12 +667,12 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed )
}
if ( bWarnMediaTypeFallback || !xStorage->getElementNames().getLength() )
- SetError( ERRCODE_IO_BROKENPACKAGE );
+ SetError( ERRCODE_IO_BROKENPACKAGE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
catch( uno::Exception& )
{
// TODO/LATER: may need error code setting based on exception
- SetError( ERRCODE_IO_GENERAL );
+ SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
// Load
@@ -691,11 +692,11 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed )
SetReadOnlyUI();
}
else
- SetError( ERRCODE_ABORT );
+ SetError( ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
else
- SetError( pMed->GetLastStorageCreationState() );
+ SetError( pMed->GetLastStorageCreationState(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
else if ( GetError() == ERRCODE_NONE && InitNew(0) )
{
@@ -827,37 +828,28 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed )
}
}
- uno::Reference< XInteractionHandler > xHandler( pMedium->GetInteractionHandler() );
- if ( xHandler.is() && !SFX_APP()->Get_Impl()->bODFVersionWarningLater )
+ if ( pMedium->HasStorage_Impl() )
{
- // scan the generator string (within meta.xml)
- uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
- GetModel(), uno::UNO_QUERY_THROW);
- uno::Reference<document::XDocumentProperties> xDocProps
- = xDPS->getDocumentProperties();
- if ( xDocProps.is() )
+ uno::Reference< XInteractionHandler > xHandler( pMedium->GetInteractionHandler() );
+ if ( xHandler.is() && !SFX_APP()->Get_Impl()->bODFVersionWarningLater )
{
- uno::Reference<beans::XPropertySet> xUserDefinedProps(
- xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
- uno::Any aAny;
+ uno::Reference<beans::XPropertySet> xStorageProps( pMedium->GetStorage(), uno::UNO_QUERY_THROW );
+ ::rtl::OUString sVersion;
try
{
- aAny = xUserDefinedProps->getPropertyValue(
- DEFINE_CONST_UNICODE("ODFVersion"));
+ xStorageProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ) ) >>= sVersion;
}
catch( const uno::Exception& )
{
// Custom Property "ODFVersion" does not exist
}
- ::rtl::OUString sVersion;
- if ( (aAny >>= sVersion) && sVersion.getLength() )
+ if ( sVersion.getLength() )
{
double nVersion = sVersion.toDouble();
- if ( nVersion > 1.20001 )
+ if ( nVersion > 1.20001 && SfxObjectShell_Impl::NeedsOfficeUpdateDialog() )
// ODF version greater than 1.2 - added some decimal places to be safe against floating point conversion errors (hack)
{
-
::rtl::OUString sDocumentURL( pMedium->GetOrigURL() );
::rtl::OUString aSystemFileURL;
if ( osl::FileBase::getSystemPathFromFileURL( sDocumentURL, aSystemFileURL ) == osl::FileBase::E_None )
@@ -1049,7 +1041,7 @@ sal_Bool SfxObjectShell::DoSave()
}
catch( uno::Exception& )
{
- SetError( ERRCODE_IO_GENERAL );
+ SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
DBG_ASSERT( bOk, "The root storage must allow to set common password!\n" );
@@ -1089,7 +1081,7 @@ sal_Bool SfxObjectShell::DoSave()
}
catch( uno::Exception& )
{
- SetError( ERRCODE_IO_GENERAL );
+ SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
bOk = sal_False;
}
}
@@ -1138,7 +1130,14 @@ sal_Bool SfxObjectShell::SaveTo_Impl
*/
{
- RTL_LOGFILE_CONTEXT( aLog, "sfx2 (mv76033) SfxObjectShell::SaveTo_Impl" );
+ RTL_LOGFILE_PRODUCT_CONTEXT( aLog, "PERFORMANCE SfxObjectShell::SaveTo_Impl" );
+ if( RTL_LOGFILE_HASLOGFILE() )
+ {
+ ByteString aString( rMedium.GetName(), RTL_TEXTENCODING_ASCII_US );
+ RTL_LOGFILE_PRODUCT_CONTEXT_TRACE1( aLog, "saving \"%s\"", aString.GetBuffer() );
+ }
+
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Begin" ) ) );
ModifyBlocker_Impl aMod(this);
@@ -1161,7 +1160,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl
// protected libraries exceed the size we can handler
if ( bOwnTarget && !QuerySaveSizeExceededModules_Impl( rMedium.GetInteractionHandler() ) )
{
- SetError( ERRCODE_IO_ABORT );
+ SetError( ERRCODE_IO_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
return sal_False;
}
@@ -1178,6 +1177,8 @@ sal_Bool SfxObjectShell::SaveTo_Impl
|| pImp->nScriptingSignatureState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED
|| pImp->nScriptingSignatureState == SIGNATURESTATE_SIGNATURES_INVALID ) )
{
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "MacroSignaturePreserving" ) ) );
+
// the checking of the library modified state iterates over the libraries, should be done only when required
bTryToPreservScriptSignature = !pImp->pBasicManager->isAnyContainerModified();
if ( bTryToPreservScriptSignature )
@@ -1221,13 +1222,15 @@ sal_Bool SfxObjectShell::SaveTo_Impl
&& SfxMedium::EqualURLs( pMedium->GetName(), rMedium.GetName() ) )
{
bStoreToSameLocation = sal_True;
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Save" ) ) );
- rMedium.CheckFileDate( pMedium->GetInitFileDate() );
+ if ( pMedium->DocNeedsFileDateCheck() )
+ rMedium.CheckFileDate( pMedium->GetInitFileDate( sal_False ) );
if ( bCopyTo && GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
{
// export to the same location is vorbidden
- SetError( ERRCODE_IO_CANTWRITE );
+ SetError( ERRCODE_IO_CANTWRITE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
else
{
@@ -1236,10 +1239,11 @@ sal_Bool SfxObjectShell::SaveTo_Impl
const sal_Bool bDoBackup = SvtSaveOptions().IsBackup();
if ( bDoBackup )
{
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "DoBackup" ) ) );
rMedium.DoBackup_Impl();
if ( rMedium.GetError() )
{
- SetError( rMedium.GetErrorCode() );
+ SetError( rMedium.GetErrorCode(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
rMedium.ResetError();
}
}
@@ -1262,6 +1266,9 @@ sal_Bool SfxObjectShell::SaveTo_Impl
// commit the wrapper stream ( the stream will connect the URL only on commit, after that it will hold it )
// if the last step is failed the stream should stay to be transacted and should be commited on any flush
// so we can forget the stream in any way and the next storage commit will flush it
+
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Save: Own to Own" ) ) );
+
bNeedsDisconnectionOnFail = DisconnectStorage_Impl(
*pMedium, rMedium );
if ( bNeedsDisconnectionOnFail
@@ -1282,6 +1289,9 @@ sal_Bool SfxObjectShell::SaveTo_Impl
// the source and the target formats are alien
// just disconnect the stream from the source format
// so that the target medium can use it
+
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Save: Alien to Alien" ) ) );
+
pMedium->CloseAndRelease();
rMedium.CloseAndRelease();
rMedium.CreateTempFileNoCopy();
@@ -1292,6 +1302,9 @@ sal_Bool SfxObjectShell::SaveTo_Impl
// the source format is an alien one but the target
// format is an own one so just disconnect the source
// medium
+
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Save: Alien to Own" ) ) );
+
pMedium->CloseAndRelease();
rMedium.CloseAndRelease();
rMedium.GetOutputStorage();
@@ -1301,6 +1314,9 @@ sal_Bool SfxObjectShell::SaveTo_Impl
// the source format is an own one but the target is
// an alien format, just connect the source to temporary
// storage
+
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Save: Own to Alien" ) ) );
+
bNeedsDisconnectionOnFail = DisconnectStorage_Impl(
*pMedium, rMedium );
if ( bNeedsDisconnectionOnFail
@@ -1320,6 +1336,9 @@ sal_Bool SfxObjectShell::SaveTo_Impl
// the alien filters still might write directly to the file, that is of course a bug,
// but for now the framework has to be ready for it
// TODO/LATER: let the medium be prepared for alien formats as well
+
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "SaveAs/Export" ) ) );
+
rMedium.CloseAndRelease();
if ( bStorageBasedTarget )
{
@@ -1331,6 +1350,8 @@ sal_Bool SfxObjectShell::SaveTo_Impl
if( rMedium.GetErrorCode() || pMedium->GetErrorCode() || GetErrorCode() )
return sal_False;
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Locking" ) ) );
+
rMedium.LockOrigFileOnDemand( sal_False, sal_False );
if ( bStorageBasedTarget )
@@ -1384,12 +1405,14 @@ sal_Bool SfxObjectShell::SaveTo_Impl
if( bOwnTarget && !( pFilter->GetFilterFlags() & SFX_FILTER_STARONEFILTER ) )
{
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Storing in own format." ) ) );
uno::Reference< embed::XStorage > xMedStorage = rMedium.GetStorage();
if ( !xMedStorage.is() )
{
// no saving without storage, unlock UI and return
Lock_Impl( this, sal_False );
pImp->bForbidReload = bOldStat;
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Storing failed, still no error set." ) ) );
return sal_False;
}
@@ -1406,7 +1429,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl
catch( uno::Exception& )
{
DBG_ERROR( "Setting of common encryption key failed!" );
- SetError( ERRCODE_IO_GENERAL );
+ SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
else
@@ -1425,15 +1448,18 @@ sal_Bool SfxObjectShell::SaveTo_Impl
if ( xMedStorage == GetStorage() )
{
OSL_ENSURE( !pVersionItem, "This scenario is impossible currently!\n" );
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Should be impossible." ) ) );
// usual save procedure
bOk = Save();
}
else
{
// save to target
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Save as own format." ) ) );
bOk = SaveAsOwnFormat( rMedium );
if ( bOk && pVersionItem )
{
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "pVersionItem != NULL" ) ) );
aTmpVersionURL = CreateTempCopyOfStorage_Impl( xMedStorage );
bOk = ( aTmpVersionURL.getLength() > 0 );
}
@@ -1444,7 +1470,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl
if ( bOk && GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
{
// store the thumbnail representation image
- // TODO: handle the case when document is encrypted and/or signed
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Thumbnail creation." ) ) );
if ( !GenerateAndStoreThumbnail( bPasswdProvided,
sal_False,
pFilter->IsOwnTemplateFormat(),
@@ -1459,6 +1485,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl
{
if ( pImp->bIsSaving || pImp->bPreserveVersions )
{
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Preserve versions." ) ) );
try
{
Sequence < util::RevisionTag > aVersions = rMedium.GetVersionList();
@@ -1488,6 +1515,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl
}
catch( uno::Exception& )
{
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Preserve versions has failed." ) ) );
DBG_ERROR( "Couldn't copy versions!\n" );
bOk = sal_False;
// TODO/LATER: a specific error could be set
@@ -1540,6 +1568,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl
}
else
{
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Storing in alien format." ) ) );
// it's a "SaveAs" in an alien format
if ( rMedium.GetFilter() && ( rMedium.GetFilter()->GetFilterFlags() & SFX_FILTER_STARONEFILTER ) )
bOk = ExportTo( rMedium );
@@ -1617,6 +1646,8 @@ sal_Bool SfxObjectShell::SaveTo_Impl
if ( bOk )
{
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Medium commit." ) ) );
+
// transfer data to its destinated location
// the medium commits the storage or the stream it is based on
RegisterTransfer( rMedium );
@@ -1624,6 +1655,8 @@ sal_Bool SfxObjectShell::SaveTo_Impl
if ( bOk && bScriptSignatureIsCopied )
{
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Script signature check." ) ) );
+
// if the script signature was copied it should be checked now
// usually it should be ok, so no additional actions will be done
// but if for any reasong ( f.e. binshell change ) it is broken it should be removed here
@@ -1671,6 +1704,8 @@ sal_Bool SfxObjectShell::SaveTo_Impl
if ( bOk )
{
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Storing is successful." ) ) );
+
// if the target medium is an alien format and the "old" medium was an own format and the "old" medium
// has a name, the object storage must be exchanged, because now we need a new temporary storage
// as object storage
@@ -1689,12 +1724,17 @@ sal_Bool SfxObjectShell::SaveTo_Impl
OSL_ENSURE( pMedium->GetName().Len(), "Fallback is used, the medium without name should not dispose the storage!\n" );
// copy storage of old medium to new temporary storage and take this over
if( !ConnectTmpStorage_Impl( pMedium->GetStorage(), pMedium ) )
+ {
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Process after storing has failed." ) ) );
bOk = sal_False;
+ }
}
}
}
else
{
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Storing has failed." ) ) );
+
// in case the document storage was connected to backup temporarely it must be disconnected now
if ( bNeedsDisconnectionOnFail )
ConnectTmpStorage_Impl( pImp->m_xDocStorage, NULL );
@@ -1848,7 +1888,7 @@ sal_Bool SfxObjectShell::ConnectTmpStorage_Impl(
if ( !bResult )
{
// TODO/LATER: may need error code setting based on exception
- SetError( ERRCODE_IO_GENERAL );
+ SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
@@ -1904,7 +1944,7 @@ sal_Bool SfxObjectShell::DoSaveAs( SfxMedium& rMedium )
{
// hier kommen nur Root-Storages rein, die via Temp-File gespeichert werden
rMedium.CreateTempFileNoCopy();
- SetError(rMedium.GetErrorCode());
+ SetError(rMedium.GetErrorCode(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
if ( GetError() )
return sal_False;
@@ -1914,7 +1954,7 @@ sal_Bool SfxObjectShell::DoSaveAs( SfxMedium& rMedium )
sal_Bool bRet = SaveTo_Impl( rMedium, NULL );
if ( !bRet )
- SetError(rMedium.GetErrorCode());
+ SetError(rMedium.GetErrorCode(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
return bRet;
}
@@ -2041,10 +2081,17 @@ sal_Bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed )
InvalidateName();
SetModified(sal_False); // nur bei gesetztem Medium zur"ucksetzen
Broadcast( SfxSimpleHint(SFX_HINT_MODECHANGED) );
+
+ // this is the end of the saving process, it is possible that the file was changed
+ // between medium commit and this step ( attributes change and so on )
+ // so get the file date again
+ if ( pNewMed->DocNeedsFileDateCheck() )
+ pNewMed->GetInitFileDate( sal_True );
}
}
pMedium->ClearBackup_Impl();
+ pMedium->LockOrigFileOnDemand( sal_True, sal_False );
return bOk;
}
@@ -2478,7 +2525,7 @@ sal_Bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs )
// pMediumTmp->CreateTempFileNoCopy();
if ( pMediumTmp->GetErrorCode() != ERRCODE_NONE )
{
- SetError( pMediumTmp->GetError() );
+ SetError( pMediumTmp->GetError(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
delete pMediumTmp;
return sal_False;
}
@@ -2487,7 +2534,7 @@ sal_Bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs )
pMediumTmp->TransferVersionList_Impl( *pRetrMedium );
/*
if ( pFilter && ( pFilter->GetFilterFlags() & SFX_FILTER_PACKED ) )
- SetError( GetMedium()->Unpack_Impl( pRetrMedium->GetPhysicalName() ) );
+ SetError( GetMedium()->Unpack_Impl( pRetrMedium->GetPhysicalName() ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
*/
// an interaction handler here can aquire only in case of GUI Saving
@@ -2508,7 +2555,7 @@ sal_Bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs )
pMediumTmp->GetItemSet()->ClearItem( SID_PROGRESS_STATUSBAR_CONTROL );
}
- SetError(pMediumTmp->GetErrorCode());
+ SetError(pMediumTmp->GetErrorCode(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
//REMOVE if ( !IsHandsOff() )
//REMOVE pMediumTmp->Close();
@@ -2520,7 +2567,7 @@ sal_Bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs )
else
{
// transfer error code from medium to objectshell
- SetError( pMediumTmp->GetError() );
+ SetError( pMediumTmp->GetError(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
// reconnect to object storage
//REMOVE if ( IsHandsOff() )
@@ -2550,7 +2597,7 @@ sal_Bool SfxObjectShell::Save_Impl( const SfxItemSet* pSet )
{
if ( IsReadOnly() )
{
- SetError( ERRCODE_SFX_DOCUMENTREADONLY );
+ SetError( ERRCODE_SFX_DOCUMENTREADONLY, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
return sal_False;
}
@@ -2596,7 +2643,7 @@ sal_Bool SfxObjectShell::CommonSaveAs_Impl
{
if( aURL.HasError() )
{
- SetError( ERRCODE_IO_INVALIDPARAMETER );
+ SetError( ERRCODE_IO_INVALIDPARAMETER, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
return sal_False;
}
@@ -2618,7 +2665,7 @@ sal_Bool SfxObjectShell::CommonSaveAs_Impl
if ( pDoc )
{
// dann Fehlermeldeung: "schon offen"
- SetError(ERRCODE_SFX_ALREADYOPEN);
+ SetError(ERRCODE_SFX_ALREADYOPEN, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
return sal_False;
}
}
@@ -2634,7 +2681,7 @@ sal_Bool SfxObjectShell::CommonSaveAs_Impl
|| !pFilter->CanExport()
|| (!bSaveTo && !pFilter->CanImport()) )
{
- SetError( ERRCODE_IO_INVALIDPARAMETER );
+ SetError( ERRCODE_IO_INVALIDPARAMETER, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
return sal_False;
}
@@ -2656,7 +2703,7 @@ sal_Bool SfxObjectShell::CommonSaveAs_Impl
if ( aURL == aActName && aURL != INetURLObject( OUString::createFromAscii( "private:stream" ) )
&& IsReadOnly() )
{
- SetError(ERRCODE_SFX_DOCUMENTREADONLY);
+ SetError(ERRCODE_SFX_DOCUMENTREADONLY, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
return sal_False;
}
@@ -2793,7 +2840,7 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl
if ( pNewFile->GetErrorCode() != ERRCODE_NONE )
{
// creating temporary file failed ( f.e. floppy disk not inserted! )
- SetError( pNewFile->GetError() );
+ SetError( pNewFile->GetError(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
delete pNewFile;
return sal_False;
}
@@ -2813,7 +2860,7 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl
if ( GetMedium()->GetFilter() && ( GetMedium()->GetFilter()->GetFilterFlags() & SFX_FILTER_PACKED ) )
{
SfxMedium *pMed = bCopyTo ? pMedium : pNewFile;
- pNewFile->SetError( GetMedium()->Unpack_Impl( pMed->GetPhysicalName() ) );
+ pNewFile->SetError( GetMedium()->Unpack_Impl( pMed->GetPhysicalName() ) , ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
*/
// Save the document ( first as temporary file, then transfer to the target URL by committing the medium )
@@ -2823,7 +2870,7 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl
bOk = sal_True;
// transfer a possible error from the medium to the document
- SetError( pNewFile->GetErrorCode() );
+ SetError( pNewFile->GetErrorCode(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
// notify the document that saving was done successfully
//REMOVE if ( bCopyTo )
@@ -2854,7 +2901,7 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl
// and the DoSaveCompleted call should not be able to fail in general
DBG_ASSERT( !bCopyTo, "Error while reconnecting to medium, can't be handled!");
- SetError( pNewFile->GetErrorCode() );
+ SetError( pNewFile->GetErrorCode(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
if ( !bCopyTo )
{
@@ -2888,7 +2935,7 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl
}
else
{
- SetError( pNewFile->GetErrorCode() );
+ SetError( pNewFile->GetErrorCode(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
//REMOVE // reconnect to the old storage
//REMOVE if ( IsHandsOff() )
@@ -3064,6 +3111,13 @@ void SfxObjectShell::SetSecurityOptOpenReadOnly( sal_Bool _b )
sal_Bool SfxObjectShell::LoadOwnFormat( SfxMedium& rMedium )
{
+ RTL_LOGFILE_PRODUCT_CONTEXT( aLog, "PERFORMANCE SfxObjectShell::LoadOwnFormat" );
+ if( RTL_LOGFILE_HASLOGFILE() )
+ {
+ ByteString aString( rMedium.GetName(), RTL_TEXTENCODING_ASCII_US );
+ RTL_LOGFILE_PRODUCT_CONTEXT_TRACE1( aLog, "loading \"%s\"", aString.GetBuffer() );
+ }
+
uno::Reference< embed::XStorage > xStorage = rMedium.GetStorage();
if ( xStorage.is() )
{
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index d91ec392aa92..3edf1ddb60d7 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -722,11 +722,11 @@ namespace
{
static BasicManager* lcl_getBasicManagerForDocument( const SfxObjectShell& _rDocument )
{
- if ( !_rDocument.pImp->m_bNoBasicCapabilities )
+ if ( !_rDocument.Get_Impl()->m_bNoBasicCapabilities )
{
- if ( !_rDocument.pImp->bBasicInitialized )
+ if ( !_rDocument.Get_Impl()->bBasicInitialized )
const_cast< SfxObjectShell& >( _rDocument ).InitBasicManager_Impl();
- return _rDocument.pImp->pBasicManager->get();
+ return _rDocument.Get_Impl()->pBasicManager->get();
}
// assume we do not have Basic ourself, but we can refer to another
@@ -794,9 +794,13 @@ namespace
try
{
Reference< XStorageBasedDocument > xStorageDoc( _rxDocument, UNO_QUERY );
+ const Reference< XComponentContext > xContext(
+ ::comphelper::getProcessComponentContext() );
_rxContainer.set ( _bScript
- ? DocumentScriptLibraryContainer::create( comphelper_getProcessComponentContext(), xStorageDoc )
- : DocumentDialogLibraryContainer::create( comphelper_getProcessComponentContext(), xStorageDoc )
+ ? DocumentScriptLibraryContainer::create(
+ xContext, xStorageDoc )
+ : DocumentDialogLibraryContainer::create(
+ xContext, xStorageDoc )
, UNO_QUERY_THROW );
}
catch( const Exception& )
@@ -1065,6 +1069,12 @@ void SfxObjectShell::SetAutoStyleFilterIndex(sal_uInt16 nSet)
pImp->nStyleFilter = nSet;
}
+sal_uInt16 SfxObjectShell::GetAutoStyleFilterIndex()
+{
+ return pImp->nStyleFilter;
+}
+
+
void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComponent )
{
if ( _rxComponent.get() == s_xCurrentComponent.get().get() )
diff --git a/sfx2/source/doc/plugin.cxx b/sfx2/source/doc/plugin.cxx
index 4f08b197aa4a..0ab29e39b829 100644
--- a/sfx2/source/doc/plugin.cxx
+++ b/sfx2/source/doc/plugin.cxx
@@ -168,7 +168,7 @@ throw( uno::RuntimeException )
// we must destroy the plugin before the parent is destroyed
xWindow->addEventListener( this );
xFrame->setComponent( xWindow, uno::Reference < frame::XController >() );
- return TRUE;
+ return mxPlugin.is() ? TRUE : FALSE;
}
return FALSE;
diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx
index 07d218fcd690..cd8e28ee771c 100755
--- a/sfx2/source/doc/printhelper.cxx
+++ b/sfx2/source/doc/printhelper.cxx
@@ -179,6 +179,85 @@ SfxPrintHelper::~SfxPrintHelper()
delete m_pData;
}
+namespace
+{
+ view::PaperFormat convertToPaperFormat(Paper eFormat)
+ {
+ view::PaperFormat eRet;
+ switch (eFormat)
+ {
+ case PAPER_A3:
+ eRet = view::PaperFormat_A3;
+ break;
+ case PAPER_A4:
+ eRet = view::PaperFormat_A4;
+ break;
+ case PAPER_A5:
+ eRet = view::PaperFormat_A5;
+ break;
+ case PAPER_B4_ISO:
+ eRet = view::PaperFormat_B4;
+ break;
+ case PAPER_B5_ISO:
+ eRet = view::PaperFormat_B5;
+ break;
+ case PAPER_LETTER:
+ eRet = view::PaperFormat_LETTER;
+ break;
+ case PAPER_LEGAL:
+ eRet = view::PaperFormat_LEGAL;
+ break;
+ case PAPER_TABLOID:
+ eRet = view::PaperFormat_TABLOID;
+ break;
+ case PAPER_USER:
+ default:
+ eRet = view::PaperFormat_USER;
+ break;
+ }
+ return eRet;
+ }
+
+ Paper convertToPaper(view::PaperFormat eFormat)
+ {
+ Paper eRet(PAPER_USER);
+ switch (eFormat)
+ {
+ case view::PaperFormat_A3:
+ eRet = PAPER_A3;
+ break;
+ case view::PaperFormat_A4:
+ eRet = PAPER_A4;
+ break;
+ case view::PaperFormat_A5:
+ eRet = PAPER_A5;
+ break;
+ case view::PaperFormat_B4:
+ eRet = PAPER_B4_ISO;
+ break;
+ case view::PaperFormat_B5:
+ eRet = PAPER_B5_ISO;
+ break;
+ case view::PaperFormat_LETTER:
+ eRet = PAPER_LETTER;
+ break;
+ case view::PaperFormat_LEGAL:
+ eRet = PAPER_LEGAL;
+ break;
+ case view::PaperFormat_TABLOID:
+ eRet = PAPER_TABLOID;
+ break;
+ case view::PaperFormat_USER:
+ eRet = PAPER_USER;
+ break;
+ case view::PaperFormat_MAKE_FIXED_SIZE:
+ break;
+ //deliberate no default to force warn on a new papersize
+ }
+ return eRet;
+ }
+}
+
//________________________________________________________________________________________________________
// XPrintable
//________________________________________________________________________________________________________
@@ -218,7 +297,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxPrintHelper::getPrinter() thro
aPrinter.getArray()[3].Value <<= aSize;
aPrinter.getArray()[2].Name = DEFINE_CONST_UNICODE( "PaperFormat" );
- view::PaperFormat eFormat = (view::PaperFormat)pPrinter->GetPaper();
+ view::PaperFormat eFormat = convertToPaperFormat(pPrinter->GetPaper());
aPrinter.getArray()[2].Value <<= eFormat;
aPrinter.getArray()[1].Name = DEFINE_CONST_UNICODE( "PaperOrientation" );
@@ -276,7 +355,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >
}
Size aSetPaperSize( 0, 0);
- view::PaperFormat nPaperFormat = (view::PaperFormat) PAPER_USER;
+ view::PaperFormat nPaperFormat = view::PaperFormat_USER;
// other properties
for ( int i = 0; i < rPrinter.getLength(); ++i )
@@ -312,9 +391,9 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >
nPaperFormat = ( view::PaperFormat ) lDummy;
}
- if ( (Paper) nPaperFormat != pPrinter->GetPaper() )
+ if ( convertToPaper(nPaperFormat) != pPrinter->GetPaper() )
{
- pPrinter->SetPaper( (Paper) nPaperFormat );
+ pPrinter->SetPaper( convertToPaper(nPaperFormat) );
nChangeFlags |= SFX_PRINTER_CHG_SIZE;
}
}
@@ -354,7 +433,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >
//os 12.11.98: die PaperSize darf nur gesetzt werden, wenn tatsaechlich
//PAPER_USER gilt, sonst koennte vom Treiber ein falsches Format gewaehlt werden
- if(nPaperFormat == PAPER_USER && aSetPaperSize.Width())
+ if(nPaperFormat == view::PaperFormat_USER && aSetPaperSize.Width())
{
//JP 23.09.98 - Bug 56929 - MapMode von 100mm in die am
// Device gesetzten umrechnen. Zusaetzlich nur dann
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 7fce5942f8af..53673b505d6d 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -66,6 +66,7 @@
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/Aspects.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/frame/XTransientDocumentsDocumentContentFactory.hpp>
#include <comphelper/enumhelper.hxx> // can be removed when this is a "real" service
#include <cppuhelper/interfacecontainer.hxx>
@@ -124,6 +125,8 @@
#include "brokenpackageint.hxx"
#include "graphhelp.hxx"
#include <sfx2/msgpool.hxx>
+#include <sfx2/DocumentMetadataAccess.hxx>
+
#include <sfxresid.hxx>
//________________________________________________________________________________________________________
@@ -135,13 +138,14 @@ static const ::rtl::OUString SERVICENAME_DESKTOP = ::rtl::OUString::createFromAs
//________________________________________________________________________________________________________
namespace css = ::com::sun::star;
-using namespace com::sun::star;
+using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
//________________________________________________________________________________________________________
// impl. declarations
//________________________________________________________________________________________________________
+
struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument
{
// counter for SfxBaseModel instances created.
@@ -172,6 +176,8 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument
::rtl::OUString m_sModuleIdentifier;
css::uno::Reference< css::frame::XTitle > m_xTitleHelper;
css::uno::Reference< css::frame::XUntitledNumbers > m_xNumberedControllers;
+ uno::Reference< rdf::XDocumentMetadataAccess> m_xDocumentMetadata;
+
IMPL_SfxBaseModel_DataContainer( ::osl::Mutex& rMutex, SfxObjectShell* pObjectShell )
: m_pObjectShell ( pObjectShell )
@@ -184,6 +190,7 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument
, m_pStorageModifyListen ( NULL )
, m_xTitleHelper ()
, m_xNumberedControllers ()
+ , m_xDocumentMetadata () // lazy
{
// increase global instance counter.
++g_nInstanceCounter;
@@ -201,6 +208,58 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument
if ( m_pObjectShell.Is() && !m_pObjectShell->IsModified() )
m_pObjectShell->SetModified( sal_True );
}
+
+ uno::Reference<rdf::XDocumentMetadataAccess> GetDMA()
+ {
+ if (!m_xDocumentMetadata.is())
+ {
+ OSL_ENSURE(m_pObjectShell, "GetDMA: no object shell?");
+ if (!m_pObjectShell)
+ {
+ return 0;
+ }
+
+ const uno::Reference<uno::XComponentContext> xContext(
+ ::comphelper::getProcessComponentContext());
+ ::rtl::OUString uri;
+ const uno::Reference<frame::XModel> xModel(
+ m_pObjectShell->GetModel());
+ const uno::Reference<lang::XMultiComponentFactory> xMsf(
+ xContext->getServiceManager());
+ const uno::Reference<frame::
+ XTransientDocumentsDocumentContentFactory> xTDDCF(
+ xMsf->createInstanceWithContext(
+ ::rtl::OUString::createFromAscii( "com.sun.star.frame."
+ "TransientDocumentsDocumentContentFactory"),
+ xContext),
+ uno::UNO_QUERY_THROW);
+ const uno::Reference<ucb::XContent> xContent(
+ xTDDCF->createDocumentContent(xModel) );
+ OSL_ENSURE(xContent.is(), "GetDMA: cannot create DocumentContent");
+ if (!xContent.is())
+ {
+ return 0;
+ }
+ uri = xContent->getIdentifier()->getContentIdentifier();
+ OSL_ENSURE(uri.getLength(), "GetDMA: empty uri?");
+ if (uri.getLength() && !uri.endsWithAsciiL("/", 1))
+ {
+ uri = uri + ::rtl::OUString::createFromAscii("/");
+ }
+
+ m_xDocumentMetadata = new ::sfx2::DocumentMetadataAccess(
+ xContext, *m_pObjectShell, uri);
+ }
+ return m_xDocumentMetadata;
+ }
+
+ uno::Reference<rdf::XDocumentMetadataAccess> CreateDMAUninitialized()
+ {
+ return (m_pObjectShell)
+ ? new ::sfx2::DocumentMetadataAccess(
+ ::comphelper::getProcessComponentContext(), *m_pObjectShell)
+ : 0;
+ }
};
// static member initialization.
@@ -417,9 +476,9 @@ SfxSaveGuard::~SfxSaveGuard()
//________________________________________________________________________________________________________
DBG_NAME(sfx2_SfxBaseModel)
SfxBaseModel::SfxBaseModel( SfxObjectShell *pObjectShell )
-: IMPL_SfxBaseModel_MutexContainer()
+: BaseMutex()
, m_pData( new IMPL_SfxBaseModel_DataContainer( m_aMutex, pObjectShell ) )
-, m_bSupportEmbeddedScripts( pObjectShell && pObjectShell->pImp ? !pObjectShell->pImp->m_bNoBasicCapabilities : false )
+, m_bSupportEmbeddedScripts( pObjectShell && pObjectShell->Get_Impl() ? !pObjectShell->Get_Impl()->m_bNoBasicCapabilities : false )
{
DBG_CTOR(sfx2_SfxBaseModel,NULL);
if ( pObjectShell != NULL )
@@ -686,10 +745,9 @@ void SAL_CALL SfxBaseModel::dispose() throw(::com::sun::star::uno::RuntimeExcept
m_pData->m_xDocumentInfo = 0;
}
- if ( m_pData->m_xDocumentProperties.is() )
- {
- m_pData->m_xDocumentProperties = 0;
- }
+ m_pData->m_xDocumentProperties.clear();
+
+ m_pData->m_xDocumentMetadata.clear();
EndListening( *m_pData->m_pObjectShell );
@@ -1485,6 +1543,7 @@ void SAL_CALL SfxBaseModel::storeSelf( const uno::Sequence< beans::PropertyVa
if ( m_pData->m_pObjectShell.Is() )
{
+ m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "storeSelf" ) ) );
SfxSaveGuard aSaveGuard(this, m_pData, sal_False);
for ( sal_Int32 nInd = 0; nInd < aSeqArgs.getLength(); nInd++ )
@@ -1495,6 +1554,9 @@ void SAL_CALL SfxBaseModel::storeSelf( const uno::Sequence< beans::PropertyVa
&& !aSeqArgs[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" ) ) )
&& !aSeqArgs[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StatusIndicator" ) ) ) )
{
+ m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "unexpected parameter for storeSelf, might be no problem if SaveAs is executed." ) ) );
+ m_pData->m_pObjectShell->StoreLog();
+
::rtl::OUString aMessage( RTL_CONSTASCII_USTRINGPARAM( "Unexpected MediaDescriptor parameter: " ) );
aMessage += aSeqArgs[nInd].Name;
throw lang::IllegalArgumentException( aMessage, uno::Reference< uno::XInterface >(), 1 );
@@ -1539,12 +1601,17 @@ void SAL_CALL SfxBaseModel::storeSelf( const uno::Sequence< beans::PropertyVa
if ( bRet )
{
+ m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "successful saving." ) ) );
m_pData->m_aPreusedFilterName = GetMediumFilterName_Impl();
SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOCDONE, m_pData->m_pObjectShell ) );
}
else
{
+ m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Storing failed!" ) ) );
+ m_pData->m_pObjectShell->StoreLog();
+
+ // write the contents of the logger to the file
SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOCFAILED, m_pData->m_pObjectShell ) );
throw task::ErrorCodeIOException( ::rtl::OUString(), uno::Reference< uno::XInterface >(), nErrCode );
@@ -1579,6 +1646,7 @@ void SAL_CALL SfxBaseModel::storeAsURL( const ::rtl::OUString&
if ( m_pData->m_pObjectShell.Is() )
{
+ m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "storeAsURL" ) ) );
SfxSaveGuard aSaveGuard(this, m_pData, sal_False);
impl_store( rURL, rArgs, sal_False );
@@ -1604,6 +1672,7 @@ void SAL_CALL SfxBaseModel::storeToURL( const ::rtl::OUString&
if ( m_pData->m_pObjectShell.Is() )
{
+ m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "storeToURL" ) ) );
SfxSaveGuard aSaveGuard(this, m_pData, sal_False);
impl_store( rURL, rArgs, sal_True );
}
@@ -2468,6 +2537,10 @@ void SfxBaseModel::changing()
if ( impl_isDisposed() )
return;
+ // the notification should not be sent if the document can not be modified
+ if ( !m_pData->m_pObjectShell.Is() || !m_pData->m_pObjectShell->IsEnableSetModified() )
+ return;
+
::cppu::OInterfaceContainerHelper* pIC = m_pData->m_aInterfaceContainer.getContainer( ::getCppuType((const uno::Reference< XMODIFYLISTENER >*)0) );
if( pIC )
@@ -2589,19 +2662,48 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL
aArgHash.erase( aFilterString );
aArgHash.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ) );
- try
+ // if the password is changed SaveAs should be done
+ // no password for encrypted document is also a change here
+ sal_Bool bPassChanged = sal_False;
+
+ ::comphelper::SequenceAsHashMap::iterator aNewPassIter
+ = aArgHash.find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Password" ) ) );
+ SFX_ITEMSET_ARG( pMedium->GetItemSet(), pPasswordItem, SfxStringItem, SID_PASSWORD, sal_False );
+ if ( pPasswordItem && aNewPassIter != aArgHash.end() )
+ {
+ ::rtl::OUString aNewPass;
+ aNewPassIter->second >>= aNewPass;
+ bPassChanged = !aNewPass.equals( pPasswordItem->GetValue() );
+ }
+ else if ( pPasswordItem || aNewPassIter != aArgHash.end() )
+ bPassChanged = sal_True;
+
+ if ( !bPassChanged )
{
- storeSelf( aArgHash.getAsConstPropertyValueList() );
- bSaved = sal_True;
+ try
+ {
+ storeSelf( aArgHash.getAsConstPropertyValueList() );
+ bSaved = sal_True;
+ }
+ catch( const lang::IllegalArgumentException& )
+ {
+ // some additional arguments do not allow to use saving, SaveAs should be done
+ // but only for normal documents, the shared documents would be overwritten in this case
+ // that would mean an information loss
+ // TODO/LATER: need a new interaction for this case
+ if ( m_pData->m_pObjectShell->IsDocShared() )
+ {
+ m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't store shared document!" ) ) );
+ m_pData->m_pObjectShell->StoreLog();
+
+ throw;
+ }
+ }
}
- catch( const lang::IllegalArgumentException& )
+ else if ( m_pData->m_pObjectShell->IsDocShared() )
{
- // some additional arguments do not allow to use saving, SaveAs should be done
- // but only for normal documents, the shared documents would be overwritten in this case
- // that would mean an information loss
- // TODO/LATER: need a new interaction for this case
- if ( m_pData->m_pObjectShell->IsDocShared() )
- throw;
+ // if the password is changed a special error should be used in case of shared document
+ throw task::ErrorCodeIOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cant change password for shared document." ) ), uno::Reference< uno::XInterface >(), ERRCODE_SFX_SHARED_NOPASSWORDCHANGE );
}
}
}
@@ -2623,9 +2725,14 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL
SFX_ITEMSET_ARG( aParams, pCopyStreamItem, SfxBoolItem, SID_COPY_STREAM_IF_POSSIBLE, sal_False );
if ( pCopyStreamItem && pCopyStreamItem->GetValue() && !bSaveTo )
+ {
+ m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Misuse of CopyStreamIfPossible!" ) ) );
+ m_pData->m_pObjectShell->StoreLog();
+
throw frame::IllegalArgumentIOException(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CopyStreamIfPossible parameter is not acceptable for storeAsURL() call!") ),
uno::Reference< uno::XInterface >() );
+ }
// since saving a document modifies its DocumentInfo, the current
// DocumentInfo must be saved on "SaveTo", so it can be restored
@@ -2679,7 +2786,10 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL
sal_uInt32 nErrCode = m_pData->m_pObjectShell->GetErrorCode();
if ( !bRet && !nErrCode )
+ {
+ m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Storing has failed, no error is set!" ) ) );
nErrCode = ERRCODE_IO_CANTWRITE;
+ }
m_pData->m_pObjectShell->ResetError();
if ( bRet )
@@ -2708,6 +2818,7 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL
}
}
+ m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Storing succeeded!" ) ) );
if ( !bSaveTo )
{
m_pData->m_aPreusedFilterName = GetMediumFilterName_Impl();
@@ -2720,6 +2831,10 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL
}
else
{
+ // let the logring be stored to the related file
+ m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Storing failed!" ) ) );
+ m_pData->m_pObjectShell->StoreLog();
+
SFX_APP()->NotifyEvent( SfxEventHint( bSaveTo ? SFX_EVENT_SAVETODOCFAILED : SFX_EVENT_SAVEASDOCFAILED,
m_pData->m_pObjectShell ) );
@@ -3772,3 +3887,325 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie
{
return css::uno::Reference< css::frame::XController2 >();
}
+
+//=============================================================================
+// RDF DocumentMetadataAccess
+
+// ::com::sun::star::rdf::XRepositorySupplier:
+uno::Reference< rdf::XRepository > SAL_CALL
+SfxBaseModel::getRDFRepository() throw (uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( impl_isDisposed() )
+ throw lang::DisposedException();
+
+ const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
+ if (!xDMA.is()) {
+ throw uno::RuntimeException( ::rtl::OUString::createFromAscii(
+ "model has no document metadata"), *this );
+ }
+
+ return xDMA->getRDFRepository();
+}
+
+// ::com::sun::star::rdf::XNode:
+::rtl::OUString SAL_CALL
+SfxBaseModel::getStringValue() throw (uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( impl_isDisposed() )
+ throw lang::DisposedException();
+
+ const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
+ if (!xDMA.is()) {
+ throw uno::RuntimeException( ::rtl::OUString::createFromAscii(
+ "model has no document metadata"), *this );
+ }
+
+ return xDMA->getStringValue();
+}
+
+// ::com::sun::star::rdf::XURI:
+::rtl::OUString SAL_CALL
+SfxBaseModel::getNamespace() throw (uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( impl_isDisposed() )
+ throw lang::DisposedException();
+
+ const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
+ if (!xDMA.is()) {
+ throw uno::RuntimeException( ::rtl::OUString::createFromAscii(
+ "model has no document metadata"), *this );
+ }
+
+ return xDMA->getNamespace();
+}
+
+::rtl::OUString SAL_CALL
+SfxBaseModel::getLocalName() throw (uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( impl_isDisposed() )
+ throw lang::DisposedException();
+
+ const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
+ if (!xDMA.is()) {
+ throw uno::RuntimeException( ::rtl::OUString::createFromAscii(
+ "model has no document metadata"), *this );
+ }
+
+ return xDMA->getLocalName();
+}
+
+// ::com::sun::star::rdf::XDocumentMetadataAccess:
+uno::Reference< rdf::XMetadatable > SAL_CALL
+SfxBaseModel::getElementByMetadataReference(
+ const ::com::sun::star::beans::StringPair & i_rReference)
+throw (uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( impl_isDisposed() )
+ throw lang::DisposedException();
+
+ const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
+ if (!xDMA.is()) {
+ throw uno::RuntimeException( ::rtl::OUString::createFromAscii(
+ "model has no document metadata"), *this );
+ }
+
+ return xDMA->getElementByMetadataReference(i_rReference);
+}
+
+uno::Reference< rdf::XMetadatable > SAL_CALL
+SfxBaseModel::getElementByURI(const uno::Reference< rdf::XURI > & i_xURI)
+throw (uno::RuntimeException, lang::IllegalArgumentException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( impl_isDisposed() )
+ throw lang::DisposedException();
+
+ const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
+ if (!xDMA.is()) {
+ throw uno::RuntimeException( ::rtl::OUString::createFromAscii(
+ "model has no document metadata"), *this );
+ }
+
+ return xDMA->getElementByURI(i_xURI);
+}
+
+uno::Sequence< uno::Reference< rdf::XURI > > SAL_CALL
+SfxBaseModel::getMetadataGraphsWithType(
+ const uno::Reference<rdf::XURI> & i_xType)
+throw (uno::RuntimeException, lang::IllegalArgumentException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( impl_isDisposed() )
+ throw lang::DisposedException();
+
+ const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
+ if (!xDMA.is()) {
+ throw uno::RuntimeException( ::rtl::OUString::createFromAscii(
+ "model has no document metadata"), *this );
+ }
+
+ return xDMA->getMetadataGraphsWithType(i_xType);
+}
+
+uno::Reference<rdf::XURI> SAL_CALL
+SfxBaseModel::addMetadataFile(const ::rtl::OUString & i_rFileName,
+ const uno::Sequence < uno::Reference< rdf::XURI > > & i_rTypes)
+throw (uno::RuntimeException, lang::IllegalArgumentException,
+ container::ElementExistException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( impl_isDisposed() )
+ throw lang::DisposedException();
+
+ const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
+ if (!xDMA.is()) {
+ throw uno::RuntimeException( ::rtl::OUString::createFromAscii(
+ "model has no document metadata"), *this );
+ }
+
+ return xDMA->addMetadataFile(i_rFileName, i_rTypes);
+}
+
+uno::Reference<rdf::XURI> SAL_CALL
+SfxBaseModel::importMetadataFile(::sal_Int16 i_Format,
+ const uno::Reference< io::XInputStream > & i_xInStream,
+ const ::rtl::OUString & i_rFileName,
+ const uno::Reference< rdf::XURI > & i_xBaseURI,
+ const uno::Sequence < uno::Reference< rdf::XURI > > & i_rTypes)
+throw (uno::RuntimeException, lang::IllegalArgumentException,
+ datatransfer::UnsupportedFlavorException,
+ container::ElementExistException, rdf::ParseException, io::IOException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( impl_isDisposed() )
+ throw lang::DisposedException();
+
+ const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
+ if (!xDMA.is()) {
+ throw uno::RuntimeException( ::rtl::OUString::createFromAscii(
+ "model has no document metadata"), *this );
+ }
+
+ return xDMA->importMetadataFile(i_Format,
+ i_xInStream, i_rFileName, i_xBaseURI, i_rTypes);
+}
+
+void SAL_CALL
+SfxBaseModel::removeMetadataFile(
+ const uno::Reference< rdf::XURI > & i_xGraphName)
+throw (uno::RuntimeException, lang::IllegalArgumentException,
+ container::NoSuchElementException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( impl_isDisposed() )
+ throw lang::DisposedException();
+
+ const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
+ if (!xDMA.is()) {
+ throw uno::RuntimeException( ::rtl::OUString::createFromAscii(
+ "model has no document metadata"), *this );
+ }
+
+ return xDMA->removeMetadataFile(i_xGraphName);
+}
+
+void SAL_CALL
+SfxBaseModel::addContentOrStylesFile(const ::rtl::OUString & i_rFileName)
+throw (uno::RuntimeException, lang::IllegalArgumentException,
+ container::ElementExistException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( impl_isDisposed() )
+ throw lang::DisposedException();
+
+ const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
+ if (!xDMA.is()) {
+ throw uno::RuntimeException( ::rtl::OUString::createFromAscii(
+ "model has no document metadata"), *this );
+ }
+
+ return xDMA->addContentOrStylesFile(i_rFileName);
+}
+
+void SAL_CALL
+SfxBaseModel::removeContentOrStylesFile(const ::rtl::OUString & i_rFileName)
+throw (uno::RuntimeException, lang::IllegalArgumentException,
+ container::NoSuchElementException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( impl_isDisposed() )
+ throw lang::DisposedException();
+
+ const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
+ if (!xDMA.is()) {
+ throw uno::RuntimeException( ::rtl::OUString::createFromAscii(
+ "model has no document metadata"), *this );
+ }
+
+ return xDMA->removeContentOrStylesFile(i_rFileName);
+}
+
+void SAL_CALL
+SfxBaseModel::loadMetadataFromStorage(
+ uno::Reference< embed::XStorage > const & i_xStorage,
+ uno::Reference<rdf::XURI> const & i_xBaseURI,
+ uno::Reference<task::XInteractionHandler> const & i_xHandler)
+throw (uno::RuntimeException, lang::IllegalArgumentException,
+ lang::WrappedTargetException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( impl_isDisposed() )
+ throw lang::DisposedException();
+
+ const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(
+ m_pData->CreateDMAUninitialized());
+ if (!xDMA.is()) {
+ throw uno::RuntimeException( ::rtl::OUString::createFromAscii(
+ "model has no document metadata"), *this );
+ }
+
+ try {
+ xDMA->loadMetadataFromStorage(i_xStorage, i_xBaseURI, i_xHandler);
+ } catch (lang::IllegalArgumentException &) {
+ throw; // not initialized
+ } catch (uno::Exception &) {
+ // UGLY: if it's a RuntimeException, we can't be sure DMA is initialzed
+ m_pData->m_xDocumentMetadata = xDMA;
+ throw;
+ }
+ m_pData->m_xDocumentMetadata = xDMA;
+
+}
+
+void SAL_CALL
+SfxBaseModel::storeMetadataToStorage(
+ uno::Reference< embed::XStorage > const & i_xStorage)
+throw (uno::RuntimeException, lang::IllegalArgumentException,
+ lang::WrappedTargetException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( impl_isDisposed() )
+ throw lang::DisposedException();
+
+ const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
+ if (!xDMA.is()) {
+ throw uno::RuntimeException( ::rtl::OUString::createFromAscii(
+ "model has no document metadata"), *this );
+ }
+
+ return xDMA->storeMetadataToStorage(i_xStorage);
+}
+
+void SAL_CALL
+SfxBaseModel::loadMetadataFromMedium(
+ const uno::Sequence< beans::PropertyValue > & i_rMedium)
+throw (uno::RuntimeException, lang::IllegalArgumentException,
+ lang::WrappedTargetException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( impl_isDisposed() )
+ throw lang::DisposedException();
+
+ const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(
+ m_pData->CreateDMAUninitialized());
+ if (!xDMA.is()) {
+ throw uno::RuntimeException( ::rtl::OUString::createFromAscii(
+ "model has no document metadata"), *this );
+ }
+
+ try {
+ xDMA->loadMetadataFromMedium(i_rMedium);
+ } catch (lang::IllegalArgumentException &) {
+ throw; // not initialized
+ } catch (uno::Exception &) {
+ // UGLY: if it's a RuntimeException, we can't be sure DMA is initialzed
+ m_pData->m_xDocumentMetadata = xDMA;
+ throw;
+ }
+ m_pData->m_xDocumentMetadata = xDMA;
+}
+
+void SAL_CALL
+SfxBaseModel::storeMetadataToMedium(
+ const uno::Sequence< beans::PropertyValue > & i_rMedium)
+throw (uno::RuntimeException, lang::IllegalArgumentException,
+ lang::WrappedTargetException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( impl_isDisposed() )
+ throw lang::DisposedException();
+
+ const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
+ if (!xDMA.is()) {
+ throw uno::RuntimeException( ::rtl::OUString::createFromAscii(
+ "model has no document metadata"), *this );
+ }
+
+ return xDMA->storeMetadataToMedium(i_rMedium);
+}
+
diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx
index 88afb10dfcc9..eb8719435406 100644
--- a/sfx2/source/inc/objshimp.hxx
+++ b/sfx2/source/inc/objshimp.hxx
@@ -33,6 +33,7 @@
//#include <hash_map>
#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/logging/XSimpleLogRing.hpp>
#include <tools/datetime.hxx>
#include <svtools/securityoptions.hxx>
@@ -168,9 +169,13 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess
::rtl::OUString m_aSharedFileURL;
+ ::com::sun::star::uno::Reference< ::com::sun::star::logging::XSimpleLogRing > m_xLogRing;
+
SfxObjectShell_Impl( SfxObjectShell& _rDocShell );
virtual ~SfxObjectShell_Impl();
+ static sal_Bool NeedsOfficeUpdateDialog();
+
// IMacroDocumentAccess overridables
virtual sal_Int16 getCurrentMacroExecMode() const;
virtual sal_Bool setCurrentMacroExecMode( sal_uInt16 nMacroMode );
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index c72989339a34..6a776f6a211e 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -1029,6 +1029,25 @@ void SfxToolBoxControl::Select( USHORT nModifier )
void SfxToolBoxControl::Select( BOOL /*bMod1*/ )
{
+ if(::comphelper::UiEventsLogger::isEnabled()) //#i88653# #i102805#
+ {
+ ::rtl::OUString sAppName;
+ try
+ {
+ static ::rtl::OUString our_aModuleManagerName = ::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager");
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager =
+ ::comphelper::getProcessServiceFactory();
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > xModuleManager(
+ xServiceManager->createInstance(our_aModuleManagerName)
+ , ::com::sun::star::uno::UNO_QUERY_THROW);
+ sAppName = xModuleManager->identify(m_xFrame);
+ } catch(::com::sun::star::uno::Exception&) {}
+ Sequence<PropertyValue> vSource;
+ ::comphelper::UiEventsLogger::appendDispatchOrigin(vSource, sAppName, ::rtl::OUString::createFromAscii("SfxToolBoxControl"));
+ URL aURL;
+ aURL.Complete = m_aCommandURL;
+ ::comphelper::UiEventsLogger::logDispatch(aURL, vSource);
+ }
svt::ToolboxController::execute( pImpl->nSelectModifier );
}
diff --git a/sfx2/util/makefile.mk b/sfx2/util/makefile.mk
index cfed0a838ffa..5ee6e64daca0 100644
--- a/sfx2/util/makefile.mk
+++ b/sfx2/util/makefile.mk
@@ -98,7 +98,9 @@ SHL1STDLIBS+=\
$(CPPULIB) \
$(VOSLIB) \
$(SALLIB) \
- $(SJLIB)
+ $(SJLIB) \
+ $(LIBXML2LIB) \
+
.IF "$(GUI)"=="WNT"
diff --git a/shell/inc/internal/basereader.hxx b/shell/inc/internal/basereader.hxx
index 47f7a9b82c40..4da8b7fa95be 100644
--- a/shell/inc/internal/basereader.hxx
+++ b/shell/inc/internal/basereader.hxx
@@ -50,6 +50,8 @@ public:
protected: // protected because its only an implementation relevant class
CBaseReader( const std::string& DocumentName );
+ CBaseReader( void* stream, zlib_filefunc_def* fa );
+
virtual void start_document();
virtual void end_document();
diff --git a/shell/inc/internal/contentreader.hxx b/shell/inc/internal/contentreader.hxx
index 41491df9fa8b..d8b2d77d28c0 100644
--- a/shell/inc/internal/contentreader.hxx
+++ b/shell/inc/internal/contentreader.hxx
@@ -43,6 +43,9 @@ public:
//CContentReader( const std::string& DocumentName );
CContentReader( const std::string& DocumentName, LocaleSet_t const & DocumentLocale );
+ CContentReader( void* stream, LocaleSet_t const & DocumentLocale, zlib_filefunc_def* fa );
+
+
/** Get the chunkbuffer.
@return
diff --git a/shell/inc/internal/metainforeader.hxx b/shell/inc/internal/metainforeader.hxx
index 62248beb845f..1e004b5a3727 100644
--- a/shell/inc/internal/metainforeader.hxx
+++ b/shell/inc/internal/metainforeader.hxx
@@ -45,6 +45,9 @@ public:
virtual ~CMetaInfoReader();
CMetaInfoReader( const std::string& DocumentName );
+
+ CMetaInfoReader( void* stream, zlib_filefunc_def* fa);
+
/** check if the Tag is in the target meta.xml file.
@param TagName
diff --git a/shell/inc/internal/propsheets.hxx b/shell/inc/internal/propsheets.hxx
index 3b14dc574fe3..0ebafcf0aa3a 100644
--- a/shell/inc/internal/propsheets.hxx
+++ b/shell/inc/internal/propsheets.hxx
@@ -92,7 +92,6 @@ private:
private:
long m_RefCnt;
char m_szFileName[MAX_PATH];
- std::auto_ptr<CMetaInfoReader> m_pMetaInfo;
};
#endif
diff --git a/shell/inc/internal/types.hxx b/shell/inc/internal/types.hxx
index 316a5e716d5b..730263060041 100644
--- a/shell/inc/internal/types.hxx
+++ b/shell/inc/internal/types.hxx
@@ -36,6 +36,9 @@
#include <utility>
#include <vector>
#include <stack>
+#include <external/zlib/zlib.h>
+#include <external/zlib/ioapi.h>
+
typedef std::vector<std::wstring> StringList_t;
diff --git a/shell/inc/internal/zipfile.hxx b/shell/inc/internal/zipfile.hxx
index 81da437544fe..2a860bb4c6cd 100644
--- a/shell/inc/internal/zipfile.hxx
+++ b/shell/inc/internal/zipfile.hxx
@@ -35,7 +35,9 @@
#define _WINDOWS
#endif
-#include <external/zlib/unzip.h>
+
+#include <external/zlib/unzip.h>
+
#include <string>
#include <vector>
@@ -69,6 +71,9 @@ public:
*/
static bool IsZipFile(const std::string& FileName);
+ static bool IsZipFile(void* stream);
+
+
/** Returns wheter the version of the specified zip file may be uncompressed with the
currently used zlib version or not
@@ -86,6 +91,7 @@ public:
*/
static bool IsValidZipFileVersionNumber(const std::string& FileName);
+ static bool IsValidZipFileVersionNumber(void* stream);
public:
@@ -103,6 +109,9 @@ public:
*/
ZipFile(const std::string& FileName);
+ ZipFile(void* stream, zlib_filefunc_def* fa);
+
+
/** Destroys a zip file
*/
~ZipFile();
diff --git a/shell/prj/build.lst b/shell/prj/build.lst
index 9758834dc803..7a2e91f973ba 100644
--- a/shell/prj/build.lst
+++ b/shell/prj/build.lst
@@ -1,4 +1,4 @@
-sl shell : offuh rdbmaker tools sal vcl EXPAT:expat transex3 NULL
+sl shell : l10n offuh rdbmaker tools sal vcl EXPAT:expat NULL
sl shell\inc nmake - all sl_inc NULL
sl shell\source\win32 nmake - w sl_win32 sl_inc NULL
sl shell\source\win32\simplemail nmake - w sl_win32_simplemail sl_inc NULL
@@ -31,6 +31,7 @@ sl shell\source\backends\wininetbe nmake - w sl_backends_w
sl shell\source\backends\macbe nmake - u sl_backends_macbe sl_inc NULL
sl shell\source\backends\gconfbe nmake - u sl_backends_gconfbe sl_inc NULL
sl shell\source\backends\kdebe nmake - u sl_backends_kdebe sl_inc NULL
+sl shell\source\backends\kde4be nmake - u sl_backends_kde4be sl_inc NULL
sl shell\source\backends\desktopbe nmake - u sl_backends_desktopbe sl_inc NULL
sl shell\source\win32\shlxthandler\ooofilt nmake - w sl_win32_shlxthandler_ooofilt sl_all_zipfile.w sl_all_ooofilereader.w sl_win32_shlxthandler_util.w sl_all sl_inc NULL
sl shell\source\win32\shlxthandler\ooofilt\proxy nmake - w sl_win32_ooofiltproxy sl_inc NULL
diff --git a/shell/source/all/makefile.mk b/shell/source/all/makefile.mk
index 3695abae798c..623aad6d69c1 100755
--- a/shell/source/all/makefile.mk
+++ b/shell/source/all/makefile.mk
@@ -35,6 +35,7 @@ PRJNAME=shell
TARGET=xmlparser
ENABLE_EXCEPTIONS=TRUE
+
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
@@ -61,6 +62,7 @@ CFLAGS+=-DSYSTEM_EXPAT
.ENDIF
SLOFILES=$(SLO)$/xml_parser.obj
+
.IF "$(BUILD_X64)"!=""
SLOFILES_X64=$(SLO_X64)$/xml_parser.obj
.ENDIF # "$(BUILD_X64)"!=""
diff --git a/shell/source/all/ooofilereader/basereader.cxx b/shell/source/all/ooofilereader/basereader.cxx
index 8412de36e458..d9be6740f057 100644
--- a/shell/source/all/ooofilereader/basereader.cxx
+++ b/shell/source/all/ooofilereader/basereader.cxx
@@ -50,6 +50,15 @@ m_ZipFile( DocumentName )
//
//------------------------------
+CBaseReader::CBaseReader(void * sw, zlib_filefunc_def* fa):
+m_ZipFile( sw , fa )
+{
+}
+
+//------------------------------
+//
+//------------------------------
+
CBaseReader::~CBaseReader()
{
}
diff --git a/shell/source/all/ooofilereader/contentreader.cxx b/shell/source/all/ooofilereader/contentreader.cxx
index f1990c741721..111647e70ad6 100644
--- a/shell/source/all/ooofilereader/contentreader.cxx
+++ b/shell/source/all/ooofilereader/contentreader.cxx
@@ -61,6 +61,29 @@ CBaseReader( DocumentName )
}
}
+CContentReader::CContentReader( void* stream, LocaleSet_t const & DocumentLocale, zlib_filefunc_def* fa ) :
+CBaseReader( stream, fa )
+{
+try
+ {
+ m_DefaultLocale = DocumentLocale;
+ Initialize( DOC_CONTENT_NAME );
+ }
+ catch(xml_parser_exception&
+ #if OSL_DEBUG_LEVEL > 0
+ ex
+ #endif
+ )
+ {
+ ENSURE(false, ex.what());
+ }
+ catch(...)
+ {
+ ENSURE(false, "Unknown error");
+ }
+}
+
+
/** destructor.
*/
diff --git a/shell/source/all/ooofilereader/makefile.mk b/shell/source/all/ooofilereader/makefile.mk
index 1e9788cf3f17..b893db45d849 100644
--- a/shell/source/all/ooofilereader/makefile.mk
+++ b/shell/source/all/ooofilereader/makefile.mk
@@ -35,6 +35,7 @@ TARGET=ooofilereader
LIBTARGET=NO
ENABLE_EXCEPTIONS=TRUE
+
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
@@ -65,7 +66,7 @@ LIB1TARGET=$(SLB)$/$(TARGET).lib
LIB1OBJFILES=$(SLOFILES)
LIB1FILES=$(SLB)$/zipfile.lib\
$(SLB)$/xmlparser.lib
-
+
.IF "$(BUILD_X64)"!=""
SLOFILES_X64=$(SLO_X64)$/basereader.obj\
$(SLO_X64)$/metainforeader.obj\
diff --git a/shell/source/all/ooofilereader/metainforeader.cxx b/shell/source/all/ooofilereader/metainforeader.cxx
index f09d8b3e41d0..cec17b59d3c9 100644
--- a/shell/source/all/ooofilereader/metainforeader.cxx
+++ b/shell/source/all/ooofilereader/metainforeader.cxx
@@ -80,6 +80,48 @@ CBaseReader( DocumentName )
}
}
+CMetaInfoReader::CMetaInfoReader( void* stream, zlib_filefunc_def* fa) :
+CBaseReader( stream, fa)
+{
+try
+ {
+ m_pKeywords_Builder = new CKeywordsTag( );
+ m_pSimple_Builder = new CSimpleTag( );
+ m_pDummy_Builder = new CDummyTag( );
+
+ //retrieve all infomation that is useful
+ m_AllMetaInfo[META_INFO_AUTHOR] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_TITLE] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_SUBJECT] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_KEYWORDS] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_DESCRIPTION] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_DOCUMENT_STATISTIC] = EMPTY_XML_TAG;
+
+ m_AllMetaInfo[META_INFO_GENERATOR] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_CREATION] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_CREATOR] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_MODIFIED] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_LANGUAGE] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_DOCUMENT_NUMBER] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_EDITING_TIME] = EMPTY_XML_TAG;
+
+ Initialize( META_CONTENT_NAME );
+ }
+ catch(xml_parser_exception&
+ #if OSL_DEBUG_LEVEL > 0
+ ex
+ #endif
+ )
+ {
+ ENSURE(false, ex.what());
+ }
+ catch(...)
+ {
+ ENSURE(false, "Unknown error");
+ }
+
+}
+
/** destructor.
*/
diff --git a/shell/source/all/zipfile/makefile.mk b/shell/source/all/zipfile/makefile.mk
index a7f9c95b95cf..9f294ce7aad0 100644
--- a/shell/source/all/zipfile/makefile.mk
+++ b/shell/source/all/zipfile/makefile.mk
@@ -33,6 +33,9 @@ PRJ=..$/..$/..
PRJNAME=shell
TARGET=zipfile
ENABLE_EXCEPTIONS=TRUE
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+
# --- Settings -----------------------------------------------------
@@ -45,8 +48,8 @@ SLOFILES=$(SLO)$/zipfile.obj\
$(SLO)$/zipexcptn.obj
SLOFILES_X64=$(SLO_X64)$/zipfile.obj\
- $(SLO_X64)$/zipexcptn.obj
-
+ $(SLO_X64)$/zipexcptn.obj
+
# --- Targets ------------------------------------------------------
.INCLUDE : set_wntx64.mk
diff --git a/shell/source/all/zipfile/zipfile.cxx b/shell/source/all/zipfile/zipfile.cxx
index b174c7a023e3..06fb6cc934d3 100644
--- a/shell/source/all/zipfile/zipfile.cxx
+++ b/shell/source/all/zipfile/zipfile.cxx
@@ -79,6 +79,12 @@ bool ZipFile::IsZipFile(const std::string& /*FileName*/)
return true;
}
+bool ZipFile::IsZipFile(void* /*stream*/)
+{
+ return true;
+}
+
+
/** Returns wheter the version of the specified zip file may be uncompressed with the
currently used zlib version or not
@@ -99,6 +105,12 @@ bool ZipFile::IsValidZipFileVersionNumber(const std::string& /*FileName*/)
return true;
}
+bool ZipFile::IsValidZipFileVersionNumber(void* /* stream*/)
+{
+ return true;
+}
+
+
/** Constructs a zip file from a zip file
@precond The given parameter must be a string with length > 0
@@ -119,6 +131,16 @@ ZipFile::ZipFile(const std::string& FileName)
throw IOException(-1);
}
+ZipFile::ZipFile(void* stream, zlib_filefunc_def* fa)
+{
+ fa->opaque = stream;
+ m_uzFile = unzOpen2((const char *)NULL, fa);
+
+ if (0 == m_uzFile)
+ throw IOException(-1);
+}
+
+
/** Destroys a zip file
*/
ZipFile::~ZipFile()
diff --git a/shell/source/backends/kde4be/exports.map b/shell/source/backends/kde4be/exports.map
new file mode 100644
index 000000000000..ba501f9ae076
--- /dev/null
+++ b/shell/source/backends/kde4be/exports.map
@@ -0,0 +1,10 @@
+UDK_3_0_0 {
+ global:
+ GetVersionInfo;
+ component_getImplementationEnvironment;
+ component_getFactory;
+ component_writeInfo;
+
+ local:
+ *;
+};
diff --git a/shell/source/backends/kde4be/kde4backend.cxx b/shell/source/backends/kde4be/kde4backend.cxx
new file mode 100644
index 000000000000..7eb093bf7217
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4backend.cxx
@@ -0,0 +1,158 @@
+/*************************************************************************
+ *
+ * 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: kde4backend.cxx,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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_shell.hxx"
+
+#include "kde4backend.hxx"
+#include "kde4commonlayer.hxx"
+#include "kde4inetlayer.hxx"
+#include "kde4vcllayer.hxx"
+#include "kde4pathslayer.hxx"
+
+//------------------------------------------------------------------------------
+
+KDEBackend* KDEBackend::mInstance= 0;
+
+KDEBackend* KDEBackend::createInstance(const uno::Reference<uno::XComponentContext>& xContext)
+{
+ if (mInstance == 0)
+ {
+ mInstance = new KDEBackend (xContext);
+ }
+
+ return mInstance;
+}
+
+//------------------------------------------------------------------------------
+
+KDEBackend::KDEBackend(const uno::Reference<uno::XComponentContext>& xContext)
+ throw (backend::BackendAccessException)
+ : BackendBase(mMutex), m_xContext(xContext)
+{
+}
+
+//------------------------------------------------------------------------------
+
+KDEBackend::~KDEBackend(void)
+{
+}
+
+//------------------------------------------------------------------------------
+
+uno::Reference<backend::XLayer> SAL_CALL KDEBackend::getLayer(
+ const rtl::OUString& aComponent, const rtl::OUString& /* aTimestamp */)
+ throw (backend::BackendAccessException, lang::IllegalArgumentException)
+{
+ uno::Reference<backend::XLayer> xLayer;
+
+ if( aComponent.equalsAscii("org.openoffice.Office.Common" ) )
+ {
+ xLayer = new KDECommonLayer(m_xContext);
+ }
+ else if( aComponent.equalsAscii("org.openoffice.Inet" ) )
+ {
+ xLayer = new KDEInetLayer(m_xContext);
+ }
+ else if( aComponent.equalsAscii("org.openoffice.VCL" ) )
+ {
+ xLayer = new KDEVCLLayer(m_xContext);
+ }
+ else if( aComponent.equalsAscii("org.openoffice.Office.Paths" ) )
+ {
+ xLayer = new KDEPathsLayer(m_xContext);
+ }
+
+ return xLayer;
+}
+
+//------------------------------------------------------------------------------
+
+uno::Reference<backend::XUpdatableLayer> SAL_CALL
+KDEBackend::getUpdatableLayer(const rtl::OUString& /* aComponent */)
+ throw (backend::BackendAccessException,lang::NoSupportException,
+ lang::IllegalArgumentException)
+{
+ throw lang::NoSupportException( rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("KDEBackend: No Update Operation allowed, Read Only access") ),
+ *this) ;
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString SAL_CALL KDEBackend::getBackendName(void)
+{
+ return rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.configuration.backend.KDE4Backend") );
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString SAL_CALL KDEBackend::getImplementationName(void)
+ throw (uno::RuntimeException)
+{
+ return getBackendName() ;
+}
+
+//------------------------------------------------------------------------------
+
+uno::Sequence<rtl::OUString> SAL_CALL KDEBackend::getBackendServiceNames(void)
+{
+ uno::Sequence<rtl::OUString> aServices(1) ;
+ aServices[0] = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.KDE4Backend")) ;
+
+ return aServices ;
+}
+
+//------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL KDEBackend::supportsService(const rtl::OUString& aServiceName)
+ throw (uno::RuntimeException)
+{
+ uno::Sequence< rtl::OUString > const svc = getBackendServiceNames();
+
+ for(sal_Int32 i = 0; i < svc.getLength(); ++i )
+ if(svc[i] == aServiceName)
+ return true;
+
+ return false;
+}
+
+//------------------------------------------------------------------------------
+
+uno::Sequence<rtl::OUString>
+SAL_CALL KDEBackend::getSupportedServiceNames(void)
+ throw (uno::RuntimeException)
+{
+ return getBackendServiceNames() ;
+}
+
+// ---------------------------------------------------------------------------------------
diff --git a/shell/source/backends/kde4be/kde4backend.hxx b/shell/source/backends/kde4be/kde4backend.hxx
new file mode 100644
index 000000000000..01599c41a74d
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4backend.hxx
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * 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: kde4backend.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#pragma once
+
+#include <com/sun/star/configuration/backend/XSingleLayerStratum.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/configuration/InvalidBootstrapFileException.hpp>
+#include <com/sun/star/configuration/backend/CannotConnectException.hpp>
+#include <cppuhelper/compbase2.hxx>
+
+#ifndef INCLUDED_MAP
+#include <map>
+#define INCLUDED_MAP
+#endif
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+namespace lang = css::lang ;
+namespace backend = css::configuration::backend ;
+
+
+//------------------------------------------------------------------------------
+typedef cppu::WeakComponentImplHelper2<backend::XSingleLayerStratum,
+ lang::XServiceInfo> BackendBase ;
+
+/**
+ Implements the SingleLayerStratum service for KDE access.
+ */
+class KDEBackend : public BackendBase {
+ public :
+
+ static KDEBackend* createInstance(const uno::Reference<uno::XComponentContext>& xContext);
+
+ // XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName( )
+ throw (uno::RuntimeException) ;
+
+ virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& aServiceName )
+ throw (uno::RuntimeException) ;
+
+ virtual uno::Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames( )
+ throw (uno::RuntimeException) ;
+
+ /**
+ Provides the implementation name.
+
+ @return implementation name
+ */
+ static rtl::OUString SAL_CALL getBackendName(void) ;
+
+ /**
+ Provides the supported services names
+
+ @return service names
+ */
+ static uno::Sequence<rtl::OUString> SAL_CALL getBackendServiceNames(void) ;
+
+ //XSingleLayerStratum
+ virtual uno::Reference<backend::XLayer> SAL_CALL
+ getLayer( const rtl::OUString& aLayerId, const rtl::OUString& aTimestamp )
+ throw (backend::BackendAccessException, lang::IllegalArgumentException) ;
+
+ virtual uno::Reference<backend::XUpdatableLayer> SAL_CALL
+ getUpdatableLayer( const rtl::OUString& aLayerId )
+ throw (backend::BackendAccessException, lang::NoSupportException,
+ lang::IllegalArgumentException) ;
+
+ protected:
+ /**
+ Service constructor from a service factory.
+
+ @param xContext component context
+ */
+ KDEBackend(const uno::Reference<uno::XComponentContext>& xContext)
+ throw (backend::BackendAccessException);
+
+ /** Destructor */
+ ~KDEBackend(void) ;
+
+ private:
+
+ /** Build KDE/OO mapping table */
+ void initializeMappingTable ();
+
+
+ /** The component context */
+ uno::Reference<uno::XComponentContext> m_xContext;
+
+ /** Mutex for reOOurces protection */
+ osl::Mutex mMutex ;
+
+ static KDEBackend* mInstance;
+};
diff --git a/shell/source/backends/kde4be/kde4be.xml b/shell/source/backends/kde4be/kde4be.xml
new file mode 100644
index 000000000000..ea2d9be6dd6b
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4be.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd">
+<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
+ <module-name>kde4be</module-name>
+ <component-description>
+ <author> Éric Bischoff </author>
+ <name>com.sun.star.comp.configuration.backend.KDE4Backend</name>
+ <description> The KDE4 configuration backend </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.comp.configuration.backend.KDE4Backend</supported-service>
+ <service-dependency>...</service-dependency>
+ <type>com.sun.star.configuration.backend.XBackendChangesListener</type>
+ <type>com.sun.star.configuration.backend.XBackendChangesNotifier</type>
+ <type>com.sun.star.configuration.backend.XLayerHandler</type>
+ <type>com.sun.star.configuration.backend.XSingleLayerStratum</type>
+ <type>com.sun.star.lang.XMultiComponentFactory</type>
+ <type>com.sun.star.lang.XServiceInfo</type>
+ <type>com.sun.star.lang.XSingleComponentFactory</type>
+ <type>com.sun.star.lang.XTypeProvider</type>
+ <type>com.sun.star.uno.TypeClass</type>
+ <type>com.sun.star.uno.XAggregation</type>
+ <type>com.sun.star.uno.XComponentContext</type>
+ <type>com.sun.star.uno.XCurrentContext</type>
+ <type>com.sun.star.uno.XWeak</type>
+ <type>com.sun.star.registry.XRegistryKey</type>
+ </component-description>
+ <project-build-dependency>cppuhelper</project-build-dependency>
+ <project-build-dependency>cppu</project-build-dependency>
+ <project-build-dependency>sal</project-build-dependency>
+ <runtime-module-dependency>cppuhelper3$(COM)</runtime-module-dependency>
+ <runtime-module-dependency>cppu3</runtime-module-dependency>
+ <runtime-module-dependency>sal3</runtime-module-dependency>
+</module-description>
diff --git a/shell/source/backends/kde4be/kde4be1-ucd.txt b/shell/source/backends/kde4be/kde4be1-ucd.txt
new file mode 100644
index 000000000000..9671199b26e3
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4be1-ucd.txt
@@ -0,0 +1,6 @@
+[ComponentDescriptor]
+ImplementationName=com.sun.star.comp.configuration.backend.KDE4Backend
+ComponentName=kde4be1.uno.so
+LoaderName=com.sun.star.loader.SharedLibrary
+[SupportedServices]
+com.sun.star.configuration.backend.KDE4Backend
diff --git a/shell/source/backends/kde4be/kde4becdef.cxx b/shell/source/backends/kde4be/kde4becdef.cxx
new file mode 100644
index 000000000000..da0d22ead22e
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4becdef.cxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * 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: kde4becdef.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_shell.hxx"
+#include "kde4backend.hxx"
+
+#include <kapplication.h>
+
+#include <cppuhelper/implementationentry.hxx>
+
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include "uno/current_context.hxx"
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+namespace lang = css::lang ;
+namespace backend = css::configuration::backend ;
+
+//==============================================================================
+
+static uno::Reference<uno::XInterface> SAL_CALL createKDEBackend(const uno::Reference<uno::XComponentContext>& xContext)
+{
+ try {
+ uno::Reference< uno::XCurrentContext > xCurrentContext(uno::getCurrentContext());
+
+ if (xCurrentContext.is())
+ {
+ uno::Any aValue = xCurrentContext->getValueByName(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "system.desktop-environment" ) ) );
+
+ rtl::OUString aDesktopEnvironment;
+ if ( (aValue >>= aDesktopEnvironment) && (aDesktopEnvironment.equalsAscii("KDE")) && (KApplication::kApplication() != NULL) )
+ return * KDEBackend::createInstance(xContext);
+ }
+
+ return uno::Reference<uno::XInterface>();
+
+ } catch (uno::RuntimeException e) {
+ return uno::Reference<uno::XInterface>();
+ }
+
+}
+
+//==============================================================================
+
+static const cppu::ImplementationEntry kImplementations_entries[] =
+{
+ {
+ createKDEBackend,
+ KDEBackend::getBackendName,
+ KDEBackend::getBackendServiceNames,
+ cppu::createSingleComponentFactory,
+ NULL,
+ 0
+ },
+ { NULL, NULL, NULL, NULL, NULL, 0 }
+} ;
+//------------------------------------------------------------------------------
+
+extern "C" void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char **aEnvTypeName,
+ uno_Environment **) {
+ *aEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ;
+}
+
+//------------------------------------------------------------------------------
+
+extern "C" sal_Bool SAL_CALL component_writeInfo(void *,
+ void *pRegistryKey) {
+
+ using namespace ::com::sun::star::registry;
+ if (pRegistryKey)
+ {
+ try
+ {
+ uno::Reference< XRegistryKey > xImplKey = static_cast< XRegistryKey* >( pRegistryKey )->createKey(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + KDEBackend::getBackendName()
+ );
+
+ // Register associated service names
+ uno::Reference< XRegistryKey > xServicesKey = xImplKey->createKey(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES") )
+ );
+
+ uno::Sequence<rtl::OUString> sServiceNames = KDEBackend::getBackendServiceNames();
+ for (sal_Int32 i = 0 ; i < sServiceNames.getLength() ; ++ i)
+ xServicesKey->createKey(sServiceNames[i]);
+
+ return sal_True;
+ }
+
+ catch( InvalidRegistryException& )
+ {
+ OSL_ENSURE(sal_False, "InvalidRegistryException caught");
+ }
+ }
+
+ return sal_False;
+}
+
+//------------------------------------------------------------------------------
+
+extern "C" void *component_getFactory(const sal_Char *aImplementationName,
+ void *aServiceManager,
+ void *aRegistryKey) {
+
+ return cppu::component_getFactoryHelper(
+ aImplementationName,
+ aServiceManager,
+ aRegistryKey,
+ kImplementations_entries) ;
+}
+//------------------------------------------------------------------------------
diff --git a/shell/source/backends/kde4be/kde4commonlayer.cxx b/shell/source/backends/kde4be/kde4commonlayer.cxx
new file mode 100644
index 000000000000..1ce844672225
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4commonlayer.cxx
@@ -0,0 +1,157 @@
+/*************************************************************************
+ *
+ * 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: kde4commonlayer.cxx,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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_shell.hxx"
+
+#include "kde4commonlayer.hxx"
+
+#include <kemailsettings.h>
+#include <kglobalsettings.h>
+
+#include <QFont>
+
+#include <com/sun/star/configuration/backend/PropertyInfo.hpp>
+#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#define SPACE ' '
+
+//==============================================================================
+
+KDECommonLayer::KDECommonLayer(const uno::Reference<uno::XComponentContext>& xContext)
+{
+ //Create instance of LayerContentDescriber Service
+ rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.configuration.backend.LayerDescriber"));
+
+ typedef uno::Reference<backend::XLayerContentDescriber> LayerDescriber;
+ uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager();
+ if( xServiceManager.is() )
+ {
+ m_xLayerContentDescriber = LayerDescriber::query(
+ xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext));
+ }
+ else
+ {
+ OSL_TRACE("Could not retrieve ServiceManager");
+ }
+}
+
+//------------------------------------------------------------------------------
+
+void SAL_CALL KDECommonLayer::readData( const uno::Reference<backend::XLayerHandler>& xHandler)
+ throw ( backend::MalformedDataException, lang::NullPointerException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( ! m_xLayerContentDescriber.is() )
+ {
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Could not create com.sun.star.configuration.backend.LayerContentDescriber Service"
+ ) ), static_cast < backend::XLayer * > (this) );
+ }
+
+ uno::Sequence<backend::PropertyInfo> aPropInfoList(3);
+ sal_Int32 nProperties = 0;
+
+ // Email client settings
+ KEMailSettings aEmailSettings;
+ QString aClientProgram;
+ ::rtl::OUString sClientProgram;
+
+ aClientProgram = aEmailSettings.getSetting( KEMailSettings::ClientProgram );
+ if ( aClientProgram.isEmpty() )
+ aClientProgram = "kmail";
+ else
+ aClientProgram = aClientProgram.section(SPACE, 0, 0);
+ sClientProgram = (const sal_Unicode *) aClientProgram.utf16();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Common/ExternalMailer/Program") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "string" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( sClientProgram );
+
+ // Source code font settings
+ QFont aFixedFont;
+ QString aFontName;
+ :: rtl::OUString sFontName;
+ short nFontHeight;
+
+ aFixedFont = KGlobalSettings::fixedFont();
+ aFontName = aFixedFont.family();
+ sFontName = (const sal_Unicode *) aFontName.utf16();
+ nFontHeight = aFixedFont.pointSize();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Common/Font/SourceViewFont/FontName") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "string" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( sFontName );
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Common/Font/SourceViewFont/FontHeight") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "short" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( nFontHeight );
+
+ if( nProperties > 0 )
+ {
+ aPropInfoList.realloc(nProperties);
+ m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList);
+ }
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString SAL_CALL KDECommonLayer::getTimestamp(void)
+ throw (uno::RuntimeException)
+{
+ // Return the value as timestamp to avoid regenerating the binary cache
+ // on each office launch.
+
+ KEMailSettings aEmailSettings;
+ QString aClientProgram = aEmailSettings.getSetting( KEMailSettings::ClientProgram );
+ aClientProgram = aClientProgram.section(SPACE, 0, 0);
+
+ QString aFixedFont = KGlobalSettings::fixedFont().toString();
+
+ ::rtl::OUString sTimeStamp,
+ sep( RTL_CONSTASCII_USTRINGPARAM( "$" ) );
+
+ sTimeStamp = (const sal_Unicode *) aClientProgram.utf16();
+ sTimeStamp += sep;
+ sTimeStamp += (const sal_Unicode *) aFixedFont.utf16();
+
+ return sTimeStamp;
+}
diff --git a/shell/source/backends/kde4be/kde4commonlayer.hxx b/shell/source/backends/kde4be/kde4commonlayer.hxx
new file mode 100644
index 000000000000..9ce4cd4dc962
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4commonlayer.hxx
@@ -0,0 +1,51 @@
+#pragma once
+
+#include "kde4backend.hxx"
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/configuration/backend/XLayer.hpp>
+#include <com/sun/star/configuration/backend/BackendAccessException.hpp>
+#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
+#include <com/sun/star/util/XTimeStamped.hpp>
+#include <cppuhelper/implbase2.hxx>
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+namespace lang = css::lang ;
+namespace backend = css::configuration::backend ;
+namespace util = css::util ;
+
+/**
+ Implementation of the XLayer interface for the KDE values mapped into
+ the org.openoffice.Office.Common configuration component.
+ */
+class KDECommonLayer : public cppu::WeakImplHelper2<backend::XLayer, util::XTimeStamped>
+{
+public :
+ /**
+ Constructor given the component context
+
+ @param xContext The component context
+ */
+
+ KDECommonLayer(const uno::Reference<uno::XComponentContext>& xContext);
+
+ // XLayer
+ virtual void SAL_CALL readData(
+ const uno::Reference<backend::XLayerHandler>& xHandler)
+ throw ( backend::MalformedDataException,
+ lang::NullPointerException,
+ lang::WrappedTargetException,
+ uno::RuntimeException) ;
+
+ // XTimeStamped
+ virtual rtl::OUString SAL_CALL getTimestamp(void)
+ throw (uno::RuntimeException);
+
+ protected:
+
+ /** Destructor */
+ ~KDECommonLayer(void) {}
+
+ private :
+ uno::Reference<backend::XLayerContentDescriber> m_xLayerContentDescriber ;
+};
diff --git a/shell/source/backends/kde4be/kde4inetlayer.cxx b/shell/source/backends/kde4be/kde4inetlayer.cxx
new file mode 100644
index 000000000000..bc661a093fb7
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4inetlayer.cxx
@@ -0,0 +1,255 @@
+/*************************************************************************
+ *
+ * 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: kde4inetlayer.cxx,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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_shell.hxx"
+
+#include <kprotocolmanager.h>
+
+#include "kde4inetlayer.hxx"
+#include <com/sun/star/configuration/backend/PropertyInfo.hpp>
+#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#define COMMA ','
+#define SEMI_COLON ';'
+
+//==============================================================================
+
+KDEInetLayer::KDEInetLayer(const uno::Reference<uno::XComponentContext>& xContext)
+{
+ //Create instance of LayerContentDescriber Service
+ rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.configuration.backend.LayerDescriber"));
+
+ typedef uno::Reference<backend::XLayerContentDescriber> LayerDescriber;
+ uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager();
+ if( xServiceManager.is() )
+ {
+ m_xLayerContentDescriber = LayerDescriber::query(
+ xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext));
+ }
+ else
+ {
+ OSL_TRACE("Could not retrieve ServiceManager");
+ }
+}
+
+//------------------------------------------------------------------------------
+
+void SAL_CALL KDEInetLayer::readData( const uno::Reference<backend::XLayerHandler>& xHandler)
+ throw ( backend::MalformedDataException, lang::NullPointerException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( ! m_xLayerContentDescriber.is() )
+ {
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Could not create com.sun.star.configuration.backend.LayerContentDescriber Service"
+ ) ), static_cast < backend::XLayer * > (this) );
+ }
+
+ uno::Sequence<backend::PropertyInfo> aPropInfoList(8);
+ sal_Int32 nProperties = 0;
+
+ switch ( KProtocolManager::proxyType() )
+ {
+ case KProtocolManager::ManualProxy: // Proxies are manually configured
+ setProxy(aPropInfoList, nProperties, 1,
+ KProtocolManager::noProxyFor(),
+ KProtocolManager::proxyFor( "HTTP" ),
+ KProtocolManager::proxyFor( "FTP" ),
+ KProtocolManager::proxyFor( "HTTPS" ));
+ break;
+ case KProtocolManager::PACProxy: // A proxy configuration URL has been given
+ case KProtocolManager::WPADProxy: // A proxy should be automatically discovered
+ case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
+// In such cases, the proxy address is not stored in KDE, but determined dynamically.
+// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind...
+// The best we can do here is to ask the current value for a given address.
+ setProxy(aPropInfoList, nProperties, 1,
+ KProtocolManager::noProxyFor(),
+ KProtocolManager::proxyForUrl( KUrl("http://www.openoffice.org") ),
+ KProtocolManager::proxyForUrl( KUrl("ftp://ftp.openoffice.org") ),
+ KProtocolManager::proxyForUrl( KUrl("https://www.openoffice.org") ));
+ break;
+ default: // No proxy is used
+ setProxy(aPropInfoList, nProperties, 0);
+ }
+
+ if ( nProperties > 0 )
+ {
+ aPropInfoList.realloc(nProperties);
+ m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList);
+ }
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString SAL_CALL KDEInetLayer::getTimestamp(void)
+ throw (uno::RuntimeException)
+{
+ // Return the value as timestamp to avoid regenerating the binary cache
+ // on each office launch.
+
+ QString aProxyType, aNoProxyFor, aHTTPProxy, aHTTPSProxy, aFTPProxy;
+
+ switch ( KProtocolManager::proxyType() )
+ {
+ case KProtocolManager::ManualProxy:
+ aProxyType = '1';
+ aNoProxyFor = KProtocolManager::noProxyFor();
+ aHTTPProxy = KProtocolManager::proxyFor( "HTTP" );
+ aHTTPProxy = KProtocolManager::proxyFor( "HTTPS" );
+ aFTPProxy = KProtocolManager::proxyFor( "FTP" );
+ break;
+ case KProtocolManager::PACProxy:
+ case KProtocolManager::WPADProxy:
+ case KProtocolManager::EnvVarProxy:
+ aProxyType = '1';
+ aNoProxyFor = KProtocolManager::noProxyFor();
+ aHTTPProxy = KProtocolManager::proxyForUrl( KUrl("http://www.openoffice.org") );
+ aHTTPSProxy = KProtocolManager::proxyForUrl( KUrl("https://www.openoffice.org") );
+ aFTPProxy = KProtocolManager::proxyForUrl( KUrl("ftp://ftp.openoffice.org") );
+ break;
+ default:
+ aProxyType = '0';
+ }
+
+ ::rtl::OUString sTimeStamp,
+ sep( RTL_CONSTASCII_USTRINGPARAM( "$" ) );
+
+ sTimeStamp = (const sal_Unicode *) aProxyType.utf16();
+ sTimeStamp += sep;
+ sTimeStamp += (const sal_Unicode *) aNoProxyFor.utf16();
+ sTimeStamp += sep;
+ sTimeStamp += (const sal_Unicode *) aHTTPProxy.utf16();
+ sTimeStamp += sep;
+ sTimeStamp += (const sal_Unicode *) aHTTPSProxy.utf16();
+ sTimeStamp += sep;
+ sTimeStamp += (const sal_Unicode *) aFTPProxy.utf16();
+
+ return sTimeStamp;
+}
+
+//------------------------------------------------------------------------------
+
+void SAL_CALL KDEInetLayer::setProxy
+ (uno::Sequence<backend::PropertyInfo> &aPropInfoList, sal_Int32 &nProperties,
+ int nProxyType, const QString &aNoProxy, const QString &aHTTPProxy, const QString &aFTPProxy, const QString &aHTTPSProxy ) const
+{
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetProxyType") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "int" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( (sal_Int32) nProxyType );
+
+ if (nProxyType == 0) return;
+
+ if ( !aNoProxy.isEmpty() )
+ {
+ QString aNoProxyFor(aNoProxy);
+ ::rtl::OUString sNoProxyFor;
+
+ aNoProxyFor = aNoProxyFor.replace( COMMA, SEMI_COLON );
+ sNoProxyFor = (const sal_Unicode *) aNoProxyFor.utf16();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetNoProxy") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "string" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( sNoProxyFor );
+ }
+
+ if ( !aHTTPProxy.isEmpty() )
+ {
+ KUrl aProxy(aHTTPProxy);
+ ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16();
+ sal_Int32 nPort = aProxy.port();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPProxyName") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "string" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( sProxy );
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPProxyPort") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "int" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( nPort );
+ }
+
+ if ( !aHTTPSProxy.isEmpty() )
+ {
+ KUrl aProxy(aHTTPSProxy);
+ ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16();
+ sal_Int32 nPort = aProxy.port();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPSProxyName") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "string" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( sProxy );
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPSProxyPort") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "int" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( nPort );
+ }
+
+ if ( !aFTPProxy.isEmpty() )
+ {
+ KUrl aProxy(aFTPProxy);
+ ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16();
+ sal_Int32 nPort = aProxy.port();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetFTPProxyName") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "string" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( sProxy );
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetFTPProxyPort") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "int" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( nPort );
+ }
+}
+
diff --git a/shell/source/backends/kde4be/kde4inetlayer.hxx b/shell/source/backends/kde4be/kde4inetlayer.hxx
new file mode 100644
index 000000000000..64d00fec45fc
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4inetlayer.hxx
@@ -0,0 +1,59 @@
+#pragma once
+
+#include <QString>
+
+#include "kde4backend.hxx"
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/configuration/backend/XLayer.hpp>
+#include <com/sun/star/configuration/backend/BackendAccessException.hpp>
+#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
+#include <com/sun/star/util/XTimeStamped.hpp>
+#include <cppuhelper/implbase2.hxx>
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+namespace lang = css::lang ;
+namespace backend = css::configuration::backend ;
+namespace util = css::util ;
+
+/**
+ Implementation of the XLayer interface for the KDE values mapped into
+ the org.openoffice.Inet configuration component.
+ */
+class KDEInetLayer : public cppu::WeakImplHelper2<backend::XLayer, util::XTimeStamped>
+{
+public :
+ /**
+ Constructor given the component context
+
+ @param xContext The component context
+ */
+
+ KDEInetLayer(const uno::Reference<uno::XComponentContext>& xContext);
+
+ // XLayer
+ virtual void SAL_CALL readData(
+ const uno::Reference<backend::XLayerHandler>& xHandler)
+ throw ( backend::MalformedDataException,
+ lang::NullPointerException,
+ lang::WrappedTargetException,
+ uno::RuntimeException) ;
+
+ // XTimeStamped
+ virtual rtl::OUString SAL_CALL getTimestamp(void)
+ throw (uno::RuntimeException);
+
+ protected:
+
+ /** Destructor */
+ ~KDEInetLayer(void) {}
+
+private :
+ uno::Reference<backend::XLayerContentDescriber> m_xLayerContentDescriber ;
+
+ void SAL_CALL setProxy
+ (uno::Sequence<backend::PropertyInfo> &aPropInfoList, sal_Int32 &nProperties,
+ int nProxyType, const QString &aNoProxyfor = QString(),
+ const QString &aHTTPProxy = QString(), const QString &aFTPProxy = QString(), const QString &aHTTPSProxy = QString()) const;
+};
diff --git a/shell/source/backends/kde4be/kde4pathslayer.cxx b/shell/source/backends/kde4be/kde4pathslayer.cxx
new file mode 100644
index 000000000000..2511d0b57405
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4pathslayer.cxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * 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: kde4pathslayer.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * 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_shell.hxx"
+
+#include "kde4pathslayer.hxx"
+
+#include <QString>
+#include <kglobalsettings.h>
+
+#include <com/sun/star/configuration/backend/PropertyInfo.hpp>
+#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
+
+#include <osl/security.hxx>
+#include <osl/file.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#define SPACE ' '
+
+//==============================================================================
+
+KDEPathsLayer::KDEPathsLayer(const uno::Reference<uno::XComponentContext>& xContext)
+{
+ //Create instance of LayerContentDescriber Service
+ rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.configuration.backend.LayerDescriber"));
+
+ typedef uno::Reference<backend::XLayerContentDescriber> LayerDescriber;
+ uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager();
+ if( xServiceManager.is() )
+ {
+ m_xLayerContentDescriber = LayerDescriber::query(
+ xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext));
+ }
+ else
+ {
+ OSL_TRACE("Could not retrieve ServiceManager");
+ }
+}
+
+//------------------------------------------------------------------------------
+
+void SAL_CALL KDEPathsLayer::readData( const uno::Reference<backend::XLayerHandler>& xHandler)
+ throw ( backend::MalformedDataException, lang::NullPointerException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( ! m_xLayerContentDescriber.is() )
+ {
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Could not create com.sun.star.configuration.backend.LayerContentDescriber Service"
+ ) ), static_cast < backend::XLayer * > (this) );
+ }
+
+ uno::Sequence<backend::PropertyInfo> aPropInfoList(1);
+ sal_Int32 nProperties = 0;
+
+ QString aDocumentsDir( KGlobalSettings::documentPath() );
+ rtl::OUString sDocumentsDir;
+ rtl::OUString sDocumentsURL;
+ if ( aDocumentsDir.endsWith(QChar('/')) )
+ aDocumentsDir.truncate ( aDocumentsDir.length() - 1 );
+ sDocumentsDir = (const sal_Unicode *) aDocumentsDir.utf16();
+ osl_getFileURLFromSystemPath( sDocumentsDir.pData, &sDocumentsURL.pData );
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Paths/Variables/Work") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "string" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( sDocumentsURL );
+
+ if( nProperties > 0 )
+ {
+ aPropInfoList.realloc(nProperties);
+ m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList);
+ }
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString SAL_CALL KDEPathsLayer::getTimestamp(void)
+ throw (uno::RuntimeException)
+{
+ // Return the value as timestamp to avoid regenerating the binary cache
+ // on each office launch.
+
+ ::rtl::OUString sTimeStamp,
+ sep( RTL_CONSTASCII_USTRINGPARAM( "$" ) );
+
+ QString aDocumentsDir;
+ aDocumentsDir = KGlobalSettings::documentPath();
+
+ sTimeStamp += (const sal_Unicode *) aDocumentsDir.utf16();
+
+ return sTimeStamp;
+}
diff --git a/shell/source/backends/kde4be/kde4pathslayer.hxx b/shell/source/backends/kde4be/kde4pathslayer.hxx
new file mode 100644
index 000000000000..40d31a73c4f9
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4pathslayer.hxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * 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: kde4pathslayer.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.
+ *
+ ************************************************************************/
+
+#pragma once
+
+#include "kde4backend.hxx"
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/configuration/backend/XLayer.hpp>
+#include <com/sun/star/configuration/backend/BackendAccessException.hpp>
+#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
+#include <com/sun/star/util/XTimeStamped.hpp>
+
+#include <cppuhelper/implbase2.hxx>
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+namespace lang = css::lang ;
+namespace backend = css::configuration::backend ;
+namespace util = css::util ;
+
+/**
+ Implementation of the XLayer interface for the KDE values mapped into
+ the org.openoffice.Office.Paths configuration component.
+ */
+class KDEPathsLayer : public cppu::WeakImplHelper2<backend::XLayer, util::XTimeStamped>
+{
+public :
+ /**
+ Constructor given the component context
+
+ @param xContext The component context
+ */
+
+ KDEPathsLayer(const uno::Reference<uno::XComponentContext>& xContext);
+
+ // XLayer
+ virtual void SAL_CALL readData(
+ const uno::Reference<backend::XLayerHandler>& xHandler)
+ throw ( backend::MalformedDataException,
+ lang::NullPointerException,
+ lang::WrappedTargetException,
+ uno::RuntimeException) ;
+
+ // XTimeStamped
+ virtual rtl::OUString SAL_CALL getTimestamp(void)
+ throw (uno::RuntimeException);
+
+ protected:
+
+ /** Destructor */
+ ~KDEPathsLayer(void) {}
+
+ private :
+ uno::Reference<backend::XLayerContentDescriber> m_xLayerContentDescriber ;
+};
diff --git a/shell/source/backends/kde4be/kde4vcllayer.cxx b/shell/source/backends/kde4be/kde4vcllayer.cxx
new file mode 100644
index 000000000000..780c3e4e7ce1
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4vcllayer.cxx
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * 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: kde4vcllayer.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * 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_shell.hxx"
+
+#include "kde4vcllayer.hxx"
+
+#include <com/sun/star/configuration/backend/PropertyInfo.hpp>
+#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+//==============================================================================
+
+KDEVCLLayer::KDEVCLLayer(const uno::Reference<uno::XComponentContext>& xContext)
+{
+ //Create instance of LayerContentDescriber Service
+ rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.configuration.backend.LayerDescriber"));
+
+ typedef uno::Reference<backend::XLayerContentDescriber> LayerDescriber;
+ uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager();
+ if( xServiceManager.is() )
+ {
+ m_xLayerContentDescriber = LayerDescriber::query(
+ xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext));
+ }
+ else
+ {
+ OSL_TRACE("Could not retrieve ServiceManager");
+ }
+}
+
+//------------------------------------------------------------------------------
+
+void SAL_CALL KDEVCLLayer::readData( const uno::Reference<backend::XLayerHandler>& xHandler)
+ throw ( backend::MalformedDataException, lang::NullPointerException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( ! m_xLayerContentDescriber.is() )
+ {
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Could not create com.sun.star.configuration.backend.LayerContentDescriber Service"
+ ) ), static_cast < backend::XLayer * > (this) );
+ }
+
+ uno::Sequence<backend::PropertyInfo> aPropInfoList(1);
+
+/*
+ Commenting out, does not make much sense without an accessibility bridge
+===========================================================================
+#if defined(QT_ACCESSIBILITY_SUPPORT)
+// Accessibility tools under Qt for UNIX are available starting with Qt 4.0
+ int nVersionMajor = 0;
+ const char *q = qVersion(); // "3.1.0" for example
+ while ('0' <= *q && *q <= '9')
+ nVersionMajor = nVersionMajor * 10 + *q++ - '0';
+ sal_Bool ATToolSupport = (sal_Bool) (nVersionMajor >= 4);
+#else
+ sal_Bool ATToolSupport = sal_False;
+#endif
+===========================================================================
+ End of commented out section
+*/ sal_Bool ATToolSupport = sal_False;
+
+ aPropInfoList[0].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.VCL/Settings/Accessibility/EnableATToolSupport") );
+ aPropInfoList[0].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "string" ) );
+ aPropInfoList[0].Protected = sal_False;
+ aPropInfoList[0].Value = uno::makeAny( rtl::OUString::valueOf( ATToolSupport ) );
+
+ m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList);
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString SAL_CALL KDEVCLLayer::getTimestamp(void)
+ throw (uno::RuntimeException)
+{
+ // Return the value as timestamp to avoid regenerating the binary cache
+ // on each office launch.
+
+ ::rtl::OUString sTimeStamp(
+ RTL_CONSTASCII_USTRINGPARAM( "FALSE" ) );
+
+ return sTimeStamp;
+}
diff --git a/shell/source/backends/kde4be/kde4vcllayer.hxx b/shell/source/backends/kde4be/kde4vcllayer.hxx
new file mode 100644
index 000000000000..16036ee89122
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4vcllayer.hxx
@@ -0,0 +1,53 @@
+#pragma once
+
+#include "kde4backend.hxx"
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/configuration/backend/XLayer.hpp>
+#include <com/sun/star/configuration/backend/BackendAccessException.hpp>
+#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
+#include <com/sun/star/util/XTimeStamped.hpp>
+
+#include <cppuhelper/implbase2.hxx>
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+namespace lang = css::lang ;
+namespace backend = css::configuration::backend ;
+namespace util = css::util ;
+
+/**
+ Implementation of the XLayer interface for the KDE values mapped into
+ the org.openoffice.VCL configuration component.
+ */
+class KDEVCLLayer : public cppu::WeakImplHelper2<backend::XLayer, util::XTimeStamped>
+{
+public :
+ /**
+ Constructor given the component context
+
+ @param xContext The component context
+ */
+
+ KDEVCLLayer(const uno::Reference<uno::XComponentContext>& xContext);
+
+ // XLayer
+ virtual void SAL_CALL readData(
+ const uno::Reference<backend::XLayerHandler>& xHandler)
+ throw ( backend::MalformedDataException,
+ lang::NullPointerException,
+ lang::WrappedTargetException,
+ uno::RuntimeException) ;
+
+ // XTimeStamped
+ virtual rtl::OUString SAL_CALL getTimestamp(void)
+ throw (uno::RuntimeException);
+
+ protected:
+
+ /** Destructor */
+ ~KDEVCLLayer(void) {}
+
+ private :
+ uno::Reference<backend::XLayerContentDescriber> m_xLayerContentDescriber ;
+};
diff --git a/shell/source/backends/kde4be/makefile.mk b/shell/source/backends/kde4be/makefile.mk
new file mode 100644
index 000000000000..6f92762e5ae1
--- /dev/null
+++ b/shell/source/backends/kde4be/makefile.mk
@@ -0,0 +1,94 @@
+#*************************************************************************
+#
+# 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.5 $
+#
+# 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=shell
+TARGET=kde4be
+
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+
+COMP1TYPELIST=$(TARGET)
+COMPRDB=$(SOLARBINDIR)$/types.rdb
+UNOUCROUT=$(OUT)$/inc$/$(TARGET)
+INCPRE=$(UNOUCROUT)
+
+# --- Settings ---
+
+.INCLUDE : settings.mk
+
+# For some of the included external KDE headers, GCC complains about shadowed
+# symbols in instantiated template code only at the end of a compilation unit,
+# so the only solution is to disable that warning here:
+.IF "$(COM)" == "GCC"
+CFLAGSCXX+=-Wno-shadow
+.ENDIF
+
+UNIXTEXT=$(MISC)/$(TARGET)1-ucd.txt
+
+# no "lib" prefix
+DLLPRE =
+
+.IF "$(ENABLE_KDE4)" == "TRUE"
+
+CFLAGS+=$(KDE4_CFLAGS)
+
+# --- Files ---
+
+SLOFILES=\
+ $(SLO)$/kde4backend.obj \
+ $(SLO)$/kde4commonlayer.obj \
+ $(SLO)$/kde4inetlayer.obj \
+ $(SLO)$/kde4vcllayer.obj \
+ $(SLO)$/kde4pathslayer.obj \
+ $(SLO)$/kde4becdef.obj
+
+SHL1NOCHECK=TRUE
+SHL1TARGET=$(TARGET)1.uno
+SHL1OBJS=$(SLOFILES)
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+
+SHL1IMPLIB=i$(SHL1TARGET)
+SHL1STDLIBS= \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB) \
+ $(KDE4_LIBS) -lkio
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+
+.ENDIF
+
+# --- Targets ---
+
+.INCLUDE : target.mk
diff --git a/shell/source/win32/shlxthandler/ooofilt/makefile.mk b/shell/source/win32/shlxthandler/ooofilt/makefile.mk
index 74ecf35ac5fc..22127bc8ddac 100644
--- a/shell/source/win32/shlxthandler/ooofilt/makefile.mk
+++ b/shell/source/win32/shlxthandler/ooofilt/makefile.mk
@@ -36,6 +36,13 @@ LIBTARGET=NO
ENABLE_EXCEPTIONS=TRUE
USE_DEFFILE=TRUE
+# Do not use the dynamic STLport library.
+# NO_DEFAULT_STL=YES
+
+# Do not use the uwinapi library
+UWINAPILIB=
+
+
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
@@ -43,11 +50,10 @@ USE_DEFFILE=TRUE
CFLAGS+=-DISOLATION_AWARE_ENABLED -DWIN32_LEAN_AND_MEAN -DXML_UNICODE -D_NTSDK -DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0501
CFLAGS+=-wd4710 -wd4711 -wd4514 -wd4619 -wd4217 -wd4820
CDEFS+=-D_WIN32_IE=0x501
+# SCPCDEFS+=-D_STLP_USE_STATIC_LIB
# --- Files --------------------------------------------------------
-#UWINAPILIB=
-
SLOFILES=$(SLO)$/ooofilt.obj\
$(SLO)$/propspec.obj
@@ -71,10 +77,12 @@ SHL1STDLIBS+=$(OLE32LIB)\
$(SHELL32LIB)\
$(KERNEL32LIB)\
$(OLDNAMESLIB)
-
+
+# $(LIBSTLPORTST)
+
SHL1LIBS+=$(SLB)$/util.lib\
$(SLB)$/ooofilereader.lib
-
+
SHL1DEPN=
SHL1OBJS=$(SLOFILES)
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
diff --git a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
index e22fb89f94cf..ac8dd676c3b1 100644
--- a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
+++ b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
@@ -46,7 +46,7 @@
//--------------------------------------------------------------------------
#include "internal/contentreader.hxx"
#include "internal/metainforeader.hxx"
-#include "internal/utilities.hxx"
+//#include "internal/utilities.hxx"
#include "internal/registry.hxx"
#include "internal/fileextensions.hxx"
@@ -78,6 +78,8 @@
#include <ntquery.h>
#include "assert.h"
#include "ooofilt.hxx"
+#include <objidl.h>
+#include <stdio.h>
#include "propspec.hxx"
#ifdef __MINGW32__
#include <algorithm>
@@ -117,7 +119,9 @@ COooFilter::COooFilter() :
m_fEof(FALSE),
m_ChunkPosition(0),
m_cAttributes(0),
- m_pAttributes(0)
+ m_pAttributes(0),
+ m_pStream(NULL)
+
{
InterlockedIncrement( &g_lInstances );
}
@@ -172,6 +176,8 @@ SCODE STDMETHODCALLTYPE COooFilter::QueryInterface(
pUnkTemp = (IUnknown *)(IPersistFile *)this;
else if ( IID_IPersist == riid )
pUnkTemp = (IUnknown *)(IPersist *)(IPersistFile *)this;
+ else if (IID_IPersistStream == riid)
+ pUnkTemp = (IUnknown *)(IPersistStream *)this;
else if ( IID_IUnknown == riid )
pUnkTemp = (IUnknown *)(IPersist *)(IPersistFile *)this;
else
@@ -713,6 +719,101 @@ SCODE STDMETHODCALLTYPE COooFilter::SaveCompleted(LPCWSTR /*pszFileName*/)
// File is opened read-only, so "save" is always finished
return S_OK;
}
+
+//M-------------------------------------------------------------------------
+//
+// Method: COooFilter::Load (IPersistStream::Load)
+//
+// Summary: Initializes an object from the stream where it was previously saved
+//
+// Arguments: pStm
+// [in] Pointer to stream from which object should be loaded
+//
+//
+// Returns: S_OK
+// E_OUTOFMEMORY
+// E_FAIL
+//
+//
+//--------------------------------------------------------------------------
+SCODE STDMETHODCALLTYPE COooFilter::Load(IStream *pStm)
+{
+
+ // These next few lines work around the "Seek pointer" bug found on Vista.
+
+ char buf[20];
+ unsigned long count;
+ HRESULT hr;
+ ULARGE_INTEGER NewPosition;
+ LARGE_INTEGER Move;
+ Move.QuadPart = 0;
+ hr = pStm->Seek (Move, STREAM_SEEK_SET, &NewPosition);
+ hr = pStm->Read (buf, 20, &count);
+
+ zlib_filefunc_def z_filefunc;
+ fill_stream_filefunc (&z_filefunc);
+ z_filefunc.opaque = (void*)pStm;
+
+ m_pStream = pStm;
+
+ try
+ {
+ if (m_pMetaInfoReader)
+ delete m_pMetaInfoReader;
+ m_pMetaInfoReader = new CMetaInfoReader((void*)m_pStream, &z_filefunc);
+
+ if (m_pContentReader)
+ delete m_pContentReader;
+ m_pContentReader = new CContentReader((void*)m_pStream, m_pMetaInfoReader->getDefaultLocale(), &z_filefunc);
+ }
+ catch (const std::exception&)
+ {
+ return E_FAIL;
+ }
+ return S_OK;
+}
+
+//M-------------------------------------------------------------------------
+//
+// Method: COooFilter::GetSizeMax (IPersistStream::GetSizeMax)
+//
+// Summary: Returns the size in bytes of the stream neede to save the object.
+//
+// Arguments: pcbSize
+// [out] Pointer to a 64 bit unsigned int indicating the size needed
+//
+// Returns: E_NOTIMPL
+//
+//
+//--------------------------------------------------------------------------
+SCODE STDMETHODCALLTYPE COooFilter::GetSizeMax(ULARGE_INTEGER * /*pcbSize*/)
+{
+ //
+ return E_NOTIMPL;
+}
+
+//M-------------------------------------------------------------------------
+//
+// Method: COooFilter::Save (IPersistStream::Save)
+//
+// Summary: Save object to specified stream
+//
+// Arguments: pStm
+// [in] Pointer to stream
+//
+// fClearDirty
+// [in] Indicates whether to clear dirty flag
+//
+// Returns: E_NOTIMPL
+//
+//
+//--------------------------------------------------------------------------
+SCODE STDMETHODCALLTYPE COooFilter::Save(IStream * /*pStm*/, BOOL )
+{
+ //
+ return E_NOTIMPL;
+}
+
//M-------------------------------------------------------------------------
//
// Method: COooFilter::GetCurFile (IPersistFile::GetCurFile)
@@ -1142,9 +1243,19 @@ namespace /* private */
std::string ClsidEntry_Persist = CLSID_GUID_ENTRY;
SubstitutePlaceholder(ClsidEntry_Persist, GUID_PLACEHOLDER, ClsidToString(PersistentGuid));
+
if (!SetRegistryKey(HKEY_CLASSES_ROOT, ClsidEntry_Persist.c_str(), "", "OpenOffice.org Persistent Handler"))
return E_FAIL;
+ // Add missing entry
+ std::string ClsidEntry_Persist_Entry = CLSID_PERSIST_ENTRY;
+ SubstitutePlaceholder(ClsidEntry_Persist_Entry,
+ GUID_PLACEHOLDER,
+ ClsidToString(PersistentGuid));
+
+ if (!SetRegistryKey(HKEY_CLASSES_ROOT, ClsidEntry_Persist_Entry.c_str(), "", ClsidToString(PersistentGuid).c_str()));
+
+
std::string ClsidEntry_Persist_Addin = CLSID_GUID_PERSIST_ADDIN_ENTRY;
SubstitutePlaceholder(ClsidEntry_Persist_Addin,
GUID_PLACEHOLDER,
@@ -1393,3 +1504,100 @@ STDAPI DllUnregisterServer()
*/
return S_OK;
}
+
+extern "C" {
+
+ // IStream callback
+ voidpf ZCALLBACK cb_sopen (voidpf opaque, const char* filename, int mode) {
+ return opaque;
+ }
+
+ uLong ZCALLBACK cb_sread (voidpf opaque, voidpf stream, void* buf, uLong size) {
+ unsigned long newsize;
+ HRESULT hr;
+
+ hr = ((IStream *)stream)->Read (buf, size, &newsize);
+ if (hr == S_OK){
+ return (unsigned long)newsize;
+ }
+ else {
+ return (uLong)0;
+ }
+ }
+
+ long ZCALLBACK cb_sseek (voidpf opaque, voidpf stream, uLong offset, int origin) {
+ // IStream::Seek parameters
+ HRESULT hr;
+ LARGE_INTEGER Move;
+ DWORD dwOrigin;
+ Move.QuadPart = (__int64)offset;
+
+ switch (origin) {
+ case SEEK_CUR:
+ dwOrigin = STREAM_SEEK_CUR;
+ break;
+ case SEEK_END:
+ dwOrigin = STREAM_SEEK_END;
+ break;
+ case SEEK_SET:
+ dwOrigin = STREAM_SEEK_SET;
+ break;
+ default:
+ return -1;
+ }
+
+ hr = ((IStream*)stream)->Seek (Move, dwOrigin, NULL);
+ if (hr == S_OK){
+ return 0;
+ }
+ else {
+ return -1;
+ }
+ }
+
+ long ZCALLBACK cb_stell (voidpf opaque, voidpf stream) {
+ // IStream::Seek parameters
+ HRESULT hr;
+ LARGE_INTEGER Move;
+ ULARGE_INTEGER NewPosition;
+ Move.QuadPart = 0;
+ NewPosition.QuadPart = 0;
+
+ hr = ((IStream*)stream)->Seek (Move, STREAM_SEEK_CUR, &NewPosition);
+ if (hr == S_OK){
+ return (long) NewPosition.QuadPart;
+ }
+ else {
+ return -1;
+ }
+ }
+
+ int ZCALLBACK cb_sclose (voidpf opaque, voidpf stream) {
+ return 0;
+ }
+
+ int ZCALLBACK cb_serror (voidpf opaque, voidpf stream) {
+ return 0; //RJK - for now
+ }
+
+ uLong ZCALLBACK cb_swrite (voidpf opaque, voidpf stream, const void* buf, uLong size) {
+ HRESULT hr;
+ unsigned long writecount;
+ hr = ((IStream*)stream)->Write (buf, size, &writecount);
+ if (hr == S_OK)
+ return (unsigned int)writecount;
+ else
+ return (uLong)0;
+ }
+
+ void fill_stream_filefunc (zlib_filefunc_def* pzlib_filefunc_def) {
+ pzlib_filefunc_def->zopen_file = cb_sopen;
+ pzlib_filefunc_def->zread_file = cb_sread;
+ pzlib_filefunc_def->zwrite_file = cb_swrite;
+ pzlib_filefunc_def->ztell_file = cb_stell;
+ pzlib_filefunc_def->zseek_file = cb_sseek;
+ pzlib_filefunc_def->zclose_file = cb_sclose;
+ pzlib_filefunc_def->zerror_file = cb_serror;
+ }
+}
+
diff --git a/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx b/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx
index f83e8792507f..9f1566b406bd 100644
--- a/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx
+++ b/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx
@@ -96,8 +96,7 @@ enum FilterState
FilteringContent, // Filtering the content property
FilteringProperty // Filtering the pseudo property
};
-
-class COooFilter : public IFilter, public IPersistFile
+class COooFilter : public IFilter, public IPersistFile, public IPersistStream
{
public:
// From IUnknown
@@ -144,6 +143,18 @@ public:
virtual SCODE STDMETHODCALLTYPE GetCurFile(
LPWSTR * ppszFileName);
+ // From IPersistStream
+ virtual SCODE STDMETHODCALLTYPE Load(
+ IStream *pStm);
+
+ virtual SCODE STDMETHODCALLTYPE Save(
+ IStream *pStm,
+ BOOL fClearDirty);
+
+ virtual SCODE STDMETHODCALLTYPE GetSizeMax(
+ ULARGE_INTEGER *pcbSize);
+
+
private:
friend class COooFilterCF;
@@ -166,6 +177,8 @@ private:
ULONG m_ChunkPosition; // Chunk pointer to specify the current Chunk;
ULONG m_cAttributes; // Count of attributes
CFullPropSpec * m_pAttributes; // Attributes to filter
+ IStream * m_pStream;
+
};
//C-------------------------------------------------------------------------
@@ -207,6 +220,22 @@ private:
long m_lRefs; // Reference count
};
+extern "C" {
+
+ voidpf ZCALLBACK cb_sopen OF((voidpf opaque, const char * filename, int mode));
+ uLong ZCALLBACK cb_sread OF((voidpf opaque, voidpf stream, void* vuf, uLong size));
+ uLong ZCALLBACK cb_swrite OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
+ long ZCALLBACK cb_stell OF((voidpf opaque, voidpf stream));
+ long ZCALLBACK cb_sseek OF((voidpf opaque, voidpf stream, uLong offset, int origin));
+ int ZCALLBACK cb_sclose OF((voidpf opaque, voidpf stream));
+ int ZCALLBACK cb_serror OF((voidpf opaque, voidpf stream));
+
+ void fill_stream_filefunc (zlib_filefunc_def* pzlib_filefunc_def);
+
+}
+
+
+
diff --git a/shell/source/win32/shlxthandler/ooofilt/proxy/ooofiltproxy.cxx b/shell/source/win32/shlxthandler/ooofilt/proxy/ooofiltproxy.cxx
index 623bc7be7772..879cf8c0115b 100644
--- a/shell/source/win32/shlxthandler/ooofilt/proxy/ooofiltproxy.cxx
+++ b/shell/source/win32/shlxthandler/ooofilt/proxy/ooofiltproxy.cxx
@@ -147,7 +147,6 @@ extern "C" HRESULT __stdcall DllCanUnloadNow()
extern "C" HRESULT __stdcall DllRegisterServer()
{
Init();
-
if (Forward_DllRegisterServer)
return Forward_DllRegisterServer();
else
diff --git a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
index b8af5acbde78..171bc287715f 100644
--- a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
+++ b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
@@ -177,14 +177,6 @@ HRESULT STDMETHODCALLTYPE CPropertySheet::Initialize(
HRESULT STDMETHODCALLTYPE CPropertySheet::AddPages(LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
{
- try
- {
- m_pMetaInfo = std::auto_ptr<CMetaInfoReader>(new CMetaInfoReader(m_szFileName));
- }
- catch (const std::exception&)
- {
- return E_FAIL;
- }
PROPSHEETPAGE psp;
@@ -317,14 +309,17 @@ BOOL CALLBACK CPropertySheet::PropPageStatisticsProc(HWND hwnd, UINT uiMsg, WPAR
//##################################
void CPropertySheet::InitPropPageSummary(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/)
{
- SetWindowText(GetDlgItem(hwnd,IDC_TITLE), m_pMetaInfo->getTagData( META_INFO_TITLE ).c_str() );
- SetWindowText(GetDlgItem(hwnd,IDC_AUTHOR), m_pMetaInfo->getTagData( META_INFO_AUTHOR ).c_str() );
- SetWindowText(GetDlgItem(hwnd,IDC_SUBJECT), m_pMetaInfo->getTagData( META_INFO_SUBJECT ).c_str() );
- SetWindowText(GetDlgItem(hwnd,IDC_KEYWORDS), m_pMetaInfo->getTagData( META_INFO_KEYWORDS ).c_str() );
+
+ CMetaInfoReader metaInfo(m_szFileName);
+
+ SetWindowText(GetDlgItem(hwnd,IDC_TITLE), metaInfo.getTagData( META_INFO_TITLE ).c_str() );
+ SetWindowText(GetDlgItem(hwnd,IDC_AUTHOR), metaInfo.getTagData( META_INFO_AUTHOR ).c_str() );
+ SetWindowText(GetDlgItem(hwnd,IDC_SUBJECT), metaInfo.getTagData( META_INFO_SUBJECT ).c_str() );
+ SetWindowText(GetDlgItem(hwnd,IDC_KEYWORDS), metaInfo.getTagData( META_INFO_KEYWORDS ).c_str() );
// comments read from meta.xml use "\n" for return, but this will not displayable in Edit control, add
// "\r" before "\n" to form "\r\n" in order to display return in Edit control.
- std::wstring tempStr = m_pMetaInfo->getTagData( META_INFO_DESCRIPTION ).c_str();
+ std::wstring tempStr = metaInfo.getTagData( META_INFO_DESCRIPTION ).c_str();
std::wstring::size_type itor = tempStr.find ( L"\n" , 0 );
while (itor != std::wstring::npos)
{
@@ -332,6 +327,7 @@ void CPropertySheet::InitPropPageSummary(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/)
itor = tempStr.find(L"\n", itor + 2);
}
SetWindowText(GetDlgItem(hwnd,IDC_COMMENTS), tempStr.c_str());
+
}
//---------------------------------
@@ -339,7 +335,10 @@ void CPropertySheet::InitPropPageSummary(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/)
*/
void CPropertySheet::InitPropPageStatistics(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/)
{
- document_statistic_reader_ptr doc_stat_reader = create_document_statistic_reader(m_szFileName, m_pMetaInfo.get());
+
+ CMetaInfoReader metaInfo(m_szFileName);
+
+ document_statistic_reader_ptr doc_stat_reader = create_document_statistic_reader(m_szFileName, &metaInfo);
statistic_group_list_t sgl;
doc_stat_reader->read(&sgl);
@@ -350,6 +349,7 @@ void CPropertySheet::InitPropPageStatistics(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/
GetResString(IDS_PROPERTY_VALUE));
lv_builder->build(sgl);
+
}
diff --git a/shell/source/win32/shlxthandler/res/makefile.mk b/shell/source/win32/shlxthandler/res/makefile.mk
index eaf147118f93..08893506b2d2 100644
--- a/shell/source/win32/shlxthandler/res/makefile.mk
+++ b/shell/source/win32/shlxthandler/res/makefile.mk
@@ -62,5 +62,5 @@ ULFDIR:=.
# using lngconvex.exe
$(RCFILES) : $(ULFDIR)$/shlxthdl.ulf makefile.mk rcfooter.txt rcheader.txt rctmpl.txt
- $(WRAPCMD) $(BIN)$/lngconvex.exe -ulf $(ULFDIR)$/shlxthdl.ulf -rc $(RES)$/shlxthdl.rc -rct rctmpl.txt -rch rcheader.txt -rcf rcfooter.txt
+ $(subst,$(SOLARBINDIR)$/lngconvex,$(BIN)$/lngconvex $(LNGCONVEX)) -ulf $(ULFDIR)$/shlxthdl.ulf -rc $(RES)$/shlxthdl.rc -rct rctmpl.txt -rch rcheader.txt -rcf rcfooter.txt
diff --git a/shell/source/win32/shlxthandler/util/makefile.mk b/shell/source/win32/shlxthandler/util/makefile.mk
index f5d912c4b185..c0bec9c36d3b 100644
--- a/shell/source/win32/shlxthandler/util/makefile.mk
+++ b/shell/source/win32/shlxthandler/util/makefile.mk
@@ -35,6 +35,7 @@ TARGET=util
#LIBTARGET=NO
ENABLE_EXCEPTIONS=TRUE
+
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
diff --git a/shell/source/win32/shlxthandler/util/utilities.cxx b/shell/source/win32/shlxthandler/util/utilities.cxx
index 0598b4d335b7..36c19dd0c500 100644
--- a/shell/source/win32/shlxthandler/util/utilities.cxx
+++ b/shell/source/win32/shlxthandler/util/utilities.cxx
@@ -586,5 +586,4 @@ LCID LocaleSetToLCID( const LocaleSet_t & Locale )
return GetSystemDefaultLCID(); //System Default Locale
return MAKELCID( MAKELANGID( usPrimaryLang, usSubLang ), SORT_DEFAULT );
-
}
diff --git a/svx/inc/accessibility.hrc b/svx/inc/accessibility.hrc
index 01955e04967c..c202c4611ffe 100644
--- a/svx/inc/accessibility.hrc
+++ b/svx/inc/accessibility.hrc
@@ -92,97 +92,3 @@
#endif
-/*************************************************************************
- *
- * 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: accessibility.hrc,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 _SVX_ACCESSIBILITY_HRC
-#define _SVX_ACCESSIBILITY_HRC
-
-#include <svx/dialogs.hrc>
-
-#define RID_SVXSTR_A11Y_3D_MATERIAL_COLOR (RID_SVXSTR_ACCESSIBILITY_START + 1)
-#define RID_SVXSTR_A11Y_TEXT_COLOR (RID_SVXSTR_ACCESSIBILITY_START + 2)
-#define RID_SVXSTR_A11Y_BACKGROUND_COLOR (RID_SVXSTR_ACCESSIBILITY_START + 3)
-#define RID_SVXSTR_A11Y_FILLSTYLE_NONE (RID_SVXSTR_ACCESSIBILITY_START + 4)
-#define RID_SVXSTR_A11Y_FILLSTYLE_SOLID (RID_SVXSTR_ACCESSIBILITY_START + 5)
-#define RID_SVXSTR_A11Y_FILLSTYLE_HATCH (RID_SVXSTR_ACCESSIBILITY_START + 6)
-#define RID_SVXSTR_A11Y_FILLSTYLE_GRADIENT (RID_SVXSTR_ACCESSIBILITY_START + 7)
-#define RID_SVXSTR_A11Y_FILLSTYLE_BITMAP (RID_SVXSTR_ACCESSIBILITY_START + 8)
-#define RID_SVXSTR_A11Y_WITH (RID_SVXSTR_ACCESSIBILITY_START + 9)
-#define RID_SVXSTR_A11Y_STYLE (RID_SVXSTR_ACCESSIBILITY_START + 10)
-#define RID_SVXSTR_A11Y_AND (RID_SVXSTR_ACCESSIBILITY_START + 11)
-
-
-// SvxRectCtl & childs
-#define RID_SVXSTR_RECTCTL_ACC_START (RID_SVXSTR_ACCESSIBILITY_START + 20)
-#define RID_SVXSTR_RECTCTL_ACC_CORN_NAME (RID_SVXSTR_RECTCTL_ACC_START + 0)
-#define RID_SVXSTR_RECTCTL_ACC_CORN_DESCR (RID_SVXSTR_RECTCTL_ACC_START + 1)
-#define RID_SVXSTR_RECTCTL_ACC_ANGL_NAME (RID_SVXSTR_RECTCTL_ACC_START + 2)
-#define RID_SVXSTR_RECTCTL_ACC_ANGL_DESCR (RID_SVXSTR_RECTCTL_ACC_START + 3)
-
-#define RID_SVXSTR_RECTCTL_ACC_CHLD_LT (RID_SVXSTR_RECTCTL_ACC_START + 4)
-#define RID_SVXSTR_RECTCTL_ACC_CHLD_MT (RID_SVXSTR_RECTCTL_ACC_START + 5)
-#define RID_SVXSTR_RECTCTL_ACC_CHLD_RT (RID_SVXSTR_RECTCTL_ACC_START + 6)
-#define RID_SVXSTR_RECTCTL_ACC_CHLD_LM (RID_SVXSTR_RECTCTL_ACC_START + 7)
-#define RID_SVXSTR_RECTCTL_ACC_CHLD_MM (RID_SVXSTR_RECTCTL_ACC_START + 8)
-#define RID_SVXSTR_RECTCTL_ACC_CHLD_RM (RID_SVXSTR_RECTCTL_ACC_START + 9)
-#define RID_SVXSTR_RECTCTL_ACC_CHLD_LB (RID_SVXSTR_RECTCTL_ACC_START + 10)
-#define RID_SVXSTR_RECTCTL_ACC_CHLD_MB (RID_SVXSTR_RECTCTL_ACC_START + 11)
-#define RID_SVXSTR_RECTCTL_ACC_CHLD_RB (RID_SVXSTR_RECTCTL_ACC_START + 12)
-
-#define RID_SVXSTR_RECTCTL_ACC_CHLD_A000 (RID_SVXSTR_RECTCTL_ACC_START + 13)
-#define RID_SVXSTR_RECTCTL_ACC_CHLD_A045 (RID_SVXSTR_RECTCTL_ACC_START + 14)
-#define RID_SVXSTR_RECTCTL_ACC_CHLD_A090 (RID_SVXSTR_RECTCTL_ACC_START + 15)
-#define RID_SVXSTR_RECTCTL_ACC_CHLD_A135 (RID_SVXSTR_RECTCTL_ACC_START + 16)
-#define RID_SVXSTR_RECTCTL_ACC_CHLD_A180 (RID_SVXSTR_RECTCTL_ACC_START + 17)
-#define RID_SVXSTR_RECTCTL_ACC_CHLD_A225 (RID_SVXSTR_RECTCTL_ACC_START + 18)
-#define RID_SVXSTR_RECTCTL_ACC_CHLD_A270 (RID_SVXSTR_RECTCTL_ACC_START + 19)
-#define RID_SVXSTR_RECTCTL_ACC_CHLD_A315 (RID_SVXSTR_RECTCTL_ACC_START + 20)
-#define RID_SVXSTR_RECTCTL_ACC_END (RID_SVXSTR_RECTCTL_ACC_START + 21)
-
-// SvxGraphCtrlAccessibleContext
-#define RID_SVXSTR_GRAPHCTRL_ACC_START (RID_SVXSTR_RECTCTL_ACC_END)
-#define RID_SVXSTR_GRAPHCTRL_ACC_NAME (RID_SVXSTR_GRAPHCTRL_ACC_START + 0)
-#define RID_SVXSTR_GRAPHCTRL_ACC_DESCRIPTION (RID_SVXSTR_GRAPHCTRL_ACC_START + 1)
-
-// text paragraphs and bullets
-#define RID_SVXSTR_A11Y_TEXTHELPER_START (RID_SVXSTR_ACCESSIBILITY_START + 70)
-#define RID_SVXSTR_A11Y_PARAGRAPH_DESCRIPTION (RID_SVXSTR_A11Y_TEXTHELPER_START + 0)
-#define RID_SVXSTR_A11Y_PARAGRAPH_NAME (RID_SVXSTR_A11Y_TEXTHELPER_START + 1)
-#define RID_SVXSTR_A11Y_IMAGEBULLET_DESCRIPTION (RID_SVXSTR_A11Y_TEXTHELPER_START + 2)
-#define RID_SVXSTR_A11Y_IMAGEBULLET_NAME (RID_SVXSTR_A11Y_TEXTHELPER_START + 3)
-
-// SvxShowCharSetAcc
-#define RID_SVXSTR_CHARACTER_SELECTION (RID_SVXSTR_ACCESSIBILITY_START + 80)
-#define RID_SVXSTR_CHARACTER_CODE (RID_SVXSTR_ACCESSIBILITY_START + 81)
-#define RID_SVXSTR_CHAR_SEL_DESC (RID_SVXSTR_ACCESSIBILITY_START + 82)
-
-#endif
-
diff --git a/svx/inc/edtspell.hxx b/svx/inc/edtspell.hxx
index f3d55ee87841..15e180342d85 100644
--- a/svx/inc/edtspell.hxx
+++ b/svx/inc/edtspell.hxx
@@ -133,6 +133,9 @@ public:
void MarkWrongsInvalid();
WrongList* Clone() const;
+
+ // #i102062#
+ bool operator==(const WrongList& rCompare) const;
};
inline void WrongList::InsertWrong( const WrongRange& rWrong, USHORT nPos )
diff --git a/svx/inc/mscodec.hxx b/svx/inc/mscodec.hxx
index 1b72976cbf01..4ee508d661dd 100644
--- a/svx/inc/mscodec.hxx
+++ b/svx/inc/mscodec.hxx
@@ -235,6 +235,36 @@ public:
*/
bool InitCipher( sal_uInt32 nCounter );
+ /** Creates an MD5 digest of salt digest. */
+ bool CreateSaltDigest(
+ const sal_uInt8 nSaltData[16], sal_uInt8 nSaltDigest[16] );
+
+ /** Encodes a block of memory.
+
+ @see rtl_cipher_encode()
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used. The destination buffer must be able to take all
+ unencoded data from the source buffer (usually this means it must be
+ as long as or longer than the source buffer).
+
+ @param pData
+ Unencrypted source data block.
+ @param nDatLen
+ Size of the passed source data block.
+ @param pBuffer
+ Destination buffer for the encrypted data.
+ @param nBufLen
+ Size of the destination buffer.
+
+ @return
+ true = Encoding was successful (no error occured).
+ */
+ bool Encode(
+ const void* pData, sal_Size nDatLen,
+ sal_uInt8* pBuffer, sal_Size nBufLen );
+
/** Decodes a block of memory.
@see rtl_cipher_decode()
@@ -275,6 +305,27 @@ public:
*/
bool Skip( sal_Size nDatLen );
+ /** Gets salt data and salt digest.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param pSalt
+ Salt, a random number.
+ @param pSaltData
+ Salt data block generated from the salt.
+ @param pSaltDigest
+ Salt digest generated from the salt.
+ */
+ void GetEncryptKey (
+ const sal_uInt8 pSalt[16],
+ sal_uInt8 pSaltData[16],
+ sal_uInt8 pSaltDigest[16]);
+
+private:
+ void GetDigestFromSalt( const sal_uInt8 pSaltData[16], sal_uInt8 pDigest[16] );
+
private:
SVX_DLLPRIVATE MSCodec_Std97( const MSCodec_Std97& );
SVX_DLLPRIVATE MSCodec_Std97& operator=( const MSCodec_Std97& );
diff --git a/svx/inc/optgenrl.hrc b/svx/inc/optgenrl.hrc
index 1972689529fc..b6f191aaea07 100644
--- a/svx/inc/optgenrl.hrc
+++ b/svx/inc/optgenrl.hrc
@@ -74,7 +74,7 @@
#define LINEH 12
#define FLINEH 8
#define LEFT 12
-#define MID 96
+#define MID 100
#define RIGHT 248
#define TOP 10
#define LINE(y) (14+y*15)
diff --git a/svx/inc/svx/dialogs.hrc b/svx/inc/svx/dialogs.hrc
index d19518fbcd88..1d78c5e6396e 100644
--- a/svx/inc/svx/dialogs.hrc
+++ b/svx/inc/svx/dialogs.hrc
@@ -251,8 +251,10 @@
// ResId fuer FontSubstitution
#define RID_SVX_FONT_SUBSTITUTION (RID_SVX_START + 18)
+// insert row&col dialog
+#define DLG_INS_ROW_COL (RID_SVX_START + 156)
+
//InetDlg
-//#define RID_SVXDLG_INTERNET (RID_SVX_START + 156)
#define RID_SVXPAGE_INET_MAIL (RID_SVX_START + 155)
#define RID_SVXPAGE_INET_PROXY (RID_SVX_START + 157)
#define RID_SVXPAGE_INET_CACHE (RID_SVX_START + 158)
@@ -484,13 +486,13 @@
#define RID_SVXSTR_PAPER_A3 (RID_SVX_START + 103)
#define RID_SVXSTR_PAPER_A4 (RID_SVX_START + 104)
#define RID_SVXSTR_PAPER_A5 (RID_SVX_START + 105)
-#define RID_SVXSTR_PAPER_B4 (RID_SVX_START + 106)
-#define RID_SVXSTR_PAPER_B5 (RID_SVX_START + 107)
+#define RID_SVXSTR_PAPER_B4_ISO (RID_SVX_START + 106)
+#define RID_SVXSTR_PAPER_B5_ISO (RID_SVX_START + 107)
#define RID_SVXSTR_PAPER_LETTER (RID_SVX_START + 108)
#define RID_SVXSTR_PAPER_LEGAL (RID_SVX_START + 109)
#define RID_SVXSTR_PAPER_TABLOID (RID_SVX_START + 110)
#define RID_SVXSTR_PAPER_USER (RID_SVX_START + 111)
-#define RID_SVXSTR_PAPER_B6 (RID_SVX_START + 112)
+#define RID_SVXSTR_PAPER_B6_ISO (RID_SVX_START + 112)
#define RID_SVXSTR_PAPER_C4 (RID_SVX_START + 113)
#define RID_SVXSTR_PAPER_C5 (RID_SVX_START + 114)
#define RID_SVXSTR_PAPER_C6 (RID_SVX_START + 115)
@@ -498,25 +500,23 @@
#define RID_SVXSTR_PAPER_DL (RID_SVX_START + 117)
#define RID_SVXSTR_PAPER_DIA (RID_SVX_START + 118)
#define RID_SVXSTR_PAPER_SCREEN (RID_SVX_START + 119)
-#define RID_SVXSTR_PAPER_A (RID_SVX_START + 120)
-#define RID_SVXSTR_PAPER_B (RID_SVX_START + 121)
-#define RID_SVXSTR_PAPER_C (RID_SVX_START + 122)
-#define RID_SVXSTR_PAPER_D (RID_SVX_START + 123)
-#define RID_SVXSTR_PAPER_E (RID_SVX_START + 124)
-#define RID_SVXSTR_PAPER_EXECUTIVE (RID_SVX_START + 125)
-#define RID_SVXSTR_PAPER_LEGAL2 (RID_SVX_START + 126)
-#define RID_SVXSTR_PAPER_MONARCH (RID_SVX_START + 127)
-#define RID_SVXSTR_PAPER_COM675 (RID_SVX_START + 128)
-#define RID_SVXSTR_PAPER_COM9 (RID_SVX_START + 129)
-#define RID_SVXSTR_PAPER_COM10 (RID_SVX_START + 130)
-#define RID_SVXSTR_PAPER_COM11 (RID_SVX_START + 131)
-#define RID_SVXSTR_PAPER_COM12 (RID_SVX_START + 132)
-#define RID_SVXSTR_PAPER_KAI16 (RID_SVX_START + 133)
-#define RID_SVXSTR_PAPER_KAI32 (RID_SVX_START + 134)
-#define RID_SVXSTR_PAPER_KAI32BIG (RID_SVX_START + 135)
-#define RID_SVXSTR_PAPER_B4_JIS (RID_SVX_START + 136)
-#define RID_SVXSTR_PAPER_B5_JIS (RID_SVX_START + 137)
-#define RID_SVXSTR_PAPER_B6_JIS (RID_SVX_START + 138)
+#define RID_SVXSTR_PAPER_C (RID_SVX_START + 120)
+#define RID_SVXSTR_PAPER_D (RID_SVX_START + 121)
+#define RID_SVXSTR_PAPER_E (RID_SVX_START + 122)
+#define RID_SVXSTR_PAPER_EXECUTIVE (RID_SVX_START + 123)
+#define RID_SVXSTR_PAPER_LEGAL2 (RID_SVX_START + 124)
+#define RID_SVXSTR_PAPER_MONARCH (RID_SVX_START + 125)
+#define RID_SVXSTR_PAPER_COM675 (RID_SVX_START + 126)
+#define RID_SVXSTR_PAPER_COM9 (RID_SVX_START + 127)
+#define RID_SVXSTR_PAPER_COM10 (RID_SVX_START + 128)
+#define RID_SVXSTR_PAPER_COM11 (RID_SVX_START + 129)
+#define RID_SVXSTR_PAPER_COM12 (RID_SVX_START + 130)
+#define RID_SVXSTR_PAPER_KAI16 (RID_SVX_START + 131)
+#define RID_SVXSTR_PAPER_KAI32 (RID_SVX_START + 132)
+#define RID_SVXSTR_PAPER_KAI32BIG (RID_SVX_START + 133)
+#define RID_SVXSTR_PAPER_B4_JIS (RID_SVX_START + 134)
+#define RID_SVXSTR_PAPER_B5_JIS (RID_SVX_START + 135)
+#define RID_SVXSTR_PAPER_B6_JIS (RID_SVX_START + 136)
#define RID_SVXSTRARY_PAPERSIZE_STD (RID_SVX_START + 142)
#define RID_SVXSTRARY_PAPERSIZE_DRAW (RID_SVX_START + 143)
diff --git a/svx/inc/svx/editobj.hxx b/svx/inc/svx/editobj.hxx
index eb304425f09d..f291adefcf71 100644
--- a/svx/inc/svx/editobj.hxx
+++ b/svx/inc/svx/editobj.hxx
@@ -121,6 +121,9 @@ public:
virtual void ChangeStyleSheetName( SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName );
bool operator==( const EditTextObject& rCompare ) const;
+
+ // #i102062#
+ bool isWrongListEqual(const EditTextObject& rCompare) const;
};
#endif // _EDITOBJ_HXX
diff --git a/svx/inc/svx/editview.hxx b/svx/inc/svx/editview.hxx
index c7c9bd975428..79deaab4dc36 100644
--- a/svx/inc/svx/editview.hxx
+++ b/svx/inc/svx/editview.hxx
@@ -34,6 +34,7 @@
#include <rsc/rscsfx.hxx>
#include <i18npool/lang.h>
#include <tools/color.hxx>
+#include <tools/gen.hxx>
class EditEngine;
class ImpEditEngine;
@@ -242,6 +243,9 @@ public:
void ChangeFontSize( bool bGrow, const FontList* pList );
static bool ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFontList );
+
+ String GetSurroundingText() const;
+ Selection GetSurroundingTextSelection() const;
};
#endif // _MyEDITVIEW_HXX
diff --git a/svx/inc/svx/emphitem.hxx b/svx/inc/svx/emphitem.hxx
index 2d90f4cd035a..fd80081f2d30 100644
--- a/svx/inc/svx/emphitem.hxx
+++ b/svx/inc/svx/emphitem.hxx
@@ -28,7 +28,7 @@
*
************************************************************************/
#ifndef _SVX_EMPHITEM_HXX
-#define _SVX_EMPTITEM_HXX
+#define _SVX_EMPHITEM_HXX
// include ---------------------------------------------------------------
diff --git a/svx/inc/svx/fntctrl.hxx b/svx/inc/svx/fntctrl.hxx
index d87d75ab3690..a0de3b2d3048 100644
--- a/svx/inc/svx/fntctrl.hxx
+++ b/svx/inc/svx/fntctrl.hxx
@@ -71,6 +71,7 @@ public:
SvxFont& GetCJKFont();
SvxFont& GetCTLFont();
void SetColor( const Color& rColor );
+ void ResetColor();
void SetBackColor( const Color& rColor );
void UseResourceText( BOOL bUse = TRUE );
void Paint( const Rectangle& );
diff --git a/svx/inc/svx/msocximex.hxx b/svx/inc/svx/msocximex.hxx
index 679845827867..a32179a43eb4 100644
--- a/svx/inc/svx/msocximex.hxx
+++ b/svx/inc/svx/msocximex.hxx
@@ -230,7 +230,7 @@ class SVX_DLLPUBLIC OCX_Control
{
public:
OCX_Control(UniString sN, OCX_Control* parent = NULL ) : nWidth( 0 ), nHeight( 0 ), mnLeft(0), mnTop(0),
- mnStep(0), mnBackColor(0x8000000FL), mnForeColor(0), mnTabPos(0), sName(sN), pDocSh(0),
+ mnStep(0), mnBackColor(0x8000000FL), mnForeColor(0), mnTabPos(0), mbVisible(true), sName(sN), pDocSh(0),
bSetInDialog(FALSE), mpParent( parent ) {}
sal_Bool FullRead(SotStorageStream *pS)
{
@@ -287,6 +287,7 @@ public:
sal_Int32 mnBackColor;
sal_Int32 mnForeColor;
sal_uInt16 mnTabPos;
+ bool mbVisible;
UniString sName;
UniString msToolTip;
OCX_FontData aFontData;
@@ -483,7 +484,7 @@ public:
};
struct ContainerRecord
{
- ContainerRecord():nTop(0), nLeft(0), nSubStorageId(0), nSubStreamLen(0), nTabPos(0), nTypeIdent(0) {}
+ ContainerRecord():nTop(0), nLeft(0), nSubStorageId(0), nSubStreamLen(0), nTabPos(0), nTypeIdent(0), bVisible( true ) {}
::rtl::OUString cName;
::rtl::OUString controlTip;
@@ -494,6 +495,7 @@ struct ContainerRecord
sal_uInt32 nSubStreamLen;
sal_uInt16 nTabPos;
sal_uInt16 nTypeIdent;
+ bool bVisible;
};
typedef std::vector<OCX_Control*>::iterator CtrlIterator;
diff --git a/svx/inc/svx/obj3d.hxx b/svx/inc/svx/obj3d.hxx
index 3c15cd6951ef..6d77b0612e90 100644
--- a/svx/inc/svx/obj3d.hxx
+++ b/svx/inc/svx/obj3d.hxx
@@ -308,9 +308,6 @@ public :
virtual UINT16 GetObjIdentifier() const;
virtual void RecalcSnapRect();
- // Hittest, wird an Geometrie weitergegeben
- virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const;
-
// Parameter Geometrieerzeugung setzen/lesen
BOOL GetCreateNormals() const { return bCreateNormals; }
void SetCreateNormals(BOOL bNew);
diff --git a/svx/inc/svx/outliner.hxx b/svx/inc/svx/outliner.hxx
index 7b9b8c80708a..37e3d8ac71ee 100644
--- a/svx/inc/svx/outliner.hxx
+++ b/svx/inc/svx/outliner.hxx
@@ -387,6 +387,9 @@ public:
void SetInvalidateMore( USHORT nPixel );
USHORT GetInvalidateMore() const;
+
+ String GetSurroundingText() const;
+ Selection GetSurroundingTextSelection() const;
};
//#if 0 // _SOLAR__PRIVATE
diff --git a/svx/inc/svx/outlobj.hxx b/svx/inc/svx/outlobj.hxx
index 9a8efeaaddc1..0311fa914422 100644
--- a/svx/inc/svx/outlobj.hxx
+++ b/svx/inc/svx/outlobj.hxx
@@ -67,6 +67,9 @@ public:
bool operator==(const OutlinerParaObject& rCandidate) const;
bool operator!=(const OutlinerParaObject& rCandidate) const { return !operator==(rCandidate); }
+ // #i102062#
+ bool isWrongListEqual(const OutlinerParaObject& rCompare) const;
+
// outliner mode access
sal_uInt16 GetOutlinerMode() const;
void SetOutlinerMode(sal_uInt16 nNew);
diff --git a/svx/inc/svx/paperinf.hxx b/svx/inc/svx/paperinf.hxx
index 1c6ccf02a9f4..9e2503a56ea8 100644
--- a/svx/inc/svx/paperinf.hxx
+++ b/svx/inc/svx/paperinf.hxx
@@ -32,12 +32,8 @@
// INCLUDE ---------------------------------------------------------------
-#ifndef _PRINT_HXX //autogen
#include <vcl/print.hxx>
-#endif
-#ifndef _MAPMOD_HXX //autogen
#include <vcl/mapmod.hxx>
-#endif
#include <svx/svxenum.hxx>
#include "svx/svxdllapi.h"
@@ -52,19 +48,12 @@ class String;
class SVX_DLLPUBLIC SvxPaperInfo
{
public:
- static Size GetPaperSize( const Printer* );
- static Size GetPaperSize( SvxPaper ePaper,
- MapUnit eUnit = MAP_TWIP );
- // entfaellt demnaechst
- static SvxPaper GetPaper( const Size&, MapUnit eUnit = MAP_TWIP,
- BOOL bSloppy = FALSE );
- // dann nur noch diese beiden
- static SvxPaper GetSvxPaper( const Size&, MapUnit eUnit = MAP_TWIP,
- BOOL bSloppy = FALSE );
- static SvxPaper GetDefaultSvxPaper( LanguageType eLanguage );
- static Paper GetSvPaper( const Size&, MapUnit eUnit = MAP_TWIP,
- BOOL bSloppy = FALSE );
- static String GetName( SvxPaper ePaper );
+ static Size GetDefaultPaperSize( MapUnit eUnit = MAP_TWIP );
+ static Size GetPaperSize( Paper ePaper, MapUnit eUnit = MAP_TWIP );
+ static Size GetPaperSize( const Printer* pPrinter );
+ static Paper GetSvxPaper( const Size &rSize, MapUnit eUnit = MAP_TWIP, bool bSloppy = FALSE );
+ static long GetSloppyPaperDimension( long nSize, MapUnit eUnit = MAP_TWIP );
+ static String GetName( Paper ePaper );
};
// INLINE -----------------------------------------------------------------
@@ -84,97 +73,4 @@ inline Size &LandscapeSwap(Size &rSize)
return rSize;
}
-// Masze f"ur Standard- Papiergr"ossen:
-// Berechnungsformel: X twips = Y mm * 14400 / 254 (ungerundet!)
-
-const long lA0Width = 47678; // A0 841mm
-const long lA0Height = 67407; // A0 1189mm
-const long lA1Width = 33675; // A1 594mm
-const long lA1Height = lA0Width; // A1
-const long lA2Width = 23811; // A2 420mm
-const long lA2Height = lA1Width; // A2
-const long lA3Width = 16837; // A3 297mm
-const long lA3Height = lA2Width; // A3 420mm
-const long lA4Width = 11905; // A4 210mm
-const long lA4Height = lA3Width; // A4
-const long lA5Width = 8390; // A5 148mm
-const long lA5Height = lA4Width; // A5
-
-const long lB4Width = 14173; // B4 250mm
-const long lB4Height = 20012; // B4 353mm
-const long lB5Width = 9977; // B5 176mm
-const long lB5Height = lB4Width; // B5
-const long lB6Width = 7086;
-const long lB6Height = lB5Width;
-
-const long lC4Width = 12983;
-const long lC4Height = 18368;
-const long lC5Width = 9184;
-const long lC5Height = lC4Width;
-const long lC6Width = 6463;
-const long lC6Height = lC5Width;
-const long lC65Width = 6463;
-const long lC65Height = 12870;
-const long lDLWidth = 6236;
-const long lDLHeight = 12472;
-
-const long lJISB4Width = 14570;
-const long lJISB4Height = 20636;
-const long lJISB5Width = 10318;
-const long lJISB5Height = lJISB4Width;
-const long lJISB6Width = 7256;
-const long lJISB6Height = lJISB5Width;
-
-// Die folgenden Daten stammen vom WinWord und sind noch
-// nicht nach der obigen Formel,
-// sondern per 1cm = 567 twips oder 1 Zoll = 1440 twips berechnet worden:
-
-const long lLetterWidth = 12240; // LETTER
-const long lLetterHeight = 15840; // LETTER
-const long lLegalWidth = lLetterWidth; // LEGAL
-const long lLegalHeight = 20163; // LEGAL
-const long lTabloidWidth = 15850; // TABLOID
-const long lTabloidHeight = 24450; // TABLOID
-
-const long lDiaWidth = 10206; // DIA
-const long lDiaHeight = 15309; // DIA
-const long lScreenWidth = 11905; // SCREEN
-const long lScreenHeight = 15874; // SCREEN
-
-const long lAWidth = 12240; // A 8,5 Zoll
-const long lAHeight = 15840; // A 11 Zoll
-const long lBWidth = lAHeight; // B
-const long lBHeight = 24480; // B 17 Zoll
-const long lCWidth = lBHeight; // C
-const long lCHeight = 31680; // C 22 Zoll
-const long lDWidth = lCHeight; // D
-const long lDHeight = 48960; // D 34 Zoll
-const long lEWidth = lDHeight; // E
-const long lEHeight = 63360; // E 44 Zoll
-
-const long lExeWidth = 10440; // Executive 7,25 Zoll
-const long lExeHeight = 15120; // Executive 10,5 Zoll
-const long lLegal2Width = 12240; // Legal2 8,5 Zoll
-const long lLegal2Height = 18720; // Legal2 13 Zoll
-const long lCom675Width = 5220; // COM-6 3/4 3,625 Zoll
-const long lCom675Height = 9360; // COM-6 3/4 6,5 Zoll
-const long lCom9Width = 5580; // COM-9 3,875 Zoll
-const long lCom9Height = 12780; // COM-9 8,875 Zoll
-const long lCom10Width = 5940; // COM-10 4,125 Zoll
-const long lCom10Height = 13680; // COM-10 9,5 Zoll
-const long lCom11Width = 6480; // COM-11 4,5 Zoll
-const long lCom11Height = 14940; // COM-11 10,375 Zoll
-const long lCom12Width = 6840; // COM-12 4,75 Zoll
-const long lCom12Height = lAHeight; // COM-12 11 Zoll
-const long lMonarchWidth = lCom9Width; // Monarch 3,875 Zoll
-const long lMonarchHeight = 10800; // Monarch 7,5 Zoll
-
-const long lKai16Width = 10433; // 16 kai 18,4 cm
-const long lKai16Height = 14742; // 16 kai 26 cm
-const long lKai32Width = 7371; // 32 kai 13 cm
-const long lKai32Height = lKai16Width; // 32 kai 18,4 cm
-const long lKai32BigWidth = 7938; // 32 kai gross 14 cm
-const long lKai32BigHeight = 11510; // 32 kai gross 20,3 cm
-
#endif
-
diff --git a/svx/inc/svx/sdr/attribute/sdrallattribute.hxx b/svx/inc/svx/sdr/attribute/sdrallattribute.hxx
index ad3de9d8c837..a699c7f9a198 100644
--- a/svx/inc/svx/sdr/attribute/sdrallattribute.hxx
+++ b/svx/inc/svx/sdr/attribute/sdrallattribute.hxx
@@ -32,6 +32,8 @@
#ifndef _SDR_ATTRIBUTE_SDRALLATTRIBUTE_HXX
#define _SDR_ATTRIBUTE_SDRALLATTRIBUTE_HXX
+#include <sal/types.h>
+
//////////////////////////////////////////////////////////////////////////////
// predefines
@@ -57,7 +59,9 @@ namespace drawinglayer
SdrTextAttribute* mpTextAttribute; // text and text attributes (if used)
public:
- SdrShadowTextAttribute(SdrShadowAttribute* pShadow = 0L, SdrTextAttribute* pTextAttribute = 0L);
+ SdrShadowTextAttribute(
+ SdrShadowAttribute* pShadow = 0,
+ SdrTextAttribute* pTextAttribute = 0);
~SdrShadowTextAttribute();
// copy constructor and assigment operator
@@ -68,7 +72,7 @@ namespace drawinglayer
bool operator==(const SdrShadowTextAttribute& rCandidate) const;
// bool access
- bool isVisible() const { return (0L != mpTextAttribute); }
+ bool isVisible() const { return (0 != mpTextAttribute); }
// data access
const SdrShadowAttribute* getShadow() const { return mpShadow; }
@@ -91,7 +95,10 @@ namespace drawinglayer
SdrTextAttribute* mpTextAttribute; // text and text attributes (if used)
public:
- SdrFillTextAttribute(SdrFillAttribute* pFill = 0L, FillGradientAttribute* pFillFloatTransGradient = 0L, SdrTextAttribute* pTextAttribute = 0L);
+ SdrFillTextAttribute(
+ SdrFillAttribute* pFill = 0,
+ FillGradientAttribute* pFillFloatTransGradient = 0,
+ SdrTextAttribute* pTextAttribute = 0);
~SdrFillTextAttribute();
// copy constructor and assigment operator
@@ -126,8 +133,10 @@ namespace drawinglayer
public:
SdrLineShadowTextAttribute(
- SdrLineAttribute* pLine = 0L, SdrLineStartEndAttribute* pLineStartEnd = 0L,
- SdrShadowAttribute* pShadow = 0L, SdrTextAttribute* pTextAttribute = 0L);
+ SdrLineAttribute* pLine = 0,
+ SdrLineStartEndAttribute* pLineStartEnd = 0,
+ SdrShadowAttribute* pShadow = 0,
+ SdrTextAttribute* pTextAttribute = 0);
~SdrLineShadowTextAttribute();
// copy constructor and assigment operator
@@ -161,8 +170,12 @@ namespace drawinglayer
public:
SdrLineFillShadowTextAttribute(
- SdrLineAttribute* pLine = 0L, SdrFillAttribute* pFill = 0L, SdrLineStartEndAttribute* pLineStartEnd = 0L,
- SdrShadowAttribute* pShadow = 0L, FillGradientAttribute* pFillFloatTransGradient = 0L, SdrTextAttribute* pTextAttribute = 0L);
+ SdrLineAttribute* pLine = 0,
+ SdrFillAttribute* pFill = 0,
+ SdrLineStartEndAttribute* pLineStartEnd = 0,
+ SdrShadowAttribute* pShadow = 0,
+ FillGradientAttribute* pFillFloatTransGradient = 0,
+ SdrTextAttribute* pTextAttribute = 0);
~SdrLineFillShadowTextAttribute();
// copy constructor and assigment operator
diff --git a/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx
new file mode 100644
index 000000000000..77273bd9cb03
--- /dev/null
+++ b/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * 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: sdrtextattribute.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * 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 _SDR_ATTRIBUTE_SDRFORMTEXTATTRIBUTE_HXX
+#define _SDR_ATTRIBUTE_SDRFORMTEXTATTRIBUTE_HXX
+
+#include <sal/types.h>
+#include <svx/xenum.hxx>
+#include <tools/color.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+class SfxItemSet;
+namespace drawinglayer { namespace attribute { class SdrFormTextOutlineAttribute; }}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class SdrFormTextAttribute
+ {
+ private:
+ // FormText (FontWork) Attributes
+ sal_Int32 mnFormTextDistance; // distance from line in upright direction
+ sal_Int32 mnFormTextStart; // shift from polygon start
+ sal_Int32 mnFormTextShdwXVal; // shadow distance or 10th degrees
+ sal_Int32 mnFormTextShdwYVal; // shadow distance or scaling
+ sal_uInt16 mnFormTextShdwTransp; // shadow transparence
+ XFormTextStyle meFormTextStyle; // on/off and char orientation
+ XFormTextAdjust meFormTextAdjust; // adjustment (left/right/center) and scale
+ XFormTextShadow meFormTextShadow; // shadow mode
+ Color maFormTextShdwColor; // shadow color
+
+ // outline attributes; used when getFormTextOutline() is true and (for
+ // shadow) when getFormTextShadow() != XFTSHADOW_NONE
+ SdrFormTextOutlineAttribute* mpOutline;
+ SdrFormTextOutlineAttribute* mpShadowOutline;
+
+ // bitfield
+ unsigned mbFormTextMirror : 1; // change orientation
+ unsigned mbFormTextOutline : 1; // show contour of objects
+
+ public:
+ SdrFormTextAttribute(const SfxItemSet& rSet);
+ ~SdrFormTextAttribute();
+
+ // copy constructor and assigment operator
+ SdrFormTextAttribute(const SdrFormTextAttribute& rCandidate);
+ SdrFormTextAttribute& operator=(const SdrFormTextAttribute& rCandidate);
+
+ // compare operator
+ bool operator==(const SdrFormTextAttribute& rCandidate) const;
+
+ // data access
+ sal_Int32 getFormTextDistance() const { return mnFormTextDistance; }
+ sal_Int32 getFormTextStart() const { return mnFormTextStart; }
+ sal_Int32 getFormTextShdwXVal() const { return mnFormTextShdwXVal; }
+ sal_Int32 getFormTextShdwYVal() const { return mnFormTextShdwYVal; }
+ sal_uInt16 getFormTextShdwTransp() const { return mnFormTextShdwTransp; }
+ XFormTextStyle getFormTextStyle() const { return meFormTextStyle; }
+ XFormTextAdjust getFormTextAdjust() const { return meFormTextAdjust; }
+ XFormTextShadow getFormTextShadow() const { return meFormTextShadow; }
+ Color getFormTextShdwColor() const { return maFormTextShdwColor; }
+
+ const SdrFormTextOutlineAttribute* getOutline() const { return mpOutline; }
+ const SdrFormTextOutlineAttribute* getShadowOutline() const { return mpShadowOutline; }
+
+ bool getFormTextMirror() const { return mbFormTextMirror; }
+ bool getFormTextOutline() const { return mbFormTextOutline; }
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // _SDR_ATTRIBUTE_SDRFORMTEXTATTRIBUTE_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx b/svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx
new file mode 100644
index 000000000000..8e11c97ed5c3
--- /dev/null
+++ b/svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * 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: sdrtextattribute.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * 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 _SDR_ATTRIBUTE_SDRFORMTEXTOUTLINEATTRIBUTE_HXX
+#define _SDR_ATTRIBUTE_SDRFORMTEXTOUTLINEATTRIBUTE_HXX
+
+#include <sal/types.h>
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <drawinglayer/attribute/strokeattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class SdrFormTextOutlineAttribute
+ {
+ private:
+ // one set of attributes for FormText (FontWork) outline visualisation
+ LineAttribute maLineAttribute;
+ StrokeAttribute maStrokeAttribute;
+ sal_uInt8 mnTransparence;
+
+ public:
+ SdrFormTextOutlineAttribute(
+ const LineAttribute& rLineAttribute,
+ const StrokeAttribute& rStrokeAttribute,
+ sal_uInt8 nTransparence);
+
+ // compare operator
+ bool operator==(const SdrFormTextOutlineAttribute& rCandidate) const;
+
+ // data read access
+ const LineAttribute& getLineAttribute() const { return maLineAttribute; }
+ const StrokeAttribute getStrokeAttribute() const { return maStrokeAttribute; }
+ sal_uInt8 getTransparence() const { return mnTransparence; }
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // _SDR_ATTRIBUTE_SDRFORMTEXTOUTLINEATTRIBUTE_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx
index 9033135e6caa..e0dcb51e9460 100644
--- a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx
+++ b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx
@@ -32,18 +32,15 @@
#ifndef _SDR_ATTRIBUTE_SDRTEXTATTRIBUTE_HXX
#define _SDR_ATTRIBUTE_SDRTEXTATTRIBUTE_HXX
-#include <svx/xenum.hxx>
#include <sal/types.h>
-#include <svx/sdr/primitive2d/sdrtextprimitive2d.hxx>
+#include <svx/xenum.hxx>
+#include <svx/outlobj.hxx>
//////////////////////////////////////////////////////////////////////////////
// predefines
class SdrText;
-class OutlinerParaObject;
-
-namespace drawinglayer { namespace animation {
- class AnimationEntryList;
-}}
+namespace drawinglayer { namespace animation { class AnimationEntryList; }}
+namespace drawinglayer { namespace attribute { class SdrFormTextAttribute; }}
//////////////////////////////////////////////////////////////////////////////
@@ -53,15 +50,24 @@ namespace drawinglayer
{
class SdrTextAttribute
{
- const SdrText& mrSdrText;
- const OutlinerParaObject maOutlinerParaObject;
- XFormTextStyle meFormTextStyle;
+ private:
+ // all-text attributes. The SdrText itself and a copy
+ // of te OPO
+ const SdrText* mpSdrText;
+ OutlinerParaObject maOutlinerParaObject;
+
+ // Set when it's a FormText; contains all FormText attributes
+ SdrFormTextAttribute* mpSdrFormTextAttribute;
+ // text distances
sal_Int32 maTextLeftDistance;
sal_Int32 maTextUpperDistance;
sal_Int32 maTextRightDistance;
sal_Int32 maTextLowerDistance;
+ // #i101556# use versioning from text attributes to detect changes
+ sal_uInt32 maPropertiesVersion;
+
// bitfield
unsigned mbContour : 1;
unsigned mbFitToSize : 1;
@@ -85,23 +91,30 @@ namespace drawinglayer
bool bBlink,
bool bScroll,
bool bInEditMode);
+ ~SdrTextAttribute();
+
+ // copy constructor and assigment operator
+ SdrTextAttribute(const SdrTextAttribute& rCandidate);
+ SdrTextAttribute& operator=(const SdrTextAttribute& rCandidate);
+
+ // compare operator
bool operator==(const SdrTextAttribute& rCandidate) const;
// data access
- const SdrText& getSdrText() const { return mrSdrText; }
+ const SdrText& getSdrText() const { return *mpSdrText; }
const OutlinerParaObject& getOutlinerParaObject() const { return maOutlinerParaObject; }
bool isContour() const { return mbContour; }
- bool isFontwork() const { return (XFT_NONE != meFormTextStyle); }
bool isFitToSize() const { return mbFitToSize; }
bool isHideContour() const { return mbHideContour; }
bool isBlink() const { return mbBlink; }
bool isScroll() const { return mbScroll; }
bool isInEditMode() const { return mbInEditMode; }
- XFormTextStyle getFormTextStyle() const { return meFormTextStyle; }
+ const SdrFormTextAttribute* getSdrFormTextAttribute() const { return mpSdrFormTextAttribute; }
sal_Int32 getTextLeftDistance() const { return maTextLeftDistance; }
sal_Int32 getTextUpperDistance() const { return maTextUpperDistance; }
sal_Int32 getTextRightDistance() const { return maTextRightDistance; }
sal_Int32 getTextLowerDistance() const { return maTextLowerDistance; }
+ sal_uInt32 getPropertiesVersion() const { return maPropertiesVersion; }
// animation timing generation
void getBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const;
diff --git a/svx/inc/svx/sdr/contact/viewcontactofgraphic.hxx b/svx/inc/svx/sdr/contact/viewcontactofgraphic.hxx
index 7ddc9546ee78..136f43aed0aa 100644
--- a/svx/inc/svx/sdr/contact/viewcontactofgraphic.hxx
+++ b/svx/inc/svx/sdr/contact/viewcontactofgraphic.hxx
@@ -38,6 +38,8 @@
// predeclarations
class SdrGrafObj;
+namespace drawinglayer { namespace attribute { class SdrLineFillShadowTextAttribute; }}
+class GraphicAttr;
//////////////////////////////////////////////////////////////////////////////
@@ -47,6 +49,16 @@ namespace sdr
{
class ViewContactOfGraphic : public ViewContactOfTextObj
{
+ private:
+ // helpers for constructing various primitive visualisations in various states
+ drawinglayer::primitive2d::Primitive2DSequence createVIP2DSForPresObj(
+ const basegfx::B2DHomMatrix& rObjectMatrix,
+ const drawinglayer::attribute::SdrLineFillShadowTextAttribute& rAttribute,
+ const GraphicAttr& rLocalGrafInfo) const;
+ drawinglayer::primitive2d::Primitive2DSequence createVIP2DSForDraft(
+ const basegfx::B2DHomMatrix& rObjectMatrix,
+ const drawinglayer::attribute::SdrLineFillShadowTextAttribute& rAttribute) const;
+
protected:
// Create a Object-Specific ViewObjectContact, set ViewContact and
// ObjectContact. Always needs to return something.
@@ -63,6 +75,13 @@ namespace sdr
ViewContactOfGraphic(SdrGrafObj& rGrafObj);
virtual ~ViewContactOfGraphic();
+ // #i102380#
+ void flushGraphicObjects();
+
+ // helpers for viusualisation state
+ bool visualisationUsesPresObj() const;
+ bool visualisationUsesDraft() const;
+
protected:
// This method is responsible for creating the graphical visualisation data
// ONLY based on model data
diff --git a/svx/inc/svx/sdr/contact/viewcontactofsdrobjcustomshape.hxx b/svx/inc/svx/sdr/contact/viewcontactofsdrobjcustomshape.hxx
index f9f19ba687bc..f1b515e8a198 100644
--- a/svx/inc/svx/sdr/contact/viewcontactofsdrobjcustomshape.hxx
+++ b/svx/inc/svx/sdr/contact/viewcontactofsdrobjcustomshape.hxx
@@ -53,6 +53,9 @@ namespace sdr
return (SdrObjCustomShape&)GetSdrObject();
}
+ // #i101684# internal tooling
+ basegfx::B2DRange getCorrectedTextBoundRect() const;
+
public:
// basic constructor, used from SdrObject.
ViewContactOfSdrObjCustomShape(SdrObjCustomShape& rCustomShape);
diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx
index 7a40c25511e4..27359ebf9738 100644
--- a/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx
+++ b/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx
@@ -89,18 +89,6 @@ namespace sdr { namespace contact {
*/
void setControlDesignMode( bool _bDesignMode ) const;
- /** determines whether the instance belongs to a given OutputDevice
- @precond
- The instance knows the device it belongs to, or can determine it.
- If this is not the case, you will notice an assertion, and the method will
- return false.
- */
- bool belongsToDevice( const OutputDevice* _pDevice ) const;
-
- /** positions the control for subsequent paint operations
- */
- void positionControlForPaint( const DisplayInfo& _rDisplayInfo ) const;
-
/** callback from impl class to react on changes of properties form the XControlModel
*/
void propertyChange();
@@ -165,6 +153,8 @@ namespace sdr { namespace contact {
UnoControlPrintOrPreviewContact(); // never implemented
UnoControlPrintOrPreviewContact( const UnoControlPrintOrPreviewContact& ); // never implemented
UnoControlPrintOrPreviewContact& operator=( const UnoControlPrintOrPreviewContact& ); // never implemented
+
+ virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const DisplayInfo& rDisplayInfo ) const;
};
//====================================================================
diff --git a/svx/inc/svx/sdr/overlay/overlayanimatedbitmapex.hxx b/svx/inc/svx/sdr/overlay/overlayanimatedbitmapex.hxx
index 90c546cb85cc..9acc34c8dcc8 100644
--- a/svx/inc/svx/sdr/overlay/overlayanimatedbitmapex.hxx
+++ b/svx/inc/svx/sdr/overlay/overlayanimatedbitmapex.hxx
@@ -60,11 +60,8 @@ namespace sdr
// Flag to remember which state to draw. Inited with sal_False (0)
unsigned mbOverlayState : 1;
- // Draw geometry
- virtual void drawGeometry(OutputDevice& rOutputDevice);
-
- // Create the BaseRange. This method needs to calculate maBaseRange.
- virtual void createBaseRange(OutputDevice& rOutputDevice);
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
// #i53216# check blink time value range (currently 25 < mnBlinkTime < 10000)
void impCheckBlinkTimeValueRange();
@@ -100,11 +97,6 @@ namespace sdr
// execute event from base class ::sdr::animation::Event. Default
// implementation does nothing and does not create a new event.
virtual void Trigger(sal_uInt32 nTime);
-
- // Zoom has changed. If the objects logical size
- // depends on the MapMode of the used OutputDevice, use this call
- // to invalidate the range in logical coordinates.
- virtual void zoomHasChanged();
};
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/inc/svx/sdr/overlay/overlaybitmap.hxx b/svx/inc/svx/sdr/overlay/overlaybitmap.hxx
deleted file mode 100644
index 23037300259d..000000000000
--- a/svx/inc/svx/sdr/overlay/overlaybitmap.hxx
+++ /dev/null
@@ -1,94 +0,0 @@
-/*************************************************************************
- *
- * 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: overlaybitmap.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 _SDR_OVERLAY_OVERLAYBITMAP_HXX
-#define _SDR_OVERLAY_OVERLAYBITMAP_HXX
-
-#include <svx/sdr/overlay/overlayobject.hxx>
-#include <vcl/bitmap.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace overlay
- {
- class OverlayBitmap : public OverlayObjectWithBasePosition
- {
- protected:
- // the Bitmap itself
- Bitmap maBitmap;
-
- // position of the basePosition inside the Bitmap, in pixels
- sal_uInt16 mnCenterX;
- sal_uInt16 mnCenterY;
-
- // bitfield
- // shall the BaseColor be used to create transparence?
- unsigned mbUseTransparenceColor : 1;
-
- // Draw geometry
- virtual void drawGeometry(OutputDevice& rOutputDevice);
-
- // Create the BaseRange. This method needs to calculate maBaseRange.
- virtual void createBaseRange(OutputDevice& rOutputDevice);
-
- public:
- OverlayBitmap(
- const basegfx::B2DPoint& rBasePos,
- const Bitmap& rBitmap,
- sal_uInt16 nCenX = 0, sal_uInt16 nCenY = 0,
- sal_Bool bUseTransCol = sal_False,
- Color aTransColor = Color(COL_WHITE));
- virtual ~OverlayBitmap();
-
- const Bitmap& getBitmap() const { return maBitmap; }
- void setBitmap(const Bitmap& rNew);
-
- sal_Bool isTransparenceUsed() const { return mbUseTransparenceColor; }
- void setTransparenceUsed(sal_Bool bNew);
-
- sal_uInt16 getCenterX() const { return mnCenterX; }
- sal_uInt16 getCenterY() const { return mnCenterY; }
- void setCenterXY(sal_uInt16 nNewX, sal_uInt16 nNewY);
-
- // Zoom has changed. If the objects logical size
- // depends on the MapMode of the used OutputDevice, use this call
- // to invalidate the range in logical coordinates.
- virtual void zoomHasChanged();
- };
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
-
-#endif //_SDR_OVERLAY_OVERLAYBITMAP_HXX
-
-// eof
diff --git a/svx/inc/svx/sdr/overlay/overlaybitmapex.hxx b/svx/inc/svx/sdr/overlay/overlaybitmapex.hxx
index b19b8248eb3e..96295d0f9f80 100644
--- a/svx/inc/svx/sdr/overlay/overlaybitmapex.hxx
+++ b/svx/inc/svx/sdr/overlay/overlaybitmapex.hxx
@@ -50,11 +50,7 @@ namespace sdr
sal_uInt16 mnCenterX;
sal_uInt16 mnCenterY;
- // Draw geometry
- virtual void drawGeometry(OutputDevice& rOutputDevice);
-
- // Create the BaseRange. This method needs to calculate maBaseRange.
- virtual void createBaseRange(OutputDevice& rOutputDevice);
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
public:
OverlayBitmapEx(
@@ -69,11 +65,6 @@ namespace sdr
sal_uInt16 getCenterX() const { return mnCenterX; }
sal_uInt16 getCenterY() const { return mnCenterY; }
void setCenterXY(sal_uInt16 nNewX, sal_uInt16 nNewY);
-
- // Zoom has changed. If the objects logical size
- // depends on the MapMode of the used OutputDevice, use this call
- // to invalidate the range in logical coordinates.
- virtual void zoomHasChanged();
};
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/inc/svx/sdr/overlay/overlaycrosshair.hxx b/svx/inc/svx/sdr/overlay/overlaycrosshair.hxx
index c85bc3d9aae5..35223ce44d04 100644
--- a/svx/inc/svx/sdr/overlay/overlaycrosshair.hxx
+++ b/svx/inc/svx/sdr/overlay/overlaycrosshair.hxx
@@ -42,39 +42,15 @@ namespace sdr
class OverlayCrosshairStriped : public OverlayObjectWithBasePosition
{
protected:
- // Draw geometry
- virtual void drawGeometry(OutputDevice& rOutputDevice);
-
- // Create the BaseRange. This method needs to calculate maBaseRange.
- virtual void createBaseRange(OutputDevice& rOutputDevice);
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
public:
OverlayCrosshairStriped(const basegfx::B2DPoint& rBasePos);
virtual ~OverlayCrosshairStriped();
- // Hittest with logical coordinates
- virtual sal_Bool isHit(const basegfx::B2DPoint& rPos, double fTol = 0.0) const;
- };
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace overlay
- {
- class OverlayCrosshair : public OverlayCrosshairStriped
- {
- protected:
- // Draw geometry
- virtual void drawGeometry(OutputDevice& rOutputDevice);
-
- public:
- OverlayCrosshair(
- const basegfx::B2DPoint& rBasePos,
- Color aLineColor = Color(COL_BLACK));
- virtual ~OverlayCrosshair();
+ // react on stripe definition change
+ virtual void stripeDefinitionHasChanged();
};
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/inc/svx/sdr/overlay/overlayhatchrect.hxx b/svx/inc/svx/sdr/overlay/overlayhatchrect.hxx
index 41e55f7dbdec..aeb4c416f058 100644
--- a/svx/inc/svx/sdr/overlay/overlayhatchrect.hxx
+++ b/svx/inc/svx/sdr/overlay/overlayhatchrect.hxx
@@ -47,38 +47,30 @@ namespace sdr
{
// geometric definitions
basegfx::B2DPoint maSecondPosition;
- const double mfDiscreteWidth;
+ const double mfDiscreteGrow;
+ const double mfDiscreteShrink;
const double mfHatchRotation;
const double mfRotation;
- // helper to create visualisation geometry from above values
- basegfx::B2DPolyPolygon getGeometry(OutputDevice& rOutputDevice);
-
- // Draw geometry
- virtual void drawGeometry(OutputDevice& rOutputDevice);
-
- // Create the BaseRange. This method needs to calculate maBaseRange.
- virtual void createBaseRange(OutputDevice& rOutputDevice);
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
public:
OverlayHatchRect(
const basegfx::B2DPoint& rBasePosition,
const basegfx::B2DPoint& rSecondPosition,
const Color& rHatchColor,
- double fDiscreteWidth,
+ double fDiscreteGrow,
+ double fDiscreteShrink,
double fHatchRotation,
double fRotation);
const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; }
void setSecondPosition(const basegfx::B2DPoint&);
- // Zoom has changed. If the objects logical size
- // depends on the MapMode of the used OutputDevice, use this call
- // to invalidate the range in logical coordinates.
- virtual void zoomHasChanged();
-
// data read access
- double getDiscreteWidth() const { return mfDiscreteWidth; }
+ double getDiscreteGrow() const { return mfDiscreteGrow; }
+ double getDiscreteShrink() const { return mfDiscreteShrink; }
double getHatchRotation() const { return mfHatchRotation; }
double getRotation() const { return mfRotation; }
};
diff --git a/svx/inc/svx/sdr/overlay/overlayhelpline.hxx b/svx/inc/svx/sdr/overlay/overlayhelpline.hxx
index b26fc8c3f565..44baf5101e02 100644
--- a/svx/inc/svx/sdr/overlay/overlayhelpline.hxx
+++ b/svx/inc/svx/sdr/overlay/overlayhelpline.hxx
@@ -46,11 +46,8 @@ namespace sdr
// remember HelpLineKind
SdrHelpLineKind meKind;
- // Draw geometry
- virtual void drawGeometry(OutputDevice& rOutputDevice);
-
- // Create the BaseRange. This method needs to calculate maBaseRange.
- virtual void createBaseRange(OutputDevice& rOutputDevice);
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
public:
OverlayHelplineStriped(
@@ -58,30 +55,11 @@ namespace sdr
SdrHelpLineKind eNewKind = SDRHELPLINE_POINT);
virtual ~OverlayHelplineStriped();
- // Hittest with logical coordinates
- virtual sal_Bool isHit(const basegfx::B2DPoint& rPos, double fTol = 0.0) const;
- };
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace overlay
- {
- class OverlayHelpline : public OverlayHelplineStriped
- {
- protected:
- // Draw geometry
- virtual void drawGeometry(OutputDevice& rOutputDevice);
+ // dat read access
+ SdrHelpLineKind getKind() const { return meKind; }
- public:
- OverlayHelpline(
- const basegfx::B2DPoint& rBasePos,
- Color aLineColor = Color(COL_BLACK),
- SdrHelpLineKind eNewKind = SDRHELPLINE_POINT);
- virtual ~OverlayHelpline();
+ // react on stripe definition change
+ virtual void stripeDefinitionHasChanged();
};
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/inc/svx/sdr/overlay/overlayline.hxx b/svx/inc/svx/sdr/overlay/overlayline.hxx
index 821a87a0a36b..5c052b778fce 100644
--- a/svx/inc/svx/sdr/overlay/overlayline.hxx
+++ b/svx/inc/svx/sdr/overlay/overlayline.hxx
@@ -45,11 +45,8 @@ namespace sdr
// second position in pixel
basegfx::B2DPoint maSecondPosition;
- // Draw geometry
- virtual void drawGeometry(OutputDevice& rOutputDevice);
-
- // Create the BaseRange. This method needs to calculate maBaseRange.
- virtual void createBaseRange(OutputDevice& rOutputDevice);
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
public:
OverlayLineStriped(
@@ -61,33 +58,8 @@ namespace sdr
const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; }
void setSecondPosition(const basegfx::B2DPoint& rNew);
- // Hittest with logical coordinates
- virtual sal_Bool isHit(const basegfx::B2DPoint& rPos, double fTol = 0.0) const;
-
- // transform object coordinates. Needs to transform maSecondPosition.
- virtual void transform(const basegfx::B2DHomMatrix& rMatrix);
- };
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace overlay
- {
- class OverlayLine : public OverlayLineStriped
- {
- protected:
- // Draw geometry
- virtual void drawGeometry(OutputDevice& rOutputDevice);
-
- public:
- OverlayLine(
- const basegfx::B2DPoint& rBasePos,
- const basegfx::B2DPoint& rSecondPos,
- Color aLineColor = Color(COL_BLACK));
- virtual ~OverlayLine();
+ // react on stripe definition change
+ virtual void stripeDefinitionHasChanged();
};
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/inc/svx/sdr/overlay/overlaymanager.hxx b/svx/inc/svx/sdr/overlay/overlaymanager.hxx
index 53cb15c5d72b..557a06a5f722 100644
--- a/svx/inc/svx/sdr/overlay/overlaymanager.hxx
+++ b/svx/inc/svx/sdr/overlay/overlaymanager.hxx
@@ -38,7 +38,6 @@
#include <tools/color.hxx>
#include "svx/svxdllapi.h"
#include <svtools/optionsdrawinglayer.hxx>
-#include <boost/shared_ptr.hpp>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <drawinglayer/geometry/viewinformation2d.hxx>
@@ -68,13 +67,8 @@ namespace sdr
// the OutputDevice to work on, set on construction and not to be changed
OutputDevice& rmOutputDevice;
- // start, end and number of the double linked list of OverlayObjects
- // managed by this manager
- OverlayObject* mpOverlayObjectStart;
- OverlayObject* mpOverlayObjectEnd;
-
- // MapMode for MapMode change watching
- MapMode maMapMode;
+ // the vector of registered OverlayObjects
+ OverlayObjectVector maOverlayObjects;
// Stripe support. All striped OverlayObjects use these stripe
// values. Changes change all those objects.
@@ -88,23 +82,33 @@ namespace sdr
// hold buffered the logic length of discrete vector (1.0, 0.0) and the
// view transformation belonging to it. Update happens in getDiscreteOne()
basegfx::B2DHomMatrix maViewTransformation;
+ drawinglayer::geometry::ViewInformation2D maViewInformation2D;
double mfDiscreteOne;
// internal
void ImpDrawMembers(const basegfx::B2DRange& rRange, OutputDevice& rDestinationDevice) const;
- void ImpCheckMapModeChange() const;
void ImpStripeDefinitionChanged();
+ void impApplyRemoveActions(OverlayObject& rTarget);
+ void impApplyAddActions(OverlayObject& rTarget);
// return mfDiscreteOne to derivations, but also check for buffered local
// ViewTransformation and evtl. correct mfDiscreteOne
double getDiscreteOne() const;
public:
- OverlayManager(OutputDevice& rOutputDevice);
+ // when handing over another OverlayManager at construction, the OverlayObjects
+ // will be taken over from it. The new one will have added all OverlayObjects
+ // while the handed over one will have none
+ OverlayManager(
+ OutputDevice& rOutputDevice,
+ OverlayManager* pOldOverlayManager = 0);
virtual ~OverlayManager();
+ // access to current ViewInformation2D; this call checks and evtl. updates ViewInformation2D
+ const drawinglayer::geometry::ViewInformation2D getCurrentViewInformation2D() const;
+
// complete redraw
- virtual void completeRedraw(const Region& rRegion, OutputDevice* pPreRenderDevice = 0L) const;
+ virtual void completeRedraw(const Region& rRegion, OutputDevice* pPreRenderDevice = 0) const;
// flush. Do buffered updates.
virtual void flush();
@@ -139,17 +143,6 @@ namespace sdr
// access to maDrawinglayerOpt
const SvtOptionsDrawinglayer& getDrawinglayerOpt() const { return maDrawinglayerOpt; }
-
- /** Return a list of all OverlayObjects that currently belong to
- the called OverlayManager. Subsequent calls to add() or
- remove() will not alter the content of the returned list.
- Modifying the list will not change the list of
- OverlayObjects that belong to the called OverlayManager.
- @return
- The returned pointer is never empty but the pointed-to
- vector may be.
- */
- ::boost::shared_ptr<OverlayObjectVector> GetOverlayObjects (void) const;
};
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/inc/svx/sdr/overlay/overlaymanagerbuffered.hxx b/svx/inc/svx/sdr/overlay/overlaymanagerbuffered.hxx
index 8899c1ac3194..9ced6a4d18ec 100644
--- a/svx/inc/svx/sdr/overlay/overlaymanagerbuffered.hxx
+++ b/svx/inc/svx/sdr/overlay/overlaymanagerbuffered.hxx
@@ -65,7 +65,7 @@ namespace sdr
// bitfield
// Flag to decide if PreRendering shall be used for overlay refreshes.
- // Default is sal_False.
+ // Default is false.
unsigned mbRefreshWithPreRendering : 1;
// link for timer
@@ -78,7 +78,13 @@ namespace sdr
void ImpSaveBackground(const Region& rRegion, OutputDevice* pPreRenderDevice = 0L);
public:
- OverlayManagerBuffered(OutputDevice& rOutputDevice, sal_Bool bRefreshWithPreRendering = sal_False);
+ // when handing over another OverlayManager at construction, the OverlayObjects
+ // will be taken over from it. The new one will have added all OverlayObjects
+ // while the handed over one will have none
+ OverlayManagerBuffered(
+ OutputDevice& rOutputDevice,
+ OverlayManager* pOldOverlayManager = 0,
+ bool bRefreshWithPreRendering = false);
virtual ~OverlayManagerBuffered();
// complete redraw
@@ -97,8 +103,8 @@ namespace sdr
virtual void invalidateRange(const basegfx::B2DRange& rRange);
// access to RefreshWithPreRendering Flag
- sal_Bool DoRefreshWithPreRendering() const { return mbRefreshWithPreRendering; }
- void SetRefreshWithPreRendering(sal_Bool bNew);
+ bool DoRefreshWithPreRendering() const { return mbRefreshWithPreRendering; }
+ void SetRefreshWithPreRendering(bool bNew);
};
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/inc/svx/sdr/overlay/overlayobject.hxx b/svx/inc/svx/sdr/overlay/overlayobject.hxx
index 41c13db0e457..e5aca5651976 100644
--- a/svx/inc/svx/sdr/overlay/overlayobject.hxx
+++ b/svx/inc/svx/sdr/overlay/overlayobject.hxx
@@ -36,6 +36,7 @@
#include <tools/color.hxx>
#include <svx/sdr/animation/scheduler.hxx>
#include "svx/svxdllapi.h"
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <vector>
@@ -65,60 +66,64 @@ namespace sdr
{
namespace overlay
{
- class SVX_DLLPUBLIC OverlayObject : public ::sdr::animation::Event
+ class SVX_DLLPUBLIC OverlayObject : private ::boost::noncopyable, public ::sdr::animation::Event
{
- // Manager is allowed access to private Members, especially
- // pNext and pPrevious are used form the manager to handle the
- // OverlayObject.
- friend class OverlayManager;
+ private:
+ // Manager is allowed access to private Member mpOverlayManager
+ friend class OverlayManager;
// pointer to OverlayManager, if object is added. Changed by
// OverlayManager, do not chnge Yourself.
- OverlayManager* mpOverlayManager;
+ OverlayManager* mpOverlayManager;
- // Chaining of IAO's, used by OverlayManager. These will be
- // used form the OverlayManager, so do not change them Yourself.
- OverlayObject* mpNext;
- OverlayObject* mpPrevious;
+ // Primitive2DSequence of the OverlayObject
+ drawinglayer::primitive2d::Primitive2DSequence maPrimitive2DSequence;
protected:
+ // access methods to maPrimitive2DSequence. The usage of this methods may allow
+ // later thread-safe stuff to be added if needed. Only to be used by getPrimitive2DSequence()
+ // implementations for buffering the last decomposition.
+ const drawinglayer::primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; }
+ void setPrimitive2DSequence(const drawinglayer::primitive2d::Primitive2DSequence& rNew) { maPrimitive2DSequence = rNew; }
+
+ // the creation method for Primitive2DSequence. Called when getPrimitive2DSequence()
+ // sees that maPrimitive2DSequence is empty. Needs to be supported by all
+ // OverlayObject implementations. Default implementation will assert
+ // a missing implementation
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
+
// region in logical coordinates
- basegfx::B2DRange maBaseRange;
+ basegfx::B2DRange maBaseRange;
// base color of this OverlayObject
- Color maBaseColor;
+ Color maBaseColor;
// bitfield
// Flag for visibility
- unsigned mbIsVisible : 1;
-
- // Flag for validity
- unsigned mbIsChanged : 1;
+ unsigned mbIsVisible : 1;
// Flag to control hittability
- unsigned mbIsHittable : 1;
+ unsigned mbIsHittable : 1;
// Flag to hold info if this objects supports animation. Default is
- // sal_False. If sal_True, the Trigger() method should be overloaded
+ // false. If true, the Trigger() method should be overloaded
// to implement the animation effect and to re-initiate the event.
- unsigned mbAllowsAnimation : 1;
+ unsigned mbAllowsAnimation : 1;
- // Draw geometry
- virtual void drawGeometry(OutputDevice& rOutputDevice) = 0;
-
- // Create the BaseRange. This method needs to calculate maBaseRange.
- virtual void createBaseRange(OutputDevice& rOutputDevice) = 0;
+ // Flag tocontrol if this OverlayObject allows AntiAliased visualisation.
+ // Default is true, but e.g. for selection visualisation in SC and SW,
+ // it is switched to false
+ unsigned mbAllowsAntiAliase : 1;
// set changed flag. Call after change, since the old range is invalidated
// and then the new one is calculated and invalidated, too. This will only
// work after the change.
- void objectChange();
+ virtual void objectChange();
- // support method to draw striped geometries
- void ImpDrawRangeStriped(OutputDevice& rOutputDevice, const basegfx::B2DRange& rRange);
- void ImpDrawLineStriped(OutputDevice& rOutputDevice, double x1, double y1, double x2, double y2);
- void ImpDrawLineStriped(OutputDevice& rOutputDevice, const basegfx::B2DPoint& rStart, const basegfx::B2DPoint& rEnd);
- void ImpDrawPolygonStriped(OutputDevice& rOutputDevice, const basegfx::B2DPolygon& rPolygon);
+ // write access to AntiAliase flag. This is protected since
+ // only implementations are allowed to change this, preferrably in their
+ // constructor
+ void allowAntiAliase(bool bNew);
public:
OverlayObject(Color aBaseColor);
@@ -127,19 +132,20 @@ namespace sdr
// get OverlayManager
OverlayManager* getOverlayManager() const { return mpOverlayManager; }
- // Hittest with logical coordinates. Default tests against maBaseRange.
- virtual sal_Bool isHit(const basegfx::B2DPoint& rPos, double fTol = 0.0) const;
+ // the access method for Primitive2DSequence. Will use createPrimitive2DSequence and
+ // setPrimitive2DSequence if needed
+ const drawinglayer::primitive2d::Primitive2DSequence& getOverlayObjectPrimitive2DSequence() const;
// access to visibility state
- sal_Bool isVisible() const { return mbIsVisible; }
- void setVisible(sal_Bool bNew);
-
- // read access to changed flag
- sal_Bool isChanged() const { return mbIsChanged; }
+ bool isVisible() const { return mbIsVisible; }
+ void setVisible(bool bNew);
// access to hittable flag
- sal_Bool isHittable() const { return mbIsHittable; }
- void setHittable(sal_Bool bNew);
+ bool isHittable() const { return mbIsHittable; }
+ void setHittable(bool bNew);
+
+ // read access to AntiAliase flag
+ bool allowsAntiAliase() const { return mbAllowsAntiAliase; }
// read access to baseRange. This may trigger createBaseRange() if
// object is changed.
@@ -154,16 +160,7 @@ namespace sdr
virtual void Trigger(sal_uInt32 nTime);
// acces to AllowsAnimation flag
- sal_Bool allowsAnimation() const { return mbAllowsAnimation; }
-
- // transform object coordinates.
- virtual void transform(const basegfx::B2DHomMatrix& rMatrix) = 0;
-
- // Zoom has changed. If the objects logical size
- // depends on the MapMode of the used OutputDevice, use this call
- // to invalidate the range in logical coordinates. Default is no
- // change.
- virtual void zoomHasChanged();
+ bool allowsAnimation() const { return mbAllowsAnimation; }
// stripe definition has changed. The OverlayManager does have
// support data to draw graphics in two colors striped. This
@@ -197,10 +194,6 @@ namespace sdr
// access to basePosition
const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
void setBasePosition(const basegfx::B2DPoint& rNew);
-
- // transform object coordinates. Transforms maBasePosition
- // and invalidates on change
- virtual void transform(const basegfx::B2DHomMatrix& rMatrix);
};
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/inc/svx/sdr/overlay/overlayobjectcell.hxx b/svx/inc/svx/sdr/overlay/overlayobjectcell.hxx
index 91add8a39758..2f40c9385674 100644
--- a/svx/inc/svx/sdr/overlay/overlayobjectcell.hxx
+++ b/svx/inc/svx/sdr/overlay/overlayobjectcell.hxx
@@ -42,7 +42,7 @@ namespace sdr
{
namespace overlay
{
- enum CellOverlayType { CELL_OVERLAY_INVERT, CELL_OVERLAY_HATCH, CELL_OVERLAY_TRANSPARENT, CELL_OVERLAY_LIGHT_TRANSPARENT };
+ enum CellOverlayType { CELL_OVERLAY_INVERT, CELL_OVERLAY_TRANSPARENT };
// OverlayObjectCell - used for cell cursor, selection and AutoFill handle
@@ -55,14 +55,12 @@ namespace sdr
CellOverlayType mePaintType;
RangeVector maRectangles;
- virtual void drawGeometry(OutputDevice& rOutputDevice);
- virtual void createBaseRange(OutputDevice& rOutputDevice);
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
public:
OverlayObjectCell( CellOverlayType eType, const Color& rColor, const RangeVector& rRects);
virtual ~OverlayObjectCell();
-
- virtual void transform(const basegfx::B2DHomMatrix& rMatrix);
};
} // end of namespace overlay
diff --git a/svx/inc/svx/sdr/overlay/overlayobjectlist.hxx b/svx/inc/svx/sdr/overlay/overlayobjectlist.hxx
index 8e03cc620dd0..3f665f203e5d 100644
--- a/svx/inc/svx/sdr/overlay/overlayobjectlist.hxx
+++ b/svx/inc/svx/sdr/overlay/overlayobjectlist.hxx
@@ -70,16 +70,13 @@ namespace sdr
OverlayObject& getOverlayObject(sal_uInt32 nIndex) const { return *(maVector[nIndex]); }
// Hittest with logical coordinates
- sal_Bool isHit(const basegfx::B2DPoint& rPos, double fTol = 0.0) const;
+ bool isHitLogic(const basegfx::B2DPoint& rLogicPosition, double fLogicTolerance = 0.0) const;
// Hittest with pixel coordinates and pixel tolerance
- sal_Bool isHitPixel(const Point& rPos, sal_uInt32 nTol = DEFAULT_VALUE_FOR_HITTEST_PIXEL) const;
+ bool isHitPixel(const Point& rDiscretePosition, sal_uInt32 fDiscreteTolerance = DEFAULT_VALUE_FOR_HITTEST_PIXEL) const;
// calculate BaseRange of all included OverlayObjects and return
basegfx::B2DRange getBaseRange() const;
-
- // transform all members coordinates
- void transform(const basegfx::B2DHomMatrix& rMatrix);
};
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/inc/svx/sdr/overlay/overlaypolypolygon.hxx b/svx/inc/svx/sdr/overlay/overlaypolypolygon.hxx
index 276ad2b6bc5b..d7dc72df4d59 100644
--- a/svx/inc/svx/sdr/overlay/overlaypolypolygon.hxx
+++ b/svx/inc/svx/sdr/overlay/overlaypolypolygon.hxx
@@ -46,11 +46,8 @@ namespace sdr
// geometry
basegfx::B2DPolyPolygon maPolyPolygon;
- // Draw geometry
- virtual void drawGeometry(OutputDevice& rOutputDevice);
-
- // Create the BaseRange. This method needs to calculate maBaseRange.
- virtual void createBaseRange(OutputDevice& rOutputDevice);
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
public:
OverlayPolyPolygonStriped(const basegfx::B2DPolyPolygon& rPolyPolygon);
@@ -60,33 +57,8 @@ namespace sdr
basegfx::B2DPolyPolygon getPolyPolygon() const { return maPolyPolygon; }
void setPolyPolygon(const basegfx::B2DPolyPolygon& rNew);
- // Hittest with logical coordinates
- virtual sal_Bool isHit(const basegfx::B2DPoint& rPos, double fTol = 0.0) const;
-
- // transform object coordinates. Needs to transform maSecondPosition
- // and maThirdPosition.
- virtual void transform(const basegfx::B2DHomMatrix& rMatrix);
- };
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace overlay
- {
- class OverlayPolyPolygon : public OverlayPolyPolygonStriped
- {
- protected:
- // Draw geometry
- virtual void drawGeometry(OutputDevice& rOutputDevice);
-
- public:
- OverlayPolyPolygon(
- const basegfx::B2DPolyPolygon& rPolyPolygon,
- Color aPolygonColor = Color(COL_BLACK));
- virtual ~OverlayPolyPolygon();
+ // react on stripe definition change
+ virtual void stripeDefinitionHasChanged();
};
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/inc/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx b/svx/inc/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx
index 1ca1a0a7d18a..e94cfefcf327 100644
--- a/svx/inc/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx
+++ b/svx/inc/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx
@@ -41,20 +41,14 @@ namespace sdr
{
namespace overlay
{
- class OverlayPrimitive2DSequenceObject : public OverlayObjectWithBasePosition
+ class SVX_DLLPUBLIC OverlayPrimitive2DSequenceObject : public OverlayObjectWithBasePosition
{
protected:
// the sequence of primitives to show
const drawinglayer::primitive2d::Primitive2DSequence maSequence;
- // Draw geometry
- virtual void drawGeometry(OutputDevice& rOutputDevice);
-
- // Create the BaseRange. This method needs to calculate maBaseRange.
- virtual void createBaseRange(OutputDevice& rOutputDevice);
-
- // Hittest with logical coordinates. Default tests against maBaseRange.
- virtual sal_Bool isHit(const basegfx::B2DPoint& rPos, double fTol = 0.0) const;
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
private:
// internal helper to create a drawinglayer::geometry::ViewInformation2D
diff --git a/svx/inc/svx/sdr/overlay/overlayrollingrectangle.hxx b/svx/inc/svx/sdr/overlay/overlayrollingrectangle.hxx
index 81233e0d0252..3120f02d950b 100644
--- a/svx/inc/svx/sdr/overlay/overlayrollingrectangle.hxx
+++ b/svx/inc/svx/sdr/overlay/overlayrollingrectangle.hxx
@@ -52,18 +52,15 @@ namespace sdr
// Flag to switch on/off the bounds itself
unsigned mbShowBounds : 1;
- // Draw geometry
- virtual void drawGeometry(OutputDevice& rOutputDevice);
-
- // Create the BaseRange. This method needs to calculate maBaseRange.
- virtual void createBaseRange(OutputDevice& rOutputDevice);
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
public:
OverlayRollingRectangleStriped(
const basegfx::B2DPoint& rBasePos,
const basegfx::B2DPoint& rSecondPos,
- sal_Bool bExtendedLines = sal_False,
- sal_Bool bShowBounds = sal_True);
+ bool bExtendedLines = false,
+ bool bShowBounds = true);
virtual ~OverlayRollingRectangleStriped();
// change second position
@@ -71,42 +68,15 @@ namespace sdr
void setSecondPosition(const basegfx::B2DPoint& rNew);
// change extended lines
- sal_Bool getExtendedLines() const { return mbExtendedLines; }
- void setExtendedLines(sal_Bool bNew);
+ bool getExtendedLines() const { return mbExtendedLines; }
+ void setExtendedLines(bool bNew);
// change show bounds
- sal_Bool getShowBounds() const { return mbShowBounds; }
- void setShowBounds(sal_Bool bNew);
-
- // Hittest with logical coordinates
- virtual sal_Bool isHit(const basegfx::B2DPoint& rPos, double fTol = 0.0) const;
-
- // transform object coordinates. Needs to transform maSecondPosition.
- virtual void transform(const basegfx::B2DHomMatrix& rMatrix);
- };
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace overlay
- {
- class OverlayRollingRectangle : public OverlayRollingRectangleStriped
- {
- protected:
- // Draw geometry
- virtual void drawGeometry(OutputDevice& rOutputDevice);
+ bool getShowBounds() const { return mbShowBounds; }
+ void setShowBounds(bool bNew);
- public:
- OverlayRollingRectangle(
- const basegfx::B2DPoint& rBasePos,
- const basegfx::B2DPoint& rSecondPos,
- Color aLineColor = Color(COL_BLACK),
- sal_Bool bExtendedLines = sal_False,
- sal_Bool bShowBounds = sal_True);
- virtual ~OverlayRollingRectangle();
+ // react on stripe definition change
+ virtual void stripeDefinitionHasChanged();
};
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/inc/svx/sdr/overlay/overlaytools.hxx b/svx/inc/svx/sdr/overlay/overlaytools.hxx
new file mode 100644
index 000000000000..d9a1b34dd8f6
--- /dev/null
+++ b/svx/inc/svx/sdr/overlay/overlaytools.hxx
@@ -0,0 +1,281 @@
+/*************************************************************************
+ *
+ * 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: overlayobject.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * 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 _SDR_OVERLAY_OVERLAYTOOLS_HXX
+#define _SDR_OVERLAY_OVERLAYTOOLS_HXX
+
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <vcl/bitmapex.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// Overlay helper class which holds a BotmapEx which is to be visualized
+// at the given logic position with the Bitmap's pixel size, unscaled and
+// unrotated (like a marker). The discrete pixel on the bitmap assocciated
+// with the target position is given in discrete X,Y coordinates
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class OverlayBitmapExPrimitive : public DiscreteMetricDependentPrimitive2D
+ {
+ private:
+ // The BitmapEx to use, PixelSize is used
+ BitmapEx maBitmapEx;
+
+ // The logic position
+ basegfx::B2DPoint maBasePosition;
+
+ // The pixel inside the BitmapEx which is assocciated with
+ // the target position (offset in the bitmap)
+ sal_uInt16 mnCenterX;
+ sal_uInt16 mnCenterY;
+
+ protected:
+ virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ OverlayBitmapExPrimitive(
+ const BitmapEx& rBitmapEx,
+ const basegfx::B2DPoint& rBasePosition,
+ sal_uInt16 nCenterX,
+ sal_uInt16 nCenterY);
+
+ // data access
+ const BitmapEx& getBitmapEx() const { return maBitmapEx; }
+ const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
+ sal_uInt16 getCenterX() const { return mnCenterX; }
+ sal_uInt16 getCenterY() const { return mnCenterY; }
+
+ // compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// Overlay helper class for a crosshair
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class OverlayCrosshairPrimitive : public ViewportDependentPrimitive2D
+ {
+ private:
+ // The logic position
+ basegfx::B2DPoint maBasePosition;
+
+ // The stripe colors and legth
+ basegfx::BColor maRGBColorA;
+ basegfx::BColor maRGBColorB;
+ double mfDiscreteDashLength;
+
+ protected:
+ virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ OverlayCrosshairPrimitive(
+ const basegfx::B2DPoint& rBasePosition,
+ const basegfx::BColor& rRGBColorA,
+ const basegfx::BColor& rRGBColorB,
+ double fDiscreteDashLength);
+
+ // data access
+ const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
+ const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
+ const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
+ double getDiscreteDashLength() const { return mfDiscreteDashLength; }
+
+ // compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// Overlay helper class for a hatch rectangle as used e.g. for text object
+// selection hilighting
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class OverlayHatchRectanglePrimitive : public DiscreteMetricDependentPrimitive2D
+ {
+ private:
+ // the logic rectangle definition
+ basegfx::B2DRange maObjectRange;
+
+ // the hatch definition
+ double mfDiscreteHatchDistance;
+ double mfHatchRotation;
+ basegfx::BColor maHatchColor;
+
+ // the dscrete grow and shrink of the box
+ double mfDiscreteGrow;
+ double mfDiscreteShrink;
+
+ // the rotation of the primitive itself
+ double mfRotation;
+
+ protected:
+ virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ OverlayHatchRectanglePrimitive(
+ const basegfx::B2DRange& rObjectRange,
+ double fDiscreteHatchDistance,
+ double fHatchRotation,
+ const basegfx::BColor& rHatchColor,
+ double fDiscreteGrow,
+ double fDiscreteShrink,
+ double fRotation);
+
+ // data access
+ const basegfx::B2DRange& getObjectRange() const { return maObjectRange; }
+ double getDiscreteHatchDistance() const { return mfDiscreteHatchDistance; }
+ double getHatchRotation() const { return mfHatchRotation; }
+ const basegfx::BColor& getHatchColor() const { return maHatchColor; }
+ double getDiscreteGrow() const { return mfDiscreteGrow; }
+ double getDiscreteShrink() const { return mfDiscreteShrink; }
+ double getRotation() const { return mfRotation; }
+
+ // compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// Overlay helper class for a striped helpline
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ enum HelplineStyle
+ {
+ HELPLINESTYLE_POINT,
+ HELPLINESTYLE_VERTICAL,
+ HELPLINESTYLE_HORIZONTAL
+ };
+
+ class OverlayHelplineStripedPrimitive : public ViewportDependentPrimitive2D
+ {
+ private:
+ // The logic position
+ basegfx::B2DPoint maBasePosition;
+
+ // the style
+ HelplineStyle meStyle;
+
+ // The stripe colors and legth
+ basegfx::BColor maRGBColorA;
+ basegfx::BColor maRGBColorB;
+ double mfDiscreteDashLength;
+
+ protected:
+ virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ OverlayHelplineStripedPrimitive(
+ const basegfx::B2DPoint& rBasePosition,
+ HelplineStyle eStyle,
+ const basegfx::BColor& rRGBColorA,
+ const basegfx::BColor& rRGBColorB,
+ double fDiscreteDashLength);
+
+ // data access
+ const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
+ HelplineStyle getStyle() const { return meStyle; }
+ const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
+ const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
+ double getDiscreteDashLength() const { return mfDiscreteDashLength; }
+
+ // compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// Overlay helper class for rolling rectangle helplines. This primitive is
+// only for the extended lines to the ends of the view
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class OverlayRollingRectanglePrimitive : public ViewportDependentPrimitive2D
+ {
+ private:
+ // The logic range
+ basegfx::B2DRange maRollingRectangle;
+
+ // The stripe colors and legth
+ basegfx::BColor maRGBColorA;
+ basegfx::BColor maRGBColorB;
+ double mfDiscreteDashLength;
+
+ protected:
+ virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ OverlayRollingRectanglePrimitive(
+ const basegfx::B2DRange& aRollingRectangle,
+ const basegfx::BColor& rRGBColorA,
+ const basegfx::BColor& rRGBColorB,
+ double fDiscreteDashLength);
+
+ // data access
+ const basegfx::B2DRange& getRollingRectangle() const { return maRollingRectangle; }
+ const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
+ const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
+ double getDiscreteDashLength() const { return mfDiscreteDashLength; }
+
+ // compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_OVERLAY_OVERLAYTOOLS_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/overlay/overlaytriangle.hxx b/svx/inc/svx/sdr/overlay/overlaytriangle.hxx
index b1d7a16ac72e..97b391047ba7 100644
--- a/svx/inc/svx/sdr/overlay/overlaytriangle.hxx
+++ b/svx/inc/svx/sdr/overlay/overlaytriangle.hxx
@@ -39,25 +39,23 @@ namespace sdr
{
namespace overlay
{
- class OverlayTriangleStriped : public OverlayObjectWithBasePosition
+ class OverlayTriangle : public OverlayObjectWithBasePosition
{
protected:
// second and third position in pixel
basegfx::B2DPoint maSecondPosition;
basegfx::B2DPoint maThirdPosition;
- // Draw geometry
- virtual void drawGeometry(OutputDevice& rOutputDevice);
-
- // Create the BaseRange. This method needs to calculate maBaseRange.
- virtual void createBaseRange(OutputDevice& rOutputDevice);
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
public:
- OverlayTriangleStriped(
+ OverlayTriangle(
const basegfx::B2DPoint& rBasePos,
const basegfx::B2DPoint& rSecondPos,
- const basegfx::B2DPoint& rThirdPos);
- virtual ~OverlayTriangleStriped();
+ const basegfx::B2DPoint& rThirdPos,
+ Color aTriangleColor);
+ virtual ~OverlayTriangle();
// change second position
const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; }
@@ -66,36 +64,6 @@ namespace sdr
// change third position
const basegfx::B2DPoint& getThirdPosition() const { return maThirdPosition; }
void setThirdPosition(const basegfx::B2DPoint& rNew);
-
- // Hittest with logical coordinates
- virtual sal_Bool isHit(const basegfx::B2DPoint& rPos, double fTol = 0.0) const;
-
- // transform object coordinates. Needs to transform maSecondPosition
- // and maThirdPosition.
- virtual void transform(const basegfx::B2DHomMatrix& rMatrix);
- };
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace overlay
- {
- class OverlayTriangle : public OverlayTriangleStriped
- {
- protected:
- // Draw geometry
- virtual void drawGeometry(OutputDevice& rOutputDevice);
-
- public:
- OverlayTriangle(
- const basegfx::B2DPoint& rBasePos,
- const basegfx::B2DPoint& rSecondPos,
- const basegfx::B2DPoint& rThirdPos,
- Color aTriangleColor = Color(COL_BLACK));
- virtual ~OverlayTriangle();
};
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx b/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx
index a9b3767c3c32..e4a8fa01902f 100644
--- a/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx
+++ b/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx
@@ -71,7 +71,16 @@ namespace drawinglayer
attribute::SdrLineStartEndAttribute* createNewSdrLineStartEndAttribute(const SfxItemSet& rSet, double fWidth);
attribute::SdrShadowAttribute* createNewSdrShadowAttribute(const SfxItemSet& rSet);
attribute::SdrFillAttribute* createNewSdrFillAttribute(const SfxItemSet& rSet);
- attribute::SdrTextAttribute* createNewSdrTextAttribute(const SfxItemSet& rSet, const SdrText& rText);
+
+ // #i101508# Support handing over given text-to-border distances
+ attribute::SdrTextAttribute* createNewSdrTextAttribute(
+ const SfxItemSet& rSet,
+ const SdrText& rText,
+ const sal_Int32* pLeft = 0,
+ const sal_Int32* pUpper = 0,
+ const sal_Int32* pRight = 0,
+ const sal_Int32* pLower = 0);
+
attribute::FillGradientAttribute* createNewTransparenceGradientAttribute(const SfxItemSet& rSet);
attribute::SdrFillBitmapAttribute* createNewSdrFillBitmapAttribute(const SfxItemSet& rSet);
attribute::SdrShadowTextAttribute* createNewSdrShadowTextAttribute(
@@ -83,7 +92,15 @@ namespace drawinglayer
attribute::SdrLineFillShadowAttribute* createNewSdrLineFillShadowAttribute(const SfxItemSet& rSet, bool bSuppressFill);
attribute::SdrSceneAttribute* createNewSdrSceneAttribute(const SfxItemSet& rSet);
attribute::SdrLightingAttribute* createNewSdrLightingAttribute(const SfxItemSet& rSet);
- attribute::SdrFillTextAttribute* createNewSdrFillTextAttribute(const SfxItemSet& rSet, const SdrText* pSdrText);
+
+ // #i101508# Support handing over given text-to-border distances
+ attribute::SdrFillTextAttribute* createNewSdrFillTextAttribute(
+ const SfxItemSet& rSet,
+ const SdrText* pSdrText,
+ const sal_Int32* pLeft = 0,
+ const sal_Int32* pUpper = 0,
+ const sal_Int32* pRight = 0,
+ const sal_Int32* pLower = 0);
// helpers
void calculateRelativeCornerRadius(sal_Int32 nRadius, const ::basegfx::B2DRange& rObjectRange, double& rfCornerRadiusX, double& rfCornerRadiusY);
diff --git a/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx
index 29d905c697ec..97b12b72d4a5 100644
--- a/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx
+++ b/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx
@@ -49,9 +49,9 @@ namespace drawinglayer
class SdrPathPrimitive2D : public BasePrimitive2D
{
private:
- ::basegfx::B2DHomMatrix maTransform;
+ basegfx::B2DHomMatrix maTransform;
attribute::SdrLineFillShadowTextAttribute maSdrLFSTAttribute;
- ::basegfx::B2DPolyPolygon maUnitPolyPolygon;
+ basegfx::B2DPolyPolygon maUnitPolyPolygon;
protected:
// local decomposition.
@@ -59,14 +59,14 @@ namespace drawinglayer
public:
SdrPathPrimitive2D(
- const ::basegfx::B2DHomMatrix& rTransform,
+ const basegfx::B2DHomMatrix& rTransform,
const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute,
- const ::basegfx::B2DPolyPolygon& rUnitPolyPolygon);
+ const basegfx::B2DPolyPolygon& rUnitPolyPolygon);
// data access
- const ::basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
const attribute::SdrLineFillShadowTextAttribute& getSdrLFSTAttribute() const { return maSdrLFSTAttribute; }
- const ::basegfx::B2DPolyPolygon& getUnitPolyPolygon() const { return maUnitPolyPolygon; }
+ const basegfx::B2DPolyPolygon& getUnitPolyPolygon() const { return maUnitPolyPolygon; }
// compare operator
virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
diff --git a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx
index 8579b87e9470..6dd60b45d2d5 100644
--- a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx
+++ b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx
@@ -36,8 +36,10 @@
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <com/sun/star/drawing/XDrawPage.hpp>
-#include <boost/shared_ptr.hpp>
#include <svx/outlobj.hxx>
+#include <tools/color.hxx>
+#include <svx/sdr/attribute/sdrformtextattribute.hxx>
+#include <tools/weakbase.hxx>
//////////////////////////////////////////////////////////////////////////////
// predefines
@@ -54,11 +56,11 @@ namespace drawinglayer
private:
// The text model data; this sould later just be the OutlinerParaObject or
// something equal
- const SdrText& mrSdrText; // text model data
+ ::tools::WeakReference< SdrText > mrSdrText;
// #i97628#
- // The text content; now as OutlinerParaObject* and in exclusive, local, cloned
- // form as needed in a primitive
+ // The text content; now as local OutlinerParaObject copy (internally RefCounted and
+ // COW) and in exclusive, local form as needed in a primitive
const OutlinerParaObject maOutlinerParaObject;
// remeber last VisualizingPage for which a decomposition was made. If the new target
@@ -67,6 +69,18 @@ namespace drawinglayer
// field renderings in SubGeometry and MasterPage mnode
com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > mxLastVisualizingPage;
+ // remember last PageNumber for which a decomposition was made. This is only used
+ // when mbContainsPageField is true, else it is 0
+ sal_Int16 mnLastPageNumber;
+
+ // remember last PageCount for which a decomposition was made. This is only used
+ // when mbContainsPageCountField is true, else it is 0
+ sal_Int16 mnLastPageCount;
+
+ // #i101443# remember last TextBackgroundColor to decide if a new decomposition is
+ // needed because of background color change
+ Color maLastTextBackgroundColor;
+
// bitfield
// remember if last decomposition was with or without spell checker. In this special
// case the get2DDecomposition implementation has to take care of this aspect. This is
@@ -75,6 +89,8 @@ namespace drawinglayer
// is there a PageNumber, Header, Footer or DateTimeField used? Evaluated at construction
unsigned mbContainsPageField : 1;
+ unsigned mbContainsPageCountField : 1;
+ unsigned mbContainsOtherFields : 1;
protected:
// support for XTEXT_PAINTSHAPE_BEGIN/XTEXT_PAINTSHAPE_END Metafile comments
@@ -85,11 +101,11 @@ namespace drawinglayer
public:
SdrTextPrimitive2D(
- const SdrText& rSdrText,
+ const SdrText* pSdrText,
const OutlinerParaObject& rOutlinerParaObjectPtr);
// get data
- const SdrText& getSdrText() const { return mrSdrText; }
+ const SdrText* getSdrText() const { return mrSdrText.get(); }
const OutlinerParaObject& getOutlinerParaObject() const { return maOutlinerParaObject; }
// compare operator
@@ -100,7 +116,7 @@ namespace drawinglayer
virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
// transformed clone operator
- virtual SdrTextPrimitive2D* createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const = 0;
+ virtual SdrTextPrimitive2D* createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const = 0;
};
} // end of namespace primitive2d
} // end of namespace drawinglayer
@@ -114,8 +130,11 @@ namespace drawinglayer
class SdrContourTextPrimitive2D : public SdrTextPrimitive2D
{
private:
- ::basegfx::B2DPolyPolygon maUnitPolyPolygon; // unit contour polygon (scaled to [0.0 .. 1.0])
- ::basegfx::B2DHomMatrix maObjectTransform; // complete contour polygon transform (scale, rotate, shear, translate)
+ // unit contour polygon (scaled to [0.0 .. 1.0])
+ basegfx::B2DPolyPolygon maUnitPolyPolygon;
+
+ // complete contour polygon transform (scale, rotate, shear, translate)
+ basegfx::B2DHomMatrix maObjectTransform;
protected:
// local decomposition.
@@ -123,20 +142,20 @@ namespace drawinglayer
public:
SdrContourTextPrimitive2D(
- const SdrText& rSdrText,
+ const SdrText* pSdrText,
const OutlinerParaObject& rOutlinerParaObjectPtr,
- const ::basegfx::B2DPolyPolygon& rUnitPolyPolygon,
- const ::basegfx::B2DHomMatrix& rObjectTransform);
+ const basegfx::B2DPolyPolygon& rUnitPolyPolygon,
+ const basegfx::B2DHomMatrix& rObjectTransform);
// get data
- const ::basegfx::B2DPolyPolygon& getUnitPolyPolygon() const { return maUnitPolyPolygon; }
- const ::basegfx::B2DHomMatrix& getObjectTransform() const { return maObjectTransform; }
+ const basegfx::B2DPolyPolygon& getUnitPolyPolygon() const { return maUnitPolyPolygon; }
+ const basegfx::B2DHomMatrix& getObjectTransform() const { return maObjectTransform; }
// compare operator
virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
// transformed clone operator
- virtual SdrTextPrimitive2D* createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const;
+ virtual SdrTextPrimitive2D* createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const;
// provide unique ID
DeclPrimitrive2DIDBlock()
@@ -153,7 +172,11 @@ namespace drawinglayer
class SdrPathTextPrimitive2D : public SdrTextPrimitive2D
{
private:
- ::basegfx::B2DPolyPolygon maPathPolyPolygon; // the path to use. Each paragraph will use one Polygon.
+ // the path to use. Each paragraph will use one Polygon.
+ basegfx::B2DPolyPolygon maPathPolyPolygon;
+
+ // the Fontwork parameters
+ attribute::SdrFormTextAttribute maSdrFormTextAttribute;
protected:
// local decomposition.
@@ -161,18 +184,20 @@ namespace drawinglayer
public:
SdrPathTextPrimitive2D(
- const SdrText& rSdrText,
+ const SdrText* pSdrText,
const OutlinerParaObject& rOutlinerParaObjectPtr,
- const ::basegfx::B2DPolyPolygon& rPathPolyPolygon);
+ const basegfx::B2DPolyPolygon& rPathPolyPolygon,
+ const attribute::SdrFormTextAttribute& rSdrFormTextAttribute);
// get data
- const ::basegfx::B2DPolyPolygon& getPathPolyPolygon() const { return maPathPolyPolygon; }
+ const basegfx::B2DPolyPolygon& getPathPolyPolygon() const { return maPathPolyPolygon; }
+ const attribute::SdrFormTextAttribute& getSdrFormTextAttribute() const { return maSdrFormTextAttribute; }
// compare operator
virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
// transformed clone operator
- virtual SdrTextPrimitive2D* createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const;
+ virtual SdrTextPrimitive2D* createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const;
// provide unique ID
DeclPrimitrive2DIDBlock()
@@ -189,7 +214,8 @@ namespace drawinglayer
class SdrBlockTextPrimitive2D : public SdrTextPrimitive2D
{
private:
- ::basegfx::B2DHomMatrix maTextRangeTransform; // text range transformation from unit range ([0.0 .. 1.0]) to text range
+ // text range transformation from unit range ([0.0 .. 1.0]) to text range
+ basegfx::B2DHomMatrix maTextRangeTransform;
// bitfield
unsigned mbUnlimitedPage : 1; // force layout with no text break
@@ -202,9 +228,9 @@ namespace drawinglayer
public:
SdrBlockTextPrimitive2D(
- const SdrText& rSdrText,
+ const SdrText* pSdrText,
const OutlinerParaObject& rOutlinerParaObjectPtr,
- const ::basegfx::B2DHomMatrix& rTextRangeTransform,
+ const basegfx::B2DHomMatrix& rTextRangeTransform,
bool bUnlimitedPage,
bool bCellText,
bool bWordWrap);
@@ -219,7 +245,7 @@ namespace drawinglayer
virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
// transformed clone operator
- virtual SdrTextPrimitive2D* createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const;
+ virtual SdrTextPrimitive2D* createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const;
// provide unique ID
DeclPrimitrive2DIDBlock()
@@ -236,7 +262,8 @@ namespace drawinglayer
class SdrStretchTextPrimitive2D : public SdrTextPrimitive2D
{
private:
- ::basegfx::B2DHomMatrix maTextRangeTransform; // text range transformation from unit range ([0.0 .. 1.0]) to text range
+ // text range transformation from unit range ([0.0 .. 1.0]) to text range
+ basegfx::B2DHomMatrix maTextRangeTransform;
protected:
// local decomposition.
@@ -244,18 +271,18 @@ namespace drawinglayer
public:
SdrStretchTextPrimitive2D(
- const SdrText& rSdrText,
+ const SdrText* pSdrText,
const OutlinerParaObject& rOutlinerParaObjectPtr,
- const ::basegfx::B2DHomMatrix& rTextRangeTransform);
+ const basegfx::B2DHomMatrix& rTextRangeTransform);
// get data
- const ::basegfx::B2DHomMatrix& getTextRangeTransform() const { return maTextRangeTransform; }
+ const basegfx::B2DHomMatrix& getTextRangeTransform() const { return maTextRangeTransform; }
// compare operator
virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
// transformed clone operator
- virtual SdrTextPrimitive2D* createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const;
+ virtual SdrTextPrimitive2D* createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const;
// provide unique ID
DeclPrimitrive2DIDBlock()
diff --git a/svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx b/svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx
index d7dbf9f4ad9c..623158f21d68 100644
--- a/svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx
+++ b/svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx
@@ -52,6 +52,12 @@
#define PRIMITIVE2D_ID_SDRSTRETCHTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 13)
#define PRIMITIVE2D_ID_SDRCELLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 14)
#define PRIMITIVE2D_ID_SDRBORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 15)
+#define PRIMITIVE2D_ID_OVERLAYBITMAPEXPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 16)
+#define PRIMITIVE2D_ID_OVERLAYCROSSHAIRPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 17)
+#define PRIMITIVE2D_ID_OVERLAYHATCHRECTANGLEPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 18)
+#define PRIMITIVE2D_ID_OVERLAYHELPLINESTRIPEDPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 19)
+#define PRIMITIVE2D_ID_OVERLAYROLLINGRECTANGLEPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 20)
+#define PRIMITIVE2D_ID_SDRCONTROLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 21)
//////////////////////////////////////////////////////////////////////////////
diff --git a/svx/inc/svx/sdr/properties/properties.hxx b/svx/inc/svx/sdr/properties/properties.hxx
index d8b374a18042..2c4512236cb7 100644
--- a/svx/inc/svx/sdr/properties/properties.hxx
+++ b/svx/inc/svx/sdr/properties/properties.hxx
@@ -184,6 +184,11 @@ namespace sdr
// ClearItemAndBroadcast() and SetItemSetAndBroadcast(), see above.
// But also from inside SdrObjects.
void BroadcastItemChange(const ItemChangeBroadcaster& rChange);
+
+ // #i101556# add versioning mechanism; used from e.g. text attribute set to
+ // allow detection of e.g. style sheet or single text attribute changes. The
+ // default implementation returns 0 (zero)
+ virtual sal_uInt32 getVersion() const;
};
} // end of namespace properties
} // end of namespace sdr
diff --git a/svx/inc/svx/sdr/properties/textproperties.hxx b/svx/inc/svx/sdr/properties/textproperties.hxx
index 424b76ba7610..77a19818f55a 100644
--- a/svx/inc/svx/sdr/properties/textproperties.hxx
+++ b/svx/inc/svx/sdr/properties/textproperties.hxx
@@ -42,6 +42,10 @@ namespace sdr
{
class SVX_DLLPUBLIC TextProperties : public AttributeProperties
{
+ private:
+ // #i101556# versioning support
+ sal_uInt32 maVersion;
+
protected:
// create a new itemset
virtual SfxItemSet& CreateObjectSpecificItemSet(SfxItemPool& rPool);
@@ -82,6 +86,9 @@ namespace sdr
// Set single item at the local ItemSet. *Does not use* AllowItemChange(),
// ItemChange(), PostItemChange() and ItemSetChanged() calls.
void SetObjectItemNoBroadcast(const SfxPoolItem& rItem);
+
+ // #i101556# versioning support
+ virtual sal_uInt32 getVersion() const;
};
} // end of namespace properties
} // end of namespace sdr
diff --git a/svx/inc/svx/sdrhittesthelper.hxx b/svx/inc/svx/sdrhittesthelper.hxx
new file mode 100644
index 000000000000..037f7fa813a5
--- /dev/null
+++ b/svx/inc/svx/sdrhittesthelper.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * 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: svdetc.hxx,v $
+ * $Revision: 1.4.152.1 $
+ *
+ * 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 _SDRHITTESTHELPER_HXX
+#define _SDRHITTESTHELPER_HXX
+
+#include "svx/svxdllapi.h"
+#include <tools/string.hxx>
+#include <tools/gen.hxx>
+
+/////////////////////////////////////////////////////////////////////
+// #i101872# new Object HitTest as View-tooling
+
+class SdrObject;
+class SdrPageView;
+class SetOfByte;
+class SdrObjList;
+namespace sdr { namespace contact { class ViewObjectContact; }}
+namespace basegfx { class B2DPoint; }
+
+/////////////////////////////////////////////////////////////////////
+// Wrappers for classic Sdr* Mode/View classes
+
+SVX_DLLPUBLIC SdrObject* SdrObjectPrimitiveHit(
+ const SdrObject& rObject,
+ const Point& rPnt,
+ sal_uInt16 nTol,
+ const SdrPageView& rSdrPageView,
+ const SetOfByte* pVisiLayer,
+ bool bTextOnly);
+
+SVX_DLLPUBLIC SdrObject* SdrObjListPrimitiveHit(
+ const SdrObjList& rList,
+ const Point& rPnt,
+ sal_uInt16 nTol,
+ const SdrPageView& rSdrPageView,
+ const SetOfByte* pVisiLayer,
+ bool bTextOnly);
+
+/////////////////////////////////////////////////////////////////////
+// the pure HitTest based on a VOC
+
+SVX_DLLPUBLIC bool ViewObjectContactPrimitiveHit(
+ const sdr::contact::ViewObjectContact& rVOC,
+ const basegfx::B2DPoint& rHitPosition,
+ double fLogicHitTolerance,
+ bool bTextOnly);
+
+/////////////////////////////////////////////////////////////////////
+
+#endif //_SDRHITTESTHELPER_HXX
+
+/////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/inc/svx/svdedxv.hxx b/svx/inc/svx/svdedxv.hxx
index ccfc74ab00af..17333ad74459 100644
--- a/svx/inc/svx/svdedxv.hxx
+++ b/svx/inc/svx/svdedxv.hxx
@@ -130,9 +130,6 @@ protected:
void ImpPaintOutlinerView(OutlinerView& rOutlView, const Rectangle& rRect) const;
void ImpInvalidateOutlinerView(OutlinerView& rOutlView) const;
- // Hintergrundfarbe fuer die Outlinerviews bestimmen
- Color ImpGetTextEditBackgroundColor() const;
-
// Feststellen, ob der gesamte Text markiert ist. Liefert auch TRUE wenn
// kein Text vorhanden ist.
BOOL ImpIsTextEditAllSelected() const;
diff --git a/svx/inc/svx/svdetc.hxx b/svx/inc/svx/svdetc.hxx
index 40ece921f6a2..493c8476c459 100644
--- a/svx/inc/svx/svdetc.hxx
+++ b/svx/inc/svx/svdetc.hxx
@@ -344,8 +344,12 @@ SVX_DLLPUBLIC String GetResourceString(sal_uInt16 nResID);
}
+/////////////////////////////////////////////////////////////////////
+// #i101872# isolated GetTextEditBackgroundColor for tooling
+class SdrObjEditView;
+
+SVX_DLLPUBLIC Color GetTextEditBackgroundColor(const SdrObjEditView& rView);
/////////////////////////////////////////////////////////////////////
#endif //_SVDETC_HXX
-
diff --git a/svx/inc/svx/svdfppt.hxx b/svx/inc/svx/svdfppt.hxx
index 40c851d1c949..5a73bea5052f 100644
--- a/svx/inc/svx/svdfppt.hxx
+++ b/svx/inc/svx/svdfppt.hxx
@@ -989,6 +989,18 @@ struct PPTStyleTextPropReader
PPTStyleTextPropReader( SvStream& rIn, SdrPowerPointImport&, const DffRecordHeader& rClientTextBoxHd,
PPTTextRulerInterpreter& rInterpreter, const DffRecordHeader& rExtParaHd, sal_uInt32 nTextInstance );
+ void Init( SvStream& rIn, SdrPowerPointImport&, const DffRecordHeader& rClientTextBoxHd,
+ PPTTextRulerInterpreter& rInterpreter, const DffRecordHeader& rExtParaHd, sal_uInt32 nTextInstance );
+ void ReadParaProps( SvStream& rIn, SdrPowerPointImport& rMan, const DffRecordHeader& rTextHeader,
+ const String& aString, PPTTextRulerInterpreter& rRuler,
+ sal_uInt32& nCharCount, sal_Bool& bTextPropAtom );
+ void ReadCharProps( SvStream& rIn, PPTCharPropSet& aCharPropSet, const String& aString,
+ sal_uInt32& nCharCount, sal_uInt32 nCharAnzRead,
+ sal_Bool& bTextPropAtom, sal_uInt32 nExtParaPos,
+ const std::vector< StyleTextProp9 >& aStyleTextProp9,
+ sal_uInt32& nExtParaFlags, sal_uInt16& nBuBlip,
+ sal_uInt16& nHasAnm, sal_uInt32& nAnmScheme );
+
~PPTStyleTextPropReader();
};
diff --git a/svx/inc/svx/svdhdl.hxx b/svx/inc/svx/svdhdl.hxx
index ab4abfdd7458..11d400b85b8a 100644
--- a/svx/inc/svx/svdhdl.hxx
+++ b/svx/inc/svx/svdhdl.hxx
@@ -245,7 +245,7 @@ public:
sal_uInt32 GetSourceHdlNum() const { return nSourceHdlNum; }
virtual Pointer GetPointer() const;
- virtual bool IsHdlHit(const Point& rPnt) const;
+ bool IsHdlHit(const Point& rPnt) const;
// #97016# II
virtual BOOL IsFocusHdl() const;
@@ -363,7 +363,6 @@ public:
virtual ~SdrHdlLine();
virtual Pointer GetPointer() const;
- virtual bool IsHdlHit(const Point& rPnt) const;
};
// Ein SdrHdlBezWgt hat Kenntnis von seinem "BasisHandle". Seine Draw-Methode
diff --git a/svx/inc/svx/svdmrkv.hxx b/svx/inc/svx/svdmrkv.hxx
index c9a590feccc5..88d0b941273d 100644
--- a/svx/inc/svx/svdmrkv.hxx
+++ b/svx/inc/svx/svdmrkv.hxx
@@ -180,9 +180,8 @@ protected:
void ForceUndirtyMrkPnt() const { if (bMrkPntDirty) UndirtyMrkPnt(); }
//HMHvoid ImpShowMarkHdl(bool bNoRefHdl);
- SdrObject* ImpCheckObjHit(const Point& rPnt, USHORT nTol, SdrObject* pObj, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay) const;
- SdrObject* ImpCheckObjHit(const Point& rPnt, USHORT nTol, SdrObjList* pOL, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay, SdrObject*& rpRootObj) const;
- BOOL ImpIsObjHit(const Point& rPnt, USHORT nTol, SdrObject* pObj, SdrPageView* pPV, ULONG nOptions) const { return ImpCheckObjHit(rPnt,nTol,pObj,pPV,nOptions,NULL)!=NULL; }
+ virtual SdrObject* CheckSingleSdrObjectHit(const Point& rPnt, USHORT nTol, SdrObject* pObj, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay) const;
+ virtual SdrObject* CheckSingleSdrObjectHit(const Point& rPnt, USHORT nTol, SdrObjList* pOL, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay, SdrObject*& rpRootObj) const;
BOOL ImpIsFrameHandles() const;
void ImpTakeDescriptionStr(USHORT nStrCacheID, String& rStr, USHORT nVal=0, USHORT nOpt=0) const;
@@ -309,9 +308,9 @@ public:
// SDRSEARCH_DEEP SDRSEARCH_ALSOONMASTER SDRSEARCH_TESTMARKABLE SDRSEARCH_TESTTEXTEDIT
// SDRSEARCH_WITHTEXT SDRSEARCH_TESTTEXTAREA SDRSEARCH_BACKWARD SDRSEARCH_MARKED
// SDRSEARCH_WHOLEPAGE
- BOOL PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, ULONG nOptions, SdrObject** ppRootObj, ULONG* pnMarkNum=NULL, USHORT* pnPassNum=NULL) const;
- BOOL PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, ULONG nOptions=0) const;
- BOOL PickObj(const Point& rPnt, SdrObject*& rpObj, SdrPageView*& rpPV, ULONG nOptions=0) const { return PickObj(rPnt,nHitTolLog,rpObj,rpPV,nOptions); }
+ virtual BOOL PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, ULONG nOptions, SdrObject** ppRootObj, ULONG* pnMarkNum=NULL, USHORT* pnPassNum=NULL) const;
+ virtual BOOL PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, ULONG nOptions=0) const;
+ // BOOL PickObj(const Point& rPnt, SdrObject*& rpObj, SdrPageView*& rpPV, ULONG nOptions=0) const { return PickObj(rPnt,nHitTolLog,rpObj,rpPV,nOptions); }
BOOL MarkObj(const Point& rPnt, short nTol=-2, BOOL bToggle=FALSE, BOOL bDeep=FALSE);
// Pick: Unterstuetzte Optionen fuer nOptions sind SDRSEARCH_PASS2BOUND und SDRSEARCH_PASS3NEAREST
diff --git a/svx/inc/svx/svdoashp.hxx b/svx/inc/svx/svdoashp.hxx
index a75c064e35ad..1344bff74413 100644
--- a/svx/inc/svx/svdoashp.hxx
+++ b/svx/inc/svx/svdoashp.hxx
@@ -199,6 +199,8 @@ public:
virtual void NbcSetSnapRect(const Rectangle& rRect);
virtual void NbcSetLogicRect(const Rectangle& rRect);
+ virtual SdrGluePoint GetVertexGluePoint(USHORT nNum) const;
+
virtual void NbcSetStyleSheet( SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr );
// special drag methods
@@ -222,8 +224,6 @@ public:
virtual void TakeTextAnchorRect( Rectangle& rAnchorRect ) const;
virtual void TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, FASTBOOL bNoEditText=FALSE,
Rectangle* pAnchorRect=NULL, BOOL bLineWidth=TRUE ) const;
-
- virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const;
virtual void operator=(const SdrObject& rObj);
virtual void TakeObjNameSingul(String& rName) const;
diff --git a/svx/inc/svx/svdoattr.hxx b/svx/inc/svx/svdoattr.hxx
index 20b196443739..3bcce26ea45e 100644
--- a/svx/inc/svx/svdoattr.hxx
+++ b/svx/inc/svx/svdoattr.hxx
@@ -66,9 +66,6 @@ protected:
// Strichstaerke ermitteln. Keine Linie -> 0.
sal_Int32 ImpGetLineWdt() const;
- // Schattenabstand ermitteln. FALSE=Kein Schatten.
- FASTBOOL ImpGetShadowDist(sal_Int32& nXDist, sal_Int32& nYDist) const;
-
// Zuhoeren, ob sich ein StyleSheet aendert
virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx
index cc5c9be64438..349bf49ccf06 100644
--- a/svx/inc/svx/svdobj.hxx
+++ b/svx/inc/svx/svdobj.hxx
@@ -683,20 +683,10 @@ public:
// Tooling for painting a single object to a OutputDevice. This will be needed as long
// as not all painting is changed to use DrawContact objects.
sal_Bool SingleObjectPainter(OutputDevice& rOut) const;
-
BOOL LineGeometryUsageIsNecessary() const;
- // HitTest, 2. Stufe. nTol ist die zulaessige Toleranz in logischen Einheiten.
- // rVisiLayer ist hauptsaechlich fuer Gruppenobjekte gedacht, die ja Objekte
- // mit unterschiedlichen Layerzuordnungen beinhalten koennen.
- virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const;
- //SdrObject* CheckHit(const Point& rPnt, USHORT nTol) const { return CheckHit(rPnt,nTol,NULL); }
- sal_Bool IsHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const { return CheckHit(rPnt,nTol,pVisiLayer)!=NULL; }
- sal_Bool IsHit(const Point& rPnt, USHORT nTol) const { return CheckHit(rPnt,nTol,NULL)!=NULL; }
-
// Clone() soll eine komplette Kopie des Objektes erzeugen.
virtual SdrObject* Clone() const;
- // #116235# virtual SdrObject* Clone(SdrPage* pPage, SdrModel* pModel) const;
virtual void operator=(const SdrObject& rObj);
// TakeObjName...() ist fuer die Anzeige in der UI, z.B. "3 Rahmen selektiert".
@@ -878,10 +868,6 @@ public:
// TextEdit
virtual FASTBOOL HasTextEdit() const;
- virtual SdrObject* CheckTextEditHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const;
- //SdrObject* CheckTextEditHit(const Point& rPnt, USHORT nTol) const { return CheckTextEditHit(rPnt,nTol,NULL); }
- sal_Bool IsTextEditHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const { return CheckTextEditHit(rPnt,nTol,pVisiLayer)!=NULL; }
- sal_Bool IsTextEditHit(const Point& rPnt, USHORT nTol) const { return CheckTextEditHit(rPnt,nTol,NULL)!=NULL; }
// Return==TRUE: TextEditMode gestartet
virtual sal_Bool BegTextEdit(SdrOutliner& rOutl);
diff --git a/svx/inc/svx/svdocapt.hxx b/svx/inc/svx/svdocapt.hxx
index 8e7860c204ce..37bfd5ed2f9b 100644
--- a/svx/inc/svx/svdocapt.hxx
+++ b/svx/inc/svx/svdocapt.hxx
@@ -99,7 +99,6 @@ public:
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
virtual UINT16 GetObjIdentifier() const;
- virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const;
virtual void operator=(const SdrObject& rObj);
// for calc: special shadow only for text box
diff --git a/svx/inc/svx/svdocirc.hxx b/svx/inc/svx/svdocirc.hxx
index db31996939af..3f6a589d2cd7 100644
--- a/svx/inc/svx/svdocirc.hxx
+++ b/svx/inc/svx/svdocirc.hxx
@@ -111,7 +111,6 @@ public:
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
virtual UINT16 GetObjIdentifier() const;
virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const;
- virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const;
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
diff --git a/svx/inc/svx/svdoedge.hxx b/svx/inc/svx/svdoedge.hxx
index 9d2effc87c28..4fa4fd7c0d31 100644
--- a/svx/inc/svx/svdoedge.hxx
+++ b/svx/inc/svx/svdoedge.hxx
@@ -252,7 +252,6 @@ public:
virtual void RecalcSnapRect();
virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const;
- virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const;
virtual void operator=(const SdrObject& rObj);
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
diff --git a/svx/inc/svx/svdograf.hxx b/svx/inc/svx/svdograf.hxx
index 4d464d5c9836..4f00da997361 100644
--- a/svx/inc/svx/svdograf.hxx
+++ b/svx/inc/svx/svdograf.hxx
@@ -180,7 +180,6 @@ public:
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
virtual UINT16 GetObjIdentifier() const;
- virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const;
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
@@ -227,6 +226,9 @@ public:
sal_Bool IsObjectTransparent() const;
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > getInputStream();
+
+ // #i103116# FullDrag support
+ virtual SdrObject* getFullDragClone() const;
};
#endif //_SVDOGRAF_HXX
diff --git a/svx/inc/svx/svdogrp.hxx b/svx/inc/svx/svdogrp.hxx
index b6d2a4519db6..5f243d451f90 100644
--- a/svx/inc/svx/svdogrp.hxx
+++ b/svx/inc/svx/svdogrp.hxx
@@ -84,7 +84,6 @@ public:
virtual const Rectangle& GetCurrentBoundRect() const;
virtual const Rectangle& GetSnapRect() const;
- virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const;
virtual void operator=(const SdrObject& rObj);
virtual void TakeObjNameSingul(String& rName) const;
diff --git a/svx/inc/svx/svdomeas.hxx b/svx/inc/svx/svdomeas.hxx
index 866fda1eff48..406c5badbcb0 100644
--- a/svx/inc/svx/svdomeas.hxx
+++ b/svx/inc/svx/svdomeas.hxx
@@ -105,7 +105,6 @@ public:
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
virtual UINT16 GetObjIdentifier() const;
virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const;
- virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const;
virtual void operator=(const SdrObject& rObj);
virtual void TakeObjNameSingul(String& rName) const;
@@ -153,7 +152,6 @@ public:
Rectangle* pAnchorRect=NULL, BOOL bLineWidth=TRUE ) const;
virtual void TakeTextAnchorRect(Rectangle& rAnchorRect) const;
virtual void TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin) const;
- virtual SdrObject* CheckTextEditHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const;
virtual USHORT GetOutlinerViewAnchorMode() const;
virtual void NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject);
virtual OutlinerParaObject* GetOutlinerParaObject() const;
diff --git a/svx/inc/svx/svdoole2.hxx b/svx/inc/svx/svdoole2.hxx
index 87a86baeb624..605e9463bdab 100644
--- a/svx/inc/svx/svdoole2.hxx
+++ b/svx/inc/svx/svdoole2.hxx
@@ -145,7 +145,6 @@ public:
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
virtual UINT16 GetObjIdentifier() const;
- virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const;
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
@@ -157,6 +156,8 @@ public:
virtual void NbcSetLogicRect(const Rectangle& rRect);
virtual void SetGeoData(const SdrObjGeoData& rGeo);
+ static sal_Bool CanUnloadRunningObj( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >& xObj,
+ sal_Int64 nAspect );
static sal_Bool Unload( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >& xObj, sal_Int64 nAspect );
BOOL Unload();
void Connect();
@@ -183,11 +184,7 @@ public:
sal_Bool CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScaleHeight, Size& aObjAreaSize );
sal_Bool AddOwnLightClient();
- // helper for ViewObjectContactOfSdrOle2Obj. As long as the OLE stuff is not
- // reworked, the things the old Do_PaintObject did at this object need to be
- // emulated. Isolated those things here. Return value tells if the object
- // is active
- bool executeOldDoPaintPreparations(SdrPageView* pPageVew) const;
+ bool executeOldDoPaintPreparations(SdrPageView* pPageVew) const; //remove me with the next incompatible build
// handy to get the empty replacement bitmap without accessing all the old stuff
Bitmap GetEmtyOLEReplacementBitmap() const;
diff --git a/svx/inc/svx/svdopath.hxx b/svx/inc/svx/svdopath.hxx
index a43b06ffd2ab..382f968f19b2 100644
--- a/svx/inc/svx/svdopath.hxx
+++ b/svx/inc/svx/svdopath.hxx
@@ -99,7 +99,6 @@ public:
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
virtual UINT16 GetObjIdentifier() const;
virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const;
- virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const;
virtual void operator=(const SdrObject& rObj);
virtual void TakeObjNameSingul(String& rName) const;
diff --git a/svx/inc/svx/svdorect.hxx b/svx/inc/svx/svdorect.hxx
index 2f4a3a3120dc..d8b0d2767553 100644
--- a/svx/inc/svx/svdorect.hxx
+++ b/svx/inc/svx/svdorect.hxx
@@ -75,7 +75,6 @@ protected:
protected:
XPolygon ImpCalcXPoly(const Rectangle& rRect1, long nRad1) const;
- SdrObject* ImpCheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer, FASTBOOL bForceFilled, FASTBOOL bForceTol=FALSE) const;
void SetXPolyDirty();
// RecalcXPoly sollte ueberladen werden. Dabei muss dann eine XPolygon
@@ -103,7 +102,6 @@ public:
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
virtual UINT16 GetObjIdentifier() const;
virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const;
- virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const;
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
diff --git a/svx/inc/svx/svdotable.hxx b/svx/inc/svx/svdotable.hxx
index 04348306a7de..a524ce757898 100644
--- a/svx/inc/svx/svdotable.hxx
+++ b/svx/inc/svx/svdotable.hxx
@@ -226,7 +226,6 @@ public:
virtual FASTBOOL AdjustTextFrameWidthAndHeight(Rectangle& rR, FASTBOOL bHgt=TRUE, FASTBOOL bWdt=TRUE) const;
virtual FASTBOOL AdjustTextFrameWidthAndHeight(FASTBOOL bHgt=TRUE, FASTBOOL bWdt=TRUE);
- virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const;
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
virtual void operator=(const SdrObject& rObj);
diff --git a/svx/inc/svx/svdotext.hxx b/svx/inc/svx/svdotext.hxx
index 080e20fd1a77..36afd7a670ab 100644
--- a/svx/inc/svx/svdotext.hxx
+++ b/svx/inc/svx/svdotext.hxx
@@ -272,14 +272,14 @@ private:
Rectangle& rAnchorRect,
Rectangle& rPaintRect,
Fraction& aFitXKorreg ) const;
- SVX_DLLPRIVATE SdrObject* ImpConvertObj(FASTBOOL bToPoly) const;
+ SVX_DLLPRIVATE SdrObject* ImpConvertContainedTextToSdrPathObjs(bool bToPoly) const;
SVX_DLLPRIVATE void ImpLinkAnmeldung();
SVX_DLLPRIVATE void ImpLinkAbmeldung();
SVX_DLLPRIVATE ImpSdrObjTextLinkUserData* GetLinkUserData() const;
// void ImpCheckItemSetChanges(const SfxItemSet& rAttr);
protected:
- FASTBOOL ImpCanConvTextToCurve() const { return GetOutlinerParaObject()!=NULL && pModel!=NULL && !IsOutlText() && !IsFontwork(); }
+ bool ImpCanConvTextToCurve() const;
SdrObject* ImpConvertMakeObj(const basegfx::B2DPolyPolygon& rPolyPolygon, sal_Bool bClosed, sal_Bool bBezier, sal_Bool bNoSetAttr = sal_False) const;
SdrObject* ImpConvertAddText(SdrObject* pObj, FASTBOOL bBezier) const;
void ImpSetTextStyleSheetListeners();
@@ -430,7 +430,6 @@ public:
// Wird zur Bestimmung des Textankerbereichs benoetigt
virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const;
- virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const;
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
virtual void operator=(const SdrObject& rObj);
@@ -472,7 +471,6 @@ public:
virtual sal_Bool BegTextEdit(SdrOutliner& rOutl);
virtual void TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin) const;
virtual void EndTextEdit(SdrOutliner& rOutl);
- virtual SdrObject* CheckTextEditHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const;
virtual USHORT GetOutlinerViewAnchorMode() const;
void StartTextAnimation(OutputDevice* pOutDev, const Point& rOffset, long nExtraData=0L);
diff --git a/svx/inc/svx/svdouno.hxx b/svx/inc/svx/svdouno.hxx
index b366c50cfc84..83019f6b1cc5 100644
--- a/svx/inc/svx/svdouno.hxx
+++ b/svx/inc/svx/svdouno.hxx
@@ -90,7 +90,6 @@ public:
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
virtual UINT16 GetObjIdentifier() const;
- virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const;
virtual void operator = (const SdrObject& rObj);
virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
diff --git a/svx/inc/svx/svdovirt.hxx b/svx/inc/svx/svdovirt.hxx
index d7010cd40b48..190576fc68c6 100644
--- a/svx/inc/svx/svdovirt.hxx
+++ b/svx/inc/svx/svdovirt.hxx
@@ -83,7 +83,6 @@ public:
virtual const Rectangle& GetLastBoundRect() const;
virtual void RecalcBoundRect();
virtual void SetChanged();
- virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const;
virtual SdrObject* Clone() const;
virtual void operator=(const SdrObject& rObj);
diff --git a/svx/inc/svx/svdpage.hxx b/svx/inc/svx/svdpage.hxx
index d817ede41406..6f2753c4e896 100644
--- a/svx/inc/svx/svdpage.hxx
+++ b/svx/inc/svx/svdpage.hxx
@@ -132,9 +132,7 @@ friend class SdrEditView;
FASTBOOL bRectsDirty;
protected:
virtual void RecalcRects();
-//#if 0 // _SOLAR__PRIVATE
- FASTBOOL ImpGetFillColor(SdrObject* pObj, Color& rCol) const;
-//#endif // __PRIVATE
+
private:
/// simple ActionChildInserted forwarder to have it on a central place
void impChildInserted(SdrObject& rChild) const;
@@ -188,12 +186,6 @@ public:
const Rectangle& GetAllObjSnapRect() const;
const Rectangle& GetAllObjBoundRect() const;
- // HitTest auf alle Objekte der Liste
- SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer, FASTBOOL bBackward=FALSE) const;
- SdrObject* CheckHit(const Point& rPnt, USHORT nTol, FASTBOOL bBackward=FALSE) const { return CheckHit(rPnt,nTol,NULL,bBackward); }
- FASTBOOL IsHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const { return CheckHit(rPnt,nTol,pVisiLayer)!=NULL; }
- FASTBOOL IsHit(const Point& rPnt, USHORT nTol) const { return CheckHit(rPnt,nTol)!=NULL; } // #i24906#
-
// Alle Textobjekte neu formatieren, z.B. bei Druckerwechsel
void NbcReformatAllTextObjects();
void ReformatAllTextObjects();
@@ -204,14 +196,6 @@ public:
// Die Vorlagenattribute der Zeichenobjekte in harte Attribute verwandeln.
void BurnInStyleSheetAttributes();
- // Bestimmung der FuellFarbe an einer bestimmten Position.
- // FALSE=Kein Objekt mit FuellFarbe an dieser Position gefunden.
- // rVisLayers gibt die zu durchsuchenden Layer an.
- // bLayerSorted: TRUE=Es wird in der Reihenfolge der Layer gesucht (ni)
- // rCol: Hier wird die gefundene Farbe zurueckgegeben
- FASTBOOL GetFillColor(const Point& rPnt, const SetOfByte& rVisLayers,
- /* FASTBOOL bLayerSorted, */ Color& rCol) const;
-
ULONG GetObjCount() const;
SdrObject* GetObj(ULONG nNum) const;
@@ -444,10 +428,6 @@ friend class ChXChartDocument;
// this is a weak reference to a possible living api wrapper for this page
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxUnoPage;
- // #108867# used by GetFillColor
- FASTBOOL ImplGetFillColor(const Point& rPnt, const SetOfByte& rVisLayers,
- /* FASTBOOL bLayerSorted, */ Color& rCol, FASTBOOL bSkipBackgroundShape) const;
-
protected:
SdrLayerAdmin* pLayerAdmin;
SdrObject* pBackgroundObj;
@@ -530,15 +510,6 @@ public:
const SdrLayerAdmin& GetLayerAdmin() const { return *pLayerAdmin; }
SdrLayerAdmin& GetLayerAdmin() { return *pLayerAdmin; }
- // Bestimmung der FuellFarbe an einer bestimmten Position.
- // FALSE=Kein Objekt mit FuellFarbe an dieser Position gefunden.
- // rVisLayers gibt die zu durchsuchenden Layer an.
- // bLayerSorted: TRUE=Es wird in der Reihenfolge der Layer gesucht (ni)
- // rCol: Hier wird die gefundene Farbe zurueckgegeben
- // Auch MasterPages werden durchsucht.
- FASTBOOL GetFillColor(const Point& rPnt, const SetOfByte& rVisLayers,
- /*FASTBOOL bLayerSorted,*/ Color& rCol) const;
-
// GetBitmap und GetMetafile sind noch nicht implementiert.
// Bitmap in Bildschirmaufloesung und -farbtiefe aus den Objekten der
// Page erzeugen.
diff --git a/svx/inc/svx/svdpntv.hxx b/svx/inc/svx/svdpntv.hxx
index dcdbe7fc1c8f..8654e3a79db0 100644
--- a/svx/inc/svx/svdpntv.hxx
+++ b/svx/inc/svx/svdpntv.hxx
@@ -319,6 +319,10 @@ public:
void SetHitTolerancePixel(USHORT nVal) { nHitTolPix=nVal; TheresNewMapMode(); }
USHORT GetHitTolerancePixel() const { return (USHORT)nHitTolPix; }
+ // data read access on logic HitTolerance and MinMoveTolerance
+ USHORT getHitTolLog() const { return nHitTolLog; }
+ USHORT getMinMovLog() const { return nMinMovLog; }
+
// Flag zur Visualisierung von Gruppen abfragen/testen
BOOL DoVisualizeEnteredGroup() const { return bVisualizeEnteredGroup; }
void SetVisualizeEnteredGroup(BOOL bNew) { bVisualizeEnteredGroup = bNew; }
@@ -559,35 +563,6 @@ public:
// #103911# Set document color for svx at SdrPageViews
void SetApplicationDocumentColor(Color aDocumentColor);
- /** Determine typical background color for given area on given page
-
- This method calculates a single representative color for the
- given rectangular area. This is accomplished by sampling from
- various points within that area, and calculating a weighted
- mean value of those samples. High contrast settings are
- respected by this method, i.e. in high contrast mode,
- svtools::DOCCOLOR is used as the background color.
-
- @attention For some cases, such as highly structured
- background or huge color ranges spanned by the background,
- this method cannot yield meaningful results, as the background
- simply cannot be represented by a single color. Beware.
-
- @param rArea
- Rectangular area to determine representative background color from
-
- @param rVisibleLayers
- Set of layers visible when calculating the background color
-
- @param rCurrPage
- Current page for which to determine background color on
-
- @return a representative background color.
- */
- Color CalcBackgroundColor( const Rectangle& rArea,
- const SetOfByte& rVisibleLayers,
- const SdrPage& rCurrPage ) const;
-
// #i38135#
// Sets the timer for Object animations and restarts.
void SetAnimationTimer(sal_uInt32 nTime);
diff --git a/svx/inc/svx/svdtext.hxx b/svx/inc/svx/svdtext.hxx
index 24e4d651cf50..d745bbe170de 100644
--- a/svx/inc/svx/svdtext.hxx
+++ b/svx/inc/svx/svdtext.hxx
@@ -33,6 +33,7 @@
#include <sal/types.h>
#include "svx/svxdllapi.h"
+#include <tools/weakbase.hxx>
// --------------------------------------------------------------------
@@ -49,7 +50,7 @@ namespace sdr { namespace properties {
/** This class stores information about one text inside a shape.
*/
-class SVX_DLLPUBLIC SdrText
+class SVX_DLLPUBLIC SdrText : public tools::WeakBase< SdrText >
{
public:
SdrText( SdrTextObj& rObject, OutlinerParaObject* pOutlinerParaObject = 0 );
diff --git a/svx/inc/svx/svxdlg.hxx b/svx/inc/svx/svxdlg.hxx
index 233c7956f18a..e4b3b6152022 100644
--- a/svx/inc/svx/svxdlg.hxx
+++ b/svx/inc/svx/svxdlg.hxx
@@ -347,6 +347,13 @@ public:
virtual sal_Int32 getColumns() const = 0;
};
+class SvxAbstractInsRowColDlg : public VclAbstractDialog
+{
+public:
+ virtual bool isInsertBefore() const = 0;
+ virtual sal_uInt16 getInsertCount() const = 0;
+};
+
//-------------------------------------------------------------
class SVX_DLLPUBLIC SvxAbstractDialogFactory : public SfxAbstractDialogFactory
@@ -543,6 +550,8 @@ public:
virtual SvxAbstractSplittTableDialog* CreateSvxSplittTableDialog( Window* pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal )=0;
virtual SvxAbstractNewTableDialog* CreateSvxNewTableDialog( Window* pParent ) = 0;
+
+ virtual SvxAbstractInsRowColDlg* CreateSvxInsRowColDlg( Window* pParent, bool bCol, ULONG nHelpId ) = 0;
};
#endif
diff --git a/svx/inc/svx/svxenum.hxx b/svx/inc/svx/svxenum.hxx
index 235128039fe4..01a7d80d1351 100644
--- a/svx/inc/svx/svxenum.hxx
+++ b/svx/inc/svx/svxenum.hxx
@@ -143,49 +143,6 @@ enum SvxCellOrientation
SVX_ORIENTATION_STACKED
};
-enum SvxPaper
-{
- SVX_PAPER_A0,
- SVX_PAPER_A1,
- SVX_PAPER_A2,
- SVX_PAPER_A3, // Aus SV.XXX
- SVX_PAPER_A4,
- SVX_PAPER_A5,
- SVX_PAPER_B4,
- SVX_PAPER_B5,
- SVX_PAPER_LETTER,
- SVX_PAPER_LEGAL,
- SVX_PAPER_TABLOID,
- SVX_PAPER_USER,
- SVX_PAPER_B6, // SVX_-Erweiterungen
- SVX_PAPER_C4,
- SVX_PAPER_C5,
- SVX_PAPER_C6,
- SVX_PAPER_C65,
- SVX_PAPER_DL,
- SVX_PAPER_DIA,
- SVX_PAPER_SCREEN,
- SVX_PAPER_A,
- SVX_PAPER_B,
- SVX_PAPER_C,
- SVX_PAPER_D,
- SVX_PAPER_E,
- SVX_PAPER_EXECUTIVE,
- SVX_PAPER_LEGAL2,
- SVX_PAPER_MONARCH,
- SVX_PAPER_COM675,
- SVX_PAPER_COM9,
- SVX_PAPER_COM10,
- SVX_PAPER_COM11,
- SVX_PAPER_COM12,
- SVX_PAPER_KAI16,
- SVX_PAPER_KAI32,
- SVX_PAPER_KAI32BIG,
- SVX_PAPER_B4_JIS,
- SVX_PAPER_B5_JIS,
- SVX_PAPER_B6_JIS
-};
-
enum SvxDrawToolEnum
{
SVX_SNAP_DRAW_SELECT,
diff --git a/svx/inc/svx/svxfont.hxx b/svx/inc/svx/svxfont.hxx
index b0165d73f978..cab43c06628c 100644
--- a/svx/inc/svx/svxfont.hxx
+++ b/svx/inc/svx/svxfont.hxx
@@ -70,7 +70,8 @@ public:
inline void SetCaseMap( const SvxCaseMap eNew ) { eCaseMap = eNew; }
inline LanguageType GetLanguage() const { return eLang; }
- inline void SetLanguage( const LanguageType eNewLan ) { eLang = eNewLan; }
+ inline void SetLanguage( const LanguageType eNewLan )
+ { eLang = eNewLan; Font::SetLanguage(eNewLan); }
// Is-Methoden:
inline BOOL IsCaseMap() const { return SVX_CASEMAP_NOT_MAPPED != eCaseMap; }
diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc
index d7c018bedaac..6019c3590d55 100644
--- a/svx/inc/svx/svxids.hrc
+++ b/svx/inc/svx/svxids.hrc
@@ -831,7 +831,11 @@
#define SID_OFASLOTS_START ( SID_SVX_START + 425 )
//#define SID_SD_AUTOPILOT ( SID_SVX_START + 425 ) -> sfxsids.hrc
#define SID_AUTOPILOT SID_SD_AUTOPILOT
-// 4 defines of Writer's old wizards have been removed here
+
+#define SID_TABLE_INSERT_COL_DLG ( SID_SVX_START + 426 )
+#define SID_TABLE_INSERT_ROW_DLG ( SID_SVX_START + 427 )
+#define SID_TABLE_PARAM_INSERT_AFTER ( SID_SVX_START + 428 )
+
#define SID_TABLEDESIGN ( SID_SVX_START + 429 )
#define SID_MN_AUTOPILOT ( SID_SVX_START + 430 )
#define SID_GENERAL_OPTIONS ( SID_SVX_START + 432 )
diff --git a/svx/inc/svx/xcolit.hxx b/svx/inc/svx/xcolit.hxx
index 719ef1a48fc2..e8d041079652 100644
--- a/svx/inc/svx/xcolit.hxx
+++ b/svx/inc/svx/xcolit.hxx
@@ -48,7 +48,7 @@ class SVX_DLLPUBLIC XColorItem : public NameOrIndex
public:
TYPEINFO();
XColorItem() {}
- XColorItem(USHORT nWhich, long nIndex, const Color& rTheColor);
+ XColorItem(USHORT nWhich, INT32 nIndex, const Color& rTheColor);
virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const;
virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 );
diff --git a/svx/inc/svx/xflclit.hxx b/svx/inc/svx/xflclit.hxx
index 72f7728c14ab..39a382bd5e60 100644
--- a/svx/inc/svx/xflclit.hxx
+++ b/svx/inc/svx/xflclit.hxx
@@ -46,7 +46,7 @@ class SVX_DLLPUBLIC XFillColorItem : public XColorItem
public:
TYPEINFO();
XFillColorItem() {}
- XFillColorItem(long nIndex, const Color& rTheColor);
+ XFillColorItem(INT32 nIndex, const Color& rTheColor);
XFillColorItem(const String& rName, const Color& rTheColor);
XFillColorItem(SvStream& rIn);
diff --git a/svx/inc/svx/xflftrit.hxx b/svx/inc/svx/xflftrit.hxx
index d2c5ef8ef0b3..1e77f2a6d2e0 100644
--- a/svx/inc/svx/xflftrit.hxx
+++ b/svx/inc/svx/xflftrit.hxx
@@ -50,7 +50,7 @@ public:
TYPEINFO();
XFillFloatTransparenceItem();
- XFillFloatTransparenceItem( long nIndex, const XGradient& rGradient, BOOL bEnable = TRUE );
+ XFillFloatTransparenceItem( INT32 nIndex, const XGradient& rGradient, BOOL bEnable = TRUE );
XFillFloatTransparenceItem(const String& rName, const XGradient& rGradient, BOOL bEnable = TRUE );
XFillFloatTransparenceItem(SfxItemPool* pPool, const XGradient& rTheGradient, BOOL bEnable = TRUE );
XFillFloatTransparenceItem(SfxItemPool* pPool );
diff --git a/svx/inc/svx/xflgrit.hxx b/svx/inc/svx/xflgrit.hxx
index f463dd8f6dae..fd0a7a202c81 100644
--- a/svx/inc/svx/xflgrit.hxx
+++ b/svx/inc/svx/xflgrit.hxx
@@ -47,7 +47,7 @@ class SVX_DLLPUBLIC XFillGradientItem : public NameOrIndex
public:
TYPEINFO();
XFillGradientItem() : NameOrIndex(XATTR_FILLGRADIENT, -1) {}
- XFillGradientItem(long nIndex, const XGradient& rTheGradient);
+ XFillGradientItem(INT32 nIndex, const XGradient& rTheGradient);
XFillGradientItem(const UniString& rName, const XGradient& rTheGradient);
XFillGradientItem(SfxItemPool* pPool, const XGradient& rTheGradient);
XFillGradientItem(SfxItemPool* pPool );
diff --git a/svx/inc/svx/xflhtit.hxx b/svx/inc/svx/xflhtit.hxx
index 30686200f298..212977c87a1f 100644
--- a/svx/inc/svx/xflhtit.hxx
+++ b/svx/inc/svx/xflhtit.hxx
@@ -47,7 +47,7 @@ class SVX_DLLPUBLIC XFillHatchItem : public NameOrIndex
public:
TYPEINFO();
XFillHatchItem() : NameOrIndex(XATTR_FILLHATCH, -1) {}
- XFillHatchItem(long nIndex, const XHatch& rTheHatch);
+ XFillHatchItem(INT32 nIndex, const XHatch& rTheHatch);
XFillHatchItem(const String& rName, const XHatch& rTheHatch);
XFillHatchItem(SfxItemPool* pPool, const XHatch& rTheHatch);
XFillHatchItem(SfxItemPool* pPool );
diff --git a/svx/inc/svx/xftshcit.hxx b/svx/inc/svx/xftshcit.hxx
index 9668b01441dc..7f767d163278 100644
--- a/svx/inc/svx/xftshcit.hxx
+++ b/svx/inc/svx/xftshcit.hxx
@@ -45,7 +45,7 @@ class SVX_DLLPUBLIC XFormTextShadowColorItem : public XColorItem
public:
TYPEINFO();
XFormTextShadowColorItem() {}
- XFormTextShadowColorItem(long nIndex, const Color& rTheColor);
+ XFormTextShadowColorItem(INT32 nIndex, const Color& rTheColor);
XFormTextShadowColorItem(const String& rName, const Color& rTheColor);
XFormTextShadowColorItem(SvStream& rIn);
diff --git a/svx/inc/svx/xit.hxx b/svx/inc/svx/xit.hxx
index 2eaaa1629ef2..993f16eb1f43 100644
--- a/svx/inc/svx/xit.hxx
+++ b/svx/inc/svx/xit.hxx
@@ -54,7 +54,7 @@ typedef BOOL (*SvxCompareValueFunc)( const NameOrIndex* p1, const NameOrIndex* p
//-------------------
class SVX_DLLPUBLIC NameOrIndex : public SfxStringItem
{
- long nPalIndex;
+ INT32 nPalIndex;
protected:
void Detach() { nPalIndex = -1; }
@@ -62,7 +62,7 @@ protected:
public:
TYPEINFO();
NameOrIndex() { nPalIndex = -1; }
- NameOrIndex(USHORT nWhich, long nIndex);
+ NameOrIndex(USHORT nWhich, INT32 nIndex);
NameOrIndex(USHORT nWhich,
const String& rName= String());
NameOrIndex(USHORT nWhich, SvStream& rIn);
@@ -76,8 +76,8 @@ public:
String GetName() const { return GetValue(); }
void SetName(const String& rName) { SetValue(rName); }
- long GetIndex() const { return nPalIndex; }
- void SetIndex(long nIndex) { nPalIndex = nIndex; }
+ INT32 GetIndex() const { return nPalIndex; }
+ void SetIndex(INT32 nIndex) { nPalIndex = nIndex; }
BOOL IsIndex() const { return (nPalIndex >= 0); }
/** this static checks if the given NameOrIndex item has a unique name for its value.
diff --git a/svx/inc/svx/xlnclit.hxx b/svx/inc/svx/xlnclit.hxx
index 662531856689..f3622b32ce90 100644
--- a/svx/inc/svx/xlnclit.hxx
+++ b/svx/inc/svx/xlnclit.hxx
@@ -42,7 +42,7 @@ class SVX_DLLPUBLIC XLineColorItem : public XColorItem
public:
TYPEINFO();
XLineColorItem() {}
- XLineColorItem(long nIndex, const Color& rTheColor);
+ XLineColorItem(INT32 nIndex, const Color& rTheColor);
XLineColorItem(const String& rName, const Color& rTheColor);
XLineColorItem(SvStream& rIn);
diff --git a/svx/inc/svx/xlndsit.hxx b/svx/inc/svx/xlndsit.hxx
index 355ea3f72f55..4315161b34eb 100644
--- a/svx/inc/svx/xlndsit.hxx
+++ b/svx/inc/svx/xlndsit.hxx
@@ -50,7 +50,7 @@ class SVX_DLLPUBLIC XLineDashItem : public NameOrIndex
public:
TYPEINFO();
XLineDashItem() : NameOrIndex(XATTR_LINEDASH, -1) {}
- XLineDashItem(long nIndex, const XDash& rTheDash);
+ XLineDashItem(INT32 nIndex, const XDash& rTheDash);
XLineDashItem(const String& rName, const XDash& rTheDash);
XLineDashItem(SfxItemPool* pPool, const XDash& rTheDash);
XLineDashItem(SfxItemPool* pPool );
diff --git a/svx/inc/svx/xlnedit.hxx b/svx/inc/svx/xlnedit.hxx
index fa96776a18c4..46ef12ee2937 100644
--- a/svx/inc/svx/xlnedit.hxx
+++ b/svx/inc/svx/xlnedit.hxx
@@ -46,7 +46,7 @@ class SVX_DLLPUBLIC XLineEndItem : public NameOrIndex
public:
TYPEINFO();
- XLineEndItem(long nIndex = -1);
+ XLineEndItem(INT32 nIndex = -1);
XLineEndItem(const String& rName, const basegfx::B2DPolyPolygon& rPolyPolygon);
XLineEndItem(SfxItemPool* pPool, const basegfx::B2DPolyPolygon& rPolyPolygon);
XLineEndItem(SfxItemPool* pPool );
diff --git a/svx/inc/svx/xlnstit.hxx b/svx/inc/svx/xlnstit.hxx
index 0256e078d148..1d6af8690acd 100644
--- a/svx/inc/svx/xlnstit.hxx
+++ b/svx/inc/svx/xlnstit.hxx
@@ -46,7 +46,7 @@ class SVX_DLLPUBLIC XLineStartItem : public NameOrIndex
public:
TYPEINFO();
- XLineStartItem(long nIndex = -1);
+ XLineStartItem(INT32 nIndex = -1);
XLineStartItem(const String& rName, const basegfx::B2DPolyPolygon& rPolyPolygon);
XLineStartItem(SfxItemPool* pPool, const basegfx::B2DPolyPolygon& rPolyPolygon);
XLineStartItem(SfxItemPool* pPool );
diff --git a/svx/inc/svx/xsflclit.hxx b/svx/inc/svx/xsflclit.hxx
index eebe2e723620..0b065597fc8f 100644
--- a/svx/inc/svx/xsflclit.hxx
+++ b/svx/inc/svx/xsflclit.hxx
@@ -41,7 +41,7 @@ class XSecondaryFillColorItem : public XColorItem
public:
TYPEINFO();
XSecondaryFillColorItem() {}
- XSecondaryFillColorItem(long nIndex, const Color& rTheColor);
+ XSecondaryFillColorItem(INT32 nIndex, const Color& rTheColor);
XSecondaryFillColorItem(const String& rName, const Color& rTheColor);
XSecondaryFillColorItem(SvStream& rIn);
diff --git a/svx/inc/xmlgrhlp.hxx b/svx/inc/xmlgrhlp.hxx
index f36733706ab5..f99730c0ad1c 100644
--- a/svx/inc/xmlgrhlp.hxx
+++ b/svx/inc/xmlgrhlp.hxx
@@ -95,7 +95,7 @@ private:
SVX_DLLPRIVATE sal_Bool ImplWriteGraphic( const ::rtl::OUString& rPictureStorageName,
const ::rtl::OUString& rPictureStreamName,
const ::rtl::OUString& rGraphicId );
- SVX_DLLPRIVATE void ImplInsertGraphicURL( const ::rtl::OUString& rURLStr, sal_uInt32 nInsertPos );
+ SVX_DLLPRIVATE void ImplInsertGraphicURL( const ::rtl::OUString& rURLStr, sal_uInt32 nInsertPos, rtl::OUString& rRequestedFileName );
protected:
SvXMLGraphicHelper();
diff --git a/svx/prj/build.lst b/svx/prj/build.lst
index 51d1217ceae8..56980702fb2d 100644
--- a/svx/prj/build.lst
+++ b/svx/prj/build.lst
@@ -1,4 +1,4 @@
-sx svx : connectivity xmloff linguistic jvmfwk avmedia configmgr ucb fileaccess drawinglayer NULL
+sx svx : l10n connectivity xmloff linguistic jvmfwk avmedia configmgr ucb fileaccess drawinglayer NULL
sx svx usr1 - all sx_mkout NULL
sx svx\inc nmake - all sx_inc NULL
sx svx\uiconfig\layout nmake - all sx_layout NULL
diff --git a/svx/prj/d.lst b/svx/prj/d.lst
index 74236afdad1c..147cfd57d862 100644
--- a/svx/prj/d.lst
+++ b/svx/prj/d.lst
@@ -218,6 +218,7 @@ mkdir: %_DEST%\inc%_EXT%\svx
..\inc\svx\svdedtv.hxx %_DEST%\inc%_EXT%\svx\svdedtv.hxx
..\inc\svx\svdedxv.hxx %_DEST%\inc%_EXT%\svx\svdedxv.hxx
..\inc\svx\svdetc.hxx %_DEST%\inc%_EXT%\svx\svdetc.hxx
+..\inc\svx\sdrhittesthelper.hxx %_DEST%\inc%_EXT%\svx\sdrhittesthelper.hxx
..\inc\svx\svdglev.hxx %_DEST%\inc%_EXT%\svx\svdglev.hxx
..\inc\svx\svdglue.hxx %_DEST%\inc%_EXT%\svx\svdglue.hxx
..\inc\svx\svdhdl.hxx %_DEST%\inc%_EXT%\svx\svdhdl.hxx
@@ -254,7 +255,6 @@ mkdir: %_DEST%\inc%_EXT%\svx
..\inc\svx\svdpoev.hxx %_DEST%\inc%_EXT%\svx\svdpoev.hxx
..\inc\svx\svdpool.hxx %_DEST%\inc%_EXT%\svx\svdpool.hxx
..\inc\svx\svdsnpv.hxx %_DEST%\inc%_EXT%\svx\svdsnpv.hxx
-..\inc\svdtouch.hxx %_DEST%\inc%_EXT%\svx\svdtouch.hxx
..\inc\svx\svdtrans.hxx %_DEST%\inc%_EXT%\svx\svdtrans.hxx
..\inc\svx\svdundo.hxx %_DEST%\inc%_EXT%\svx\svdundo.hxx
..\inc\svx\svdoutl.hxx %_DEST%\inc%_EXT%\svx\svdoutl.hxx
@@ -593,11 +593,9 @@ mkdir: %_DEST%\inc%_EXT%\svx\sdr\contact
mkdir: %_DEST%\inc%_EXT%\svx\sdr\overlay
..\inc\svx\sdr\overlay\overlayanimatedbitmapex.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlayanimatedbitmapex.hxx
-..\inc\svx\sdr\overlay\overlaybitmap.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaybitmap.hxx
..\inc\svx\sdr\overlay\overlaybitmapex.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaybitmapex.hxx
..\inc\svx\sdr\overlay\overlayline.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlayline.hxx
..\inc\svx\sdr\overlay\overlayhelpline.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlayhelpline.hxx
-..\inc\svx\sdr\overlay\overlaylinestriped.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaylinestriped.hxx
..\inc\svx\sdr\overlay\overlaymanager.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaymanager.hxx
..\inc\svx\sdr\overlay\overlaymanagerbuffered.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaymanagerbuffered.hxx
..\inc\svx\sdr\overlay\overlayobject.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlayobject.hxx
@@ -605,7 +603,8 @@ mkdir: %_DEST%\inc%_EXT%\svx\sdr\overlay
..\inc\svx\sdr\overlay\overlaytriangle.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaytriangle.hxx
..\inc\svx\sdr\overlay\overlaypolypolygon.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaypolypolygon.hxx
..\inc\svx\sdr\overlay\overlayobjectcell.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlayobjectcell.hxx
-..\inc\svx\sdr\overlay\overlaysdrobject.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaysdrobject.hxx
+..\inc\svx\sdr\overlay\overlayprimitive2dsequenceobject.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlayprimitive2dsequenceobject.hxx
+..\inc\svx\sdr\overlay\overlaytools.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaytools.hxx
mkdir: %_DEST%\inc%_EXT%\svx\sdr\animation
..\inc\svx\sdr\animation\ainfographic.hxx %_DEST%\inc%_EXT%\svx\sdr\animation\ainfographic.hxx
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index a69aae4cf9fd..3c819229ee4c 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -14911,3 +14911,54 @@ SfxVoidItem RecheckDocument SID_RECHECK_DOCUMENT
GroupId = GID_DOCUMENT;
]
+//--------------------------------------------------------------------------
+
+SfxVoidItem InsertColumnDialog SID_TABLE_INSERT_COL_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+
+SfxVoidItem InsertRowDialog SID_TABLE_INSERT_ROW_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_TABLE;
+]
diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
index 7882aeac6b7b..9423e6719a40 100644
--- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx
+++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
@@ -64,6 +64,8 @@
#include <svx/svdpage.hxx>
#include <svx/unomod.hxx>
#include <svx/dialmgr.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/sdrhittesthelper.hxx>
//===== namespaces ===========================================================
@@ -225,7 +227,14 @@ Reference< XAccessible > SAL_CALL SvxGraphCtrlAccessibleContext::getAccessibleAt
{
Point aPnt( rPoint.X, rPoint.Y );
mpControl->PixelToLogic( aPnt );
- SdrObject * pObj = mpPage->CheckHit(aPnt, 1, NULL, false);
+
+ SdrObject* pObj = 0;
+
+ if(mpView && mpView->GetSdrPageView())
+ {
+ pObj = SdrObjListPrimitiveHit(*mpPage, aPnt, 1, *mpView->GetSdrPageView(), 0, false);
+ }
+
if( pObj )
xAccessible = getAccessible( pObj );
}
diff --git a/svx/source/cui/commonlingui.src b/svx/source/cui/commonlingui.src
index b69d3449db4c..c229953ad3c8 100644
--- a/svx/source/cui/commonlingui.src
+++ b/svx/source/cui/commonlingui.src
@@ -47,7 +47,7 @@ Window RID_SVX_WND_COMMON_LINGU
{
HelpId=HID_SPELLDLG_SETWORD;
Pos = MAP_APPFONT( 51, 9 );
- Size = MAP_APPFONT( 149, 10 );
+ Size = MAP_APPFONT( 164, 10 );
Border =FALSE;
TabStop = TRUE;
};
@@ -62,7 +62,7 @@ Window RID_SVX_WND_COMMON_LINGU
Edit ED_NEWWORD
{
Pos = MAP_APPFONT( 51, 24 );
- Size = MAP_APPFONT( 122, 12 );
+ Size = MAP_APPFONT( 137, 12 );
Border = TRUE;
};
@@ -75,21 +75,21 @@ Window RID_SVX_WND_COMMON_LINGU
PushButton BTN_IGNORE
{
- Pos = MAP_APPFONT( 209, 6 );
+ Pos = MAP_APPFONT( 224, 6 );
Size = MAP_APPFONT( 55, 14 );
Text [ en-US ] = "~Ignore" ;
};
PushButton BTN_IGNOREALL
{
- Pos = MAP_APPFONT( 209, 22 );
+ Pos = MAP_APPFONT( 224, 22 );
Size = MAP_APPFONT( 55, 14 );
Text [ en-US ] = "Always I~gnore" ;
};
PushButton BTN_CHANGE
{
- Pos = MAP_APPFONT( 209, 40 );
+ Pos = MAP_APPFONT( 224, 40 );
Size = MAP_APPFONT( 55, 14 );
Text [ en-US ] = "~Replace" ;
DefButton = TRUE ;
@@ -97,14 +97,14 @@ Window RID_SVX_WND_COMMON_LINGU
PushButton BTN_CHANGEALL
{
- Pos = MAP_APPFONT( 209, 56 );
+ Pos = MAP_APPFONT( 224, 56 );
Size = MAP_APPFONT( 55, 14 );
Text [ en-US ] = "Always R~eplace" ;
};
PushButton BTN_OPTIONS
{
- Pos = MAP_APPFONT( 209, 129 );
+ Pos = MAP_APPFONT( 224, 129 );
Size = MAP_APPFONT( 55, 14 );
Hide = TRUE ;
Text [ en-US ] = "Options..." ;
@@ -119,19 +119,19 @@ Window RID_SVX_WND_COMMON_LINGU
GroupBox GB_AUDIT
{
Pos = MAP_APPFONT( 1, 1 );
- Size = MAP_APPFONT( 268, 148 );
+ Size = MAP_APPFONT( 283, 148 );
Hide=TRUE;
};
HelpButton BTN_SPL_HELP
{
- Pos = MAP_APPFONT( 145, 153 );
+ Pos = MAP_APPFONT( 160, 153 );
Size = MAP_APPFONT( 55, 14 );
};
CancelButton BTN_SPL_CANCEL
{
- Pos = MAP_APPFONT ( 209 , 153 ) ;
+ Pos = MAP_APPFONT ( 224 , 153 ) ;
Size = MAP_APPFONT ( 55 , 14 ) ;
TabStop = TRUE ;
Text [ en-US ] = "~Close" ;
diff --git a/svx/source/cui/cuicharmap.cxx b/svx/source/cui/cuicharmap.cxx
index fa962beafc3d..a66c7b3c10a8 100644
--- a/svx/source/cui/cuicharmap.cxx
+++ b/svx/source/cui/cuicharmap.cxx
@@ -6,9 +6,6 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: cuicharmap.cxx,v $
- * $Revision: 1.10 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -405,6 +402,11 @@ IMPL_LINK( SvxCharMapData, FontSelectHdl, ListBox *, EMPTYARG )
USHORT nPos = aFontLB.GetSelectEntryPos(),
nFont = (USHORT)(ULONG)aFontLB.GetEntryData( nPos );
aFont = mpDialog->GetDevFont( nFont );
+ aFont.SetWeight( WEIGHT_DONTKNOW );
+ aFont.SetItalic( ITALIC_NONE );
+ aFont.SetWidthType( WIDTH_DONTKNOW );
+ aFont.SetPitch( PITCH_DONTKNOW );
+ aFont.SetFamily( FAMILY_DONTKNOW );
// notify children using this font
aShowSet.SetFont( aFont );
diff --git a/svx/source/cui/dlgfact.cxx b/svx/source/cui/dlgfact.cxx
index 5fe71d5eb8af..996d0f63f9e9 100644
--- a/svx/source/cui/dlgfact.cxx
+++ b/svx/source/cui/dlgfact.cxx
@@ -112,6 +112,7 @@
#include "newtabledlg.hxx"
#include "macroass.hxx"
#include "acccfg.hxx"
+#include "insrc.hxx"
using namespace ::com::sun::star;
using namespace ::com::sun::star::frame;
@@ -2385,3 +2386,8 @@ VclAbstractDialog* AbstractDialogFactory_Impl::CreateOptionsDialog(
{
return new VclAbstractDialog_Impl( new OfaTreeOptionsDialog( pParent, rExtensionId ) );
}
+
+SvxAbstractInsRowColDlg* AbstractDialogFactory_Impl::CreateSvxInsRowColDlg( Window* pParent, bool bCol, ULONG nHelpId )
+{
+ return new SvxInsRowColDlg( pParent, bCol, nHelpId );
+}
diff --git a/svx/source/cui/dlgfact.hxx b/svx/source/cui/dlgfact.hxx
index e6c1325b4b38..e52c21fc597a 100644
--- a/svx/source/cui/dlgfact.hxx
+++ b/svx/source/cui/dlgfact.hxx
@@ -810,6 +810,8 @@ public:
virtual VclAbstractDialog* CreateOptionsDialog(
Window* pParent, const rtl::OUString& rExtensionId, const rtl::OUString& rApplicationContext );
+
+ virtual SvxAbstractInsRowColDlg* CreateSvxInsRowColDlg( Window* pParent, bool bCol, ULONG nHelpId );
};
#endif
diff --git a/svx/source/cui/hangulhanjadlg.src b/svx/source/cui/hangulhanjadlg.src
index 91439e285f7d..920f99e03aec 100644
--- a/svx/source/cui/hangulhanjadlg.src
+++ b/svx/source/cui/hangulhanjadlg.src
@@ -37,7 +37,7 @@
ModalDialog RID_SVX_MDLG_HANGULHANJA
{
HelpId = HID_DIALOG_HANGULHANJA;
- Size = MAP_APPFONT( 287, 175 );
+ Size = MAP_APPFONT( 302, 175 );
OutputSize = TRUE;
Closeable = TRUE ;
Moveable = TRUE ;
@@ -47,7 +47,7 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA
PushButton PB_FIND
{
- Pos = MAP_APPFONT( 192, 23 );
+ Pos = MAP_APPFONT( 207, 23 );
Size = MAP_APPFONT( 30, 14 );
Text [ en-US ] = "~Find";
@@ -56,7 +56,7 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA
Control CTL_SUGGESTIONS
{
Pos = MAP_APPFONT( 51, 46 );
- Size = MAP_APPFONT( 171, 30 );
+ Size = MAP_APPFONT( 186, 30 );
TabStop = TRUE ;
};
@@ -71,7 +71,7 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA
RadioButton RB_SIMPLE_CONVERSION
{
Pos = MAP_APPFONT( 51, 81 );
- Size = MAP_APPFONT( 55, 8 );
+ Size = MAP_APPFONT( 60, 8 );
Group = TRUE;
@@ -80,16 +80,16 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA
RadioButton RB_HANJA_HANGUL_BRACKETED
{
- Pos = MAP_APPFONT( 109, 81 );
- Size = MAP_APPFONT( 55, 8 );
+ Pos = MAP_APPFONT( 114, 81 );
+ Size = MAP_APPFONT( 60, 8 );
Text [ en-US ] = "Hanja (Han~gul)";
};
RadioButton RB_HANGUL_HANJA_BRACKETED
{
- Pos = MAP_APPFONT( 167, 81 );
- Size = MAP_APPFONT( 55, 8 );
+ Pos = MAP_APPFONT( 177, 81 );
+ Size = MAP_APPFONT( 60, 8 );
Text [ en-US ] = "Hang~ul (Hanja)";
};
@@ -97,7 +97,7 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA
RadioButton RB_HANGUL_HANJA_ABOVE
{
Pos = MAP_APPFONT( 51, 95 );
- Size = MAP_APPFONT( 55, 16 );
+ Size = MAP_APPFONT( 60, 16 );
// this is the _primary_ text
Text [ en-US ] = "Hangu~l";
@@ -105,8 +105,8 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA
RadioButton RB_HANGUL_HANJA_BELOW
{
- Pos = MAP_APPFONT( 109, 95 );
- Size = MAP_APPFONT( 55, 16 );
+ Pos = MAP_APPFONT( 114, 95 );
+ Size = MAP_APPFONT( 60, 16 );
// this is the _primary_ text
Text [ en-US ] = "Hang~ul";
@@ -114,8 +114,8 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA
RadioButton RB_HANJA_HANGUL_ABOVE
{
- Pos = MAP_APPFONT( 51, 114 );
- Size = MAP_APPFONT( 55, 16 );
+ Pos = MAP_APPFONT( 56, 114 );
+ Size = MAP_APPFONT( 60, 16 );
// this is the _primary_ text
Text [ en-US ] = "Han~ja";
@@ -123,8 +123,8 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA
RadioButton RB_HANJA_HANGUL_BELOW
{
- Pos = MAP_APPFONT( 109, 114 );
- Size = MAP_APPFONT( 55, 16 );
+ Pos = MAP_APPFONT( 114, 114 );
+ Size = MAP_APPFONT( 60, 16 );
// this is the _primary_ text
Text [ en-US ] = "Ha~nja";
@@ -141,14 +141,14 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA
CheckBox CB_HANGUL_ONLY
{
Pos = MAP_APPFONT( 51, 134 );
- Size = MAP_APPFONT( 55, 8 );
+ Size = MAP_APPFONT( 60, 8 );
Text [ en-US ] = "Hangul ~only";
};
CheckBox CB_HANJA_ONLY
{
- Pos = MAP_APPFONT( 109, 134 );
+ Pos = MAP_APPFONT( 114, 134 );
Size = MAP_APPFONT( 55, 8 );
Text [ en-US ] = "Hanja onl~y";
@@ -157,12 +157,12 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA
// this element is only for determining where our radio button group ends (in both directions)
FixedText FT_RESIZE_ANCHOR
{
- Pos = MAP_APPFONT( 226, 133 );
+ Pos = MAP_APPFONT( 241, 133 );
};
CheckBox CB_REPLACE_BY_CHARACTER
{
- Pos = MAP_APPFONT( 226, 81 );
+ Pos = MAP_APPFONT( 241, 81 );
Size = MAP_APPFONT( 55, 24 );
WordBreak = TRUE;
diff --git a/svx/source/cui/insrc.cxx b/svx/source/cui/insrc.cxx
new file mode 100644
index 000000000000..10b0a5d713a3
--- /dev/null
+++ b/svx/source/cui/insrc.cxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * 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: insrc.cxx,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_svx.hxx"
+#ifdef SVX_DLLIMPLEMENTATION
+#undef SVX_DLLIMPLEMENTATION
+#endif
+
+#include <svx/dialmgr.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include "insrc.hxx"
+#include "insrc.hrc"
+
+bool SvxInsRowColDlg::isInsertBefore() const
+{
+ return !aAfterBtn.IsChecked();
+}
+
+sal_uInt16 SvxInsRowColDlg::getInsertCount() const
+{
+ return static_cast< sal_uInt16 >( aCountEdit.GetValue() );
+}
+
+SvxInsRowColDlg::SvxInsRowColDlg(Window* pParent, bool bCol, ULONG nHelpId )
+ : ModalDialog( pParent, SVX_RES(DLG_INS_ROW_COL) ),
+ aCount( this, SVX_RES( FT_COUNT ) ),
+ aCountEdit( this, SVX_RES( ED_COUNT ) ),
+ aInsFL( this, SVX_RES( FL_INS ) ),
+ aBeforeBtn( this, SVX_RES( CB_POS_BEFORE ) ),
+ aAfterBtn( this, SVX_RES( CB_POS_AFTER ) ),
+ aPosFL( this, SVX_RES( FL_POS ) ),
+ aRow(SVX_RES(STR_ROW)),
+ aCol(SVX_RES(STR_COL)),
+ aOKBtn( this, SVX_RES( BT_OK ) ),
+ aCancelBtn( this, SVX_RES( BT_CANCEL ) ),
+ aHelpBtn( this, SVX_RES( BT_HELP ) ),
+ bColumn( bCol )
+{
+ FreeResource();
+ String aTmp( GetText() );
+ if( bColumn )
+ {
+ aTmp += aCol;
+ }
+ else
+ {
+ aTmp += aRow;
+ }
+ SetText( aTmp );
+ SetHelpId( nHelpId );
+}
+
+short SvxInsRowColDlg::Execute(void)
+{
+ return ModalDialog::Execute();
+}
+
+
+
diff --git a/svx/source/cui/insrc.hrc b/svx/source/cui/insrc.hrc
new file mode 100644
index 000000000000..e07c7cb2f1d5
--- /dev/null
+++ b/svx/source/cui/insrc.hrc
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * 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: insrc.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+#define FT_COUNT 1
+#define ED_COUNT 2
+#define FL_INS 3
+
+#define CB_POS_BEFORE 10
+#define CB_POS_AFTER 11
+#define FL_POS 12
+
+#define STR_ROW 20
+#define STR_COL 21
+
+#define BT_OK 100
+#define BT_CANCEL 101
+#define BT_HELP 102
diff --git a/svx/source/cui/insrc.hxx b/svx/source/cui/insrc.hxx
new file mode 100644
index 000000000000..e187313bdd03
--- /dev/null
+++ b/svx/source/cui/insrc.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * 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: insrc.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * 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 _SVX_INSRC_HXX
+#define _SVX_INSRC_HXX
+
+#include <svx/stddlg.hxx>
+
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <vcl/button.hxx>
+#include <vcl/group.hxx>
+#include <vcl/button.hxx>
+
+#include <tools/string.hxx>
+
+class SvxInsRowColDlg : public SvxAbstractInsRowColDlg, public ModalDialog
+{
+ FixedText aCount;
+ NumericField aCountEdit;
+ FixedLine aInsFL;
+
+ RadioButton aBeforeBtn;
+ RadioButton aAfterBtn;
+ FixedLine aPosFL;
+
+ String aRow;
+ String aCol;
+
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+
+ bool bColumn;
+
+public:
+ SvxInsRowColDlg( Window* pParent, bool bCol, ULONG nHelpId );
+
+ virtual short Execute(void);
+
+ virtual bool isInsertBefore() const;
+ virtual sal_uInt16 getInsertCount() const;
+};
+
+#endif
+
diff --git a/svx/source/cui/insrc.src b/svx/source/cui/insrc.src
new file mode 100644
index 000000000000..6023e94604ef
--- /dev/null
+++ b/svx/source/cui/insrc.src
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * 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: insrc.src,v $
+ * $Revision: 1.32 $
+ *
+ * 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 <svx/dialogs.hrc>
+#include "insrc.hrc"
+
+ModalDialog DLG_INS_ROW_COL
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 136 , 84 ) ;
+ Text [ en-US ] = "Insert" ;
+ Moveable = TRUE ;
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 80 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 80 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 80 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ RadioButton CB_POS_BEFORE
+ {
+ Pos = MAP_APPFONT ( 12 , 49 ) ;
+ Size = MAP_APPFONT ( 56 , 10 ) ;
+ Text [ en-US ] = "~Before" ;
+ TabStop = TRUE ;
+ };
+ RadioButton CB_POS_AFTER
+ {
+ Pos = MAP_APPFONT ( 12 , 62 ) ;
+ Size = MAP_APPFONT ( 56 , 10 ) ;
+ Text [ en-US ] = "A~fter" ;
+ TabStop = TRUE ;
+ Check = TRUE ;
+ };
+ NumericField ED_COUNT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 44 , 14 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 99 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 5 ;
+ };
+ FixedLine FL_INS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 68 , 8 ) ;
+ Text [ en-US ] = "Insert" ;
+ };
+ FixedLine FL_POS
+ {
+ Pos = MAP_APPFONT ( 6 , 38 ) ;
+ Size = MAP_APPFONT ( 68 , 8 ) ;
+ Text [ en-US ] = "Position";
+ };
+ FixedText FT_COUNT
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "~Number" ;
+ Left = TRUE ;
+ };
+ String STR_ROW
+ {
+ Text [ en-US ] = " Rows" ;
+ };
+ String STR_COL
+ {
+ Text [ en-US ] = " Columns" ;
+ };
+};
diff --git a/svx/source/cui/macropg.src b/svx/source/cui/macropg.src
index 84fdb5c1af7f..0de8a8c5e1dd 100644
--- a/svx/source/cui/macropg.src
+++ b/svx/source/cui/macropg.src
@@ -234,11 +234,11 @@ String RID_SVXSTR_EVENT_PAGECOUNTCHANGE
};
String RID_SVXSTR_EVENT_SUBCOMPONENT_OPENED
{
- Text = "Loaded a sub component" ;
+ Text [ en-US ] = "Loaded a sub component" ;
};
String RID_SVXSTR_EVENT_SUBCOMPONENT_CLOSED
{
- Text = "Closed a sub component" ;
+ Text [ en-US ] = "Closed a sub component" ;
};
String RID_SVXSTR_EVENT_APPROVEPARAMETER
{
diff --git a/svx/source/cui/makefile.mk b/svx/source/cui/makefile.mk
index 7db32bb15f7a..7a1db4a85f19 100755
--- a/svx/source/cui/makefile.mk
+++ b/svx/source/cui/makefile.mk
@@ -100,7 +100,8 @@ SRC1FILES = \
textattr.src \
treeopt.src \
webconninfo.src \
- zoom.src
+ zoom.src \
+ insrc.src
SRS2NAME=cuidrawdlgs
SRC2FILES = \
@@ -221,7 +222,8 @@ SLOFILES+=\
$(SLO)$/macroass.obj \
$(SLO)$/cfg.obj \
$(SLO)$/cfgutil.obj \
- $(SLO)$/optchart.obj
+ $(SLO)$/optchart.obj \
+ $(SLO)$/insrc.obj
.IF "$(GUI)"=="WNT"
SLOFILES+=$(SLO)$/winpluginlib.obj
diff --git a/svx/source/cui/optgdlg.cxx b/svx/source/cui/optgdlg.cxx
index ca8c361fa615..ed93ab97c7d6 100644
--- a/svx/source/cui/optgdlg.cxx
+++ b/svx/source/cui/optgdlg.cxx
@@ -136,7 +136,6 @@ int OfaMiscTabPage::DeactivatePage( SfxItemSet* pSet_ )
return LEAVE_PAGE;
}
-# ifdef ENABLE_GTK
namespace
{
::rtl::OUString impl_SystemFileOpenServiceName()
@@ -146,13 +145,33 @@ namespace
if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "gnome" ) )
{
+ #ifdef ENABLE_GTK
return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.GtkFilePicker" );
+ #else
+ return rtl::OUString();
+ #endif
+ }
+ else if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde4" ) )
+ {
+ #ifdef ENABLE_KDE4
+ return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.KDE4FilePicker" );
+ #else
+ return rtl::OUString();
+ #endif
}
else if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde" ) )
{
+ #ifdef ENABLE_KDE
return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.KDEFilePicker" );
+ #else
+ return rtl::OUString();
+ #endif
}
+ #if defined WNT || (defined MACOSX && defined QUARTZ)
return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.SystemFilePicker" );
+ #else
+ return rtl::OUString();
+ #endif
}
sal_Bool lcl_HasSystemFilePicker()
@@ -180,8 +199,6 @@ namespace
}
}
-#endif
-
// -----------------------------------------------------------------------
OfaMiscTabPage::OfaMiscTabPage(Window* pParent, const SfxItemSet& rSet ) :
@@ -210,20 +227,11 @@ OfaMiscTabPage::OfaMiscTabPage(Window* pParent, const SfxItemSet& rSet ) :
{
FreeResource();
- //system fileopen only available in Windows and with gtk vclplug based
- //picker and on MacOSX (aqua version)
-#if !defined( WNT ) && !defined( ENABLE_GTK ) && !(defined(MACOSX) && defined(QUARTZ))
- aFileDlgFL.Hide();
- aFileDlgCB.Hide();
-#else
-# ifdef ENABLE_GTK
if (!lcl_HasSystemFilePicker())
{
aFileDlgFL.Hide();
aFileDlgCB.Hide();
}
-# endif
-#endif
#if ! defined(QUARTZ)
aPrintDlgFL.Hide();
diff --git a/svx/source/cui/optpath.cxx b/svx/source/cui/optpath.cxx
index b31d56493aed..eeef9ec75fea 100644
--- a/svx/source/cui/optpath.cxx
+++ b/svx/source/cui/optpath.cxx
@@ -41,6 +41,7 @@
#include <tools/shl.hxx>
#include <vcl/msgbox.hxx>
#include <sfx2/filedlghelper.hxx>
+#include <sfx2/app.hxx>
#include <svtools/pickerhelper.hxx>
#include <svtools/aeitem.hxx>
#include <svtools/svtabbx.hxx>
@@ -52,6 +53,7 @@
#include <unotools/localfilehelper.hxx>
#include <svtools/pathoptions.hxx>
#include <svtools/moduleoptions.hxx>
+#include <svtools/viewoptions.hxx>
#define _SVX_OPTPATH_CXX
@@ -62,6 +64,7 @@
#include <svx/dialogs.hrc>
#include "helpid.hrc"
#include <comphelper/processfactory.hxx>
+#include <comphelper/configurationhelper.hxx>
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -91,6 +94,7 @@ using namespace svx;
#define POSTFIX_WRITABLE String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "_writable" ) )
#define POSTFIX_READONLY String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "_readonly" ) )
#define VAR_ONE String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "%1" ) )
+#define IODLG_CONFIGNAME String(DEFINE_CONST_UNICODE("FilePicker_Save"))
// struct OptPath_Impl ---------------------------------------------------
@@ -536,6 +540,26 @@ void SvxPathTabPage::ChangeCurrentEntry( const String& _rFolder )
pPathImpl = (PathUserData_Impl*)pPathBox->GetEntry(nPos)->GetUserData();
pPathImpl->eState = SFX_ITEM_SET;
pPathImpl->sWritablePath = sNewPathStr;
+ if ( SvtPathOptions::PATH_WORK == pPathImpl->nRealId )
+ {
+ // Remove view options entry so the new work path
+ // will be used for the next open dialog.
+ SvtViewOptions aDlgOpt( E_DIALOG, IODLG_CONFIGNAME );
+ aDlgOpt.Delete();
+ // Reset also last used dir in the sfx application instance
+ SfxApplication *pSfxApp = SFX_APP();
+ pSfxApp->ResetLastDir();
+
+ // Set configuration flag to notify file picker that it's necessary
+ // to take over the path provided.
+ Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ ::comphelper::ConfigurationHelper::writeDirectKey(xFactory,
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/")),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Path/Info")),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkPathChanged")),
+ ::com::sun::star::uno::makeAny(true),
+ ::comphelper::ConfigurationHelper::E_STANDARD);
+ }
}
}
diff --git a/svx/source/cui/page.cxx b/svx/source/cui/page.cxx
index 140a7cb646ab..f842af6b7559 100644
--- a/svx/source/cui/page.cxx
+++ b/svx/source/cui/page.cxx
@@ -310,8 +310,8 @@ SvxPageDescPage::SvxPageDescPage( Window* pParent, const SfxItemSet& rAttr ) :
bLandscape ( FALSE ),
eMode ( SVX_PAGE_MODE_STANDARD ),
- ePaperStart ( SVX_PAPER_A3 ),
- ePaperEnd ( SVX_PAPER_DL ),
+ ePaperStart ( PAPER_A3 ),
+ ePaperEnd ( PAPER_ENV_DL ),
pImpl ( new SvxPage_Impl )
{
@@ -455,6 +455,7 @@ void SvxPageDescPage::Init_Impl()
// Handler einstellen
aLayoutBox.SetSelectHdl( LINK( this, SvxPageDescPage, LayoutHdl_Impl ) );
+ aPaperSizeBox.SetDropDownLineCount(10);
aPaperTrayBox.SetGetFocusHdl(
LINK( this, SvxPageDescPage, PaperBinHdl_Impl ) );
@@ -595,22 +596,28 @@ void SvxPageDescPage::Reset( const SfxItemSet& rSet )
aBspWin.SetSize( Size( ConvertLong_Impl( aPaperSize.Width(), eUnit ),
ConvertLong_Impl( aPaperSize.Height(), eUnit ) ) );
- // Werte in die Edits eintragen
- SetMetricValue( aPaperHeightEdit, aPaperSize.Height(), eUnit );
- SetMetricValue( aPaperWidthEdit, aPaperSize.Width(), eUnit );
- aPaperSizeBox.Clear();
+ aPaperSize = OutputDevice::LogicToLogic(aPaperSize, (MapUnit)eUnit, MAP_100TH_MM);
+ if ( bLandscape )
+ Swap( aPaperSize );
+
+ // Actual Paper Format
+ Paper ePaper = SvxPaperInfo::GetSvxPaper( aPaperSize, MAP_100TH_MM, TRUE );
- // Papierformate
- Size aTmpSize = aPaperSize;
+ if ( PAPER_USER != ePaper )
+ aPaperSize = SvxPaperInfo::GetPaperSize( ePaper, MAP_100TH_MM );
if ( bLandscape )
- Swap( aTmpSize );
- // aktuelles Format
- SvxPaper ePaper = SvxPaperInfo::GetPaper( aTmpSize, (MapUnit)eUnit, TRUE );
+ Swap( aPaperSize );
+
+ // Werte in die Edits eintragen
+ SetMetricValue( aPaperHeightEdit, aPaperSize.Height(), SFX_MAPUNIT_100TH_MM );
+ SetMetricValue( aPaperWidthEdit, aPaperSize.Width(), SFX_MAPUNIT_100TH_MM );
+ aPaperSizeBox.Clear();
+
USHORT nActPos = LISTBOX_ENTRY_NOTFOUND;
USHORT nAryId = RID_SVXSTRARY_PAPERSIZE_STD;
- if ( ePaperStart != SVX_PAPER_A3 )
+ if ( ePaperStart != PAPER_A3 )
nAryId = RID_SVXSTRARY_PAPERSIZE_DRAW;
ResStringArray aPaperAry( SVX_RES( nAryId ) );
sal_uInt32 nCnt = aPaperAry.Count();
@@ -618,7 +625,7 @@ void SvxPageDescPage::Reset( const SfxItemSet& rSet )
for ( sal_uInt32 i = 0; i < nCnt; ++i )
{
String aStr = aPaperAry.GetString(i);
- SvxPaper eSize = (SvxPaper)aPaperAry.GetValue(i);
+ Paper eSize = (Paper)aPaperAry.GetValue(i);
USHORT nPos = aPaperSizeBox.InsertEntry( aStr );
aPaperSizeBox.SetEntryData( nPos, (void*)(ULONG)eSize );
@@ -825,11 +832,11 @@ BOOL SvxPageDescPage::FillItemSet( SfxItemSet& rSet )
}
nPos = aPaperSizeBox.GetSelectEntryPos();
- SvxPaper ePaper = (SvxPaper)(ULONG)aPaperSizeBox.GetEntryData( nPos );
+ Paper ePaper = (Paper)(ULONG)aPaperSizeBox.GetEntryData( nPos );
const USHORT nOld = aPaperSizeBox.GetSavedValue();
BOOL bChecked = aLandscapeBtn.IsChecked();
- if ( SVX_PAPER_USER == ePaper )
+ if ( PAPER_USER == ePaper )
{
if ( nOld != nPos ||
aPaperWidthEdit.IsValueModified() ||
@@ -1039,23 +1046,23 @@ IMPL_LINK( SvxPageDescPage, PaperBinHdl_Impl, ListBox *, EMPTYARG )
IMPL_LINK( SvxPageDescPage, PaperSizeSelect_Impl, ListBox *, pBox )
{
const USHORT nPos = pBox->GetSelectEntryPos();
- SvxPaper ePaper = (SvxPaper)(ULONG)aPaperSizeBox.GetEntryData( nPos );
+ Paper ePaper = (Paper)(ULONG)aPaperSizeBox.GetEntryData( nPos );
- if ( ePaper != SVX_PAPER_USER )
+ if ( ePaper != PAPER_USER )
{
- Size aSize( SvxPaperInfo::GetPaperSize( ePaper ) );
+ Size aSize( SvxPaperInfo::GetPaperSize( ePaper, MAP_100TH_MM ) );
if ( aLandscapeBtn.IsChecked() )
Swap( aSize );
- if ( aSize.Height() < aPaperHeightEdit.GetMin( FUNIT_TWIP ) )
+ if ( aSize.Height() < aPaperHeightEdit.GetMin( FUNIT_100TH_MM ) )
aPaperHeightEdit.SetMin(
- aPaperHeightEdit.Normalize( aSize.Height() ), FUNIT_TWIP );
- if ( aSize.Width() < aPaperWidthEdit.GetMin( FUNIT_TWIP ) )
+ aPaperHeightEdit.Normalize( aSize.Height() ), FUNIT_100TH_MM );
+ if ( aSize.Width() < aPaperWidthEdit.GetMin( FUNIT_100TH_MM ) )
aPaperWidthEdit.SetMin(
- aPaperWidthEdit.Normalize( aSize.Width() ), FUNIT_TWIP );
- SetMetricValue( aPaperHeightEdit, aSize.Height(), SFX_MAPUNIT_TWIP );
- SetMetricValue( aPaperWidthEdit, aSize.Width(), SFX_MAPUNIT_TWIP );
+ aPaperWidthEdit.Normalize( aSize.Width() ), FUNIT_100TH_MM );
+ SetMetricValue( aPaperHeightEdit, aSize.Height(), SFX_MAPUNIT_100TH_MM );
+ SetMetricValue( aPaperWidthEdit, aSize.Width(), SFX_MAPUNIT_100TH_MM );
// R"ander ggf. neu berechnen
CalcMargin_Impl();
@@ -1067,7 +1074,7 @@ IMPL_LINK( SvxPageDescPage, PaperSizeSelect_Impl, ListBox *, pBox )
{
// Draw: bei Papierformat soll der Rand 1cm betragen
long nTmp = 0;
- BOOL bScreen = ( SVX_PAPER_SCREEN == ePaper );
+ BOOL bScreen = ( PAPER_SCREEN == ePaper );
if ( !bScreen )
// bei Bildschirm keinen Rand
@@ -1116,12 +1123,12 @@ IMPL_LINK( SvxPageDescPage, PaperSizeModify_Impl, Edit *, EMPTYARG )
SfxMapUnit eUnit = GetItemSet().GetPool()->GetMetric( nWhich );
Size aSize( GetCoreValue( aPaperWidthEdit, eUnit ),
GetCoreValue( aPaperHeightEdit, eUnit ) );
- SvxPaper ePaper = SvxPaperInfo::GetPaper( aSize, (MapUnit)eUnit, TRUE );
+ Paper ePaper = SvxPaperInfo::GetSvxPaper( aSize, (MapUnit)eUnit, TRUE );
USHORT nEntryCount = aPaperSizeBox.GetEntryCount();
for ( USHORT i = 0; i < nEntryCount; ++i )
{
- SvxPaper eTmp = (SvxPaper)(ULONG)aPaperSizeBox.GetEntryData(i);
+ Paper eTmp = (Paper)(ULONG)aPaperSizeBox.GetEntryData(i);
if ( eTmp == ePaper )
{
@@ -1144,12 +1151,12 @@ IMPL_LINK( SvxPageDescPage, SwapOrientation_Impl, RadioButton *, pBtn )
{
bLandscape = aLandscapeBtn.IsChecked();
- const long lWidth = GetCoreValue( aPaperWidthEdit, SFX_MAPUNIT_TWIP );
- const long lHeight = GetCoreValue( aPaperHeightEdit, SFX_MAPUNIT_TWIP );
+ const long lWidth = GetCoreValue( aPaperWidthEdit, SFX_MAPUNIT_100TH_MM );
+ const long lHeight = GetCoreValue( aPaperHeightEdit, SFX_MAPUNIT_100TH_MM );
// swap with and height
- SetMetricValue( aPaperWidthEdit, lHeight, SFX_MAPUNIT_TWIP );
- SetMetricValue( aPaperHeightEdit, lWidth, SFX_MAPUNIT_TWIP );
+ SetMetricValue( aPaperWidthEdit, lHeight, SFX_MAPUNIT_100TH_MM );
+ SetMetricValue( aPaperHeightEdit, lWidth, SFX_MAPUNIT_100TH_MM );
// recalculate margins if necessary
CalcMargin_Impl();
@@ -1478,9 +1485,9 @@ int SvxPageDescPage::DeactivatePage( SfxItemSet* _pSet )
// Wenn nicht, dann den Anwender fragen, ob sie "ubernommen werden sollen.
// Wenn nicht, dann auf der TabPage bleiben.
USHORT nPos = aPaperSizeBox.GetSelectEntryPos();
- SvxPaper ePaper = (SvxPaper)(ULONG)aPaperSizeBox.GetEntryData( nPos );
+ Paper ePaper = (Paper)(ULONG)aPaperSizeBox.GetEntryData( nPos );
- if ( ePaper != SVX_PAPER_SCREEN && IsMarginOutOfRange() )
+ if ( ePaper != PAPER_SCREEN && IsMarginOutOfRange() )
{
if ( QueryBox( this, WB_YES_NO | WB_DEF_NO, aPrintRangeQueryText ).Execute() == RET_NO )
{
@@ -1775,7 +1782,7 @@ void SvxPageDescPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
if (pModeItem)
SetMode((SvxModeType)pModeItem->GetEnumValue());
if (pPaperStartItem && pPaperEndItem)
- SetPaperFormatRanges( (SvxPaper)pPaperStartItem->GetEnumValue(), (SvxPaper)pPaperEndItem->GetEnumValue() );
+ SetPaperFormatRanges( (Paper)pPaperStartItem->GetEnumValue(), (Paper)pPaperEndItem->GetEnumValue() );
if (pCollectListItem)
SetCollectionList(pCollectListItem->GetList());
}
diff --git a/svx/source/cui/page.h b/svx/source/cui/page.h
index 60f962565d33..98aefdc79cc4 100644
--- a/svx/source/cui/page.h
+++ b/svx/source/cui/page.h
@@ -38,13 +38,13 @@
#define PAPERSIZE_A3 3
#define PAPERSIZE_A4 4
#define PAPERSIZE_A5 5
-#define PAPERSIZE_B4 6
-#define PAPERSIZE_B5 7
+#define PAPERSIZE_B4_ISO 6
+#define PAPERSIZE_B5_ISO 7
#define PAPERSIZE_LETTER 8
#define PAPERSIZE_LEGAL 9
#define PAPERSIZE_TABLOID 10
#define PAPERSIZE_USER 11
-#define PAPERSIZE_B6 12
+#define PAPERSIZE_B6_ISO 12
#define PAPERSIZE_C4 13
#define PAPERSIZE_C5 14
#define PAPERSIZE_C6 15
@@ -52,25 +52,23 @@
#define PAPERSIZE_DL 17
#define PAPERSIZE_DIA 18
#define PAPERSIZE_SCREEN 19
-#define PAPERSIZE_A 20
-#define PAPERSIZE_B 21
-#define PAPERSIZE_C 22
-#define PAPERSIZE_D 23
-#define PAPERSIZE_E 24
-#define PAPERSIZE_EXECUTIVE 25
-#define PAPERSIZE_LEGAL2 26
-#define PAPERSIZE_MONARCH 27
-#define PAPERSIZE_COM675 28
-#define PAPERSIZE_COM9 29
-#define PAPERSIZE_COM10 30
-#define PAPERSIZE_COM11 31
-#define PAPERSIZE_COM12 32
-#define PAPERSIZE_KAI16 33
-#define PAPERSIZE_KAI32 34
-#define PAPERSIZE_KAI32BIG 35
-#define PAPERSIZE_B4_JIS 36
-#define PAPERSIZE_B5_JIS 37
-#define PAPERSIZE_B6_JIS 38
+#define PAPERSIZE_C 20
+#define PAPERSIZE_D 21
+#define PAPERSIZE_E 22
+#define PAPERSIZE_EXECUTIVE 23
+#define PAPERSIZE_LEGAL2 24
+#define PAPERSIZE_MONARCH 25
+#define PAPERSIZE_COM675 26
+#define PAPERSIZE_COM9 27
+#define PAPERSIZE_COM10 28
+#define PAPERSIZE_COM11 29
+#define PAPERSIZE_COM12 30
+#define PAPERSIZE_KAI16 31
+#define PAPERSIZE_KAI32 32
+#define PAPERSIZE_KAI32BIG 33
+#define PAPERSIZE_B4_JIS 34
+#define PAPERSIZE_B5_JIS 35
+#define PAPERSIZE_B6_JIS 36
#endif
diff --git a/svx/source/cui/page.hxx b/svx/source/cui/page.hxx
index 5b04e91ac387..a1fae0536af8 100644
--- a/svx/source/cui/page.hxx
+++ b/svx/source/cui/page.hxx
@@ -53,6 +53,9 @@
#include <svx/frmdirlbox.hxx>
#include <svx/svxenum.hxx>
+
+#include <i18npool/paper.hxx>
+
#include "flagsdef.hxx" //CHINA001
// enum ------------------------------------------------------------------
@@ -183,8 +186,8 @@ class SvxPageDescPage : public SfxTabPage
BOOL bLandscape;
FASTBOOL bBorderModified;
SvxModeType eMode;
- SvxPaper ePaperStart;
- SvxPaper ePaperEnd;
+ Paper ePaperStart;
+ Paper ePaperEnd;
SvxPage_Impl* pImpl;
@@ -242,7 +245,7 @@ public:
virtual ~SvxPageDescPage();
void SetMode( SvxModeType eMType ) { eMode = eMType; }
- void SetPaperFormatRanges( SvxPaper eStart, SvxPaper eEnd )
+ void SetPaperFormatRanges( Paper eStart, Paper eEnd )
{ ePaperStart = eStart, ePaperEnd = eEnd; }
void SetCollectionList(const List* pList);
diff --git a/svx/source/cui/page.src b/svx/source/cui/page.src
index 697f1416b47c..6a44e41729a7 100644
--- a/svx/source/cui/page.src
+++ b/svx/source/cui/page.src
@@ -399,11 +399,11 @@ String RID_SVXSTR_PAPER_A5
{
Text = "A5" ;
};
-String RID_SVXSTR_PAPER_B4
+String RID_SVXSTR_PAPER_B4_ISO
{
Text = "B4 (ISO)" ;
};
-String RID_SVXSTR_PAPER_B5
+String RID_SVXSTR_PAPER_B5_ISO
{
Text = "B5 (ISO)" ;
};
@@ -423,46 +423,38 @@ String RID_SVXSTR_PAPER_USER
{
Text [ en-US ] = "User Defined" ;
};
-String RID_SVXSTR_PAPER_B6
+String RID_SVXSTR_PAPER_B6_ISO
{
Text = "B6 (ISO)" ;
};
String RID_SVXSTR_PAPER_C4
{
- Text = "C4" ;
+ Text = "C4 Envelope" ;
};
String RID_SVXSTR_PAPER_C5
{
- Text = "C5" ;
+ Text = "C5 Envelope" ;
};
String RID_SVXSTR_PAPER_C6
{
- Text = "C6" ;
+ Text = "C6 Envelope" ;
};
String RID_SVXSTR_PAPER_C65
{
- Text = "C6/5" ;
+ Text = "C6/5 Envelope" ;
};
String RID_SVXSTR_PAPER_DL
{
- Text = "DL" ;
+ Text = "DL Envelope" ;
};
String RID_SVXSTR_PAPER_DIA
{
- Text = "Dia" ;
+ Text = "Dia Slide" ;
};
String RID_SVXSTR_PAPER_SCREEN
{
Text [ en-US ] = "Screen" ;
};
-String RID_SVXSTR_PAPER_A
-{
- Text = "A" ;
-};
-String RID_SVXSTR_PAPER_B
-{
- Text = "B" ;
-};
String RID_SVXSTR_PAPER_C
{
Text = "C" ;
@@ -477,47 +469,47 @@ String RID_SVXSTR_PAPER_E
};
String RID_SVXSTR_PAPER_EXECUTIVE
{
- Text = "Executive" ;
+ Text = "Executive" ;
};
String RID_SVXSTR_PAPER_LEGAL2
{
- Text = "Legal" ;
+ Text = "Long Bond" ;
};
String RID_SVXSTR_PAPER_MONARCH
{
- Text = "Monarch" ;
+ Text = "#8 (Monarch) Envelope" ;
};
String RID_SVXSTR_PAPER_COM675
{
- Text = "Env. 6¾" ;
+ Text = "#6 3/4 (Personal) Envelope" ;
};
String RID_SVXSTR_PAPER_COM9
{
- Text = "Env. 9" ;
+ Text = "#9 Envelope" ;
};
String RID_SVXSTR_PAPER_COM10
{
- Text = "Env. 10" ;
+ Text = "#10 Envelope" ;
};
String RID_SVXSTR_PAPER_COM11
{
- Text = "Env. 11" ;
+ Text = "#11 Envelope" ;
};
String RID_SVXSTR_PAPER_COM12
{
- Text = "Env. 12" ;
+ Text = "#12 Envelope" ;
};
String RID_SVXSTR_PAPER_KAI16
{
- Text = "16 kai" ;
+ Text = "16 Kai" ;
};
String RID_SVXSTR_PAPER_KAI32
{
- Text = "32 kai" ;
+ Text = "32 Kai" ;
};
String RID_SVXSTR_PAPER_KAI32BIG
{
- Text = "32 kai big" ;
+ Text = "Big 32 Kai" ;
};
String RID_SVXSTR_PAPER_B4_JIS
{
@@ -535,67 +527,69 @@ StringArray RID_SVXSTRARY_PAPERSIZE_STD
{
ItemList [ en-US ] =
{
- < "A3" ; PAPERSIZE_A3 ; > ;
- < "A4" ; PAPERSIZE_A4 ; > ;
< "A5" ; PAPERSIZE_A5 ; > ;
- < "B4 (ISO)" ; PAPERSIZE_B4 ; > ;
- < "B5 (ISO)" ; PAPERSIZE_B5 ; > ;
- < "B6 (ISO)" ; PAPERSIZE_B6 ; > ;
- < "B4 (JIS)" ; PAPERSIZE_B4_JIS ; > ;
- < "B5 (JIS)" ; PAPERSIZE_B5_JIS ; > ;
- < "B6 (JIS)" ; PAPERSIZE_B6_JIS ; > ;
+ < "A4" ; PAPERSIZE_A4 ; > ;
+ < "A3" ; PAPERSIZE_A3 ; > ;
+ < "B6 (ISO)" ; PAPERSIZE_B6_ISO ; > ;
+ < "B5 (ISO)" ; PAPERSIZE_B5_ISO ; > ;
+ < "B4 (ISO)" ; PAPERSIZE_B4_ISO ; > ;
< "Letter" ; PAPERSIZE_LETTER ; > ;
< "Legal" ; PAPERSIZE_LEGAL ; > ;
+ < "Long Bond" ; PAPERSIZE_LEGAL2 ; > ;
< "Tabloid" ; PAPERSIZE_TABLOID ; > ;
+ < "B6 (JIS)" ; PAPERSIZE_B6_JIS ; > ;
+ < "B5 (JIS)" ; PAPERSIZE_B5_JIS ; > ;
+ < "B4 (JIS)" ; PAPERSIZE_B4_JIS ; > ;
+ < "16 Kai" ; PAPERSIZE_KAI16; > ;
+ < "32 Kai" ; PAPERSIZE_KAI32; > ;
+ < "Big 32 Kai" ; PAPERSIZE_KAI32BIG; > ;
< "User" ; PAPERSIZE_USER ; > ;
- < "C4" ; PAPERSIZE_C4 ; > ;
- < "C5" ; PAPERSIZE_C5 ; > ;
- < "C6" ; PAPERSIZE_C6 ; > ;
- < "C6/5" ; PAPERSIZE_C65 ; > ;
- < "DL" ; PAPERSIZE_DL ; > ;
- < "Env. #6¾" ; PAPERSIZE_COM675; > ;
- < "Env. Monarch" ; PAPERSIZE_MONARCH; > ;
- < "Env. #9" ; PAPERSIZE_COM9; > ;
- < "Env. #10" ; PAPERSIZE_COM10; > ;
- < "Env. #11" ; PAPERSIZE_COM11; > ;
- < "Env. #12" ; PAPERSIZE_COM12; > ;
- < "16 kai" ; PAPERSIZE_KAI16; > ;
- < "32 kai" ; PAPERSIZE_KAI32; > ;
- < "32 kai large" ; PAPERSIZE_KAI32BIG; > ;
- };
+ < "DL Envelope" ; PAPERSIZE_DL ; > ;
+ < "C6 Envelope" ; PAPERSIZE_C6 ; > ;
+ < "C6/5 Envelope" ; PAPERSIZE_C65 ; > ;
+ < "C5 Envelope" ; PAPERSIZE_C5 ; > ;
+ < "C4 Envelope" ; PAPERSIZE_C4 ; > ;
+ < "#6 3/4 (Personal) Envelope" ; PAPERSIZE_COM675; > ;
+ < "#8 (Monarch) Envelope" ; PAPERSIZE_MONARCH; > ;
+ < "#9 Envelope" ; PAPERSIZE_COM9; > ;
+ < "#10 Envelope" ; PAPERSIZE_COM10; > ;
+ < "#11 Envelope" ; PAPERSIZE_COM11; > ;
+ < "#12 Envelope" ; PAPERSIZE_COM12; > ;
};
+};
StringArray RID_SVXSTRARY_PAPERSIZE_DRAW
{
ItemList [ en-US ] =
{
- < "A0" ; PAPERSIZE_A0 ; > ;
- < "A1" ; PAPERSIZE_A1 ; > ;
- < "A2" ; PAPERSIZE_A2 ; > ;
- < "A3" ; PAPERSIZE_A3 ; > ;
- < "A4" ; PAPERSIZE_A4 ; > ;
< "A5" ; PAPERSIZE_A5 ; > ;
- < "B4 (ISO)" ; PAPERSIZE_B4 ; > ;
- < "B5 (ISO)" ; PAPERSIZE_B5 ; > ;
- < "B6 (ISO)" ; PAPERSIZE_B6 ; > ;
- < "B4 (JIS)" ; PAPERSIZE_B4_JIS ; > ;
- < "B5 (JIS)" ; PAPERSIZE_B5_JIS ; > ;
- < "B6 (JIS)" ; PAPERSIZE_B6_JIS ; > ;
+ < "A4" ; PAPERSIZE_A4 ; > ;
+ < "A3" ; PAPERSIZE_A3 ; > ;
+ < "A2" ; PAPERSIZE_A2 ; > ;
+ < "A1" ; PAPERSIZE_A1 ; > ;
+ < "A0" ; PAPERSIZE_A0 ; > ;
+ < "B6 (ISO)" ; PAPERSIZE_B6_ISO ; > ;
+ < "B5 (ISO)" ; PAPERSIZE_B5_ISO ; > ;
+ < "B4 (ISO)" ; PAPERSIZE_B4_ISO ; > ;
< "Letter" ; PAPERSIZE_LETTER ; > ;
< "Legal" ; PAPERSIZE_LEGAL ; > ;
+ < "Long Bond" ; PAPERSIZE_LEGAL2 ; > ;
< "Tabloid" ; PAPERSIZE_TABLOID ; > ;
+ < "B6 (JIS)" ; PAPERSIZE_B6_JIS ; > ;
+ < "B5 (JIS)" ; PAPERSIZE_B5_JIS ; > ;
+ < "B4 (JIS)" ; PAPERSIZE_B4_JIS ; > ;
+ < "16 Kai" ; PAPERSIZE_KAI16; > ;
+ < "32 Kai" ; PAPERSIZE_KAI32; > ;
+ < "Big 32 Kai" ; PAPERSIZE_KAI32BIG; > ;
< "User" ; PAPERSIZE_USER ; > ;
- < "C4" ; PAPERSIZE_C4 ; > ;
- < "C5" ; PAPERSIZE_C5 ; > ;
- < "C6" ; PAPERSIZE_C6 ; > ;
- < "C6/5" ; PAPERSIZE_C65 ; > ;
- < "DL" ; PAPERSIZE_DL ; > ;
- < "Slide" ; PAPERSIZE_DIA ; > ;
+ < "DL Envelope" ; PAPERSIZE_DL ; > ;
+ < "C6 Envelope" ; PAPERSIZE_C6 ; > ;
+ < "C6/5 Envelope" ; PAPERSIZE_C65 ; > ;
+ < "C5 Envelope" ; PAPERSIZE_C5 ; > ;
+ < "C4 Envelope" ; PAPERSIZE_C4 ; > ;
+ < "Dia Slide" ; PAPERSIZE_DIA ; > ;
< "Screen" ; PAPERSIZE_SCREEN ; > ;
- < "16 kai" ; PAPERSIZE_KAI16; > ;
- < "32 kai" ; PAPERSIZE_KAI32; > ;
- < "32 kai large" ; PAPERSIZE_KAI32BIG; > ;
- };
};
+};
String RID_SVXSTR_PAPERBIN
{
Text [ en-US ] = "Paper tray" ;
diff --git a/svx/source/cui/svuidlg.src b/svx/source/cui/svuidlg.src
index a00a09e919e6..cc8f2db676ae 100644
--- a/svx/source/cui/svuidlg.src
+++ b/svx/source/cui/svuidlg.src
@@ -156,37 +156,37 @@ ModalDialog MD_UPDATE_BASELINKS
};
CancelButton 1
{
- Pos = MAP_APPFONT ( 275 , 6 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
+ Pos = MAP_APPFONT ( 270 , 6 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
Text [ en-US ] = "~Close" ;
};
HelpButton 1
{
- Pos = MAP_APPFONT ( 275 , 26 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
+ Pos = MAP_APPFONT ( 270 , 26 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
};
PushButton PB_UPDATE_NOW
{
- Pos = MAP_APPFONT ( 275 , 43 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
+ Pos = MAP_APPFONT ( 270 , 43 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
Text [ en-US ] = "~Update" ;
};
PushButton PB_OPEN_SOURCE
{
- Pos = MAP_APPFONT ( 275 , 60 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
+ Pos = MAP_APPFONT ( 270 , 60 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
Text [ en-US ] = "~Open" ;
};
PushButton PB_CHANGE_SOURCE
{
- Pos = MAP_APPFONT ( 275 , 77 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
+ Pos = MAP_APPFONT ( 270 , 77 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
Text [ en-US ] = "~Modify..." ;
};
PushButton PB_BREAK_LINK
{
- Pos = MAP_APPFONT ( 275 , 94 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
+ Pos = MAP_APPFONT ( 270 , 94 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
Text [ en-US ] = "~Break Link" ;
};
FixedText FT_FILES2
diff --git a/svx/source/cui/zoom.src b/svx/source/cui/zoom.src
index dca32260ab8d..197d1e2f2959 100644
--- a/svx/source/cui/zoom.src
+++ b/svx/source/cui/zoom.src
@@ -37,48 +37,48 @@ ModalDialog RID_SVXDLG_ZOOM
HelpId = SID_ATTR_ZOOM ;
OutputSize = TRUE ;
SvLook = TRUE ;
- Size = MAP_APPFONT ( 218 , 112 ) ;
+ Size = MAP_APPFONT ( 242 , 112 ) ;
Moveable = TRUE ;
Text [ en-US ] = "Zoom & View Layout";
FixedLine FL_ZOOM
{
Pos = MAP_APPFONT ( 6 , 3 ) ;
- Size = MAP_APPFONT ( 100 , 8 ) ;
+ Size = MAP_APPFONT ( 112 , 8 ) ;
Text [ en-US ] = "Zoom factor";
};
RadioButton BTN_OPTIMAL
{
Pos = MAP_APPFONT ( 12 , 14 ) ;
- Size = MAP_APPFONT ( 91 , 10 ) ;
+ Size = MAP_APPFONT ( 105 , 10 ) ;
Text [ en-US ] = "~Optimal" ;
};
RadioButton BTN_WHOLE_PAGE
{
Pos = MAP_APPFONT ( 12 , 27 ) ;
- Size = MAP_APPFONT ( 91 , 10 ) ;
+ Size = MAP_APPFONT ( 105 , 10 ) ;
Text [ en-US ] = "~Fit width and height" ;
};
RadioButton BTN_PAGE_WIDTH
{
Pos = MAP_APPFONT ( 12 , 40 ) ;
- Size = MAP_APPFONT ( 91 , 10 ) ;
+ Size = MAP_APPFONT ( 105, 10 ) ;
Text [ en-US ] = "Fit ~width" ;
};
RadioButton BTN_100
{
Pos = MAP_APPFONT ( 12 , 53 ) ;
- Size = MAP_APPFONT ( 91 , 10 ) ;
+ Size = MAP_APPFONT ( 105, 10 ) ;
Text = "~100 %" ;
};
RadioButton BTN_USER
{
Pos = MAP_APPFONT ( 12 , 67 ) ;
- Size = MAP_APPFONT ( 59 , 10 ) ;
+ Size = MAP_APPFONT ( 72 , 10 ) ;
Text [ en-US ] = "~Variable" ;
};
MetricField ED_USER
{
- Pos = MAP_APPFONT ( 74 , 66 ) ;
+ Pos = MAP_APPFONT ( 86 , 66 ) ;
Size = MAP_APPFONT ( 32 , 12 ) ;
Border = TRUE ;
Group = TRUE ;
@@ -91,31 +91,31 @@ ModalDialog RID_SVXDLG_ZOOM
};
FixedLine FL_VIEWLAYOUT
{
- Pos = MAP_APPFONT ( 112 , 3 ) ;
- Size = MAP_APPFONT ( 100 , 8 ) ;
+ Pos = MAP_APPFONT ( 124 , 3 ) ;
+ Size = MAP_APPFONT ( 112 , 8 ) ;
Text [ en-US ] = "View layout";
};
RadioButton BTN_AUTOMATIC
{
- Pos = MAP_APPFONT ( 118 , 14 ) ;
- Size = MAP_APPFONT ( 91 , 10 ) ;
+ Pos = MAP_APPFONT ( 130 , 14 ) ;
+ Size = MAP_APPFONT ( 106 , 10 ) ;
Text [ en-US ] = "~Automatic" ;
};
RadioButton BTN_SINGLE
{
- Pos = MAP_APPFONT ( 118 , 27 ) ;
- Size = MAP_APPFONT ( 91 , 10 ) ;
+ Pos = MAP_APPFONT ( 130, 27 ) ;
+ Size = MAP_APPFONT ( 106, 10 ) ;
Text [ en-US ] = "~Single page" ;
};
RadioButton BTN_COLUMNS
{
- Pos = MAP_APPFONT ( 118 , 41 ) ;
- Size = MAP_APPFONT ( 64 , 10 ) ;
+ Pos = MAP_APPFONT ( 130, 41 ) ;
+ Size = MAP_APPFONT ( 75 , 10 ) ;
Text [ en-US ] = "~Columns" ;
};
MetricField ED_COLUMNS
{
- Pos = MAP_APPFONT ( 185 , 40 ) ;
+ Pos = MAP_APPFONT ( 209 , 40 ) ;
Size = MAP_APPFONT ( 24 , 12 ) ;
Border = TRUE ;
Group = TRUE ;
@@ -128,29 +128,29 @@ ModalDialog RID_SVXDLG_ZOOM
};
CheckBox CHK_BOOK
{
- Pos = MAP_APPFONT ( 124 , 55 ) ;
+ Pos = MAP_APPFONT ( 136 , 55 ) ;
Size = MAP_APPFONT ( 85 , 10 ) ;
Text [ en-US ] = "~Book mode" ;
};
FixedLine FL_BOTTOM
{
Pos = MAP_APPFONT ( 6 , 81 ) ;
- Size = MAP_APPFONT ( 206 , 8 ) ;
+ Size = MAP_APPFONT ( 230 , 8 ) ;
};
OKButton BTN_ZOOM_OK
{
- Pos = MAP_APPFONT ( 53 , 92 ) ;
+ Pos = MAP_APPFONT ( 77 , 92 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
DefButton = TRUE ;
};
CancelButton BTN_ZOOM_CANCEL
{
- Pos = MAP_APPFONT ( 106 , 92 ) ;
+ Pos = MAP_APPFONT ( 130 , 92 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
};
HelpButton BTN_ZOOM_HELP
{
- Pos = MAP_APPFONT ( 162 , 92 ) ;
+ Pos = MAP_APPFONT ( 186 , 92 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
};
};
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index e4b2d1da1a0d..f066cd6a4729 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -751,30 +751,9 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) :
}
break;
case mso_sptCurvedLeftArrow :
- {
- if ( ( seqAdjustmentValues.getLength() > 2 ) && ( seqAdjustmentValues[ 2 ].State == com::sun::star::beans::PropertyState_DIRECT_VALUE ) )
- {
- double fValue;
- seqAdjustmentValues[ 2 ].Value >>= fValue;
- fValue = 21600 - fValue;
- seqAdjustmentValues[ 2 ].Value <<= fValue;
- }
- nFlags |= DFF_CUSTOMSHAPE_FLIP_H;
- }
- break;
+ case mso_sptCurvedRightArrow :
case mso_sptCurvedUpArrow :
- {
- if ( ( seqAdjustmentValues.getLength() > 2 ) && ( seqAdjustmentValues[ 2 ].State == com::sun::star::beans::PropertyState_DIRECT_VALUE ) )
- {
- double fValue;
- seqAdjustmentValues[ 2 ].Value >>= fValue;
- fValue = 21600 - fValue;
- seqAdjustmentValues[ 2 ].Value <<= fValue;
- }
- nFlags |= DFF_CUSTOMSHAPE_FLIP_V | DFF_CUSTOMSHAPE_EXCH;
- }
- break;
- case mso_sptCurvedDownArrow : nFlags |= DFF_CUSTOMSHAPE_EXCH; break;
+ case mso_sptCurvedDownArrow : nColorData = 0x2d000000; break;
case mso_sptRibbon2 : nColorData = 0x30dd0000; break;
case mso_sptRibbon : nColorData = 0x30dd0000; break;
@@ -1152,6 +1131,14 @@ sal_Bool EnhancedCustomShape2d::GetHandlePosition( const sal_uInt32 nIndex, Poin
}
rReturnPosition = GetPoint( aHandle.aPosition, sal_True, sal_False );
}
+ const GeoStat aGeoStat( ((SdrObjCustomShape*)pCustomShapeObj)->GetGeoStat() );
+ if ( aGeoStat.nShearWink )
+ {
+ double nTan = aGeoStat.nTan;
+ if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV))
+ nTan = -nTan;
+ ShearPoint( rReturnPosition, Point( aLogicRect.GetWidth() / 2, aLogicRect.GetHeight() / 2 ), nTan );
+ }
if ( nRotateAngle )
{
double a = nRotateAngle * F_PI18000;
@@ -1193,6 +1180,15 @@ sal_Bool EnhancedCustomShape2d::SetHandleControllerPosition( const sal_uInt32 nI
double a = -nRotateAngle * F_PI18000;
RotatePoint( aP, Point( aLogicRect.GetWidth() / 2, aLogicRect.GetHeight() / 2 ), sin( a ), cos( a ) );
}
+ const GeoStat aGeoStat( ((SdrObjCustomShape*)pCustomShapeObj)->GetGeoStat() );
+ if ( aGeoStat.nShearWink )
+ {
+ double nTan = -aGeoStat.nTan;
+ if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV))
+ nTan = -nTan;
+ ShearPoint( aP, Point( aLogicRect.GetWidth() / 2, aLogicRect.GetHeight() / 2 ), nTan );
+ }
+
double fPos1 = aP.X(); //( bFlipH ) ? aLogicRect.GetWidth() - aP.X() : aP.X();
double fPos2 = aP.Y(); //( bFlipV ) ? aLogicRect.GetHeight() -aP.Y() : aP.Y();
fPos1 /= fXScale;
@@ -2062,13 +2058,17 @@ void EnhancedCustomShape2d::ApplyGluePoints( SdrObject* pObj )
for ( i = 0; i < nCount; i++ )
{
SdrGluePoint aGluePoint;
- const Point& rPoint = GetPoint( seqGluePoints[ i ], sal_True, sal_True );
- double fXRel = rPoint.X();
- double fYRel = rPoint.Y();
- fXRel = aLogicRect.GetWidth() == 0 ? 0.0 : fXRel / aLogicRect.GetWidth() * 10000;
- fYRel = aLogicRect.GetHeight() == 0 ? 0.0 : fYRel / aLogicRect.GetHeight() * 10000;
- aGluePoint.SetPos( Point( (sal_Int32)fXRel, (sal_Int32)fYRel ) );
- aGluePoint.SetPercent( sal_True );
+
+ aGluePoint.SetPos( GetPoint( seqGluePoints[ i ], sal_True, sal_True ) );
+ aGluePoint.SetPercent( sal_False );
+
+// const Point& rPoint = GetPoint( seqGluePoints[ i ], sal_True, sal_True );
+// double fXRel = rPoint.X();
+// double fYRel = rPoint.Y();
+// fXRel = aLogicRect.GetWidth() == 0 ? 0.0 : fXRel / aLogicRect.GetWidth() * 10000;
+// fYRel = aLogicRect.GetHeight() == 0 ? 0.0 : fYRel / aLogicRect.GetHeight() * 10000;
+// aGluePoint.SetPos( Point( (sal_Int32)fXRel, (sal_Int32)fYRel ) );
+// aGluePoint.SetPercent( sal_True );
aGluePoint.SetAlign( SDRVERTALIGN_TOP | SDRHORZALIGN_LEFT );
aGluePoint.SetEscDir( SDRESC_SMART );
SdrGluePointList* pList = pObj->ForceGluePointList();
diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
index 0ac56ff21a43..8ae4e34197c5 100644
--- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
@@ -307,6 +307,19 @@ REF( com::sun::star::drawing::XShape ) SAL_CALL EnhancedCustomShapeEngine::rende
pRenderedShape = pRenderedShape3d;
}
Rectangle aRect( pSdrObjCustomShape->GetSnapRect() );
+
+ const GeoStat& rGeoStat = ((SdrObjCustomShape*)pSdrObjCustomShape)->GetGeoStat();
+ if ( rGeoStat.nShearWink )
+ {
+ long nShearWink = rGeoStat.nShearWink;
+ double nTan = rGeoStat.nTan;
+ if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV))
+ {
+ nShearWink = -nShearWink;
+ nTan = -nTan;
+ }
+ pRenderedShape->Shear( pSdrObjCustomShape->GetSnapRect().Center(), nShearWink, nTan, FALSE);
+ }
if( nRotateAngle )
{
double a = nRotateAngle * F_PI18000;
@@ -374,19 +387,34 @@ com::sun::star::drawing::PolyPolygonBezierCoords SAL_CALL EnhancedCustomShapeEng
if ( pObj )
{
Rectangle aRect( pSdrObjCustomShape->GetSnapRect() );
+ sal_Bool bFlipV = aCustomShape2d.IsFlipVert();
+ sal_Bool bFlipH = aCustomShape2d.IsFlipHorz();
+
+ const GeoStat& rGeoStat = ((SdrObjCustomShape*)pSdrObjCustomShape)->GetGeoStat();
+ if ( rGeoStat.nShearWink )
+ {
+ long nShearWink = rGeoStat.nShearWink;
+ double nTan = rGeoStat.nTan;
+ if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV))
+ {
+ nShearWink = -nShearWink;
+ nTan = -nTan;
+ }
+ pObj->Shear( aRect.Center(), nShearWink, nTan, FALSE);
+ }
sal_Int32 nRotateAngle = aCustomShape2d.GetRotateAngle();
if( nRotateAngle )
{
double a = nRotateAngle * F_PI18000;
pObj->NbcRotate( aRect.Center(), nRotateAngle, sin( a ), cos( a ) );
}
- if ( aCustomShape2d.IsFlipHorz() )
+ if ( bFlipH )
{
Point aTop( ( aRect.Left() + aRect.Right() ) >> 1, aRect.Top() );
Point aBottom( aTop.X(), aTop.Y() + 1000 );
pObj->NbcMirror( aTop, aBottom );
}
- if ( aCustomShape2d.IsFlipVert() )
+ if ( bFlipV )
{
Point aLeft( aRect.Left(), ( aRect.Top() + aRect.Bottom() ) >> 1 );
Point aRight( aLeft.X() + 1000, aLeft.Y() );
diff --git a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx
index 9cb3c414de37..0b41dda45eaa 100644
--- a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx
@@ -54,10 +54,6 @@ static const SvxMSDffTextRect TextRect[] =
{
{ { 0, 0 }, { 0, 0 } }
};
-static const sal_Int32 BoundRect[] =
-{
- 0, 0, 21600, 21600
-};
static const mso_CustomShape mso =
{
(SvxMSDffVertPair*)mso_sptVert, sizeof( mso_sptVert ) / sizeof( SvxMSDffVertPair ),
@@ -668,10 +664,6 @@ static const SvxMSDffVertPair mso_sptCanGluePoints[] =
{
{ 44, 6 MSO_I }, { 44, 0 }, { 0, 10800 }, { 44, 21600 }, { 88, 10800 }
};
-static const sal_Int32 mso_sptCanBoundRect[] =
-{
- 0, 0, 88, 21600
-};
static const SvxMSDffHandle mso_sptCanHandle[] =
{
{ MSDFF_HANDLE_FLAGS_RANGE,
@@ -1197,60 +1189,422 @@ static const mso_CustomShape msoBentUpArrow =
(SvxMSDffHandle*)mso_sptBentUpArrowHandle, sizeof( mso_sptBentUpArrowHandle ) / sizeof( SvxMSDffHandle )
};
-static const SvxMSDffVertPair mso_sptCurvedArrowVert[] = // adjustment1 : y 10800 - 21600, adjustment2 : y 16424 - 21600
-{ // adjustment3 : x 0 - 21600
- { 21600, 0 },
- { 9675, 0 }, { 0, 10 MSO_I }, { 0, 9 MSO_I }, // ccp
- { 0, 11 MSO_I },
- { 0, 14 MSO_I }, { 15 MSO_I, 1 MSO_I }, { 2 MSO_I, 1 MSO_I }, // ccp
- { 2 MSO_I, 21600 }, { 21600, 7 MSO_I }, { 2 MSO_I, 0 MSO_I }, { 2 MSO_I, 16 MSO_I },// pppp
- { 2 MSO_I, 16 MSO_I }, { 80, 8 MSO_I }, { 80, 8 MSO_I }, // ccp
- { 80, 8 MSO_I }, { 21600, 5 MSO_I }, { 21600, 0 } // ccp
-};
-static const sal_uInt16 mso_sptCurvedArrowSegm[] =
-{
- 0x4000, 0x2001, 0x0001, 0x2001, 0x0004, 0x2002, 0x6001, 0x8000
-};
-static const SvxMSDffCalculationData mso_sptCurvedArrowCalc[] =
-{
- { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, // 0
- { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } }, // 1
- { 0x2000, { DFF_Prop_adjust3Value, 0, 0 } }, // 2
- { 0x8000, { 21600, 0, DFF_Prop_adjust2Value } }, // 3
- { 0xa000, { DFF_Prop_adjust2Value, 0, DFF_Prop_adjustValue } }, // 4
- { 0xa000, { 0x0404, 0, 0x0403 } }, // 5
- { 0x2001, { 0x0405, 1, 2 } }, // 6
- { 0xa000, { DFF_Prop_adjust2Value, 0, 0x0406 } }, // 7
- { 0x2001, { DFF_Prop_adjust2Value, 1, 2 } }, // 8
- { 0xa000, { 0x0408, 0, 0x0406 } }, // 9
- { 0x2001, { 0x0409, 10000, 22326 } }, // 10
- { 0x6000, { 0x0409, 0x0405, 0 } }, // 11
- { 0xa000, { DFF_Prop_adjust2Value, 0, 0x040b } }, // 12
- { 0x2001, { 0x040c, 10000, 23148 } }, // 13
- { 0x6000, { 0x040d, 0x040b, 0 } }, // 14
- { 0x2001, { DFF_Prop_adjust3Value, 10000, 25467 } }, // 15
- { 0x6000, { DFF_Prop_adjustValue, 0x0403, 0 } } // 16
-};
-static const sal_Int32 mso_sptCurvedArrowDefault[] =
-{
- 3, 13000, 19400, 14400
-};
-static const SvxMSDffTextRectangles mso_sptCurvedArrowTextRect[] = // todo
+
+static const SvxMSDffVertPair mso_sptCurvedDownVert[] =
{
- { { 0, 0 }, { 21600, 21600 } }
+ { 0, 0 }, { 3 MSO_I, 21 MSO_I }, { 0, 21600 }, { 4 MSO_I, 0 },
+ { 0, 0 }, { 3 MSO_I, 21 MSO_I }, { 4 MSO_I, 0 }, { 17 MSO_I, 24 MSO_I },
+ { 15 MSO_I, 0 }, { 1 MSO_I, 21 MSO_I }, { 17 MSO_I, 24 MSO_I }, { 15 MSO_I, 21600 },
+ { 15 MSO_I, 0 }, { 1 MSO_I, 21 MSO_I }, { 7 MSO_I, 0 }, { 13 MSO_I, 2 MSO_I },
+ { 14 MSO_I, 2 MSO_I }, { 8 MSO_I, 21600 }, { 12 MSO_I, 2 MSO_I },
+ { 0, 0 }, { 3 MSO_I, 21 MSO_I }, { 11 MSO_I, 2 MSO_I }, { 17 MSO_I, 24 MSO_I },
+ { 0, 0 }, { 3 MSO_I, 21 MSO_I }, { 17 MSO_I, 24 MSO_I }, { 4 MSO_I, 0 }
+};
+static const sal_uInt16 mso_sptCurvedDownSegm[] =
+{
+ 0xa508,
+ 0xa304,
+ 0x6000,
+ 0x8000,
+ 0xa604,
+ 0x0003,
+ 0xa308,
+ 0x6000,
+ 0x8000
+};
+static const SvxMSDffCalculationData mso_sptCurvedDownCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust3Value, 0, 0 } },
+ { 0xa000, { DFF_Prop_adjustValue, 21600, DFF_Prop_adjust2Value } },
+ { 0x2001, { 0x403, 1, 2 } },
+ { 0x6000, { DFF_Prop_adjust2Value, DFF_Prop_adjust2Value, 21600 } },
+ { 0xe000, { 0x405, DFF_Prop_adjust2Value, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x406, 1, 2 } },
+ { 0x4002, { 21600, DFF_Prop_adjustValue, 0 } },
+ { 0x8000, { 21600, 0, DFF_Prop_adjust3Value } },
+ { 0xa00f, { 0x409, 21600, 0x404 } },
+ { 0x6000, { 0x404, 0x40a, 0 } },
+ { 0x6000, { 0x40b, DFF_Prop_adjust2Value, 21600 } },
+ { 0x6000, { 0x407, 0x40a, 0 } },
+ { 0xa000, { 0x40c, 21600, DFF_Prop_adjustValue } },
+ { 0xa000, { 0x405, 0, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x40f, 1, 2 } },
+ { 0x6002, { 0x404, 0x407, 0 } },
+ { 0x6000, { DFF_Prop_adjustValue, DFF_Prop_adjust2Value, 21600 } },
+ { 0x2001, { 0x412, 1, 2 } },
+ { 0xa000, { 0x411, 0, 0x413 } },
+ { 0x0001, { 21600, 2, 1 } },
+ { 0xa000, { 0x411, 0, 0x404 } },
+ { 0x600f, { 0x416, 0x404, 21600 } },
+ { 0x8000, { 21600, 0, 0x417 } },
+ { 0x2000, { 0x408, 128, 0 } },
+ { 0x2001, { 0x405, 1, 2 } },
+ { 0x2000, { 0x405, 0, 128 } },
+ { 0xe000, { DFF_Prop_adjustValue, 0x411, 0x40c } },
+ { 0x600f, { 0x414, 0x404, 21600 } },
+ { 0x8000, { 21600, 0, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x41e, 1, 2 } },
+ { 0x0001, { 21600, 21600, 1 } },
+ { 0x6001, { 0x409, 0x409, 1 } },
+ { 0xa000, { 0x420, 0, 0x421 } },
+ { 0x200d, { 0x422, 0, 0 } },
+ { 0x2000, { 0x423, 21600, 0 } },
+ { 0x8001, { 21600, 21600, 0x424 } },
+ { 0x2000, { 0x425, 64, 0 } },
+ { 0x2001, { DFF_Prop_adjustValue, 1, 2 } },
+ { 0x600f, { 0x41f, 0x427, 21600 } },
+ { 0x8000, { 21600, 0, 0x428 } },
+ { 0x2000, { 0x429, 64, 0 } },
+ { 0x2001, { 0x404, 1, 2 } },
+ { 0xa000, { DFF_Prop_adjust2Value, 0, 0x42b } },
+ { 0x0001, { 21600, 2195, 16384 } },
+ { 0x0001, { 21600, 14189, 16384 } }
};
-static const mso_CustomShape msoCurvedArrow =
+static const sal_Int32 mso_sptCurvedDownDefault[] =
{
- (SvxMSDffVertPair*)mso_sptCurvedArrowVert, sizeof( mso_sptCurvedArrowVert ) / sizeof( SvxMSDffVertPair ),
- (sal_uInt16*)mso_sptCurvedArrowSegm, sizeof( mso_sptCurvedArrowSegm ) >> 1,
- (SvxMSDffCalculationData*)mso_sptCurvedArrowCalc, sizeof( mso_sptCurvedArrowCalc ) / sizeof( SvxMSDffCalculationData ),
- (sal_Int32*)mso_sptCurvedArrowDefault,
- (SvxMSDffTextRectangles*)mso_sptCurvedArrowTextRect, sizeof( mso_sptCurvedArrowTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 3, 12960, 19440, 14400
+};
+static const SvxMSDffTextRectangles mso_sptCurvedDownTextRect[] =
+{
+ { { 43 MSO_I, 45 MSO_I }, { 44 MSO_I, 46 MSO_I } }
+};
+static const SvxMSDffVertPair mso_sptCurvedDownGluePoints[] =
+{
+ { 17 MSO_I, 0 }, { 16 MSO_I, 21600 }, { 12 MSO_I, 2 MSO_I }, { 8 MSO_I, 21600 }, { 14 MSO_I, 2 MSO_I }
+};
+static const SvxMSDffHandle mso_sptCurvedDownHandles[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL,
+ 0x100, 21600, 10800, 10800, 3 + 0x26, 3 + 0x1b, 0, 10800 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL,
+ 0x101, 21600, 10800, 10800, 3 + 0x19, 21600, 0, 10800 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL,
+ 21600, 0x102, 10800, 10800, 3375, 21600, 3 + 0x2a, 21600 }
+};
+static const mso_CustomShape msoCurvedDownArrow =
+{
+ (SvxMSDffVertPair*)mso_sptCurvedDownVert, sizeof( mso_sptCurvedDownVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCurvedDownSegm, sizeof( mso_sptCurvedDownSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCurvedDownCalc, sizeof( mso_sptCurvedDownCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCurvedDownDefault,
+ (SvxMSDffTextRectangles*)mso_sptCurvedDownTextRect, sizeof( mso_sptCurvedDownTextRect ) / sizeof( SvxMSDffTextRectangles ),
21600, 21600,
0x80000000, 0x80000000,
- NULL, 0,
- NULL, 0 // handles
+ (SvxMSDffVertPair*)mso_sptCurvedDownGluePoints, sizeof( mso_sptCurvedDownGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptCurvedDownHandles, sizeof( mso_sptCurvedDownHandles ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptCurvedUpVert[] =
+{
+ { 0, 22 MSO_I }, { 3 MSO_I, 21 MSO_I }, { 0, 0 }, { 4 MSO_I, 21 MSO_I },
+ { 14 MSO_I, 22 MSO_I }, { 1 MSO_I, 21 MSO_I }, { 7 MSO_I, 21 MSO_I }, { 12 MSO_I, 2 MSO_I },
+ { 13 MSO_I, 2 MSO_I }, { 8 MSO_I, 0 }, { 11 MSO_I, 2 MSO_I },
+ { 0, 22 MSO_I }, { 3 MSO_I, 21 MSO_I }, { 10 MSO_I, 2 MSO_I }, { 16 MSO_I, 24 MSO_I },
+ { 14 MSO_I, 22 MSO_I }, { 1 MSO_I, 21 MSO_I }, { 16 MSO_I, 24 MSO_I }, { 14 MSO_I, 0 },
+ { 14 MSO_I, 22 MSO_I }, { 1 MSO_I, 21 MSO_I }, { 7 MSO_I, 21 MSO_I }, { 16 MSO_I, 24 MSO_I }
+};
+static const sal_uInt16 mso_sptCurvedUpSegm[] =
+{
+ 0xa408,
+ 0x0003,
+ 0xa508,
+ 0x6000,
+ 0x8000,
+ 0xa604,
+ 0xaa00,
+ 0x8000
+};
+static const SvxMSDffCalculationData mso_sptCurvedUpCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust3Value, 0, 0 } },
+ { 0xa000, { DFF_Prop_adjustValue, 21600, DFF_Prop_adjust2Value } },
+ { 0x2001, { 0x403, 1, 2 } },
+ { 0x6000, { DFF_Prop_adjust2Value, DFF_Prop_adjust2Value, 21600 } },
+ { 0xe000, { 0x405, DFF_Prop_adjust2Value, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x406, 1, 2 } },
+ { 0x4002, { 21600, DFF_Prop_adjustValue, 0 } },
+ { 0xa00f, { DFF_Prop_adjust3Value, 21600, 0x404 } },
+ { 0x6000, { 0x404, 0x409, 0 } },
+ { 0x6000, { 0x40a, DFF_Prop_adjust2Value, 21600 } },
+ { 0x6000, { 0x407, 0x409, 0 } },
+ { 0xa000, { 0x40b, 21600, DFF_Prop_adjustValue } },
+ { 0xa000, { 0x405, 0, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x40e, 1, 2 } },
+ { 0x6002, { 0x404, 0x407, 0 } },
+ { 0x6000, { DFF_Prop_adjustValue, DFF_Prop_adjust2Value, 21600 } },
+ { 0x2001, { 0x411, 1, 2 } },
+ { 0xa000, { 0x410, 0, 0x412 } },
+ { 0x0000, { 21600, 0, 0 } },
+ { 0x0000, { 21600, 0, 0 } },
+ { 0x0000, { 0, 0, 21600 } },
+ { 0xa000, { 0x410, 0, 0x404 } },
+ { 0x600f, { 0x417, 0x404, 21600 } },
+ { 0x2000, { 0x408, 128, 0 } },
+ { 0x2001, { 0x405, 1, 2 } },
+ { 0x2000, { 0x405, 0, 128 } },
+ { 0xe000, { DFF_Prop_adjustValue, 0x410, 0x40b } },
+ { 0x8000, { 21600, 0, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x41d, 1, 2 } },
+ { 0x0001, { 21600, 21600, 1 } },
+ { 0x6001, { DFF_Prop_adjust3Value, DFF_Prop_adjust3Value, 1 } },
+ { 0xa000, { 0x41f, 0, 0x420 } },
+ { 0x200d, { 0x421, 0, 0 } },
+ { 0x2000, { 0x422, 21600, 0 } },
+ { 0x8001, { 21600, 21600, 0x423 } },
+ { 0x2000, { 0x424, 64, 0 } },
+ { 0x2001, { DFF_Prop_adjustValue, 1, 2 } },
+ { 0x600f, { 0x41e, 0x426, 21600 } },
+ { 0x2000, { 0x427, 0, 64 } },
+ { 0x2001, { 0x404, 1, 2 } },
+ { 0xa000, { DFF_Prop_adjust2Value, 0, 0x429 } },
+ { 0x0001, { 21600, 2195, 16384 } },
+ { 0x0001, { 21600, 14189, 16384 } }
+};
+static const sal_Int32 mso_sptCurvedUpDefault[] =
+{
+ 3, 12960, 19440, 7200
+};
+static const SvxMSDffTextRectangles mso_sptCurvedUpTextRect[] =
+{
+ { { 41 MSO_I, 43 MSO_I }, { 42 MSO_I, 44 MSO_I } }
+};
+static const SvxMSDffVertPair mso_sptCurvedUpGluePoints[] =
+{
+ { 8 MSO_I, 0 }, { 11 MSO_I, 2 MSO_I }, { 15 MSO_I, 0 }, { 16 MSO_I, 21 MSO_I }, { 13 MSO_I, 2 MSO_I }
+};
+static const SvxMSDffHandle mso_sptCurvedUpHandles[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL,
+ 0x100, 0, 10800, 10800, 3 + 37, 3 + 27, 0, 10800 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL,
+ 0x101, 0, 10800, 10800, 3 + 25, 3 + 20, 0, 10800 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL,
+ 21600, 0x102, 10800, 10800, 3375, 21600, 0, 3 + 40 }
+};
+static const mso_CustomShape msoCurvedUpArrow =
+{
+ (SvxMSDffVertPair*)mso_sptCurvedUpVert, sizeof( mso_sptCurvedUpVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCurvedUpSegm, sizeof( mso_sptCurvedUpSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCurvedUpCalc, sizeof( mso_sptCurvedUpCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCurvedUpDefault,
+ (SvxMSDffTextRectangles*)mso_sptCurvedUpTextRect, sizeof( mso_sptCurvedUpTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptCurvedUpGluePoints, sizeof( mso_sptCurvedUpGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptCurvedUpHandles, sizeof( mso_sptCurvedUpHandles ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptCurvedRightVert[] =
+{
+ { 0, 0 }, { 23 MSO_I, 3 MSO_I }, { 22 MSO_I, 0 }, { 0, 4 MSO_I }, { 0, 15 MSO_I }, { 23 MSO_I, 1 MSO_I }, { 0, 7 MSO_I }, { 2 MSO_I, 13 MSO_I },
+ { 2 MSO_I, 14 MSO_I }, { 22 MSO_I, 8 MSO_I }, { 2 MSO_I, 12 MSO_I },
+ { 0, 0 }, { 23 MSO_I, 3 MSO_I }, { 2 MSO_I, 11 MSO_I }, { 26 MSO_I, 17 MSO_I }, { 0, 15 MSO_I }, { 23 MSO_I, 1 MSO_I }, { 26 MSO_I, 17 MSO_I }, { 22 MSO_I, 15 MSO_I },
+ { 0, 0 }, { 23 MSO_I, 3 MSO_I }, { 0, 4 MSO_I }, { 26 MSO_I, 17 MSO_I }
+};
+static const sal_uInt16 mso_sptCurvedRightSegm[] =
+{
+ 0xa408,
+ 0x0003,
+ 0xa508,
+ 0x6000,
+ 0x8000,
+ 0xa404,
+ 0xaa00,
+ 0x8000
+};
+static const SvxMSDffCalculationData mso_sptCurvedRightCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust3Value, 0, 0 } },
+ { 0xa000, { DFF_Prop_adjustValue, 21600, DFF_Prop_adjust2Value } },
+ { 0x2001, { 0x403, 1, 2 } },
+ { 0x6000, { DFF_Prop_adjust2Value, DFF_Prop_adjust2Value, 21600 } },
+ { 0xe000, { 0x405, DFF_Prop_adjust2Value, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x406, 1, 2 } },
+ { 0x4002, { 21600, DFF_Prop_adjustValue, 0 } },
+ { 0x8000, { 21600, 0, DFF_Prop_adjust3Value } },
+ { 0xa00f, { 0x409, 21600, 0x404 } },
+ { 0x6000, { 0x404, 0x40a, 0 } },
+ { 0x6000, { 0x40b, DFF_Prop_adjust2Value, 21600 } },
+ { 0x6000, { 0x407, 0x40a, 0 } },
+ { 0xa000, { 0x40c, 21600, DFF_Prop_adjustValue } },
+ { 0xa000, { 0x405, 0, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x40f, 1, 2 } },
+ { 0x6002, { 0x404, 0x407, 0 } },
+ { 0x6000, { DFF_Prop_adjustValue, DFF_Prop_adjust2Value, 21600 } },
+ { 0x2001, { 0x412, 1, 2 } },
+ { 0xa000, { 0x411, 0, 0x413 } },
+ { 0x0000, { 21600, 0, 0 } },
+ { 0x0000, { 21600, 0, 0 } },
+ { 0x0001, { 21600, 2, 1 } },
+ { 0xa000, { 0x411, 0, 0x404 } },
+ { 0x600f, { 0x418, 0x404, 21600 } },
+ { 0x8000, { 21600, 0, 0x419 } },
+ { 0x2000, { 0x408, 128, 0 } },
+ { 0x2001, { 0x405, 1, 2 } },
+ { 0x2000, { 0x405, 0, 128 } },
+ { 0xe000, { DFF_Prop_adjustValue, 0x411, 0x40c } },
+ { 0x600f, { 0x414, 0x404, 21600 } },
+ { 0x8000, { 21600, 0, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x420, 1, 2 } },
+ { 0x0001, { 21600, 21600, 1 } },
+ { 0x6001, { 0x409, 0x409, 1 } },
+ { 0xa000, { 0x422, 0, 0x423 } },
+ { 0x200d, { 0x424, 0, 0 } },
+ { 0x2000, { 0x425, 21600, 0 } },
+ { 0x8001, { 21600, 21600, 0x426 } },
+ { 0x2000, { 0x427, 64, 0 } },
+ { 0x2001, { DFF_Prop_adjustValue, 1, 2 } },
+ { 0x600f, { 0x421, 0x429, 21600 } },
+ { 0x8000, { 21600, 0, 0x42a } },
+ { 0x2000, { 0x42b, 64, 0 } },
+ { 0x2001, { 0x404, 1, 2 } },
+ { 0xa000, { DFF_Prop_adjust2Value, 0, 0x42d } },
+ { 0x0001, { 21600, 2195, 16384 } },
+ { 0x0001, { 21600, 14189, 16384 } }
+};
+static const sal_Int32 mso_sptCurvedRightDefault[] =
+{
+ 3, 12960, 19440, 14400
+};
+static const SvxMSDffTextRectangles mso_sptCurvedRightTextRect[] =
+{
+ { { 47 MSO_I, 45 MSO_I }, { 48 MSO_I, 46 MSO_I } }
+};
+static const SvxMSDffVertPair mso_sptCurvedRightGluePoints[] =
+{
+ { 0, 17 MSO_I }, { 2 MSO_I, 14 MSO_I }, { 22 MSO_I, 8 MSO_I }, { 2 MSO_I, 12 MSO_I }, { 22 MSO_I, 16 MSO_I }
+};
+static const SvxMSDffHandle mso_sptCurvedRightHandles[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL,
+ 21600, 0x100, 10800, 10800, 0, 10800, 3 + 40, 3 + 29 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL,
+ 21600, 0x101, 10800, 10800, 0, 10800, 3 + 27, 3 + 21 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL,
+ 0x102, 21600, 10800, 10800, 3 + 44, 3 + 22, 3375, 21600 }
+};
+static const mso_CustomShape msoCurvedRightArrow =
+{
+ (SvxMSDffVertPair*)mso_sptCurvedRightVert, sizeof( mso_sptCurvedRightVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCurvedRightSegm, sizeof( mso_sptCurvedRightSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCurvedRightCalc, sizeof( mso_sptCurvedRightCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCurvedRightDefault,
+ (SvxMSDffTextRectangles*)mso_sptCurvedRightTextRect, sizeof( mso_sptCurvedRightTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptCurvedRightGluePoints, sizeof( mso_sptCurvedRightGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptCurvedRightHandles, sizeof( mso_sptCurvedRightHandles ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptCurvedLeftVert[] =
+{
+ { 22 MSO_I, 0 }, { 21 MSO_I, 3 MSO_I }, { 0, 0 }, { 21 MSO_I, 4 MSO_I }, { 22 MSO_I, 14 MSO_I }, { 21 MSO_I, 1 MSO_I }, { 21 MSO_I, 7 MSO_I }, { 2 MSO_I, 12 MSO_I },
+ { 2 MSO_I, 13 MSO_I }, { 0, 8 MSO_I }, { 2 MSO_I, 11 MSO_I },
+ { 22 MSO_I, 0 }, { 21 MSO_I, 3 MSO_I }, { 2 MSO_I, 10 MSO_I }, { 24 MSO_I, 16 MSO_I }, { 22 MSO_I, 14 MSO_I }, { 21 MSO_I, 1 MSO_I }, { 24 MSO_I, 16 MSO_I }, { 0, 14 MSO_I },
+ { 22 MSO_I, 14 MSO_I }, { 21 MSO_I, 1 MSO_I }, { 21 MSO_I, 7 MSO_I }, { 24 MSO_I, 16 MSO_I }
+};
+static const sal_uInt16 mso_sptCurvedLeftSegm[] =
+{
+ 0xa608,
+ 0x0003,
+ 0xa308,
+ 0x6000,
+ 0x8000,
+ 0xa404,
+ 0xaa00,
+ 0x8000
+};
+static const SvxMSDffCalculationData mso_sptCurvedLeftCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust3Value, 0, 0 } },
+ { 0xa000, { DFF_Prop_adjustValue, 21600, DFF_Prop_adjust2Value } },
+ { 0x2001, { 0x403, 1, 2 } },
+ { 0x6000, { DFF_Prop_adjust2Value, DFF_Prop_adjust2Value, 21600 } },
+ { 0xe000, { 0x405, DFF_Prop_adjust2Value, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x406, 1, 2 } },
+ { 0x4002, { 21600, DFF_Prop_adjustValue, 0 } },
+ { 0xa00f, { DFF_Prop_adjust3Value, 21600, 0x404 } },
+ { 0x6000, { 0x404, 0x409, 0 } },
+ { 0x6000, { 0x40a, DFF_Prop_adjust2Value, 21600 } },
+ { 0x6000, { 0x407, 0x409, 0 } },
+ { 0xa000, { 0x40b, 21600, DFF_Prop_adjustValue } },
+ { 0xa000, { 0x405, 0, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x40e, 1, 2 } },
+ { 0x6002, { 0x404, 0x407, 0 } },
+ { 0x6000, { DFF_Prop_adjustValue, DFF_Prop_adjust2Value, 21600 } },
+ { 0x2001, { 0x411, 1, 2 } },
+ { 0xa000, { 0x410, 0, 0x412 } },
+ { 0x0000, { 21600, 0, 0 } },
+ { 0x0000, { 21600, 0, 0 } },
+ { 0x0000, { 0, 0, 21600 } },
+ { 0xa000, { 0x410, 0, 0x404 } },
+ { 0x600f, { 0x417, 0x404, 21600 } },
+ { 0x2000, { 0x408, 128, 0 } },
+ { 0x2001, { 0x405, 1, 2 } },
+ { 0x2000, { 0x405, 0, 128 } },
+ { 0xe000, { DFF_Prop_adjustValue, 0x410, 0x40b } },
+ { 0x8000, { 21600, 0, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x41d, 1, 2 } },
+ { 0x0001, { 21600, 21600, 1 } },
+ { 0x6001, { DFF_Prop_adjust3Value, DFF_Prop_adjust3Value, 1 } },
+ { 0xa000, { 0x41f, 0, 0x420 } },
+ { 0x200d, { 0x421, 0, 0 } },
+ { 0x2000, { 0x422, 21600, 0 } },
+ { 0x8001, { 21600, 21600, 0x423 } },
+ { 0x2000, { 0x424, 64, 0 } },
+ { 0x2001, { DFF_Prop_adjustValue, 1, 2 } },
+ { 0x600f, { 0x41e, 0x426, 21600 } },
+ { 0x2000, { 0x427, 0, 64 } },
+ { 0x2001, { 0x404, 1, 2 } },
+ { 0xa000, { DFF_Prop_adjust2Value, 0, 0x429 } },
+ { 0x0001, { 21600, 2195, 16384 } },
+ { 0x0001, { 21600, 14189, 16384 } }
+};
+static const sal_Int32 mso_sptCurvedLeftDefault[] =
+{
+ 3, 12960, 19440, 7200
+};
+static const SvxMSDffTextRectangles mso_sptCurvedLeftTextRect[] =
+{
+ { { 43 MSO_I, 41 MSO_I }, { 44 MSO_I, 42 MSO_I } }
};
+static const SvxMSDffVertPair mso_sptCurvedLeftGluePoints[] =
+{
+ { 0, 15 MSO_I }, { 2 MSO_I, 11 MSO_I }, { 0, 8 MSO_I }, { 2 MSO_I, 13 MSO_I }, { 21 MSO_I, 16 MSO_I }
+};
+static const SvxMSDffHandle mso_sptCurvedLeftHandles[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL,
+ 0, 0x100, 10800, 10800, 0, 10800, 3 + 37, 3 + 27 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL,
+ 0, 0x101, 10800, 10800, 0, 10800, 3 + 25, 3 + 20 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL,
+ 0x102, 21600, 10800, 10800, 0, 3 + 40, 3375, 21600 }
+};
+static const mso_CustomShape msoCurvedLeftArrow =
+{
+ (SvxMSDffVertPair*)mso_sptCurvedLeftVert, sizeof( mso_sptCurvedLeftVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCurvedLeftSegm, sizeof( mso_sptCurvedLeftSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCurvedLeftCalc, sizeof( mso_sptCurvedLeftCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCurvedLeftDefault,
+ (SvxMSDffTextRectangles*)mso_sptCurvedLeftTextRect, sizeof( mso_sptCurvedLeftTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptCurvedLeftGluePoints, sizeof( mso_sptCurvedLeftGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptCurvedLeftHandles, sizeof( mso_sptCurvedLeftHandles ) / sizeof( SvxMSDffHandle )
+};
+
+
+
+
static const SvxMSDffVertPair mso_sptStripedRightArrowVert[] = // adjustment1 : x 3375 - 21600
{ // adjustment2 : y 0 - 10800
@@ -3046,10 +3400,6 @@ static const SvxMSDffVertPair mso_sptHeartGluePoints[] =
{
{ 10800, 2180 }, { 3090, 10800 }, { 10800, 21600 }, { 18490, 10800 }
};
-static const sal_Int32 mso_sptHeartBoundRect[] =
-{
- -9, 0, 21606, 21602
-};
static const mso_CustomShape msoHeart =
{
(SvxMSDffVertPair*)mso_sptHeartVert, sizeof( mso_sptHeartVert ) / sizeof( SvxMSDffVertPair ),
@@ -7772,10 +8122,10 @@ const mso_CustomShape* GetCustomShapeContent( MSO_SPT eSpType )
case mso_sptUturnArrow : pCustomShape = &msoUturnArrow; break;
case mso_sptLeftUpArrow : pCustomShape = &msoLeftUpArrow; break;
case mso_sptBentUpArrow : pCustomShape = &msoBentUpArrow; break;
- case mso_sptCurvedRightArrow : pCustomShape = &msoCurvedArrow; break;
- case mso_sptCurvedLeftArrow : pCustomShape = &msoCurvedArrow; break;
- case mso_sptCurvedUpArrow : pCustomShape = &msoCurvedArrow; break;
- case mso_sptCurvedDownArrow : pCustomShape = &msoCurvedArrow; break;
+ case mso_sptCurvedRightArrow : pCustomShape = &msoCurvedRightArrow; break;
+ case mso_sptCurvedLeftArrow : pCustomShape = &msoCurvedLeftArrow; break;
+ case mso_sptCurvedUpArrow : pCustomShape = &msoCurvedUpArrow; break;
+ case mso_sptCurvedDownArrow : pCustomShape = &msoCurvedDownArrow; break;
case mso_sptStripedRightArrow : pCustomShape = &msoStripedRightArrow; break;
case mso_sptNotchedRightArrow : pCustomShape = &msoNotchedRightArrow; break;
case mso_sptHomePlate : pCustomShape = &msoHomePlate; break;
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index beef4fe8ae48..59d0c721b560 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -173,24 +173,22 @@ void SvxRectCtl::InitRectBitmap( void )
pBitmap = new Bitmap( SVX_RES( RID_SVXCTRL_RECTBTNS ) );
// set bitmap-colors
- long aTempAry1[(7*sizeof(Color))/sizeof(long)];
- long aTempAry2[(7*sizeof(Color))/sizeof(long)];
- Color* pColorAry1 = (Color*)aTempAry1;
- Color* pColorAry2 = (Color*)aTempAry2;
- pColorAry1[0] = Color( 0xC0, 0xC0, 0xC0 ); // light-gray
- pColorAry1[1] = Color( 0xFF, 0xFF, 0x00 ); // yellow
- pColorAry1[2] = Color( 0xFF, 0xFF, 0xFF ); // white
- pColorAry1[3] = Color( 0x80, 0x80, 0x80 ); // dark-gray
- pColorAry1[4] = Color( 0x00, 0x00, 0x00 ); // black
- pColorAry1[5] = Color( 0x00, 0xFF, 0x00 ); // green
- pColorAry1[6] = Color( 0x00, 0x00, 0xFF ); // blue
- pColorAry2[0] = rStyles.GetDialogColor(); // background
- pColorAry2[1] = rStyles.GetWindowColor();
- pColorAry2[2] = rStyles.GetLightColor();
- pColorAry2[3] = rStyles.GetShadowColor();
- pColorAry2[4] = rStyles.GetDarkShadowColor();
- pColorAry2[5] = Color( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
- pColorAry2[6] = rStyles.GetDialogColor();
+ Color aColorAry1[7];
+ Color aColorAry2[7];
+ aColorAry1[0] = Color( 0xC0, 0xC0, 0xC0 ); // light-gray
+ aColorAry1[1] = Color( 0xFF, 0xFF, 0x00 ); // yellow
+ aColorAry1[2] = Color( 0xFF, 0xFF, 0xFF ); // white
+ aColorAry1[3] = Color( 0x80, 0x80, 0x80 ); // dark-gray
+ aColorAry1[4] = Color( 0x00, 0x00, 0x00 ); // black
+ aColorAry1[5] = Color( 0x00, 0xFF, 0x00 ); // green
+ aColorAry1[6] = Color( 0x00, 0x00, 0xFF ); // blue
+ aColorAry2[0] = rStyles.GetDialogColor(); // background
+ aColorAry2[1] = rStyles.GetWindowColor();
+ aColorAry2[2] = rStyles.GetLightColor();
+ aColorAry2[3] = rStyles.GetShadowColor();
+ aColorAry2[4] = rStyles.GetDarkShadowColor();
+ aColorAry2[5] = Color( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
+ aColorAry2[6] = rStyles.GetDialogColor();
#ifdef DBG_UTIL
static BOOL bModify = FALSE;
@@ -205,11 +203,11 @@ void SvxRectCtl::InitRectBitmap( void )
UINT8& rr = r;
UINT8& rg = g;
UINT8& rb = b;
- pColorAry2[ rn ] = Color( rr, rg, rb );
+ aColorAry2[ rn ] = Color( rr, rg, rb );
}
#endif
- pBitmap->Replace( pColorAry1, pColorAry2, 7, NULL );
+ pBitmap->Replace( aColorAry1, aColorAry2, 7, NULL );
}
// -----------------------------------------------------------------------
diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx
index 5076b06f52c5..5018bd28a640 100644
--- a/svx/source/dialog/fntctrl.cxx
+++ b/svx/source/dialog/fntctrl.cxx
@@ -36,6 +36,7 @@
#include <sfx2/printer.hxx> // SfxPrinter
#include <vcl/metric.hxx>
#include <vcl/svapp.hxx>
+#include <unicode/uchar.h>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/i18n/XBreakIterator.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -244,7 +245,25 @@ void FontPrevWin_Impl::_CheckScript()
do
{
nChg = (xub_StrLen)xBreak->endOfScript( aText, nChg, nScript );
- aScriptChg.Insert( nChg, nCnt );
+ if (nChg < aText.Len() && nChg > 0 &&
+ (com::sun::star::i18n::ScriptType::WEAK ==
+ xBreak->getScriptType(aText, nChg - 1)))
+ {
+ int8_t nType = u_charType(aText.GetChar(nChg) );
+ if (nType == U_NON_SPACING_MARK || nType == U_ENCLOSING_MARK ||
+ nType == U_COMBINING_SPACING_MARK )
+ {
+ aScriptChg.Insert( nChg - 1, nCnt );
+ }
+ else
+ {
+ aScriptChg.Insert( nChg, nCnt );
+ }
+ }
+ else
+ {
+ aScriptChg.Insert( nChg, nCnt );
+ }
aScriptType.Insert( nScript, nCnt );
aTextWidth.Insert( ULONG(0), nCnt++ );
@@ -604,6 +623,14 @@ void SvxFontPrevWindow::SetColor(const Color &rColor)
pImpl->pColor = new Color( rColor );
Invalidate();
}
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::ResetColor()
+{
+ delete pImpl->pColor;
+ pImpl->pColor = 0;
+ Invalidate();
+}
// -----------------------------------------------------------------------
diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx
index 56fd8273fed2..5777dc8e7446 100644
--- a/svx/source/dialog/imapdlg.cxx
+++ b/svx/source/dialog/imapdlg.cxx
@@ -60,6 +60,8 @@
#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
#include <svtools/urihelper.hxx>
#include <svtools/miscopt.hxx>
+#include <svtools/ehdl.hxx>
+#include <svtools/sfxecode.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/docfile.hxx>
@@ -654,7 +656,10 @@ void SvxIMapDlg::DoOpen()
aLoadIMap.Read( *pIStm, IMAP_FORMAT_DETECT, String() );
if( pIStm->GetError() )
+ {
+ SfxErrorContext eEC(ERRCODE_SFX_GENERAL,this);
ErrorHandler::HandleError( ERRCODE_IO_GENERAL );
+ }
else
pIMapWnd->SetImageMap( aLoadIMap );
diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx
index 277a6a9f8372..40c94d2128c3 100644
--- a/svx/source/dialog/imapwnd.cxx
+++ b/svx/source/dialog/imapwnd.cxx
@@ -716,7 +716,7 @@ void IMapWindow::RequestHelp( const HelpEvent& rHEvt )
if ( Help::IsBalloonHelpEnabled() || Help::IsQuickHelpEnabled() )
{
- if ( pView->PickObj( aPos, pSdrObj, pPageView ) )
+ if ( pView->PickObj( aPos, pView->getHitTolLog(), pSdrObj, pPageView ) )
{
const IMapObject* pIMapObj = GetIMapObj( pSdrObj );
String aStr;
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 8d0ec6ac4d59..918234222135 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -394,7 +394,7 @@ void SvxJSearchOptionsDialog::SetTransliterationFlags( INT32 nSettings )
aCalcStr ( THIS_SVX_RES( STR_WORDCALC ) ), \
pImpl ( NULL ), \
pSearchList ( NULL ), \
- pReplaceList ( NULL ), \
+ pReplaceList ( new SearchAttrItemList ), \
pSearchItem ( NULL ), \
pSearchController ( NULL ), \
pOptionsController ( NULL ), \
diff --git a/svx/source/editeng/editdoc.cxx b/svx/source/editeng/editdoc.cxx
index c90de8eb5ce0..acf278e2d01f 100644
--- a/svx/source/editeng/editdoc.cxx
+++ b/svx/source/editeng/editdoc.cxx
@@ -258,7 +258,7 @@ USHORT aV5Map[] = {
4035, 4036, 4037, 4038
};
-SV_IMPL_PTRARR( ContentList, ContentNode* );
+SV_IMPL_PTRARR( DummyContentList, ContentNode* );
SV_IMPL_VARARR( ScriptTypePosInfos, ScriptTypePosInfo );
SV_IMPL_VARARR( WritingDirectionInfos, WritingDirectionInfo );
// SV_IMPL_VARARR( ExtraCharInfos, ExtraCharInfo );
diff --git a/svx/source/editeng/editdoc.hxx b/svx/source/editeng/editdoc.hxx
index dd9662d366e5..872f19485ae6 100644
--- a/svx/source/editeng/editdoc.hxx
+++ b/svx/source/editeng/editdoc.hxx
@@ -285,7 +285,15 @@ public:
};
typedef ContentNode* ContentNodePtr;
-SV_DECL_PTRARR( ContentList, ContentNodePtr, 0, 4 )
+SV_DECL_PTRARR( DummyContentList, ContentNodePtr, 0, 4 )
+
+class ContentList : public DummyContentList
+{
+ USHORT nLastCache;
+public:
+ ContentList() : DummyContentList( 0, 4 ), nLastCache(0) {}
+ USHORT GetPos( const ContentNodePtr &rPtr ) const;
+};
// -------------------------------------------------------------------------
// class EditPaM
@@ -612,6 +620,7 @@ SV_DECL_PTRARR( DummyParaPortionList, ParaPortionPtr, 0, 4 )
// -------------------------------------------------------------------------
class ParaPortionList : public DummyParaPortionList
{
+ USHORT nLastCache;
public:
ParaPortionList();
~ParaPortionList();
@@ -623,6 +632,8 @@ public:
inline ParaPortion* SaveGetObject( USHORT nPos ) const
{ return ( nPos < Count() ) ? GetObject( nPos ) : 0; }
+ USHORT GetPos( const ParaPortionPtr &rPtr ) const;
+
// temporaer:
void DbgCheck( EditDoc& rDoc );
};
diff --git a/svx/source/editeng/editdoc2.cxx b/svx/source/editeng/editdoc2.cxx
index 2b0967e173a8..030dfb1ad615 100644
--- a/svx/source/editeng/editdoc2.cxx
+++ b/svx/source/editeng/editdoc2.cxx
@@ -324,10 +324,42 @@ void ParaPortion::CorrectValuesBehindLastFormattedLine( USHORT nLastFormattedLin
DBG_ASSERT( aLineList[ aLineList.Count()-1 ]->GetEnd() == pNode->Len(), "CorrectLines: Ende stimmt nicht!" );
}
- // -------------------------------------------------------------------------
+// Shared reverse lookup acceleration pieces ...
+
+static USHORT FastGetPos( const VoidPtr *pPtrArray, USHORT nPtrArrayLen,
+ VoidPtr pPtr, USHORT &rLastPos )
+{
+ // Through certain filter code-paths we do a lot of appends, which in
+ // turn call GetPos - creating some N^2 nightmares. If we have a
+ // non-trivially large list, do a few checks from the end first.
+ if( rLastPos > 16 )
+ {
+ USHORT nEnd;
+ if (rLastPos > nPtrArrayLen - 2)
+ nEnd = nPtrArrayLen;
+ else
+ nEnd = rLastPos + 2;
+
+ for( USHORT nIdx = rLastPos - 2; nIdx < nEnd; nIdx++ )
+ {
+ if( pPtrArray[ nIdx ] == pPtr )
+ {
+ rLastPos = nIdx;
+ return nIdx;
+ }
+ }
+ }
+ // The world's lamest linear search from svarray ...
+ for( USHORT nIdx = 0; nIdx < nPtrArrayLen; nIdx++ )
+ if (pPtrArray[ nIdx ] == pPtr )
+ return rLastPos = nIdx;
+ return USHRT_MAX;
+}
+
+// -------------------------------------------------------------------------
// class ParaPortionList
// -------------------------------------------------------------------------
-ParaPortionList::ParaPortionList()
+ParaPortionList::ParaPortionList() : nLastCache( 0 )
{
}
@@ -336,6 +368,20 @@ ParaPortionList::~ParaPortionList()
Reset();
}
+USHORT ParaPortionList::GetPos( const ParaPortionPtr &rPtr ) const
+{
+ return FastGetPos( reinterpret_cast<const VoidPtr *>( GetData() ),
+ Count(), static_cast<VoidPtr>( rPtr ),
+ ((ParaPortionList *)this)->nLastCache );
+}
+
+USHORT ContentList::GetPos( const ContentNodePtr &rPtr ) const
+{
+ return FastGetPos( reinterpret_cast<const VoidPtr *>( GetData() ),
+ Count(), static_cast<VoidPtr>( rPtr ),
+ ((ContentList *)this)->nLastCache );
+}
+
void ParaPortionList::Reset()
{
for ( USHORT nPortion = 0; nPortion < Count(); nPortion++ )
diff --git a/svx/source/editeng/editobj.cxx b/svx/source/editeng/editobj.cxx
index d0170e507060..fb5e921f60f0 100644
--- a/svx/source/editeng/editobj.cxx
+++ b/svx/source/editeng/editobj.cxx
@@ -253,6 +253,18 @@ void ContentInfo::DestroyLoadStoreTempInfos()
}
*/
+// #i102062#
+bool ContentInfo::isWrongListEqual(const ContentInfo& rCompare) const
+{
+ if(GetWrongList() == rCompare.GetWrongList())
+ return true;
+
+ if(!GetWrongList() || !rCompare.GetWrongList())
+ return false;
+
+ return (*GetWrongList() == *rCompare.GetWrongList());
+}
+
bool ContentInfo::operator==( const ContentInfo& rCompare ) const
{
if( (aText == rCompare.aText) &&
@@ -566,6 +578,12 @@ bool EditTextObject::operator==( const EditTextObject& rCompare ) const
return static_cast< const BinTextObject* >( this )->operator==( static_cast< const BinTextObject& >( rCompare ) );
}
+// #i102062#
+bool EditTextObject::isWrongListEqual(const EditTextObject& rCompare) const
+{
+ return static_cast< const BinTextObject* >(this)->isWrongListEqual(static_cast< const BinTextObject& >(rCompare));
+}
+
// from SfxItemPoolUser
void BinTextObject::ObjectInDestruction(const SfxItemPool& rSfxItemPool)
{
@@ -599,6 +617,23 @@ void BinTextObject::ObjectInDestruction(const SfxItemPool& rSfxItemPool)
}
}
+EditEngineItemPool* getEditEngineItemPool(SfxItemPool* pPool)
+{
+ EditEngineItemPool* pRetval = dynamic_cast< EditEngineItemPool* >(pPool);
+
+ while(!pRetval && pPool && pPool->GetSecondaryPool())
+ {
+ pPool = pPool->GetSecondaryPool();
+
+ if(pPool)
+ {
+ pRetval = dynamic_cast< EditEngineItemPool* >(pPool);
+ }
+ }
+
+ return pRetval;
+}
+
BinTextObject::BinTextObject( SfxItemPool* pP ) :
EditTextObject( EE_FORMAT_BIN ),
SfxItemPoolUser()
@@ -608,9 +643,17 @@ BinTextObject::BinTextObject( SfxItemPool* pP ) :
nUserType = 0;
nObjSettings = 0;
pPortionInfo = 0;
- if ( pP )
+
+ // #i101239# ensure target is a EditEngineItemPool, else
+ // fallback to pool ownership. This is needed to ensure that at
+ // pool destruction time of an alien pool, the pool is still alive.
+ // When registering would happen at an alien pool which just uses an
+ // EditEngineItemPool as some sub-pool, that pool could already
+ // be decoupled and deleted whcih would lead to crashes.
+ pPool = getEditEngineItemPool(pP);
+
+ if ( pPool )
{
- pPool = pP;
bOwnerOfPool = FALSE;
}
else
@@ -621,6 +664,7 @@ BinTextObject::BinTextObject( SfxItemPool* pP ) :
if(!bOwnerOfPool && pPool)
{
+ // it is sure now that the pool is an EditEngineItemPool
pPool->AddSfxItemPoolUser(*this);
}
@@ -641,9 +685,12 @@ BinTextObject::BinTextObject( const BinTextObject& r ) :
nScriptType = r.nScriptType;
pPortionInfo = NULL; // PortionInfo nicht kopieren
bStoreUnicodeStrings = FALSE;
+
if ( !r.bOwnerOfPool )
{
- // Dann den Pool mitverwenden
+ // reuse alien pool; this must be a EditEngineItemPool
+ // since there is no other way to construct a BinTextObject
+ // than it's regular constructor where that is ensured
pPool = r.pPool;
bOwnerOfPool = FALSE;
}
@@ -656,6 +703,7 @@ BinTextObject::BinTextObject( const BinTextObject& r ) :
if(!bOwnerOfPool && pPool)
{
+ // it is sure now that the pool is an EditEngineItemPool
pPool->AddSfxItemPoolUser(*this);
}
@@ -1589,6 +1637,28 @@ bool BinTextObject::operator==( const BinTextObject& rCompare ) const
return true;
}
+// #i102062#
+bool BinTextObject::isWrongListEqual(const BinTextObject& rCompare) const
+{
+ if(GetContents().Count() != rCompare.GetContents().Count())
+ {
+ return false;
+ }
+
+ for(USHORT a(0); a < GetContents().Count(); a++)
+ {
+ const ContentInfo& rCandA(*GetContents().GetObject(a));
+ const ContentInfo& rCandB(*rCompare.GetContents().GetObject(a));
+
+ if(!rCandA.isWrongListEqual(rCandB))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
#define CHARSETMARKER 0x9999
void __EXPORT BinTextObject::CreateData300( SvStream& rIStream )
diff --git a/svx/source/editeng/editobj2.hxx b/svx/source/editeng/editobj2.hxx
index 51a044575dd2..2ed9c8b3e6d8 100644
--- a/svx/source/editeng/editobj2.hxx
+++ b/svx/source/editeng/editobj2.hxx
@@ -181,13 +181,10 @@ public:
WrongList* GetWrongList() const { return pWrongs; }
void SetWrongList( WrongList* p ) { pWrongs = p; }
-
-/* cl removed because not needed anymore since binfilter
- LoadStoreTempInfos* GetLoadStoreTempInfos() const { return pTempLoadStoreInfos; }
- void CreateLoadStoreTempInfos();
- void DestroyLoadStoreTempInfos();
-*/
bool operator==( const ContentInfo& rCompare ) const;
+
+ // #i102062#
+ bool isWrongListEqual(const ContentInfo& rCompare) const;
};
typedef ContentInfo* ContentInfoPtr;
@@ -198,6 +195,7 @@ SV_DECL_PTRARR( ContentInfoList, ContentInfoPtr, 1, 4 )
class BinTextObject : public EditTextObject, public SfxItemPoolUser
{
using EditTextObject::operator==;
+ using EditTextObject::isWrongListEqual;
private:
ContentInfoList aContents;
@@ -303,6 +301,9 @@ public:
bool operator==( const BinTextObject& rCompare ) const;
+ // #i102062#
+ bool isWrongListEqual(const BinTextObject& rCompare) const;
+
// from SfxItemPoolUser
virtual void ObjectInDestruction(const SfxItemPool& rSfxItemPool);
};
diff --git a/svx/source/editeng/editview.cxx b/svx/source/editeng/editview.cxx
index 134e3d6c75b0..6776f57ea2b6 100644
--- a/svx/source/editeng/editview.cxx
+++ b/svx/source/editeng/editview.cxx
@@ -1546,3 +1546,54 @@ bool EditView::ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFo
}
return bRet;
}
+
+String EditView::GetSurroundingText() const
+{
+ DBG_CHKTHIS( EditView, 0 );
+ DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
+
+ EditSelection aSel( pImpEditView->GetEditSelection() );
+ aSel.Adjust( PIMPEE->GetEditDoc() );
+
+ if( HasSelection() )
+ {
+ XubString aStr = PIMPEE->GetSelected( aSel );
+
+ // Stop reconversion if the selected text includes a line break.
+ if ( aStr.Search( 0x0A ) == STRING_NOTFOUND )
+ return aStr;
+ else
+ return String();
+ }
+ else
+ {
+ aSel.Min().SetIndex( 0 );
+ aSel.Max().SetIndex( aSel.Max().GetNode()->Len() );
+ return PIMPEE->GetSelected( aSel );
+ }
+}
+
+Selection EditView::GetSurroundingTextSelection() const
+{
+ DBG_CHKTHIS( EditView, 0 );
+
+ ESelection aSelection( GetSelection() );
+ aSelection.Adjust();
+
+ if( HasSelection() )
+ {
+ EditSelection aSel( pImpEditView->GetEditSelection() );
+ aSel.Adjust( PIMPEE->GetEditDoc() );
+ XubString aStr = PIMPEE->GetSelected( aSel );
+
+ // Stop reconversion if the selected text includes a line break.
+ if ( aStr.Search( 0x0A ) == STRING_NOTFOUND )
+ return Selection( 0, aSelection.nEndPos - aSelection.nStartPos );
+ else
+ return Selection( 0, 0 );
+ }
+ else
+ {
+ return Selection( aSelection.nStartPos, aSelection.nEndPos );
+ }
+}
diff --git a/svx/source/editeng/edtspell.cxx b/svx/source/editeng/edtspell.cxx
index 25cf685a5df7..df6725cff00f 100644
--- a/svx/source/editeng/edtspell.cxx
+++ b/svx/source/editeng/edtspell.cxx
@@ -476,6 +476,31 @@ WrongList* WrongList::Clone() const
return pNew;
}
+// #i102062#
+bool WrongList::operator==(const WrongList& rCompare) const
+{
+ // cleck direct members
+ if(GetInvalidStart() != rCompare.GetInvalidStart()
+ || GetInvalidEnd() != rCompare.GetInvalidEnd()
+ || Count() != rCompare.Count())
+ {
+ return false;
+ }
+
+ for(USHORT a(0); a < Count(); a++)
+ {
+ const WrongRange& rCandA(GetObject(a));
+ const WrongRange& rCandB(rCompare.GetObject(a));
+
+ if(rCandA.nStart != rCandB.nStart
+ || rCandA.nEnd != rCandB.nEnd)
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
#ifdef DBG_UTIL
sal_Bool WrongList::DbgIsBuggy() const
diff --git a/svx/source/editeng/impedit2.cxx b/svx/source/editeng/impedit2.cxx
index 9ae79e7b1391..47a3aa24b3e9 100644
--- a/svx/source/editeng/impedit2.cxx
+++ b/svx/source/editeng/impedit2.cxx
@@ -381,7 +381,6 @@ BOOL ImpEditEngine::MouseButtonDown( const MouseEvent& rMEvt, EditView* pView )
void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView )
{
-#ifndef SVX_LIGHT
GetSelEngine().SetCurView( pView );
SetActiveView( pView );
if ( rCEvt.GetCommand() == COMMAND_VOICE )
@@ -642,7 +641,42 @@ void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView )
pView->GetWindow()->SetCursorRect();
}
}
-#endif // !SVX_LIGHT
+ else if ( rCEvt.GetCommand() == COMMAND_SELECTIONCHANGE )
+ {
+ const CommandSelectionChangeData *pData = rCEvt.GetSelectionChangeData();
+
+ ESelection aSelection = pView->GetSelection();
+ aSelection.Adjust();
+
+ if( pView->HasSelection() )
+ {
+ aSelection.nEndPos = aSelection.nStartPos;
+ aSelection.nStartPos += pData->GetStart();
+ aSelection.nEndPos += pData->GetEnd();
+ }
+ else
+ {
+ aSelection.nStartPos = pData->GetStart();
+ aSelection.nEndPos = pData->GetEnd();
+ }
+ pView->SetSelection( aSelection );
+ }
+ else if ( rCEvt.GetCommand() == COMMAND_PREPARERECONVERSION )
+ {
+ if ( pView->HasSelection() )
+ {
+ ESelection aSelection = pView->GetSelection();
+ aSelection.Adjust();
+
+ if ( aSelection.nStartPara != aSelection.nEndPara )
+ {
+ xub_StrLen aParaLen = pEditEngine->GetTextLen( aSelection.nStartPara );
+ aSelection.nEndPara = aSelection.nStartPara;
+ aSelection.nEndPos = aParaLen;
+ pView->SetSelection( aSelection );
+ }
+ }
+ }
GetSelEngine().Command( rCEvt );
}
@@ -1743,7 +1777,7 @@ void ImpEditEngine::InitScriptTypes( USHORT nPara )
::rtl::OUString aOUText( aText );
USHORT nTextLen = (USHORT)aOUText.getLength();
- long nPos = 0;
+ sal_Int32 nPos = 0;
short nScriptType = _xBI->getScriptType( aOUText, nPos );
rTypes.Insert( ScriptTypePosInfo( nScriptType, (USHORT)nPos, nTextLen ), rTypes.Count() );
nPos = _xBI->endOfScript( aOUText, nPos, nScriptType );
@@ -1761,6 +1795,17 @@ void ImpEditEngine::InitScriptTypes( USHORT nPara )
}
else
{
+ if ( _xBI->getScriptType( aOUText, nPos - 1 ) == i18n::ScriptType::WEAK )
+ {
+ switch ( u_charType(aOUText.iterateCodePoints(&nPos, 0) ) ) {
+ case U_NON_SPACING_MARK:
+ case U_ENCLOSING_MARK:
+ case U_COMBINING_SPACING_MARK:
+ --nPos;
+ rTypes[rTypes.Count()-1].nEndPos--;
+ break;
+ }
+ }
rTypes.Insert( ScriptTypePosInfo( nScriptType, (USHORT)nPos, nTextLen ), rTypes.Count() );
}
diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx
index 23e73421192d..2d3408ffeb86 100644
--- a/svx/source/engine3d/obj3d.cxx
+++ b/svx/source/engine3d/obj3d.cxx
@@ -1206,22 +1206,6 @@ void E3dCompoundObject::operator=(const SdrObject& rObj)
/*************************************************************************
|*
-|* Hittest fuer 3D-Objekte, wird an Geometrie weitergegeben
-|*
-\************************************************************************/
-
-SdrObject* E3dCompoundObject::CheckHit(const Point& rPnt, USHORT /*nTol*/, const SetOfByte* /*pVisiLayer*/) const
-{
- if(checkHitSingle3DObject(basegfx::B2DPoint(rPnt.X(), rPnt.Y()), *this))
- {
- return const_cast< E3dCompoundObject* >(this);
- }
-
- return 0;
-}
-
-/*************************************************************************
-|*
|* Parameter Geometrieerzeugung setzen
|*
\************************************************************************/
diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx
index ebd11f87c477..22ef5777f730 100644
--- a/svx/source/engine3d/scene3d.cxx
+++ b/svx/source/engine3d/scene3d.cxx
@@ -538,6 +538,19 @@ void E3dScene::operator=(const SdrObject& rObj)
// #110988#
ImpCleanup3DDepthMapper();
+
+ // #i101941#
+ // After a Scene as model object is cloned, the used
+ // ViewContactOfE3dScene is created and partially used
+ // to calculate Bound/SnapRects, but - since quite some
+ // values are buffered at the VC - not really well
+ // initialized. It would be possible to always watch for
+ // preconditions of buffered data, but this would be expensive
+ // and would create a lot of short living data structures.
+ // It is currently better to flush that data, e.g. by using
+ // ActionChanged at the VC which will for this class
+ // flush that cached data and initalize it's valid reconstruction
+ GetViewContact().ActionChanged();
}
/*************************************************************************
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index 80983514ede5..8f5a895e0c33 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -1921,7 +1921,7 @@ void FmXGridPeer::setProperty( const ::rtl::OUString& PropertyName, const Any& V
if ( 0 == PropertyName.compareToAscii( FM_PROP_TEXTLINECOLOR ) )
{
- ::Color aTextLineColor(::comphelper::getINT32(Value));
+ ::Color aTextLineColor( bVoid ? COL_TRANSPARENT : ::comphelper::getINT32( Value ) );
if (bVoid)
{
pGrid->SetTextLineColor();
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index d6cd4f2d2bae..ad645992d53d 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -55,6 +55,7 @@
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/awt/LineEndFormat.hpp>
+#include <com/sun/star/awt/MouseWheelBehavior.hpp>
#ifndef _COM_SUN_STAR_SCRTIP_XEVENTATTACHERMANAGER_HPP_
#include <com/sun/star/script/XEventAttacherManager.hpp>
#endif
@@ -90,9 +91,9 @@ using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::form;
-using ::com::sun::star::util::XNumberFormatter;
using ::com::sun::star::util::XNumberFormatter;
+namespace MouseWheelBehavior = ::com::sun::star::awt::MouseWheelBehavior;
String INVALIDTEXT = String::CreateFromAscii("###");
String OBJECTTEXT = String::CreateFromAscii("<OBJECT>");
@@ -836,22 +837,40 @@ void DbCellControl::Init( Window& rParent, const Reference< XRowSet >& _rxCursor
try
{
// some other common properties
- Reference< XPropertySet > xModel( m_rColumn.getModel() );
- Reference< XPropertySetInfo > xModelPSI;
- if ( xModel.is() )
- xModelPSI = xModel->getPropertySetInfo();
+ Reference< XPropertySet > xModel( m_rColumn.getModel(), UNO_SET_THROW );
+ Reference< XPropertySetInfo > xModelPSI( xModel->getPropertySetInfo(), UNO_SET_THROW );
- // the "readonly" state
- if ( xModelPSI.is() && xModelPSI->hasPropertyByName( FM_PROP_READONLY ) )
+ if ( xModelPSI->hasPropertyByName( FM_PROP_READONLY ) )
{
implAdjustReadOnly( xModel );
}
- // the "enabled" flag
- if ( xModelPSI.is() && xModelPSI->hasPropertyByName( FM_PROP_ENABLED ) )
+ if ( xModelPSI->hasPropertyByName( FM_PROP_ENABLED ) )
{
implAdjustEnabled( xModel );
}
+
+ if ( xModelPSI->hasPropertyByName( FM_PROP_MOUSE_WHEEL_BEHAVIOR ) )
+ {
+ sal_Int16 nWheelBehavior = MouseWheelBehavior::SCROLL_FOCUS_ONLY;
+ OSL_VERIFY( xModel->getPropertyValue( FM_PROP_MOUSE_WHEEL_BEHAVIOR ) >>= nWheelBehavior );
+ USHORT nVclSetting = MOUSE_WHEEL_FOCUS_ONLY;
+ switch ( nWheelBehavior )
+ {
+ case MouseWheelBehavior::SCROLL_DISABLED: nVclSetting = MOUSE_WHEEL_DISABLE; break;
+ case MouseWheelBehavior::SCROLL_FOCUS_ONLY: nVclSetting = MOUSE_WHEEL_FOCUS_ONLY; break;
+ case MouseWheelBehavior::SCROLL_ALWAYS: nVclSetting = MOUSE_WHEEL_ALWAYS; break;
+ default:
+ OSL_ENSURE( false, "DbCellControl::Init: invalid MouseWheelBehavior!" );
+ break;
+ }
+
+ AllSettings aSettings = m_pWindow->GetSettings();
+ MouseSettings aMouseSettings = aSettings.GetMouseSettings();
+ aMouseSettings.SetWheelBehavior( nVclSetting );
+ aSettings.SetMouseSettings( aMouseSettings );
+ m_pWindow->SetSettings( aSettings, TRUE );
+ }
}
catch( const Exception& )
{
diff --git a/svx/source/form/fmprop.cxx b/svx/source/form/fmprop.cxx
index 2cf5f158ac1f..e328e79b9514 100644
--- a/svx/source/form/fmprop.cxx
+++ b/svx/source/form/fmprop.cxx
@@ -189,6 +189,7 @@ namespace svxform
IMPLEMENT_CONSTASCII_USTRING( FM_PROP_INPUT_REQUIRED, "InputRequired" );
IMPLEMENT_CONSTASCII_USTRING( FM_PROP_WRITING_MODE, "WritingMode" );
+ IMPLEMENT_CONSTASCII_USTRING( FM_PROP_MOUSE_WHEEL_BEHAVIOR, "MouseWheelBehavior" );
} // namespace svxform
diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx
index 25992ad607dd..b5cdd332362d 100644
--- a/svx/source/gallery2/galobj.cxx
+++ b/svx/source/gallery2/galobj.cxx
@@ -134,7 +134,8 @@ BOOL SgaObject::CreateThumb( const Graphic& rGraphic )
else
aSize.Height() = (sal_Int32)( S_THUMB / fFactor );
- aThumbBmp = rGraphic.GetBitmap( &aSize );
+ const GraphicConversionParameters aParameters(aSize);
+ aThumbBmp = rGraphic.GetBitmap(aParameters);
if( !aThumbBmp.IsEmpty() )
{
diff --git a/svx/source/inc/fmprop.hrc b/svx/source/inc/fmprop.hrc
index adfb73ad1dc8..3deec41981d4 100644
--- a/svx/source/inc/fmprop.hrc
+++ b/svx/source/inc/fmprop.hrc
@@ -182,6 +182,7 @@ namespace svxform
DECLARE_CONSTASCII_USTRING( FM_PROP_FORM_OPERATIONS );
DECLARE_CONSTASCII_USTRING( FM_PROP_INPUT_REQUIRED );
DECLARE_CONSTASCII_USTRING( FM_PROP_WRITING_MODE );
+ DECLARE_CONSTASCII_USTRING( FM_PROP_MOUSE_WHEEL_BEHAVIOR );
} // namespace svxform
diff --git a/svx/source/items/paperinf.cxx b/svx/source/items/paperinf.cxx
index 234b5548567d..161d7af1aba9 100644
--- a/svx/source/items/paperinf.cxx
+++ b/svx/source/items/paperinf.cxx
@@ -44,129 +44,6 @@
#include <svx/paperinf.hxx>
#include <svx/dialmgr.hxx>
-#define SVX_PAPER_OFFSET 3 // Anfang: enum Paper A3 - SvxPaper A0; Diff=3
-
-// STATIC DATA -----------------------------------------------------------
-
-static Size __FAR_DATA aDinTab[] =
-{
- Size(lA0Width,lA0Height), // A0
- Size(lA1Width,lA1Height), // A1
- Size(lA2Width,lA2Height), // A2
- Size(lA3Width,lA3Height), // A3
- Size(lA4Width,lA4Height), // A4
- Size(lA5Width,lA5Height), // A5
- Size(lB4Width, lB4Height), // B4
- Size(lB5Width,lB5Height), // B5
- Size(lLetterWidth,lLetterHeight), // LETTER
- Size(lLegalWidth,lLegalHeight), // LEGAL
- Size(lTabloidWidth,lTabloidHeight), // TABLOID
- Size(0, 0), // USER
- Size(lB6Width, lB6Height), // B6
- Size(lC4Width, lC4Height), // C4
- Size(lC5Width, lC5Height), // C5
- Size(lC6Width, lC6Height), // C6
- Size(lC65Width, lC65Height), // C65
- Size(lDLWidth, lDLHeight), // DL
- Size(lDiaWidth,lDiaHeight ), // DIA
- Size(lScreenWidth, lScreenHeight), // SCREEN
- Size(lAWidth, lAHeight), // A
- Size(lBWidth, lBHeight), // B
- Size(lCWidth, lCHeight), // C
- Size(lDWidth, lDHeight), // D
- Size(lEWidth, lEHeight), // E
- Size(lExeWidth, lExeHeight), // Executive
- Size(lLegal2Width, lLegal2Height), // Legal2
- Size(lMonarchWidth, lMonarchHeight),// Monarch
- Size(lCom675Width, lCom675Height), // COM-6 3/4
- Size(lCom9Width, lCom9Height), // COM-9
- Size(lCom10Width, lCom10Height), // COM-10
- Size(lCom11Width, lCom11Height), // COM-11
- Size(lCom12Width, lCom12Height), // COM-12
- Size(lKai16Width, lKai16Height), // 16 kai
- Size(lKai32Width, lKai32Height), // 32 kai
- Size(lKai32BigWidth, lKai32BigHeight), // 32 kai gross
- Size(lJISB4Width, lJISB4Height), // B4 (JIS)
- Size(lJISB5Width, lJISB5Height), // B5 (JIS)
- Size(lJISB6Width, lJISB6Height) // B6 (JIS)
-};
-
-static const int nTabSize = sizeof(aDinTab) / sizeof(aDinTab[0]);
-
-// -----------------------------------------------------------------------
-
-long TwipsTo100thMM( long nIn )
-{
- long nRet = OutputDevice::LogicToLogic( nIn, MAP_TWIP, MAP_100TH_MM );
- long nTmp = nRet % 10;
-
- if ( nTmp )
- nRet += 10 - nTmp;
- return nRet;
-}
-
-// -----------------------------------------------------------------------
-
-Size ConvertTo100thMM( Size& rSize )
-{
- // Convert form TWIPS to 100TH_MM
- long nW = TwipsTo100thMM( rSize.Width() );
- long nH = TwipsTo100thMM( rSize.Height() );
-
- rSize.Width() = nW;
- rSize.Height() = nH;
- return rSize;
-}
-
-// -----------------------------------------------------------------------
-
-long HundMMToTwips( long nIn )
-{
- long nRet = OutputDevice::LogicToLogic( nIn, MAP_100TH_MM, MAP_TWIP );
- return nRet;
-}
-
-// -----------------------------------------------------------------------
-
-Size ConvertToTwips( Size& rSize )
-{
- // Convert form TWIPS to 100TH_MM
- long nW = HundMMToTwips( rSize.Width() );
- long nH = HundMMToTwips( rSize.Height() );
-
- rSize.Width() = nW;
- rSize.Height() = nH;
- return rSize;
-}
-
-// -----------------------------------------------------------------------
-
-SvxPaper GetPaper_Impl( const Size &rSize, MapUnit eUnit, BOOL bSloppy )
-{
- DBG_ASSERT( eUnit == MAP_TWIP || eUnit == MAP_100TH_MM,
- "map unit not supported" );
- Size aSize = rSize;
-
- if ( eUnit == MAP_100TH_MM )
- ConvertToTwips( aSize );
-
- for ( USHORT i = 0; i < nTabSize; i++ )
- {
- if ( aDinTab[i] == aSize )
- return (SvxPaper)i;
- else if ( bSloppy )
- {
- long lDiffW = Abs(aDinTab[i].Width () - aSize.Width ()),
- lDiffH = Abs(aDinTab[i].Height() - aSize.Height());
-
- if ( lDiffW < 6 && lDiffH < 6 )
- return (SvxPaper)i;
- }
- }
- return SVX_PAPER_USER;
-}
-
-
/*--------------------------------------------------------------------
Beschreibung: Ist der Printer gueltig
--------------------------------------------------------------------*/
@@ -176,22 +53,13 @@ inline BOOL IsValidPrinter( const Printer* pPtr )
return pPtr->GetName().Len() ? TRUE : FALSE;
}
-/*------------------------------------------------------------------------
- Beschreibung: Konvertierung eines SV-Defines fuer Papiergroesse in
- Twips.
- Funktioniert logischerweise nicht fuer User Groessen
- (ASSERT).
-------------------------------------------------------------------------*/
+//------------------------------------------------------------------------
-Size SvxPaperInfo::GetPaperSize( SvxPaper ePaper, MapUnit eUnit )
+Size SvxPaperInfo::GetPaperSize( Paper ePaper, MapUnit eUnit )
{
- DBG_ASSERT( ePaper < nTabSize, "Tabelle der Papiergroessen ueberindiziert" );
- DBG_ASSERT( eUnit == MAP_TWIP || eUnit == MAP_100TH_MM, "this MapUnit not supported" );
- Size aSize = aDinTab[ePaper]; // in Twips
-
- if ( eUnit == MAP_100TH_MM )
- ConvertTo100thMM( aSize );
- return aSize;
+ PaperInfo aInfo(ePaper);
+ Size aRet(aInfo.getWidth(), aInfo.getHeight()); // in 100thMM
+ return eUnit == MAP_100TH_MM ? aRet : OutputDevice::LogicToLogic(aRet, MAP_100TH_MM, eUnit);
}
/*------------------------------------------------------------------------
@@ -201,21 +69,25 @@ Size SvxPaperInfo::GetPaperSize( SvxPaper ePaper, MapUnit eUnit )
wird DIN A4 Portrait als Defaultpapiergroesse geliefert.
------------------------------------------------------------------------*/
+//Is this method may be confused about the units it returns ?
+//Always returns TWIPS for known paper sizes or on failure.
+//But in the case of PAPER_USER paper and with a Printer with a mapmode set
+//will return in those printer units ?
Size SvxPaperInfo::GetPaperSize( const Printer* pPrinter )
{
if ( !IsValidPrinter(pPrinter) )
- return GetPaperSize( SVX_PAPER_A4 );
- const SvxPaper ePaper = (SvxPaper)(pPrinter->GetPaper() + SVX_PAPER_OFFSET);
+ return GetPaperSize( PAPER_A4 );
+ const Paper ePaper = pPrinter->GetPaper();
- if ( ePaper == SVX_PAPER_USER )
+ if ( ePaper == PAPER_USER )
{
- // Orientation nicht beruecksichtigen, da durch SV bereits
- // die richtigen Masze eingestellt worden sind.
+ // Orientation nicht beruecksichtigen, da durch SV bereits
+ // die richtigen Masze eingestellt worden sind.
Size aPaperSize = pPrinter->GetPaperSize();
const Size aInvalidSize;
if ( aPaperSize == aInvalidSize )
- return GetPaperSize(SVX_PAPER_A4);
+ return GetPaperSize(PAPER_A4);
MapMode aMap1 = pPrinter->GetMapMode();
MapMode aMap2;
@@ -233,64 +105,33 @@ Size SvxPaperInfo::GetPaperSize( const Printer* pPrinter )
return aSize;
}
-/*------------------------------------------------------------------------
- Beschreibung: Konvertierung einer Papiergroesse in Twips in das
- SV-Define. Ist bSloppy TRUE, so wird nur auf 1/10 mm genau
- verglichen.
-------------------------------------------------------------------------*/
+// -----------------------------------------------------------------------
-SvxPaper SvxPaperInfo::GetPaper( const Size &rSize, MapUnit eUnit, BOOL bSloppy )
+Paper SvxPaperInfo::GetSvxPaper( const Size &rSize, MapUnit eUnit, bool bSloppy )
{
- return GetPaper_Impl( rSize, eUnit, bSloppy );
+ Size aSize(eUnit == MAP_100TH_MM ? rSize : OutputDevice::LogicToLogic(rSize, eUnit, MAP_100TH_MM));
+ PaperInfo aInfo(aSize.Width(), aSize.Height());
+ if (bSloppy)
+ aInfo.doSloppyFit();
+ return aInfo.getPaper();
}
// -----------------------------------------------------------------------
-SvxPaper SvxPaperInfo::GetSvxPaper( const Size &rSize, MapUnit eUnit, BOOL bSloppy )
+long SvxPaperInfo::GetSloppyPaperDimension( long nSize, MapUnit eUnit )
{
- return GetPaper_Impl( rSize, eUnit, bSloppy );
-}
-
-SvxPaper SvxPaperInfo::GetDefaultSvxPaper( LanguageType eLanguage )
-{
- SvxPaper ePaper;
- switch ( eLanguage )
- {
- case LANGUAGE_ENGLISH_US:
- case LANGUAGE_ENGLISH_CAN:
- case LANGUAGE_FRENCH_CANADIAN:
- case LANGUAGE_SPANISH_MEXICAN:
- case LANGUAGE_SPANISH_VENEZUELA:
- ePaper = SvxPaper( SVX_PAPER_LETTER );
- break;
- default:
- ePaper = SvxPaper( SVX_PAPER_A4 );
- }
- return ePaper;
+ nSize = eUnit == MAP_100TH_MM ? nSize : OutputDevice::LogicToLogic(nSize, eUnit, MAP_100TH_MM);
+ nSize = PaperInfo::sloppyFitPageDimension(nSize);
+ return eUnit == MAP_100TH_MM ? nSize : OutputDevice::LogicToLogic(nSize, MAP_100TH_MM, eUnit);
}
// -----------------------------------------------------------------------
-Paper SvxPaperInfo::GetSvPaper( const Size &rSize, MapUnit eUnit,
- BOOL bSloppy )
+Size SvxPaperInfo::GetDefaultPaperSize( MapUnit eUnit )
{
- Paper eRet = PAPER_USER;
- SvxPaper ePaper = GetPaper_Impl( rSize, eUnit, bSloppy );
-
- switch ( ePaper )
- {
- case SVX_PAPER_A3: eRet = PAPER_A3; break;
- case SVX_PAPER_A4: eRet = PAPER_A4; break;
- case SVX_PAPER_A5: eRet = PAPER_A5; break;
- case SVX_PAPER_B4: eRet = PAPER_B4; break;
- case SVX_PAPER_B5: eRet = PAPER_B5; break;
- case SVX_PAPER_LETTER: eRet = PAPER_LETTER; break;
- case SVX_PAPER_LEGAL: eRet = PAPER_LEGAL; break;
- case SVX_PAPER_TABLOID: eRet = PAPER_TABLOID; break;
- default: ;//prevent warning
- }
-
- return eRet;
+ PaperInfo aInfo(PaperInfo::getSystemDefaultPaper());
+ Size aRet(aInfo.getWidth(), aInfo.getHeight());
+ return eUnit == MAP_100TH_MM ? aRet : OutputDevice::LogicToLogic(aRet, MAP_100TH_MM, eUnit);
}
/*------------------------------------------------------------------------
@@ -298,52 +139,49 @@ Paper SvxPaperInfo::GetSvPaper( const Size &rSize, MapUnit eUnit,
Papiergroessen.
------------------------------------------------------------------------*/
-String SvxPaperInfo::GetName( SvxPaper ePaper )
+String SvxPaperInfo::GetName( Paper ePaper )
{
USHORT nResId = 0;
switch ( ePaper )
{
- case SVX_PAPER_A0: nResId = RID_SVXSTR_PAPER_A0; break;
- case SVX_PAPER_A1: nResId = RID_SVXSTR_PAPER_A1; break;
- case SVX_PAPER_A2: nResId = RID_SVXSTR_PAPER_A2; break;
- case SVX_PAPER_A3: nResId = RID_SVXSTR_PAPER_A3; break;
- case SVX_PAPER_A4: nResId = RID_SVXSTR_PAPER_A4; break;
- case SVX_PAPER_A5: nResId = RID_SVXSTR_PAPER_A5; break;
- case SVX_PAPER_B4: nResId = RID_SVXSTR_PAPER_B4; break;
- case SVX_PAPER_B5: nResId = RID_SVXSTR_PAPER_B5; break;
- case SVX_PAPER_LETTER: nResId = RID_SVXSTR_PAPER_LETTER; break;
- case SVX_PAPER_LEGAL: nResId = RID_SVXSTR_PAPER_LEGAL; break;
- case SVX_PAPER_TABLOID: nResId = RID_SVXSTR_PAPER_TABLOID; break;
- case SVX_PAPER_USER: nResId = RID_SVXSTR_PAPER_USER; break;
- case SVX_PAPER_B6: nResId = RID_SVXSTR_PAPER_B6; break;
- case SVX_PAPER_C4: nResId = RID_SVXSTR_PAPER_C4; break;
- case SVX_PAPER_C5: nResId = RID_SVXSTR_PAPER_C5; break;
- case SVX_PAPER_C6: nResId = RID_SVXSTR_PAPER_C6; break;
- case SVX_PAPER_C65: nResId = RID_SVXSTR_PAPER_C65; break;
- case SVX_PAPER_DL: nResId = RID_SVXSTR_PAPER_DL; break;
- case SVX_PAPER_DIA: nResId = RID_SVXSTR_PAPER_DIA; break;
- case SVX_PAPER_SCREEN: nResId = RID_SVXSTR_PAPER_SCREEN; break;
- case SVX_PAPER_A: nResId = RID_SVXSTR_PAPER_A; break;
- case SVX_PAPER_B: nResId = RID_SVXSTR_PAPER_B; break;
- case SVX_PAPER_C: nResId = RID_SVXSTR_PAPER_C; break;
- case SVX_PAPER_D: nResId = RID_SVXSTR_PAPER_D; break;
- case SVX_PAPER_E: nResId = RID_SVXSTR_PAPER_E; break;
- case SVX_PAPER_EXECUTIVE: nResId = RID_SVXSTR_PAPER_EXECUTIVE;break;
- case SVX_PAPER_LEGAL2: nResId = RID_SVXSTR_PAPER_LEGAL2; break;
- case SVX_PAPER_MONARCH: nResId = RID_SVXSTR_PAPER_MONARCH; break;
- case SVX_PAPER_COM675: nResId = RID_SVXSTR_PAPER_COM675; break;
- case SVX_PAPER_COM9: nResId = RID_SVXSTR_PAPER_COM9; break;
- case SVX_PAPER_COM10: nResId = RID_SVXSTR_PAPER_COM10; break;
- case SVX_PAPER_COM11: nResId = RID_SVXSTR_PAPER_COM11; break;
- case SVX_PAPER_COM12: nResId = RID_SVXSTR_PAPER_COM12; break;
- case SVX_PAPER_KAI16: nResId = RID_SVXSTR_PAPER_KAI16; break;
- case SVX_PAPER_KAI32: nResId = RID_SVXSTR_PAPER_KAI32; break;
- case SVX_PAPER_KAI32BIG: nResId = RID_SVXSTR_PAPER_KAI32BIG; break;
- case SVX_PAPER_B4_JIS: nResId = RID_SVXSTR_PAPER_B4_JIS; break;
- case SVX_PAPER_B5_JIS: nResId = RID_SVXSTR_PAPER_B5_JIS; break;
- case SVX_PAPER_B6_JIS: nResId = RID_SVXSTR_PAPER_B6_JIS; break;
-
+ case PAPER_A0: nResId = RID_SVXSTR_PAPER_A0; break;
+ case PAPER_A1: nResId = RID_SVXSTR_PAPER_A1; break;
+ case PAPER_A2: nResId = RID_SVXSTR_PAPER_A2; break;
+ case PAPER_A3: nResId = RID_SVXSTR_PAPER_A3; break;
+ case PAPER_A4: nResId = RID_SVXSTR_PAPER_A4; break;
+ case PAPER_A5: nResId = RID_SVXSTR_PAPER_A5; break;
+ case PAPER_B4_ISO: nResId = RID_SVXSTR_PAPER_B4_ISO; break;
+ case PAPER_B5_ISO: nResId = RID_SVXSTR_PAPER_B5_ISO; break;
+ case PAPER_LETTER: nResId = RID_SVXSTR_PAPER_LETTER; break;
+ case PAPER_LEGAL: nResId = RID_SVXSTR_PAPER_LEGAL; break;
+ case PAPER_TABLOID: nResId = RID_SVXSTR_PAPER_TABLOID; break;
+ case PAPER_USER: nResId = RID_SVXSTR_PAPER_USER; break;
+ case PAPER_B6_ISO: nResId = RID_SVXSTR_PAPER_B6_ISO; break;
+ case PAPER_ENV_C4: nResId = RID_SVXSTR_PAPER_C4; break;
+ case PAPER_ENV_C5: nResId = RID_SVXSTR_PAPER_C5; break;
+ case PAPER_ENV_C6: nResId = RID_SVXSTR_PAPER_C6; break;
+ case PAPER_ENV_C65: nResId = RID_SVXSTR_PAPER_C65; break;
+ case PAPER_ENV_DL: nResId = RID_SVXSTR_PAPER_DL; break;
+ case PAPER_SLIDE_DIA: nResId = RID_SVXSTR_PAPER_DIA; break;
+ case PAPER_SCREEN: nResId = RID_SVXSTR_PAPER_SCREEN; break;
+ case PAPER_C: nResId = RID_SVXSTR_PAPER_C; break;
+ case PAPER_D: nResId = RID_SVXSTR_PAPER_D; break;
+ case PAPER_E: nResId = RID_SVXSTR_PAPER_E; break;
+ case PAPER_EXECUTIVE: nResId = RID_SVXSTR_PAPER_EXECUTIVE;break;
+ case PAPER_FANFOLD_LEGAL_DE: nResId = RID_SVXSTR_PAPER_LEGAL2; break;
+ case PAPER_ENV_MONARCH: nResId = RID_SVXSTR_PAPER_MONARCH; break;
+ case PAPER_ENV_PERSONAL: nResId = RID_SVXSTR_PAPER_COM675; break;
+ case PAPER_ENV_9: nResId = RID_SVXSTR_PAPER_COM9; break;
+ case PAPER_ENV_10: nResId = RID_SVXSTR_PAPER_COM10; break;
+ case PAPER_ENV_11: nResId = RID_SVXSTR_PAPER_COM11; break;
+ case PAPER_ENV_12: nResId = RID_SVXSTR_PAPER_COM12; break;
+ case PAPER_KAI16: nResId = RID_SVXSTR_PAPER_KAI16; break;
+ case PAPER_KAI32: nResId = RID_SVXSTR_PAPER_KAI32; break;
+ case PAPER_KAI32BIG: nResId = RID_SVXSTR_PAPER_KAI32BIG; break;
+ case PAPER_B4_JIS: nResId = RID_SVXSTR_PAPER_B4_JIS; break;
+ case PAPER_B5_JIS: nResId = RID_SVXSTR_PAPER_B5_JIS; break;
+ case PAPER_B6_JIS: nResId = RID_SVXSTR_PAPER_B6_JIS; break;
default: DBG_ERRORFILE( "unknown papersize" );
}
diff --git a/svx/source/items/paraitem.cxx b/svx/source/items/paraitem.cxx
index ebc9c9f59ac2..80af583638e8 100644
--- a/svx/source/items/paraitem.cxx
+++ b/svx/source/items/paraitem.cxx
@@ -1268,6 +1268,7 @@ SvStream& SvxTabStopItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ )
if( nNew <= nPos + 50 )
nNew += nDefDist;
+ long lA3Width = SvxPaperInfo::GetPaperSize(PAPER_A3).Width();
nCount = (sal_uInt16)(nNew < lA3Width ? ( lA3Width - nNew ) / nDefDist + 1 : 0);
}
diff --git a/svx/source/msfilter/mscodec.cxx b/svx/source/msfilter/mscodec.cxx
index 428d18c20649..591bce8f4f6d 100644
--- a/svx/source/msfilter/mscodec.cxx
+++ b/svx/source/msfilter/mscodec.cxx
@@ -37,6 +37,13 @@
#include <string.h>
#include <tools/solar.h>
+#define DEBUG_MSO_ENCRYPTION_STD97 0
+
+#if DEBUG_MSO_ENCRYPTION_STD97
+#include <stdio.h>
+#endif
+
+
namespace svx {
// ============================================================================
@@ -241,15 +248,50 @@ MSCodec_Std97::~MSCodec_Std97 ()
rtl_cipher_destroy (m_hCipher);
}
+#if DEBUG_MSO_ENCRYPTION_STD97
+static void lcl_PrintKeyData(const sal_uInt8* pKeyData, const char* msg)
+{
+ printf("pKeyData: (%s)\n", msg);
+ for (int j = 0; j < 4; ++j)
+ {
+ for (int i = 0; i < 16; ++i)
+ printf("%2.2x ", pKeyData[j*16+i]);
+ printf("\n");
+ }
+}
+#else
+static void lcl_PrintKeyData(const sal_uInt8* /*pKeyData*/, const char* /*msg*/)
+{
+}
+#endif
+
+#if DEBUG_MSO_ENCRYPTION_STD97
+static void lcl_PrintDigest(const sal_uInt8* pDigest, const char* msg)
+{
+ printf("digest: (%s)\n", msg);
+ for (int i = 0; i < 16; ++i)
+ printf("%2.2x ", pDigest[i]);
+ printf("\n");
+}
+#else
+static void lcl_PrintDigest(const sal_uInt8* /*pDigest*/, const char* /*msg*/)
+{
+}
+#endif
+
void MSCodec_Std97::InitKey (
const sal_uInt16 pPassData[16],
const sal_uInt8 pUnique[16])
{
+#if DEBUG_MSO_ENCRYPTION_STD97
+ fprintf(stdout, "MSCodec_Std97::InitKey: --begin\n");fflush(stdout);
+#endif
sal_uInt8 pKeyData[64];
int i, n;
// Fill PassData into KeyData.
(void)memset (pKeyData, 0, sizeof(pKeyData));
+ lcl_PrintKeyData(pKeyData, "initial");
for (i = 0, n = 16; (i < n) && pPassData[i]; i++)
{
pKeyData[2*i ] = sal::static_int_cast< sal_uInt8 >(
@@ -260,12 +302,16 @@ void MSCodec_Std97::InitKey (
pKeyData[2*i] = 0x80;
pKeyData[ 56] = sal::static_int_cast< sal_uInt8 >(i << 4);
+ lcl_PrintKeyData(pKeyData, "password data");
+
// Fill raw digest of KeyData into KeyData.
(void)rtl_digest_updateMD5 (
m_hDigest, pKeyData, sizeof(pKeyData));
(void)rtl_digest_rawMD5 (
m_hDigest, pKeyData, RTL_DIGEST_LENGTH_MD5);
+ lcl_PrintKeyData(pKeyData, "raw digest of key data");
+
// Update digest with KeyData and Unique.
for (i = 0; i < 16; i++)
{
@@ -279,6 +325,8 @@ void MSCodec_Std97::InitKey (
pKeyData[56] = 0x80;
pKeyData[57] = 0x0a;
+ lcl_PrintKeyData(pKeyData, "update digest with padding");
+
rtl_digest_updateMD5 (
m_hDigest, &(pKeyData[16]), sizeof(pKeyData) - 16);
@@ -286,6 +334,8 @@ void MSCodec_Std97::InitKey (
rtl_digest_rawMD5 (
m_hDigest, m_pDigestValue, sizeof(m_pDigestValue));
+ lcl_PrintDigest(m_pDigestValue, "digest value");
+
// Erase KeyData array and leave.
(void)memset (pKeyData, 0, sizeof(pKeyData));
}
@@ -294,27 +344,21 @@ bool MSCodec_Std97::VerifyKey (
const sal_uInt8 pSaltData[16],
const sal_uInt8 pSaltDigest[16])
{
+ // both the salt data and salt digest (hash) come from the document being imported.
+
+#if DEBUG_MSO_ENCRYPTION_STD97
+ fprintf(stdout, "MSCodec_Std97::VerifyKey: \n");
+ lcl_PrintDigest(pSaltData, "salt data");
+ lcl_PrintDigest(pSaltDigest, "salt hash");
+#endif
bool result = false;
if (InitCipher(0))
{
sal_uInt8 pDigest[RTL_DIGEST_LENGTH_MD5];
- sal_uInt8 pBuffer[64];
-
- // Decode SaltData into Buffer.
- rtl_cipher_decode (
- m_hCipher, pSaltData, 16, pBuffer, sizeof(pBuffer));
-
- pBuffer[16] = 0x80;
- (void)memset (pBuffer + 17, 0, sizeof(pBuffer) - 17);
- pBuffer[56] = 0x80;
-
- // Fill raw digest of Buffer into Digest.
- rtl_digest_updateMD5 (
- m_hDigest, pBuffer, sizeof(pBuffer));
- rtl_digest_rawMD5 (
- m_hDigest, pDigest, sizeof(pDigest));
+ GetDigestFromSalt(pSaltData, pDigest);
+ sal_uInt8 pBuffer[16];
// Decode original SaltDigest into Buffer.
rtl_cipher_decode (
m_hCipher, pSaltDigest, 16, pBuffer, sizeof(pBuffer));
@@ -333,7 +377,7 @@ bool MSCodec_Std97::VerifyKey (
bool MSCodec_Std97::InitCipher (sal_uInt32 nCounter)
{
rtlCipherError result;
- sal_uInt8 pKeyData[64];
+ sal_uInt8 pKeyData[64]; // 512-bit message block
// Initialize KeyData array.
(void)memset (pKeyData, 0, sizeof(pKeyData));
@@ -358,7 +402,7 @@ bool MSCodec_Std97::InitCipher (sal_uInt32 nCounter)
// Initialize Cipher with KeyData (for decoding).
result = rtl_cipher_init (
- m_hCipher, rtl_Cipher_DirectionDecode,
+ m_hCipher, rtl_Cipher_DirectionBoth,
pKeyData, RTL_DIGEST_LENGTH_MD5, 0, 0);
// Erase KeyData array and leave.
@@ -367,6 +411,39 @@ bool MSCodec_Std97::InitCipher (sal_uInt32 nCounter)
return (result == rtl_Cipher_E_None);
}
+bool MSCodec_Std97::CreateSaltDigest( const sal_uInt8 nSaltData[16], sal_uInt8 nSaltDigest[16] )
+{
+#if DEBUG_MSO_ENCRYPTION_STD97
+ lcl_PrintDigest(pSaltData, "salt data");
+#endif
+ bool result = false;
+
+ if (InitCipher(0))
+ {
+ sal_uInt8 pDigest[RTL_DIGEST_LENGTH_MD5];
+ GetDigestFromSalt(nSaltData, pDigest);
+
+ rtl_cipher_decode (
+ m_hCipher, pDigest, 16, pDigest, sizeof(pDigest));
+
+ (void)memcpy(nSaltDigest, pDigest, 16);
+ }
+
+ return (result);
+}
+
+bool MSCodec_Std97::Encode (
+ const void *pData, sal_Size nDatLen,
+ sal_uInt8 *pBuffer, sal_Size nBufLen)
+{
+ rtlCipherError result;
+
+ result = rtl_cipher_encode (
+ m_hCipher, pData, nDatLen, pBuffer, nBufLen);
+
+ return (result == rtl_Cipher_E_None);
+}
+
bool MSCodec_Std97::Decode (
const void *pData, sal_Size nDatLen,
sal_uInt8 *pBuffer, sal_Size nBufLen)
@@ -395,6 +472,65 @@ bool MSCodec_Std97::Skip( sal_Size nDatLen )
return bResult;
}
+void MSCodec_Std97::GetDigestFromSalt( const sal_uInt8 pSaltData[16], sal_uInt8 pDigest[16] )
+{
+ sal_uInt8 pBuffer[64];
+ sal_uInt8 pDigestLocal[16];
+
+ // Decode SaltData into Buffer.
+ rtl_cipher_decode (
+ m_hCipher, pSaltData, 16, pBuffer, sizeof(pBuffer));
+
+ // set the 129th bit to make the buffer 128-bit in length.
+ pBuffer[16] = 0x80;
+
+ // erase the rest of the buffer with zeros.
+ (void)memset (pBuffer + 17, 0, sizeof(pBuffer) - 17);
+
+ // set the 441st bit.
+ pBuffer[56] = 0x80;
+
+ // Fill raw digest of Buffer into Digest.
+ rtl_digest_updateMD5 (
+ m_hDigest, pBuffer, sizeof(pBuffer));
+ rtl_digest_rawMD5 (
+ m_hDigest, pDigestLocal, sizeof(pDigestLocal));
+
+ memcpy(pDigest, pDigestLocal, 16);
+}
+
+void MSCodec_Std97::GetEncryptKey (
+ const sal_uInt8 pSalt[16],
+ sal_uInt8 pSaltData[16],
+ sal_uInt8 pSaltDigest[16])
+{
+ if (InitCipher(0))
+ {
+ sal_uInt8 pDigest[RTL_DIGEST_LENGTH_MD5];
+ sal_uInt8 pBuffer[64];
+
+ rtl_cipher_encode (
+ m_hCipher, pSalt, 16, pSaltData, sizeof(pBuffer));
+
+ (void)memcpy( pBuffer, pSalt, 16 );
+
+ pBuffer[16] = 0x80;
+ (void)memset (pBuffer + 17, 0, sizeof(pBuffer) - 17);
+ pBuffer[56] = 0x80;
+
+ rtl_digest_updateMD5 (
+ m_hDigest, pBuffer, sizeof(pBuffer));
+ rtl_digest_rawMD5 (
+ m_hDigest, pDigest, sizeof(pDigest));
+
+ rtl_cipher_encode (
+ m_hCipher, pDigest, 16, pSaltDigest, 16);
+
+ (void)memset (pBuffer, 0, sizeof(pBuffer));
+ (void)memset (pDigest, 0, sizeof(pDigest));
+ }
+}
+
// ============================================================================
} // namespace svx
diff --git a/svx/source/msfilter/msdffimp.cxx b/svx/source/msfilter/msdffimp.cxx
index 5a8c149fa2bf..5830a737e790 100644
--- a/svx/source/msfilter/msdffimp.cxx
+++ b/svx/source/msfilter/msdffimp.cxx
@@ -4754,13 +4754,13 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r
if ( ( nGroupRotateAngle > 4500 && nGroupRotateAngle <= 13500 )
|| ( nGroupRotateAngle > 22500 && nGroupRotateAngle <= 31500 ) )
{
- sal_Int32 nHalfWidth = ( aGlobalChildRect.GetWidth() + 1 ) >> 1;
- sal_Int32 nHalfHeight = ( aGlobalChildRect.GetHeight() + 1 ) >> 1;
- Point aTopLeft( aGlobalChildRect.Left() + nHalfWidth - nHalfHeight,
- aGlobalChildRect.Top() + nHalfHeight - nHalfWidth );
- Size aNewSize( aGlobalChildRect.GetHeight(), aGlobalChildRect.GetWidth() );
+ sal_Int32 nHalfWidth = ( aClientRect.GetWidth() + 1 ) >> 1;
+ sal_Int32 nHalfHeight = ( aClientRect.GetHeight() + 1 ) >> 1;
+ Point aTopLeft( aClientRect.Left() + nHalfWidth - nHalfHeight,
+ aClientRect.Top() + nHalfHeight - nHalfWidth );
+ Size aNewSize( aClientRect.GetHeight(), aClientRect.GetWidth() );
Rectangle aNewRect( aTopLeft, aNewSize );
- aGlobalChildRect = aNewRect;
+ aClientRect = aNewRect;
}
// now importing the inner objects of the group
diff --git a/svx/source/msfilter/msocximex.cxx b/svx/source/msfilter/msocximex.cxx
index 7308bbf221eb..7db08e229536 100644
--- a/svx/source/msfilter/msocximex.cxx
+++ b/svx/source/msfilter/msocximex.cxx
@@ -623,7 +623,11 @@ class ContainerRecReader
pS->SeekRel( 4 );
// option flags
if( nContentFlags & 0x00000010 )
- pS->SeekRel( 4 );
+ {
+ sal_uInt32 nBitFlags = 0;
+ *pS >> nBitFlags;
+ rec.bVisible = ( ( nBitFlags & 0x02 ) == 0x02 );
+ }
// substream size
if( nContentFlags & 0x00000020 )
*pS >> rec.nSubStreamLen;
@@ -1212,6 +1216,13 @@ sal_Bool OCX_Control::Import(uno::Reference<container::XNameContainer> &rDialog
xPropSet->setPropertyValue(WW8_ASCII2STR("Step"), aTmp);
}
+ try
+ {
+ xPropSet->setPropertyValue(WW8_ASCII2STR("EnableVisible"), uno::makeAny( mbVisible ) );
+ }
+ catch( uno::Exception& )
+ {
+ }
return sal_True;
}
@@ -3612,6 +3623,7 @@ void OCX_ContainerControl::ProcessControl(OCX_Control* pControl,SvStorageStream*
// reflect the ms tabbing from orig MS UserForm, see below
pControl->mnTabPos = rec.nTabPos;
pControl->SetInDialog(true);
+ pControl->mbVisible = rec.bVisible;
if ( mnStep )
{
// If the container has a step then it should be
diff --git a/svx/source/outliner/outliner.cxx b/svx/source/outliner/outliner.cxx
index b8bf859dbc17..3da9e8dbecac 100644
--- a/svx/source/outliner/outliner.cxx
+++ b/svx/source/outliner/outliner.cxx
@@ -1519,14 +1519,14 @@ void Outliner::ImplCheckParagraphs( USHORT nStart, USHORT nEnd )
// --> OD 2009-03-10 #i100014#
// assure that the following for-loop does not loop forever
- for ( ULONG n = nStart; n < nEnd; n++ )
+ for ( USHORT n = nStart; n < nEnd; n++ )
// <--
{
Paragraph* pPara = pParaList->GetParagraph( n );
if (pPara)
{
pPara->Invalidate();
- ImplCalcBulletText( static_cast< USHORT >(n), FALSE, FALSE );
+ ImplCalcBulletText( n, FALSE, FALSE );
}
}
}
diff --git a/svx/source/outliner/outlobj.cxx b/svx/source/outliner/outlobj.cxx
index b76f3a8c366e..0e319ad1be81 100644
--- a/svx/source/outliner/outlobj.cxx
+++ b/svx/source/outliner/outlobj.cxx
@@ -77,6 +77,12 @@ public:
&& maParagraphDataVector == rCandidate.maParagraphDataVector
&& mbIsEditDoc == rCandidate.mbIsEditDoc);
}
+
+ // #i102062#
+ bool isWrongListEqual(const ImplOutlinerParaObject& rCompare) const
+ {
+ return mpEditTextObject->isWrongListEqual(*rCompare.mpEditTextObject);
+ }
};
//////////////////////////////////////////////////////////////////////////////
@@ -147,6 +153,17 @@ bool OutlinerParaObject::operator==(const OutlinerParaObject& rCandidate) const
return (*rCandidate.mpImplOutlinerParaObject == *mpImplOutlinerParaObject);
}
+// #i102062#
+bool OutlinerParaObject::isWrongListEqual(const OutlinerParaObject& rCompare) const
+{
+ if(rCompare.mpImplOutlinerParaObject == mpImplOutlinerParaObject)
+ {
+ return true;
+ }
+
+ return mpImplOutlinerParaObject->isWrongListEqual(*rCompare.mpImplOutlinerParaObject);
+}
+
sal_uInt16 OutlinerParaObject::GetOutlinerMode() const
{
return mpImplOutlinerParaObject->mpEditTextObject->GetUserType();
diff --git a/svx/source/outliner/outlvw.cxx b/svx/source/outliner/outlvw.cxx
index 102a0318bcb5..098a4055ce0f 100644
--- a/svx/source/outliner/outlvw.cxx
+++ b/svx/source/outliner/outlvw.cxx
@@ -1635,3 +1635,15 @@ USHORT OutlinerView::GetSelectedScriptType() const
DBG_CHKTHIS(OutlinerView,0);
return pEditView->GetSelectedScriptType();
}
+
+String OutlinerView::GetSurroundingText() const
+{
+ DBG_CHKTHIS(OutlinerView,0);
+ return pEditView->GetSurroundingText();
+}
+
+Selection OutlinerView::GetSurroundingTextSelection() const
+{
+ DBG_CHKTHIS(OutlinerView,0);
+ return pEditView->GetSurroundingTextSelection();
+}
diff --git a/svx/source/sdr/attribute/makefile.mk b/svx/source/sdr/attribute/makefile.mk
index adbd85f88d94..44e161a3b503 100644
--- a/svx/source/sdr/attribute/makefile.mk
+++ b/svx/source/sdr/attribute/makefile.mk
@@ -33,6 +33,7 @@ PRJ=..$/..$/..
PRJNAME=svx
TARGET=attribute
+ENABLE_EXCEPTIONS=TRUE
# --- Settings -----------------------------------------------------
@@ -43,6 +44,8 @@ TARGET=attribute
SLOFILES=\
$(SLO)$/sdrallattribute.obj \
- $(SLO)$/sdrtextattribute.obj
+ $(SLO)$/sdrtextattribute.obj \
+ $(SLO)$/sdrformtextattribute.obj \
+ $(SLO)$/sdrformtextoutlineattribute.obj
.INCLUDE : target.mk
diff --git a/svx/source/sdr/attribute/sdrallattribute.cxx b/svx/source/sdr/attribute/sdrallattribute.cxx
index 6e9d312b8357..9eee8dbccce8 100644
--- a/svx/source/sdr/attribute/sdrallattribute.cxx
+++ b/svx/source/sdr/attribute/sdrallattribute.cxx
@@ -30,6 +30,7 @@
************************************************************************/
#include "precompiled_svx.hxx"
+
#include <svx/sdr/attribute/sdrallattribute.hxx>
#include <drawinglayer/attribute/sdrattribute.hxx>
#include <drawinglayer/attribute/fillattribute.hxx>
@@ -45,20 +46,20 @@ namespace drawinglayer
{
namespace attribute
{
- SdrShadowTextAttribute::SdrShadowTextAttribute(SdrShadowAttribute* pShadow, SdrTextAttribute* pTextAttribute)
+ SdrShadowTextAttribute::SdrShadowTextAttribute(
+ SdrShadowAttribute* pShadow,
+ SdrTextAttribute* pTextAttribute)
: mpShadow(pShadow),
mpTextAttribute(pTextAttribute)
{
}
- SdrShadowTextAttribute::SdrShadowTextAttribute(const SdrShadowTextAttribute& rCandidate)
- : mpShadow(0L),
- mpTextAttribute(0L)
+ SdrShadowTextAttribute::SdrShadowTextAttribute(
+ const SdrShadowTextAttribute& rCandidate)
+ : mpShadow(0),
+ mpTextAttribute(0)
{
- if(!(*this == rCandidate))
- {
- *this = rCandidate;
- }
+ *this = rCandidate;
}
SdrShadowTextAttribute::~SdrShadowTextAttribute()
@@ -72,14 +73,14 @@ namespace drawinglayer
// handle mpShadow
{
// delete local mpShadow if necessary
- if(mpShadow && ((!rCandidate.mpShadow) || (!(*mpShadow == *rCandidate.mpShadow))))
+ if(mpShadow)
{
delete mpShadow;
- mpShadow = 0L;
+ mpShadow = 0;
}
// copy mpShadow if necessary
- if(!mpShadow && rCandidate.mpShadow)
+ if(rCandidate.mpShadow)
{
mpShadow = new SdrShadowAttribute(*rCandidate.mpShadow);
}
@@ -88,14 +89,14 @@ namespace drawinglayer
// handle mpTextAttribute
{
// delete local mpTextAttribute if necessary
- if(mpTextAttribute && ((!rCandidate.mpTextAttribute) || (!(*mpTextAttribute == *rCandidate.mpTextAttribute))))
+ if(mpTextAttribute)
{
delete mpTextAttribute;
- mpTextAttribute = 0L;
+ mpTextAttribute = 0;
}
// copy mpTextAttribute if necessary
- if(!mpTextAttribute && rCandidate.mpTextAttribute)
+ if(rCandidate.mpTextAttribute)
{
mpTextAttribute = new SdrTextAttribute(*rCandidate.mpTextAttribute);
}
@@ -125,22 +126,23 @@ namespace drawinglayer
{
namespace attribute
{
- SdrFillTextAttribute::SdrFillTextAttribute(SdrFillAttribute* pFill, FillGradientAttribute* pFillFloatTransGradient, SdrTextAttribute* pTextAttribute)
+ SdrFillTextAttribute::SdrFillTextAttribute(
+ SdrFillAttribute* pFill,
+ FillGradientAttribute* pFillFloatTransGradient,
+ SdrTextAttribute* pTextAttribute)
: mpFill(pFill),
mpFillFloatTransGradient(pFillFloatTransGradient),
mpTextAttribute(pTextAttribute)
{
}
- SdrFillTextAttribute::SdrFillTextAttribute(const SdrFillTextAttribute& rCandidate)
+ SdrFillTextAttribute::SdrFillTextAttribute(
+ const SdrFillTextAttribute& rCandidate)
: mpFill(0),
mpFillFloatTransGradient(0),
mpTextAttribute(0)
{
- if(!(*this == rCandidate))
- {
- *this = rCandidate;
- }
+ *this = rCandidate;
}
SdrFillTextAttribute::~SdrFillTextAttribute()
@@ -155,14 +157,14 @@ namespace drawinglayer
// handle mpFill
{
// delete local mpFill if necessary
- if(mpFill && ((!rCandidate.mpFill) || (!(*mpFill == *rCandidate.mpFill))))
+ if(mpFill)
{
delete mpFill;
- mpFill = 0L;
+ mpFill = 0;
}
// copy mpFill if necessary
- if(!mpFill && rCandidate.mpFill)
+ if(rCandidate.mpFill)
{
mpFill = new attribute::SdrFillAttribute(*rCandidate.mpFill);
}
@@ -171,14 +173,14 @@ namespace drawinglayer
// handle mpFillFloatTransGradient
{
// delete local mpFillFloatTransGradient if necessary
- if(mpFillFloatTransGradient && ((!rCandidate.mpFillFloatTransGradient) || (!(*mpFillFloatTransGradient == *rCandidate.mpFillFloatTransGradient))))
+ if(mpFillFloatTransGradient)
{
delete mpFillFloatTransGradient;
- mpFillFloatTransGradient = 0L;
+ mpFillFloatTransGradient = 0;
}
// copy mpFillFloatTransGradient if necessary
- if(!mpFillFloatTransGradient && rCandidate.mpFillFloatTransGradient)
+ if(rCandidate.mpFillFloatTransGradient)
{
mpFillFloatTransGradient = new FillGradientAttribute(*rCandidate.mpFillFloatTransGradient);
}
@@ -187,14 +189,14 @@ namespace drawinglayer
// handle mpTextAttribute
{
// delete local mpTextAttribute if necessary
- if(mpTextAttribute && ((!rCandidate.mpTextAttribute) || (!(*mpTextAttribute == *rCandidate.mpTextAttribute))))
+ if(mpTextAttribute)
{
delete mpTextAttribute;
- mpTextAttribute = 0L;
+ mpTextAttribute = 0;
}
// copy mpTextAttribute if necessary
- if(!mpTextAttribute && rCandidate.mpTextAttribute)
+ if(rCandidate.mpTextAttribute)
{
mpTextAttribute = new SdrTextAttribute(*rCandidate.mpTextAttribute);
}
@@ -229,23 +231,23 @@ namespace drawinglayer
namespace attribute
{
SdrLineShadowTextAttribute::SdrLineShadowTextAttribute(
- SdrLineAttribute* pLine, SdrLineStartEndAttribute* pLineStartEnd,
- SdrShadowAttribute* pShadow, SdrTextAttribute* pTextAttribute)
+ SdrLineAttribute* pLine,
+ SdrLineStartEndAttribute* pLineStartEnd,
+ SdrShadowAttribute* pShadow,
+ SdrTextAttribute* pTextAttribute)
: SdrShadowTextAttribute(pShadow, pTextAttribute),
mpLine(pLine),
mpLineStartEnd(pLineStartEnd)
{
}
- SdrLineShadowTextAttribute::SdrLineShadowTextAttribute(const SdrLineShadowTextAttribute& rCandidate)
- : SdrShadowTextAttribute(0L, 0L),
- mpLine(0L),
- mpLineStartEnd(0L)
+ SdrLineShadowTextAttribute::SdrLineShadowTextAttribute(
+ const SdrLineShadowTextAttribute& rCandidate)
+ : SdrShadowTextAttribute(0, 0),
+ mpLine(0),
+ mpLineStartEnd(0)
{
- if(!(*this == rCandidate))
- {
- *this = rCandidate;
- }
+ *this = rCandidate;
}
SdrLineShadowTextAttribute::~SdrLineShadowTextAttribute()
@@ -262,14 +264,14 @@ namespace drawinglayer
// handle mpLine
{
// delete local mpLine if necessary
- if(mpLine && ((!rCandidate.mpLine) || (!(*mpLine == *rCandidate.mpLine))))
+ if(mpLine)
{
delete mpLine;
- mpLine = 0L;
+ mpLine = 0;
}
// copy mpLine if necessary
- if(!mpLine && rCandidate.mpLine)
+ if(rCandidate.mpLine)
{
mpLine = new SdrLineAttribute(*rCandidate.mpLine);
}
@@ -278,14 +280,14 @@ namespace drawinglayer
// handle mpLineStartEnd
{
// delete local mpLineStartEnd if necessary
- if(mpLineStartEnd && ((!rCandidate.mpLineStartEnd) || (!(*mpLineStartEnd == *rCandidate.mpLineStartEnd))))
+ if(mpLineStartEnd)
{
delete mpLineStartEnd;
- mpLineStartEnd = 0L;
+ mpLineStartEnd = 0;
}
// copy mpLineStartEnd if necessary
- if(!mpLineStartEnd && rCandidate.mpLineStartEnd)
+ if(rCandidate.mpLineStartEnd)
{
mpLineStartEnd = new SdrLineStartEndAttribute(*rCandidate.mpLineStartEnd);
}
@@ -320,23 +322,25 @@ namespace drawinglayer
namespace attribute
{
SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute(
- SdrLineAttribute* pLine, attribute::SdrFillAttribute* pFill, SdrLineStartEndAttribute* pLineStartEnd,
- SdrShadowAttribute* pShadow, FillGradientAttribute* pFillFloatTransGradient, SdrTextAttribute* pTextAttribute)
+ SdrLineAttribute* pLine,
+ attribute::SdrFillAttribute* pFill,
+ SdrLineStartEndAttribute* pLineStartEnd,
+ SdrShadowAttribute* pShadow,
+ FillGradientAttribute* pFillFloatTransGradient,
+ SdrTextAttribute* pTextAttribute)
: SdrLineShadowTextAttribute(pLine, pLineStartEnd, pShadow, pTextAttribute),
mpFill(pFill),
mpFillFloatTransGradient(pFillFloatTransGradient)
{
}
- SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute(const SdrLineFillShadowTextAttribute& rCandidate)
- : SdrLineShadowTextAttribute(0L, 0L, 0L, 0L),
- mpFill(0L),
- mpFillFloatTransGradient(0L)
+ SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute(
+ const SdrLineFillShadowTextAttribute& rCandidate)
+ : SdrLineShadowTextAttribute(0, 0, 0, 0),
+ mpFill(0),
+ mpFillFloatTransGradient(0)
{
- if(!(*this == rCandidate))
- {
- *this = rCandidate;
- }
+ *this = rCandidate;
}
SdrLineFillShadowTextAttribute::~SdrLineFillShadowTextAttribute()
@@ -353,14 +357,14 @@ namespace drawinglayer
// handle mpFill
{
// delete local mpFill if necessary
- if(mpFill && ((!rCandidate.mpFill) || (!(*mpFill == *rCandidate.mpFill))))
+ if(mpFill)
{
delete mpFill;
- mpFill = 0L;
+ mpFill = 0;
}
// copy mpFill if necessary
- if(!mpFill && rCandidate.mpFill)
+ if(rCandidate.mpFill)
{
mpFill = new attribute::SdrFillAttribute(*rCandidate.mpFill);
}
@@ -369,14 +373,14 @@ namespace drawinglayer
// handle mpFillFloatTransGradient
{
// delete local mpFillFloatTransGradient if necessary
- if(mpFillFloatTransGradient && ((!rCandidate.mpFillFloatTransGradient) || (!(*mpFillFloatTransGradient == *rCandidate.mpFillFloatTransGradient))))
+ if(mpFillFloatTransGradient)
{
delete mpFillFloatTransGradient;
- mpFillFloatTransGradient = 0L;
+ mpFillFloatTransGradient = 0;
}
// copy mpFillFloatTransGradient if necessary
- if(!mpFillFloatTransGradient && rCandidate.mpFillFloatTransGradient)
+ if(rCandidate.mpFillFloatTransGradient)
{
mpFillFloatTransGradient = new FillGradientAttribute(*rCandidate.mpFillFloatTransGradient);
}
diff --git a/svx/source/sdr/attribute/sdrformtextattribute.cxx b/svx/source/sdr/attribute/sdrformtextattribute.cxx
new file mode 100644
index 000000000000..0282b519499c
--- /dev/null
+++ b/svx/source/sdr/attribute/sdrformtextattribute.cxx
@@ -0,0 +1,304 @@
+/*************************************************************************
+ *
+ * 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: sdrtextattribute.cxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * 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_svx.hxx"
+
+#include <svx/sdr/attribute/sdrformtextattribute.hxx>
+#include <svtools/itemset.hxx>
+
+#include <svx/xftdiit.hxx>
+#include <svx/xftstit.hxx>
+#include <svx/xftshxy.hxx>
+#include <svx/xftshtit.hxx>
+#include <svx/xtextit0.hxx>
+#include <svx/xftadit.hxx>
+#include <svx/xftshit.hxx>
+#include <svx/xftshcit.hxx>
+#include <svx/xftmrit.hxx>
+#include <svx/xftouit.hxx>
+
+#include <svx/sdshtitm.hxx>
+#include <svx/xlntrit.hxx>
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <drawinglayer/attribute/strokeattribute.hxx>
+#include <svx/sdshcitm.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xlnwtit.hxx>
+#include <xlinjoit.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/xdash.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/sdr/attribute/sdrformtextoutlineattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// pointer compare define
+#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q))
+
+//////////////////////////////////////////////////////////////////////////////
+// helper to get line, stroke and transparence attributes from SfxItemSet
+
+namespace
+{
+ basegfx::B2DLineJoin impGetB2DLineJoin(XLineJoint eLineJoint)
+ {
+ switch(eLineJoint)
+ {
+ case XLINEJOINT_MIDDLE :
+ {
+ return basegfx::B2DLINEJOIN_MIDDLE;
+ }
+ case XLINEJOINT_BEVEL :
+ {
+ return basegfx::B2DLINEJOIN_BEVEL;
+ }
+ case XLINEJOINT_MITER :
+ {
+ return basegfx::B2DLINEJOIN_MITER;
+ }
+ case XLINEJOINT_ROUND :
+ {
+ return basegfx::B2DLINEJOIN_ROUND;
+ }
+ default :
+ {
+ return basegfx::B2DLINEJOIN_NONE; // XLINEJOINT_NONE
+ }
+ }
+ }
+
+ sal_uInt8 impGetStrokeTransparence(bool bShadow, const SfxItemSet& rSet)
+ {
+ sal_uInt8 nRetval;
+
+ if(bShadow)
+ {
+ nRetval = (sal_uInt8)((((SdrShadowTransparenceItem&)(rSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue() * 255) / 100);
+ }
+ else
+ {
+ nRetval = (sal_uInt8)((((XLineTransparenceItem&)(rSet.Get(XATTR_LINETRANSPARENCE))).GetValue() * 255) / 100);
+ }
+
+ return nRetval;
+ }
+
+ drawinglayer::attribute::LineAttribute impGetLineAttribute(bool bShadow, const SfxItemSet& rSet)
+ {
+ basegfx::BColor aColorAttribute;
+
+ if(bShadow)
+ {
+ const Color aShadowColor(((SdrShadowColorItem&)(rSet.Get(SDRATTR_SHADOWCOLOR))).GetColorValue());
+ aColorAttribute = aShadowColor.getBColor();
+ }
+ else
+ {
+ const Color aLineColor(((XLineColorItem&)(rSet.Get(XATTR_LINECOLOR))).GetColorValue());
+ aColorAttribute = aLineColor.getBColor();
+ }
+
+ const sal_uInt32 nLineWidth = ((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue();
+ const XLineJoint eLineJoint = ((const XLineJointItem&)(rSet.Get(XATTR_LINEJOINT))).GetValue();
+
+ return drawinglayer::attribute::LineAttribute(aColorAttribute, (double)nLineWidth, impGetB2DLineJoin(eLineJoint));
+ }
+
+ drawinglayer::attribute::StrokeAttribute impGetStrokeAttribute(const SfxItemSet& rSet)
+ {
+ const XLineStyle eLineStyle = ((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue();
+ double fFullDotDashLen(0.0);
+ ::std::vector< double > aDotDashArray;
+
+ if(XLINE_DASH == eLineStyle)
+ {
+ const XDash& rDash = ((const XLineDashItem&)(rSet.Get(XATTR_LINEDASH))).GetDashValue();
+
+ if(rDash.GetDots() || rDash.GetDashes())
+ {
+ const sal_uInt32 nLineWidth = ((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue();
+ fFullDotDashLen = rDash.CreateDotDashArray(aDotDashArray, (double)nLineWidth);
+ }
+ }
+
+ return drawinglayer::attribute::StrokeAttribute(aDotDashArray, fFullDotDashLen);
+ }
+} // end of anonymous namespace
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ SdrFormTextAttribute::SdrFormTextAttribute(const SfxItemSet& rSet)
+ : mnFormTextDistance(((const XFormTextDistanceItem&)rSet.Get(XATTR_FORMTXTDISTANCE)).GetValue()),
+ mnFormTextStart(((const XFormTextStartItem&)rSet.Get(XATTR_FORMTXTSTART)).GetValue()),
+ mnFormTextShdwXVal(((const XFormTextShadowXValItem&)rSet.Get(XATTR_FORMTXTSHDWXVAL)).GetValue()),
+ mnFormTextShdwYVal(((const XFormTextShadowYValItem&)rSet.Get(XATTR_FORMTXTSHDWYVAL)).GetValue()),
+ mnFormTextShdwTransp(((const XFormTextShadowTranspItem&)rSet.Get(XATTR_FORMTXTSHDWTRANSP)).GetValue()),
+ meFormTextStyle(((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue()),
+ meFormTextAdjust(((const XFormTextAdjustItem&)rSet.Get(XATTR_FORMTXTADJUST)).GetValue()),
+ meFormTextShadow(((const XFormTextShadowItem&)rSet.Get(XATTR_FORMTXTSHADOW)).GetValue()),
+ maFormTextShdwColor(((const XFormTextShadowColorItem&)rSet.Get(XATTR_FORMTXTSHDWCOLOR)).GetColorValue()),
+ mpOutline(0),
+ mpShadowOutline(0),
+ mbFormTextMirror(((const XFormTextMirrorItem&)rSet.Get(XATTR_FORMTXTMIRROR)).GetValue()),
+ mbFormTextOutline(((const XFormTextOutlineItem&)rSet.Get(XATTR_FORMTXTOUTLINE)).GetValue())
+ {
+ if(getFormTextOutline())
+ {
+ const StrokeAttribute aStrokeAttribute(impGetStrokeAttribute(rSet));
+
+ // also need to prepare attributes for outlines
+ {
+ const LineAttribute aLineAttribute(impGetLineAttribute(false, rSet));
+ const sal_uInt8 nTransparence(impGetStrokeTransparence(false, rSet));
+
+ mpOutline = new SdrFormTextOutlineAttribute(
+ aLineAttribute, aStrokeAttribute, nTransparence);
+ }
+
+ if(XFTSHADOW_NONE != getFormTextShadow())
+ {
+ // also need to prepare attributes for shadow outlines
+ const LineAttribute aLineAttribute(impGetLineAttribute(true, rSet));
+ const sal_uInt8 nTransparence(impGetStrokeTransparence(true, rSet));
+
+ mpShadowOutline = new SdrFormTextOutlineAttribute(
+ aLineAttribute, aStrokeAttribute, nTransparence);
+ }
+ }
+ }
+
+ SdrFormTextAttribute::~SdrFormTextAttribute()
+ {
+ if(mpOutline)
+ {
+ delete mpOutline;
+ mpOutline = 0;
+ }
+
+ if(mpShadowOutline)
+ {
+ delete mpShadowOutline;
+ mpShadowOutline = 0;
+ }
+ }
+
+ SdrFormTextAttribute::SdrFormTextAttribute(const SdrFormTextAttribute& rCandidate)
+ : mnFormTextDistance(rCandidate.getFormTextDistance()),
+ mnFormTextStart(rCandidate.getFormTextStart()),
+ mnFormTextShdwXVal(rCandidate.getFormTextShdwXVal()),
+ mnFormTextShdwYVal(rCandidate.getFormTextShdwYVal()),
+ mnFormTextShdwTransp(rCandidate.getFormTextShdwTransp()),
+ meFormTextStyle(rCandidate.getFormTextStyle()),
+ meFormTextAdjust(rCandidate.getFormTextAdjust()),
+ meFormTextShadow(rCandidate.getFormTextShadow()),
+ maFormTextShdwColor(rCandidate.getFormTextShdwColor()),
+ mpOutline(0),
+ mpShadowOutline(0),
+ mbFormTextMirror(rCandidate.getFormTextMirror()),
+ mbFormTextOutline(rCandidate.getFormTextOutline())
+ {
+ if(rCandidate.getOutline())
+ {
+ mpOutline = new SdrFormTextOutlineAttribute(*rCandidate.getOutline());
+ }
+
+ if(rCandidate.getShadowOutline())
+ {
+ mpShadowOutline = new SdrFormTextOutlineAttribute(*rCandidate.getShadowOutline());
+ }
+ }
+
+ SdrFormTextAttribute& SdrFormTextAttribute::operator=(const SdrFormTextAttribute& rCandidate)
+ {
+ mnFormTextDistance = rCandidate.getFormTextDistance();
+ mnFormTextStart = rCandidate.getFormTextStart();
+ mnFormTextShdwXVal = rCandidate.getFormTextShdwXVal();
+ mnFormTextShdwYVal = rCandidate.getFormTextShdwYVal();
+ mnFormTextShdwTransp = rCandidate.getFormTextShdwTransp();
+ meFormTextStyle = rCandidate.getFormTextStyle();
+ meFormTextAdjust = rCandidate.getFormTextAdjust();
+ meFormTextShadow = rCandidate.getFormTextShadow();
+ maFormTextShdwColor = rCandidate.getFormTextShdwColor();
+
+ if(mpOutline)
+ {
+ delete mpOutline;
+ }
+
+ mpOutline = 0;
+
+ if(rCandidate.getOutline())
+ {
+ mpOutline = new SdrFormTextOutlineAttribute(*rCandidate.getOutline());
+ }
+
+ if(mpShadowOutline)
+ {
+ delete mpShadowOutline;
+ }
+
+ mpShadowOutline = 0;
+
+ if(rCandidate.getShadowOutline())
+ {
+ mpShadowOutline = new SdrFormTextOutlineAttribute(*rCandidate.getShadowOutline());
+ }
+
+ mbFormTextMirror = rCandidate.getFormTextMirror();
+ mbFormTextOutline = rCandidate.getFormTextOutline();
+
+ return *this;
+ }
+
+ bool SdrFormTextAttribute::operator==(const SdrFormTextAttribute& rCandidate) const
+ {
+ return (getFormTextDistance() == rCandidate.getFormTextDistance()
+ && getFormTextStart() == rCandidate.getFormTextStart()
+ && getFormTextShdwXVal() == rCandidate.getFormTextShdwXVal()
+ && getFormTextShdwYVal() == rCandidate.getFormTextShdwYVal()
+ && getFormTextShdwTransp() == rCandidate.getFormTextShdwTransp()
+ && getFormTextStyle() == rCandidate.getFormTextStyle()
+ && getFormTextAdjust() == rCandidate.getFormTextAdjust()
+ && getFormTextShadow() == rCandidate.getFormTextShadow()
+ && getFormTextShdwColor() == rCandidate.getFormTextShdwColor()
+ && pointerOrContentEqual(getOutline(), rCandidate.getOutline())
+ && pointerOrContentEqual(getShadowOutline(), rCandidate.getShadowOutline())
+ && getFormTextMirror() == rCandidate.getFormTextMirror()
+ && getFormTextOutline() == rCandidate.getFormTextOutline());
+ }
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/inc/svx/sdr/overlay/overlaysdrobject.hxx b/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx
index d5c8f7ba6ba6..db2fe20ae21b 100644
--- a/svx/inc/svx/sdr/overlay/overlaysdrobject.hxx
+++ b/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx
@@ -6,8 +6,9 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: overlaysdrobject.hxx,v $
- * $Revision: 1.4 $
+ * $RCSfile: sdrtextattribute.cxx,v $
+ *
+ * $Revision: 1.2 $
*
* This file is part of OpenOffice.org.
*
@@ -28,47 +29,38 @@
*
************************************************************************/
-#ifndef _SDR_OVERLAY_OVERLAYSDROBJECT_HXX
-#define _SDR_OVERLAY_OVERLAYSDROBJECT_HXX
+#include "precompiled_svx.hxx"
-#include <svx/sdr/overlay/overlayobject.hxx>
+#include <svx/sdr/attribute/sdrformtextoutlineattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
-// predeclarations
-class SdrObject;
+// pointer compare define
+#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q))
//////////////////////////////////////////////////////////////////////////////
-namespace sdr
+namespace drawinglayer
{
- namespace overlay
+ namespace attribute
{
- class SVX_DLLPUBLIC OverlaySdrObject : public OverlayObjectWithBasePosition
+ SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute(
+ const LineAttribute& rLineAttribute,
+ const StrokeAttribute& rStrokeAttribute,
+ sal_uInt8 nTransparence)
+ : maLineAttribute(rLineAttribute),
+ maStrokeAttribute(rStrokeAttribute),
+ mnTransparence(nTransparence)
{
- protected:
- // the SdrObject to show
- const SdrObject& mrSdrObject;
-
- // Draw geometry
- virtual void drawGeometry(OutputDevice& rOutputDevice);
-
- // Create the BaseRange. This method needs to calculate maBaseRange.
- virtual void createBaseRange(OutputDevice& rOutputDevice);
-
- // Hittest with logical coordinates. Default tests against maBaseRange.
- virtual sal_Bool isHit(const basegfx::B2DPoint& rPos, double fTol = 0.0) const;
+ }
- public:
- OverlaySdrObject(
- const basegfx::B2DPoint& rBasePos,
- const SdrObject& rObject);
- virtual ~OverlaySdrObject();
- };
- } // end of namespace overlay
-} // end of namespace sdr
+ bool SdrFormTextOutlineAttribute::operator==(const SdrFormTextOutlineAttribute& rCandidate) const
+ {
+ return (getLineAttribute() == rCandidate.getLineAttribute()
+ && getStrokeAttribute() == rCandidate.getStrokeAttribute()
+ && getTransparence() == rCandidate.getTransparence());
+ }
+ } // end of namespace attribute
+} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
-
-#endif //_SDR_OVERLAY_OVERLAYSDROBJECT_HXX
-
// eof
diff --git a/svx/source/sdr/attribute/sdrtextattribute.cxx b/svx/source/sdr/attribute/sdrtextattribute.cxx
index 394f68041d7a..33c958fa6268 100644
--- a/svx/source/sdr/attribute/sdrtextattribute.cxx
+++ b/svx/source/sdr/attribute/sdrtextattribute.cxx
@@ -30,11 +30,18 @@
************************************************************************/
#include "precompiled_svx.hxx"
+
#include <svx/sdr/attribute/sdrtextattribute.hxx>
+#include <svx/sdr/attribute/sdrformtextattribute.hxx>
#include <svx/svdotext.hxx>
#include <svx/outlobj.hxx>
#include <svx/editobj.hxx>
#include <svx/flditem.hxx>
+#include <svx/sdr/properties/properties.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// pointer compare define
+#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q))
//////////////////////////////////////////////////////////////////////////////
@@ -56,13 +63,14 @@ namespace drawinglayer
bool bBlink,
bool bScroll,
bool bInEditMode)
- : mrSdrText(rSdrText),
+ : mpSdrText(&rSdrText),
maOutlinerParaObject(rOutlinerParaObject),
- meFormTextStyle(eFormTextStyle),
+ mpSdrFormTextAttribute(0),
maTextLeftDistance(aTextLeftDistance),
maTextUpperDistance(aTextUpperDistance),
maTextRightDistance(aTextRightDistance),
maTextLowerDistance(aTextLowerDistance),
+ maPropertiesVersion(0),
mbContour(bContour),
mbFitToSize(bFitToSize),
mbHideContour(bHideContour),
@@ -70,16 +78,94 @@ namespace drawinglayer
mbScroll(bScroll),
mbInEditMode(bInEditMode)
{
+ if(XFT_NONE != eFormTextStyle)
+ {
+ // text on path. Create FormText attribute
+ const SfxItemSet& rSet = getSdrText().GetItemSet();
+ mpSdrFormTextAttribute = new SdrFormTextAttribute(rSet);
+ }
+
+ // #i101556# init with version number to detect changes of single text
+ // attribute and/or style sheets in primitive data without having to
+ // copy that data locally (which would be better from principle)
+ maPropertiesVersion = rSdrText.GetObject().GetProperties().getVersion();
+ }
+
+ SdrTextAttribute::~SdrTextAttribute()
+ {
+ if(mpSdrFormTextAttribute)
+ {
+ delete mpSdrFormTextAttribute;
+ mpSdrFormTextAttribute = 0;
+ }
+ }
+
+ SdrTextAttribute::SdrTextAttribute(const SdrTextAttribute& rCandidate)
+ : mpSdrText(&rCandidate.getSdrText()),
+ maOutlinerParaObject(rCandidate.getOutlinerParaObject()),
+ mpSdrFormTextAttribute(0),
+ maTextLeftDistance(rCandidate.getTextLeftDistance()),
+ maTextUpperDistance(rCandidate.getTextUpperDistance()),
+ maTextRightDistance(rCandidate.getTextRightDistance()),
+ maTextLowerDistance(rCandidate.getTextLowerDistance()),
+ mbContour(rCandidate.isContour()),
+ mbFitToSize(rCandidate.isFitToSize()),
+ mbHideContour(rCandidate.isHideContour()),
+ mbBlink(rCandidate.isBlink()),
+ mbScroll(rCandidate.isScroll()),
+ mbInEditMode(rCandidate.isInEditMode())
+ {
+ if(rCandidate.getSdrFormTextAttribute())
+ {
+ mpSdrFormTextAttribute = new SdrFormTextAttribute(*rCandidate.getSdrFormTextAttribute());
+ }
+ }
+
+ SdrTextAttribute& SdrTextAttribute::operator=(const SdrTextAttribute& rCandidate)
+ {
+ mpSdrText = &rCandidate.getSdrText();
+ maOutlinerParaObject = rCandidate.getOutlinerParaObject();
+
+ if(mpSdrFormTextAttribute)
+ {
+ delete mpSdrFormTextAttribute;
+ }
+
+ mpSdrFormTextAttribute = 0;
+
+ if(rCandidate.getSdrFormTextAttribute())
+ {
+ mpSdrFormTextAttribute = new SdrFormTextAttribute(*rCandidate.getSdrFormTextAttribute());
+ }
+
+ maTextLeftDistance = rCandidate.getTextLeftDistance();
+ maTextUpperDistance = rCandidate.getTextUpperDistance();
+ maTextRightDistance = rCandidate.getTextRightDistance();
+ maTextLowerDistance = rCandidate.getTextLowerDistance();
+ mbContour = rCandidate.isContour();
+ mbFitToSize = rCandidate.isFitToSize();
+ mbHideContour = rCandidate.isHideContour();
+ mbBlink = rCandidate.isBlink();
+ mbScroll = rCandidate.isScroll();
+ mbInEditMode = rCandidate.isInEditMode();
+
+ return *this;
}
bool SdrTextAttribute::operator==(const SdrTextAttribute& rCandidate) const
{
return (getOutlinerParaObject() == rCandidate.getOutlinerParaObject()
- && getFormTextStyle() == rCandidate.getFormTextStyle()
+ // #i102062# for primitive visualisation, the WrongList (SpellChecking)
+ // is important, too, so use isWrongListEqual since there is no WrongList
+ // comparison in the regular OutlinerParaObject compare (since it's
+ // not-persistent data)
+ && getOutlinerParaObject().isWrongListEqual(rCandidate.getOutlinerParaObject())
+ && pointerOrContentEqual(getSdrFormTextAttribute(), rCandidate.getSdrFormTextAttribute())
&& getTextLeftDistance() == rCandidate.getTextLeftDistance()
&& getTextUpperDistance() == rCandidate.getTextUpperDistance()
&& getTextRightDistance() == rCandidate.getTextRightDistance()
&& getTextLowerDistance() == rCandidate.getTextLowerDistance()
+ && getPropertiesVersion() == rCandidate.getPropertiesVersion()
&& isContour() == rCandidate.isContour()
&& isFitToSize() == rCandidate.isFitToSize()
&& isHideContour() == rCandidate.isHideContour()
@@ -92,7 +178,7 @@ namespace drawinglayer
{
if(isBlink())
{
- mrSdrText.GetObject().impGetBlinkTextTiming(rAnimList);
+ mpSdrText->GetObject().impGetBlinkTextTiming(rAnimList);
}
}
@@ -100,7 +186,7 @@ namespace drawinglayer
{
if(isScroll())
{
- mrSdrText.GetObject().impGetScrollTextTiming(rAnimList, fFrameLength, fTextLength);
+ mpSdrText->GetObject().impGetScrollTextTiming(rAnimList, fFrameLength, fTextLength);
}
}
} // end of namespace attribute
diff --git a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
index 851ee1f3da58..9ae265d29362 100644
--- a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
@@ -75,8 +75,8 @@ namespace sdr
basegfx::B3DPolyPolygon aPolyPolygon3D(GetE3dPolygonObj().GetPolyPolygon3D());
const basegfx::B3DPolyPolygon aPolyNormals3D(GetE3dPolygonObj().GetPolyNormals3D());
const basegfx::B2DPolyPolygon aPolyTexture2D(GetE3dPolygonObj().GetPolyTexture2D());
- const bool bNormals(aPolyNormals3D.count());
- const bool bTexture(aPolyTexture2D.count());
+ const bool bNormals(aPolyNormals3D.count() && aPolyNormals3D.count() == aPolyPolygon3D.count());
+ const bool bTexture(aPolyTexture2D.count() && aPolyTexture2D.count() == aPolyPolygon3D.count());
if(bNormals || bTexture)
{
@@ -100,12 +100,19 @@ namespace sdr
{
if(bNormals)
{
- aCandidate3D.setNormal(b, aNormals3D.getB3DPoint(b));
+ sal_uInt32 nNormalCount = aNormals3D.count();
+ if( b < nNormalCount )
+ aCandidate3D.setNormal(b, aNormals3D.getB3DPoint(b));
+ else if( nNormalCount > 0 )
+ aCandidate3D.setNormal(b, aNormals3D.getB3DPoint(0));
}
-
if(bTexture)
{
- aCandidate3D.setTextureCoordinate(b, aTexture2D.getB2DPoint(b));
+ sal_uInt32 nTextureCount = aTexture2D.count();
+ if( b < nTextureCount )
+ aCandidate3D.setTextureCoordinate(b, aTexture2D.getB2DPoint(b));
+ else if( nTextureCount > 0 )
+ aCandidate3D.setTextureCoordinate(b, aTexture2D.getB2DPoint(0));
}
}
diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx
index aae01c5d24ff..b083a1014299 100644
--- a/svx/source/sdr/contact/viewcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx
@@ -53,6 +53,18 @@
#include <svdglob.hxx>
#include <vcl/svapp.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textlayoutdevice.hxx>
+#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
+
+#include <svx/sdr/primitive2d/sdrtextprimitive2d.hxx>
+#include <svx/eeitem.hxx>
+#include <svx/colritem.hxx>
+//#include <svx/xtable.hxx>
+
//////////////////////////////////////////////////////////////////////////////
namespace sdr
@@ -78,6 +90,238 @@ namespace sdr
{
}
+ void ViewContactOfGraphic::flushGraphicObjects()
+ {
+ // #i102380# The graphic is swapped out. To let that have an effect ist is necessary to
+ // delete copies of the GraphicObject which are not swapped out and have no SwapHandler set
+ // (this is what happnes when the GraphicObject gets copied to a SdrGrafPrimitive2D). This
+ // is best achieved for the VC by clearing the local decomposition cache. It would be possible
+ // to also do this for the VOC cache, but that VOCs exist exactly expresss that the object
+ // gets visualised, so this would be wrong.
+ flushViewIndependentPrimitive2DSequence();
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGraphic::createVIP2DSForPresObj(
+ const basegfx::B2DHomMatrix& rObjectMatrix,
+ const drawinglayer::attribute::SdrLineFillShadowTextAttribute& rAttribute,
+ const GraphicAttr& rLocalGrafInfo) const
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+ GraphicObject aEmptyGraphicObject;
+ GraphicAttr aEmptyGraphicAttr;
+
+ // SdrGrafPrimitive2D without content in original size which carries all eventual attributes and texts
+ const drawinglayer::primitive2d::Primitive2DReference xReferenceA(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
+ rObjectMatrix,
+ rAttribute,
+ aEmptyGraphicObject,
+ aEmptyGraphicAttr));
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReferenceA, 1);
+
+ // SdrGrafPrimitive2D with content (which is the preview graphic) scaled to smaller size and
+ // without attributes
+ basegfx::B2DHomMatrix aSmallerMatrix;
+
+ // #i94431# for some reason, i forgot to take the PrefMapMode of the graphic
+ // into account. Since EmptyPresObj's are only used in Draw/Impress, it is
+ // safe to assume 100th mm as target.
+ Size aPrefSize(GetGrafObject().GetGrafPrefSize());
+
+ if(MAP_PIXEL == GetGrafObject().GetGrafPrefMapMode().GetMapUnit())
+ {
+ aPrefSize = Application::GetDefaultDevice()->PixelToLogic(aPrefSize, MAP_100TH_MM);
+ }
+ else
+ {
+ aPrefSize = Application::GetDefaultDevice()->LogicToLogic(aPrefSize, GetGrafObject().GetGrafPrefMapMode(), MAP_100TH_MM);
+ }
+
+ // decompose object matrix to get single values
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ rObjectMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
+
+ const double fOffsetX((aScale.getX() - aPrefSize.getWidth()) / 2.0);
+ const double fOffsetY((aScale.getY() - aPrefSize.getHeight()) / 2.0);
+
+ if(basegfx::fTools::moreOrEqual(fOffsetX, 0.0) && basegfx::fTools::moreOrEqual(fOffsetY, 0.0))
+ {
+ // create the EmptyPresObj fallback visualisation. The fallback graphic
+ // is already provided in rGraphicObject in this case, use it
+ aSmallerMatrix.scale(aPrefSize.getWidth(), aPrefSize.getHeight());
+ aSmallerMatrix.translate(fOffsetX, fOffsetY);
+ aSmallerMatrix.shearX(fShearX);
+ aSmallerMatrix.rotate(fRotate);
+ aSmallerMatrix.translate(aTranslate.getX(), aTranslate.getY());
+
+ const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false);
+ const drawinglayer::attribute::SdrLineFillShadowTextAttribute aEmptyAttributes(0, 0, 0, 0, 0, 0);
+ const drawinglayer::primitive2d::Primitive2DReference xReferenceB(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
+ aSmallerMatrix,
+ aEmptyAttributes,
+ rGraphicObject,
+ rLocalGrafInfo));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xReferenceB);
+ }
+
+ return xRetval;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGraphic::createVIP2DSForDraft(
+ const basegfx::B2DHomMatrix& rObjectMatrix,
+ const drawinglayer::attribute::SdrLineFillShadowTextAttribute& rAttribute) const
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+ GraphicObject aEmptyGraphicObject;
+ GraphicAttr aEmptyGraphicAttr;
+
+ // SdrGrafPrimitive2D without content in original size which carries all eventual attributes and texts
+ const drawinglayer::primitive2d::Primitive2DReference xReferenceA(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
+ rObjectMatrix,
+ rAttribute,
+ aEmptyGraphicObject,
+ aEmptyGraphicAttr));
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReferenceA, 1);
+
+ if(!rAttribute.getLine())
+ {
+ // create a surrounding frame when no linestyle given
+ const Color aColor(Application::GetSettings().GetStyleSettings().GetShadowColor());
+ const basegfx::BColor aBColor(aColor.getBColor());
+ const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0);
+
+ basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aUnitRange));
+ aOutline.transform(rObjectMatrix);
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval,
+ drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
+ aOutline,
+ aBColor)));
+ }
+
+ // decompose object matrix to get single values
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ rObjectMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // define a distance value, used for distance from bitmap to borders and from bitmap
+ // to text, too (2 mm)
+ const double fDistance(200.0);
+
+ // consume borders from values
+ aScale.setX(std::max(0.0, aScale.getX() - (2.0 * fDistance)));
+ aScale.setY(std::max(0.0, aScale.getY() - (2.0 * fDistance)));
+ aTranslate.setX(aTranslate.getX() + fDistance);
+ aTranslate.setY(aTranslate.getY() + fDistance);
+
+ // draw a draft bitmap
+ const Bitmap aDraftBitmap(ResId(BMAP_GrafikEi, *ImpGetResMgr()));
+
+ if(!aDraftBitmap.IsEmpty())
+ {
+ Size aPrefSize(aDraftBitmap.GetPrefSize());
+
+ if(MAP_PIXEL == aDraftBitmap.GetPrefMapMode().GetMapUnit())
+ {
+ aPrefSize = Application::GetDefaultDevice()->PixelToLogic(aDraftBitmap.GetSizePixel(), MAP_100TH_MM);
+ }
+ else
+ {
+ aPrefSize = Application::GetDefaultDevice()->LogicToLogic(aPrefSize, aDraftBitmap.GetPrefMapMode(), MAP_100TH_MM);
+ }
+
+ const double fBitmapScaling(2.0);
+ const double fWidth(aPrefSize.getWidth() * fBitmapScaling);
+ const double fHeight(aPrefSize.getHeight() * fBitmapScaling);
+
+ if(basegfx::fTools::more(fWidth, 1.0)
+ && basegfx::fTools::more(fHeight, 1.0)
+ && basegfx::fTools::lessOrEqual(fWidth, aScale.getX())
+ && basegfx::fTools::lessOrEqual(fHeight, aScale.getY()))
+ {
+ basegfx::B2DHomMatrix aBitmapMatrix;
+
+ aBitmapMatrix.scale(fWidth, fHeight);
+ aBitmapMatrix.shearX(fShearX);
+ aBitmapMatrix.rotate(fRotate);
+ aBitmapMatrix.translate(aTranslate.getX(), aTranslate.getY());
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval,
+ drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::BitmapPrimitive2D(
+ BitmapEx(aDraftBitmap),
+ aBitmapMatrix)));
+
+ // consume bitmap size in X
+ aScale.setX(std::max(0.0, aScale.getX() - (fWidth + fDistance)));
+ aTranslate.setX(aTranslate.getX() + fWidth + fDistance);
+ }
+ }
+
+ // Build the text for the draft object
+ XubString aDraftText = GetGrafObject().GetFileName();
+
+ if(!aDraftText.Len())
+ {
+ aDraftText = GetGrafObject().GetName();
+ aDraftText.AppendAscii(" ...");
+ }
+
+ if(aDraftText.Len() && GetGrafObject().GetModel())
+ {
+ // #i103255# Goal is to produce TextPrimitives which hold the given text as
+ // BlockText in the available space. It would be very tricky to do
+ // an own word wrap/line layout here.
+ // Using SdrBlockTextPrimitive2D OTOH is critical since it internally
+ // uses the SdrObject it references. To solve this, create a temp
+ // SdrObject with Attributes and Text, generate a SdrBlockTextPrimitive2D
+ // directly and immediately decompose it. After that, it is no longer
+ // needed and can be deleted.
+
+ // create temp RectObj as TextObj and set needed attributes
+ SdrRectObj aRectObj(OBJ_TEXT);
+ aRectObj.SetModel(GetGrafObject().GetModel());
+ aRectObj.NbcSetText(aDraftText);
+ aRectObj.SetMergedItem(SvxColorItem(Color(COL_LIGHTRED), EE_CHAR_COLOR));
+
+ // get SdrText and OPO
+ SdrText* pSdrText = aRectObj.getText(0);
+ OutlinerParaObject* pOPO = aRectObj.GetOutlinerParaObject();
+
+ if(pSdrText && pOPO)
+ {
+ // directly use the remaining space as TextRangeTransform
+ basegfx::B2DHomMatrix aTextRangeTransform;
+
+ aTextRangeTransform.scale(aScale.getX(), aScale.getY());
+ aTextRangeTransform.shearX(fShearX);
+ aTextRangeTransform.rotate(fRotate);
+ aTextRangeTransform.translate(aTranslate.getX(), aTranslate.getY());
+
+ // directly create temp SdrBlockTextPrimitive2D
+ drawinglayer::primitive2d::SdrBlockTextPrimitive2D aBlockTextPrimitive(
+ pSdrText,
+ *pOPO,
+ aTextRangeTransform,
+ false,
+ false,
+ false);
+
+ // decompose immediately with neutral ViewInformation. This will
+ // layout the text to more simple TextPrimitives from drawinglayer
+ const drawinglayer::geometry::ViewInformation2D aViewInformation2D(0);
+
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(
+ xRetval,
+ aBlockTextPrimitive.get2DDecomposition(aViewInformation2D));
+ }
+ }
+
+ return xRetval;
+ }
+
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGraphic::createViewIndependentPrimitive2DSequence() const
{
drawinglayer::primitive2d::Primitive2DSequence xRetval;
@@ -86,7 +330,8 @@ namespace sdr
if(pSdrText)
{
const SfxItemSet& rItemSet = GetGrafObject().GetMergedItemSet();
- drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText);
+ drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute =
+ drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText);
bool bVisible(pAttribute && pAttribute->isVisible());
// create and fill GraphicAttr
@@ -131,7 +376,7 @@ namespace sdr
// which will use the primitive data we just create in the near future
const Rectangle& rRectangle = GetGrafObject().GetGeoRect();
const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom());
- ::basegfx::B2DHomMatrix aObjectMatrix;
+ basegfx::B2DHomMatrix aObjectMatrix;
// look for mirroring
const GeoStat& rGeoStat(GetGrafObject().GetGeoStat());
@@ -170,60 +415,25 @@ namespace sdr
// get the current, unchenged graphic obect from SdrGrafObj
const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false);
- if(GetGrafObject().IsEmptyPresObj())
+ if(visualisationUsesPresObj())
{
// it's an EmptyPresObj, create the SdrGrafPrimitive2D without content and another scaled one
// with the content which is the placeholder graphic
- GraphicObject aEmptyGraphicObject;
- GraphicAttr aEmptyGraphicAttr;
- drawinglayer::attribute::SdrLineFillShadowTextAttribute aEmptyAttributes(0, 0, 0, 0, 0, 0);
-
- // SdrGrafPrimitive2D without content in original size which carries all eventual attributes and texts
- const drawinglayer::primitive2d::Primitive2DReference xReferenceA(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
- aObjectMatrix, *pAttribute, aEmptyGraphicObject, aEmptyGraphicAttr));
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReferenceA, 1);
-
- // SdrGrafPrimitive2D with content (which is the preview graphic) scaled to smaller size and
- // without attributes
- basegfx::B2DHomMatrix aSmallerMatrix;
-
- // #i94431# for some reason, i forgot to take the PrefMapMode of the graphic
- // into account. Since EmptyPresObj's are only used in Draw/Impress, it is
- // safe to assume 100th mm as target.
- Size aPrefSize(GetGrafObject().GetGrafPrefSize());
-
- if(MAP_PIXEL == GetGrafObject().GetGrafPrefMapMode().GetMapUnit())
- {
- aPrefSize = Application::GetDefaultDevice()->PixelToLogic(aPrefSize, MAP_100TH_MM);
- }
- else
- {
- aPrefSize = Application::GetDefaultDevice()->LogicToLogic(aPrefSize, GetGrafObject().GetGrafPrefMapMode(), MAP_100TH_MM);
- }
-
- const double fOffsetX((aObjectRange.getWidth() - aPrefSize.getWidth()) / 2.0);
- const double fOffsetY((aObjectRange.getHeight() - aPrefSize.getHeight()) / 2.0);
-
- if(basegfx::fTools::moreOrEqual(fOffsetX, 0.0) && basegfx::fTools::moreOrEqual(fOffsetY, 0.0))
- {
- aSmallerMatrix.scale(aPrefSize.getWidth(), aPrefSize.getHeight());
- aSmallerMatrix.translate(fOffsetX, fOffsetY);
- aSmallerMatrix.shearX(fShearX);
- aSmallerMatrix.rotate(fRotate);
- aSmallerMatrix.translate(aObjectRange.getMinX(), aObjectRange.getMinY());
-
- const drawinglayer::primitive2d::Primitive2DReference xReferenceB(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
- aSmallerMatrix,
- aEmptyAttributes,
- rGraphicObject,
- aLocalGrafInfo));
-
- drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xReferenceB);
- }
+ xRetval = createVIP2DSForPresObj(aObjectMatrix, *pAttribute, aLocalGrafInfo);
+ }
+ else if(visualisationUsesDraft())
+ {
+ // #i102380# The graphic is swapped out. To not force a swap-in here, there is a mechanism
+ // which shows a swapped-out-visualisation (which gets created here now) and an asynchronious
+ // visual update mechanism for swapped-out grapgics when they were loaded (see AsynchGraphicLoadingEvent
+ // and ViewObjectContactOfGraphic implementation). Not forcing the swap-in here allows faster
+ // (non-blocking) processing here and thus in the effect e.g. fast scrolling through pages
+ xRetval = createVIP2DSForDraft(aObjectMatrix, *pAttribute);
}
else
{
- // create primitive
+ // create primitive. Info: Calling the copy-constructor of GraphicObject in this
+ // SdrGrafPrimitive2D constructor will force a full swap-in of the graphic
const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
aObjectMatrix,
*pAttribute,
@@ -241,6 +451,31 @@ namespace sdr
return xRetval;
}
+ bool ViewContactOfGraphic::visualisationUsesPresObj() const
+ {
+ return GetGrafObject().IsEmptyPresObj();
+ }
+
+ bool ViewContactOfGraphic::visualisationUsesDraft() const
+ {
+ // no draft when already PresObj
+ if(visualisationUsesPresObj())
+ return false;
+
+ // draft when swapped out
+ const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false);
+ static bool bAllowReplacements(true);
+
+ if(rGraphicObject.IsSwappedOut() && bAllowReplacements)
+ return true;
+
+ // draft when no graphic
+ if(GRAPHIC_NONE == rGraphicObject.GetType() || GRAPHIC_DEFAULT == rGraphicObject.GetType())
+ return true;
+
+ return false;
+ }
+
} // end of namespace contact
} // end of namespace sdr
diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
index 317a49bb090d..0f4716e2d513 100644
--- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
@@ -37,6 +37,8 @@
#include <svx/sdr/attribute/sdrallattribute.hxx>
#include <svditer.hxx>
#include <svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -53,6 +55,60 @@ namespace sdr
{
}
+ basegfx::B2DRange ViewContactOfSdrObjCustomShape::getCorrectedTextBoundRect() const
+ {
+ const Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect());
+ Rectangle aTextBound(aObjectBound);
+ GetCustomShapeObj().GetTextBounds(aTextBound);
+ basegfx::B2DRange aTextRange(aTextBound.Left(), aTextBound.Top(), aTextBound.Right(), aTextBound.Bottom());
+ const basegfx::B2DRange aObjectRange(aObjectBound.Left(), aObjectBound.Top(), aObjectBound.Right(), aObjectBound.Bottom());
+
+ // no need to correct if no extra text range
+ if(aTextRange != aObjectRange)
+ {
+ const GeoStat& rGeoStat(GetCustomShapeObj().GetGeoStat());
+
+ // only correct when rotation and/or shear is used
+ if(rGeoStat.nShearWink || rGeoStat.nDrehWink)
+ {
+ // text range needs to be corrected by
+ // aObjectRange.getCenter() - aRotObjectRange.getCenter() since it's
+ // defined differenly by using rotation around object center. Start
+ // with positive part
+ basegfx::B2DVector aTranslation(aObjectRange.getCenter());
+
+ // get rotated and sheared object's range
+ basegfx::B2DRange aRotObjectRange(aObjectRange);
+ basegfx::B2DHomMatrix aRotMatrix;
+
+ aRotMatrix.translate(-aObjectRange.getMinimum().getX(), -aObjectRange.getMinimum().getY());
+
+ if(rGeoStat.nShearWink)
+ {
+ aRotMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000));
+ }
+
+ if(rGeoStat.nDrehWink)
+ {
+ aRotMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000);
+ }
+
+ aRotMatrix.translate(aObjectRange.getMinimum().getX(), aObjectRange.getMinimum().getY());
+ aRotObjectRange.transform(aRotMatrix);
+
+ // add negative translation part
+ aTranslation -= aRotObjectRange.getCenter();
+
+ // create new range
+ aTextRange = basegfx::B2DRange(
+ aTextRange.getMinX() + aTranslation.getX(), aTextRange.getMinY() + aTranslation.getY(),
+ aTextRange.getMaxX() + aTranslation.getX(), aTextRange.getMaxY() + aTranslation.getY());
+ }
+ }
+
+ return aTextRange;
+ }
+
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrObjCustomShape::createViewIndependentPrimitive2DSequence() const
{
drawinglayer::primitive2d::Primitive2DSequence xRetval;
@@ -88,38 +144,35 @@ namespace sdr
if(bHasText || xGroup.hasElements())
{
// prepare text box geometry
- ::basegfx::B2DHomMatrix aTextBoxMatrix;
+ basegfx::B2DHomMatrix aTextBoxMatrix;
bool bWordWrap(false);
if(bHasText)
{
// take unrotated snap rect as default, then get the
// unrotated text box. Rotation needs to be done centered
- Rectangle aTextBound(GetCustomShapeObj().GetGeoRect());
- GetCustomShapeObj().GetTextBounds(aTextBound);
- const ::basegfx::B2DRange aTextBoxRange(aTextBound.Left(), aTextBound.Top(), aTextBound.Right(), aTextBound.Bottom());
+ const Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect());
+ const basegfx::B2DRange aObjectRange(aObjectBound.Left(), aObjectBound.Top(), aObjectBound.Right(), aObjectBound.Bottom());
- // fill object matrix
- if(!::basegfx::fTools::equalZero(aTextBoxRange.getWidth()))
- {
- aTextBoxMatrix.set(0, 0, aTextBoxRange.getWidth());
- }
+ // #i101684# get the text range unrotated and absolute to the object range
+ const basegfx::B2DRange aTextRange(getCorrectedTextBoundRect());
- if(!::basegfx::fTools::equalZero(aTextBoxRange.getHeight()))
- {
- aTextBoxMatrix.set(1, 1, aTextBoxRange.getHeight());
- }
+ // give text object a size
+ aTextBoxMatrix.scale(aTextRange.getWidth(), aTextRange.getHeight());
+ // check if we have a rotation/shear at all to take care of
const double fExtraTextRotation(GetCustomShapeObj().GetExtraTextRotation());
const GeoStat& rGeoStat(GetCustomShapeObj().GetGeoStat());
- if(rGeoStat.nShearWink || rGeoStat.nDrehWink || !::basegfx::fTools::equalZero(fExtraTextRotation))
+ if(rGeoStat.nShearWink || rGeoStat.nDrehWink || !basegfx::fTools::equalZero(fExtraTextRotation))
{
- const double fHalfWidth(aTextBoxRange.getWidth() * 0.5);
- const double fHalfHeight(aTextBoxRange.getHeight() * 0.5);
-
- // move to it's own center to rotate around it
- aTextBoxMatrix.translate(-fHalfWidth, -fHalfHeight);
+ if(aObjectRange != aTextRange)
+ {
+ // move relative to unrotated object range
+ aTextBoxMatrix.translate(
+ aTextRange.getMinX() - aObjectRange.getMinimum().getX(),
+ aTextRange.getMinY() - aObjectRange.getMinimum().getY());
+ }
if(rGeoStat.nShearWink)
{
@@ -131,16 +184,18 @@ namespace sdr
aTextBoxMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000);
}
- if(!::basegfx::fTools::equalZero(fExtraTextRotation))
+ if(!basegfx::fTools::equalZero(fExtraTextRotation))
{
aTextBoxMatrix.rotate((360.0 - fExtraTextRotation) * F_PI180);
}
- // move back
- aTextBoxMatrix.translate(fHalfWidth, fHalfHeight);
+ // give text it's target position
+ aTextBoxMatrix.translate(aObjectRange.getMinimum().getX(), aObjectRange.getMinimum().getY());
+ }
+ else
+ {
+ aTextBoxMatrix.translate(aTextRange.getMinX(), aTextRange.getMinY());
}
-
- aTextBoxMatrix.translate(aTextBoxRange.getMinX(), aTextBoxRange.getMinY());
// check if SdrTextWordWrapItem is set
bWordWrap = ((SdrTextWordWrapItem&)(GetCustomShapeObj().GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue();
diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
index dc3fbcfaaa61..0f818ff40f7a 100644
--- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
@@ -62,59 +62,86 @@ namespace sdr
if(pSdrText)
{
- drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText);
+ drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute =
+ drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
+ rItemSet,
+ *pSdrText);
if(pAttribute)
{
if(pAttribute->isVisible())
{
- // prepare object transformation and unit polygon (direct model data)
- ::basegfx::B2DHomMatrix aObjectMatrix;
- ::basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly());
- const bool bIsLine(
- !aUnitPolyPolygon.areControlPointsUsed()
- && 1L == aUnitPolyPolygon.count()
- && 2L == aUnitPolyPolygon.getB2DPolygon(0L).count());
-
- if(bIsLine)
- {
- // special handling for single line mode (2 points)
- const ::basegfx::B2DPolygon aSubPolygon(aUnitPolyPolygon.getB2DPolygon(0L));
- const ::basegfx::B2DPoint aStart(aSubPolygon.getB2DPoint(0L));
- const ::basegfx::B2DPoint aEnd(aSubPolygon.getB2DPoint(1L));
- const ::basegfx::B2DVector aLine(aEnd - aStart);
-
- // create new polygon
- ::basegfx::B2DPolygon aNewPolygon;
- aNewPolygon.append(::basegfx::B2DPoint(0.0, 0.0));
- aNewPolygon.append(::basegfx::B2DPoint(aLine.getLength(), 0.0));
- aUnitPolyPolygon.setB2DPolygon(0L, aNewPolygon);
-
- // fill objectMatrix with rotation and offset (no shear for lines, scale in polygon)
- aObjectMatrix.rotate(atan2(aLine.getY(), aLine.getX()));
- aObjectMatrix.translate(aStart.getX(), aStart.getY());
- }
- else
+ basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly());
+ const sal_uInt32 nPolyCount(aUnitPolyPolygon.count());
+
+ if(nPolyCount)
{
- // create scaled, but unsheared, unrotated and untranslated polygon
- // by creating the object matrix and back-transforming the polygon
- const ::basegfx::B2DRange aObjectRange(::basegfx::tools::getRange(aUnitPolyPolygon));
- const GeoStat& rGeoStat(GetPathObj().GetGeoStat());
-
- aObjectMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000));
- aObjectMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000);
- aObjectMatrix.translate(aObjectRange.getMinX(), aObjectRange.getMinY());
-
- // ceate scaled unit polygon from object's absolute path
- ::basegfx::B2DHomMatrix aInverse(aObjectMatrix);
- aInverse.invert();
- aUnitPolyPolygon.transform(aInverse);
+ // prepare object transformation and unit polygon (direct model data)
+ basegfx::B2DHomMatrix aObjectMatrix;
+ const bool bIsLine(
+ !aUnitPolyPolygon.areControlPointsUsed()
+ && 1 == nPolyCount
+ && 2 == aUnitPolyPolygon.getB2DPolygon(0).count());
+
+ if(bIsLine)
+ {
+ // special handling for single line mode (2 points)
+ const basegfx::B2DPolygon aSubPolygon(aUnitPolyPolygon.getB2DPolygon(0));
+ const basegfx::B2DPoint aStart(aSubPolygon.getB2DPoint(0));
+ const basegfx::B2DPoint aEnd(aSubPolygon.getB2DPoint(1));
+ const basegfx::B2DVector aLine(aEnd - aStart);
+
+ // #i102548# create new unit polygon for line (horizontal)
+ basegfx::B2DPolygon aNewPolygon;
+ aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0));
+ aNewPolygon.append(basegfx::B2DPoint(1.0, 0.0));
+ aUnitPolyPolygon.setB2DPolygon(0, aNewPolygon);
+
+ // #i102548# fill objectMatrix with rotation and offset (no shear for lines)
+ aObjectMatrix.scale(aLine.getLength(), 1.0);
+ aObjectMatrix.rotate(atan2(aLine.getY(), aLine.getX()));
+ aObjectMatrix.translate(aStart.getX(), aStart.getY());
+ }
+ else
+ {
+ // #i102548# create unscaled, unsheared, unrotated and untranslated polygon
+ // (unit polygon) by creating the object matrix and back-transforming the polygon
+ const basegfx::B2DRange aObjectRange(basegfx::tools::getRange(aUnitPolyPolygon));
+ const GeoStat& rGeoStat(GetPathObj().GetGeoStat());
+ const double fWidth(aObjectRange.getWidth());
+ const double fHeight(aObjectRange.getHeight());
+
+ aObjectMatrix.scale(
+ basegfx::fTools::equalZero(fWidth) ? 1.0 : fWidth,
+ basegfx::fTools::equalZero(fHeight) ? 1.0 : fHeight);
+
+ if(rGeoStat.nShearWink)
+ {
+ aObjectMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000));
+ }
+
+ if(rGeoStat.nDrehWink)
+ {
+ aObjectMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000);
+ }
+
+ aObjectMatrix.translate(aObjectRange.getMinX(), aObjectRange.getMinY());
+
+ // ceate unit polygon from object's absolute path
+ basegfx::B2DHomMatrix aInverse(aObjectMatrix);
+ aInverse.invert();
+ aUnitPolyPolygon.transform(aInverse);
+ }
+
+ // create primitive
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::SdrPathPrimitive2D(
+ aObjectMatrix,
+ *pAttribute,
+ aUnitPolyPolygon));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
-
- // create primitive
- const drawinglayer::primitive2d::Primitive2DReference xReference(
- new drawinglayer::primitive2d::SdrPathPrimitive2D(aObjectMatrix, *pAttribute, aUnitPolyPolygon));
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
delete pAttribute;
diff --git a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
index 394ae3141182..902e8e7d8153 100644
--- a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
@@ -38,6 +38,7 @@
#include <svx/svdograf.hxx>
#include <svx/sdr/contact/objectcontact.hxx>
#include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -245,10 +246,19 @@ namespace sdr
{
// prepare primitive generation with evtl. loading the graphic when it's swapped out
SdrGrafObj& rGrafObj = const_cast< ViewObjectContactOfGraphic* >(this)->getSdrGrafObj();
- const bool bDoAsynchronGraphicLoading(rGrafObj.GetModel() && rGrafObj.GetModel()->IsSwapGraphics());
+ bool bDoAsynchronGraphicLoading(rGrafObj.GetModel() && rGrafObj.GetModel()->IsSwapGraphics());
static bool bSuppressAsynchLoading(false);
bool bSwapInDone(false);
+ if(bDoAsynchronGraphicLoading
+ && rGrafObj.IsSwappedOut()
+ && rGrafObj.GetPage()
+ && rGrafObj.GetPage()->IsMasterPage())
+ {
+ // #i102380# force Swap-In for GraphicObjects on MasterPage to have a nicer visualisation
+ bDoAsynchronGraphicLoading = false;
+ }
+
if(bDoAsynchronGraphicLoading && !bSuppressAsynchLoading)
{
bSwapInDone = const_cast< ViewObjectContactOfGraphic* >(this)->impPrepareGraphicWithAsynchroniousLoading();
@@ -261,6 +271,23 @@ namespace sdr
// get return value by calling parent
drawinglayer::primitive2d::Primitive2DSequence xRetval = ViewObjectContactOfSdrObj::createPrimitive2DSequence(rDisplayInfo);
+ if(xRetval.hasElements())
+ {
+ // #i103255# suppress when graphic needs draft visualisation and output
+ // is for PDF export/Printer
+ const ViewContactOfGraphic& rVCOfGraphic = static_cast< const ViewContactOfGraphic& >(GetViewContact());
+
+ if(rVCOfGraphic.visualisationUsesDraft())
+ {
+ const ObjectContact& rObjectContact = GetObjectContact();
+
+ if(rObjectContact.isOutputToPDFFile() || rObjectContact.isOutputToPrinter())
+ {
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence();
+ }
+ }
+ }
+
// if swap in was forced only for printing, swap out again
const bool bSwapInExclusiveForPrinting(bSwapInDone && GetObjectContact().isOutputToPrinter());
diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
index 87288882995e..34fddf088c98 100644
--- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
@@ -291,7 +291,8 @@ namespace sdr
}
// add a gray outline frame, except not when printing
- if(!GetObjectContact().isOutputToPrinter())
+ // #i102637# add frame also when printing and page exists (handout pages)
+ if(!GetObjectContact().isOutputToPrinter() || pPage)
{
const Color aFrameColor(aColorConfig.GetColorValue(svtools::OBJECTBOUNDARIES).nColor);
basegfx::B2DPolygon aOwnOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
index d5681c60463e..6145e0acc301 100644
--- a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
@@ -37,10 +37,13 @@
#include <svx/sdr/contact/viewcontactofsdrole2obj.hxx>
#include <svx/svdoole2.hxx>
#include <svx/sdr/contact/objectcontact.hxx>
+#include <svx/svdview.hxx>
#include <drawinglayer/primitive2d/chartprimitive2d.hxx>
#include <drawinglayer/attribute/fillattribute.hxx>
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <com/sun/star/embed/EmbedMisc.hpp>
+#include <com/sun/star/embed/EmbedStates.hpp>
//////////////////////////////////////////////////////////////////////////////
@@ -60,136 +63,194 @@ namespace sdr
drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfSdrOle2Obj::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const
{
// this method is overloaded to do some things the old SdrOle2Obj::DoPaintObject did.
- // In the future, some of these may be solved different, but ATM try to stay compatible
- // with the old behaviour
- drawinglayer::primitive2d::Primitive2DSequence xRetval;
- const SdrOle2Obj& rSdrOle2 = getSdrOle2Object();
- const bool bIsActive(rSdrOle2.executeOldDoPaintPreparations(GetObjectContact().TryToGetSdrPageView()));
- const Rectangle& rObjectRectangle(rSdrOle2.GetGeoRect());
- const basegfx::B2DRange aObjectRange(rObjectRectangle.Left(), rObjectRectangle.Top(), rObjectRectangle.Right(), rObjectRectangle.Bottom());
-
- // create object transform
- basegfx::B2DHomMatrix aObjectTransform;
- aObjectTransform.set(0, 0, aObjectRange.getWidth());
- aObjectTransform.set(1, 1, aObjectRange.getHeight());
- aObjectTransform.set(0, 2, aObjectRange.getMinX());
- aObjectTransform.set(1, 2, aObjectRange.getMinY());
-
- if(GetObjectContact().isDrawModeHighContrast())
- {
- // directly call at the corresponding VC and force OLE Graphic to HighContrast
- const ViewContactOfSdrOle2Obj& rVC = static_cast< const ViewContactOfSdrOle2Obj& >(GetViewContact());
- Graphic* pOLEHighContrastGraphic = rSdrOle2.getEmbeddedObjectRef().GetHCGraphic();
-
- if(pOLEHighContrastGraphic)
+ // In the future, some of these may be solved different, but ATM try to stay compatible
+ // with the old behaviour
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+ const SdrOle2Obj& rSdrOle2 = getSdrOle2Object();
+ sal_Int32 nState = -1;
{
- // there is a graphic set, use it
- xRetval = rVC.createPrimitive2DSequenceWithGivenGraphic(*pOLEHighContrastGraphic, rSdrOle2.IsEmptyPresObj());
+ const svt::EmbeddedObjectRef& xObjRef = rSdrOle2.getEmbeddedObjectRef();
+ if ( xObjRef.is() )
+ nState = xObjRef->getCurrentState();
}
- else
- {
- // no HighContrast graphic, use default empty OLE bitmap
- const Bitmap aEmptyOLEBitmap(rSdrOle2.GetEmtyOLEReplacementBitmap());
- const Graphic aEmtyOLEGraphic(aEmptyOLEBitmap);
+ const bool bIsOutplaceActive = (nState == embed::EmbedStates::ACTIVE);
+ const bool bIsInplaceActive = (nState == embed::EmbedStates::INPLACE_ACTIVE) || (nState == embed::EmbedStates::UI_ACTIVE);
+ const bool bIsChart = rSdrOle2.IsChart();
- xRetval = rVC.createPrimitive2DSequenceWithGivenGraphic(aEmtyOLEGraphic, true);
- }
- }
- else
- {
- // call parent which will use the regular createViewIndependentPrimitive2DSequence
- // at the corresponding VC
- xRetval = ViewObjectContactOfSdrObj::createPrimitive2DSequence(rDisplayInfo);
- }
-
- if(rSdrOle2.getEmbeddedObjectRef().IsChart())
- {
- // for chart, to not lose the current better quality visualisation which
- // uses a direct paint, use a primtive wrapper for that exceptional case. The renderers
- // will then ATM paint it to an OutputDevice directly.
- // In later versions this should be replaced by getting the Primitive2DSequnce from
- // the chart and using it.
- // to be able to render something in non-VCL using renderers, the wrapper is a
- // GroupPrimitive2D which automatically decomposes to the already created Metafile
- // content.
- // For being completely compatible, ATM Window and VDEV PrettyPrinting is suppressed.
- // It works in the VCL renderers, though. So for activating again with VCL primitive
- // renderers, change conditions here.
-
- // determine if embedding and PrettyPrinting shall be done at all
- uno::Reference< frame::XModel > xChartModel;
- bool bDoChartPrettyPrinting(true);
- static bool bPrettyPrintingForBitmaps(false);
-
- // the original ChartPrettyPainter does not do it for Window
- if(!bPrettyPrintingForBitmaps && bDoChartPrettyPrinting && GetObjectContact().isOutputToWindow())
+ bool bDone = false;
+ if( !bDone && bIsInplaceActive )
{
- bDoChartPrettyPrinting = false;
+ if( !GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile() )
+ {
+ bDone = true;
+ //no need to create a primitive sequence here as the OLE object does render itself
+ //in case of charts the superfluous creation of a metafile is strongly performance relevant!
+ }
}
- // the original ChartPrettyPainter does not do it for VDEV
- if(!bPrettyPrintingForBitmaps && bDoChartPrettyPrinting && GetObjectContact().isOutputToVirtualDevice())
+ if( !bDone )
{
- if(GetObjectContact().isOutputToPDFFile())
+ const Rectangle& rObjectRectangle(rSdrOle2.GetGeoRect());
+ const basegfx::B2DRange aObjectRange(rObjectRectangle.Left(), rObjectRectangle.Top(), rObjectRectangle.Right(), rObjectRectangle.Bottom());
+
+ // create object transform
+ basegfx::B2DHomMatrix aObjectTransform;
+ aObjectTransform.set(0, 0, aObjectRange.getWidth());
+ aObjectTransform.set(1, 1, aObjectRange.getHeight());
+ aObjectTransform.set(0, 2, aObjectRange.getMinX());
+ aObjectTransform.set(1, 2, aObjectRange.getMinY());
+
+ if(bIsChart)
{
- // #i97982#
- // For PDF files, allow PrettyPrinting
+ //charts must be painted resolution dependent!! #i82893#, #i75867#
+
+ // for chart, to not lose the current better quality visualisation which
+ // uses a direct paint, use a primtive wrapper for that exceptional case. The renderers
+ // will then ATM paint it to an OutputDevice directly.
+ // In later versions this should be replaced by getting the Primitive2DSequnce from
+ // the chart and using it.
+ // to be able to render something in non-VCL using renderers, the wrapper is a
+ // GroupPrimitive2D which automatically decomposes to the already created Metafile
+ // content.
+ // For being completely compatible, ATM Window and VDEV PrettyPrinting is suppressed.
+ // It works in the VCL renderers, though. So for activating again with VCL primitive
+ // renderers, change conditions here.
+
+ // determine if embedding and PrettyPrinting shall be done at all
+ uno::Reference< frame::XModel > xChartModel;
+ bool bDoChartPrettyPrinting(true);
+
+ // the original ChartPrettyPainter does not do it for Window
+ if(bDoChartPrettyPrinting && GetObjectContact().isOutputToWindow())
+ {
+ bDoChartPrettyPrinting = false;
+ }
+
+ // the original ChartPrettyPainter does not do it for VDEV
+ if(bDoChartPrettyPrinting && GetObjectContact().isOutputToVirtualDevice())
+ {
+ if(GetObjectContact().isOutputToPDFFile())
+ {
+ // #i97982#
+ // For PDF files, allow PrettyPrinting
+ }
+ else
+ {
+ bDoChartPrettyPrinting = false;
+ }
+ }
+
+ // the chart model is needed. Check if it's available
+ if(bDoChartPrettyPrinting)
+ {
+ // get chart model
+ xChartModel = rSdrOle2.getXModel();
+
+ if(!xChartModel.is())
+ {
+ bDoChartPrettyPrinting = false;
+ }
+ }
+
+ if(bDoChartPrettyPrinting)
+ {
+ // embed MetaFile data in a specialized Wrapper Primitive which holds also the ChartModel needed
+ // for PrettyPrinting
+ const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::ChartPrimitive2D(
+ xChartModel, aObjectTransform, xRetval));
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ bDone = true;
+ }
}
- else
+
+ if( !bDone )
{
- bDoChartPrettyPrinting = false;
- }
- }
+ //old stuff that should be reworked
+ {
+ //if no replacement image is available load the OLE object
+ if(!rSdrOle2.GetGraphic()) //try to fetch the metafile - this can lead to the actual creation of the metafile what can be extremely expensive (e.g. for big charts)!!! #i101925#
+ {
+ // try to create embedded object
+ rSdrOle2.GetObjRef(); //this loads the OLE object if it is not loaded already
+ }
+ const svt::EmbeddedObjectRef& xObjRef = rSdrOle2.getEmbeddedObjectRef();
+ if(xObjRef.is())
+ {
+ const sal_Int64 nMiscStatus(xObjRef->getStatus(rSdrOle2.GetAspect()));
- // the chart model is needed. Check if it's available
- if(bDoChartPrettyPrinting)
- {
- // get chart model
- xChartModel = rSdrOle2.getXModel();
+ // this hack (to change model data during PAINT argh(!)) should be reworked
+ if(!rSdrOle2.IsResizeProtect() && (nMiscStatus & embed::EmbedMisc::EMBED_NEVERRESIZE))
+ {
+ const_cast< SdrOle2Obj* >(&rSdrOle2)->SetResizeProtect(true);
+ }
+
+ SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
+ if(pPageView && (nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE))
+ {
+ // connect plugin object
+ pPageView->GetView().DoConnect(const_cast< SdrOle2Obj* >(&rSdrOle2));
+ }
+ }
+ }//end old stuff to rework
+
+ if(GetObjectContact().isDrawModeHighContrast())
+ {
+ // directly call at the corresponding VC and force OLE Graphic to HighContrast
+ const ViewContactOfSdrOle2Obj& rVC = static_cast< const ViewContactOfSdrOle2Obj& >(GetViewContact());
+ Graphic* pOLEHighContrastGraphic = rSdrOle2.getEmbeddedObjectRef().GetHCGraphic();
+
+ if(pOLEHighContrastGraphic)
+ {
+ // there is a graphic set, use it
+ xRetval = rVC.createPrimitive2DSequenceWithGivenGraphic(*pOLEHighContrastGraphic, rSdrOle2.IsEmptyPresObj());
+ }
+ else
+ {
+ // no HighContrast graphic, use default empty OLE bitmap
+ const Bitmap aEmptyOLEBitmap(rSdrOle2.GetEmtyOLEReplacementBitmap());
+ const Graphic aEmtyOLEGraphic(aEmptyOLEBitmap);
+
+ xRetval = rVC.createPrimitive2DSequenceWithGivenGraphic(aEmtyOLEGraphic, true);
+ }
+ }
+ else
+ {
+ // call parent which will use the regular createViewIndependentPrimitive2DSequence
+ // at the corresponding VC
+ xRetval = ViewObjectContactOfSdrObj::createPrimitive2DSequence(rDisplayInfo);
+ }
- if(!xChartModel.is())
- {
- bDoChartPrettyPrinting = false;
}
- }
- if(bDoChartPrettyPrinting)
- {
- // embed MetaFile data in a specialized Wrapper Primitive which holds also the ChartModel needed
- // for PrettyPrinting
- const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::ChartPrimitive2D(
- xChartModel, aObjectTransform, xRetval));
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
- }
- }
+ if(bIsOutplaceActive)
+ {
+ // do not shade when printing or PDF exporting
+ if(!GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile())
+ {
+ // shade the representation if the object is activated outplace
+ basegfx::B2DPolygon aObjectOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
+ aObjectOutline.transform(aObjectTransform);
+
+ // Use a FillHatchPrimitive2D with necessary attributes
+ const drawinglayer::attribute::FillHatchAttribute aFillHatch(
+ drawinglayer::attribute::HATCHSTYLE_SINGLE, // single hatch
+ 125.0, // 1.25 mm
+ 45.0 * F_PI180, // 45 degree diagonal
+ Color(COL_BLACK).getBColor(), // black color
+ false); // no filling
+
+ const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolyPolygonHatchPrimitive2D(
+ basegfx::B2DPolyPolygon(aObjectOutline),
+ Color(COL_BLACK).getBColor(),
+ aFillHatch));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xReference);
+ }
+ }
- if(bIsActive)
- {
- // do not shade when printing or PDF exporting
- if(!GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile())
- {
- // shade the representation if the object is activated outplace
- basegfx::B2DPolygon aObjectOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
- aObjectOutline.transform(aObjectTransform);
-
- // Use a FillHatchPrimitive2D with necessary attributes
- const drawinglayer::attribute::FillHatchAttribute aFillHatch(
- drawinglayer::attribute::HATCHSTYLE_SINGLE, // single hatch
- 125.0, // 1.25 mm
- 45.0 * F_PI180, // 45 degree diagonal
- Color(COL_BLACK).getBColor(), // black color
- false); // no filling
-
- const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolyPolygonHatchPrimitive2D(
- basegfx::B2DPolyPolygon(aObjectOutline),
- Color(COL_BLACK).getBColor(),
- aFillHatch));
-
- drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xReference);
}
- }
- return xRetval;
+ return xRetval;
}
ViewObjectContactOfSdrOle2Obj::ViewObjectContactOfSdrOle2Obj(ObjectContact& rObjectContact, ViewContact& rViewContact)
diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
index ea260f3285f7..92003865fde0 100644
--- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
@@ -35,6 +35,7 @@
#include <svx/sdr/contact/displayinfo.hxx>
#include <svx/sdr/properties/properties.hxx>
#include <svx/sdr/contact/objectcontactofpageview.hxx>
+#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
/** === begin UNO includes === **/
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -80,6 +81,7 @@ namespace sdr { namespace contact {
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::awt::XControl;
@@ -175,7 +177,11 @@ namespace sdr { namespace contact {
inline void addWindowListener( const Reference< XWindowListener >& _l ) const { m_xControlWindow->addWindowListener( _l ); }
inline void removeWindowListener( const Reference< XWindowListener >& _l ) const { m_xControlWindow->removeWindowListener( _l ); }
void setPosSize( const Rectangle& _rPosSize ) const;
- void setZoom( const MapMode& _rMapMode ) const;
+ Rectangle
+ getPosSize() const;
+ void setZoom( const ::basegfx::B2DVector& _rScale ) const;
+ ::basegfx::B2DVector
+ getZoom() const;
inline void setGraphics( const Reference< XGraphics >& _g ) const { m_xControlView->setGraphics( _g ); }
inline Reference< XGraphics >
@@ -221,10 +227,36 @@ namespace sdr { namespace contact {
}
//--------------------------------------------------------------------
- void ControlHolder::setZoom( const MapMode& _rMapMode ) const
+ ::Rectangle ControlHolder::getPosSize() const
{
// no check whether we're valid, this is the responsibility of the caller
- m_xControlView->setZoom( (float)double( _rMapMode.GetScaleX() ), (float)double( _rMapMode.GetScaleY() ) );
+ return VCLUnoHelper::ConvertToVCLRect( m_xControlWindow->getPosSize() );
+ }
+
+ //--------------------------------------------------------------------
+ void ControlHolder::setZoom( const ::basegfx::B2DVector& _rScale ) const
+ {
+ // no check whether we're valid, this is the responsibility of the caller
+ m_xControlView->setZoom( (float)_rScale.getX(), (float)_rScale.getY() );
+ }
+
+ //--------------------------------------------------------------------
+ ::basegfx::B2DVector ControlHolder::getZoom() const
+ {
+ // no check whether we're valid, this is the responsibility of the caller
+
+ // Argh. Why does XView have a setZoom only, but not a getZoom?
+ Window* pWindow = VCLUnoHelper::GetWindow( m_xControlWindow );
+ OSL_ENSURE( pWindow, "ControlHolder::setZoom: no implementation access!" );
+
+ ::basegfx::B2DVector aZoom( 1, 1 );
+ if ( pWindow )
+ {
+ const Fraction& rZoom( pWindow->GetZoom() );
+ aZoom.setX( (double)rZoom );
+ aZoom.setY( (double)rZoom );
+ }
+ return aZoom;
}
//====================================================================
@@ -233,37 +265,13 @@ namespace sdr { namespace contact {
class UnoControlContactHelper
{
public:
- /** positions a control relative to a device
-
- @precond <arg>_pDevice</arg> is not <NULL/>
+ /** positions a control, and sets its zoom mode, using a given transformation and output device
*/
- static void positionControl_throw(
+ static void adjustControlGeometry_throw(
const ControlHolder& _rControl,
const Rectangle& _rLogicBoundingRect,
- const OutputDevice* _pDevice
- );
-
- /** sets the zoom at a UNO control, according to a Device's MapMode
-
- @precond <arg>_pDevice</arg> is not <NULL/>
- */
- static void setControlZoom(
- const ControlHolder& _rControl,
- const OutputDevice* _pDevice
- );
-
- /** draws a given control onto it's current XGraphics, at given coordinates
-
- Note that the control is not drawn onto the given device, instead you must
- use ->XView::setGraphics yourself, before calling this method. The given ->OutputDevice
- is only used to calculate pixel coordinates from logic coordinates
-
- @precond <arg>_pDevice</arg> is not <NULL/>
- */
- static void drawControl(
- const ControlHolder& _rControl,
- const Point& _rLogicTopLeft,
- const OutputDevice* _pDevice
+ const ::basegfx::B2DHomMatrix& _rViewTransformation,
+ const ::basegfx::B2DHomMatrix& _rZoomLevelNormalization
);
/** disposes the given control
@@ -279,50 +287,28 @@ namespace sdr { namespace contact {
};
//--------------------------------------------------------------------
- void UnoControlContactHelper::positionControl_throw( const ControlHolder& _rControl, const Rectangle& _rLogicBoundingRect,
- const OutputDevice* _pDevice )
+ void UnoControlContactHelper::adjustControlGeometry_throw( const ControlHolder& _rControl, const Rectangle& _rLogicBoundingRect,
+ const basegfx::B2DHomMatrix& _rViewTransformation, const ::basegfx::B2DHomMatrix& _rZoomLevelNormalization )
{
- OSL_PRECOND( _pDevice, "UnoControlContactHelper::positionControl_throw: no device -> no survival!" );
-
- if ( _rControl.is() )
- {
- const Rectangle aPaintRectPixel(
- _pDevice->LogicToPixel( _rLogicBoundingRect.TopLeft() ),
- _pDevice->LogicToPixel( _rLogicBoundingRect.GetSize() )
- );
-
- _rControl.setPosSize( aPaintRectPixel );
- }
- }
-
- //--------------------------------------------------------------------
- void UnoControlContactHelper::setControlZoom( const ControlHolder& _rControl, const OutputDevice* _pDevice )
- {
- OSL_PRECOND( _pDevice, "UnoControlContactHelper::setControlZoom: no device -> no survival!" );
- OSL_PRECOND( _rControl.is(), "UnoControlContactHelper::setControlZoom: illegal control!" );
-
- if ( _rControl.is() )
- _rControl.setZoom( _pDevice->GetMapMode() );
- }
-
- //--------------------------------------------------------------------
- void UnoControlContactHelper::drawControl( const ControlHolder& _rControl, const Point& _rLogicTopLeft,
- const OutputDevice* _pDevice )
- {
- OSL_PRECOND( _rControl.is(), "UnoControlContactHelper::drawControl: invalid control!" );
+ OSL_PRECOND( _rControl.is(), "UnoControlContactHelper::adjustControlGeometry_throw: illegal control!" );
if ( !_rControl.is() )
return;
- try
- {
- _rControl.draw(
- _pDevice->LogicToPixel( _rLogicTopLeft )
- );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
+ // transform the logic bound rect, using the view transformation, to pixel coordinates
+ ::basegfx::B2DPoint aTopLeft( _rLogicBoundingRect.Left(), _rLogicBoundingRect.Top() );
+ aTopLeft *= _rViewTransformation;
+ ::basegfx::B2DPoint aBottomRight( _rLogicBoundingRect.Right(), _rLogicBoundingRect.Bottom() );
+ aBottomRight *= _rViewTransformation;
+
+ const Rectangle aPaintRectPixel( (long)aTopLeft.getX(), (long)aTopLeft.getY(), (long)aBottomRight.getX(), (long)aBottomRight.getY() );
+ _rControl.setPosSize( aPaintRectPixel );
+
+ // determine the scale from the current view transformation, and the normalization matrix
+ ::basegfx::B2DHomMatrix aObtainResolutionDependentScale( _rViewTransformation * _rZoomLevelNormalization );
+ ::basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ aObtainResolutionDependentScale.decompose( aScale, aTranslate, fRotate, fShearX );
+ _rControl.setZoom( aScale );
}
//--------------------------------------------------------------------
@@ -402,40 +388,7 @@ namespace sdr { namespace contact {
}
//====================================================================
- //= DummyPageViewAccess
- //====================================================================
- /** is a ->IPageViewAccess implementation which defaults all attribute access, and thus can be
- operated without an actual ->SdrPageView
- */
- class DummyPageViewAccess : public IPageViewAccess
- {
- public:
- virtual bool isDesignMode() const;
- virtual Reference< XControlContainer >
- getControlContainer( const OutputDevice& _rDevice ) const;
- virtual bool isLayerVisible( SdrLayerID _nLayerID ) const;
- };
-
- //--------------------------------------------------------------------
- bool DummyPageViewAccess::isDesignMode() const
- {
- return true;
- }
-
- //--------------------------------------------------------------------
- Reference< XControlContainer > DummyPageViewAccess::getControlContainer( const OutputDevice& /*_rDevice*/ ) const
- {
- return Reference< XControlContainer >();
- }
-
- //--------------------------------------------------------------------
- bool DummyPageViewAccess::isLayerVisible( SdrLayerID /*_nLayerID*/ ) const
- {
- return true;
- }
-
- //====================================================================
- //= DummyPageViewAccess
+ //= InvisibleControlViewAccess
//====================================================================
/** is a ->IPageViewAccess implementation which can be used to create an invisble control for
an arbitrary device
@@ -510,7 +463,7 @@ namespace sdr { namespace contact {
Reference< XContainer > m_xContainer;
/// the output device for which the control was created
- OutputDevice const* m_pOutputDeviceForWindow;
+ const OutputDevice* m_pOutputDeviceForWindow;
/// flag indicating whether the control is currently visible
bool m_bControlIsVisible;
@@ -527,6 +480,8 @@ namespace sdr { namespace contact {
/// is the control currently in design mode?
mutable ViewControlMode m_eControlDesignMode;
+ ::basegfx::B2DHomMatrix m_aZoomLevelNormalization;
+
public:
ViewObjectContactOfUnoControl_Impl( ViewObjectContactOfUnoControl* _pAntiImpl );
@@ -549,17 +504,13 @@ namespace sdr { namespace contact {
*/
bool getUnoObject( SdrUnoObj*& _out_rpObject ) const;
- /** ensures that we have an XControl which can be painted onto the given display
- */
- bool ensureControl( const DisplayInfo& _rDisplayInfo );
-
/** ensures that we have an ->XControl
Must only be called if a control is needed when no DisplayInfo is present, yet.
- For creating a control, an ->OutputDevice is needed, and an ->SdrPageView. Both can only be
- obtained from a ->DisplayInfo struct, or alternatively a ->ObjectContactOfPageView. So, if
- our (anti-impl's) object contact is not a ->ObjectContactOfPageView, this method fill fail.
+ For creating a control, an ->OutputDevice is needed, and an ->SdrPageView. Both will be obtained
+ from a ->ObjectContactOfPageView. So, if our (anti-impl's) object contact is not a ->ObjectContactOfPageView,
+ this method fill fail.
Failure of this method will be reported via an assertion in a non-product version.
*/
@@ -572,22 +523,16 @@ namespace sdr { namespace contact {
inline const ControlHolder&
getExistentControl() const { return m_aControl; }
- /** positions our XControl according to the geometry settings in the SdrUnoObj,
- and sets proper zoom settings according to our device
+ inline bool
+ hasControl() const { return m_aControl.is(); }
+
+ /** positions our XControl according to the geometry settings in the SdrUnoObj, modified by the given
+ transformation, and sets proper zoom settings according to our device
@precond
->m_pOutputDeviceForWindow and ->m_aControl are not <NULL/>
- @tolerant
- If the preconditions are not met, nothing is done at all
*/
- void positionAndZoomControl() const;
-
- /** positions the control for a paint onto a given device
-
- If we do not (yet) have a control, or the control does not belong to the
- device for which a paint is requested, no positioning happens.
- */
- void positionControlForPaint( const DisplayInfo& _rDisplayInfo ) const;
+ void positionAndZoomControl( const basegfx::B2DHomMatrix& _rViewTransformation ) const;
/** determines whether or not our control is printable
@@ -626,6 +571,13 @@ namespace sdr { namespace contact {
struct GuardAccess { friend class VOCGuard; private: GuardAccess() { } };
::osl::Mutex& getMutex( GuardAccess ) const { return m_aMutex; }
+ const ViewContactOfUnoControl&
+ getViewContact() const
+ {
+ ENSURE_OR_THROW( !impl_isDisposed_nofail(), "already disposed" );
+ return static_cast< const ViewContactOfUnoControl& >( m_pAntiImpl->GetViewContact() );
+ }
+
protected:
~ViewObjectContactOfUnoControl_Impl();
@@ -797,10 +749,11 @@ namespace sdr { namespace contact {
This method cares for this, by retrieving the very original OutputDevice.
*/
- const OutputDevice& imp_getPageViewDevice_nothrow( const ObjectContactOfPageView& _rObjectContact ) const;
+ static const OutputDevice& imp_getPageViewDevice_nothrow( const ObjectContactOfPageView& _rObjectContact );
+ const OutputDevice& imp_getPageViewDevice_nothrow() const;
private:
- ViewObjectContactOfUnoControl_Impl(); // never implemented
+ ViewObjectContactOfUnoControl_Impl(); // never implemented
ViewObjectContactOfUnoControl_Impl( const ViewObjectContactOfUnoControl_Impl& ); // never implemented
ViewObjectContactOfUnoControl_Impl& operator=( const ViewObjectContactOfUnoControl_Impl& ); // never implemented
};
@@ -812,18 +765,65 @@ namespace sdr { namespace contact {
*/
class VOCGuard
{
- const ViewObjectContactOfUnoControl_Impl& m_rImpl;
- ::osl::MutexGuard m_aMutexGuard;
+ private:
+ ::osl::MutexGuard m_aMutexGuard;
public:
VOCGuard( const ViewObjectContactOfUnoControl_Impl& _rImpl )
- :m_rImpl( _rImpl )
- ,m_aMutexGuard( _rImpl.getMutex( ViewObjectContactOfUnoControl_Impl::GuardAccess() ) )
+ :m_aMutexGuard( _rImpl.getMutex( ViewObjectContactOfUnoControl_Impl::GuardAccess() ) )
{
}
};
//====================================================================
+ //= LazyControlCreationPrimitive2D
+ //====================================================================
+ class LazyControlCreationPrimitive2D : public ::drawinglayer::primitive2d::BasePrimitive2D
+ {
+ private:
+ typedef ::drawinglayer::primitive2d::BasePrimitive2D BasePrimitive2D;
+
+ protected:
+ virtual ::drawinglayer::primitive2d::Primitive2DSequence
+ get2DDecomposition(
+ const ::drawinglayer::geometry::ViewInformation2D& rViewInformation
+ ) const;
+
+ virtual ::drawinglayer::primitive2d::Primitive2DSequence
+ createLocalDecomposition(
+ const ::drawinglayer::geometry::ViewInformation2D& rViewInformation
+ ) const;
+
+ virtual ::basegfx::B2DRange
+ getB2DRange(
+ const ::drawinglayer::geometry::ViewInformation2D& rViewInformation
+ ) const;
+
+ public:
+ LazyControlCreationPrimitive2D( const ::rtl::Reference< ViewObjectContactOfUnoControl_Impl >& _pVOCImpl )
+ :m_pVOCImpl( _pVOCImpl )
+ {
+ ENSURE_OR_THROW( m_pVOCImpl.is(), "Illegal argument." );
+ getTransformation( m_pVOCImpl->getViewContact(), m_aTransformation );
+ }
+
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ // declare unique ID for this primitive class
+ DeclPrimitrive2DIDBlock()
+
+ static void getTransformation( const ViewContactOfUnoControl& _rVOC, ::basegfx::B2DHomMatrix& _out_Transformation );
+
+ private:
+ ::rtl::Reference< ViewObjectContactOfUnoControl_Impl > m_pVOCImpl;
+ /** The geometry is part of the identity of an primitive, so we cannot calculate it on demand
+ (since the data the calculation is based on might have changed then), but need to calc
+ it at construction time, and remember it.
+ */
+ ::basegfx::B2DHomMatrix m_aTransformation;
+ };
+
+ //====================================================================
//= ViewObjectContactOfUnoControl_Impl
//====================================================================
DBG_NAME( ViewObjectContactOfUnoControl_Impl )
@@ -834,10 +834,20 @@ namespace sdr { namespace contact {
,m_bControlIsVisible( false )
,m_bIsDesignModeListening( false )
,m_eControlDesignMode( eUnknown )
+ ,m_aZoomLevelNormalization()
{
DBG_CTOR( ViewObjectContactOfUnoControl_Impl, NULL );
DBG_ASSERT( m_pAntiImpl, "ViewObjectContactOfUnoControl_Impl::ViewObjectContactOfUnoControl_Impl: invalid AntiImpl!" );
- }
+
+ const OutputDevice& rPageViewDevice( imp_getPageViewDevice_nothrow() );
+ m_aZoomLevelNormalization = rPageViewDevice.GetInverseViewTransformation();
+
+ ::basegfx::B2DHomMatrix aScaleNormalization;
+ MapMode aCurrentDeviceMapMode( rPageViewDevice.GetMapMode() );
+ aScaleNormalization.set( 0, 0, (double)aCurrentDeviceMapMode.GetScaleX() );
+ aScaleNormalization.set( 1, 1, (double)aCurrentDeviceMapMode.GetScaleY() );
+ m_aZoomLevelNormalization *= aScaleNormalization;
+ }
//--------------------------------------------------------------------
ViewObjectContactOfUnoControl_Impl::~ViewObjectContactOfUnoControl_Impl()
@@ -898,27 +908,21 @@ namespace sdr { namespace contact {
}
//--------------------------------------------------------------------
- void ViewObjectContactOfUnoControl_Impl::positionControlForPaint( const DisplayInfo& /* #i74769# _rDisplayInfo*/ ) const
- {
- if ( !m_aControl.is() )
- return;
-
- positionAndZoomControl();
- }
-
- //--------------------------------------------------------------------
- void ViewObjectContactOfUnoControl_Impl::positionAndZoomControl() const
+ void ViewObjectContactOfUnoControl_Impl::positionAndZoomControl( const basegfx::B2DHomMatrix& _rViewTransformation ) const
{
- OSL_PRECOND( m_pOutputDeviceForWindow && m_aControl.is(), "ViewObjectContactOfUnoControl_Impl::positionAndZoomControl: no output device or no control!" );
- if ( !m_pOutputDeviceForWindow || !m_aControl.is() )
+ OSL_PRECOND( ( m_pOutputDeviceForWindow != NULL ) && m_aControl.is(), "ViewObjectContactOfUnoControl_Impl::positionAndZoomControl: no output device or no control!" );
+ if ( ( m_pOutputDeviceForWindow == NULL ) || !m_aControl.is() )
return;
try
{
SdrUnoObj* pUnoObject( NULL );
if ( getUnoObject( pUnoObject ) )
- UnoControlContactHelper::positionControl_throw( m_aControl, pUnoObject->GetLogicRect(), m_pOutputDeviceForWindow );
- UnoControlContactHelper::setControlZoom( m_aControl, m_pOutputDeviceForWindow );
+ {
+ UnoControlContactHelper::adjustControlGeometry_throw( m_aControl, pUnoObject->GetLogicRect(), _rViewTransformation, m_aZoomLevelNormalization );
+ }
+ else
+ OSL_ENSURE( false, "ViewObjectContactOfUnoControl_Impl::positionAndZoomControl: no SdrUnoObj!" );
}
catch( const Exception& )
{
@@ -927,37 +931,6 @@ namespace sdr { namespace contact {
}
//--------------------------------------------------------------------
- bool ViewObjectContactOfUnoControl_Impl::ensureControl( const DisplayInfo& /*_rDisplayInfo*/ )
- {
- OSL_PRECOND( !impl_isDisposed_nofail(), "ViewObjectContactOfUnoControl_Impl::ensureControl: already disposed()" );
- if ( impl_isDisposed_nofail() )
- return false;
-
- const OutputDevice* pDeviceForControl( NULL );
-
- // if we're working for a page view, use the respective OutputDevice at the proper
- // PaintWindow. The DisplayInfo might only contain a temporary (virtual) device, which
- // is dangerous to remember
- // 2006-10-24 / #i70604# / frank.schoenheit@sun.com
- ObjectContactOfPageView* pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &m_pAntiImpl->GetObjectContact() );
- if ( pPageViewContact )
- pDeviceForControl = &imp_getPageViewDevice_nothrow( *pPageViewContact );
-
- if ( !pDeviceForControl && pPageViewContact)
- pDeviceForControl = pPageViewContact->TryToGetOutputDevice();
-
- DBG_ASSERT( pDeviceForControl, "ViewObjectContactOfUnoControl_Impl::ensureControl: no output device!" );
- if ( !pDeviceForControl )
- return false;
-
- SdrPageView* pPageView = m_pAntiImpl->GetObjectContact().TryToGetSdrPageView();
-
- ::std::auto_ptr< IPageViewAccess > pPVAccess;
- pPVAccess.reset( pPageView ? (IPageViewAccess*)new SdrPageViewAccess( *pPageView ) : (IPageViewAccess*)new DummyPageViewAccess() );
- return impl_ensureControl_nothrow( *pPVAccess, *pDeviceForControl );
- }
-
- //--------------------------------------------------------------------
bool ViewObjectContactOfUnoControl_Impl::ensureControl()
{
OSL_PRECOND( !impl_isDisposed_nofail(), "ViewObjectContactOfUnoControl_Impl::ensureControl: already disposed()" );
@@ -977,13 +950,21 @@ namespace sdr { namespace contact {
}
//--------------------------------------------------------------------
- const OutputDevice& ViewObjectContactOfUnoControl_Impl::imp_getPageViewDevice_nothrow( const ObjectContactOfPageView& _rObjectContact ) const
+ const OutputDevice& ViewObjectContactOfUnoControl_Impl::imp_getPageViewDevice_nothrow() const
+ {
+ ObjectContactOfPageView* pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &m_pAntiImpl->GetObjectContact() );
+ ENSURE_OR_THROW( pPageViewContact, "need a ObjectContactOfPageView." );
+ return imp_getPageViewDevice_nothrow( *pPageViewContact );
+ }
+
+ //--------------------------------------------------------------------
+ const OutputDevice& ViewObjectContactOfUnoControl_Impl::imp_getPageViewDevice_nothrow( const ObjectContactOfPageView& _rObjectContact )
{
// if the PageWindow has a patched PaintWindow, use the original PaintWindow
// this ensures that our control is _not_ re-created just because somebody
// (temporarily) changed the window to paint onto.
// #i72429# / 2007-02-20 / frank.schoenheit@sun.com
- const SdrPageWindow& rPageWindow( _rObjectContact.GetPageWindow() );
+ SdrPageWindow& rPageWindow( _rObjectContact.GetPageWindow() );
if ( rPageWindow.GetOriginalPaintWindow() )
return rPageWindow.GetOriginalPaintWindow()->GetOutputDevice();
@@ -1001,7 +982,7 @@ namespace sdr { namespace contact {
// Somebody requested a control for a new device, which means either of
// - our PageView's paint window changed since we were last here
// - we don't belong to a page view, and are simply painted onto different devices
- // The first sounds strange (doens't it?), the second means we could perhaps
+ // The first sounds strange (doens't it?), the second means we could perhaps
// optimize this in the future - there is no need to re-create the control every time,
// is it?
// #i74523# / 2007-02-15 / frank.schoenheit@sun.com
@@ -1063,44 +1044,37 @@ namespace sdr { namespace contact {
bool bSuccess = false;
try
{
- do
- {
- const ::rtl::OUString sControlServiceName( _rUnoObject.GetUnoControlTypeName() );
+ const ::rtl::OUString sControlServiceName( _rUnoObject.GetUnoControlTypeName() );
- Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
- if ( xFactory.is() )
- {
- _out_rControl = Reference< XControl >( xFactory->createInstance( sControlServiceName ), UNO_QUERY );
- }
- DBG_ASSERT( _out_rControl.is(), "ViewObjectContactOfUnoControl_Impl::createControlForDevice: no control could be created!" );
- if ( !_out_rControl.is() )
- break;
+ Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_SET_THROW );
+ _out_rControl = Reference< XControl >( xFactory->createInstance( sControlServiceName ), UNO_QUERY_THROW );
- // knit the model and the control
- _out_rControl.setModel( xControlModel );
+ // knit the model and the control
+ _out_rControl.setModel( xControlModel );
- UnoControlContactHelper::positionControl_throw( _out_rControl, _rUnoObject.GetLogicRect(), &_rDevice );
-
- // proper zoom
- UnoControlContactHelper::setControlZoom( _out_rControl, &_rDevice );
+ // proper geometry
+ UnoControlContactHelper::adjustControlGeometry_throw(
+ _out_rControl,
+ _rUnoObject.GetLogicRect(),
+ _rDevice.GetViewTransformation(),
+ _rDevice.GetInverseViewTransformation()
+ );
- // #107049# set design mode before peer is created,
- // this is also needed for accessibility
- _out_rControl.setDesignMode( _rPageView.isDesignMode() );
+ // #107049# set design mode before peer is created,
+ // this is also needed for accessibility
+ _out_rControl.setDesignMode( _rPageView.isDesignMode() );
- // adjust the initial visibility according to the visibility of the layer
- // 2003-06-03 - #110592# - fs@openoffice.org
- impl_adjustControlVisibilityToLayerVisibility_throw( _out_rControl, _rUnoObject, _rPageView, false, true );
+ // adjust the initial visibility according to the visibility of the layer
+ // 2003-06-03 - #110592# - fs@openoffice.org
+ impl_adjustControlVisibilityToLayerVisibility_throw( _out_rControl, _rUnoObject, _rPageView, false, true );
- // add the control to the respective control container
- // #108327# do this last
- Reference< XControlContainer > xControlContainer( _rPageView.getControlContainer( _rDevice ) );
- if ( xControlContainer.is() )
- xControlContainer->addControl( sControlServiceName, _out_rControl.getControl() );
+ // add the control to the respective control container
+ // #108327# do this last
+ Reference< XControlContainer > xControlContainer( _rPageView.getControlContainer( _rDevice ) );
+ if ( xControlContainer.is() )
+ xControlContainer->addControl( sControlServiceName, _out_rControl.getControl() );
- bSuccess = true;
- }
- while ( false );
+ bSuccess = true;
}
catch( const Exception& )
{
@@ -1257,18 +1231,16 @@ namespace sdr { namespace contact {
//--------------------------------------------------------------------
bool ViewObjectContactOfUnoControl_Impl::isPrintableControl() const
{
- if ( !m_aControl.is() )
+ SdrUnoObj* pUnoObject( NULL );
+ if ( !getUnoObject( pUnoObject ) )
return false;
bool bIsPrintable = false;
try
{
- Reference< XPropertySet > xModelProperties( m_aControl.getModel(), UNO_QUERY );
- Reference< XPropertySetInfo > xPropertyInfo( xModelProperties.is() ? xModelProperties->getPropertySetInfo() : Reference< XPropertySetInfo >() );
- const ::rtl::OUString sPrintablePropertyName( RTL_CONSTASCII_USTRINGPARAM( "Printable" ) );
-
- if ( xPropertyInfo.is() && xPropertyInfo->hasPropertyByName( sPrintablePropertyName ) )
- OSL_VERIFY( xModelProperties->getPropertyValue( sPrintablePropertyName ) >>= bIsPrintable );
+ Reference< XPropertySet > xModelProperties( pUnoObject->GetUnoControlModel(), UNO_QUERY_THROW );
+ static const ::rtl::OUString s_sPrintablePropertyName( RTL_CONSTASCII_USTRINGPARAM( "Printable" ) );
+ OSL_VERIFY( xModelProperties->getPropertyValue( s_sPrintablePropertyName ) >>= bIsPrintable );
}
catch( const Exception& )
{
@@ -1411,15 +1383,20 @@ namespace sdr { namespace contact {
if ( !xNewControl.is() )
return;
+ ENSURE_OR_THROW( m_pOutputDeviceForWindow, "calling this without /me having an output device should be impossible." );
+
DBG_ASSERT( xNewControl->getModel() == m_aControl.getModel(), "ViewObjectContactOfUnoControl_Impl::elementReplaced: another model at the new control?" );
// another model should - in the drawing layer - also imply another SdrUnoObj, which
// should also result in new ViewContact, and thus in new ViewObjectContacts
impl_switchControlListening_nothrow( false );
+ ControlHolder aNewControl( xNewControl );
+ aNewControl.setZoom( m_aControl.getZoom() );
+ aNewControl.setPosSize( m_aControl.getPosSize() );
+ aNewControl.setDesignMode( impl_isControlDesignMode_nothrow() );
+
m_aControl = xNewControl;
- positionAndZoomControl();
- m_aControl.setDesignMode( impl_isControlDesignMode_nothrow() );
m_bControlIsVisible = m_aControl.isVisible();
impl_switchControlListening_nothrow( true );
@@ -1449,30 +1426,96 @@ namespace sdr { namespace contact {
}
}
+ //====================================================================
+ //= LazyControlCreationPrimitive2D
+ //====================================================================
//--------------------------------------------------------------------
- bool ViewObjectContactOfUnoControl_Impl::belongsToDevice( const OutputDevice* _pDevice ) const
+ bool LazyControlCreationPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
{
- DBG_ASSERT( _pDevice, "ViewObjectContactOfUnoControl_Impl::belongsToDevice: invalid device!" );
+ if ( !BasePrimitive2D::operator==( rPrimitive ) )
+ return false;
- OSL_PRECOND( !impl_isDisposed_nofail(), "ViewObjectContactOfUnoControl_Impl::belongsToDevice: already disposed!" );
- if ( impl_isDisposed_nofail() )
+ const LazyControlCreationPrimitive2D* pRHS = dynamic_cast< const LazyControlCreationPrimitive2D* >( &rPrimitive );
+ if ( !pRHS )
return false;
- if ( m_pOutputDeviceForWindow )
- {
- if ( _pDevice == m_pOutputDeviceForWindow )
- return true;
+ if ( m_pVOCImpl != pRHS->m_pVOCImpl )
return false;
- }
- ObjectContactOfPageView* pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &m_pAntiImpl->GetObjectContact() );
- if ( pPageViewContact )
- return ( _pDevice == &imp_getPageViewDevice_nothrow( *pPageViewContact ) );
+ if ( m_aTransformation != pRHS->m_aTransformation )
+ return false;
- DBG_ERROR( "ViewObjectContactOfUnoControl_Impl::belongsToDevice: could not determine the device I belong to!" );
- return false;
+ return true;
+ }
+
+ //--------------------------------------------------------------------
+ void LazyControlCreationPrimitive2D::getTransformation( const ViewContactOfUnoControl& _rVOC, ::basegfx::B2DHomMatrix& _out_Transformation )
+ {
+ // Do use model data directly to create the correct geometry. Do NOT
+ // use getBoundRect()/getSnapRect() here; tese will use the sequence of
+ // primitives themselves in the long run.
+ const Rectangle aSdrGeoData( _rVOC.GetSdrUnoObj().GetGeoRect() );
+ const basegfx::B2DRange aRange(
+ aSdrGeoData.Left(),
+ aSdrGeoData.Top(),
+ aSdrGeoData.Right(),
+ aSdrGeoData.Bottom()
+ );
+
+ _out_Transformation.identity();
+ _out_Transformation.set( 0, 0, aRange.getWidth() );
+ _out_Transformation.set( 1, 1, aRange.getHeight() );
+ _out_Transformation.set( 0, 2, aRange.getMinX() );
+ _out_Transformation.set( 1, 2, aRange.getMinY() );
}
+ //--------------------------------------------------------------------
+ ::basegfx::B2DRange LazyControlCreationPrimitive2D::getB2DRange( const ::drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/ ) const
+ {
+ ::basegfx::B2DRange aRange( 0.0, 0.0, 1.0, 1.0 );
+ aRange.transform( m_aTransformation );
+ return aRange;
+ }
+
+ //--------------------------------------------------------------------
+ ::drawinglayer::primitive2d::Primitive2DSequence LazyControlCreationPrimitive2D::get2DDecomposition( const ::drawinglayer::geometry::ViewInformation2D& _rViewInformation ) const
+ {
+ if ( m_pVOCImpl->hasControl() )
+ m_pVOCImpl->positionAndZoomControl( _rViewInformation.getObjectToViewTransformation() );
+ return BasePrimitive2D::get2DDecomposition( _rViewInformation );
+ }
+
+ //--------------------------------------------------------------------
+ ::drawinglayer::primitive2d::Primitive2DSequence LazyControlCreationPrimitive2D::createLocalDecomposition( const ::drawinglayer::geometry::ViewInformation2D& _rViewInformation ) const
+ {
+ // force control here to make it a VCL ChildWindow. Will be fetched
+ // and used below by getExistentControl()
+ m_pVOCImpl->ensureControl();
+ m_pVOCImpl->positionAndZoomControl( _rViewInformation.getObjectToViewTransformation() );
+
+ // get needed data
+ const ViewContactOfUnoControl& rViewContactOfUnoControl( m_pVOCImpl->getViewContact() );
+ Reference< XControlModel > xControlModel( rViewContactOfUnoControl.GetSdrUnoObj().GetUnoControlModel() );
+ const ControlHolder& rControl( m_pVOCImpl->getExistentControl() );
+
+ // check if we already have an XControl.
+ if ( !xControlModel.is() || !rControl.is() )
+ // use the default mechanism. This will create a ControlPrimitive2D without
+ // handing over a XControl. If not even a XControlModel exists, it will
+ // create the SdrObject fallback visualisation
+ return rViewContactOfUnoControl.getViewIndependentPrimitive2DSequence();
+
+ // create a primitive and hand over the existing xControl. This will
+ // allow the primitive to not need to create another one on demand.
+ const drawinglayer::primitive2d::Primitive2DReference xRetval( new ::drawinglayer::primitive2d::ControlPrimitive2D(
+ m_aTransformation, xControlModel, rControl.getControl() ) );
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1);
+ }
+
+ //--------------------------------------------------------------------
+ ImplPrimitrive2DIDBlock( LazyControlCreationPrimitive2D, PRIMITIVE2D_ID_SDRCONTROLPRIMITIVE2D )
+
//====================================================================
//= ViewObjectContactOfUnoControl
//====================================================================
@@ -1522,20 +1565,6 @@ namespace sdr { namespace contact {
}
//--------------------------------------------------------------------
- void ViewObjectContactOfUnoControl::positionControlForPaint( const DisplayInfo& _rDisplayInfo ) const
- {
- VOCGuard aGuard( *m_pImpl );
-
- // ensure we have a control. If we don't, then the Drawing Layer might be tempted to
- // never draw the complete form layer.
- // #i75095# / 2007-03-05 / frank.schoenheit@sun.com
- m_pImpl->ensureControl( _rDisplayInfo );
-
- // position the control
- m_pImpl->positionControlForPaint( _rDisplayInfo );
- }
-
- //--------------------------------------------------------------------
void ViewObjectContactOfUnoControl::ensureControlVisibility( bool _bVisible ) const
{
VOCGuard aGuard( *m_pImpl );
@@ -1582,70 +1611,32 @@ namespace sdr { namespace contact {
}
//--------------------------------------------------------------------
- bool ViewObjectContactOfUnoControl::belongsToDevice( const OutputDevice* _pDevice ) const
+ drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfUnoControl::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const
{
- VOCGuard aGuard( *m_pImpl );
- return m_pImpl->belongsToDevice( _pDevice );
+ if ( m_pImpl->isDisposed() )
+ // our control already died.
+ // TODO: Is it worth re-creating the control? Finally, this is a pathological situation, it means some instance
+ // disposed the control though it doesn't own it. So, /me thinks we should not bother here.
+ return drawinglayer::primitive2d::Primitive2DSequence();
+
+ ::drawinglayer::primitive2d::Primitive2DReference xPrimitive( new LazyControlCreationPrimitive2D( m_pImpl ) );
+ return ::drawinglayer::primitive2d::Primitive2DSequence( &xPrimitive, 1 );
}
//--------------------------------------------------------------------
- drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfUnoControl::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const
- {
- // force control here to make it a VCL ChildWindow. Will be fetched
- // and used below by getExistentControl()
- m_pImpl->ensureControl();
- m_pImpl->positionControlForPaint(rDisplayInfo);
-
- // get needed data
- const ViewContactOfUnoControl& rViewContactOfUnoControl(static_cast< const ViewContactOfUnoControl& >(GetViewContact()));
- Reference< XControlModel > xControlModel(rViewContactOfUnoControl.GetSdrUnoObj().GetUnoControlModel());
- const ControlHolder& rControl(m_pImpl->getExistentControl());
-
- // check if we already have a XControl.
- if(xControlModel.is() && rControl.is())
- {
- // create a primitive and hand over the existing xControl. This will
- // allow the primitive to not need to create another one on demand.
- // Do use model data directly to create the correct geometry. Do NOT
- // use getBoundRect()/getSnapRect() here; tese will use the sequence of
- // primitives themselves in the long run.
- const Rectangle aUnoControlModelData(rViewContactOfUnoControl.GetSdrUnoObj().GetGeoRect());
- const basegfx::B2DRange aRange(aUnoControlModelData.Left(), aUnoControlModelData.Top(), aUnoControlModelData.Right(), aUnoControlModelData.Bottom());
-
- // create object transform
- basegfx::B2DHomMatrix aTransform;
- aTransform.set(0, 0, aRange.getWidth());
- aTransform.set(1, 1, aRange.getHeight());
- aTransform.set(0, 2, aRange.getMinX());
- aTransform.set(1, 2, aRange.getMinY());
-
- // create control primitive with existing XControl
- const drawinglayer::primitive2d::Primitive2DReference xRetval(new drawinglayer::primitive2d::ControlPrimitive2D(
- aTransform, xControlModel, rControl.getControl()));
-
- return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1);
- }
- else
- {
- // use the default mechanism. This will create a ControlPrimitive2D without
- // handing over a XControl. If not even a XControlModel exists, it will
- // create the SdrObject fallback visualisation
- return rViewContactOfUnoControl.getViewIndependentPrimitive2DSequence();
- }
- }
-
void ViewObjectContactOfUnoControl::propertyChange()
{
// graphical invalidate at all views
ActionChanged();
// #i93318# flush Primitive2DSequence to force recreation with updated XControlModel
- // since e.g. background color has changed and existing decompositions are evtl. no
+ // since e.g. background color has changed and existing decompositions are possibly no
// longer valid. Unfortunately this is not detected from ControlPrimitive2D::operator==
// since it only has a uno reference to the XControlModel
flushPrimitive2DSequence();
}
+ //--------------------------------------------------------------------
void ViewObjectContactOfUnoControl::ActionChanged()
{
// call parent
@@ -1721,6 +1712,14 @@ namespace sdr { namespace contact {
DBG_DTOR( UnoControlPrintOrPreviewContact, NULL );
}
+ //--------------------------------------------------------------------
+ drawinglayer::primitive2d::Primitive2DSequence UnoControlPrintOrPreviewContact::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo ) const
+ {
+ if ( !m_pImpl->isPrintableControl() )
+ return drawinglayer::primitive2d::Primitive2DSequence();
+ return ViewObjectContactOfUnoControl::createPrimitive2DSequence( rDisplayInfo );
+ }
+
//====================================================================
//= UnoControlPDFExportContact
//====================================================================
diff --git a/svx/source/sdr/overlay/makefile.mk b/svx/source/sdr/overlay/makefile.mk
index 1243a71e2585..bb6489606283 100644
--- a/svx/source/sdr/overlay/makefile.mk
+++ b/svx/source/sdr/overlay/makefile.mk
@@ -43,22 +43,20 @@ ENABLE_EXCEPTIONS=TRUE
SLOFILES=\
$(SLO)$/overlayanimatedbitmapex.obj \
- $(SLO)$/overlaybitmap.obj \
$(SLO)$/overlaybitmapex.obj \
+ $(SLO)$/overlaycrosshair.obj \
+ $(SLO)$/overlayhatchrect.obj \
+ $(SLO)$/overlayhelpline.obj \
$(SLO)$/overlayline.obj \
- $(SLO)$/overlaylinestriped.obj \
$(SLO)$/overlaymanager.obj \
$(SLO)$/overlaymanagerbuffered.obj \
$(SLO)$/overlayobject.obj \
+ $(SLO)$/overlayobjectcell.obj \
$(SLO)$/overlayobjectlist.obj \
- $(SLO)$/overlaytriangle.obj \
- $(SLO)$/overlaycrosshair.obj \
- $(SLO)$/overlayhelpline.obj \
- $(SLO)$/overlayhatchrect.obj \
- $(SLO)$/overlayrollingrectangle.obj \
$(SLO)$/overlaypolypolygon.obj \
- $(SLO)$/overlaysdrobject.obj \
$(SLO)$/overlayprimitive2dsequenceobject.obj \
- $(SLO)$/overlayobjectcell.obj
+ $(SLO)$/overlayrollingrectangle.obj \
+ $(SLO)$/overlaytools.obj \
+ $(SLO)$/overlaytriangle.obj
.INCLUDE : target.mk
diff --git a/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx b/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx
index 4781cc247e7e..dcfeb0ae3dc2 100644
--- a/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx
+++ b/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx
@@ -34,9 +34,8 @@
#include <vcl/salbtype.hxx>
#include <vcl/outdev.hxx>
#include <svx/sdr/overlay/overlaymanager.hxx>
-
-// #i77674#
#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/overlay/overlaytools.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -57,43 +56,30 @@ namespace sdr
}
}
- void OverlayAnimatedBitmapEx::drawGeometry(OutputDevice& rOutputDevice)
- {
- // #i77674# calculate discrete top-left
- basegfx::B2DPoint aDiscreteTopLeft(rOutputDevice.GetViewTransformation() * getBasePosition());
- aDiscreteTopLeft -= (mbOverlayState)
- ? basegfx::B2DPoint((double)mnCenterX1, (double)mnCenterY1)
- : basegfx::B2DPoint((double)mnCenterX2, (double)mnCenterY2);
-
- // remember MapMode and switch to pixels
- const bool bMapModeWasEnabled(rOutputDevice.IsMapModeEnabled());
- rOutputDevice.EnableMapMode(false);
-
- // draw the bitmap
- const Point aPixelTopLeft((sal_Int32)floor(aDiscreteTopLeft.getX()), (sal_Int32)floor(aDiscreteTopLeft.getY()));
- rOutputDevice.DrawBitmapEx(aPixelTopLeft, (mbOverlayState) ? maBitmapEx1 : maBitmapEx2);
-
- // restore MapMode
- rOutputDevice.EnableMapMode(bMapModeWasEnabled);
- }
-
- void OverlayAnimatedBitmapEx::createBaseRange(OutputDevice& rOutputDevice)
+ drawinglayer::primitive2d::Primitive2DSequence OverlayAnimatedBitmapEx::createOverlayObjectPrimitive2DSequence()
{
- // #i77674# calculate discrete top-left
- basegfx::B2DPoint aDiscreteTopLeft(rOutputDevice.GetViewTransformation() * getBasePosition());
- aDiscreteTopLeft -= (mbOverlayState)
- ? basegfx::B2DPoint((double)mnCenterX1, (double)mnCenterY1)
- : basegfx::B2DPoint((double)mnCenterX2, (double)mnCenterY2);
-
- // calculate discrete range
- const Size aBitmapPixelSize((mbOverlayState) ? maBitmapEx1.GetSizePixel() : maBitmapEx2.GetSizePixel());
- const basegfx::B2DRange aDiscreteRange(
- aDiscreteTopLeft.getX(), aDiscreteTopLeft.getY(),
- aDiscreteTopLeft.getX() + (double)aBitmapPixelSize.getWidth(), aDiscreteTopLeft.getY() + (double)aBitmapPixelSize.getHeight());
-
- // set and go back to logic range
- maBaseRange = aDiscreteRange;
- maBaseRange.transform(rOutputDevice.GetInverseViewTransformation());
+ if(mbOverlayState)
+ {
+ const drawinglayer::primitive2d::Primitive2DReference aPrimitive(
+ new drawinglayer::primitive2d::OverlayBitmapExPrimitive(
+ getBitmapEx1(),
+ getBasePosition(),
+ getCenterX1(),
+ getCenterY1()));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&aPrimitive, 1);
+ }
+ else
+ {
+ const drawinglayer::primitive2d::Primitive2DReference aPrimitive(
+ new drawinglayer::primitive2d::OverlayBitmapExPrimitive(
+ getBitmapEx2(),
+ getBasePosition(),
+ getCenterX2(),
+ getCenterY2()));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&aPrimitive, 1);
+ }
}
OverlayAnimatedBitmapEx::OverlayAnimatedBitmapEx(
@@ -111,10 +97,10 @@ namespace sdr
mnCenterX1(nCenX1), mnCenterY1(nCenY1),
mnCenterX2(nCenX2), mnCenterY2(nCenY2),
mnBlinkTime(nBlinkTime),
- mbOverlayState(sal_False)
+ mbOverlayState(false)
{
// set AllowsAnimation flag to mark this object as animation capable
- mbAllowsAnimation = sal_True;
+ mbAllowsAnimation = true;
// #i53216# check blink time value range
impCheckBlinkTimeValueRange();
@@ -213,11 +199,11 @@ namespace sdr
// switch state
if(mbOverlayState)
{
- mbOverlayState = sal_False;
+ mbOverlayState = false;
}
else
{
- mbOverlayState = sal_True;
+ mbOverlayState = true;
}
// re-insert me as event
@@ -227,12 +213,6 @@ namespace sdr
objectChange();
}
}
-
- void OverlayAnimatedBitmapEx::zoomHasChanged()
- {
- // reset validity of range in logical coor to force recalculation
- mbIsChanged = sal_True;
- }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlaybitmap.cxx b/svx/source/sdr/overlay/overlaybitmap.cxx
deleted file mode 100644
index cc782d38bc7d..000000000000
--- a/svx/source/sdr/overlay/overlaybitmap.cxx
+++ /dev/null
@@ -1,162 +0,0 @@
-/*************************************************************************
- *
- * 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: overlaybitmap.cxx,v $
- * $Revision: 1.5 $
- *
- * 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_svx.hxx"
-#include <svx/sdr/overlay/overlaybitmap.hxx>
-#include <vcl/salbtype.hxx>
-#include <vcl/outdev.hxx>
-#include <vcl/bitmapex.hxx>
-
-// #i77674#
-#include <basegfx/matrix/b2dhommatrix.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace overlay
- {
- void OverlayBitmap::drawGeometry(OutputDevice& rOutputDevice)
- {
- // #i77674# calculate discrete top-left
- basegfx::B2DPoint aDiscreteTopLeft(rOutputDevice.GetViewTransformation() * getBasePosition());
- aDiscreteTopLeft -= basegfx::B2DPoint((double)mnCenterX, (double)mnCenterY);
-
- // remember MapMode and switch to pixels
- const bool bMapModeWasEnabled(rOutputDevice.IsMapModeEnabled());
- rOutputDevice.EnableMapMode(false);
-
- // draw the bitmap
- const Point aPixelTopLeft((sal_Int32)floor(aDiscreteTopLeft.getX()), (sal_Int32)floor(aDiscreteTopLeft.getY()));
-
- if(mbUseTransparenceColor)
- {
- BitmapEx aBitmapEx(maBitmap, getBaseColor());
- rOutputDevice.DrawBitmapEx(aPixelTopLeft, aBitmapEx);
- }
- else
- {
- rOutputDevice.DrawBitmap(aPixelTopLeft, maBitmap);
- }
-
- // restore MapMode
- rOutputDevice.EnableMapMode(bMapModeWasEnabled);
- }
-
- void OverlayBitmap::createBaseRange(OutputDevice& rOutputDevice)
- {
- // #i77674# calculate discrete top-left
- basegfx::B2DPoint aDiscreteTopLeft(rOutputDevice.GetViewTransformation() * getBasePosition());
- aDiscreteTopLeft -= basegfx::B2DPoint((double)mnCenterX, (double)mnCenterY);
-
- // calculate discrete range
- const Size aBitmapPixelSize(maBitmap.GetSizePixel());
- const basegfx::B2DRange aDiscreteRange(
- aDiscreteTopLeft.getX(), aDiscreteTopLeft.getY(),
- aDiscreteTopLeft.getX() + (double)aBitmapPixelSize.getWidth(), aDiscreteTopLeft.getY() + (double)aBitmapPixelSize.getHeight());
-
- // set and go back to logic range
- maBaseRange = aDiscreteRange;
- maBaseRange.transform(rOutputDevice.GetInverseViewTransformation());
- }
-
- OverlayBitmap::OverlayBitmap(
- const basegfx::B2DPoint& rBasePos,
- const Bitmap& rBitmap,
- sal_uInt16 nCenX, sal_uInt16 nCenY,
- sal_Bool bUseTransCol,
- Color aTransColor)
- : OverlayObjectWithBasePosition(rBasePos, aTransColor),
- maBitmap(rBitmap),
- mnCenterX(nCenX),
- mnCenterY(nCenY),
- mbUseTransparenceColor(bUseTransCol)
- {
- }
-
- OverlayBitmap::~OverlayBitmap()
- {
- }
-
- void OverlayBitmap::setBitmap(const Bitmap& rNew)
- {
- if(rNew != maBitmap)
- {
- // remember new Bitmap
- maBitmap = rNew;
-
- // register change (after change)
- objectChange();
- }
- }
-
- void OverlayBitmap::setTransparenceUsed(sal_Bool bNew)
- {
- if(bNew != mbUseTransparenceColor)
- {
- // remember new value
- mbUseTransparenceColor = bNew;
-
- // register change (after change)
- objectChange();
- }
- }
-
- void OverlayBitmap::setCenterXY(sal_uInt16 nNewX, sal_uInt16 nNewY)
- {
- if(nNewX != mnCenterX || nNewY != mnCenterY)
- {
- // remember new values
- if(nNewX != mnCenterX)
- {
- mnCenterX = nNewX;
- }
-
- if(nNewY != mnCenterY)
- {
- mnCenterY = nNewY;
- }
-
- // register change (after change)
- objectChange();
- }
- }
-
- void OverlayBitmap::zoomHasChanged()
- {
- // reset validity of range in logical coor to force recalculation
- mbIsChanged = sal_True;
- }
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
-// eof
diff --git a/svx/source/sdr/overlay/overlaybitmapex.cxx b/svx/source/sdr/overlay/overlaybitmapex.cxx
index 9f0e183f420c..cd50c9149b27 100644
--- a/svx/source/sdr/overlay/overlaybitmapex.cxx
+++ b/svx/source/sdr/overlay/overlaybitmapex.cxx
@@ -33,9 +33,8 @@
#include <svx/sdr/overlay/overlaybitmapex.hxx>
#include <vcl/salbtype.hxx>
#include <vcl/outdev.hxx>
-
-// #i77674#
#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/overlay/overlaytools.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -43,39 +42,16 @@ namespace sdr
{
namespace overlay
{
- void OverlayBitmapEx::drawGeometry(OutputDevice& rOutputDevice)
- {
- // #i77674# calculate discrete top-left
- basegfx::B2DPoint aDiscreteTopLeft(rOutputDevice.GetViewTransformation() * getBasePosition());
- aDiscreteTopLeft -= basegfx::B2DPoint((double)mnCenterX, (double)mnCenterY);
-
- // remember MapMode and switch to pixels
- const bool bMapModeWasEnabled(rOutputDevice.IsMapModeEnabled());
- rOutputDevice.EnableMapMode(false);
-
- // draw the bitmap
- const Point aPixelTopLeft((sal_Int32)floor(aDiscreteTopLeft.getX()), (sal_Int32)floor(aDiscreteTopLeft.getY()));
- rOutputDevice.DrawBitmapEx(aPixelTopLeft, maBitmapEx);
-
- // restore MapMode
- rOutputDevice.EnableMapMode(bMapModeWasEnabled);
- }
-
- void OverlayBitmapEx::createBaseRange(OutputDevice& rOutputDevice)
+ drawinglayer::primitive2d::Primitive2DSequence OverlayBitmapEx::createOverlayObjectPrimitive2DSequence()
{
- // #i77674# calculate discrete top-left
- basegfx::B2DPoint aDiscreteTopLeft(rOutputDevice.GetViewTransformation() * getBasePosition());
- aDiscreteTopLeft -= basegfx::B2DPoint((double)mnCenterX, (double)mnCenterY);
-
- // calculate discrete range
- const Size aBitmapPixelSize(maBitmapEx.GetSizePixel());
- const basegfx::B2DRange aDiscreteRange(
- aDiscreteTopLeft.getX(), aDiscreteTopLeft.getY(),
- aDiscreteTopLeft.getX() + (double)aBitmapPixelSize.getWidth(), aDiscreteTopLeft.getY() + (double)aBitmapPixelSize.getHeight());
-
- // set and go back to logic range
- maBaseRange = aDiscreteRange;
- maBaseRange.transform(rOutputDevice.GetInverseViewTransformation());
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new drawinglayer::primitive2d::OverlayBitmapExPrimitive(
+ getBitmapEx(),
+ getBasePosition(),
+ getCenterX(),
+ getCenterY()));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
}
OverlayBitmapEx::OverlayBitmapEx(
@@ -124,12 +100,6 @@ namespace sdr
objectChange();
}
}
-
- void OverlayBitmapEx::zoomHasChanged()
- {
- // reset validity of range in logical coor to force recalculation
- mbIsChanged = sal_True;
- }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlaycrosshair.cxx b/svx/source/sdr/overlay/overlaycrosshair.cxx
index 7107817fad04..90bd99bc289e 100644
--- a/svx/source/sdr/overlay/overlaycrosshair.cxx
+++ b/svx/source/sdr/overlay/overlaycrosshair.cxx
@@ -34,6 +34,8 @@
#include <tools/gen.hxx>
#include <vcl/salbtype.hxx>
#include <vcl/outdev.hxx>
+#include <svx/sdr/overlay/overlaytools.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -41,31 +43,33 @@ namespace sdr
{
namespace overlay
{
- void OverlayCrosshairStriped::drawGeometry(OutputDevice& rOutputDevice)
+ drawinglayer::primitive2d::Primitive2DSequence OverlayCrosshairStriped::createOverlayObjectPrimitive2DSequence()
{
- const Point aEmptyPoint;
- const Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel());
- const Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel));
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
- const basegfx::B2DPoint aStartA(aVisibleLogic.Left(), getBasePosition().getY());
- const basegfx::B2DPoint aEndA(aVisibleLogic.Right(), getBasePosition().getY());
- ImpDrawLineStriped(rOutputDevice, aStartA, aEndA);
+ if(getOverlayManager())
+ {
+ const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor());
+ const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor());
+ const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel());
+
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new drawinglayer::primitive2d::OverlayCrosshairPrimitive(
+ getBasePosition(),
+ aRGBColorA,
+ aRGBColorB,
+ fStripeLengthPixel));
+
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
+ }
- const basegfx::B2DPoint aStartB(getBasePosition().getX(), aVisibleLogic.Top());
- const basegfx::B2DPoint aEndB(getBasePosition().getX(), aVisibleLogic.Bottom());
- ImpDrawLineStriped(rOutputDevice, aStartB, aEndB);
+ return aRetval;
}
- void OverlayCrosshairStriped::createBaseRange(OutputDevice& rOutputDevice)
+ void OverlayCrosshairStriped::stripeDefinitionHasChanged()
{
- // reset range and expand it
- const Point aEmptyPoint;
- const Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel());
- const Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel));
-
- maBaseRange.reset();
- maBaseRange.expand(basegfx::B2DPoint(aVisibleLogic.Left(), aVisibleLogic.Top()));
- maBaseRange.expand(basegfx::B2DPoint(aVisibleLogic.Right(), aVisibleLogic.Bottom()));
+ // react on OverlayManager's stripe definition change
+ objectChange();
}
OverlayCrosshairStriped::OverlayCrosshairStriped(const basegfx::B2DPoint& rBasePos)
@@ -76,64 +80,6 @@ namespace sdr
OverlayCrosshairStriped::~OverlayCrosshairStriped()
{
}
-
- sal_Bool OverlayCrosshairStriped::isHit(const basegfx::B2DPoint& rPos, double fTol) const
- {
- if(isHittable())
- {
- // test vertical
- if(rPos.getY() >= (getBasePosition().getY() - fTol)
- && rPos.getY() <= (getBasePosition().getY() + fTol))
- {
- return sal_True;
- }
-
- // test horizontal
- if(rPos.getX() >= (getBasePosition().getX() - fTol)
- && rPos.getX() <= (getBasePosition().getX() + fTol))
- {
- return sal_True;
- }
- }
-
- return sal_False;
- }
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace overlay
- {
- void OverlayCrosshair::drawGeometry(OutputDevice& rOutputDevice)
- {
- const Point aBasePos(FRound(getBasePosition().getX()), FRound(getBasePosition().getY()));
- const Point aEmptyPoint;
- const Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel());
- const Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel));
-
- rOutputDevice.SetLineColor(getBaseColor());
- rOutputDevice.SetFillColor();
-
- rOutputDevice.DrawLine(Point(aVisibleLogic.Left(), aBasePos.Y()), Point(aVisibleLogic.Right(), aBasePos.Y()));
- rOutputDevice.DrawLine(Point(aBasePos.X(), aVisibleLogic.Top()), Point(aBasePos.X(), aVisibleLogic.Bottom()));
- }
-
- OverlayCrosshair::OverlayCrosshair(
- const basegfx::B2DPoint& rBasePos,
- Color aLineColor)
- : OverlayCrosshairStriped(rBasePos)
- {
- // set base color here, OverlayCrosshairStriped constructor has set
- // it to it's own default.
- maBaseColor = aLineColor;
- }
-
- OverlayCrosshair::~OverlayCrosshair()
- {
- }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlayhatchrect.cxx b/svx/source/sdr/overlay/overlayhatchrect.cxx
index a15d38f16bc9..9bda13816029 100644
--- a/svx/source/sdr/overlay/overlayhatchrect.cxx
+++ b/svx/source/sdr/overlay/overlayhatchrect.cxx
@@ -38,6 +38,7 @@
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/numeric/ftools.hxx>
+#include <svx/sdr/overlay/overlaytools.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -45,81 +46,34 @@ namespace sdr
{
namespace overlay
{
- basegfx::B2DPolyPolygon OverlayHatchRect::getGeometry(OutputDevice& rOutputDevice)
+ drawinglayer::primitive2d::Primitive2DSequence OverlayHatchRect::createOverlayObjectPrimitive2DSequence()
{
- const basegfx::B2DPoint aDiscreteTopLeft(rOutputDevice.GetViewTransformation() * getBasePosition());
- const basegfx::B2DPoint aDiscreteBottomRight(rOutputDevice.GetViewTransformation() * getSecondPosition());
-
- basegfx::B2DRange aInnerRange(
- floor(aDiscreteTopLeft.getX()), floor(aDiscreteTopLeft.getY()),
- floor(aDiscreteBottomRight.getX()), floor(aDiscreteBottomRight.getY()));
- basegfx::B2DRange aOuterRange(aInnerRange);
- basegfx::B2DPolyPolygon aRetval;
-
- aOuterRange.grow(getDiscreteWidth() * 0.5);
- aInnerRange.grow(getDiscreteWidth() * -0.5);
-
- aRetval.append(basegfx::tools::createPolygonFromRect(aOuterRange));
- aRetval.append(basegfx::tools::createPolygonFromRect(aInnerRange));
-
- if(!basegfx::fTools::equalZero(mfRotation))
- {
- basegfx::B2DHomMatrix aTransform;
-
- aTransform.translate(-aOuterRange.getMinX(), -aOuterRange.getMinY());
- aTransform.rotate(getRotation());
- aTransform.translate(aOuterRange.getMinX(), aOuterRange.getMinY());
-
- aRetval.transform(aTransform);
- }
-
- return aRetval;
- }
-
- void OverlayHatchRect::drawGeometry(OutputDevice& rOutputDevice)
- {
- const basegfx::B2DPolyPolygon aB2DGeometry(getGeometry(rOutputDevice));
- const bool bMapModeWasEnabled(rOutputDevice.IsMapModeEnabled());
-
- // use VCL polygon and methodology for paint
- double fFullRotation(getHatchRotation() - getRotation());
-
- while(fFullRotation < 0.0)
- {
- fFullRotation += F_2PI;
- }
-
- while(fFullRotation >= F_2PI)
- {
- fFullRotation -= F_2PI;
- }
-
- const Hatch aHatch(HATCH_SINGLE, getBaseColor(), 3, (sal_uInt16)basegfx::fround(fFullRotation * ( 10.0 / F_PI180)));
- rOutputDevice.EnableMapMode(false);
- rOutputDevice.DrawHatch(PolyPolygon(aB2DGeometry), aHatch);
- rOutputDevice.EnableMapMode(bMapModeWasEnabled);
- }
-
- void OverlayHatchRect::createBaseRange(OutputDevice& rOutputDevice)
- {
- // reset range and expand with fresh geometry
- maBaseRange = getGeometry(rOutputDevice).getB2DRange();
-
- // getGeometry data is in discrete coordinates (pixels), so transform back to
- // world coordinates (logic)
- maBaseRange.transform(rOutputDevice.GetInverseViewTransformation());
+ const basegfx::B2DRange aHatchRange(getBasePosition(), getSecondPosition());
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new drawinglayer::primitive2d::OverlayHatchRectanglePrimitive(
+ aHatchRange,
+ 3.0,
+ getHatchRotation(),
+ getBaseColor().getBColor(),
+ getDiscreteGrow(),
+ getDiscreteShrink(),
+ getRotation()));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
}
OverlayHatchRect::OverlayHatchRect(
const basegfx::B2DPoint& rBasePosition,
const basegfx::B2DPoint& rSecondPosition,
const Color& rHatchColor,
- double fDiscreteWidth,
+ double fDiscreteGrow,
+ double fDiscreteShrink,
double fHatchRotation,
double fRotation)
: OverlayObjectWithBasePosition(rBasePosition, rHatchColor),
maSecondPosition(rSecondPosition),
- mfDiscreteWidth(fDiscreteWidth),
+ mfDiscreteGrow(fDiscreteGrow),
+ mfDiscreteShrink(fDiscreteShrink),
mfHatchRotation(fHatchRotation),
mfRotation(fRotation)
{
@@ -136,12 +90,6 @@ namespace sdr
objectChange();
}
}
-
- void OverlayHatchRect::zoomHasChanged()
- {
- // reset validity of range in logical coor to force recalculation
- mbIsChanged = sal_True;
- }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlayhelpline.cxx b/svx/source/sdr/overlay/overlayhelpline.cxx
index 5de8d071a292..12cb5ac660ba 100644
--- a/svx/source/sdr/overlay/overlayhelpline.cxx
+++ b/svx/source/sdr/overlay/overlayhelpline.cxx
@@ -35,6 +35,8 @@
#include <vcl/salbtype.hxx>
#include <vcl/outdev.hxx>
#include <basegfx/vector/b2dvector.hxx>
+#include <svx/sdr/overlay/overlaytools.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -42,79 +44,38 @@ namespace sdr
{
namespace overlay
{
- void OverlayHelplineStriped::drawGeometry(OutputDevice& rOutputDevice)
+ drawinglayer::primitive2d::Primitive2DSequence OverlayHelplineStriped::createOverlayObjectPrimitive2DSequence()
{
- // prepare OutputDevice
- const Point aEmptyPoint;
- const Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel());
- const Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel));
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
- switch(meKind)
+ if(getOverlayManager())
{
- case SDRHELPLINE_VERTICAL :
- {
- const basegfx::B2DPoint aStart(getBasePosition().getX(), aVisibleLogic.Top());
- const basegfx::B2DPoint aEnd(getBasePosition().getX(), aVisibleLogic.Bottom());
- ImpDrawLineStriped(rOutputDevice, aStart, aEnd);
- break;
- }
-
- case SDRHELPLINE_HORIZONTAL :
- {
- const basegfx::B2DPoint aStart(aVisibleLogic.Left(), getBasePosition().getY());
- const basegfx::B2DPoint aEnd(aVisibleLogic.Right(), getBasePosition().getY());
- ImpDrawLineStriped(rOutputDevice, aStart, aEnd);
- break;
- }
-
- case SDRHELPLINE_POINT :
- {
- const Size aPixelSize(SDRHELPLINE_POINT_PIXELSIZE, SDRHELPLINE_POINT_PIXELSIZE);
- const Size aLogicSize(rOutputDevice.PixelToLogic(aPixelSize));
-
- const basegfx::B2DPoint aStartA(getBasePosition().getX(), getBasePosition().getY() - aLogicSize.Height());
- const basegfx::B2DPoint aEndA(getBasePosition().getX(), getBasePosition().getY() + aLogicSize.Height());
- ImpDrawLineStriped(rOutputDevice, aStartA, aEndA);
-
- const basegfx::B2DPoint aStartB(getBasePosition().getX() - aLogicSize.Width(), getBasePosition().getY());
- const basegfx::B2DPoint aEndB(getBasePosition().getX() + aLogicSize.Width(), getBasePosition().getY());
- ImpDrawLineStriped(rOutputDevice, aStartB, aEndB);
-
- break;
- }
+ const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor());
+ const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor());
+ const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel());
+ const drawinglayer::primitive2d::HelplineStyle aStyle(
+ SDRHELPLINE_POINT == getKind() ? drawinglayer::primitive2d::HELPLINESTYLE_POINT :
+ SDRHELPLINE_VERTICAL == getKind() ? drawinglayer::primitive2d::HELPLINESTYLE_VERTICAL :
+ drawinglayer::primitive2d::HELPLINESTYLE_HORIZONTAL);
+
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new drawinglayer::primitive2d::OverlayHelplineStripedPrimitive(
+ getBasePosition(),
+ aStyle,
+ aRGBColorA,
+ aRGBColorB,
+ fStripeLengthPixel));
+
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
}
+
+ return aRetval;
}
- void OverlayHelplineStriped::createBaseRange(OutputDevice& rOutputDevice)
+ void OverlayHelplineStriped::stripeDefinitionHasChanged()
{
- // reset range and expand it
- maBaseRange.reset();
-
- if(SDRHELPLINE_POINT == meKind)
- {
- const Size aPixelSize(SDRHELPLINE_POINT_PIXELSIZE, SDRHELPLINE_POINT_PIXELSIZE);
- const Size aLogicSize(rOutputDevice.PixelToLogic(aPixelSize));
-
- maBaseRange.expand(basegfx::B2DPoint(getBasePosition().getX() - aLogicSize.Width(), getBasePosition().getY() - aLogicSize.Height()));
- maBaseRange.expand(basegfx::B2DPoint(getBasePosition().getX() + aLogicSize.Width(), getBasePosition().getY() + aLogicSize.Height()));
- }
- else
- {
- const Point aEmptyPoint;
- const Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel());
- const Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel));
-
- if(SDRHELPLINE_HORIZONTAL == meKind)
- {
- maBaseRange.expand(basegfx::B2DPoint(aVisibleLogic.Left(), getBasePosition().getY()));
- maBaseRange.expand(basegfx::B2DPoint(aVisibleLogic.Right(), getBasePosition().getY()));
- }
- else if(SDRHELPLINE_VERTICAL == meKind)
- {
- maBaseRange.expand(basegfx::B2DPoint(getBasePosition().getX(), aVisibleLogic.Top()));
- maBaseRange.expand(basegfx::B2DPoint(getBasePosition().getX(), aVisibleLogic.Bottom()));
- }
- }
+ // react on OverlayManager's stripe definition change
+ objectChange();
}
OverlayHelplineStriped::OverlayHelplineStriped(
@@ -128,102 +89,6 @@ namespace sdr
OverlayHelplineStriped::~OverlayHelplineStriped()
{
}
-
- sal_Bool OverlayHelplineStriped::isHit(const basegfx::B2DPoint& rPos, double fTol) const
- {
- if(isHittable())
- {
- if(SDRHELPLINE_POINT == meKind)
- {
- // use distance to BasePosition
- const basegfx::B2DVector aVector(rPos - getBasePosition());
-
- return (aVector.getLength() < fTol);
- }
- else
- {
- if(SDRHELPLINE_HORIZONTAL == meKind)
- {
- // test vertical
- if(rPos.getY() >= (getBasePosition().getY() - fTol)
- && rPos.getY() <= (getBasePosition().getY() + fTol))
- {
- return sal_True;
- }
- }
- else if(SDRHELPLINE_VERTICAL == meKind)
- {
- // test horizontal
- if(rPos.getX() >= (getBasePosition().getX() - fTol)
- && rPos.getX() <= (getBasePosition().getX() + fTol))
- {
- return sal_True;
- }
- }
- }
- }
-
- return sal_False;
- }
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace overlay
- {
- void OverlayHelpline::drawGeometry(OutputDevice& rOutputDevice)
- {
- Point aBasePos(FRound(getBasePosition().getX()), FRound(getBasePosition().getY()));
-
- rOutputDevice.SetLineColor(getBaseColor());
- rOutputDevice.SetFillColor();
-
- if(SDRHELPLINE_POINT == meKind)
- {
- Size aPixelSize(SDRHELPLINE_POINT_PIXELSIZE, SDRHELPLINE_POINT_PIXELSIZE);
- Size aLogicSize(rOutputDevice.PixelToLogic(aPixelSize));
-
- rOutputDevice.DrawLine(
- Point(aBasePos.X() - aLogicSize.Width(), aBasePos.Y()),
- Point(aBasePos.X() + aLogicSize.Width(), aBasePos.Y()));
- rOutputDevice.DrawLine(
- Point(aBasePos.X(), aBasePos.Y() - aLogicSize.Height()),
- Point(aBasePos.X(), aBasePos.Y() + aLogicSize.Height()));
- }
- else
- {
- Point aEmptyPoint;
- Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel());
- Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel));
-
- if(SDRHELPLINE_HORIZONTAL == meKind)
- {
- rOutputDevice.DrawLine(Point(aVisibleLogic.Left(), aBasePos.Y()), Point(aVisibleLogic.Right(), aBasePos.Y()));
- }
- else if(SDRHELPLINE_VERTICAL == meKind)
- {
- rOutputDevice.DrawLine(Point(aBasePos.X(), aVisibleLogic.Top()), Point(aBasePos.X(), aVisibleLogic.Bottom()));
- }
- }
- }
-
- OverlayHelpline::OverlayHelpline(
- const basegfx::B2DPoint& rBasePos,
- Color aLineColor,
- SdrHelpLineKind eNewKind)
- : OverlayHelplineStriped(rBasePos, eNewKind)
- {
- // set base color here, OverlayCrosshairStriped constructor has set
- // it to it's own default.
- maBaseColor = aLineColor;
- }
-
- OverlayHelpline::~OverlayHelpline()
- {
- }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlayline.cxx b/svx/source/sdr/overlay/overlayline.cxx
index 003da41ee31d..90ecb869f4f6 100644
--- a/svx/source/sdr/overlay/overlayline.cxx
+++ b/svx/source/sdr/overlay/overlayline.cxx
@@ -37,6 +37,9 @@
#include <basegfx/vector/b2dvector.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -44,17 +47,37 @@ namespace sdr
{
namespace overlay
{
- void OverlayLineStriped::drawGeometry(OutputDevice& rOutputDevice)
+ drawinglayer::primitive2d::Primitive2DSequence OverlayLineStriped::createOverlayObjectPrimitive2DSequence()
{
- ImpDrawLineStriped(rOutputDevice, getBasePosition(), getSecondPosition());
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
+
+ if(getOverlayManager())
+ {
+ const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor());
+ const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor());
+ const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel());
+ basegfx::B2DPolygon aLine;
+
+ aLine.append(getBasePosition());
+ aLine.append(getSecondPosition());
+
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new drawinglayer::primitive2d::PolygonMarkerPrimitive2D(
+ aLine,
+ aRGBColorA,
+ aRGBColorB,
+ fStripeLengthPixel));
+
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
+ }
+
+ return aRetval;
}
- void OverlayLineStriped::createBaseRange(OutputDevice& /*rOutputDevice*/)
+ void OverlayLineStriped::stripeDefinitionHasChanged()
{
- // reset range and expand it
- maBaseRange.reset();
- maBaseRange.expand(getBasePosition());
- maBaseRange.expand(getSecondPosition());
+ // react on OverlayManager's stripe definition change
+ objectChange();
}
OverlayLineStriped::OverlayLineStriped(
@@ -80,63 +103,6 @@ namespace sdr
objectChange();
}
}
-
- sal_Bool OverlayLineStriped::isHit(const basegfx::B2DPoint& rPos, double fTol) const
- {
- if(isHittable() && !getBasePosition().equal(getSecondPosition()))
- {
- return basegfx::tools::isInEpsilonRange(getBasePosition(), getSecondPosition(), rPos, fTol);
- }
-
- return sal_False;
- }
-
- void OverlayLineStriped::transform(const basegfx::B2DHomMatrix& rMatrix)
- {
- if(!rMatrix.isIdentity())
- {
- // transform base position
- OverlayObjectWithBasePosition::transform(rMatrix);
-
- // transform maSecondPosition
- const basegfx::B2DPoint aNewSecondPosition = rMatrix * getSecondPosition();
- setSecondPosition(aNewSecondPosition);
- }
- }
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace overlay
- {
- void OverlayLine::drawGeometry(OutputDevice& rOutputDevice)
- {
- const Point aStart(FRound(getBasePosition().getX()), FRound(getBasePosition().getY()));
- const Point aEnd(FRound(getSecondPosition().getX()), FRound(getSecondPosition().getY()));
-
- rOutputDevice.SetLineColor(getBaseColor());
- rOutputDevice.SetFillColor();
-
- rOutputDevice.DrawLine(aStart, aEnd);
- }
-
- OverlayLine::OverlayLine(
- const basegfx::B2DPoint& rBasePos,
- const basegfx::B2DPoint& rSecondPos,
- Color aLineColor)
- : OverlayLineStriped(rBasePos, rSecondPos)
- {
- // set base color here, OverlayCrosshairStriped constructor has set
- // it to it's own default.
- maBaseColor = aLineColor;
- }
-
- OverlayLine::~OverlayLine()
- {
- }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx
index 8c682adfc166..79d493b6d9d0 100644
--- a/svx/source/sdr/overlay/overlaymanager.cxx
+++ b/svx/source/sdr/overlay/overlaymanager.cxx
@@ -50,33 +50,49 @@ namespace sdr
{
void OverlayManager::ImpDrawMembers(const basegfx::B2DRange& rRange, OutputDevice& rDestinationDevice) const
{
- ::sdr::overlay::OverlayObject* pCurrent = mpOverlayObjectStart;
+ const sal_uInt32 nSize(maOverlayObjects.size());
- if(pCurrent)
+ if(nSize)
{
const sal_uInt16 nOriginalAA(rDestinationDevice.GetAntialiasing());
+ const bool bIsAntiAliasing(getDrawinglayerOpt().IsAntiAliasing());
- // react on AntiAliasing settings
- if(maDrawinglayerOpt.IsAntiAliasing())
- {
- rDestinationDevice.SetAntialiasing(nOriginalAA | ANTIALIASING_ENABLE_B2DDRAW);
- }
- else
- {
- rDestinationDevice.SetAntialiasing(nOriginalAA & ~ANTIALIASING_ENABLE_B2DDRAW);
- }
+ // create processor
+ drawinglayer::processor2d::BaseProcessor2D* pProcessor = ::sdr::contact::createBaseProcessor2DFromOutputDevice(
+ rDestinationDevice,
+ getCurrentViewInformation2D());
- while(pCurrent)
+ if(pProcessor)
{
- if(pCurrent->isVisible())
+ for(OverlayObjectVector::const_iterator aIter(maOverlayObjects.begin()); aIter != maOverlayObjects.end(); aIter++)
{
- if(rRange.overlaps(pCurrent->getBaseRange()))
+ OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)");
+ const OverlayObject& rCandidate = **aIter;
+
+ if(rCandidate.isVisible())
{
- pCurrent->drawGeometry(rDestinationDevice);
+ const drawinglayer::primitive2d::Primitive2DSequence& rSequence = rCandidate.getOverlayObjectPrimitive2DSequence();
+
+ if(rSequence.hasElements())
+ {
+ if(rRange.overlaps(rCandidate.getBaseRange()))
+ {
+ if(bIsAntiAliasing && rCandidate.allowsAntiAliase())
+ {
+ rDestinationDevice.SetAntialiasing(nOriginalAA | ANTIALIASING_ENABLE_B2DDRAW);
+ }
+ else
+ {
+ rDestinationDevice.SetAntialiasing(nOriginalAA & ~ANTIALIASING_ENABLE_B2DDRAW);
+ }
+
+ pProcessor->process(rSequence);
+ }
+ }
}
}
- pCurrent = pCurrent->mpNext;
+ delete pProcessor;
}
// restore AA settings
@@ -84,87 +100,162 @@ namespace sdr
}
}
- void OverlayManager::ImpCheckMapModeChange() const
+ void OverlayManager::ImpStripeDefinitionChanged()
{
- sal_Bool bZoomHasChanged(sal_False);
- MapMode aOutputDeviceMapMode(getOutputDevice().GetMapMode());
- ::sdr::overlay::OverlayObject* pCurrent = mpOverlayObjectStart;
+ const sal_uInt32 nSize(maOverlayObjects.size());
- if(maMapMode != aOutputDeviceMapMode)
+ if(nSize)
{
- bZoomHasChanged = (
- maMapMode.GetScaleX() != aOutputDeviceMapMode.GetScaleX()
- || maMapMode.GetScaleY() != aOutputDeviceMapMode.GetScaleY());
-
- // remember MapMode
- ((OverlayManager*)this)->maMapMode = aOutputDeviceMapMode;
- }
-
- if(bZoomHasChanged && pCurrent)
- {
- while(pCurrent)
+ for(OverlayObjectVector::iterator aIter(maOverlayObjects.begin()); aIter != maOverlayObjects.end(); aIter++)
{
- pCurrent->zoomHasChanged();
- pCurrent = pCurrent->mpNext;
+ OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)");
+ OverlayObject& rCandidate = **aIter;
+ rCandidate.stripeDefinitionHasChanged();
}
}
}
- void OverlayManager::ImpStripeDefinitionChanged()
- {
- ::sdr::overlay::OverlayObject* pCurrent = mpOverlayObjectStart;
-
- while(pCurrent)
- {
- pCurrent->stripeDefinitionHasChanged();
- pCurrent = pCurrent->mpNext;
- }
- }
-
double OverlayManager::getDiscreteOne() const
{
- if(getOutputDevice().GetViewTransformation() != maViewTransformation)
+ if(basegfx::fTools::equalZero(mfDiscreteOne))
{
- OverlayManager* pThis = const_cast< OverlayManager* >(this);
- pThis->maViewTransformation = getOutputDevice().GetViewTransformation();
const basegfx::B2DVector aDiscreteInLogic(getOutputDevice().GetInverseViewTransformation() * basegfx::B2DVector(1.0, 0.0));
- pThis->mfDiscreteOne = aDiscreteInLogic.getLength();
+ const_cast< OverlayManager* >(this)->mfDiscreteOne = aDiscreteInLogic.getLength();
}
return mfDiscreteOne;
}
- OverlayManager::OverlayManager(OutputDevice& rOutputDevice)
+ OverlayManager::OverlayManager(
+ OutputDevice& rOutputDevice,
+ OverlayManager* pOldOverlayManager)
: Scheduler(),
rmOutputDevice(rOutputDevice),
- mpOverlayObjectStart(0L),
- mpOverlayObjectEnd(0L),
+ maOverlayObjects(),
maStripeColorA(Color(COL_BLACK)),
maStripeColorB(Color(COL_WHITE)),
- mnStripeLengthPixel(5L),
+ mnStripeLengthPixel(5),
maDrawinglayerOpt(),
maViewTransformation(),
+ maViewInformation2D(0),
mfDiscreteOne(0.0)
{
+ if(pOldOverlayManager)
+ {
+ // take over OverlayObjects from given OverlayManager. Copy
+ // the vector of pointers
+ maOverlayObjects = pOldOverlayManager->maOverlayObjects;
+ const sal_uInt32 nSize(maOverlayObjects.size());
+
+ if(nSize)
+ {
+ for(OverlayObjectVector::iterator aIter(maOverlayObjects.begin()); aIter != maOverlayObjects.end(); aIter++)
+ {
+ OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)");
+ OverlayObject& rCandidate = **aIter;
+
+ // remove from old and add to new OverlayManager
+ pOldOverlayManager->impApplyRemoveActions(rCandidate);
+ impApplyAddActions(rCandidate);
+ }
+
+ pOldOverlayManager->maOverlayObjects.clear();
+ }
+ }
+ }
+
+ const drawinglayer::geometry::ViewInformation2D OverlayManager::getCurrentViewInformation2D() const
+ {
+ if(getOutputDevice().GetViewTransformation() != maViewTransformation)
+ {
+ basegfx::B2DRange aViewRange(maViewInformation2D.getViewport());
+
+ if(OUTDEV_WINDOW == getOutputDevice().GetOutDevType())
+ {
+ const Size aOutputSizePixel(getOutputDevice().GetOutputSizePixel());
+ aViewRange = basegfx::B2DRange(0.0, 0.0, aOutputSizePixel.getWidth(), aOutputSizePixel.getHeight());
+ aViewRange.transform(getOutputDevice().GetInverseViewTransformation());
+ }
+
+ OverlayManager* pThis = const_cast< OverlayManager* >(this);
+
+ pThis->maViewTransformation = getOutputDevice().GetViewTransformation();
+ pThis->maViewInformation2D = drawinglayer::geometry::ViewInformation2D(
+ maViewInformation2D.getObjectTransformation(),
+ maViewTransformation,
+ aViewRange,
+ maViewInformation2D.getVisualizedPage(),
+ maViewInformation2D.getViewTime(),
+ maViewInformation2D.getExtendedInformationSequence());
+ pThis->mfDiscreteOne = 0.0;
+ }
+
+ return maViewInformation2D;
+ }
+
+ void OverlayManager::impApplyRemoveActions(OverlayObject& rTarget)
+ {
+ // handle evtl. animation
+ if(rTarget.allowsAnimation())
+ {
+ // remove from event chain
+ RemoveEvent(&rTarget);
+ }
+
+ // make invisible
+ invalidateRange(rTarget.getBaseRange());
+
+ // clear manager
+ rTarget.mpOverlayManager = 0;
+ }
+
+ void OverlayManager::impApplyAddActions(OverlayObject& rTarget)
+ {
+ // set manager
+ rTarget.mpOverlayManager = this;
+
+ // make visible
+ invalidateRange(rTarget.getBaseRange());
+
+ // handle evtl. animation
+ if(rTarget.allowsAnimation())
+ {
+ // Trigger at current time to get alive. This will do the
+ // object-specific next time calculation and hand over adding
+ // again to the scheduler to the animated object, too. This works for
+ // a paused or non-paused animator.
+ rTarget.Trigger(GetTime());
+ }
}
OverlayManager::~OverlayManager()
{
- // the OverlayManager is not the owner of the OverlayObjects
- // and thus will not delete them, but remove them.
- while(mpOverlayObjectStart)
+ // The OverlayManager is not the owner of the OverlayObjects
+ // and thus will not delete them, but remove them. Profit here
+ // from knowing that all will be removed
+ const sal_uInt32 nSize(maOverlayObjects.size());
+
+ if(nSize)
{
- remove(*mpOverlayObjectStart);
+ for(OverlayObjectVector::iterator aIter(maOverlayObjects.begin()); aIter != maOverlayObjects.end(); aIter++)
+ {
+ OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)");
+ OverlayObject& rCandidate = **aIter;
+ impApplyRemoveActions(rCandidate);
+ }
+
+ // erase vector
+ maOverlayObjects.clear();
}
}
void OverlayManager::completeRedraw(const Region& rRegion, OutputDevice* pPreRenderDevice) const
{
- if(!rRegion.IsEmpty() && mpOverlayObjectStart)
+ if(!rRegion.IsEmpty() && maOverlayObjects.size())
{
// check for changed MapModes. That may influence the
// logical size of pixel based OverlayObjects (like BitmapHandles)
- ImpCheckMapModeChange();
+ //ImpCheckMapModeChange();
// paint members
const Rectangle aRegionBoundRect(rRegion.GetBoundRect());
@@ -195,87 +286,38 @@ namespace sdr
void OverlayManager::add(OverlayObject& rOverlayObject)
{
- // add to the end of chain to preserve display order in paint
- DBG_ASSERT(0L == rOverlayObject.mpOverlayManager,
- "OverlayManager::add: OverlayObject is added to an OverlayManager (!)");
-
- if(mpOverlayObjectEnd)
- {
- // new element, add to end
- rOverlayObject.mpNext = mpOverlayObjectEnd->mpNext;
- rOverlayObject.mpPrevious = mpOverlayObjectEnd;
- mpOverlayObjectEnd->mpNext = &rOverlayObject;
- mpOverlayObjectEnd = &rOverlayObject;
- }
- else
- {
- // first element
- rOverlayObject.mpNext = rOverlayObject.mpPrevious = 0L;
- mpOverlayObjectEnd = mpOverlayObjectStart = &rOverlayObject;
- }
-
- // set manager
- rOverlayObject.mpOverlayManager = this;
+ OSL_ENSURE(0 == rOverlayObject.mpOverlayManager, "OverlayObject is added twice to an OverlayManager (!)");
- // make visible
- invalidateRange(rOverlayObject.getBaseRange());
+ // add to the end of chain to preserve display order in paint
+ maOverlayObjects.push_back(&rOverlayObject);
- // handle evtl. animation
- if(rOverlayObject.allowsAnimation())
- {
- // Trigger at current time to get alive. This will do the
- // object-specific next time calculation and hand over adding
- // again to the scheduler to the animated object, too. This works for
- // a paused or non-paused animator.
- rOverlayObject.Trigger(GetTime());
- }
+ // execute add actions
+ impApplyAddActions(rOverlayObject);
}
void OverlayManager::remove(OverlayObject& rOverlayObject)
{
- // handle evtl. animation
- if(rOverlayObject.allowsAnimation())
- {
- // remove from event chain
- RemoveEvent(&rOverlayObject);
- }
+ OSL_ENSURE(rOverlayObject.mpOverlayManager == this, "OverlayObject is removed from wrong OverlayManager (!)");
- // Remove from chain
- DBG_ASSERT(rOverlayObject.mpOverlayManager == this,
- "OverlayManager::remove: OverlayObject is removed from wrong OverlayManager (!)");
+ // execute remove actions
+ impApplyRemoveActions(rOverlayObject);
- if(rOverlayObject.mpPrevious)
- {
- rOverlayObject.mpPrevious->mpNext = rOverlayObject.mpNext;
- }
+ // remove from vector
+ const OverlayObjectVector::iterator aFindResult = ::std::find(maOverlayObjects.begin(), maOverlayObjects.end(), &rOverlayObject);
+ const bool bFound(aFindResult != maOverlayObjects.end());
+ OSL_ENSURE(bFound, "OverlayObject NOT found at OverlayManager (!)");
- if(rOverlayObject.mpNext)
+ if(bFound)
{
- rOverlayObject.mpNext->mpPrevious = rOverlayObject.mpPrevious;
+ maOverlayObjects.erase(aFindResult);
}
-
- if(&rOverlayObject == mpOverlayObjectStart)
- {
- mpOverlayObjectStart = rOverlayObject.mpNext;
- }
-
- if(&rOverlayObject == mpOverlayObjectEnd)
- {
- mpOverlayObjectEnd = rOverlayObject.mpPrevious;
- }
-
- // make invisible
- invalidateRange(rOverlayObject.getBaseRange());
-
- // clear manager
- rOverlayObject.mpOverlayManager = 0L;
}
void OverlayManager::invalidateRange(const basegfx::B2DRange& rRange)
{
if(OUTDEV_WINDOW == getOutputDevice().GetOutDevType())
{
- if(maDrawinglayerOpt.IsAntiAliasing())
+ if(getDrawinglayerOpt().IsAntiAliasing())
{
// assume AA needs one pixel more and invalidate one pixel more
const double fDiscreteOne(getDiscreteOne());
@@ -331,18 +373,6 @@ namespace sdr
ImpStripeDefinitionChanged();
}
}
-
- ::boost::shared_ptr<OverlayObjectVector> OverlayManager::GetOverlayObjects (void) const
- {
- ::boost::shared_ptr<OverlayObjectVector> pObjectList (new OverlayObjectVector());
- sdr::overlay::OverlayObject* pObject = mpOverlayObjectStart;
- while (pObject != NULL)
- {
- pObjectList->push_back(pObject);
- pObject = pObject->mpNext;
- }
- return pObjectList;
- }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
index 584faedcdda2..2b664e816d42 100644
--- a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
+++ b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
@@ -36,12 +36,8 @@
#include <basegfx/range/b2drange.hxx>
#include <vcl/salbtype.hxx>
#include <vcl/window.hxx>
-
-// #i72754#
#include <vcl/bitmap.hxx>
#include <tools/stream.hxx>
-
-// #i75163#
#include <basegfx/matrix/b2dhommatrix.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -63,7 +59,7 @@ namespace sdr
// compare the MapModes for zoom/scroll changes
if(maBufferDevice.GetMapMode() != getOutputDevice().GetMapMode())
{
- const sal_Bool bZoomed(
+ const bool bZoomed(
maBufferDevice.GetMapMode().GetScaleX() != getOutputDevice().GetMapMode().GetScaleX()
|| maBufferDevice.GetMapMode().GetScaleY() != getOutputDevice().GetMapMode().GetScaleY());
@@ -71,7 +67,7 @@ namespace sdr
{
const Point& rOriginOld = maBufferDevice.GetMapMode().GetOrigin();
const Point& rOriginNew = getOutputDevice().GetMapMode().GetOrigin();
- const sal_Bool bScrolled(rOriginOld != rOriginNew);
+ const bool bScrolled(rOriginOld != rOriginNew);
if(bScrolled)
{
@@ -81,8 +77,8 @@ namespace sdr
const Size aOutputSizePixel(maBufferDevice.GetOutputSizePixel());
// remember and switch off MapMode
- const sal_Bool bMapModeWasEnabled(maBufferDevice.IsMapModeEnabled());
- maBufferDevice.EnableMapMode(sal_False);
+ const bool bMapModeWasEnabled(maBufferDevice.IsMapModeEnabled());
+ maBufferDevice.EnableMapMode(false);
// scroll internally buffered stuff
const Point aDestinationOffsetPixel(aOriginNewPixel - aOriginOldPixel);
@@ -132,10 +128,10 @@ namespace sdr
Rectangle aRegionRectanglePixel;
// MapModes off
- const sal_Bool bMapModeWasEnabledDest(getOutputDevice().IsMapModeEnabled());
- const sal_Bool bMapModeWasEnabledSource(maBufferDevice.IsMapModeEnabled());
- getOutputDevice().EnableMapMode(sal_False);
- ((OverlayManagerBuffered*)this)->maBufferDevice.EnableMapMode(sal_False);
+ const bool bMapModeWasEnabledDest(getOutputDevice().IsMapModeEnabled());
+ const bool bMapModeWasEnabledSource(maBufferDevice.IsMapModeEnabled());
+ getOutputDevice().EnableMapMode(false);
+ ((OverlayManagerBuffered*)this)->maBufferDevice.EnableMapMode(false);
while(aRegionPixel.GetEnumRects(aRegionHandle, aRegionRectanglePixel))
{
@@ -200,10 +196,10 @@ namespace sdr
Rectangle aRegionRectanglePixel;
// MapModes off
- const sal_Bool bMapModeWasEnabledDest(rSource.IsMapModeEnabled());
- const sal_Bool bMapModeWasEnabledSource(maBufferDevice.IsMapModeEnabled());
- rSource.EnableMapMode(sal_False);
- maBufferDevice.EnableMapMode(sal_False);
+ const bool bMapModeWasEnabledDest(rSource.IsMapModeEnabled());
+ const bool bMapModeWasEnabledSource(maBufferDevice.IsMapModeEnabled());
+ rSource.EnableMapMode(false);
+ maBufferDevice.EnableMapMode(false);
while(aRegion.GetEnumRects(aRegionHandle, aRegionRectanglePixel))
{
@@ -221,7 +217,7 @@ namespace sdr
static bool bDoPaintForVisualControl(false);
if(bDoPaintForVisualControl)
{
- const sal_Bool bMapModeWasEnabledTest(getOutputDevice().IsMapModeEnabled());
+ const bool bMapModeWasEnabledTest(getOutputDevice().IsMapModeEnabled());
getOutputDevice().EnableMapMode(false);
getOutputDevice().SetLineColor(COL_LIGHTRED);
getOutputDevice().SetFillColor();
@@ -282,7 +278,7 @@ namespace sdr
}
maOutputBufferDevice.SetMapMode(getOutputDevice().GetMapMode());
- maOutputBufferDevice.EnableMapMode(sal_False);
+ maOutputBufferDevice.EnableMapMode(false);
maOutputBufferDevice.SetDrawMode(maBufferDevice.GetDrawMode());
maOutputBufferDevice.SetSettings(maBufferDevice.GetSettings());
maOutputBufferDevice.SetAntialiasing(maBufferDevice.GetAntialiasing());
@@ -320,8 +316,8 @@ namespace sdr
const Size aSize(aRegionRectanglePixel.GetSize());
{
- const sal_Bool bMapModeWasEnabledDest(maBufferDevice.IsMapModeEnabled());
- maBufferDevice.EnableMapMode(sal_False);
+ const bool bMapModeWasEnabledDest(maBufferDevice.IsMapModeEnabled());
+ maBufferDevice.EnableMapMode(false);
maOutputBufferDevice.DrawOutDev(
aTopLeft, aSize, // destination
@@ -334,14 +330,14 @@ namespace sdr
// paint overlay content for remembered region, use
// method from base class directly
- maOutputBufferDevice.EnableMapMode(sal_True);
+ maOutputBufferDevice.EnableMapMode(true);
OverlayManager::ImpDrawMembers(aBufferRememberedRangeLogic, maOutputBufferDevice);
- maOutputBufferDevice.EnableMapMode(sal_False);
+ maOutputBufferDevice.EnableMapMode(false);
// copy to output
{
- const sal_Bool bMapModeWasEnabledDest(getOutputDevice().IsMapModeEnabled());
- getOutputDevice().EnableMapMode(sal_False);
+ const bool bMapModeWasEnabledDest(getOutputDevice().IsMapModeEnabled());
+ getOutputDevice().EnableMapMode(false);
getOutputDevice().DrawOutDev(
aTopLeft, aSize, // destination
@@ -417,8 +413,11 @@ namespace sdr
return 0;
}
- OverlayManagerBuffered::OverlayManagerBuffered(OutputDevice& rOutputDevice, sal_Bool bRefreshWithPreRendering)
- : OverlayManager(rOutputDevice),
+ OverlayManagerBuffered::OverlayManagerBuffered(
+ OutputDevice& rOutputDevice,
+ OverlayManager* pOldOverlayManager,
+ bool bRefreshWithPreRendering)
+ : OverlayManager(rOutputDevice, pOldOverlayManager),
mbRefreshWithPreRendering(bRefreshWithPreRendering)
{
// Init timer
@@ -515,9 +514,9 @@ namespace sdr
}
}
- void OverlayManagerBuffered::SetRefreshWithPreRendering(sal_Bool bNew)
+ void OverlayManagerBuffered::SetRefreshWithPreRendering(bool bNew)
{
- if(mbRefreshWithPreRendering != bNew)
+ if((bool)mbRefreshWithPreRendering != bNew)
{
mbRefreshWithPreRendering = bNew;
}
diff --git a/svx/source/sdr/overlay/overlayobject.cxx b/svx/source/sdr/overlay/overlayobject.cxx
index 658b6719709e..4c05fbd48a23 100644
--- a/svx/source/sdr/overlay/overlayobject.cxx
+++ b/svx/source/sdr/overlay/overlayobject.cxx
@@ -43,7 +43,6 @@
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <svx/sdr/contact/objectcontacttools.hxx>
#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
-#include <drawinglayer/processor2d/baseprocessor2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -53,206 +52,94 @@ namespace sdr
{
void OverlayObject::objectChange()
{
- if(mpOverlayManager)
- {
- basegfx::B2DRange aPreviousRange(maBaseRange);
-
- if(!aPreviousRange.isEmpty())
- {
- mpOverlayManager->invalidateRange(aPreviousRange);
- }
-
- mbIsChanged = sal_True;
- const basegfx::B2DRange& rCurrentRange = getBaseRange();
-
- if(rCurrentRange != aPreviousRange && !rCurrentRange.isEmpty())
- {
- mpOverlayManager->invalidateRange(rCurrentRange);
- }
- }
- }
+ const basegfx::B2DRange aPreviousRange(maBaseRange);
+ maBaseRange.reset();
+ setPrimitive2DSequence(drawinglayer::primitive2d::Primitive2DSequence());
- // support method to draw striped geometries
- void OverlayObject::ImpDrawRangeStriped(OutputDevice& rOutputDevice, const basegfx::B2DRange& rRange)
- {
- if(getOverlayManager())
+ if(getOverlayManager() && !aPreviousRange.isEmpty())
{
- const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(rRange));
-
- if(aPolygon.count())
- {
- ImpDrawPolygonStriped(rOutputDevice, aPolygon);
- }
+ getOverlayManager()->invalidateRange(aPreviousRange);
}
- }
- void OverlayObject::ImpDrawLineStriped(OutputDevice& rOutputDevice, double x1, double y1, double x2, double y2)
- {
- if(getOverlayManager())
- {
- const basegfx::B2DPoint aStart(x1, y1);
- const basegfx::B2DPoint aEnd(x2, y2);
+ const basegfx::B2DRange& rCurrentRange = getBaseRange();
- if(!aStart.equal(aEnd))
- {
- basegfx::B2DPolygon aPolygon;
- aPolygon.append(aStart);
- aPolygon.append(aEnd);
-
- ImpDrawPolygonStriped(rOutputDevice, aPolygon);
- }
+ if(getOverlayManager() && rCurrentRange != aPreviousRange && !rCurrentRange.isEmpty())
+ {
+ getOverlayManager()->invalidateRange(rCurrentRange);
}
}
- void OverlayObject::ImpDrawLineStriped(OutputDevice& rOutputDevice, const basegfx::B2DPoint& rStart, const basegfx::B2DPoint& rEnd)
+ // OverlayObject implementations.
+ drawinglayer::primitive2d::Primitive2DSequence OverlayObject::createOverlayObjectPrimitive2DSequence()
{
- if(getOverlayManager() && !rStart.equal(rEnd))
- {
- basegfx::B2DPolygon aPolygon;
- aPolygon.append(rStart);
- aPolygon.append(rEnd);
-
- ImpDrawPolygonStriped(rOutputDevice, aPolygon);
- }
+ // Default implementation has to assert a missing implementation. It cannot
+ // be useful to have overlay object derivations which have no visualisation
+ // at all
+ OSL_ENSURE(false, "OverlayObject derivation without visualisation definition (missing createOverlayObjectPrimitive2DSequence implementation) (!)");
+ return drawinglayer::primitive2d::Primitive2DSequence();
}
- void OverlayObject::ImpDrawPolygonStriped(OutputDevice& rOutputDevice, const basegfx::B2DPolygon& rPolygon)
+ void OverlayObject::allowAntiAliase(bool bNew)
{
- if(getOverlayManager() && rPolygon.count())
+ if(bNew != (bool)mbAllowsAntiAliase)
{
- if(getOverlayManager() && getOverlayManager()->getDrawinglayerOpt().IsAntiAliasing())
- {
- // prepare ViewInformation2D
- const drawinglayer::geometry::ViewInformation2D aViewInformation2D(
- basegfx::B2DHomMatrix(),
- rOutputDevice.GetViewTransformation(),
- basegfx::B2DRange(),
- 0,
- 0.0,
- 0);
-
- // create processor
- drawinglayer::processor2d::BaseProcessor2D* pProcessor = ::sdr::contact::createBaseProcessor2DFromOutputDevice(
- rOutputDevice,
- aViewInformation2D);
-
- if(pProcessor)
- {
- // prepare primitives
- const drawinglayer::primitive2d::Primitive2DReference aPolygonMarkerPrimitive2D(
- new drawinglayer::primitive2d::PolygonMarkerPrimitive2D(
- rPolygon,
- getOverlayManager()->getStripeColorA().getBColor(),
- getOverlayManager()->getStripeColorB().getBColor(),
- getOverlayManager()->getStripeLengthPixel()));
- const drawinglayer::primitive2d::Primitive2DSequence aSequence(&aPolygonMarkerPrimitive2D, 1);
-
- pProcessor->process(aSequence);
-
- delete pProcessor;
- }
- }
- else
- {
- const sal_uInt32 nLenPixel(getOverlayManager()->getStripeLengthPixel());
- const Size aDashSizePixel(nLenPixel, nLenPixel);
- const Size aDashSizeLogic(rOutputDevice.PixelToLogic(aDashSizePixel));
- const double fDashLength(aDashSizeLogic.Width());
- const double fFullDotDashLength(fDashLength + fDashLength);
-
- // fill DashDot vector
- ::std::vector<double> aDotDashArray;
- aDotDashArray.push_back(fDashLength);
- aDotDashArray.push_back(fDashLength);
-
- // get dash polygons
- basegfx::B2DPolyPolygon aStripesA;
- basegfx::B2DPolyPolygon aStripesB;
- basegfx::tools::applyLineDashing(rPolygon, aDotDashArray, &aStripesA, &aStripesB, fFullDotDashLength);
-
- // draw stripes A
- if(aStripesA.count())
- {
- rOutputDevice.SetFillColor();
- rOutputDevice.SetLineColor(getOverlayManager()->getStripeColorA());
-
- for(sal_uInt32 a(0L); a < aStripesA.count();a ++)
- {
- rOutputDevice.DrawPolyLine(aStripesA.getB2DPolygon(a));
- }
- }
-
- // draw stripes B
- if(aStripesB.count())
- {
- rOutputDevice.SetFillColor();
- rOutputDevice.SetLineColor(getOverlayManager()->getStripeColorB());
+ // remember new value
+ mbAllowsAntiAliase = bNew;
- for(sal_uInt32 a(0L); a < aStripesB.count();a ++)
- {
- rOutputDevice.DrawPolyLine(aStripesB.getB2DPolygon(a));
- }
- }
- }
+ // register change (after change)
+ objectChange();
}
}
OverlayObject::OverlayObject(Color aBaseColor)
- : Event(0L),
- mpOverlayManager(0L),
- mpNext(0L),
- mpPrevious(0L),
+ : Event(0),
+ mpOverlayManager(0),
maBaseColor(aBaseColor),
- mbIsVisible(sal_True),
- mbIsChanged(sal_True),
- mbIsHittable(sal_True),
- mbAllowsAnimation(sal_False)
+ mbIsVisible(true),
+ mbIsHittable(true),
+ mbAllowsAnimation(false),
+ mbAllowsAntiAliase(true)
{
}
OverlayObject::~OverlayObject()
{
- DBG_ASSERT(0L == mpOverlayManager,
- "OverlayObject is destructed which is still registered at OverlayManager (!)");
+ OSL_ENSURE(0 == getOverlayManager(), "OverlayObject is destructed which is still registered at OverlayManager (!)");
}
- sal_Bool OverlayObject::isHit(const basegfx::B2DPoint& rPos, double fTol) const
+ const drawinglayer::primitive2d::Primitive2DSequence& OverlayObject::getOverlayObjectPrimitive2DSequence() const
{
- if(isHittable())
+ if(!getPrimitive2DSequence().hasElements())
{
- if(0.0 != fTol)
- {
- basegfx::B2DRange aRange(getBaseRange());
- aRange.grow(fTol);
- return aRange.isInside(rPos);
- }
- else
- {
- return getBaseRange().isInside(rPos);
- }
+ // no existing sequence; create one
+ const_cast< OverlayObject* >(this)->setPrimitive2DSequence(
+ const_cast< OverlayObject* >(this)->createOverlayObjectPrimitive2DSequence());
}
- return sal_False;
+ return getPrimitive2DSequence();
}
const basegfx::B2DRange& OverlayObject::getBaseRange() const
{
- if(mbIsChanged)
+ if(getOverlayManager() && maBaseRange.isEmpty())
{
- if(mpOverlayManager)
+ const drawinglayer::primitive2d::Primitive2DSequence& rSequence = getOverlayObjectPrimitive2DSequence();
+
+ if(rSequence.hasElements())
{
- ((::sdr::overlay::OverlayObject*)this)->createBaseRange(mpOverlayManager->getOutputDevice());
- }
+ const drawinglayer::geometry::ViewInformation2D aViewInformation2D(getOverlayManager()->getCurrentViewInformation2D());
- ((::sdr::overlay::OverlayObject*)this)->mbIsChanged = sal_False;
+ const_cast< sdr::overlay::OverlayObject* >(this)->maBaseRange =
+ drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(rSequence, aViewInformation2D);
+ }
}
return maBaseRange;
}
- void OverlayObject::setVisible(sal_Bool bNew)
+ void OverlayObject::setVisible(bool bNew)
{
- if(bNew != mbIsVisible)
+ if(bNew != (bool)mbIsVisible)
{
// remember new value
mbIsVisible = bNew;
@@ -262,9 +149,9 @@ namespace sdr
}
}
- void OverlayObject::setHittable(sal_Bool bNew)
+ void OverlayObject::setHittable(bool bNew)
{
- if(bNew != mbIsHittable)
+ if(bNew != (bool)mbIsHittable)
{
// remember new value
mbIsHittable = bNew;
@@ -291,11 +178,6 @@ namespace sdr
// default does not register again
}
- void OverlayObject::zoomHasChanged()
- {
- // default does not need to do anything
- }
-
void OverlayObject::stripeDefinitionHasChanged()
{
// default does not need to do anything
@@ -330,15 +212,6 @@ namespace sdr
objectChange();
}
}
-
- void OverlayObjectWithBasePosition::transform(const basegfx::B2DHomMatrix& rMatrix)
- {
- if(!rMatrix.isIdentity())
- {
- basegfx::B2DPoint aNewBasePosition = rMatrix * getBasePosition();
- setBasePosition(aNewBasePosition);
- }
- }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlayobjectcell.cxx b/svx/source/sdr/overlay/overlayobjectcell.cxx
index 25d2dbbdd31b..5df0fc85f8f9 100644
--- a/svx/source/sdr/overlay/overlayobjectcell.cxx
+++ b/svx/source/sdr/overlay/overlayobjectcell.cxx
@@ -35,6 +35,11 @@
#include <vcl/outdev.hxx>
#include <vcl/hatch.hxx>
#include <svx/sdr/overlay/overlayobjectcell.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx>
+#include <drawinglayer/primitive2d/invertprimitive2d.hxx>
using namespace ::basegfx;
@@ -48,83 +53,60 @@ namespace sdr
mePaintType( eType ),
maRectangles( rRects )
{
+ // no AA for selection overlays
+ allowAntiAliase(false);
}
OverlayObjectCell::~OverlayObjectCell()
{
}
- void OverlayObjectCell::drawGeometry(OutputDevice& rOutputDevice)
+ drawinglayer::primitive2d::Primitive2DSequence OverlayObjectCell::createOverlayObjectPrimitive2DSequence()
{
- // set colors
- rOutputDevice.SetLineColor();
- rOutputDevice.SetFillColor(getBaseColor());
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
+ const sal_uInt32 nCount(maRectangles.size());
- if ( mePaintType == CELL_OVERLAY_INVERT )
+ if(nCount)
{
- rOutputDevice.Push();
- rOutputDevice.SetRasterOp( ROP_XOR );
- rOutputDevice.SetFillColor( COL_WHITE );
- }
-
- for(sal_uInt32 a(0L);a < maRectangles.size(); a++)
- {
- const basegfx::B2DRange& rRange(maRectangles[a]);
- const Rectangle aRectangle(fround(rRange.getMinX()), fround(rRange.getMinY()), fround(rRange.getMaxX()), fround(rRange.getMaxY()));
+ const basegfx::BColor aRGBColor(getBaseColor().getBColor());
+ aRetval.realloc(nCount);
- switch(mePaintType)
+ // create primitives for all ranges
+ for(sal_uInt32 a(0); a < nCount; a++)
{
- case CELL_OVERLAY_INVERT :
- {
- rOutputDevice.DrawRect( aRectangle );
+ const basegfx::B2DRange& rRange(maRectangles[a]);
+ const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(rRange));
- // if(OUTDEV_WINDOW == rOutputDevice.GetOutDevType())
- // {
- // ((Window&)rOutputDevice).Invert(aRectangle, INVERT_HIGHLIGHT);
- // }
-
- break;
- }
- case CELL_OVERLAY_HATCH :
- {
- rOutputDevice.DrawHatch(PolyPolygon(Polygon(aRectangle)), Hatch(HATCH_SINGLE, getBaseColor(), 2, 450));
- break;
- }
- case CELL_OVERLAY_TRANSPARENT :
- {
- rOutputDevice.DrawTransparent(PolyPolygon(Polygon(aRectangle)), 50);
- break;
- }
- case CELL_OVERLAY_LIGHT_TRANSPARENT :
- {
- rOutputDevice.DrawTransparent(PolyPolygon(Polygon(aRectangle)), 80);
- break;
- }
+ aRetval[a] = drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon(aPolygon),
+ aRGBColor));
}
- }
- if ( mePaintType == CELL_OVERLAY_INVERT )
- rOutputDevice.Pop();
- }
- void OverlayObjectCell::createBaseRange(OutputDevice& /*rOutputDevice*/)
- {
- maBaseRange.reset();
+ if(mePaintType == CELL_OVERLAY_TRANSPARENT)
+ {
+ // embed in 50% transparent paint
+ const drawinglayer::primitive2d::Primitive2DReference aUnifiedAlpha(
+ new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(
+ aRetval,
+ 0.5));
- for(sal_uInt32 a(0L); a < maRectangles.size(); a++)
- {
- maBaseRange.expand(maRectangles[a]);
- }
- }
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedAlpha, 1);
+ }
+ else // CELL_OVERLAY_INVERT
+ {
+ // embed in invert primitive
+ const drawinglayer::primitive2d::Primitive2DReference aInvert(
+ new drawinglayer::primitive2d::InvertPrimitive2D(
+ aRetval));
- void OverlayObjectCell::transform(const basegfx::B2DHomMatrix& rMatrix)
- {
- for(sal_uInt32 a(0L); a < maRectangles.size(); a++)
- {
- maRectangles[a].transform(rMatrix);
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aInvert, 1);
+ }
}
- }
+ return aRetval;
+ }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlayobjectlist.cxx b/svx/source/sdr/overlay/overlayobjectlist.cxx
index 3c9107d94bfe..370b6d66c225 100644
--- a/svx/source/sdr/overlay/overlayobjectlist.cxx
+++ b/svx/source/sdr/overlay/overlayobjectlist.cxx
@@ -40,6 +40,8 @@
// get access to basic algos like ::std::find
#include <algorithm>
+#include <drawinglayer/processor2d/hittestprocessor2d.hxx>
+
//////////////////////////////////////////////////////////////////////////////
namespace sdr
@@ -73,63 +75,92 @@ namespace sdr
void OverlayObjectList::remove(OverlayObject& rOverlayObject)
{
const OverlayObjectVector::iterator aFindResult = ::std::find(maVector.begin(), maVector.end(), &rOverlayObject);
- DBG_ASSERT((aFindResult != maVector.end()),
- "OverlayObjectList::remove: Could not find given object in list (!)");
- maVector.erase(aFindResult);
+ const bool bFound(aFindResult != maVector.end());
+ OSL_ENSURE(bFound, "Could not find given object in list (!)");
+
+ if(bFound)
+ {
+ maVector.erase(aFindResult);
+ }
}
- sal_Bool OverlayObjectList::isHit(const basegfx::B2DPoint& rPos, double fTol) const
+ bool OverlayObjectList::isHitLogic(const basegfx::B2DPoint& rLogicPosition, double fLogicTolerance) const
{
if(maVector.size())
{
OverlayObjectVector::const_iterator aStart(maVector.begin());
+ sdr::overlay::OverlayObject* pFirst = *aStart;
+ OSL_ENSURE(pFirst, "Corrupt OverlayObjectList (!)");
+ OverlayManager* pManager = pFirst->getOverlayManager();
- if(0.0 == fTol)
+ if(pManager)
{
- ::sdr::overlay::OverlayObject* pCandidate = *aStart;
- OverlayManager* pManager = pCandidate->getOverlayManager();
-
- if(pManager)
+ if(0.0 == fLogicTolerance)
{
- Size aSizeLogic(pManager->getOutputDevice().PixelToLogic(
+ const Size aSizeLogic(pManager->getOutputDevice().PixelToLogic(
Size(DEFAULT_VALUE_FOR_HITTEST_PIXEL, DEFAULT_VALUE_FOR_HITTEST_PIXEL)));
- fTol = aSizeLogic.Width();
+ fLogicTolerance = aSizeLogic.Width();
}
- }
- for(; aStart != maVector.end(); aStart++)
- {
- ::sdr::overlay::OverlayObject* pCandidate = *aStart;
+ const drawinglayer::geometry::ViewInformation2D aViewInformation2D(pManager->getCurrentViewInformation2D());
+ drawinglayer::processor2d::HitTestProcessor2D aHitTestProcessor2D(
+ aViewInformation2D,
+ rLogicPosition,
+ fLogicTolerance,
+ false);
- if(pCandidate->isHit(rPos, fTol))
+ for(; aStart != maVector.end(); aStart++)
{
- return sal_True;
+ sdr::overlay::OverlayObject* pCandidate = *aStart;
+ OSL_ENSURE(pCandidate, "Corrupt OverlayObjectList (!)");
+
+ if(pCandidate->isHittable())
+ {
+ const drawinglayer::primitive2d::Primitive2DSequence& rSequence = pCandidate->getOverlayObjectPrimitive2DSequence();
+
+ if(rSequence.hasElements())
+ {
+ aHitTestProcessor2D.process(rSequence);
+
+ if(aHitTestProcessor2D.getHit())
+ {
+ return true;
+ }
+ }
+ }
}
}
}
- return sal_False;
+ return false;
}
- sal_Bool OverlayObjectList::isHitPixel(const Point& rPos, sal_uInt32 nTol) const
+ bool OverlayObjectList::isHitPixel(const Point& rDiscretePosition, sal_uInt32 nDiscreteTolerance) const
{
if(maVector.size())
{
OverlayObjectVector::const_iterator aStart(maVector.begin());
- ::sdr::overlay::OverlayObject* pCandidate = *aStart;
+ sdr::overlay::OverlayObject* pCandidate = *aStart;
OverlayManager* pManager = pCandidate->getOverlayManager();
if(pManager)
{
- Point aPosLogic(pManager->getOutputDevice().PixelToLogic(rPos));
- Size aSizeLogic(pManager->getOutputDevice().PixelToLogic(Size(nTol, nTol)));
- basegfx::B2DPoint aPosition(aPosLogic.X(), aPosLogic.Y());
+ const Point aPosLogic(pManager->getOutputDevice().PixelToLogic(rDiscretePosition));
+ const basegfx::B2DPoint aPosition(aPosLogic.X(), aPosLogic.Y());
- return isHit(aPosition, (double)aSizeLogic.Width());
+ if(nDiscreteTolerance)
+ {
+ const Size aSizeLogic(pManager->getOutputDevice().PixelToLogic(Size(nDiscreteTolerance, nDiscreteTolerance)));
+ return isHitLogic(aPosition, (double)aSizeLogic.Width());
+ }
+ else
+ {
+ return isHitLogic(aPosition);
+ }
}
}
- return sal_False;
+ return false;
}
basegfx::B2DRange OverlayObjectList::getBaseRange() const
@@ -149,20 +180,6 @@ namespace sdr
return aRetval;
}
-
- void OverlayObjectList::transform(const basegfx::B2DHomMatrix& rMatrix)
- {
- if(!rMatrix.isIdentity() && maVector.size())
- {
- OverlayObjectVector::iterator aStart(maVector.begin());
-
- for(; aStart != maVector.end(); aStart++)
- {
- ::sdr::overlay::OverlayObject* pCandidate = *aStart;
- pCandidate->transform(rMatrix);
- }
- }
- }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlaypolypolygon.cxx b/svx/source/sdr/overlay/overlaypolypolygon.cxx
index 3d859a9b0659..a94dbdb9d1c4 100644
--- a/svx/source/sdr/overlay/overlaypolypolygon.cxx
+++ b/svx/source/sdr/overlay/overlaypolypolygon.cxx
@@ -35,6 +35,8 @@
#include <vcl/outdev.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -42,21 +44,33 @@ namespace sdr
{
namespace overlay
{
- void OverlayPolyPolygonStriped::drawGeometry(OutputDevice& rOutputDevice)
+ drawinglayer::primitive2d::Primitive2DSequence OverlayPolyPolygonStriped::createOverlayObjectPrimitive2DSequence()
{
- if(maPolyPolygon.count())
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
+
+ if(getOverlayManager())
{
- for(sal_uInt32 a(0L); a < maPolyPolygon.count(); a++)
- {
- ImpDrawPolygonStriped(rOutputDevice, maPolyPolygon.getB2DPolygon(a));
- }
+ const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor());
+ const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor());
+ const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel());
+
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new drawinglayer::primitive2d::PolyPolygonMarkerPrimitive2D(
+ getPolyPolygon(),
+ aRGBColorA,
+ aRGBColorB,
+ fStripeLengthPixel));
+
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
}
+
+ return aRetval;
}
- void OverlayPolyPolygonStriped::createBaseRange(OutputDevice& /*rOutputDevice*/)
+ void OverlayPolyPolygonStriped::stripeDefinitionHasChanged()
{
- // use tooling to get range from PolyPolygon
- maBaseRange = basegfx::tools::getRange(maPolyPolygon);
+ // react on OverlayManager's stripe definition change
+ objectChange();
}
OverlayPolyPolygonStriped::OverlayPolyPolygonStriped(
@@ -81,67 +95,6 @@ namespace sdr
objectChange();
}
}
-
- sal_Bool OverlayPolyPolygonStriped::isHit(const basegfx::B2DPoint& rPos, double fTol) const
- {
- if(isHittable())
- {
- return basegfx::tools::isInEpsilonRange(maPolyPolygon, rPos, fTol);
- }
-
- return sal_False;
- }
-
- void OverlayPolyPolygonStriped::transform(const basegfx::B2DHomMatrix& rMatrix)
- {
- if(!rMatrix.isIdentity())
- {
- // transform maPolyPolygon
- maPolyPolygon.transform(rMatrix);
-
- // register change (after change)
- objectChange();
- }
- }
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace overlay
- {
- void OverlayPolyPolygon::drawGeometry(OutputDevice& rOutputDevice)
- {
- if(maPolyPolygon.count())
- {
- rOutputDevice.SetLineColor(getBaseColor());
- rOutputDevice.SetFillColor();
-
- // iterate self, else the single polygons will be closed when
- // using DrawPolyPolygon
- for(sal_uInt32 a(0L); a < maPolyPolygon.count(); a++)
- {
- const Polygon aPaintPoly(maPolyPolygon.getB2DPolygon(a));
- rOutputDevice.DrawPolyLine(aPaintPoly);
- }
- }
- }
-
- OverlayPolyPolygon::OverlayPolyPolygon(
- const basegfx::B2DPolyPolygon& rPolyPolygon,
- Color aPolygonColor)
- : OverlayPolyPolygonStriped(rPolyPolygon)
- {
- // set base color here, OverlayCrosshairStriped constructor has set
- // it to it's own default.
- maBaseColor = aPolygonColor;
- }
-
- OverlayPolyPolygon::~OverlayPolyPolygon()
- {
- }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx b/svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx
index 1383a296709b..c43a9494901f 100644
--- a/svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx
+++ b/svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx
@@ -43,55 +43,9 @@ namespace sdr
{
namespace overlay
{
- void OverlayPrimitive2DSequenceObject::drawGeometry(OutputDevice& rOutputDevice)
+ drawinglayer::primitive2d::Primitive2DSequence OverlayPrimitive2DSequenceObject::createOverlayObjectPrimitive2DSequence()
{
- if(getOverlayManager())
- {
- // prepare ViewInformation2D
- const drawinglayer::geometry::ViewInformation2D aViewInformation2D(
- basegfx::B2DHomMatrix(),
- rOutputDevice.GetViewTransformation(),
- basegfx::B2DRange(),
- 0,
- 0.0,
- 0);
-
- // create processor
- drawinglayer::processor2d::BaseProcessor2D* pProcessor = ::sdr::contact::createBaseProcessor2DFromOutputDevice(
- rOutputDevice,
- aViewInformation2D);
-
- if(pProcessor)
- {
- pProcessor->process(getSequence());
-
- delete pProcessor;
- }
- }
- }
-
- void OverlayPrimitive2DSequenceObject::createBaseRange(OutputDevice& rOutputDevice)
- {
- const drawinglayer::geometry::ViewInformation2D aViewInformation2D(
- basegfx::B2DHomMatrix(),
- rOutputDevice.GetViewTransformation(),
- basegfx::B2DRange(),
- 0,
- 0.0,
- 0);
-
- maBaseRange = drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(
- getSequence(), aViewInformation2D);
- }
-
- sal_Bool OverlayPrimitive2DSequenceObject::isHit(const basegfx::B2DPoint& /*rPos*/, double /*fTol*/) const
- {
- if(isHittable())
- {
- return false;
- }
-
- return false;
+ return getSequence();
}
OverlayPrimitive2DSequenceObject::OverlayPrimitive2DSequenceObject(const drawinglayer::primitive2d::Primitive2DSequence& rSequence)
diff --git a/svx/source/sdr/overlay/overlayrollingrectangle.cxx b/svx/source/sdr/overlay/overlayrollingrectangle.cxx
index ea5be0e4f400..42a3575288be 100644
--- a/svx/source/sdr/overlay/overlayrollingrectangle.cxx
+++ b/svx/source/sdr/overlay/overlayrollingrectangle.cxx
@@ -35,6 +35,11 @@
#include <vcl/salbtype.hxx>
#include <vcl/outdev.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/overlay/overlaytools.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -42,65 +47,59 @@ namespace sdr
{
namespace overlay
{
- void OverlayRollingRectangleStriped::drawGeometry(OutputDevice& rOutputDevice)
+ drawinglayer::primitive2d::Primitive2DSequence OverlayRollingRectangleStriped::createOverlayObjectPrimitive2DSequence()
{
- const basegfx::B2DRange aRange(getBasePosition(), getSecondPosition());
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
- if(getShowBounds())
+ if(getOverlayManager() && (getShowBounds() || getExtendedLines()))
{
- ImpDrawRangeStriped(rOutputDevice, aRange);
- }
-
- if(getExtendedLines())
- {
- const Point aEmptyPoint;
- const Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel());
- const Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel));
-
- // Left lines
- ImpDrawLineStriped(rOutputDevice, aVisibleLogic.Left(), aRange.getMinY(), aRange.getMinX(), aRange.getMinY());
- ImpDrawLineStriped(rOutputDevice, aVisibleLogic.Left(), aRange.getMaxY(), aRange.getMinX(), aRange.getMaxY());
-
- // Right lines
- ImpDrawLineStriped(rOutputDevice, aRange.getMaxX(), aRange.getMinY(), aVisibleLogic.Right(), aRange.getMinY());
- ImpDrawLineStriped(rOutputDevice, aRange.getMaxX(), aRange.getMaxY(), aVisibleLogic.Right(), aRange.getMaxY());
+ const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor());
+ const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor());
+ const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel());
+ const basegfx::B2DRange aRollingRectangle(getBasePosition(), getSecondPosition());
- // Top lines
- ImpDrawLineStriped(rOutputDevice, aRange.getMinX(), aVisibleLogic.Top(), aRange.getMinX(), aRange.getMinY());
- ImpDrawLineStriped(rOutputDevice, aRange.getMaxX(), aVisibleLogic.Top(), aRange.getMaxX(), aRange.getMinY());
+ if(getShowBounds())
+ {
+ // view-independent part, create directly
+ const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(aRollingRectangle));
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new drawinglayer::primitive2d::PolygonMarkerPrimitive2D(
+ aPolygon,
+ aRGBColorA,
+ aRGBColorB,
+ fStripeLengthPixel));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aReference);
+ }
- // Bottom lines
- ImpDrawLineStriped(rOutputDevice, aRange.getMinX(), aRange.getMaxY(), aRange.getMinX(), aVisibleLogic.Bottom());
- ImpDrawLineStriped(rOutputDevice, aRange.getMaxX(), aRange.getMaxY(), aRange.getMaxX(), aVisibleLogic.Bottom());
+ if(getExtendedLines())
+ {
+ // view-dependent part, use helper primitive
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new drawinglayer::primitive2d::OverlayRollingRectanglePrimitive(
+ aRollingRectangle,
+ aRGBColorA,
+ aRGBColorB,
+ fStripeLengthPixel));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aReference);
+ }
}
+
+ return aRetval;
}
- void OverlayRollingRectangleStriped::createBaseRange(OutputDevice& rOutputDevice)
+ void OverlayRollingRectangleStriped::stripeDefinitionHasChanged()
{
- // reset range and expand it
- maBaseRange.reset();
-
- if(getExtendedLines())
- {
- const Point aEmptyPoint;
- const Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel());
- const Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel));
- maBaseRange.expand(basegfx::B2DPoint(aVisibleLogic.Left(), aVisibleLogic.Top()));
- maBaseRange.expand(basegfx::B2DPoint(aVisibleLogic.Right(), aVisibleLogic.Bottom()));
- }
-
- if(getShowBounds())
- {
- maBaseRange.expand(getBasePosition());
- maBaseRange.expand(getSecondPosition());
- }
+ // react on OverlayManager's stripe definition change
+ objectChange();
}
OverlayRollingRectangleStriped::OverlayRollingRectangleStriped(
const basegfx::B2DPoint& rBasePos,
const basegfx::B2DPoint& rSecondPos,
- sal_Bool bExtendedLines,
- sal_Bool bShowBounds)
+ bool bExtendedLines,
+ bool bShowBounds)
: OverlayObjectWithBasePosition(rBasePos, Color(COL_BLACK)),
maSecondPosition(rSecondPos),
mbExtendedLines(bExtendedLines),
@@ -124,9 +123,9 @@ namespace sdr
}
}
- void OverlayRollingRectangleStriped::setExtendedLines(sal_Bool bNew)
+ void OverlayRollingRectangleStriped::setExtendedLines(bool bNew)
{
- if(bNew != mbExtendedLines)
+ if(bNew != (bool)mbExtendedLines)
{
// remember new value
mbExtendedLines = bNew;
@@ -136,9 +135,9 @@ namespace sdr
}
}
- void OverlayRollingRectangleStriped::setShowBounds(sal_Bool bNew)
+ void OverlayRollingRectangleStriped::setShowBounds(bool bNew)
{
- if(bNew != mbShowBounds)
+ if(bNew != (bool)mbShowBounds)
{
// remember new value
mbShowBounds = bNew;
@@ -147,138 +146,6 @@ namespace sdr
objectChange();
}
}
-
- sal_Bool OverlayRollingRectangleStriped::isHit(const basegfx::B2DPoint& rPos, double fTol) const
- {
- if(isHittable())
- {
- if(getExtendedLines())
- {
- const basegfx::B2DRange aRange(getBaseRange());
- const basegfx::B2DPoint aMinimum(aRange.getMinimum());
- const basegfx::B2DPoint aMaximum(aRange.getMaximum());
-
- // test upper line horizontal
- if(rPos.getY() > (aMinimum.getY() - fTol) && rPos.getY() < (aMinimum.getY() + fTol))
- {
- return sal_True;
- }
-
- // test lower line horizontal
- if(rPos.getY() > (aMaximum.getY() - fTol) && rPos.getY() < (aMaximum.getY() + fTol))
- {
- return sal_True;
- }
-
- // test left line vertical
- if(rPos.getX() > (aMinimum.getX() - fTol) && rPos.getX() < (aMinimum.getX() + fTol))
- {
- return sal_True;
- }
-
- // test rightline vertical
- if(rPos.getX() > (aMaximum.getX() - fTol) && rPos.getX() < (aMaximum.getX() + fTol))
- {
- return sal_True;
- }
- }
-
- if(getShowBounds())
- {
- // test for inside grown range, outside shrinked one to test for border
- // hit without interiour
- basegfx::B2DRange aOuterRange(getBaseRange());
- aOuterRange.grow(fTol);
-
- if(aOuterRange.isInside(rPos))
- {
- basegfx::B2DRange aInnerRange(getBaseRange());
- aInnerRange.grow(-fTol);
-
- return !aInnerRange.isInside(rPos);
- }
- }
- }
-
- return sal_False;
- }
-
- void OverlayRollingRectangleStriped::transform(const basegfx::B2DHomMatrix& rMatrix)
- {
- if(!rMatrix.isIdentity())
- {
- // transform base position
- OverlayObjectWithBasePosition::transform(rMatrix);
-
- // transform maSecondPosition
- const basegfx::B2DPoint aNewSecondPosition = rMatrix * getSecondPosition();
- setSecondPosition(aNewSecondPosition);
- }
- }
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace overlay
- {
- void OverlayRollingRectangle::drawGeometry(OutputDevice& rOutputDevice)
- {
- const Point aStart(FRound(getBasePosition().getX()), FRound(getBasePosition().getY()));
- const Point aEnd(FRound(getSecondPosition().getX()), FRound(getSecondPosition().getY()));
- Rectangle aRectangle(aStart, aEnd);
- aRectangle.Justify();
-
- if(getShowBounds())
- {
- rOutputDevice.SetLineColor(getBaseColor());
- rOutputDevice.SetFillColor();
-
- rOutputDevice.DrawRect(aRectangle);
- }
-
- if(getExtendedLines())
- {
- const Point aEmptyPoint;
- const Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel());
- const Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel));
-
- // Left lines
- rOutputDevice.DrawLine(Point(aVisibleLogic.Left(), aRectangle.Top()), aRectangle.TopLeft());
- rOutputDevice.DrawLine(Point(aVisibleLogic.Left(), aRectangle.Bottom()), aRectangle.BottomLeft());
-
- // Right lines
- rOutputDevice.DrawLine(aRectangle.TopRight(), Point(aVisibleLogic.Right(), aRectangle.Top()));
- rOutputDevice.DrawLine(aRectangle.BottomRight(), Point(aVisibleLogic.Right(), aRectangle.Bottom()));
-
- // Top lines
- rOutputDevice.DrawLine(Point(aRectangle.Left(), aVisibleLogic.Top()), aRectangle.TopLeft());
- rOutputDevice.DrawLine(Point(aRectangle.Right(), aVisibleLogic.Top()), aRectangle.TopRight());
-
- // Bottom lines
- rOutputDevice.DrawLine(aRectangle.BottomLeft(), Point(aRectangle.Left(), aVisibleLogic.Bottom()));
- rOutputDevice.DrawLine(aRectangle.BottomRight(), Point(aRectangle.Right(), aVisibleLogic.Bottom()));
- }
- }
-
- OverlayRollingRectangle::OverlayRollingRectangle(
- const basegfx::B2DPoint& rBasePos,
- const basegfx::B2DPoint& rSecondPos,
- Color aLineColor,
- sal_Bool bExtendedLines,
- sal_Bool bShowBounds)
- : OverlayRollingRectangleStriped(rBasePos, rSecondPos, bExtendedLines, bShowBounds)
- {
- // set base color here, OverlayCrosshairStriped constructor has set
- // it to it's own default.
- maBaseColor = aLineColor;
- }
-
- OverlayRollingRectangle::~OverlayRollingRectangle()
- {
- }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlaysdrobject.cxx b/svx/source/sdr/overlay/overlaysdrobject.cxx
deleted file mode 100644
index 7f1dbf2d5a4f..000000000000
--- a/svx/source/sdr/overlay/overlaysdrobject.cxx
+++ /dev/null
@@ -1,87 +0,0 @@
-/*************************************************************************
- *
- * 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: overlaysdrobject.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svx.hxx"
-#include <svx/sdr/overlay/overlaysdrobject.hxx>
-#include <svx/svdobj.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace overlay
- {
- void OverlaySdrObject::drawGeometry(OutputDevice& rOutputDevice)
- {
- mrSdrObject.SingleObjectPainter(rOutputDevice);
- }
-
- void OverlaySdrObject::createBaseRange(OutputDevice& /*rOutputDevice*/)
- {
- // reset range and expand it
- maBaseRange.reset();
-
- // get BoundRect
- Rectangle aBoundRect(mrSdrObject.GetCurrentBoundRect());
- const basegfx::B2DPoint aTopLeft(aBoundRect.Left(), aBoundRect.Top());
- const basegfx::B2DPoint aBottomRight(aBoundRect.Right(), aBoundRect.Bottom());
-
- maBaseRange.expand(aTopLeft);
- maBaseRange.expand(aBottomRight);
- }
-
- OverlaySdrObject::OverlaySdrObject(
- const basegfx::B2DPoint& rBasePos,
- const SdrObject& rObject)
- : OverlayObjectWithBasePosition(rBasePos, Color(COL_BLACK)),
- mrSdrObject(rObject)
- {
- }
-
- OverlaySdrObject::~OverlaySdrObject()
- {
- }
-
- sal_Bool OverlaySdrObject::isHit(const basegfx::B2DPoint& rPos, double fTol) const
- {
- if(isHittable())
- {
- Point aPnt( (long)rPos.getX(), (long)rPos.getY() );
- return mrSdrObject.CheckHit(aPnt, (USHORT)fTol, 0) != 0 ? sal_True : sal_False;
- }
-
- return sal_False;
- }
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
-// eof
diff --git a/svx/source/sdr/overlay/overlaytools.cxx b/svx/source/sdr/overlay/overlaytools.cxx
new file mode 100644
index 000000000000..664c487c7e43
--- /dev/null
+++ b/svx/source/sdr/overlay/overlaytools.cxx
@@ -0,0 +1,498 @@
+/*************************************************************************
+ *
+ * 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: overlayobject.cxx,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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/overlay/overlaytools.hxx>
+#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ OverlayBitmapExPrimitive::OverlayBitmapExPrimitive(
+ const BitmapEx& rBitmapEx,
+ const basegfx::B2DPoint& rBasePosition,
+ sal_uInt16 nCenterX,
+ sal_uInt16 nCenterY)
+ : DiscreteMetricDependentPrimitive2D(),
+ maBitmapEx(rBitmapEx),
+ maBasePosition(rBasePosition),
+ mnCenterX(nCenterX),
+ mnCenterY(nCenterY)
+ {}
+
+ Primitive2DSequence OverlayBitmapExPrimitive::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ Primitive2DSequence aRetval;
+ const Size aBitmapSize(getBitmapEx().GetSizePixel());
+
+ if(aBitmapSize.Width() && aBitmapSize.Height() && basegfx::fTools::more(getDiscreteUnit(), 0.0))
+ {
+ // calculate back from internal bitmap's extreme coordinates (the edges)
+ // to logical coordinates. Only use a unified scaling value (getDiscreteUnit(),
+ // the prepared one which expresses how many logic units form a discrete unit)
+ // for this step. This primitive is to be displayed always unscaled (in it's pixel size)
+ // and unrotated, more like a marker
+ const double fLeft(((0.0 - getCenterX()) * getDiscreteUnit()) + getBasePosition().getX());
+ const double fTop(((0.0 - getCenterY()) * getDiscreteUnit()) + getBasePosition().getY());
+ const double fRight((((aBitmapSize.getWidth() - 1.0) - getCenterX()) * getDiscreteUnit()) + getBasePosition().getX());
+ const double fBottom((((aBitmapSize.getHeight() - 1.0) - getCenterY()) * getDiscreteUnit()) + getBasePosition().getY());
+
+ // create a BitmapPrimitive2D using those positions
+ basegfx::B2DHomMatrix aTransform;
+
+ aTransform.set(0, 0, fRight - fLeft);
+ aTransform.set(1, 1, fBottom - fTop);
+ aTransform.set(0, 2, fLeft);
+ aTransform.set(1, 2, fTop);
+
+ const Primitive2DReference aPrimitive(new BitmapPrimitive2D(getBitmapEx(), aTransform));
+ aRetval = Primitive2DSequence(&aPrimitive, 1);
+ }
+
+ return aRetval;
+ }
+
+ bool OverlayBitmapExPrimitive::operator==( const BasePrimitive2D& rPrimitive ) const
+ {
+ if(DiscreteMetricDependentPrimitive2D::operator==(rPrimitive))
+ {
+ const OverlayBitmapExPrimitive& rCompare = static_cast< const OverlayBitmapExPrimitive& >(rPrimitive);
+
+ return (getBitmapEx() == rCompare.getBitmapEx()
+ && getBasePosition() == rCompare.getBasePosition()
+ && getCenterX() == rCompare.getCenterX()
+ && getCenterY() == rCompare.getCenterY());
+ }
+
+ return false;
+ }
+
+ ImplPrimitrive2DIDBlock(OverlayBitmapExPrimitive, PRIMITIVE2D_ID_OVERLAYBITMAPEXPRIMITIVE)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ OverlayCrosshairPrimitive::OverlayCrosshairPrimitive(
+ const basegfx::B2DPoint& rBasePosition,
+ const basegfx::BColor& rRGBColorA,
+ const basegfx::BColor& rRGBColorB,
+ double fDiscreteDashLength)
+ : ViewportDependentPrimitive2D(),
+ maBasePosition(rBasePosition),
+ maRGBColorA(rRGBColorA),
+ maRGBColorB(rRGBColorB),
+ mfDiscreteDashLength(fDiscreteDashLength)
+ {}
+
+ Primitive2DSequence OverlayCrosshairPrimitive::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ // use the prepared Viewport information accessible using getViewport()
+ Primitive2DSequence aRetval;
+
+ if(!getViewport().isEmpty())
+ {
+ aRetval.realloc(2);
+ basegfx::B2DPolygon aPolygon;
+
+ aPolygon.append(basegfx::B2DPoint(getViewport().getMinX(), getBasePosition().getY()));
+ aPolygon.append(basegfx::B2DPoint(getViewport().getMaxX(), getBasePosition().getY()));
+
+ aRetval[0] = Primitive2DReference(
+ new PolygonMarkerPrimitive2D(
+ aPolygon,
+ getRGBColorA(),
+ getRGBColorB(),
+ getDiscreteDashLength()));
+
+ aPolygon.clear();
+ aPolygon.append(basegfx::B2DPoint(getBasePosition().getX(), getViewport().getMinY()));
+ aPolygon.append(basegfx::B2DPoint(getBasePosition().getX(), getViewport().getMaxY()));
+
+ aRetval[1] = Primitive2DReference(
+ new PolygonMarkerPrimitive2D(
+ aPolygon,
+ getRGBColorA(),
+ getRGBColorB(),
+ getDiscreteDashLength()));
+ }
+
+ return aRetval;
+ }
+
+ bool OverlayCrosshairPrimitive::operator==( const BasePrimitive2D& rPrimitive ) const
+ {
+ if(ViewportDependentPrimitive2D::operator==(rPrimitive))
+ {
+ const OverlayCrosshairPrimitive& rCompare = static_cast< const OverlayCrosshairPrimitive& >(rPrimitive);
+
+ return (getBasePosition() == rCompare.getBasePosition()
+ && getRGBColorA() == rCompare.getRGBColorA()
+ && getRGBColorB() == rCompare.getRGBColorB()
+ && getDiscreteDashLength() == rCompare.getDiscreteDashLength());
+ }
+
+ return false;
+ }
+
+ ImplPrimitrive2DIDBlock(OverlayCrosshairPrimitive, PRIMITIVE2D_ID_OVERLAYCROSSHAIRPRIMITIVE)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ OverlayHatchRectanglePrimitive::OverlayHatchRectanglePrimitive(
+ const basegfx::B2DRange& rObjectRange,
+ double fDiscreteHatchDistance,
+ double fHatchRotation,
+ const basegfx::BColor& rHatchColor,
+ double fDiscreteGrow,
+ double fDiscreteShrink,
+ double fRotation)
+ : DiscreteMetricDependentPrimitive2D(),
+ maObjectRange(rObjectRange),
+ mfDiscreteHatchDistance(fDiscreteHatchDistance),
+ mfHatchRotation(fHatchRotation),
+ maHatchColor(rHatchColor),
+ mfDiscreteGrow(fDiscreteGrow),
+ mfDiscreteShrink(fDiscreteShrink),
+ mfRotation(fRotation)
+ {}
+
+ Primitive2DSequence OverlayHatchRectanglePrimitive::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ Primitive2DSequence aRetval;
+
+ if(basegfx::fTools::more(getDiscreteUnit(), 0.0))
+ {
+ basegfx::B2DRange aInnerRange(getObjectRange());
+ basegfx::B2DRange aOuterRange(getObjectRange());
+ basegfx::B2DPolyPolygon aHatchPolyPolygon;
+
+ aOuterRange.grow(getDiscreteUnit() * getDiscreteGrow());
+ aInnerRange.grow(getDiscreteUnit() * -getDiscreteShrink());
+
+ aHatchPolyPolygon.append(basegfx::tools::createPolygonFromRect(aOuterRange));
+
+ if(!aInnerRange.isEmpty())
+ {
+ aHatchPolyPolygon.append(basegfx::tools::createPolygonFromRect(aInnerRange));
+ }
+
+ if(!basegfx::fTools::equalZero(getRotation()))
+ {
+ basegfx::B2DHomMatrix aTransform;
+
+ aTransform.translate(-getObjectRange().getMinX(), -getObjectRange().getMinY());
+ aTransform.rotate(getRotation());
+ aTransform.translate(getObjectRange().getMinX(), getObjectRange().getMinY());
+
+ aHatchPolyPolygon.transform(aTransform);
+ }
+
+ const basegfx::BColor aEmptyColor(0.0, 0.0, 0.0);
+ const drawinglayer::attribute::FillHatchAttribute aFillHatchAttribute(
+ drawinglayer::attribute::HATCHSTYLE_SINGLE,
+ getDiscreteHatchDistance() * getDiscreteUnit(),
+ getHatchRotation() - getRotation(),
+ getHatchColor(),
+ false);
+ const Primitive2DReference aPrimitive(
+ new PolyPolygonHatchPrimitive2D(
+ aHatchPolyPolygon,
+ aEmptyColor,
+ aFillHatchAttribute));
+
+ aRetval = Primitive2DSequence(&aPrimitive, 1);
+ }
+
+ return aRetval;
+ }
+
+ bool OverlayHatchRectanglePrimitive::operator==( const BasePrimitive2D& rPrimitive ) const
+ {
+ if(DiscreteMetricDependentPrimitive2D::operator==(rPrimitive))
+ {
+ const OverlayHatchRectanglePrimitive& rCompare = static_cast< const OverlayHatchRectanglePrimitive& >(rPrimitive);
+
+ return (getObjectRange() == rCompare.getObjectRange()
+ && getDiscreteHatchDistance() == rCompare.getDiscreteHatchDistance()
+ && getHatchRotation() == rCompare.getHatchRotation()
+ && getHatchColor() == rCompare.getHatchColor()
+ && getDiscreteGrow() == rCompare.getDiscreteGrow()
+ && getDiscreteShrink() == rCompare.getDiscreteShrink()
+ && getRotation() == rCompare.getRotation());
+ }
+
+ return false;
+ }
+
+ ImplPrimitrive2DIDBlock(OverlayHatchRectanglePrimitive, PRIMITIVE2D_ID_OVERLAYHATCHRECTANGLEPRIMITIVE)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ OverlayHelplineStripedPrimitive::OverlayHelplineStripedPrimitive(
+ const basegfx::B2DPoint& rBasePosition,
+ HelplineStyle eStyle,
+ const basegfx::BColor& rRGBColorA,
+ const basegfx::BColor& rRGBColorB,
+ double fDiscreteDashLength)
+ : ViewportDependentPrimitive2D(),
+ maBasePosition(rBasePosition),
+ meStyle(eStyle),
+ maRGBColorA(rRGBColorA),
+ maRGBColorB(rRGBColorB),
+ mfDiscreteDashLength(fDiscreteDashLength)
+ {}
+
+ Primitive2DSequence OverlayHelplineStripedPrimitive::createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const
+ {
+ // use the prepared Viewport information accessible using getViewport()
+ Primitive2DSequence aRetval;
+
+ if(!getViewport().isEmpty())
+ {
+ switch(getStyle())
+ {
+ case HELPLINESTYLE_VERTICAL :
+ {
+ aRetval.realloc(1);
+ basegfx::B2DPolygon aLine;
+
+ aLine.append(basegfx::B2DPoint(getBasePosition().getX(), getViewport().getMinY()));
+ aLine.append(basegfx::B2DPoint(getBasePosition().getX(), getViewport().getMaxY()));
+
+ aRetval[0] = Primitive2DReference(
+ new PolygonMarkerPrimitive2D(
+ aLine,
+ getRGBColorA(),
+ getRGBColorB(),
+ getDiscreteDashLength()));
+ break;
+ }
+
+ case HELPLINESTYLE_HORIZONTAL :
+ {
+ aRetval.realloc(1);
+ basegfx::B2DPolygon aLine;
+
+ aLine.append(basegfx::B2DPoint(getViewport().getMinX(), getBasePosition().getY()));
+ aLine.append(basegfx::B2DPoint(getViewport().getMaxX(), getBasePosition().getY()));
+
+ aRetval[0] = Primitive2DReference(
+ new PolygonMarkerPrimitive2D(
+ aLine,
+ getRGBColorA(),
+ getRGBColorB(),
+ getDiscreteDashLength()));
+ break;
+ }
+
+ default: // case HELPLINESTYLE_POINT :
+ {
+ const double fDiscreteUnit((rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)).getLength());
+ aRetval.realloc(2);
+ basegfx::B2DPolygon aLineA, aLineB;
+
+ aLineA.append(basegfx::B2DPoint(getBasePosition().getX(), getBasePosition().getY() - fDiscreteUnit));
+ aLineA.append(basegfx::B2DPoint(getBasePosition().getX(), getBasePosition().getY() + fDiscreteUnit));
+
+ aRetval[0] = Primitive2DReference(
+ new PolygonMarkerPrimitive2D(
+ aLineA,
+ getRGBColorA(),
+ getRGBColorB(),
+ getDiscreteDashLength()));
+
+ aLineB.append(basegfx::B2DPoint(getBasePosition().getX() - fDiscreteUnit, getBasePosition().getY()));
+ aLineB.append(basegfx::B2DPoint(getBasePosition().getX() + fDiscreteUnit, getBasePosition().getY()));
+
+ aRetval[1] = Primitive2DReference(
+ new PolygonMarkerPrimitive2D(
+ aLineB,
+ getRGBColorA(),
+ getRGBColorB(),
+ getDiscreteDashLength()));
+
+ break;
+ }
+ }
+ }
+
+ return aRetval;
+ }
+
+ bool OverlayHelplineStripedPrimitive::operator==( const BasePrimitive2D& rPrimitive ) const
+ {
+ if(ViewportDependentPrimitive2D::operator==(rPrimitive))
+ {
+ const OverlayHelplineStripedPrimitive& rCompare = static_cast< const OverlayHelplineStripedPrimitive& >(rPrimitive);
+
+ return (getBasePosition() == rCompare.getBasePosition()
+ && getStyle() == rCompare.getStyle()
+ && getRGBColorA() == rCompare.getRGBColorA()
+ && getRGBColorB() == rCompare.getRGBColorB()
+ && getDiscreteDashLength() == rCompare.getDiscreteDashLength());
+ }
+
+ return false;
+ }
+
+ ImplPrimitrive2DIDBlock(OverlayHelplineStripedPrimitive, PRIMITIVE2D_ID_OVERLAYHELPLINESTRIPEDPRIMITIVE)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ OverlayRollingRectanglePrimitive::OverlayRollingRectanglePrimitive(
+ const basegfx::B2DRange& aRollingRectangle,
+ const basegfx::BColor& rRGBColorA,
+ const basegfx::BColor& rRGBColorB,
+ double fDiscreteDashLength)
+ : ViewportDependentPrimitive2D(),
+ maRollingRectangle(aRollingRectangle),
+ maRGBColorA(rRGBColorA),
+ maRGBColorB(rRGBColorB),
+ mfDiscreteDashLength(fDiscreteDashLength)
+ {}
+
+ Primitive2DSequence OverlayRollingRectanglePrimitive::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ // use the prepared Viewport information accessible using getViewport()
+ Primitive2DSequence aRetval;
+
+ if(!getViewport().isEmpty())
+ {
+ basegfx::B2DPolygon aLine;
+ aRetval.realloc(8);
+
+ // Left lines
+ aLine.append(basegfx::B2DPoint(getViewport().getMinX(), getRollingRectangle().getMinY()));
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getRollingRectangle().getMinY()));
+ aRetval[0] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
+
+ aLine.clear();
+ aLine.append(basegfx::B2DPoint(getViewport().getMinX(), getRollingRectangle().getMaxY()));
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getRollingRectangle().getMaxY()));
+ aRetval[1] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
+
+ // Right lines
+ aLine.clear();
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getRollingRectangle().getMinY()));
+ aLine.append(basegfx::B2DPoint(getViewport().getMaxX(), getRollingRectangle().getMinY()));
+ aRetval[2] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
+
+ aLine.clear();
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getRollingRectangle().getMaxY()));
+ aLine.append(basegfx::B2DPoint(getViewport().getMaxX(), getRollingRectangle().getMaxY()));
+ aRetval[3] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
+
+ // Top lines
+ aLine.clear();
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getViewport().getMinY()));
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getRollingRectangle().getMinY()));
+ aRetval[4] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
+
+ aLine.clear();
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getViewport().getMinY()));
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getRollingRectangle().getMinY()));
+ aRetval[5] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
+
+ // Bottom lines
+ aLine.clear();
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getRollingRectangle().getMaxY()));
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getViewport().getMaxY()));
+ aRetval[6] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
+
+ aLine.clear();
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getRollingRectangle().getMaxY()));
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getViewport().getMaxY()));
+ aRetval[7] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
+ }
+
+ return aRetval;
+ }
+
+ bool OverlayRollingRectanglePrimitive::operator==( const BasePrimitive2D& rPrimitive ) const
+ {
+ if(ViewportDependentPrimitive2D::operator==(rPrimitive))
+ {
+ const OverlayRollingRectanglePrimitive& rCompare = static_cast< const OverlayRollingRectanglePrimitive& >(rPrimitive);
+
+ return (getRollingRectangle() == rCompare.getRollingRectangle()
+ && getRGBColorA() == rCompare.getRGBColorA()
+ && getRGBColorB() == rCompare.getRGBColorB()
+ && getDiscreteDashLength() == rCompare.getDiscreteDashLength());
+ }
+
+ return false;
+ }
+
+ ImplPrimitrive2DIDBlock(OverlayRollingRectanglePrimitive, PRIMITIVE2D_ID_OVERLAYROLLINGRECTANGLEPRIMITIVE)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/overlay/overlaytriangle.cxx b/svx/source/sdr/overlay/overlaytriangle.cxx
index 1d01ab24e388..74f23b8f845c 100644
--- a/svx/source/sdr/overlay/overlaytriangle.cxx
+++ b/svx/source/sdr/overlay/overlaytriangle.cxx
@@ -37,6 +37,9 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -44,7 +47,7 @@ namespace sdr
{
namespace overlay
{
- void OverlayTriangleStriped::drawGeometry(OutputDevice& rOutputDevice)
+ drawinglayer::primitive2d::Primitive2DSequence OverlayTriangle::createOverlayObjectPrimitive2DSequence()
{
basegfx::B2DPolygon aPolygon;
@@ -53,33 +56,30 @@ namespace sdr
aPolygon.append(getThirdPosition());
aPolygon.setClosed(true);
- ImpDrawPolygonStriped(rOutputDevice, aPolygon);
- }
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon(aPolygon),
+ getBaseColor().getBColor()));
- void OverlayTriangleStriped::createBaseRange(OutputDevice& /*rOutputDevice*/)
- {
- // reset range and expand it
- maBaseRange.reset();
- maBaseRange.expand(getBasePosition());
- maBaseRange.expand(getSecondPosition());
- maBaseRange.expand(getThirdPosition());
+ return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
}
- OverlayTriangleStriped::OverlayTriangleStriped(
+ OverlayTriangle::OverlayTriangle(
const basegfx::B2DPoint& rBasePos,
const basegfx::B2DPoint& rSecondPos,
- const basegfx::B2DPoint& rThirdPos)
- : OverlayObjectWithBasePosition(rBasePos, Color(COL_BLACK)),
+ const basegfx::B2DPoint& rThirdPos,
+ Color aTriangleColor)
+ : OverlayObjectWithBasePosition(rBasePos, aTriangleColor),
maSecondPosition(rSecondPos),
maThirdPosition(rThirdPos)
{
}
- OverlayTriangleStriped::~OverlayTriangleStriped()
+ OverlayTriangle::~OverlayTriangle()
{
}
- void OverlayTriangleStriped::setSecondPosition(const basegfx::B2DPoint& rNew)
+ void OverlayTriangle::setSecondPosition(const basegfx::B2DPoint& rNew)
{
if(rNew != maSecondPosition)
{
@@ -91,7 +91,7 @@ namespace sdr
}
}
- void OverlayTriangleStriped::setThirdPosition(const basegfx::B2DPoint& rNew)
+ void OverlayTriangle::setThirdPosition(const basegfx::B2DPoint& rNew)
{
if(rNew != maThirdPosition)
{
@@ -102,96 +102,6 @@ namespace sdr
objectChange();
}
}
-
- sal_Bool OverlayTriangleStriped::isHit(const basegfx::B2DPoint& rPos, double fTol) const
- {
- if(isHittable())
- {
- // test with all lines and epsilon-range
- if(basegfx::tools::isInEpsilonRange(getBasePosition(), getThirdPosition(), rPos, fTol))
- {
- return sal_True;
- }
- else if(basegfx::tools::isInEpsilonRange(getSecondPosition(), getBasePosition(), rPos, fTol))
- {
- return sal_True;
- }
- else if(basegfx::tools::isInEpsilonRange(getThirdPosition(), getSecondPosition(), rPos, fTol))
- {
- return sal_True;
- }
-
- // test if inside triangle
- basegfx::B2DPolygon aTestPoly;
- aTestPoly.append(getBasePosition());
- aTestPoly.append(getSecondPosition());
- aTestPoly.append(getThirdPosition());
- aTestPoly.setClosed(true);
-
- return basegfx::tools::isInside(aTestPoly, rPos);
- }
-
- return sal_False;
- }
-
- void OverlayTriangleStriped::transform(const basegfx::B2DHomMatrix& rMatrix)
- {
- if(!rMatrix.isIdentity())
- {
- // transform base position
- OverlayObjectWithBasePosition::transform(rMatrix);
-
- // transform maSecondPosition
- const basegfx::B2DPoint aNewSecondPosition = rMatrix * getSecondPosition();
- setSecondPosition(aNewSecondPosition);
-
- // transform maThirdPosition
- const basegfx::B2DPoint aNewThirdPosition = rMatrix * getThirdPosition();
- setThirdPosition(aNewThirdPosition);
- }
- }
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace overlay
- {
- void OverlayTriangle::drawGeometry(OutputDevice& rOutputDevice)
- {
- Polygon aPolygon(4);
- Point aPosition(FRound(getBasePosition().getX()), FRound(getBasePosition().getY()));
- aPolygon[0] = aPolygon[3] = aPosition;
- aPosition.X() = FRound(getSecondPosition().getX());
- aPosition.Y() = FRound(getSecondPosition().getY());
- aPolygon[1] = aPosition;
- aPosition.X() = FRound(getThirdPosition().getX());
- aPosition.Y() = FRound(getThirdPosition().getY());
- aPolygon[2] = aPosition;
-
- rOutputDevice.SetLineColor();
- rOutputDevice.SetFillColor(getBaseColor());
-
- rOutputDevice.DrawPolygon(aPolygon);
- }
-
- OverlayTriangle::OverlayTriangle(
- const basegfx::B2DPoint& rBasePos,
- const basegfx::B2DPoint& rSecondPos,
- const basegfx::B2DPoint& rThirdPos,
- Color aTriangleColor)
- : OverlayTriangleStriped(rBasePos, rSecondPos, rThirdPos)
- {
- // set base color here, OverlayCrosshairStriped constructor has set
- // it to it's own default.
- maBaseColor = aTriangleColor;
- }
-
- OverlayTriangle::~OverlayTriangle()
- {
- }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index a330362dddbc..277ee70f82ca 100644
--- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -473,7 +473,14 @@ namespace drawinglayer
return pRetval;
}
- attribute::SdrTextAttribute* createNewSdrTextAttribute(const SfxItemSet& rSet, const SdrText& rText)
+ // #i101508# Support handing over given text-to-border distances
+ attribute::SdrTextAttribute* createNewSdrTextAttribute(
+ const SfxItemSet& rSet,
+ const SdrText& rText,
+ const sal_Int32* pLeft,
+ const sal_Int32* pUpper,
+ const sal_Int32* pRight,
+ const sal_Int32* pLower)
{
attribute::SdrTextAttribute* pRetval(0);
const SdrTextObj& rTextObj = rText.GetObject();
@@ -519,10 +526,10 @@ namespace drawinglayer
rText,
aOutlinerParaObject,
((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue(),
- rTextObj.GetTextLeftDistance(),
- rTextObj.GetTextUpperDistance(),
- rTextObj.GetTextRightDistance(),
- rTextObj.GetTextLowerDistance(),
+ pLeft ? *pLeft : rTextObj.GetTextLeftDistance(),
+ pUpper ? *pUpper : rTextObj.GetTextUpperDistance(),
+ pRight ? *pRight : rTextObj.GetTextRightDistance(),
+ pLower ? *pLower : rTextObj.GetTextLowerDistance(),
((const SdrTextContourFrameItem&)rSet.Get(SDRATTR_TEXT_CONTOURFRAME)).GetValue(),
(SDRTEXTFIT_PROPORTIONAL == eFit || SDRTEXTFIT_ALLLINES == eFit),
((const XFormTextHideFormItem&)rSet.Get(XATTR_FORMTXTHIDEFORM)).GetValue(),
@@ -591,10 +598,18 @@ namespace drawinglayer
if(aBitmap.GetPrefMapMode() != aDestinationMapUnit)
{
- // #i96237# need to use LogicToLogic, source is not always pixels
- aBitmap.SetPrefSize(Application::GetDefaultDevice()->LogicToLogic(
- aBitmap.GetPrefSize(), aBitmap.GetPrefMapMode(), aDestinationMapUnit));
- aBitmap.SetPrefMapMode(aDestinationMapUnit);
+ // #i100360# for MAP_PIXEL, LogicToLogic will not work properly,
+ // so fallback to Application::GetDefaultDevice()
+ if(MAP_PIXEL == aBitmap.GetPrefMapMode().GetMapUnit())
+ {
+ aBitmap.SetPrefSize(Application::GetDefaultDevice()->PixelToLogic(
+ aBitmap.GetPrefSize(), aDestinationMapUnit));
+ }
+ else
+ {
+ aBitmap.SetPrefSize(OutputDevice::LogicToLogic(
+ aBitmap.GetPrefSize(), aBitmap.GetPrefMapMode(), aDestinationMapUnit));
+ }
}
// get size
@@ -665,7 +680,7 @@ namespace drawinglayer
// when object has text and text is fontwork and hide contour is set for fontwork, force
// line and fill style to empty
- if(pText && pText->isFontwork() && pText->isHideContour())
+ if(pText && pText->getSdrFormTextAttribute() && pText->isHideContour())
{
bFontworkHideContour = true;
}
@@ -730,7 +745,7 @@ namespace drawinglayer
// when object has text and text is fontwork and hide contour is set for fontwork, force
// line and fill style to empty
- if(pText && pText->isFontwork() && pText->isHideContour())
+ if(pText && pText->getSdrFormTextAttribute() && pText->isHideContour())
{
bFontworkHideContour = true;
}
@@ -1023,7 +1038,14 @@ namespace drawinglayer
}
}
- attribute::SdrFillTextAttribute* createNewSdrFillTextAttribute(const SfxItemSet& rSet, const SdrText* pSdrText)
+ // #i101508# Support handing over given text-to-border distances
+ attribute::SdrFillTextAttribute* createNewSdrFillTextAttribute(
+ const SfxItemSet& rSet,
+ const SdrText* pSdrText,
+ const sal_Int32* pLeft,
+ const sal_Int32* pUpper,
+ const sal_Int32* pRight,
+ const sal_Int32* pLower)
{
attribute::SdrFillTextAttribute* pRetval(0L);
attribute::SdrFillAttribute* pFill(0L);
@@ -1034,12 +1056,12 @@ namespace drawinglayer
// look for text first
if(pSdrText)
{
- pText = createNewSdrTextAttribute(rSet, *pSdrText);
+ pText = createNewSdrTextAttribute(rSet, *pSdrText, pLeft, pUpper, pRight, pLower);
}
// when object has text and text is fontwork and hide contour is set for fontwork, force
// fill style to empty
- if(pText && pText->isFontwork() && pText->isHideContour())
+ if(pText && pText->getSdrFormTextAttribute() && pText->isHideContour())
{
bFontworkHideContour = true;
}
diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
index 4a27eb73de8e..366b934b5473 100644
--- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
+++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
@@ -176,7 +176,7 @@ namespace drawinglayer
bool bWordWrap)
{
::basegfx::B2DHomMatrix aAnchorTransform(rObjectTransform);
- SdrTextPrimitive2D* pNew = 0L;
+ SdrTextPrimitive2D* pNew = 0;
if(rText.isContour())
{
@@ -206,20 +206,32 @@ namespace drawinglayer
aScaledUnitPolyPolygon.transform(aScaleTransform);
// create with unit polygon
- pNew = new SdrContourTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), aScaledUnitPolyPolygon, rObjectTransform);
+ pNew = new SdrContourTextPrimitive2D(
+ &rText.getSdrText(),
+ rText.getOutlinerParaObject(),
+ aScaledUnitPolyPolygon,
+ rObjectTransform);
}
else
{
// create with unit polygon
- pNew = new SdrContourTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), rUnitPolyPolygon, rObjectTransform);
+ pNew = new SdrContourTextPrimitive2D(
+ &rText.getSdrText(),
+ rText.getOutlinerParaObject(),
+ rUnitPolyPolygon,
+ rObjectTransform);
}
}
- else if(rText.isFontwork() && !rText.isScroll())
+ else if(rText.getSdrFormTextAttribute())
{
- // text on path, use scaled polygon. Not allowed when text scrolling is used.
+ // text on path, use scaled polygon
::basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon);
aScaledPolyPolygon.transform(rObjectTransform);
- pNew = new SdrPathTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), aScaledPolyPolygon);
+ pNew = new SdrPathTextPrimitive2D(
+ &rText.getSdrText(),
+ rText.getOutlinerParaObject(),
+ aScaledPolyPolygon,
+ *rText.getSdrFormTextAttribute());
}
else
{
@@ -267,12 +279,21 @@ namespace drawinglayer
if(rText.isFitToSize())
{
// streched text in range
- pNew = new SdrStretchTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), aAnchorTransform);
+ pNew = new SdrStretchTextPrimitive2D(
+ &rText.getSdrText(),
+ rText.getOutlinerParaObject(),
+ aAnchorTransform);
}
else // text in range
{
// build new primitive
- pNew = new SdrBlockTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), aAnchorTransform, rText.isScroll(), bCellText, bWordWrap);
+ pNew = new SdrBlockTextPrimitive2D(
+ &rText.getSdrText(),
+ rText.getOutlinerParaObject(),
+ aAnchorTransform,
+ rText.isScroll(),
+ bCellText,
+ bWordWrap);
}
}
@@ -299,121 +320,124 @@ namespace drawinglayer
return Primitive2DReference(pNew);
}
}
- else if(rText.isScroll())
- {
- // get scroll direction
- const SdrTextAniDirection eDirection(rText.getSdrText().GetObject().GetTextAniDirection());
- const bool bHorizontal(SDRTEXTANI_LEFT == eDirection || SDRTEXTANI_RIGHT == eDirection);
-
- // decompose to get separated values for the scroll box
- ::basegfx::B2DVector aScale, aTranslate;
- double fRotate, fShearX;
- aAnchorTransform.decompose(aScale, aTranslate, fRotate, fShearX);
-
- // build transform from scaled only to full AnchorTransform and inverse
- ::basegfx::B2DHomMatrix aSRT;
- aSRT.shearX(fShearX);
- aSRT.rotate(fRotate);
- aSRT.translate(aTranslate.getX(), aTranslate.getY());
- ::basegfx::B2DHomMatrix aISRT(aSRT);
- aISRT.invert();
-
- // bring the primitive back to scaled only and get scaled range, create new clone for this
- SdrTextPrimitive2D* pNew2 = pNew->createTransformedClone(aISRT);
- OSL_ENSURE(pNew2, "createTextPrimitive: Could not create transformed clone of text primitive (!)");
- delete pNew;
- pNew = pNew2;
-
- // create neutral geometry::ViewInformation2D for local range and decompose calls. This is okay
- // since the decompose is view-independent
- const uno::Sequence< beans::PropertyValue > xViewParameters;
- geometry::ViewInformation2D aViewInformation2D(xViewParameters);
-
- // get range
- const ::basegfx::B2DRange aScaledRange(pNew->getB2DRange(aViewInformation2D));
-
- // create left outside and right outside transformations. Also take care
- // of the clip rectangle
- ::basegfx::B2DHomMatrix aLeft, aRight;
- ::basegfx::B2DPoint aClipTopLeft(0.0, 0.0);
- ::basegfx::B2DPoint aClipBottomRight(aScale.getX(), aScale.getY());
-
- if(bHorizontal)
- {
- aClipTopLeft.setY(aScaledRange.getMinY());
- aClipBottomRight.setY(aScaledRange.getMaxY());
- aLeft.translate(-aScaledRange.getMaxX(), 0.0);
- aRight.translate(aScale.getX() - aScaledRange.getMinX(), 0.0);
- }
- else
- {
- aClipTopLeft.setX(aScaledRange.getMinX());
- aClipBottomRight.setX(aScaledRange.getMaxX());
- aLeft.translate(0.0, -aScaledRange.getMaxY());
- aRight.translate(0.0, aScale.getY() - aScaledRange.getMinY());
- }
-
- aLeft *= aSRT;
- aRight *= aSRT;
-
- // prepare animation list
- drawinglayer::animation::AnimationEntryList aAnimationList;
- if(bHorizontal)
- {
- rText.getScrollTextTiming(aAnimationList, aScale.getX(), aScaledRange.getWidth());
- }
- else
+ if(rText.isScroll())
+ {
+ // suppress scroll when FontWork
+ if(!rText.getSdrFormTextAttribute())
{
- rText.getScrollTextTiming(aAnimationList, aScale.getY(), aScaledRange.getHeight());
- }
+ // get scroll direction
+ const SdrTextAniDirection eDirection(rText.getSdrText().GetObject().GetTextAniDirection());
+ const bool bHorizontal(SDRTEXTANI_LEFT == eDirection || SDRTEXTANI_RIGHT == eDirection);
- if(0.0 != aAnimationList.getDuration())
- {
- // create a new Primitive2DSequence containing the animated text in it's scaled only state.
- // use the decomposition to force to simple text primitives, those will no longer
- // need the outliner for formatting (alternatively it is also possible to just add
- // pNew to aNewPrimitiveSequence)
- Primitive2DSequence aAnimSequence(pNew->get2DDecomposition(aViewInformation2D));
+ // decompose to get separated values for the scroll box
+ ::basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ aAnchorTransform.decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // build transform from scaled only to full AnchorTransform and inverse
+ ::basegfx::B2DHomMatrix aSRT;
+ aSRT.shearX(fShearX);
+ aSRT.rotate(fRotate);
+ aSRT.translate(aTranslate.getX(), aTranslate.getY());
+ ::basegfx::B2DHomMatrix aISRT(aSRT);
+ aISRT.invert();
+
+ // bring the primitive back to scaled only and get scaled range, create new clone for this
+ SdrTextPrimitive2D* pNew2 = pNew->createTransformedClone(aISRT);
+ OSL_ENSURE(pNew2, "createTextPrimitive: Could not create transformed clone of text primitive (!)");
delete pNew;
+ pNew = pNew2;
+
+ // create neutral geometry::ViewInformation2D for local range and decompose calls. This is okay
+ // since the decompose is view-independent
+ const uno::Sequence< beans::PropertyValue > xViewParameters;
+ geometry::ViewInformation2D aViewInformation2D(xViewParameters);
+
+ // get range
+ const ::basegfx::B2DRange aScaledRange(pNew->getB2DRange(aViewInformation2D));
+
+ // create left outside and right outside transformations. Also take care
+ // of the clip rectangle
+ ::basegfx::B2DHomMatrix aLeft, aRight;
+ ::basegfx::B2DPoint aClipTopLeft(0.0, 0.0);
+ ::basegfx::B2DPoint aClipBottomRight(aScale.getX(), aScale.getY());
+
+ if(bHorizontal)
+ {
+ aClipTopLeft.setY(aScaledRange.getMinY());
+ aClipBottomRight.setY(aScaledRange.getMaxY());
+ aLeft.translate(-aScaledRange.getMaxX(), 0.0);
+ aRight.translate(aScale.getX() - aScaledRange.getMinX(), 0.0);
+ }
+ else
+ {
+ aClipTopLeft.setX(aScaledRange.getMinX());
+ aClipBottomRight.setX(aScaledRange.getMaxX());
+ aLeft.translate(0.0, -aScaledRange.getMaxY());
+ aRight.translate(0.0, aScale.getY() - aScaledRange.getMinY());
+ }
+
+ aLeft *= aSRT;
+ aRight *= aSRT;
+
+ // prepare animation list
+ drawinglayer::animation::AnimationEntryList aAnimationList;
+
+ if(bHorizontal)
+ {
+ rText.getScrollTextTiming(aAnimationList, aScale.getX(), aScaledRange.getWidth());
+ }
+ else
+ {
+ rText.getScrollTextTiming(aAnimationList, aScale.getY(), aScaledRange.getHeight());
+ }
+
+ if(0.0 != aAnimationList.getDuration())
+ {
+ // create a new Primitive2DSequence containing the animated text in it's scaled only state.
+ // use the decomposition to force to simple text primitives, those will no longer
+ // need the outliner for formatting (alternatively it is also possible to just add
+ // pNew to aNewPrimitiveSequence)
+ Primitive2DSequence aAnimSequence(pNew->get2DDecomposition(aViewInformation2D));
+ delete pNew;
+
+ // create a new animatedInterpolatePrimitive and add it
+ std::vector< basegfx::B2DHomMatrix > aMatrixStack;
+ aMatrixStack.push_back(aLeft);
+ aMatrixStack.push_back(aRight);
+ const Primitive2DReference xRefA(new AnimatedInterpolatePrimitive2D(aMatrixStack, aAnimationList, aAnimSequence, true));
+ const Primitive2DSequence aContent(&xRefA, 1L);
+
+ // scrolling needs an encapsulating clipping primitive
+ const ::basegfx::B2DRange aClipRange(aClipTopLeft, aClipBottomRight);
+ ::basegfx::B2DPolygon aClipPolygon(::basegfx::tools::createPolygonFromRect(aClipRange));
+ aClipPolygon.transform(aSRT);
+ return Primitive2DReference(new MaskPrimitive2D(::basegfx::B2DPolyPolygon(aClipPolygon), aContent));
+ }
+ else
+ {
+ // add to decomposition
+ return Primitive2DReference(pNew);
+ }
+ }
+ }
- // create a new animatedInterpolatePrimitive and add it
- std::vector< basegfx::B2DHomMatrix > aMatrixStack;
- aMatrixStack.push_back(aLeft);
- aMatrixStack.push_back(aRight);
- const Primitive2DReference xRefA(new AnimatedInterpolatePrimitive2D(aMatrixStack, aAnimationList, aAnimSequence, true));
- const Primitive2DSequence aContent(&xRefA, 1L);
+ if(rText.isInEditMode())
+ {
+ // #i97628#
+ // encapsulate with TextHierarchyEditPrimitive2D to allow renderers
+ // to suppress actively edited content if needed
+ const Primitive2DReference xRefA(pNew);
+ const Primitive2DSequence aContent(&xRefA, 1L);
- // scrolling needs an encapsulating clipping primitive
- const ::basegfx::B2DRange aClipRange(aClipTopLeft, aClipBottomRight);
- ::basegfx::B2DPolygon aClipPolygon(::basegfx::tools::createPolygonFromRect(aClipRange));
- aClipPolygon.transform(aSRT);
- return Primitive2DReference(new MaskPrimitive2D(::basegfx::B2DPolyPolygon(aClipPolygon), aContent));
- }
- else
- {
- // add to decomposition
- return Primitive2DReference(pNew);
- }
+ // create and add TextHierarchyEditPrimitive2D primitive
+ return Primitive2DReference(new TextHierarchyEditPrimitive2D(aContent));
}
else
{
- if(rText.isInEditMode())
- {
- // #i97628#
- // encapsulate with TextHierarchyEditPrimitive2D to allow renderers
- // to suppress actively edited content if needed
- const Primitive2DReference xRefA(pNew);
- const Primitive2DSequence aContent(&xRefA, 1L);
-
- // create and add TextHierarchyEditPrimitive2D primitive
- return Primitive2DReference(new TextHierarchyEditPrimitive2D(aContent));
- }
- else
- {
- // add to decomposition
- return Primitive2DReference(pNew);
- }
+ // add to decomposition
+ return Primitive2DReference(pNew);
}
}
diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
index 7f9b47afb2d4..8d66e8b34d14 100644
--- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
@@ -125,8 +125,13 @@ namespace drawinglayer
}
// create primitive and get text range
- pBlockText = new SdrBlockTextPrimitive2D(pTextAttribute->getSdrText(), pTextAttribute->getOutlinerParaObject(),
- aTextMatrix, pTextAttribute->isScroll(), false, false);
+ pBlockText = new SdrBlockTextPrimitive2D(
+ &pTextAttribute->getSdrText(),
+ pTextAttribute->getOutlinerParaObject(),
+ aTextMatrix,
+ pTextAttribute->isScroll(),
+ false,
+ false);
aTextRange = pBlockText->getB2DRange(aViewInformation);
}
diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
index 113cd226d8ba..0cad266f69d1 100644
--- a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
@@ -41,6 +41,9 @@
#include <drawinglayer/geometry/viewinformation2d.hxx>
#include <unoapi.hxx>
#include <svx/svdpage.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdoutl.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
//////////////////////////////////////////////////////////////////////////////
@@ -48,6 +51,46 @@ using namespace com::sun::star;
//////////////////////////////////////////////////////////////////////////////
+namespace
+{
+ sal_Int16 getPageNumber(const uno::Reference< drawing::XDrawPage >& rxDrawPage)
+ {
+ sal_Int16 nRetval(0);
+ uno::Reference< beans::XPropertySet > xSet(rxDrawPage, uno::UNO_QUERY);
+
+ if (xSet.is())
+ {
+ try
+ {
+ const uno::Any aNumber(xSet->getPropertyValue(::rtl::OUString::createFromAscii("Number")));
+ aNumber >>= nRetval;
+ }
+ catch(const uno::Exception&)
+ {
+ OSL_ASSERT(false);
+ }
+ }
+
+ return nRetval;
+ }
+
+ sal_Int16 getPageCount(const uno::Reference< drawing::XDrawPage >& rxDrawPage)
+ {
+ sal_Int16 nRetval(0);
+ SdrPage* pPage = GetSdrPageFromXDrawPage(rxDrawPage);
+
+ if(pPage && pPage->GetModel())
+ {
+ const sal_uInt16 nPageCount(pPage->GetModel()->GetPageCount());
+ nRetval = ((sal_Int16)nPageCount - 1) / 2;
+ }
+
+ return nRetval;
+ }
+} // end of anonymous namespace
+
+//////////////////////////////////////////////////////////////////////////////
+
namespace drawinglayer
{
namespace primitive2d
@@ -64,20 +107,28 @@ namespace drawinglayer
}
SdrTextPrimitive2D::SdrTextPrimitive2D(
- const SdrText& rSdrText,
+ const SdrText* pSdrText,
const OutlinerParaObject& rOutlinerParaObject)
: BasePrimitive2D(),
- mrSdrText(rSdrText),
+ mrSdrText(const_cast< SdrText* >(pSdrText)),
maOutlinerParaObject(rOutlinerParaObject),
mxLastVisualizingPage(),
+ mnLastPageNumber(0),
+ mnLastPageCount(0),
+ maLastTextBackgroundColor(),
mbLastSpellCheck(false),
- mbContainsPageField(false)
+ mbContainsPageField(false),
+ mbContainsPageCountField(false),
+ mbContainsOtherFields(false)
{
const EditTextObject& rETO = maOutlinerParaObject.GetTextObject();
- mbContainsPageField = rETO.HasField(SvxPageField::StaticType())
- || rETO.HasField(SvxHeaderField::StaticType())
- || rETO.HasField(SvxFooterField::StaticType())
- || rETO.HasField(SvxDateTimeField::StaticType());
+
+ mbContainsPageField = rETO.HasField(SvxPageField::StaticType());
+ mbContainsPageCountField = rETO.HasField(SvxPagesField::StaticType());
+ mbContainsOtherFields = rETO.HasField(SvxHeaderField::StaticType())
+ || rETO.HasField(SvxFooterField::StaticType())
+ || rETO.HasField(SvxDateTimeField::StaticType())
+ || rETO.HasField(SvxAuthorField::StaticType());
}
bool SdrTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
@@ -94,21 +145,66 @@ namespace drawinglayer
Primitive2DSequence SdrTextPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const
{
- const bool bCurrentSpellCheck(getSdrText().GetObject().impCheckSpellCheckForDecomposeTextPrimitive());
+ const bool bCurrentSpellCheck(getSdrText()
+ ? getSdrText()->GetObject().impCheckSpellCheckForDecomposeTextPrimitive()
+ : false);
uno::Reference< drawing::XDrawPage > xCurrentlyVisualizingPage;
+ bool bCurrentlyVisualizingPageIsSet(false);
+ Color aNewTextBackgroundColor;
+ bool bNewTextBackgroundColorIsSet(false);
+ sal_Int16 nCurrentlyValidPageNumber(0);
+ sal_Int16 nCurrentlyValidPageCount(0);
if(getLocalDecomposition().hasElements())
{
bool bDoDelete(getLastSpellCheck() != bCurrentSpellCheck);
- if(!bDoDelete && mbContainsPageField)
+ // check visualized page
+ if(!bDoDelete && (mbContainsPageField || mbContainsPageCountField || mbContainsOtherFields))
{
+ // get visualized page and remember
xCurrentlyVisualizingPage = rViewInformation.getVisualizedPage();
+ bCurrentlyVisualizingPageIsSet = true;
if(xCurrentlyVisualizingPage != mxLastVisualizingPage)
{
bDoDelete = true;
}
+
+ // #i98870# check visualized PageNumber
+ if(!bDoDelete && mbContainsPageField)
+ {
+ nCurrentlyValidPageNumber = getPageNumber(xCurrentlyVisualizingPage);
+
+ if(nCurrentlyValidPageNumber != mnLastPageNumber)
+ {
+ bDoDelete = true;
+ }
+ }
+
+ // #i98870# check visualized PageCount, too
+ if(!bDoDelete && mbContainsPageCountField)
+ {
+ nCurrentlyValidPageCount = getPageCount(xCurrentlyVisualizingPage);
+
+ if(nCurrentlyValidPageCount != mnLastPageCount)
+ {
+ bDoDelete = true;
+ }
+ }
+ }
+
+ // #i101443# check change of TextBackgroundolor
+ if(!bDoDelete && getSdrText() && getSdrText()->GetModel())
+ {
+ SdrOutliner& rDrawOutliner = getSdrText()->GetModel()->GetDrawOutliner(0);
+ aNewTextBackgroundColor = rDrawOutliner.GetBackgroundColor();
+ bNewTextBackgroundColorIsSet = true;
+
+ if(aNewTextBackgroundColor != maLastTextBackgroundColor)
+ {
+ bDoDelete = true;
+ }
}
if(bDoDelete)
@@ -119,8 +215,32 @@ namespace drawinglayer
if(!getLocalDecomposition().hasElements())
{
+ if(!bCurrentlyVisualizingPageIsSet && mbContainsPageField)
+ {
+ xCurrentlyVisualizingPage = rViewInformation.getVisualizedPage();
+ }
+
+ if(!nCurrentlyValidPageNumber && mbContainsPageField)
+ {
+ nCurrentlyValidPageNumber = getPageNumber(xCurrentlyVisualizingPage);
+ }
+
+ if(!nCurrentlyValidPageCount && mbContainsPageCountField)
+ {
+ nCurrentlyValidPageCount = getPageCount(xCurrentlyVisualizingPage);
+ }
+
+ if(!bNewTextBackgroundColorIsSet && getSdrText() && getSdrText()->GetModel())
+ {
+ SdrOutliner& rDrawOutliner = getSdrText()->GetModel()->GetDrawOutliner(0);
+ aNewTextBackgroundColor = rDrawOutliner.GetBackgroundColor();
+ }
+
const_cast< SdrTextPrimitive2D* >(this)->setLastSpellCheck(bCurrentSpellCheck);
const_cast< SdrTextPrimitive2D* >(this)->mxLastVisualizingPage = xCurrentlyVisualizingPage;
+ const_cast< SdrTextPrimitive2D* >(this)->mnLastPageNumber = nCurrentlyValidPageNumber;
+ const_cast< SdrTextPrimitive2D* >(this)->mnLastPageCount = nCurrentlyValidPageCount;
+ const_cast< SdrTextPrimitive2D* >(this)->maLastTextBackgroundColor = aNewTextBackgroundColor;
}
// call parent
@@ -138,7 +258,9 @@ namespace drawinglayer
Primitive2DSequence SdrContourTextPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const
{
Primitive2DSequence aRetval;
- const bool bCurrentSpellCheck(getSdrText().GetObject().impDecomposeContourTextPrimitive(aRetval, *this, aViewInformation));
+ const bool bCurrentSpellCheck(getSdrText()
+ ? getSdrText()->GetObject().impDecomposeContourTextPrimitive(aRetval, *this, aViewInformation)
+ : false);
if(getLastSpellCheck() != bCurrentSpellCheck)
{
@@ -150,11 +272,11 @@ namespace drawinglayer
}
SdrContourTextPrimitive2D::SdrContourTextPrimitive2D(
- const SdrText& rSdrText,
+ const SdrText* pSdrText,
const OutlinerParaObject& rOutlinerParaObject,
- const ::basegfx::B2DPolyPolygon& rUnitPolyPolygon,
- const ::basegfx::B2DHomMatrix& rObjectTransform)
- : SdrTextPrimitive2D(rSdrText, rOutlinerParaObject),
+ const basegfx::B2DPolyPolygon& rUnitPolyPolygon,
+ const basegfx::B2DHomMatrix& rObjectTransform)
+ : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject),
maUnitPolyPolygon(rUnitPolyPolygon),
maObjectTransform(rObjectTransform)
{
@@ -166,16 +288,20 @@ namespace drawinglayer
{
const SdrContourTextPrimitive2D& rCompare = (SdrContourTextPrimitive2D&)rPrimitive;
- return (maUnitPolyPolygon == rCompare.maUnitPolyPolygon
- && maObjectTransform == rCompare.maObjectTransform);
+ return (getUnitPolyPolygon() == rCompare.getUnitPolyPolygon()
+ && getObjectTransform() == rCompare.getObjectTransform());
}
return false;
}
- SdrTextPrimitive2D* SdrContourTextPrimitive2D::createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const
+ SdrTextPrimitive2D* SdrContourTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const
{
- return new SdrContourTextPrimitive2D(getSdrText(), getOutlinerParaObject(), maUnitPolyPolygon, rTransform * maObjectTransform);
+ return new SdrContourTextPrimitive2D(
+ getSdrText(),
+ getOutlinerParaObject(),
+ getUnitPolyPolygon(),
+ rTransform * getObjectTransform());
}
// provide unique ID
@@ -193,7 +319,9 @@ namespace drawinglayer
Primitive2DSequence SdrPathTextPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const
{
Primitive2DSequence aRetval;
- const bool bCurrentSpellCheck(getSdrText().GetObject().impDecomposePathTextPrimitive(aRetval, *this, aViewInformation));
+ const bool bCurrentSpellCheck(getSdrText()
+ ? getSdrText()->GetObject().impDecomposePathTextPrimitive(aRetval, *this, aViewInformation)
+ : false);
if(getLastSpellCheck() != bCurrentSpellCheck)
{
@@ -205,11 +333,13 @@ namespace drawinglayer
}
SdrPathTextPrimitive2D::SdrPathTextPrimitive2D(
- const SdrText& rSdrText,
+ const SdrText* pSdrText,
const OutlinerParaObject& rOutlinerParaObject,
- const ::basegfx::B2DPolyPolygon& rPathPolyPolygon)
- : SdrTextPrimitive2D(rSdrText, rOutlinerParaObject),
- maPathPolyPolygon(rPathPolyPolygon)
+ const basegfx::B2DPolyPolygon& rPathPolyPolygon,
+ const attribute::SdrFormTextAttribute& rSdrFormTextAttribute)
+ : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject),
+ maPathPolyPolygon(rPathPolyPolygon),
+ maSdrFormTextAttribute(rSdrFormTextAttribute)
{
}
@@ -219,17 +349,23 @@ namespace drawinglayer
{
const SdrPathTextPrimitive2D& rCompare = (SdrPathTextPrimitive2D&)rPrimitive;
- return (maPathPolyPolygon == rCompare.maPathPolyPolygon);
+ return (getPathPolyPolygon() == rCompare.getPathPolyPolygon()
+ && getSdrFormTextAttribute() == rCompare.getSdrFormTextAttribute());
}
return false;
}
- SdrTextPrimitive2D* SdrPathTextPrimitive2D::createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const
+ SdrTextPrimitive2D* SdrPathTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const
{
- ::basegfx::B2DPolyPolygon aNewPolyPolygon(maPathPolyPolygon);
+ basegfx::B2DPolyPolygon aNewPolyPolygon(getPathPolyPolygon());
aNewPolyPolygon.transform(rTransform);
- return new SdrPathTextPrimitive2D(getSdrText(), getOutlinerParaObject(), aNewPolyPolygon);
+
+ return new SdrPathTextPrimitive2D(
+ getSdrText(),
+ getOutlinerParaObject(),
+ aNewPolyPolygon,
+ getSdrFormTextAttribute());
}
// provide unique ID
@@ -247,7 +383,9 @@ namespace drawinglayer
Primitive2DSequence SdrBlockTextPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const
{
Primitive2DSequence aRetval;
- const bool bCurrentSpellCheck(getSdrText().GetObject().impDecomposeBlockTextPrimitive(aRetval, *this, aViewInformation));
+ const bool bCurrentSpellCheck(getSdrText()
+ ? getSdrText()->GetObject().impDecomposeBlockTextPrimitive(aRetval, *this, aViewInformation)
+ : false);
if(getLastSpellCheck() != bCurrentSpellCheck)
{
@@ -259,13 +397,13 @@ namespace drawinglayer
}
SdrBlockTextPrimitive2D::SdrBlockTextPrimitive2D(
- const SdrText& rSdrText,
+ const SdrText* pSdrText,
const OutlinerParaObject& rOutlinerParaObject,
- const ::basegfx::B2DHomMatrix& rTextRangeTransform,
+ const basegfx::B2DHomMatrix& rTextRangeTransform,
bool bUnlimitedPage,
bool bCellText,
bool bWordWrap)
- : SdrTextPrimitive2D(rSdrText, rOutlinerParaObject),
+ : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject),
maTextRangeTransform(rTextRangeTransform),
mbUnlimitedPage(bUnlimitedPage),
mbCellText(bCellText),
@@ -288,9 +426,15 @@ namespace drawinglayer
return false;
}
- SdrTextPrimitive2D* SdrBlockTextPrimitive2D::createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const
+ SdrTextPrimitive2D* SdrBlockTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const
{
- return new SdrBlockTextPrimitive2D(getSdrText(), getOutlinerParaObject(), rTransform * getTextRangeTransform(), getUnlimitedPage(), getCellText(), getWordWrap());
+ return new SdrBlockTextPrimitive2D(
+ getSdrText(),
+ getOutlinerParaObject(),
+ rTransform * getTextRangeTransform(),
+ getUnlimitedPage(),
+ getCellText(),
+ getWordWrap());
}
// provide unique ID
@@ -308,7 +452,9 @@ namespace drawinglayer
Primitive2DSequence SdrStretchTextPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const
{
Primitive2DSequence aRetval;
- const bool bCurrentSpellCheck(getSdrText().GetObject().impDecomposeStretchTextPrimitive(aRetval, *this, aViewInformation));
+ const bool bCurrentSpellCheck(getSdrText()
+ ? getSdrText()->GetObject().impDecomposeStretchTextPrimitive(aRetval, *this, aViewInformation)
+ : false);
if(getLastSpellCheck() != bCurrentSpellCheck)
{
@@ -320,10 +466,10 @@ namespace drawinglayer
}
SdrStretchTextPrimitive2D::SdrStretchTextPrimitive2D(
- const SdrText& rSdrText,
+ const SdrText* pSdrText,
const OutlinerParaObject& rOutlinerParaObject,
- const ::basegfx::B2DHomMatrix& rTextRangeTransform)
- : SdrTextPrimitive2D(rSdrText, rOutlinerParaObject),
+ const basegfx::B2DHomMatrix& rTextRangeTransform)
+ : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject),
maTextRangeTransform(rTextRangeTransform)
{
}
@@ -334,15 +480,18 @@ namespace drawinglayer
{
const SdrStretchTextPrimitive2D& rCompare = (SdrStretchTextPrimitive2D&)rPrimitive;
- return (maTextRangeTransform == rCompare.maTextRangeTransform);
+ return (getTextRangeTransform() == rCompare.getTextRangeTransform());
}
return false;
}
- SdrTextPrimitive2D* SdrStretchTextPrimitive2D::createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const
+ SdrTextPrimitive2D* SdrStretchTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const
{
- return new SdrStretchTextPrimitive2D(getSdrText(), getOutlinerParaObject(), rTransform * maTextRangeTransform);
+ return new SdrStretchTextPrimitive2D(
+ getSdrText(),
+ getOutlinerParaObject(),
+ rTransform * getTextRangeTransform());
}
// provide unique ID
diff --git a/svx/source/sdr/properties/properties.cxx b/svx/source/sdr/properties/properties.cxx
index 3445e134fd0a..b3cc32d71536 100644
--- a/svx/source/sdr/properties/properties.cxx
+++ b/svx/source/sdr/properties/properties.cxx
@@ -180,6 +180,11 @@ namespace sdr
GetSdrObject().SendUserCall(SDRUSERCALL_CHGATTR, rChange.GetRectangle(a));
}
}
+
+ sal_uInt32 BaseProperties::getVersion() const
+ {
+ return 0;
+ }
} // end of namespace properties
} // end of namespace sdr
diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx
index 59e1431a1487..f720e1b9d1b2 100644
--- a/svx/source/sdr/properties/textproperties.cxx
+++ b/svx/source/sdr/properties/textproperties.cxx
@@ -72,12 +72,14 @@ namespace sdr
}
TextProperties::TextProperties(SdrObject& rObj)
- : AttributeProperties(rObj)
+ : AttributeProperties(rObj),
+ maVersion(0)
{
}
TextProperties::TextProperties(const TextProperties& rProps, SdrObject& rObj)
- : AttributeProperties(rProps, rObj)
+ : AttributeProperties(rProps, rObj),
+ maVersion(rProps.getVersion())
{
}
@@ -93,10 +95,11 @@ namespace sdr
void TextProperties::ItemSetChanged(const SfxItemSet& rSet)
{
SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
-
-
sal_Int32 nText = rObj.getTextCount();
+ // #i101556# ItemSet has changed -> new version
+ maVersion++;
+
while( --nText >= 0 )
{
SdrText* pText = rObj.getText( nText );
@@ -237,7 +240,10 @@ namespace sdr
// call parent
AttributeProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
- if( rObj.GetModel() && !rObj.IsTextEditActive() && !rObj.IsLinkedText() )
+ // #i101556# StyleSheet has changed -> new version
+ maVersion++;
+
+ if( rObj.GetModel() /*&& !rObj.IsTextEditActive()*/ && !rObj.IsLinkedText() )
{
SdrOutliner& rOutliner = rObj.ImpGetDrawOutliner();
@@ -577,6 +583,9 @@ namespace sdr
rObj.ActionChanged();
//rObj.BroadcastObjectChange();
}
+
+ // #i101556# content of StyleSheet has changed -> new version
+ maVersion++;
}
if(SFX_HINT_DYING == nId)
@@ -616,6 +625,12 @@ namespace sdr
}
}
}
+
+ // #i101556# Handout version information
+ sal_uInt32 TextProperties::getVersion() const
+ {
+ return maVersion;
+ }
} // end of namespace properties
} // end of namespace sdr
diff --git a/svx/source/svdraw/makefile.mk b/svx/source/svdraw/makefile.mk
index 0ac4b70130e6..28eeb84e29d1 100644
--- a/svx/source/svdraw/makefile.mk
+++ b/svx/source/svdraw/makefile.mk
@@ -91,6 +91,7 @@ SLOFILES=\
$(SLO)$/svdedtv2.obj \
$(SLO)$/svdedxv.obj \
$(SLO)$/svdetc.obj \
+ $(SLO)$/sdrhittesthelper.obj \
$(SLO)$/svdfmtf.obj \
$(SLO)$/svdglev.obj \
$(SLO)$/svdglue.obj \
@@ -106,9 +107,7 @@ SLOFILES=\
$(SLO)$/sdrpaintwindow.obj \
$(SLO)$/svdpoev.obj \
$(SLO)$/svdscrol.obj \
- $(SLO)$/svdtouch.obj \
$(SLO)$/svdtrans.obj \
- $(SLO)$/svdtxhdl.obj \
$(SLO)$/svdundo.obj \
$(SLO)$/svdviter.obj \
$(SLO)$/clonelist.obj \
diff --git a/svx/source/svdraw/sdrhittesthelper.cxx b/svx/source/svdraw/sdrhittesthelper.cxx
new file mode 100644
index 000000000000..3b613f42e6ef
--- /dev/null
+++ b/svx/source/svdraw/sdrhittesthelper.cxx
@@ -0,0 +1,176 @@
+/*************************************************************************
+ *
+ * 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: svdetc.cxx,v $
+ * $Revision: 1.35.18.2 $
+ *
+ * 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_svx.hxx"
+
+#include <svx/sdrhittesthelper.hxx>
+#include <svx/obj3d.hxx>
+#include <svx/helperhittest3d.hxx>
+#include <svx/sdrpagewindow.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/sdr/contact/objectcontact.hxx>
+#include <drawinglayer/processor2d/hittestprocessor2d.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// #i101872# new Object HitTest as View-tooling
+
+SdrObject* SdrObjectPrimitiveHit(
+ const SdrObject& rObject,
+ const Point& rPnt,
+ sal_uInt16 nTol,
+ const SdrPageView& rSdrPageView,
+ const SetOfByte* pVisiLayer,
+ bool bTextOnly)
+{
+ SdrObject* pResult = 0;
+
+ if(rObject.GetSubList() && rObject.GetSubList()->GetObjCount())
+ {
+ // group or scene with content. Single 3D objects also have a
+ // true == rObject.GetSubList(), but no content
+ pResult = SdrObjListPrimitiveHit(*rObject.GetSubList(), rPnt, nTol, rSdrPageView, pVisiLayer, bTextOnly);
+ }
+ else
+ {
+ if(!pVisiLayer || pVisiLayer->IsSet(rObject.GetLayer()))
+ {
+ // single object, 3d object, empty scene or empty group. Check if
+ // it's a single 3D object
+ const E3dCompoundObject* pE3dCompoundObject = dynamic_cast< const E3dCompoundObject* >(&rObject);
+
+ if(pE3dCompoundObject)
+ {
+ const basegfx::B2DPoint aHitPosition(rPnt.X(), rPnt.Y());
+
+ if(checkHitSingle3DObject(aHitPosition, *pE3dCompoundObject))
+ {
+ pResult = const_cast< E3dCompoundObject* >(pE3dCompoundObject);
+ }
+ }
+ else
+ {
+ // not a single 3D object; Check in first PageWindow using prmitives (only SC
+ // with split views uses multiple PageWindows nowadays)
+ if(rSdrPageView.PageWindowCount())
+ {
+ const double fLogicTolerance(nTol);
+ const basegfx::B2DPoint aHitPosition(rPnt.X(), rPnt.Y());
+ const sdr::contact::ViewObjectContact& rVOC = rObject.GetViewContact().GetViewObjectContact(
+ rSdrPageView.GetPageWindow(0)->GetObjectContact());
+
+ if(ViewObjectContactPrimitiveHit(rVOC, aHitPosition, fLogicTolerance, bTextOnly))
+ {
+ pResult = const_cast< SdrObject* >(&rObject);
+ }
+ }
+ }
+ }
+ }
+
+ return pResult;
+}
+
+/////////////////////////////////////////////////////////////////////
+
+SdrObject* SdrObjListPrimitiveHit(
+ const SdrObjList& rList,
+ const Point& rPnt,
+ sal_uInt16 nTol,
+ const SdrPageView& rSdrPageView,
+ const SetOfByte* pVisiLayer,
+ bool bTextOnly)
+{
+ sal_uInt32 nObjNum(rList.GetObjCount());
+ SdrObject* pRetval = 0;
+
+ while(!pRetval && nObjNum > 0)
+ {
+ nObjNum--;
+ SdrObject* pObj = rList.GetObj(nObjNum);
+
+ pRetval = SdrObjectPrimitiveHit(*pObj, rPnt, nTol, rSdrPageView, pVisiLayer, bTextOnly);
+ }
+
+ return pRetval;
+}
+
+/////////////////////////////////////////////////////////////////////
+
+bool ViewObjectContactPrimitiveHit(
+ const sdr::contact::ViewObjectContact& rVOC,
+ const basegfx::B2DPoint& rHitPosition,
+ double fLogicHitTolerance,
+ bool bTextOnly)
+{
+ basegfx::B2DRange aObjectRange(rVOC.getObjectRange());
+
+ if(!aObjectRange.isEmpty())
+ {
+ // first do a rough B2DRange based HitTest; do not forget to
+ // include the HitTolerance if given
+ if(basegfx::fTools::more(fLogicHitTolerance, 0.0))
+ {
+ aObjectRange.grow(fLogicHitTolerance);
+ }
+
+ if(aObjectRange.isInside(rHitPosition))
+ {
+ // get primitive sequence
+ sdr::contact::DisplayInfo aDisplayInfo;
+ const drawinglayer::primitive2d::Primitive2DSequence& rSequence(rVOC.getPrimitive2DSequence(aDisplayInfo));
+
+ if(rSequence.hasElements())
+ {
+ // create a HitTest processor
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation2D = rVOC.GetObjectContact().getViewInformation2D();
+ drawinglayer::processor2d::HitTestProcessor2D aHitTestProcessor2D(
+ rViewInformation2D,
+ rHitPosition,
+ fLogicHitTolerance,
+ bTextOnly);
+
+ // feed it with the primitives
+ aHitTestProcessor2D.process(rSequence);
+
+ // deliver result
+ return aHitTestProcessor2D.getHit();
+ }
+ }
+ }
+
+ return false;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/svdraw/sdrpaintwindow.cxx b/svx/source/svdraw/sdrpaintwindow.cxx
index fcf824c82921..5197b870919f 100644
--- a/svx/source/svdraw/sdrpaintwindow.cxx
+++ b/svx/source/svdraw/sdrpaintwindow.cxx
@@ -116,8 +116,9 @@ void SdrPaintWindow::impCreateOverlayManager(const bool bUseBuffer)
// When the buffer usage has changed then we have to create a new
// overlay manager. Save the current one so that later we can move its
// overlay objects to the new one.
- ::sdr::overlay::OverlayManager* pOldOverlayManager = NULL;
- if (mbUseBuffer != bUseBuffer)
+ sdr::overlay::OverlayManager* pOldOverlayManager = NULL;
+
+ if(mbUseBuffer != bUseBuffer)
{
mbUseBuffer = bUseBuffer;
pOldOverlayManager = mpOverlayManager;
@@ -134,15 +135,19 @@ void SdrPaintWindow::impCreateOverlayManager(const bool bUseBuffer)
if(GetPaintView().IsBufferedOverlayAllowed() && mbUseBuffer)
{
// buffered OverlayManager, buffers it's background and refreshes from there
- // for pure overlay changes (no system redraw). The 2nd parameter specifies
+ // for pure overlay changes (no system redraw). The 3rd parameter specifies
// if that refresh itself will use a 2nd vdev to avoid flickering.
- mpOverlayManager = new ::sdr::overlay::OverlayManagerBuffered(GetOutputDevice(), sal_True);
+ // Also hand over the evtl. existing old OverlayManager; this means to take over
+ // the registered OverlayObjects from it
+ mpOverlayManager = new ::sdr::overlay::OverlayManagerBuffered(GetOutputDevice(), pOldOverlayManager, true);
}
else
{
// unbuffered OverlayManager, just invalidates places where changes
// take place
- mpOverlayManager = new ::sdr::overlay::OverlayManager(GetOutputDevice());
+ // Also hand over the evtl. existing old OverlayManager; this means to take over
+ // the registered OverlayObjects from it
+ mpOverlayManager = new ::sdr::overlay::OverlayManager(GetOutputDevice(), pOldOverlayManager);
}
OSL_ENSURE(mpOverlayManager, "SdrPaintWindow::SdrPaintWindow: Could not allocate an overlayManager (!)");
@@ -169,33 +174,10 @@ void SdrPaintWindow::impCreateOverlayManager(const bool bUseBuffer)
}
}
- // Because we can not notify the creators of the overlay objects that
- // belong to the old overlay manager we have to move these objects from
- // the old to the new overlay manager and hope for the best (ie that the
- // owner of the overlay objects did not store a pointer to the overlay
- // manager but asks the view for the current one.)
- if (pOldOverlayManager != NULL)
+ // OverlayObjects are transfered for the evtl. newly created OverlayManager by handing over
+ // at construction time
+ if(pOldOverlayManager)
{
- if (mpOverlayManager != NULL)
- {
- // Get a list of all overlay objects added to the old overlay
- // manager. This list is not modified when overlay objects are
- // moved from one overlay manager to the other so its save to
- // iterate over it.
- ::boost::shared_ptr<sdr::overlay::OverlayObjectVector> pOverlayObjects (
- pOldOverlayManager->GetOverlayObjects());
- // Iterate over the list of overlay objects and move, not copy,
- // them from the old to the new overlay manager.
- sdr::overlay::OverlayObjectVector::iterator iOverlay;
- for (iOverlay=pOverlayObjects->begin(); iOverlay!=pOverlayObjects->end(); ++iOverlay)
- {
- if (*iOverlay != NULL)
- {
- pOldOverlayManager->remove(**iOverlay);
- mpOverlayManager->add(**iOverlay);
- }
- }
- }
// The old overlay manager is not used anymore and can be (has to be) deleted.
delete pOldOverlayManager;
}
diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx
index ebd596ac972d..341ce6dd90c0 100644
--- a/svx/source/svdraw/svdcrtv.cxx
+++ b/svx/source/svdraw/svdcrtv.cxx
@@ -41,28 +41,19 @@
#include <svx/svdetc.hxx>
#include <svx/scene3d.hxx>
#include <svx/view3d.hxx>
-
-// #116425#
#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
-
-// #116425#
#include <svx/sdr/contact/displayinfo.hxx>
#include <svx/svdouno.hxx>
-
#define XOR_CREATE_PEN PEN_SOLID
#include <svx/svdopath.hxx>
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
#include <svx/sdr/overlay/overlaypolypolygon.hxx>
#include <svx/sdr/overlay/overlaymanager.hxx>
-#include <svx/sdr/overlay/overlaysdrobject.hxx>
#include <sdrpaintwindow.hxx>
-
-// #i72535#
#include "fmobj.hxx"
-
-// #i68562#
#include <svx/svdocirc.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -172,7 +163,10 @@ void ImpSdrCreateViewExtraData::CreateAndShowOverlay(const SdrCreateView& rView,
{
if(pObject)
{
- ::sdr::overlay::OverlaySdrObject* pNew = new ::sdr::overlay::OverlaySdrObject(basegfx::B2DPoint(), *pObject);
+ const sdr::contact::ViewContact& rVC = pObject->GetViewContact();
+ const drawinglayer::primitive2d::Primitive2DSequence aSequence = rVC.getViewIndependentPrimitive2DSequence();
+ sdr::overlay::OverlayObject* pNew = new sdr::overlay::OverlayPrimitive2DSequenceObject(aSequence);
+
pOverlayManager->add(*pNew);
maObjects.append(*pNew);
}
@@ -799,6 +793,15 @@ void SdrCreateView::ShowCreateObj(/*OutputDevice* pOut, BOOL bFull*/)
// overlay objects instead.
sal_Bool bUseSolidDragging(IsSolidDragging());
+ // #i101648# check if dragged object is a naked SdrObject (no
+ // derivation of). This is e.g. used in SW Frame construction
+ // as placeholder. Do not use SolidDragging for naked SDrObjects,
+ // they cannot have a valid optical representation
+ if(bUseSolidDragging && OBJ_NONE == pAktCreate->GetObjIdentifier())
+ {
+ bUseSolidDragging = false;
+ }
+
// check for objects with no fill and no line
if(bUseSolidDragging)
{
@@ -821,13 +824,15 @@ void SdrCreateView::ShowCreateObj(/*OutputDevice* pOut, BOOL bFull*/)
}
}
- // #i68562# Force to non-solid dragging when not creating a full circle and up to step three
- if(bUseSolidDragging
- && pAktCreate->ISA(SdrCircObj)
- && OBJ_CIRC != (SdrObjKind)(static_cast< SdrCircObj* >(pAktCreate)->GetObjIdentifier())
- && aDragStat.GetPointAnz() < 4L)
+ // #i101781# force to non-solid dragging when not creating a full circle
+ if(bUseSolidDragging)
{
- bUseSolidDragging = false;
+ SdrCircObj* pCircObj = dynamic_cast< SdrCircObj* >(pAktCreate);
+
+ if(pCircObj && OBJ_CIRC != pCircObj->GetObjIdentifier())
+ {
+ bUseSolidDragging = false;
+ }
}
if(bUseSolidDragging)
@@ -869,6 +874,18 @@ void SdrCreateView::ShowCreateObj(/*OutputDevice* pOut, BOOL bFull*/)
{
mpCreateViewExtraData->CreateAndShowOverlay(*this, 0, pAktCreate->TakeCreatePoly(aDragStat));
}
+
+ // #i101679# Force changed overlay to be shown
+ for(sal_uInt32 a(0); a < PaintWindowCount(); a++)
+ {
+ SdrPaintWindow* pCandidate = GetPaintWindow(a);
+ sdr::overlay::OverlayManager* pOverlayManager = pCandidate->GetOverlayManager();
+
+ if(pOverlayManager)
+ {
+ pOverlayManager->flush();
+ }
+ }
}
aDragStat.SetShown(TRUE);
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index bbc31b803096..e427e42d80ab 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -2551,7 +2551,7 @@ bool SdrDragGradient::BeginSdrDrag()
{
basegfx::B2DPoint aPosition(DragStat().GetStart().X(), DragStat().GetStart().Y());
- if(pColHdl->getOverlayObjectList().isHit(aPosition))
+ if(pColHdl->getOverlayObjectList().isHitLogic(aPosition))
{
bHit = true;
pIAOHandle->SetMoveSingleHandle(true);
@@ -2566,7 +2566,7 @@ bool SdrDragGradient::BeginSdrDrag()
{
basegfx::B2DPoint aPosition(DragStat().GetStart().X(), DragStat().GetStart().Y());
- if(pColHdl->getOverlayObjectList().isHit(aPosition))
+ if(pColHdl->getOverlayObjectList().isHitLogic(aPosition))
{
bHit = true;
pIAOHandle->SetMoveSingleHandle(true);
@@ -2578,7 +2578,7 @@ bool SdrDragGradient::BeginSdrDrag()
{
basegfx::B2DPoint aPosition(DragStat().GetStart().X(), DragStat().GetStart().Y());
- if(pIAOHandle->getOverlayObjectList().isHit(aPosition))
+ if(pIAOHandle->getOverlayObjectList().isHitLogic(aPosition))
{
bHit = true;
}
diff --git a/svx/source/svdraw/svddrgv.cxx b/svx/source/svdraw/svddrgv.cxx
index 4dfc001ed6fc..69459b1bff35 100644
--- a/svx/source/svdraw/svddrgv.cxx
+++ b/svx/source/svdraw/svddrgv.cxx
@@ -51,6 +51,7 @@
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <svx/polypolygoneditor.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
using namespace sdr;
@@ -844,6 +845,9 @@ void SdrDragView::ShowDragObj()
if(pOverlayManager)
{
mpCurrentSdrDragMethod->CreateOverlayGeometry(*pOverlayManager);
+
+ // #i101679# Force changed overlay to be shown
+ pOverlayManager->flush();
}
}
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 75ce75240a6f..901bc0e7e5b6 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -246,7 +246,7 @@ void SdrObjEditView::ModelHasChanged()
eNewAnchor=(EVAnchorMode)pTextObj->GetOutlinerViewAnchorMode();
bAnchorChg=eOldAnchor!=eNewAnchor;
Color aOldColor(pTextEditOutlinerView->GetBackgroundColor());
- aNewColor=ImpGetTextEditBackgroundColor();
+ aNewColor = GetTextEditBackgroundColor(*this);
bColorChg=aOldColor!=aNewColor;
}
// #104082# refresh always when it's a contour frame. That
@@ -425,52 +425,10 @@ void SdrObjEditView::ImpInvalidateOutlinerView(OutlinerView& rOutlView) const
}
}
-Color SdrObjEditView::ImpGetTextEditBackgroundColor() const
-{
- // #108759# Extracted significant parts to SdrPaintView::CalcBackgroundColor()
- svtools::ColorConfig aColorConfig;
- Color aBackground(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
- const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
-
- if(!rStyleSettings.GetHighContrastMode())
- {
- bool bFound=false;
- SdrTextObj* pText = dynamic_cast< SdrTextObj * >( mxTextEditObj.get());
- if (pText!=NULL && pText->IsClosedObj())
- {
- ::sdr::table::SdrTableObj* pTable = dynamic_cast< ::sdr::table::SdrTableObj * >( pText );
- if( pTable )
- bFound = GetDraftFillColor(pTable->GetActiveCellItemSet(), aBackground );
-
- if( !bFound )
- bFound=GetDraftFillColor(pText->GetMergedItemSet(), aBackground);
- }
- if (!bFound && pTextEditPV!=NULL && pText)
- {
- // #108784#
- Point aPvOfs(pText->GetTextEditOffset());
-
- const SdrPage* pPg=pTextEditPV->GetPage();
-
- // #112690#
- // Test existance of the page before using CalcBackgroundColor
- if(pPg)
- {
- Rectangle aSnapRect( pText->GetSnapRect() );
- aSnapRect.Move(aPvOfs.X(), aPvOfs.Y());
-
- return CalcBackgroundColor( aSnapRect, pTextEditPV->GetVisibleLayers(), *pPg );
- }
- }
- }
-
- return aBackground;
-}
-
OutlinerView* SdrObjEditView::ImpMakeOutlinerView(Window* pWin, BOOL /*bNoPaint*/, OutlinerView* pGivenView) const
{
// Hintergrund
- Color aBackground(ImpGetTextEditBackgroundColor());
+ Color aBackground(GetTextEditBackgroundColor(*this));
SdrTextObj* pText = dynamic_cast< SdrTextObj * >( mxTextEditObj.get() );
BOOL bTextFrame=pText!=NULL && pText->IsTextFrame();
BOOL bContourFrame=pText!=NULL && pText->IsContourTextFrame();
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
index b3aa3daf522f..bd6bf457bdbf 100644
--- a/svx/source/svdraw/svdetc.cxx
+++ b/svx/source/svdraw/svdetc.cxx
@@ -31,10 +31,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
#include "forbiddencharacterstable.hxx"
-
#include <com/sun/star/embed/XEmbeddedObject.hpp>
#include <com/sun/star/embed/EmbedStates.hpp>
-
#include <svx/svdetc.hxx>
#include "svditext.hxx"
#include <svx/svdmodel.hxx>
@@ -68,15 +66,14 @@
#include <i18npool/lang.h>
#include <unotools/charclass.hxx>
#include <svtools/syslocale.hxx>
-
-// #97870#
#include <svx/xflbckit.hxx>
#include <svx/extrusionbar.hxx>
#include <svx/fontworkbar.hxx>
#include <vcl/svapp.hxx> //add CHINA001
-
-//#i80528#
#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdotable.hxx>
+#include <svx/sdrhittesthelper.hxx>
using namespace ::com::sun::star;
@@ -146,10 +143,13 @@ void OLEObjCache::UnloadOnDemand()
{
try
{
- sal_Bool bUnload = sal_True;
// it is important to get object without reinitialization to avoid reentrance
uno::Reference< embed::XEmbeddedObject > xUnloadObj = pUnloadObj->GetObjRef_NoInit();
- if ( xUnloadObj.is() )
+
+ sal_Bool bUnload = SdrOle2Obj::CanUnloadRunningObj( xUnloadObj, pUnloadObj->GetAspect() );
+
+ // check whether the object can be unloaded before looking for the parent objects
+ if ( xUnloadObj.is() && bUnload )
{
uno::Reference< frame::XModel > xUnloadModel( xUnloadObj->getComponent(), uno::UNO_QUERY );
if ( xUnloadModel.is() )
@@ -193,11 +193,18 @@ void OLEObjCache::InsertObj(SdrOle2Obj* pObj)
return;
}
+ // get the old position of the object to know whether it is already in container
+ ULONG nOldPos = GetPos( pObj );
+
// insert object into first position
- Remove(pObj);
+ Remove( nOldPos );
Insert(pObj, (ULONG) 0L);
- UnloadOnDemand();
+ if ( nOldPos == CONTAINER_ENTRY_NOTFOUND )
+ {
+ // a new object was inserted, recalculate the cache
+ UnloadOnDemand();
+ }
}
void OLEObjCache::RemoveObj(SdrOle2Obj* pObj)
@@ -837,6 +844,258 @@ void SvdProgressInfo::ReportError()
}
////////////////////////////////////////////////////////////////////////////////////////////////////
+// #i101872# isolate GetTextEditBackgroundColor to tooling; it woll anyways only be used as long
+// as text edit is not running on overlay
+
+namespace
+{
+ bool impGetSdrObjListFillColor(
+ const SdrObjList& rList,
+ const Point& rPnt,
+ const SdrPageView& rTextEditPV,
+ const SetOfByte& rVisLayers,
+ Color& rCol)
+ {
+ if(!rList.GetModel())
+ return false;
+
+ bool bRet(false);
+ bool bMaster(rList.GetPage() ? rList.GetPage()->IsMasterPage() : false);
+
+ for(ULONG no(rList.GetObjCount()); !bRet && no > 0; )
+ {
+ no--;
+ SdrObject* pObj = rList.GetObj(no);
+ SdrObjList* pOL = pObj->GetSubList();
+
+ if(pOL)
+ {
+ // group object
+ bRet = impGetSdrObjListFillColor(*pOL, rPnt, rTextEditPV, rVisLayers, rCol);
+ }
+ else
+ {
+ SdrTextObj* pText = dynamic_cast< SdrTextObj * >(pObj);
+
+ // #108867# Exclude zero master page object (i.e. background shape) from color query
+ if(pText
+ && pObj->IsClosedObj()
+ && (!bMaster || (!pObj->IsNotVisibleAsMaster() && 0 != no))
+ && pObj->GetCurrentBoundRect().IsInside(rPnt)
+ && !pText->IsHideContour()
+ && SdrObjectPrimitiveHit(*pObj, rPnt, 0, rTextEditPV, &rVisLayers, false))
+ {
+ bRet = GetDraftFillColor(pObj->GetMergedItemSet(), rCol);
+ }
+ }
+ }
+
+ return bRet;
+ }
+ bool impGetSdrPageFillColor(
+ const SdrPage& rPage,
+ const Point& rPnt,
+ const SdrPageView& rTextEditPV,
+ const SetOfByte& rVisLayers,
+ Color& rCol,
+ bool bSkipBackgroundShape)
+ {
+ if(!rPage.GetModel())
+ return false;
+
+ bool bRet(impGetSdrObjListFillColor(rPage, rPnt, rTextEditPV, rVisLayers, rCol));
+
+ if(!bRet && !rPage.IsMasterPage())
+ {
+ if(rPage.TRG_HasMasterPage())
+ {
+ SetOfByte aSet(rVisLayers);
+ aSet &= rPage.TRG_GetMasterPageVisibleLayers();
+ SdrPage& rMasterPage = rPage.TRG_GetMasterPage();
+
+ // #108867# Don't fall back to background shape on
+ // master pages. This is later handled by
+ // GetBackgroundColor, and is necessary to cater for
+ // the silly ordering: 1. shapes, 2. master page
+ // shapes, 3. page background, 4. master page
+ // background.
+ bRet = impGetSdrPageFillColor(rMasterPage, rPnt, rTextEditPV, aSet, rCol, true);
+ }
+ }
+ // #108867# Only now determine background color from background shapes
+ if(!bRet && !bSkipBackgroundShape)
+ {
+ rCol = rPage.GetPageBackgroundColor();
+ return true;
+ }
+
+ return bRet;
+ }
+ Color impCalcBackgroundColor(
+ const Rectangle& rArea,
+ const SdrPageView& rTextEditPV,
+ const SdrPage& rPage)
+ {
+ svtools::ColorConfig aColorConfig;
+ Color aBackground(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+
+ if(!rStyleSettings.GetHighContrastMode())
+ {
+ // search in page
+ const USHORT SPOTCOUNT(5);
+ Point aSpotPos[SPOTCOUNT];
+ Color aSpotColor[SPOTCOUNT];
+ ULONG nHeight( rArea.GetSize().Height() );
+ ULONG nWidth( rArea.GetSize().Width() );
+ ULONG nWidth14 = nWidth / 4;
+ ULONG nHeight14 = nHeight / 4;
+ ULONG nWidth34 = ( 3 * nWidth ) / 4;
+ ULONG nHeight34 = ( 3 * nHeight ) / 4;
+
+ USHORT i;
+ for ( i = 0; i < SPOTCOUNT; i++ )
+ {
+ // five spots are used
+ switch ( i )
+ {
+ case 0 :
+ {
+ // Center-Spot
+ aSpotPos[i] = rArea.Center();
+ }
+ break;
+
+ case 1 :
+ {
+ // TopLeft-Spot
+ aSpotPos[i] = rArea.TopLeft();
+ aSpotPos[i].X() += nWidth14;
+ aSpotPos[i].Y() += nHeight14;
+ }
+ break;
+
+ case 2 :
+ {
+ // TopRight-Spot
+ aSpotPos[i] = rArea.TopLeft();
+ aSpotPos[i].X() += nWidth34;
+ aSpotPos[i].Y() += nHeight14;
+ }
+ break;
+
+ case 3 :
+ {
+ // BottomLeft-Spot
+ aSpotPos[i] = rArea.TopLeft();
+ aSpotPos[i].X() += nWidth14;
+ aSpotPos[i].Y() += nHeight34;
+ }
+ break;
+
+ case 4 :
+ {
+ // BottomRight-Spot
+ aSpotPos[i] = rArea.TopLeft();
+ aSpotPos[i].X() += nWidth34;
+ aSpotPos[i].Y() += nHeight34;
+ }
+ break;
+
+ }
+
+ aSpotColor[i] = Color( COL_WHITE );
+ impGetSdrPageFillColor(rPage, aSpotPos[i], rTextEditPV, rTextEditPV.GetVisibleLayers(), aSpotColor[i], false);
+ }
+
+ USHORT aMatch[SPOTCOUNT];
+
+ for ( i = 0; i < SPOTCOUNT; i++ )
+ {
+ // were same spot colors found?
+ aMatch[i] = 0;
+
+ for ( USHORT j = 0; j < SPOTCOUNT; j++ )
+ {
+ if( j != i )
+ {
+ if( aSpotColor[i] == aSpotColor[j] )
+ {
+ aMatch[i]++;
+ }
+ }
+ }
+ }
+
+ // highest weight to center spot
+ aBackground = aSpotColor[0];
+
+ for ( USHORT nMatchCount = SPOTCOUNT - 1; nMatchCount > 1; nMatchCount-- )
+ {
+ // which spot color was found most?
+ for ( i = 0; i < SPOTCOUNT; i++ )
+ {
+ if( aMatch[i] == nMatchCount )
+ {
+ aBackground = aSpotColor[i];
+ nMatchCount = 1; // break outer for-loop
+ break;
+ }
+ }
+ }
+ }
+
+ return aBackground;
+ }
+} // end of anonymous namespace
+
+Color GetTextEditBackgroundColor(const SdrObjEditView& rView)
+{
+ svtools::ColorConfig aColorConfig;
+ Color aBackground(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+
+ if(!rStyleSettings.GetHighContrastMode())
+ {
+ bool bFound(false);
+ SdrTextObj* pText = dynamic_cast< SdrTextObj * >(rView.GetTextEditObject());
+
+ if(pText && pText->IsClosedObj())
+ {
+ ::sdr::table::SdrTableObj* pTable = dynamic_cast< ::sdr::table::SdrTableObj * >( pText );
+
+ if( pTable )
+ bFound = GetDraftFillColor(pTable->GetActiveCellItemSet(), aBackground );
+
+ if( !bFound )
+ bFound=GetDraftFillColor(pText->GetMergedItemSet(), aBackground);
+ }
+
+ if(!bFound && pText)
+ {
+ SdrPageView* pTextEditPV = rView.GetTextEditPageView();
+
+ if(pTextEditPV)
+ {
+ Point aPvOfs(pText->GetTextEditOffset());
+ const SdrPage* pPg = pTextEditPV->GetPage();
+
+ if(pPg)
+ {
+ Rectangle aSnapRect( pText->GetSnapRect() );
+ aSnapRect.Move(aPvOfs.X(), aPvOfs.Y());
+
+ return impCalcBackgroundColor(aSnapRect, *pTextEditPV, *pPg);
+ }
+ }
+ }
+ }
+
+ return aBackground;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/svdraw/svdfppt.cxx b/svx/source/svdraw/svdfppt.cxx
index aa51f524444a..e12ed76d52ce 100644
--- a/svx/source/svdraw/svdfppt.cxx
+++ b/svx/source/svdraw/svdfppt.cxx
@@ -4973,6 +4973,246 @@ void StyleTextProp9::Read( SvStream& rIn )
PPTStyleTextPropReader::PPTStyleTextPropReader( SvStream& rIn, SdrPowerPointImport& rMan, const DffRecordHeader& rTextHeader,
PPTTextRulerInterpreter& rRuler, const DffRecordHeader& rExtParaHd, sal_uInt32 nInstance )
{
+ Init(rIn, rMan, rTextHeader, rRuler, rExtParaHd, nInstance);
+}
+
+void PPTStyleTextPropReader::ReadParaProps( SvStream& rIn, SdrPowerPointImport& rMan, const DffRecordHeader& rTextHeader,
+ const String& aString, PPTTextRulerInterpreter& rRuler,
+ sal_uInt32& nCharCount, sal_Bool& bTextPropAtom )
+{
+ sal_uInt32 nMask = 0; //TODO: nMask initialized here to suppress warning for now, see corresponding TODO below
+ sal_uInt32 nCharAnzRead = 0;
+ sal_uInt16 nDummy16;
+
+ sal_uInt16 nStringLen = aString.Len();
+
+ DffRecordHeader aTextHd2;
+ rTextHeader.SeekToContent( rIn );
+ if ( rMan.SeekToRec( rIn, PPT_PST_StyleTextPropAtom, rTextHeader.GetRecEndFilePos(), &aTextHd2 ) )
+ bTextPropAtom = sal_True;
+ while ( nCharAnzRead <= nStringLen )
+ {
+ PPTParaPropSet aParaPropSet;
+ ImplPPTParaPropSet& aSet = *aParaPropSet.pParaSet;
+ if ( bTextPropAtom )
+ {
+ rIn >> nCharCount
+ >> aParaPropSet.pParaSet->mnDepth; // Einruecktiefe
+
+ nCharCount--;
+
+ rIn >> nMask;
+ aSet.mnAttrSet = nMask & 0x207df7;
+ sal_uInt16 nBulFlg = 0;
+ if ( nMask & 0xF )
+ rIn >> nBulFlg; // Bullet-HardAttr-Flags
+ aSet.mpArry[ PPT_ParaAttr_BulletOn ] = ( nBulFlg & 1 ) ? 1 : 0;
+ aSet.mpArry[ PPT_ParaAttr_BuHardFont ] = ( nBulFlg & 2 ) ? 1 : 0;
+ aSet.mpArry[ PPT_ParaAttr_BuHardColor ] = ( nBulFlg & 4 ) ? 1 : 0;
+
+ if ( nMask & 0x0080 ) // buChar
+ rIn >> aSet.mpArry[ PPT_ParaAttr_BulletChar ];
+ if ( nMask & 0x0010 ) // buTypeface
+ rIn >> aSet.mpArry[ PPT_ParaAttr_BulletFont ];
+ if ( nMask & 0x0040 ) // buSize
+ {
+ rIn >> aSet.mpArry[ PPT_ParaAttr_BulletHeight ];
+ if ( ! ( ( nMask & ( 1 << PPT_ParaAttr_BuHardHeight ) )
+ && ( nBulFlg && ( 1 << PPT_ParaAttr_BuHardHeight ) ) ) )
+ aSet.mnAttrSet ^= 0x40;
+ }
+ if ( nMask & 0x0020 ) // buColor
+ {
+ sal_uInt32 nVal32, nHiByte;
+ rIn >> nVal32;
+ nHiByte = nVal32 >> 24;
+ if ( nHiByte <= 8 )
+ nVal32 = nHiByte | PPT_COLSCHEME;
+ aSet.mnBulletColor = nVal32;
+ }
+ if ( nMask & 0x0800 ) // pfAlignment
+ {
+ rIn >> nDummy16;
+ aSet.mpArry[ PPT_ParaAttr_Adjust ] = nDummy16 & 3;
+ }
+ if ( nMask & 0x1000 ) // pfLineSpacing
+ rIn >> aSet.mpArry[ PPT_ParaAttr_LineFeed ];
+ if ( nMask & 0x2000 ) // pfSpaceBefore
+ rIn >> aSet.mpArry[ PPT_ParaAttr_UpperDist ];
+ if ( nMask & 0x4000 ) // pfSpaceAfter
+ rIn >> aSet.mpArry[ PPT_ParaAttr_LowerDist ];
+ if ( nMask & 0x100 ) // pfLeftMargin
+ rIn >> nDummy16;
+ if ( nMask & 0x400 ) // pfIndent
+ rIn >> nDummy16;
+ if ( nMask & 0x8000 ) // pfDefaultTabSize
+ rIn >> nDummy16;
+ if ( nMask & 0x100000 ) // pfTabStops
+ {
+ sal_uInt16 i, nDistance, nAlignment, nNumberOfTabStops = 0;
+ rIn >> nNumberOfTabStops;
+ for ( i = 0; i < nNumberOfTabStops; i++ )
+ {
+ rIn >> nDistance
+ >> nAlignment;
+ }
+ }
+ if ( nMask & 0x10000 ) // pfBaseLine
+ rIn >> nDummy16;
+ if ( nMask & 0xe0000 ) // pfCharWrap, pfWordWrap, pfOverflow
+ {
+ rIn >> nDummy16;
+ if ( nMask & 0x20000 )
+ aSet.mpArry[ PPT_ParaAttr_AsianLB_1 ] = nDummy16 & 1;
+ if ( nMask & 0x40000 )
+ aSet.mpArry[ PPT_ParaAttr_AsianLB_2 ] = ( nDummy16 >> 1 ) & 1;
+ if ( nMask & 0x80000 )
+ aSet.mpArry[ PPT_ParaAttr_AsianLB_3 ] = ( nDummy16 >> 2 ) & 1;
+ aSet.mnAttrSet |= ( ( nMask >> 17 ) & 7 ) << PPT_ParaAttr_AsianLB_1;
+ }
+ if ( nMask & 0x200000 ) // pfTextDirection
+ rIn >> aSet.mpArry[ PPT_ParaAttr_BiDi ];
+ }
+ else
+ nCharCount = nStringLen;
+
+ if ( rRuler.GetTextOfs( aParaPropSet.pParaSet->mnDepth, aSet.mpArry[ PPT_ParaAttr_TextOfs ] ) )
+ aSet.mnAttrSet |= 1 << PPT_ParaAttr_TextOfs;
+ if ( rRuler.GetBulletOfs( aParaPropSet.pParaSet->mnDepth, aSet.mpArry[ PPT_ParaAttr_BulletOfs ] ) )
+ aSet.mnAttrSet |= 1 << PPT_ParaAttr_BulletOfs;
+ if ( rRuler.GetDefaultTab( aParaPropSet.pParaSet->mnDepth, aSet.mpArry[ PPT_ParaAttr_DefaultTab ] ) )
+ aSet.mnAttrSet |= 1 << PPT_ParaAttr_DefaultTab;
+
+ if ( ( nCharCount > nStringLen ) || ( nStringLen < nCharAnzRead + nCharCount ) )
+ {
+ bTextPropAtom = sal_False;
+ nCharCount = nStringLen - nCharAnzRead;
+ // please fix the right hand side of
+ // PPTParaPropSet& PPTParaPropSet::operator=(PPTParaPropSet&),
+ // it should be a const reference
+ PPTParaPropSet aTmpPPTParaPropSet;
+ aParaPropSet = aTmpPPTParaPropSet;
+ DBG_ERROR( "SJ:PPTStyleTextPropReader::could not get this PPT_PST_StyleTextPropAtom by reading the paragraph attributes" );
+ }
+ PPTParaPropSet* pPara = new PPTParaPropSet( aParaPropSet );
+ pPara->mnOriginalTextPos = nCharAnzRead;
+ aParaPropList.Insert( pPara, LIST_APPEND );
+ if ( nCharCount )
+ {
+ sal_uInt32 nCount;
+ const sal_Unicode* pDat = aString.GetBuffer() + nCharAnzRead;
+ for ( nCount = 0; nCount < nCharCount; nCount++ )
+ {
+ if ( pDat[ nCount ] == 0xd )
+ {
+ pPara = new PPTParaPropSet( aParaPropSet );
+ pPara->mnOriginalTextPos = nCharAnzRead + nCount + 1;
+ aParaPropList.Insert( pPara, LIST_APPEND );
+ }
+ }
+ }
+ nCharAnzRead += nCharCount + 1;
+ }
+}
+
+void PPTStyleTextPropReader::ReadCharProps( SvStream& rIn, PPTCharPropSet& aCharPropSet, const String& aString,
+ sal_uInt32& nCharCount, sal_uInt32 nCharAnzRead,
+ sal_Bool& bTextPropAtom, sal_uInt32 nExtParaPos,
+ const std::vector< StyleTextProp9 >& aStyleTextProp9,
+ sal_uInt32& nExtParaFlags, sal_uInt16& nBuBlip,
+ sal_uInt16& nHasAnm, sal_uInt32& nAnmScheme )
+{
+ sal_uInt32 nMask = 0; //TODO: nMask initialized here to suppress warning for now, see corresponding TODO below
+ sal_uInt16 nDummy16;
+ sal_Int32 nCharsToRead;
+ sal_uInt32 nExtParaNibble = 0;
+
+ sal_uInt16 nStringLen = aString.Len();
+
+ rIn >> nDummy16;
+ nCharCount = nDummy16;
+ rIn >> nDummy16;
+ nCharsToRead = nStringLen - ( nCharAnzRead + nCharCount );
+ if ( nCharsToRead < 0 )
+ {
+ nCharCount = nStringLen - nCharAnzRead;
+ if ( nCharsToRead < -1 )
+ {
+ bTextPropAtom = sal_False;
+ DBG_ERROR( "SJ:PPTStyleTextPropReader::could not get this PPT_PST_StyleTextPropAtom by reading the character attributes" );
+ }
+ }
+ ImplPPTCharPropSet& aSet = *aCharPropSet.pCharSet;
+
+ // character attributes
+ rIn >> nMask;
+ if ( (sal_uInt16)nMask )
+ {
+ aSet.mnAttrSet |= (sal_uInt16)nMask;
+ rIn >> aSet.mnFlags;
+ }
+ if ( nMask & 0x10000 ) // cfTypeface
+ {
+ rIn >> aSet.mnFont;
+ aSet.mnAttrSet |= 1 << PPT_CharAttr_Font;
+ }
+ if ( nMask & 0x200000 ) // cfFEOldTypeface
+ {
+ rIn >> aSet.mnAsianOrComplexFont;
+ aSet.mnAttrSet |= 1 << PPT_CharAttr_AsianOrComplexFont;
+ }
+ if ( nMask & 0x400000 ) // cfANSITypeface
+ {
+ rIn >> aSet.mnANSITypeface;
+ aSet.mnAttrSet |= 1 << PPT_CharAttr_ANSITypeface;
+ }
+ if ( nMask & 0x800000 ) // cfSymbolTypeface
+ {
+ rIn >> aSet.mnSymbolFont;
+ aSet.mnAttrSet |= 1 << PPT_CharAttr_Symbol;
+ }
+ if ( nMask & 0x20000 ) // cfSize
+ {
+ rIn >> aSet.mnFontHeight;
+ aSet.mnAttrSet |= 1 << PPT_CharAttr_FontHeight;
+ }
+ if ( nMask & 0x40000 ) // cfColor
+ {
+ sal_uInt32 nVal;
+ rIn >> nVal;
+ if ( !( nVal & 0xff000000 ) )
+ nVal = PPT_COLSCHEME_HINTERGRUND;
+ aSet.mnColor = nVal;
+ aSet.mnAttrSet |= 1 << PPT_CharAttr_FontColor;
+ }
+ if ( nMask & 0x80000 ) // cfPosition
+ {
+ rIn >> aSet.mnEscapement;
+ aSet.mnAttrSet |= 1 << PPT_CharAttr_Escapement;
+ }
+ if ( nExtParaPos )
+ {
+ sal_uInt32 nExtBuInd = nMask & 0x3c00;
+ if ( nExtBuInd )
+ nExtBuInd = ( aSet.mnFlags & 0x3c00 ) >> 10;
+ if ( nExtBuInd < aStyleTextProp9.size() )
+ {
+ if ( nExtParaNibble && ( ( nExtBuInd + nExtParaNibble ) < aStyleTextProp9.size() ) )
+ nExtBuInd += nExtParaNibble;
+
+ nExtParaFlags = aStyleTextProp9[ nExtBuInd ].mnExtParagraphMask;
+ nBuBlip = aStyleTextProp9[ nExtBuInd ].mnBuBlip;
+ nHasAnm = aStyleTextProp9[ nExtBuInd ].mnHasAnm;
+ nAnmScheme = aStyleTextProp9[ nExtBuInd ].mnAnmScheme;
+ }
+ if ( ( nExtBuInd & 0xf ) == 0xf )
+ nExtParaNibble += 16;
+ }
+}
+
+void PPTStyleTextPropReader::Init( SvStream& rIn, SdrPowerPointImport& rMan, const DffRecordHeader& rTextHeader,
+ PPTTextRulerInterpreter& rRuler, const DffRecordHeader& rExtParaHd, sal_uInt32 nInstance )
+{
sal_uInt32 nMerk = rIn.Tell();
sal_uInt32 nExtParaPos = ( rExtParaHd.nRecType == PPT_PST_ExtendedParagraphAtom ) ? rExtParaHd.nFilePos + 8 : 0;
@@ -5032,7 +5272,7 @@ PPTStyleTextPropReader::PPTStyleTextPropReader( SvStream& rIn, SdrPowerPointImpo
aString = String( pBuf, (sal_uInt16)i );
delete[] pBuf;
}
- else
+ else if( aTextHd.nRecType == PPT_PST_TextBytesAtom )
{
sal_Char *pBuf = new sal_Char[ nMaxLen + 1 ];
pBuf[ nMaxLen ] = 0;
@@ -5057,148 +5297,44 @@ PPTStyleTextPropReader::PPTStyleTextPropReader( SvStream& rIn, SdrPowerPointImpo
aString = String( pBuf, nLen, RTL_TEXTENCODING_MS_1252 );
delete[] pBuf;
}
- if ( aString.Len() )
+ else
{
- sal_uInt32 nMask = 0; //TODO: nMask initialized here to suppress warning for now, see corresponding TODO below
- sal_uInt32 nCharCount, nCharAnzRead = 0;
- sal_Int32 nCharsToRead;
- sal_uInt16 nDummy16;
+ // no chars, but potentially char/para props?
+ sal_uInt32 nCharCount;
sal_Bool bTextPropAtom = sal_False;
+ ReadParaProps( rIn, rMan, rTextHeader, aString, rRuler, nCharCount, bTextPropAtom );
- sal_uInt16 nStringLen = aString.Len();
-
- DffRecordHeader aTextHd2;
- rTextHeader.SeekToContent( rIn );
- if ( rMan.SeekToRec( rIn, PPT_PST_StyleTextPropAtom, rTextHeader.GetRecEndFilePos(), &aTextHd2 ) )
- bTextPropAtom = sal_True;
- while ( nCharAnzRead <= nStringLen )
+ if ( bTextPropAtom )
{
- PPTParaPropSet aParaPropSet;
- ImplPPTParaPropSet& aSet = *aParaPropSet.pParaSet;
- if ( bTextPropAtom )
- {
- rIn >> nCharCount
- >> aParaPropSet.pParaSet->mnDepth; // Einruecktiefe
-
- nCharCount--;
-
- rIn >> nMask;
- aSet.mnAttrSet = nMask & 0x207df7;
- sal_uInt16 nBulFlg = 0;
- if ( nMask & 0xF )
- rIn >> nBulFlg; // Bullet-HardAttr-Flags
- aSet.mpArry[ PPT_ParaAttr_BulletOn ] = ( nBulFlg & 1 ) ? 1 : 0;
- aSet.mpArry[ PPT_ParaAttr_BuHardFont ] = ( nBulFlg & 2 ) ? 1 : 0;
- aSet.mpArry[ PPT_ParaAttr_BuHardColor ] = ( nBulFlg & 4 ) ? 1 : 0;
-
- if ( nMask & 0x0080 ) // buChar
- rIn >> aSet.mpArry[ PPT_ParaAttr_BulletChar ];
- if ( nMask & 0x0010 ) // buTypeface
- rIn >> aSet.mpArry[ PPT_ParaAttr_BulletFont ];
- if ( nMask & 0x0040 ) // buSize
- {
- rIn >> aSet.mpArry[ PPT_ParaAttr_BulletHeight ];
- if ( ! ( ( nMask & ( 1 << PPT_ParaAttr_BuHardHeight ) )
- && ( nBulFlg && ( 1 << PPT_ParaAttr_BuHardHeight ) ) ) )
- aSet.mnAttrSet ^= 0x40;
- }
- if ( nMask & 0x0020 ) // buColor
- {
- sal_uInt32 nVal32, nHiByte;
- rIn >> nVal32;
- nHiByte = nVal32 >> 24;
- if ( nHiByte <= 8 )
- nVal32 = nHiByte | PPT_COLSCHEME;
- aSet.mnBulletColor = nVal32;
- }
- if ( nMask & 0x0800 ) // pfAlignment
- {
- rIn >> nDummy16;
- aSet.mpArry[ PPT_ParaAttr_Adjust ] = nDummy16 & 3;
- }
- if ( nMask & 0x1000 ) // pfLineSpacing
- rIn >> aSet.mpArry[ PPT_ParaAttr_LineFeed ];
- if ( nMask & 0x2000 ) // pfSpaceBefore
- rIn >> aSet.mpArry[ PPT_ParaAttr_UpperDist ];
- if ( nMask & 0x4000 ) // pfSpaceAfter
- rIn >> aSet.mpArry[ PPT_ParaAttr_LowerDist ];
- if ( nMask & 0x100 ) // pfLeftMargin
- rIn >> nDummy16;
- if ( nMask & 0x400 ) // pfIndent
- rIn >> nDummy16;
- if ( nMask & 0x8000 ) // pfDefaultTabSize
- rIn >> nDummy16;
- if ( nMask & 0x100000 ) // pfTabStops
- {
- sal_uInt16 i, nDistance, nAlignment, nNumberOfTabStops = 0;
- rIn >> nNumberOfTabStops;
- for ( i = 0; i < nNumberOfTabStops; i++ )
- {
- rIn >> nDistance
- >> nAlignment;
- }
- }
- if ( nMask & 0x10000 ) // pfBaseLine
- rIn >> nDummy16;
- if ( nMask & 0xe0000 ) // pfCharWrap, pfWordWrap, pfOverflow
- {
- rIn >> nDummy16;
- if ( nMask & 0x20000 )
- aSet.mpArry[ PPT_ParaAttr_AsianLB_1 ] = nDummy16 & 1;
- if ( nMask & 0x40000 )
- aSet.mpArry[ PPT_ParaAttr_AsianLB_2 ] = ( nDummy16 >> 1 ) & 1;
- if ( nMask & 0x80000 )
- aSet.mpArry[ PPT_ParaAttr_AsianLB_3 ] = ( nDummy16 >> 2 ) & 1;
- aSet.mnAttrSet |= ( ( nMask >> 17 ) & 7 ) << PPT_ParaAttr_AsianLB_1;
- }
- if ( nMask & 0x200000 ) // pfTextDirection
- rIn >> aSet.mpArry[ PPT_ParaAttr_BiDi ];
- }
- else
- nCharCount = nStringLen;
+ // yeah, StyleTextProp is there, read it all & push to
+ // aParaPropList
+ PPTCharPropSet aCharPropSet(0);
+ aCharPropSet.mnOriginalTextPos = 0;
- if ( rRuler.GetTextOfs( aParaPropSet.pParaSet->mnDepth, aSet.mpArry[ PPT_ParaAttr_TextOfs ] ) )
- aSet.mnAttrSet |= 1 << PPT_ParaAttr_TextOfs;
- if ( rRuler.GetBulletOfs( aParaPropSet.pParaSet->mnDepth, aSet.mpArry[ PPT_ParaAttr_BulletOfs ] ) )
- aSet.mnAttrSet |= 1 << PPT_ParaAttr_BulletOfs;
- if ( rRuler.GetDefaultTab( aParaPropSet.pParaSet->mnDepth, aSet.mpArry[ PPT_ParaAttr_DefaultTab ] ) )
- aSet.mnAttrSet |= 1 << PPT_ParaAttr_DefaultTab;
+ sal_uInt32 nCharAnzRead = 0;
+ sal_uInt32 nExtParaFlags = 0, nAnmScheme = 0;
+ sal_uInt16 nBuBlip = 0xffff, nHasAnm = 0;
+ ReadCharProps( rIn, aCharPropSet, aString, nCharCount, nCharAnzRead,
+ bTextPropAtom, nExtParaPos, aStyleTextProp9, nExtParaFlags,
+ nBuBlip, nHasAnm, nAnmScheme );
- if ( ( nCharCount > nStringLen ) || ( nStringLen < nCharAnzRead + nCharCount ) )
- {
- bTextPropAtom = sal_False;
- nCharCount = nStringLen - nCharAnzRead;
- // please fix the right hand side of
- // PPTParaPropSet& PPTParaPropSet::operator=(PPTParaPropSet&),
- // it should be a const reference
- PPTParaPropSet aTmpPPTParaPropSet;
- aParaPropSet = aTmpPPTParaPropSet;
- DBG_ERROR( "SJ:PPTStyleTextPropReader::could not get this PPT_PST_StyleTextPropAtom by reading the paragraph attributes" );
- }
- PPTParaPropSet* pPara = new PPTParaPropSet( aParaPropSet );
- pPara->mnOriginalTextPos = nCharAnzRead;
- aParaPropList.Insert( pPara, LIST_APPEND );
- if ( nCharCount )
- {
- sal_uInt32 nCount;
- const sal_Unicode* pDat = aString.GetBuffer() + nCharAnzRead;
- for ( nCount = 0; nCount < nCharCount; nCount++ )
- {
- if ( pDat[ nCount ] == 0xd )
- {
- pPara = new PPTParaPropSet( aParaPropSet );
- pPara->mnOriginalTextPos = nCharAnzRead + nCount + 1;
- aParaPropList.Insert( pPara, LIST_APPEND );
- }
- }
- }
- nCharAnzRead += nCharCount + 1;
+ aCharPropList.Insert(
+ new PPTCharPropSet( aCharPropSet, 0 ), LIST_APPEND );
}
+ }
+
+ if ( aString.Len() )
+ {
+ sal_uInt32 nCharCount;
+ sal_Bool bTextPropAtom = sal_False;
+
+ ReadParaProps( rIn, rMan, rTextHeader, aString, rRuler, nCharCount, bTextPropAtom );
sal_Bool bEmptyParaPossible = sal_True;
- sal_uInt32 nCurrentPara = nCharAnzRead = 0;
+ sal_uInt32 nCharAnzRead = 0;
+ sal_uInt32 nCurrentPara = 0;
sal_uInt32 nCurrentSpecMarker = (sal_uInt32)(sal_uIntPtr)aSpecMarkerList.First();
- sal_uInt32 nExtParaNibble = 0;
+ sal_uInt16 nStringLen = aString.Len();
while ( nCharAnzRead < nStringLen )
{
@@ -5207,87 +5343,9 @@ PPTStyleTextPropReader::PPTStyleTextPropReader( SvStream& rIn, SdrPowerPointImpo
PPTCharPropSet aCharPropSet( nCurrentPara );
if ( bTextPropAtom )
- {
- rIn >> nDummy16;
- nCharCount = nDummy16;
- rIn >> nDummy16;
- nCharsToRead = nStringLen - ( nCharAnzRead + nCharCount );
- if ( nCharsToRead < 0 )
- {
- nCharCount = nStringLen - nCharAnzRead;
- if ( nCharsToRead < -1 )
- {
- bTextPropAtom = sal_False;
- DBG_ERROR( "SJ:PPTStyleTextPropReader::could not get this PPT_PST_StyleTextPropAtom by reading the character attributes" );
- }
- }
- ImplPPTCharPropSet& aSet = *aCharPropSet.pCharSet;
-
- // character attributes
- rIn >> nMask;
- if ( (sal_uInt16)nMask )
- {
- aSet.mnAttrSet |= (sal_uInt16)nMask;
- rIn >> aSet.mnFlags;
- }
- if ( nMask & 0x10000 ) // cfTypeface
- {
- rIn >> aSet.mnFont;
- aSet.mnAttrSet |= 1 << PPT_CharAttr_Font;
- }
- if ( nMask & 0x200000 ) // cfFEOldTypeface
- {
- rIn >> aSet.mnAsianOrComplexFont;
- aSet.mnAttrSet |= 1 << PPT_CharAttr_AsianOrComplexFont;
- }
- if ( nMask & 0x400000 ) // cfANSITypeface
- {
- rIn >> aSet.mnANSITypeface;
- aSet.mnAttrSet |= 1 << PPT_CharAttr_ANSITypeface;
- }
- if ( nMask & 0x800000 ) // cfSymbolTypeface
- {
- rIn >> aSet.mnSymbolFont;
- aSet.mnAttrSet |= 1 << PPT_CharAttr_Symbol;
- }
- if ( nMask & 0x20000 ) // cfSize
- {
- rIn >> aSet.mnFontHeight;
- aSet.mnAttrSet |= 1 << PPT_CharAttr_FontHeight;
- }
- if ( nMask & 0x40000 ) // cfColor
- {
- sal_uInt32 nVal;
- rIn >> nVal;
- if ( !( nVal & 0xff000000 ) )
- nVal = PPT_COLSCHEME_HINTERGRUND;
- aSet.mnColor = nVal;
- aSet.mnAttrSet |= 1 << PPT_CharAttr_FontColor;
- }
- if ( nMask & 0x80000 ) // cfPosition
- {
- rIn >> aSet.mnEscapement;
- aSet.mnAttrSet |= 1 << PPT_CharAttr_Escapement;
- }
- if ( nExtParaPos )
- {
- sal_uInt32 nExtBuInd = nMask & 0x3c00;
- if ( nExtBuInd )
- nExtBuInd = ( aSet.mnFlags & 0x3c00 ) >> 10;
- if ( nExtBuInd < aStyleTextProp9.size() )
- {
- if ( nExtParaNibble && ( ( nExtBuInd + nExtParaNibble ) < aStyleTextProp9.size() ) )
- nExtBuInd += nExtParaNibble;
-
- nExtParaFlags = aStyleTextProp9[ nExtBuInd ].mnExtParagraphMask;
- nBuBlip = aStyleTextProp9[ nExtBuInd ].mnBuBlip;
- nHasAnm = aStyleTextProp9[ nExtBuInd ].mnHasAnm;
- nAnmScheme = aStyleTextProp9[ nExtBuInd ].mnAnmScheme;
- }
- if ( ( nExtBuInd & 0xf ) == 0xf )
- nExtParaNibble += 16;
- }
- }
+ ReadCharProps( rIn, aCharPropSet, aString, nCharCount, nCharAnzRead,
+ bTextPropAtom, nExtParaPos, aStyleTextProp9, nExtParaFlags,
+ nBuBlip, nHasAnm, nAnmScheme );
else
nCharCount = nStringLen;
@@ -6632,7 +6690,12 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
mpImplTextObj->mnInstance = nInstance;
UINT32 nFilePos = rIn.Tell();
- if ( rSdrPowerPointImport.SeekToRec2( PPT_PST_TextBytesAtom, PPT_PST_TextCharsAtom, aClientTextBoxHd.GetRecEndFilePos() ) )
+ if ( rSdrPowerPointImport.SeekToRec2( PPT_PST_TextBytesAtom,
+ PPT_PST_TextCharsAtom,
+ aClientTextBoxHd.GetRecEndFilePos() )
+ || rSdrPowerPointImport.SeekToRec( rIn,
+ PPT_PST_StyleTextPropAtom,
+ aClientTextBoxHd.GetRecEndFilePos() ) )
{
PPTTextRulerInterpreter aTextRulerInterpreter( nTextRulerAtomOfs, rSdrPowerPointImport,
aClientTextBoxHd, rIn );
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index 2157c1052192..727e7f0bafcc 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -34,7 +34,6 @@
#include <algorithm>
#include <svx/svdhdl.hxx>
-#include "svdtouch.hxx"
#include <svx/svdpagv.hxx>
#include <svx/svdetc.hxx>
#include <svx/svdmrkv.hxx>
@@ -62,8 +61,7 @@
#include <svx/sdr/overlay/overlaymanager.hxx>
#include <svx/sdr/overlay/overlayanimatedbitmapex.hxx>
#include <svx/sdr/overlay/overlaybitmapex.hxx>
-#include <svx/sdr/overlay/overlaybitmap.hxx>
-#include <svx/sdr/overlay/overlaylinestriped.hxx>
+#include <svx/sdr/overlay/overlayline.hxx>
#include <svx/sdr/overlay/overlaytriangle.hxx>
#include <svx/sdr/overlay/overlayhatchrect.hxx>
#include <svx/sdrpagewindow.hxx>
@@ -83,36 +81,63 @@
class SdrHdlBitmapSet
{
// the bitmap holding all infos
- BitmapEx maMarkersBitmap;
+ BitmapEx maMarkersBitmap;
+
+ // the cropped Bitmaps for reusage
+ ::std::vector< BitmapEx > maRealMarkers;
+
+ // elpers
+ BitmapEx& impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const Rectangle& rRectangle);
public:
SdrHdlBitmapSet(UINT16 nResId);
~SdrHdlBitmapSet();
- BitmapEx GetBitmapEx(BitmapMarkerKind eKindOfMarker, UINT16 nInd=0);
+ const BitmapEx& GetBitmapEx(BitmapMarkerKind eKindOfMarker, UINT16 nInd=0);
};
////////////////////////////////////////////////////////////////////////////////////////////////////
+#define KIND_COUNT (14)
+#define INDEX_COUNT (6)
+#define INDIVIDUAL_COUNT (4)
SdrHdlBitmapSet::SdrHdlBitmapSet(UINT16 nResId)
+: maMarkersBitmap(),
+ // 14 kinds (BitmapMarkerKind) use index [0..5], 4 extra
+ maRealMarkers((KIND_COUNT * INDEX_COUNT) + INDIVIDUAL_COUNT)
{
// #101928# change color used for transparent parts to 0x00ff00ff (ImageList standard)
- Color aColTransparent(0x00ff00ff);
- Bitmap aBitmap(ResId(nResId, *ImpGetResMgr()));
- maMarkersBitmap = BitmapEx(aBitmap, aColTransparent);
+ const Color aColTransparent(0x00ff00ff);
+ const Bitmap aBitmap(ResId(nResId, *ImpGetResMgr()));
+ const Bitmap aMask(aBitmap.CreateMask(aColTransparent));
+
+ // create a real BitmapEx with an AlphaMask
+ maMarkersBitmap = BitmapEx(aBitmap, aMask);
+ // maMarkersBitmap = BitmapEx(aBitmap, aColTransparent);
}
SdrHdlBitmapSet::~SdrHdlBitmapSet()
{
}
-// #i15222#
+BitmapEx& SdrHdlBitmapSet::impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const Rectangle& rRectangle)
+{
+ BitmapEx& rTargetBitmap = maRealMarkers[nIndex];
+
+ if(rTargetBitmap.IsEmpty())
+ {
+ rTargetBitmap = maMarkersBitmap;
+ rTargetBitmap.Crop(rRectangle);
+ }
+
+ return rTargetBitmap;
+}
+
// change getting of bitmap to use the big ressource bitmap
-BitmapEx SdrHdlBitmapSet::GetBitmapEx(BitmapMarkerKind eKindOfMarker, UINT16 nInd)
+const BitmapEx& SdrHdlBitmapSet::GetBitmapEx(BitmapMarkerKind eKindOfMarker, UINT16 nInd)
{
// fill in size and source position in maMarkersBitmap
const sal_uInt16 nYPos(nInd * 11);
- Rectangle aSourceRect;
switch(eKindOfMarker)
{
@@ -123,140 +148,135 @@ BitmapEx SdrHdlBitmapSet::GetBitmapEx(BitmapMarkerKind eKindOfMarker, UINT16 nIn
}
case Rect_7x7:
{
- aSourceRect = Rectangle(Point(0, nYPos), Size(7, 7));
- break;
+ return impGetOrCreateTargetBitmap((0 * INDEX_COUNT) + nInd, Rectangle(Point(0, nYPos), Size(7, 7)));
}
case Rect_9x9:
{
- aSourceRect = Rectangle(Point(7, nYPos), Size(9, 9));
- break;
+ return impGetOrCreateTargetBitmap((1 * INDEX_COUNT) + nInd, Rectangle(Point(7, nYPos), Size(9, 9)));
}
case Rect_11x11:
{
- aSourceRect = Rectangle(Point(16, nYPos), Size(11, 11));
- break;
+ return impGetOrCreateTargetBitmap((2 * INDEX_COUNT) + nInd, Rectangle(Point(16, nYPos), Size(11, 11)));
}
case Rect_13x13:
{
+ const sal_uInt16 nIndex((3 * INDEX_COUNT) + nInd);
+
switch(nInd)
{
- case 0: aSourceRect = Rectangle(Point(72, 66), Size(13, 13)); break;
- case 1: aSourceRect = Rectangle(Point(85, 66), Size(13, 13)); break;
- case 2: aSourceRect = Rectangle(Point(72, 78), Size(13, 13)); break;
- case 3: aSourceRect = Rectangle(Point(85, 78), Size(13, 13)); break;
- case 4: aSourceRect = Rectangle(Point(98, 78), Size(13, 13)); break;
- case 5: aSourceRect = Rectangle(Point(98, 66), Size(13, 13)); break;
+ case 0:
+ {
+ return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(72, 66), Size(13, 13)));
+ }
+ case 1:
+ {
+ return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(85, 66), Size(13, 13)));
+ }
+ case 2:
+ {
+ return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(72, 78), Size(13, 13)));
+ }
+ case 3:
+ {
+ return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(85, 78), Size(13, 13)));
+ }
+ case 4:
+ {
+ return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(98, 78), Size(13, 13)));
+ }
+ default: // case 5:
+ {
+ return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(98, 66), Size(13, 13)));
+ }
}
-
- break;
}
case Circ_7x7:
{
- aSourceRect = Rectangle(Point(27, nYPos), Size(7, 7));
- break;
+ return impGetOrCreateTargetBitmap((4 * INDEX_COUNT) + nInd, Rectangle(Point(27, nYPos), Size(7, 7)));
}
case Circ_9x9:
case Customshape1:
{
- aSourceRect = Rectangle(Point(34, nYPos), Size(9, 9));
- break;
+ return impGetOrCreateTargetBitmap((5 * INDEX_COUNT) + nInd, Rectangle(Point(34, nYPos), Size(9, 9)));
}
case Circ_11x11:
{
- aSourceRect = Rectangle(Point(43, nYPos), Size(11, 11));
- break;
+ return impGetOrCreateTargetBitmap((6 * INDEX_COUNT) + nInd, Rectangle(Point(43, nYPos), Size(11, 11)));
}
case Elli_7x9:
{
- aSourceRect = Rectangle(Point(54, nYPos), Size(7, 9));
- break;
+ return impGetOrCreateTargetBitmap((7 * INDEX_COUNT) + nInd, Rectangle(Point(54, nYPos), Size(7, 9)));
}
case Elli_9x11:
{
- aSourceRect = Rectangle(Point(61, nYPos), Size(9, 11));
- break;
+ return impGetOrCreateTargetBitmap((8 * INDEX_COUNT) + nInd, Rectangle(Point(61, nYPos), Size(9, 11)));
}
case Elli_9x7:
{
- aSourceRect = Rectangle(Point(70, nYPos), Size(9, 7));
- break;
+ return impGetOrCreateTargetBitmap((9 * INDEX_COUNT) + nInd, Rectangle(Point(70, nYPos), Size(9, 7)));
}
case Elli_11x9:
{
- aSourceRect = Rectangle(Point(79, nYPos), Size(11, 9));
- break;
+ return impGetOrCreateTargetBitmap((10 * INDEX_COUNT) + nInd, Rectangle(Point(79, nYPos), Size(11, 9)));
}
case RectPlus_7x7:
{
- aSourceRect = Rectangle(Point(90, nYPos), Size(7, 7));
- break;
+ return impGetOrCreateTargetBitmap((11 * INDEX_COUNT) + nInd, Rectangle(Point(90, nYPos), Size(7, 7)));
}
case RectPlus_9x9:
{
- aSourceRect = Rectangle(Point(97, nYPos), Size(9, 9));
- break;
+ return impGetOrCreateTargetBitmap((12 * INDEX_COUNT) + nInd, Rectangle(Point(97, nYPos), Size(9, 9)));
}
case RectPlus_11x11:
{
- aSourceRect = Rectangle(Point(106, nYPos), Size(11, 11));
- break;
+ return impGetOrCreateTargetBitmap((13 * INDEX_COUNT) + nInd, Rectangle(Point(106, nYPos), Size(11, 11)));
}
case Crosshair:
{
- aSourceRect = Rectangle(Point(0, 68), Size(15, 15));
- break;
+ return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 0, Rectangle(Point(0, 68), Size(15, 15)));
}
case Glue:
{
- aSourceRect = Rectangle(Point(15, 74), Size(9, 9));
- break;
+ return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 1, Rectangle(Point(15, 74), Size(9, 9)));
}
- case Anchor:
- // #101688# AnchorTR for SW
+ case Anchor: // #101688# AnchorTR for SW
case AnchorTR:
{
- aSourceRect = Rectangle(Point(24, 68), Size(24, 23));
- break;
+ return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 2, Rectangle(Point(24, 68), Size(24, 23)));
}
// #98388# add AnchorPressed to be able to aninate anchor control
case AnchorPressed:
case AnchorPressedTR:
{
- aSourceRect = Rectangle(Point(48, 68), Size(24, 23));
- break;
+ return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 3, Rectangle(Point(48, 68), Size(24, 23)));
}
}
- // construct return bitmap
- BitmapEx aRetval(maMarkersBitmap);
- aRetval.Crop(aSourceRect);
-
- return aRetval;
+ // cannot happen since all pathes return something; return Rect_7x7 as default (see switch)
+ return maRealMarkers[0];
}
////////////////////////////////////////////////////////////////////////////////////////////////////
SdrHdlBitmapSet* SdrHdl::pSimpleSet = NULL;
SdrHdlBitmapSet* SdrHdl::pModernSet = NULL;
-
-// #101928#
SdrHdlBitmapSet* SdrHdl::pHighContrastSet = NULL;
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -810,7 +830,7 @@ bool SdrHdl::IsHdlHit(const Point& rPnt) const
{
// OVERLAYMANAGER
basegfx::B2DPoint aPosition(rPnt.X(), rPnt.Y());
- return maOverlayGroup.isHit(aPosition);
+ return maOverlayGroup.isHitLogic(aPosition);
}
Pointer SdrHdl::GetPointer() const
@@ -984,8 +1004,9 @@ void SdrHdlColor::CreateB2dIAObject()
Bitmap aBmpCol(CreateColorDropper(aMarkerColor));
basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
::sdr::overlay::OverlayObject* pNewOverlayObject = new
- ::sdr::overlay::OverlayBitmap(
- aPosition, aBmpCol,
+ ::sdr::overlay::OverlayBitmapEx(
+ aPosition,
+ BitmapEx(aBmpCol),
(UINT16)(aBmpCol.GetSizePixel().Width() - 1) >> 1,
(UINT16)(aBmpCol.GetSizePixel().Height() - 1) >> 1
);
@@ -1183,11 +1204,13 @@ void SdrHdlGradient::CreateB2dIAObject()
pNewOverlayObject = new
::sdr::overlay::OverlayTriangle(
- aPositionLeft, aPosition2, aPositionRight
+ aPositionLeft,
+ aPosition2,
+ aPositionRight,
+ IsGradient() ? Color(COL_BLACK) : Color(COL_BLUE)
);
DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
- pNewOverlayObject->setBaseColor(IsGradient() ? Color(COL_BLACK) : Color(COL_BLUE));
rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
maOverlayGroup.append(*pNewOverlayObject);
}
@@ -1331,13 +1354,6 @@ void SdrHdlLine::CreateB2dIAObject()
}
}
-bool SdrHdlLine::IsHdlHit(const Point& rPnt) const
-{
- // OVERLAYMANAGER
- basegfx::B2DPoint aPosition(rPnt.X(), rPnt.Y());
- return maOverlayGroup.isHit(aPosition);
-}
-
Pointer SdrHdlLine::GetPointer() const
{
return Pointer(POINTER_REFHAND);
@@ -1689,7 +1705,8 @@ void ImpTextframeHdl::CreateB2dIAObject()
aTopLeft,
aBottomRight,
aHatchCol,
- 6.0,
+ 3.0,
+ 3.0,
45 * F_PI180,
nDrehWink * -F_PI18000);
pNewOverlayObject->setHittable(false);
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 805b56eb207f..7273bb49889a 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -48,26 +48,19 @@
#include <svx/svdoole2.hxx>
#include <svx/xgrad.hxx>
#include <svx/xflgrit.hxx>
-
#include "gradtrns.hxx"
#include <svx/xflftrit.hxx>
-
#include <svx/dialmgr.hxx>
#include "svdstr.hrc"
#include <svx/svdundo.hxx>
-
-// #105722#
#include <svx/svdopath.hxx>
-
-// #i13033#
#include <svx/scene3d.hxx>
-
-// OD 30.06.2003 #108784#
#include <svx/svdovirt.hxx>
#include <svx/sdr/overlay/overlayrollingrectangle.hxx>
#include <svx/sdr/overlay/overlaymanager.hxx>
#include <sdrpaintwindow.hxx>
#include <svx/sdrpagewindow.hxx>
+#include <svx/sdrhittesthelper.hxx>
////////////////////////////////////////////////////////////////////////////////////////////////////
// predefines
@@ -109,7 +102,7 @@ ImplMarkingOverlay::ImplMarkingOverlay(const SdrPaintView& rView, const basegfx:
if(pTargetOverlay)
{
::sdr::overlay::OverlayRollingRectangleStriped* pNew = new ::sdr::overlay::OverlayRollingRectangleStriped(
- rStartPos, rStartPos, sal_False);
+ rStartPos, rStartPos, false);
pTargetOverlay->add(*pNew);
maObjects.append(*pNew);
}
@@ -1290,7 +1283,7 @@ BOOL SdrMarkView::IsMarkedObjHit(const Point& rPnt, short nTol) const
Point aPt(rPnt);
for (ULONG nm=0; nm<GetMarkedObjectCount() && !bRet; nm++) {
SdrMark* pM=GetSdrMarkByIndex(nm);
- bRet=ImpIsObjHit(aPt,USHORT(nTol),pM->GetMarkedSdrObj(),pM->GetPageView(),0);
+ bRet = 0 != CheckSingleSdrObjectHit(aPt,USHORT(nTol),pM->GetMarkedSdrObj(),pM->GetPageView(),0,0);
}
return bRet;
}
@@ -1391,7 +1384,8 @@ BOOL SdrMarkView::MarkNextObj(const Point& rPnt, short nTol, BOOL bPrev)
for (nm=nMarkAnz; nm>0 && pTopMarkHit==NULL;) {
nm--;
SdrMark* pM=GetSdrMarkByIndex(nm);
- if (ImpIsObjHit(aPt,USHORT(nTol),pM->GetMarkedSdrObj(),pM->GetPageView(),0)) {
+ if(CheckSingleSdrObjectHit(aPt,USHORT(nTol),pM->GetMarkedSdrObj(),pM->GetPageView(),0,0))
+ {
pTopMarkHit=pM;
nTopMarkHit=nm;
}
@@ -1407,7 +1401,8 @@ BOOL SdrMarkView::MarkNextObj(const Point& rPnt, short nTol, BOOL bPrev)
for (nm=0; nm<nMarkAnz && pBtmMarkHit==NULL; nm++) {
SdrMark* pM=GetSdrMarkByIndex(nm);
SdrPageView* pPV2=pM->GetPageView();
- if (pPV2==pPV && ImpIsObjHit(aPt,USHORT(nTol),pM->GetMarkedSdrObj(),pPV2,0)) {
+ if (pPV2==pPV && CheckSingleSdrObjectHit(aPt,USHORT(nTol),pM->GetMarkedSdrObj(),pPV2,0,0))
+ {
pBtmMarkHit=pM;
nBtmMarkHit=nm;
}
@@ -1464,7 +1459,8 @@ BOOL SdrMarkView::MarkNextObj(const Point& rPnt, short nTol, BOOL bPrev)
pObj = pObjList->GetObj(no);
}
- if (ImpIsObjHit(aPt,USHORT(nTol),pObj,pPV,SDRSEARCH_TESTMARKABLE)) {
+ if (CheckSingleSdrObjectHit(aPt,USHORT(nTol),pObj,pPV,SDRSEARCH_TESTMARKABLE,0))
+ {
if (TryToFindMarkedObject(pObj)==CONTAINER_ENTRY_NOTFOUND) {
pFndObj=pObj;
} else {
@@ -1590,7 +1586,7 @@ void SdrMarkView::SetMarkHdlSizePixel(USHORT nSiz)
}
#define SDRSEARCH_IMPISMASTER 0x80000000 /* MasterPage wird gerade durchsucht */
-SdrObject* SdrMarkView::ImpCheckObjHit(const Point& rPnt, USHORT nTol, SdrObject* pObj, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay) const
+SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, USHORT nTol, SdrObject* pObj, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay) const
{
if((nOptions & SDRSEARCH_IMPISMASTER) && pObj->IsNotVisibleAsMaster())
{
@@ -1636,15 +1632,13 @@ SdrObject* SdrMarkView::ImpCheckObjHit(const Point& rPnt, USHORT nTol, SdrObject
aPnt.Move( -aOffset.X(), -aOffset.Y() );
}
- pRet=ImpCheckObjHit(aPnt,nTol,pOL,pPV,nOptions,pMVisLay,pTmpObj);
+ pRet=CheckSingleSdrObjectHit(aPnt,nTol,pOL,pPV,nOptions,pMVisLay,pTmpObj);
}
else
{
- SdrLayerID nLay=pObj->GetLayer();
-
- if(pPV->GetVisibleLayers().IsSet(nLay) && (pMVisLay==NULL || pMVisLay->IsSet(nLay)))
+ if(!pMVisLay || pMVisLay->IsSet(pObj->GetLayer()))
{
- pRet=pObj->CheckHit(rPnt,nTol2,&pPV->GetVisibleLayers());
+ pRet = SdrObjectPrimitiveHit(*pObj, rPnt, nTol2, *pPV, &pPV->GetVisibleLayers(), false);
}
}
}
@@ -1658,7 +1652,7 @@ SdrObject* SdrMarkView::ImpCheckObjHit(const Point& rPnt, USHORT nTol, SdrObject
return pRet;
}
-SdrObject* SdrMarkView::ImpCheckObjHit(const Point& rPnt, USHORT nTol, SdrObjList* pOL, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay, SdrObject*& rpRootObj) const
+SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, USHORT nTol, SdrObjList* pOL, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay, SdrObject*& rpRootObj) const
{
BOOL bBack=(nOptions & SDRSEARCH_BACKWARD)!=0;
SdrObject* pRet=NULL;
@@ -1685,7 +1679,7 @@ SdrObject* SdrMarkView::ImpCheckObjHit(const Point& rPnt, USHORT nTol, SdrObjLis
pObj = pOL->GetObj(nObjNum);
}
- pRet=ImpCheckObjHit(rPnt,nTol,pObj,pPV,nOptions,pMVisLay);
+ pRet=CheckSingleSdrObjectHit(rPnt,nTol,pObj,pPV,nOptions,pMVisLay);
if (pRet!=NULL) rpRootObj=pObj;
if (bBack) nObjNum++;
}
@@ -1733,7 +1727,7 @@ BOOL SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrP
SdrMark* pM=GetSdrMarkByIndex(nMrkNum);
pObj=pM->GetMarkedSdrObj();
pPV=pM->GetPageView();
- pHitObj=ImpCheckObjHit(aPt,nTol,pObj,pPV,nOptions,NULL);
+ pHitObj=CheckSingleSdrObjectHit(aPt,nTol,pObj,pPV,nOptions,NULL);
if (bBack) nMrkNum++;
}
}
@@ -1778,7 +1772,7 @@ BOOL SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrP
if (pnPassNum!=NULL) *pnPassNum|=SDRSEARCHPASS_MASTERPAGE;
nTmpOptions=nTmpOptions | SDRSEARCH_IMPISMASTER;
}
- pHitObj=ImpCheckObjHit(aPt,nTol,pObjList,pPV,nTmpOptions,pMVisLay,pObj);
+ pHitObj=CheckSingleSdrObjectHit(aPt,nTol,pObjList,pPV,nTmpOptions,pMVisLay,pObj);
if (bBack) nPgNum++;
}
}
@@ -1801,8 +1795,12 @@ BOOL SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrP
if (!pObj->HasMacro() || !pObj->IsMacroHit(aHitRec)) pObj=NULL;
}
if (pObj!=NULL && (nOptions & SDRSEARCH_WITHTEXT) !=0 && pObj->GetOutlinerParaObject()==NULL) pObj=NULL;
- if (pObj!=NULL && (nOptions & SDRSEARCH_TESTTEXTAREA) !=0) {
- if (!pObj->IsTextEditHit(aPt,0/*nTol*/,NULL)) pObj=NULL;
+ if (pObj!=NULL && (nOptions & SDRSEARCH_TESTTEXTAREA) !=0)
+ {
+ if(!SdrObjectPrimitiveHit(*pObj, aPt, 0, *pPV, 0, true))
+ {
+ pObj = 0;
+ }
}
if (pObj!=NULL) {
rpObj=pObj;
@@ -1831,7 +1829,7 @@ BOOL SdrMarkView::PickMarkedObj(const Point& rPnt, SdrObject*& rpObj, SdrPageVie
SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
SdrPageView* pPV=pM->GetPageView();
SdrObject* pObj=pM->GetMarkedSdrObj();
- bFnd=ImpIsObjHit(aPt,nTol,pObj,pPV,SDRSEARCH_TESTMARKABLE);
+ bFnd = 0 != CheckSingleSdrObjectHit(aPt,nTol,pObj,pPV,SDRSEARCH_TESTMARKABLE,0);
if (bFnd) {
rpObj=pObj;
rpPV=pPV;
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 70dda490a540..dab855fa6f41 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -1630,7 +1630,7 @@ void SdrObjCustomShape::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
rInfo.bMirror90Allowed =TRUE;
rInfo.bTransparenceAllowed = FALSE;
rInfo.bGradientAllowed = FALSE;
- rInfo.bShearAllowed =FALSE;
+ rInfo.bShearAllowed =TRUE;
rInfo.bEdgeRadiusAllowed=FALSE;
rInfo.bNoContortion =TRUE;
@@ -1965,19 +1965,56 @@ void SdrObjCustomShape::NbcMirror( const Point& rRef1, const Point& rRef2 )
InvalidateRenderGeometry();
}
-void SdrObjCustomShape::Shear( const Point& /*rRef*/, long /*nWink*/, double /*tn*/, FASTBOOL /*bVShear*/)
+void SdrObjCustomShape::Shear( const Point& rRef, long nWink, double tn, FASTBOOL bVShear )
{
-/*
SdrTextObj::Shear( rRef, nWink, tn, bVShear );
InvalidateRenderGeometry();
-*/
}
-void SdrObjCustomShape::NbcShear( const Point& /*rRef*/, long /*nWink*/, double /*tn*/, FASTBOOL /*bVShear*/)
+void SdrObjCustomShape::NbcShear( const Point& rRef, long nWink, double tn, FASTBOOL bVShear )
{
-/*
+ long nDrehWink = aGeo.nDrehWink;
+ if ( nDrehWink )
+ {
+ aGeo.nDrehWink = -nDrehWink;
+ aGeo.RecalcSinCos();
+ NbcRotate( rRef, aGeo.nDrehWink, aGeo.nSin, aGeo.nCos );
+ }
SdrTextObj::NbcShear(rRef,nWink,tn,bVShear);
+ if ( nDrehWink )
+ {
+ aGeo.nDrehWink = nDrehWink;
+ aGeo.RecalcSinCos();
+ Rotate( rRef, aGeo.nDrehWink, aGeo.nSin, aGeo.nCos );
+ }
InvalidateRenderGeometry();
-*/
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrGluePoint SdrObjCustomShape::GetVertexGluePoint(USHORT nPosNum) const
+{
+ INT32 nWdt = ImpGetLineWdt(); // #i25616# ((XLineWidthItem&)(GetObjectItem(XATTR_LINEWIDTH))).GetValue();
+
+ // #i25616#
+ if(!LineIsOutsideGeometry())
+ {
+ nWdt++;
+ nWdt /= 2;
+ }
+
+ Point aPt;
+ switch (nPosNum) {
+ case 0: aPt=aRect.TopCenter(); aPt.Y()-=nWdt; break;
+ case 1: aPt=aRect.RightCenter(); aPt.X()+=nWdt; break;
+ case 2: aPt=aRect.BottomCenter(); aPt.Y()+=nWdt; break;
+ case 3: aPt=aRect.LeftCenter(); aPt.X()-=nWdt; break;
+ }
+ if (aGeo.nShearWink!=0) ShearPoint(aPt,aRect.TopLeft(),aGeo.nTan);
+ if (aGeo.nDrehWink!=0) RotatePoint(aPt,aRect.TopLeft(),aGeo.nSin,aGeo.nCos);
+ aPt-=GetSnapRect().Center();
+ SdrGluePoint aGP(aPt);
+ aGP.SetPercent(FALSE);
+ return aGP;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -2012,6 +2049,53 @@ void SdrObjCustomShape::ImpCheckCustomGluePointsAreAdded()
aNewList.Insert(aCopy);
}
+ sal_Bool bMirroredX = IsMirroredX();
+ sal_Bool bMirroredY = IsMirroredY();
+
+ long nShearWink = aGeo.nShearWink;
+ double fTan = aGeo.nTan;
+
+ if ( aGeo.nDrehWink || nShearWink || bMirroredX || bMirroredY )
+ {
+ Polygon aPoly( aRect );
+ if( nShearWink )
+ {
+ USHORT nPointCount=aPoly.GetSize();
+ for (USHORT i=0; i<nPointCount; i++)
+ ShearPoint(aPoly[i],aRect.Center(), fTan, FALSE );
+ }
+ if ( aGeo.nDrehWink )
+ aPoly.Rotate( aRect.Center(), aGeo.nDrehWink / 10 );
+
+ Rectangle aBoundRect( aPoly.GetBoundRect() );
+ sal_Int32 nXDiff = aBoundRect.Left() - aRect.Left();
+ sal_Int32 nYDiff = aBoundRect.Top() - aRect.Top();
+
+ if (nShearWink&&(bMirroredX&&!bMirroredY)||(bMirroredY&&!bMirroredX))
+ {
+ nShearWink = -nShearWink;
+ fTan = -fTan;
+ }
+
+ Point aRef( aRect.GetWidth() / 2, aRect.GetHeight() / 2 );
+ for ( a = 0; a < aNewList.GetCount(); a++ )
+ {
+ SdrGluePoint& rPoint = aNewList[ a ];
+ Point aGlue( rPoint.GetPos() );
+ if ( nShearWink )
+ ShearPoint( aGlue, aRef, fTan );
+
+ RotatePoint( aGlue, aRef, sin( fObjectRotation * F_PI180 ), cos( fObjectRotation * F_PI180 ) );
+ if ( bMirroredX )
+ aGlue.X() = aRect.GetWidth() - aGlue.X();
+ if ( bMirroredY )
+ aGlue.Y() = aRect.GetHeight() - aGlue.Y();
+ aGlue.X() -= nXDiff;
+ aGlue.Y() -= nYDiff;
+ rPoint.SetPos( aGlue );
+ }
+ }
+
for(a = 0; a < pList->GetCount(); a++)
{
const SdrGluePoint& rCandidate = (*pList)[a];
@@ -2162,12 +2246,13 @@ void SdrObjCustomShape::DragResizeCustomShape( const Rectangle& rNewRect, SdrObj
std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles( pObj ) );
+ GeoStat aGeoStat( pObj->GetGeoStat() );
if ( aNewRect.TopLeft()!= pObj->aRect.TopLeft() &&
( pObj->aGeo.nDrehWink || pObj->aGeo.nShearWink ) )
{
Point aNewPos( aNewRect.TopLeft() );
- if ( pObj->aGeo.nShearWink ) ShearPoint( aNewPos, aOld.TopLeft(), pObj->aGeo.nTan );
- if ( pObj->aGeo.nDrehWink ) RotatePoint(aNewPos, aOld.TopLeft(), pObj->aGeo.nSin, pObj->aGeo.nCos );
+ if ( pObj->aGeo.nShearWink ) ShearPoint( aNewPos, aOld.TopLeft(), aGeoStat.nTan );
+ if ( pObj->aGeo.nDrehWink ) RotatePoint(aNewPos, aOld.TopLeft(), aGeoStat.nSin, aGeoStat.nCos );
aNewRect.SetPos( aNewPos );
}
if ( aNewRect != pObj->aRect )
@@ -2180,7 +2265,6 @@ void SdrObjCustomShape::DragResizeCustomShape( const Rectangle& rNewRect, SdrObj
Point aTop( ( pObj->GetSnapRect().Left() + pObj->GetSnapRect().Right() ) >> 1, pObj->GetSnapRect().Top() );
Point aBottom( aTop.X(), aTop.Y() + 1000 );
pObj->NbcMirror( aTop, aBottom );
-
}
if ( rNewRect.Top() > rNewRect.Bottom() )
{
@@ -2188,6 +2272,7 @@ void SdrObjCustomShape::DragResizeCustomShape( const Rectangle& rNewRect, SdrObj
Point aRight( aLeft.X() + 1000, aLeft.Y() );
pObj->NbcMirror( aLeft, aRight );
}
+
std::vector< SdrCustomShapeInteraction >::iterator aIter( aInteractionHandles.begin() );
while ( aIter != aInteractionHandles.end() )
{
@@ -3008,10 +3093,6 @@ void SdrObjCustomShape::TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRe
rTextRect=Rectangle(aTextPos,aTextSiz);
}
-////////////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
void SdrObjCustomShape::NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject)
{
SdrTextObj::NbcSetOutlinerParaObject( pTextObject );
@@ -3020,81 +3101,6 @@ void SdrObjCustomShape::NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject
InvalidateRenderGeometry();
}
-////////////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-SdrObject* SdrObjCustomShape::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const
-{
- SdrObject* pHitObj = NULL;
- const SdrObject* pSdrObject = GetSdrObjectFromCustomShape();
- if ( pSdrObject )
- {
- SdrObjList* pOL = pSdrObject->GetSubList();
- if ( pOL )
- {
- ULONG nObjNum = pOL->GetObjCount();
- while ( ( pHitObj == NULL ) && nObjNum )
- {
- nObjNum--;
- SdrObject* pObj = pOL->GetObj( nObjNum );
- if ( pObj->CheckHit( rPnt, nTol, pVisiLayer ) )
- pHitObj = (SdrObject*)this;
- }
- }
- else if ( pSdrObject->CheckHit( rPnt, nTol, pVisiLayer ) )
- pHitObj = (SdrObject*)this;
- }
-
- if ( !pHitObj && HasText() )
- {
- // paint text over object
- double fTextRotation = GetExtraTextRotation();
- if ( fTextRotation != 0.0 )
- {
- GeoStat aOldGeoStat( aGeo );
- Rectangle aOldRect( aRect );
- Rectangle aTextBound( aRect );
- GetTextBounds( aTextBound );
-
- // determining the correct refpoint
- Point aRef( aTextBound.Center() );
- Rectangle aUnrotatedSnapRect( aOutRect );
- RotatePoint( aRef, aUnrotatedSnapRect.Center(), -aGeo.nSin, -aGeo.nCos );
-
- long dx = aRect.Right()-aRect.Left();
- long dy = aRect.Bottom()-aRect.Top();
- Point aP( aRect.TopLeft() );
- double sn = sin( F_PI180 * fTextRotation );
- double cs = cos( F_PI180 * fTextRotation );
- RotatePoint( aP, aRef, sn, cs );
- ((SdrObjCustomShape*)this)->aRect.Left()=aP.X();
- ((SdrObjCustomShape*)this)->aRect.Top()=aP.Y();
- ((SdrObjCustomShape*)this)->aRect.Right()=aRect.Left()+dx;
- ((SdrObjCustomShape*)this)->aRect.Bottom()=aRect.Top()+dy;
- if ( aGeo.nDrehWink == 0 )
- {
- ((SdrObjCustomShape*)this)->aGeo.nDrehWink=NormAngle360( (sal_Int32)( fTextRotation * 100.0 ) );
- ((SdrObjCustomShape*)this)->aGeo.nSin = sn;
- ((SdrObjCustomShape*)this)->aGeo.nCos = cs;
- }
- else
- {
- ((SdrObjCustomShape*)this)->aGeo.nDrehWink=NormAngle360( aGeo.nDrehWink + (sal_Int32)( fTextRotation * 100.0 ) );
- ((SdrObjCustomShape*)this)->aGeo.RecalcSinCos();
- }
- pHitObj = SdrTextObj::CheckHit( rPnt, nTol, pVisiLayer );
- ((SdrObjCustomShape*)this)->aGeo = aOldGeoStat;
- ((SdrObjCustomShape*)this)->aRect = aOldRect;
-
- }
- else
- pHitObj = SdrTextObj::CheckHit( rPnt, nTol, pVisiLayer );
- }
-
- return pHitObj;
-}
-
void SdrObjCustomShape::operator=(const SdrObject& rObj)
{
SdrTextObj::operator=( rObj );
@@ -3301,13 +3307,13 @@ void SdrObjCustomShape::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix,
SetSnapRect(aBaseRect);
// shear?
-// if(!basegfx::fTools::equalZero(fShearX))
-// {
-// GeoStat aGeoStat;
-// aGeoStat.nShearWink = FRound((atan(fShearX) / F_PI180) * 100.0);
-// aGeoStat.RecalcTan();
-// Shear(Point(), aGeoStat.nShearWink, aGeoStat.nTan, FALSE);
-// }
+ if(!basegfx::fTools::equalZero(fShearX))
+ {
+ GeoStat aGeoStat;
+ aGeoStat.nShearWink = FRound((atan(fShearX) / F_PI180) * 100.0);
+ aGeoStat.RecalcTan();
+ Shear(Point(), aGeoStat.nShearWink, aGeoStat.nTan, FALSE);
+ }
// rotation?
if(!basegfx::fTools::equalZero(fRotate))
diff --git a/svx/source/svdraw/svdoattr.cxx b/svx/source/svdraw/svdoattr.cxx
index f192221bd880..d4d4717535b8 100644
--- a/svx/source/svdraw/svdoattr.cxx
+++ b/svx/source/svdraw/svdoattr.cxx
@@ -34,7 +34,6 @@
#include <svx/svdoattr.hxx>
#include <svx/xpool.hxx>
#include "svditext.hxx"
-#include "svdtouch.hxx"
#include <svx/svdmodel.hxx>
#include <svx/svdpage.hxx>
#include <svx/svdattr.hxx>
@@ -171,26 +170,6 @@ sal_Int32 SdrAttrObj::ImpGetLineWdt() const
return nRetval;
}
-//////////////////////////////////////////////////////////////////////////////
-
-FASTBOOL SdrAttrObj::ImpGetShadowDist(sal_Int32& nXDist, sal_Int32& nYDist) const
-{
- const SfxItemSet& rSet = GetMergedItemSet();
-
- nXDist = 0L;
- nYDist = 0L;
-
- BOOL bShadOn = ((SdrShadowItem&)(rSet.Get(SDRATTR_SHADOW))).GetValue();
- if(bShadOn)
- {
- nXDist = ((SdrShadowXDistItem&)(rSet.Get(SDRATTR_SHADOWXDIST))).GetValue();
- nYDist = ((SdrShadowYDistItem&)(rSet.Get(SDRATTR_SHADOWYDIST))).GetValue();
- return TRUE;
- }
-
- return FALSE;
-}
-
BOOL SdrAttrObj::HasFill() const
{
return bClosedObj && ((XFillStyleItem&)(GetProperties().GetObjectItemSet().Get(XATTR_FILLSTYLE))).GetValue()!=XFILL_NONE;
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index c1abb3add6b9..e272a51a4a7a 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -127,6 +127,7 @@
#include <svx/polysc3d.hxx>
#include "svx/svdotable.hxx"
#include "svx/shapepropertynotifier.hxx"
+#include <svx/sdrhittesthelper.hxx>
using namespace ::com::sun::star;
@@ -175,8 +176,15 @@ FASTBOOL SdrObjUserData::HasMacro(const SdrObject* /*pObj*/) const
SdrObject* SdrObjUserData::CheckMacroHit(const SdrObjMacroHitRec& rRec, const SdrObject* pObj) const
{
- if (pObj==NULL) return NULL;
- return pObj->CheckHit(rRec.aPos,rRec.nTol,rRec.pVisiLayer);
+ if(pObj)
+ {
+ if(rRec.pPageView)
+ {
+ return SdrObjectPrimitiveHit(*pObj, rRec.aPos, rRec.nTol, *rRec.pPageView, rRec.pVisiLayer, false);
+ }
+ }
+
+ return 0;
}
Pointer SdrObjUserData::GetMacroPointer(const SdrObjMacroHitRec& /*rRec*/, const SdrObject* /*pObj*/) const
@@ -902,6 +910,10 @@ const Rectangle& SdrObject::GetLastBoundRect() const
void SdrObject::RecalcBoundRect()
{
+ // #i101680# suppress BoundRect calculations on import(s)
+ if(pModel && pModel->isLocked() )
+ return;
+
// central new method which will calculate the BoundRect using primitive geometry
if(aOutRect.IsEmpty())
{
@@ -982,19 +994,6 @@ BOOL SdrObject::LineGeometryUsageIsNecessary() const
return (eXLS != XLINE_NONE);
}
-SdrObject* SdrObject::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const
-{
- if(pVisiLayer && !pVisiLayer->IsSet(sal::static_int_cast< sal_uInt8 >(GetLayer())))
- {
- return 0L;
- }
-
- Rectangle aO(GetCurrentBoundRect());
- aO.Left()-=nTol; aO.Top()-=nTol; aO.Right()+=nTol; aO.Bottom()+=nTol;
- FASTBOOL bRet=aO.IsInside(rPnt);
- return bRet ? (SdrObject*)this : NULL;
-}
-
SdrObject* SdrObject::Clone() const
{
SdrObject* pObj=SdrObjFactory::MakeNewObject(GetObjInventor(),GetObjIdentifier(),NULL);
@@ -1166,6 +1165,11 @@ basegfx::B2DPolyPolygon SdrObject::TakeContour() const
SfxItemSet aNewSet(*GetObjectItemPool());
+ // #i101980# ignore LineWidth; that's what the old implementation
+ // did. With linewidth, the result may be huge due to fat/thick
+ // line decompositions
+ aNewSet.Put(XLineWidthItem(0));
+
// solid black lines and no fill
aNewSet.Put(XLineStyleItem(XLINE_SOLID));
aNewSet.Put(XLineColorItem(String(), Color(COL_BLACK)));
@@ -1393,8 +1397,15 @@ FASTBOOL SdrObject::MovCreate(SdrDragStat& rStat)
rStat.TakeCreateRect(aOutRect);
rStat.SetActionRect(aOutRect);
aOutRect.Justify();
- SetBoundRectDirty();
- bSnapRectDirty=TRUE;
+
+ // #i101648# for naked (non-derived) SdrObjects, do not invalidate aOutRect
+ // by calling SetBoundRectDirty(); aOutRect IS the geometry for such objects.
+ // No derivation implementation calls the parent implementation, so this will
+ // cause no further prolems
+ //
+ // SetBoundRectDirty();
+ // bSnapRectDirty=TRUE;
+
return TRUE;
}
@@ -1402,7 +1413,11 @@ FASTBOOL SdrObject::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
{
rStat.TakeCreateRect(aOutRect);
aOutRect.Justify();
- SetRectsDirty();
+
+ // #i101648# see description at MovCreate
+ //
+ // SetRectsDirty();
+
return (eCmd==SDRCREATE_FORCEEND || rStat.GetPointAnz()>=2);
}
@@ -1730,11 +1745,6 @@ FASTBOOL SdrObject::HasTextEdit() const
return FALSE;
}
-SdrObject* SdrObject::CheckTextEditHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const
-{
- return CheckHit(rPnt,nTol,pVisiLayer);
-}
-
sal_Bool SdrObject::BegTextEdit(SdrOutliner& /*rOutl*/)
{
return FALSE;
@@ -1806,11 +1816,19 @@ FASTBOOL SdrObject::HasMacro() const
SdrObject* SdrObject::CheckMacroHit(const SdrObjMacroHitRec& rRec) const
{
- SdrObjUserData* pData=ImpGetMacroUserData();
- if (pData!=NULL) {
- return pData->CheckMacroHit(rRec,this);
+ SdrObjUserData* pData = ImpGetMacroUserData();
+
+ if(pData)
+ {
+ return pData->CheckMacroHit(rRec, this);
}
- return CheckHit(rRec.aPos,rRec.nTol,rRec.pVisiLayer);
+
+ if(rRec.pPageView)
+ {
+ return SdrObjectPrimitiveHit(*this, rRec.aPos, rRec.nTol, *rRec.pPageView, rRec.pVisiLayer, false);
+ }
+
+ return 0;
}
Pointer SdrObject::GetMacroPointer(const SdrObjMacroHitRec& rRec) const
@@ -2374,8 +2392,8 @@ SdrObject* SdrObject::ImpConvertToContourObj(SdrObject* pRet, BOOL bForceLineDas
if(pRet->LineGeometryUsageIsNecessary())
{
- basegfx::B2DPolyPolygon aAreaPolyPolygon;
- basegfx::B2DPolyPolygon aLinePolyPolygon;
+ basegfx::B2DPolyPolygon aMergedLineFillPolyPolygon;
+ basegfx::B2DPolyPolygon aMergedHairlinePolyPolygon;
const drawinglayer::primitive2d::Primitive2DSequence xSequence(pRet->GetViewContact().getViewIndependentPrimitive2DSequence());
if(xSequence.hasElements())
@@ -2387,36 +2405,31 @@ SdrObject* SdrObject::ImpConvertToContourObj(SdrObject* pRet, BOOL bForceLineDas
drawinglayer::processor2d::LineGeometryExtractor2D aExtractor(aViewInformation2D);
aExtractor.process(xSequence);
- aAreaPolyPolygon = aExtractor.getExtractedLineFills();
- aLinePolyPolygon = aExtractor.getExtractedHairlines();
- }
+ // #i102241# check for line results
+ const std::vector< basegfx::B2DPolygon >& rHairlineVector = aExtractor.getExtractedHairlines();
- // Since this may in some cases lead to a count of 0 after
- // the merge i moved the merge to the front.
- if(aAreaPolyPolygon.count())
- {
- // bezier geometry got created, even for straight edges since the given
- // object is a result of DoConvertToPolyObj. For conversion to contour
- // this is not really needed and can be reduced again AFAP
- aAreaPolyPolygon = basegfx::tools::simplifyCurveSegments(aAreaPolyPolygon);
+ if(rHairlineVector.size())
+ {
+ // for SdrObject creation, just copy all to a single Hairline-PolyPolygon
+ for(sal_uInt32 a(0); a < rHairlineVector.size(); a++)
+ {
+ aMergedHairlinePolyPolygon.append(rHairlineVector[a]);
+ }
+ }
- // merge all to a decent result (try to use AND, but remember original)
- const basegfx::B2DPolyPolygon aTemp(aAreaPolyPolygon);
- aAreaPolyPolygon = basegfx::tools::solveCrossovers(aAreaPolyPolygon);
- aAreaPolyPolygon = basegfx::tools::stripNeutralPolygons(aAreaPolyPolygon);
- aAreaPolyPolygon = basegfx::tools::stripDispensablePolygons(aAreaPolyPolygon, false);
+ // #i102241# check for fill rsults
+ const std::vector< basegfx::B2DPolyPolygon >& rLineFillVector(aExtractor.getExtractedLineFills());
- if(!aAreaPolyPolygon.count())
+ if(rLineFillVector.size())
{
- // OOps, AND is empty, this means there were no overlapping parts. Use
- // remembered parts as result
- aAreaPolyPolygon = aTemp;
+ // merge to a single PolyPolygon (OR)
+ aMergedLineFillPolyPolygon = basegfx::tools::mergeToSinglePolyPolygon(rLineFillVector);
}
}
- // || aLinePolyPolygon.Count() removed; the conversion is ONLY
+ // || aMergedHairlinePolyPolygon.Count() removed; the conversion is ONLY
// useful when new closed filled polygons are created
- if(aAreaPolyPolygon.count() || (bForceLineDash && aLinePolyPolygon.count()))
+ if(aMergedLineFillPolyPolygon.count() || (bForceLineDash && aMergedHairlinePolyPolygon.count()))
{
SfxItemSet aSet(pRet->GetMergedItemSet());
XFillStyle eOldFillStyle = ((const XFillStyleItem&)(aSet.Get(XATTR_FILLSTYLE))).GetValue();
@@ -2424,10 +2437,10 @@ SdrObject* SdrObject::ImpConvertToContourObj(SdrObject* pRet, BOOL bForceLineDas
SdrPathObj* aLineHairlinePart = NULL;
bool bBuildGroup(false);
- if(aAreaPolyPolygon.count())
+ if(aMergedLineFillPolyPolygon.count())
{
// create SdrObject for filled line geometry
- aLinePolygonPart = new SdrPathObj(OBJ_PATHFILL, aAreaPolyPolygon);
+ aLinePolygonPart = new SdrPathObj(OBJ_PATHFILL, aMergedLineFillPolyPolygon);
aLinePolygonPart->SetModel(pRet->GetModel());
// correct item properties
@@ -2442,13 +2455,13 @@ SdrObject* SdrObject::ImpConvertToContourObj(SdrObject* pRet, BOOL bForceLineDas
aLinePolygonPart->SetMergedItemSet(aSet);
}
- if(aLinePolyPolygon.count())
+ if(aMergedHairlinePolyPolygon.count())
{
// create SdrObject for hairline geometry
// OBJ_PATHLINE is necessary here, not OBJ_PATHFILL. This is intended
// to get a non-filled object. If the poly is closed, the PathObj takes care for
// the correct closed state.
- aLineHairlinePart = new SdrPathObj(OBJ_PATHLINE, aLinePolyPolygon);
+ aLineHairlinePart = new SdrPathObj(OBJ_PATHLINE, aMergedHairlinePolyPolygon);
aLineHairlinePart->SetModel(pRet->GetModel());
aSet.Put(XLineWidthItem(0L));
diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx
index 47fc34dba5ba..7d41191c99a9 100644
--- a/svx/source/svdraw/svdocapt.cxx
+++ b/svx/source/svdraw/svdocapt.cxx
@@ -40,7 +40,6 @@
#include <svx/svdpool.hxx>
#include <svx/svdetc.hxx>
#include <svx/svdtrans.hxx>
-#include "svdtouch.hxx"
#include <svx/svdhdl.hxx>
#include <svx/svddrag.hxx>
#include <svx/svdmodel.hxx>
@@ -61,6 +60,7 @@
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/range/b2drange.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <svx/sdrhittesthelper.hxx>
// #i32599#
inline double ImplTwipsToMM(double fVal) { return (fVal * (127.0 / 72.0)); }
@@ -253,31 +253,6 @@ UINT16 SdrCaptionObj::GetObjIdentifier() const
return UINT16(OBJ_CAPTION);
}
-SdrObject* SdrCaptionObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const
-{
- if(pVisiLayer && !pVisiLayer->IsSet(sal::static_int_cast< sal_uInt8 >(GetLayer())))
- {
- return NULL;
- }
-
- sal_Bool bHit(SdrRectObj::CheckHit(rPnt,nTol,pVisiLayer) != NULL);
- if (!bHit) {
- INT32 nMyTol=nTol;
- INT32 nWdt = ((XLineWidthItem&)(GetObjectItem(XATTR_LINEWIDTH))).GetValue();
- nWdt++;
- nWdt /= 2;
-
- if (nWdt>nMyTol) nMyTol=nWdt; // Bei dicker Linie keine Toleranz noetig
- Rectangle aR(rPnt,rPnt);
- aR.Left() -=nMyTol;
- aR.Right() +=nMyTol;
- aR.Top() -=nMyTol;
- aR.Bottom()+=nMyTol;
- bHit = IsRectTouchesLine(aTailPoly,aR);
- }
- return bHit ? (SdrObject*)this : NULL;
-}
-
void SdrCaptionObj::operator=(const SdrObject& rObj)
{
SdrRectObj::operator=(rObj);
@@ -377,8 +352,10 @@ bool SdrCaptionObj::beginSpecialDrag(SdrDragStat& rDrag) const
Point aHit(rDrag.GetStart());
- if(SdrRectObj::CheckHit(aHit, 0, NULL))
+ if(rDrag.GetPageView() && SdrObjectPrimitiveHit(*this, aHit, 0, *rDrag.GetPageView(), 0, false))
+ {
return true;
+ }
}
else
{
diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx
index 9c8b8bf81937..6af31224ee45 100644
--- a/svx/source/svdraw/svdocirc.cxx
+++ b/svx/source/svdraw/svdocirc.cxx
@@ -40,7 +40,6 @@
#include <svx/svdocirc.hxx>
#include <math.h>
#include <svx/xpool.hxx>
-#include "svdtouch.hxx"
#include <svx/svdattr.hxx>
#include <svx/svdpool.hxx>
#include <svx/svdattrx.hxx>
@@ -312,127 +311,6 @@ void SdrCircObj::RecalcXPoly()
mpXPoly = new XPolygon(aPolyCirc);
}
-SdrObject* SdrCircObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const
-{
- if(pVisiLayer && !pVisiLayer->IsSet(sal::static_int_cast< sal_uInt8 >(GetLayer())))
- {
- return NULL;
- }
-
- Point aPt(rPnt);
- Point aZero;
- aPt.X()-=aRect.Left();
- aPt.Y()-=aRect.Top();
-
- INT32 nMyTol=nTol;
- FASTBOOL bFilled=meCircleKind!=OBJ_CARC && (bTextFrame || HasFill());
-
- INT32 nWdt=ImpGetLineWdt()/2; // Halbe Strichstaerke
- long nBoundWdt=aRect.GetWidth()-1;
- long nBoundHgt=aRect.GetHeight()-1;
- if (meCircleKind==OBJ_SECT) {
- long nTmpWink=NormAngle360(nEndWink-nStartWink);
- if (nTmpWink<9000) {
- nBoundWdt=0;
- nBoundHgt=0;
- } else if (nTmpWink<27000) {
- nBoundWdt/=2;
- nBoundHgt/=2;
- }
- }
- if (bFilled && nBoundWdt>short(nTol) && nBoundHgt>short(nTol) && Abs(aGeo.nShearWink)<=4500) nMyTol=0; // Keine Toleranz noetig hier
- if (nWdt>nMyTol) nMyTol=nWdt; // Bei dicker Umrandung keine Toleranz noetig
-
- // Den uebergebenen Punkt auf den gedrehten, geshearten Kreis transformieren
- // Unrotate:
- if (aGeo.nDrehWink!=0) RotatePoint(aPt,aZero,-aGeo.nSin,aGeo.nCos); // -sin fuer Umkehrung
- // Unshear:
- if (aGeo.nShearWink!=0) ShearPoint(aPt,aZero,-aGeo.nTan); // -tan fuer Umkehrung
-
- long nXRad=aRect.GetWidth()/2; if (nXRad<1) nXRad=1;
- long nYRad=aRect.GetHeight()/2; if (nYRad<1) nYRad=1;
-
- // Die wirklichen Radien fuer spaeter merken
- long nXRadReal=nXRad;
- long nYRadReal=nYRad;
- aPt.X()-=nXRad;
- aPt.Y()-=nYRad;
- Point aPtNoStretch(aPt);
-
- if (nXRad>nYRad) {
- aPt.Y()=BigMulDiv(aPt.Y(),nXRad,nYRad);
- // Da die Strichstaerke bei Ellipsen ueberall gleich ist:
- if (Abs(aPt.X())<Abs(aPt.Y())) {
- nMyTol=BigMulDiv(nMyTol,nXRad,nYRad);
- }
- nYRad=nXRad;
- }
- if (nYRad>nXRad) {
- aPt.X()=BigMulDiv(aPt.X(),nYRad,nXRad);
- // Da die Strichstaerke bei Ellipsen ueberall gleich ist:
- if (Abs(aPt.Y())<Abs(aPt.X())) {
- nMyTol=BigMulDiv(nMyTol,nYRad,nXRad);
- }
- nXRad=nYRad;
- }
-
- // Die BigInts haben bei *= leider ein Vorzeichenproblem (a*=a;)
- // (SV250A), deshalb hier soviele Instanzen. (JOE)
- long nAussen=nXRad+nMyTol;
- BigInt nBigTmpA(nAussen);
- BigInt nAusRadQ(nBigTmpA*nBigTmpA);
- long nInnen=nXRad-nMyTol; if (nInnen<=0) nInnen=0;
- BigInt nBigTmpI(nInnen);
- // wird sonst nicht benoetigt, ggf. BugMul sparen:
- BigInt nInnRadQ((!bFilled && nInnen!=0) ? nBigTmpI*nBigTmpI : nBigTmpI);
-
- // Radius von aPt berechnen
- BigInt nBigTmpX(aPt.X());
- BigInt nBigTmpY(aPt.Y());
- BigInt nPntRadQ(nBigTmpX*nBigTmpX+nBigTmpY*nBigTmpY);
-
- sal_Bool bRet(sal_False);
- if (nPntRadQ<=nAusRadQ) { // sonst ausserhalb
- if (nInnen==0) bRet = sal_True;
- else if (meCircleKind==OBJ_CIRC) { // Vollkreis
- if (bFilled) bRet = sal_True;
- else if (nPntRadQ>=nInnRadQ) bRet = sal_True;
- } else { // Teilkreise
- long nWink=NormAngle360(GetAngle(aPt));
- long a=nStartWink;
- long e=nEndWink;
- if (e<a) e+=36000;
- if (nWink<a) nWink+=36000;
- if (nWink>=a && nWink<=e) {
- if (bFilled) bRet = sal_True;
- else if (nPntRadQ>=nInnRadQ) bRet = sal_True;
- }
- if (!bRet) {
- Rectangle aR(aPtNoStretch.X()-nMyTol,aPtNoStretch.Y()-nMyTol,
- aPtNoStretch.X()+nMyTol,aPtNoStretch.Y()+nMyTol);
- Point aP1(GetWinkPnt(aRect,nStartWink));
- aP1.X()-=aRect.Left()+nXRadReal;
- aP1.Y()-=aRect.Top()+nYRadReal;
- Point aP2(GetWinkPnt(aRect,nEndWink));
- aP2.X()-=aRect.Left()+nXRadReal;
- aP2.Y()-=aRect.Top()+nYRadReal;
- if (meCircleKind==OBJ_SECT) { // Kreissektor: nur noch die beiden Strecken testen
- bRet=IsRectTouchesLine(aZero,aP1,aR) || IsRectTouchesLine(aZero,aP2,aR);
- }
- if (meCircleKind==OBJ_CCUT) { // Kreisabschnitt noch die Sehne und die MaeuseEcke (Dreieck) testen
- if (IsRectTouchesLine(aP1,aP2,aR)) bRet = sal_True; // die Sehne
- else if (bFilled) { // und nun die Maeusescke
- const Polygon aPoly(GetXPoly().getB2DPolygon().getDefaultAdaptiveSubdivision());
- bRet=IsPointInsidePoly(aPoly,rPnt);
- }
- }
- }
- }
- }
- if (!bRet && HasText()) bRet=SdrTextObj::CheckHit(rPnt,nTol,pVisiLayer)!=NULL;
- return bRet ? (SdrObject*)this : NULL;
-}
-
void SdrCircObj::TakeObjNameSingul(XubString& rName) const
{
USHORT nID=STR_ObjNameSingulCIRC;
diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx
index 4d4b9a985e15..abadbf094981 100644
--- a/svx/source/svdraw/svdoedge.cxx
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -44,7 +44,6 @@
#include <svx/svddrgv.hxx>
#include "svddrgm1.hxx"
#include <svx/svdhdl.hxx>
-#include "svdtouch.hxx"
#include <svx/svdtrans.hxx>
#include <svx/svdetc.hxx>
#include "svdglob.hxx" // StringCache
@@ -58,6 +57,7 @@
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdrhittesthelper.hxx>
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -417,30 +417,6 @@ void SdrEdgeObj::TakeUnrotatedSnapRect(Rectangle& rRect) const
rRect=GetSnapRect();
}
-SdrObject* SdrEdgeObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const
-{
- if(pVisiLayer && !pVisiLayer->IsSet(sal::static_int_cast< sal_uInt8 >(GetLayer())))
- {
- return NULL;
- }
-
- INT32 nMyTol=nTol;
- INT32 nWdt=ImpGetLineWdt()/2; // Halbe Strichstaerke
- if (nWdt>nMyTol) nMyTol=nWdt; // Bei dicker Linie keine Toleranz noetig
- Rectangle aR(rPnt,rPnt);
- aR.Left() -=nMyTol;
- aR.Right() +=nMyTol;
- aR.Top() -=nMyTol;
- aR.Bottom()+=nMyTol;
-
- sal_Bool bHit(sal_False);
-
- const Polygon aPoly(pEdgeTrack->getB2DPolygon().getDefaultAdaptiveSubdivision());
- bHit = IsRectTouchesLine(aPoly,aR);
- if (!bHit && HasText()) bHit = SdrTextObj::CheckHit(rPnt,nTol,pVisiLayer)!=NULL;
- return bHit ? (SdrObject*)this : NULL;
-}
-
FASTBOOL SdrEdgeObj::IsNode() const
{
return TRUE;
@@ -2134,7 +2110,8 @@ FASTBOOL SdrEdgeObj::ImpFindConnector(const Point& rPt, const SdrPageView& rPV,
USHORT nGesAnz=nConAnz+9;
FASTBOOL bUserFnd=FALSE;
ULONG nBestDist=0xFFFFFFFF;
- for (USHORT i=0; i<nGesAnz; i++) {
+ for (USHORT i=0; i<nGesAnz; i++)
+ {
FASTBOOL bUser=i<nConAnz;
FASTBOOL bVertex=i>=nConAnz+0 && i<nConAnz+4;
FASTBOOL bCorner=i>=nConAnz+4 && i<nConAnz+8;
@@ -2191,7 +2168,9 @@ FASTBOOL SdrEdgeObj::ImpFindConnector(const Point& rPt, const SdrPageView& rPV,
}
// Falls kein Konnektor getroffen wird nochmal
// HitTest versucht fuer BestConnector (=bCenter)
- if (!bFnd && !bEdge && pObj->IsHit(rPt,nBoundHitTol,&rVisLayer))
+ if(!bFnd &&
+ !bEdge &&
+ SdrObjectPrimitiveHit(*pObj, rPt, nBoundHitTol, rPV, &rVisLayer, false))
{
// #109007#
// Suppress default connect at object inside bound
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 805577df9b72..3f5da01e101b 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -581,13 +581,6 @@ sal_Bool SdrGrafObj::ImpUpdateGraphicLink() const
// -----------------------------------------------------------------------------
-SdrObject* SdrGrafObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const
-{
- return ImpCheckHit( rPnt, nTol, pVisiLayer, TRUE );
-}
-
-// -----------------------------------------------------------------------------
-
void SdrGrafObj::TakeObjNameSingul(XubString& rName) const
{
switch( pGraphic->GetType() )
@@ -666,6 +659,23 @@ void SdrGrafObj::TakeObjNamePlural( XubString& rName ) const
// -----------------------------------------------------------------------------
+SdrObject* SdrGrafObj::getFullDragClone() const
+{
+ // call parent
+ SdrGrafObj* pRetval = static_cast< SdrGrafObj* >(SdrRectObj::getFullDragClone());
+
+ // #i103116# the full drag clone leads to problems
+ // with linked graphics, so reset the link in this
+ // temporary interaction object and load graphic
+ if(pRetval && IsLinkedGraphic())
+ {
+ pRetval->ForceSwapIn();
+ pRetval->ReleaseGraphicLink();
+ }
+
+ return pRetval;
+}
+
void SdrGrafObj::operator=( const SdrObject& rObj )
{
SdrRectObj::operator=( rObj );
@@ -1097,6 +1107,14 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO )
pRet = GRFMGR_AUTOSWAPSTREAM_TEMP;
pGraphic->SetUserData();
}
+
+ // #i102380#
+ sdr::contact::ViewContactOfGraphic* pVC = dynamic_cast< sdr::contact::ViewContactOfGraphic* >(&GetViewContact());
+
+ if(pVC)
+ {
+ pVC->flushGraphicObjects();
+ }
}
}
}
diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx
index 879a53851919..5782ca91b74b 100644
--- a/svx/source/svdraw/svdogrp.cxx
+++ b/svx/source/svdraw/svdogrp.cxx
@@ -295,32 +295,6 @@ const Rectangle& SdrObjGroup::GetSnapRect() const
// <--
}
-SdrObject* SdrObjGroup::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const
-{
- if (pSub->GetObjCount()!=0) {
- return pSub->CheckHit(rPnt,nTol,pVisiLayer);
- } else { // ansonsten ist es eine leere Gruppe
- if(!pVisiLayer || pVisiLayer->IsSet(sal::static_int_cast< sal_uInt8 >(GetLayer())))
- {
- Rectangle aAussen(aOutRect);
- aAussen.Top() -=nTol;
- aAussen.Left() -=nTol;
- aAussen.Bottom()+=nTol;
- aAussen.Right() +=nTol;
- nTol++;
- Rectangle aInnen(aOutRect);
- aInnen.Top() +=nTol;
- aInnen.Left() +=nTol;
- aInnen.Bottom()-=nTol;
- aInnen.Right() -=nTol;
- if (aAussen.IsInside(rPnt) && !aInnen.IsInside(rPnt)) {
- return (SdrObject*)this;
- }
- }
- }
- return NULL;
-}
-
void SdrObjGroup::operator=(const SdrObject& rObj)
{
if(rObj.IsGroupObject())
diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx
index 6f97d4051b28..330b7f5c37f6 100644
--- a/svx/source/svdraw/svdomeas.cxx
+++ b/svx/source/svdraw/svdomeas.cxx
@@ -36,7 +36,6 @@
#include "svditext.hxx" //
#include <svx/xpoly.hxx>
#include <svx/svdtrans.hxx>
-#include "svdtouch.hxx"
#include <svx/svdhdl.hxx>
#include <svx/svdoutl.hxx>
#include <svx/svddrag.hxx>
@@ -766,37 +765,6 @@ void SdrMeasureObj::TakeUnrotatedSnapRect(Rectangle& rRect) const
}
}
-SdrObject* SdrMeasureObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const
-{
- if(pVisiLayer && !pVisiLayer->IsSet(sal::static_int_cast< sal_uInt8 >(GetLayer())))
- {
- return NULL;
- }
-
- sal_Bool bHit(sal_False);
- INT32 nMyTol=nTol;
- INT32 nWdt=ImpGetLineWdt()/2; // Halbe Strichstaerke
- if (nWdt>nMyTol) nMyTol=nWdt; // Bei dicker Linie keine Toleranz noetig
- Rectangle aR(rPnt,rPnt);
- aR.Left() -=nMyTol;
- aR.Right() +=nMyTol;
- aR.Top() -=nMyTol;
- aR.Bottom()+=nMyTol;
-
- if (bTextDirty) UndirtyText();
- ImpMeasureRec aRec;
- ImpMeasurePoly aMPol;
- ImpTakeAttr(aRec);
- ImpCalcGeometrics(aRec,aMPol);
- bHit=IsRectTouchesLine(aMPol.aMainline1.aP1,aMPol.aMainline1.aP2,aR) ||
- IsRectTouchesLine(aMPol.aMainline2.aP1,aMPol.aMainline2.aP2,aR) ||
- IsRectTouchesLine(aMPol.aHelpline1.aP1,aMPol.aHelpline1.aP2,aR) ||
- IsRectTouchesLine(aMPol.aHelpline2.aP1,aMPol.aHelpline2.aP2,aR);
- // und nun noch ggf. den Textbereich checken
- bHit=bHit || SdrTextObj::CheckHit(rPnt,nTol,pVisiLayer)!=NULL;
- return bHit ? (SdrObject*)this : NULL;
-}
-
void SdrMeasureObj::operator=(const SdrObject& rObj)
{
SdrTextObj::operator=(rObj);
@@ -1381,12 +1349,6 @@ void SdrMeasureObj::TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle
SdrTextObj::TakeTextEditArea(pPaperMin,pPaperMax,pViewInit,pViewMin);
}
-SdrObject* SdrMeasureObj::CheckTextEditHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const
-{
- if (bTextDirty) UndirtyText();
- return SdrTextObj::CheckTextEditHit(rPnt,nTol,pVisiLayer);
-}
-
USHORT SdrMeasureObj::GetOutlinerViewAnchorMode() const
{
if (bTextDirty) UndirtyText();
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index f9c1dc85c258..01ef392e941a 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -1578,13 +1578,6 @@ UINT16 SdrOle2Obj::GetObjIdentifier() const
// -----------------------------------------------------------------------------
-SdrObject* SdrOle2Obj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const
-{
- return ImpCheckHit(rPnt,nTol,pVisiLayer,TRUE,TRUE);
-}
-
-// -----------------------------------------------------------------------------
-
void SdrOle2Obj::TakeObjNameSingul(XubString& rName) const
{
rName = ImpGetResStr(bFrame ? STR_ObjNameSingulFrame : STR_ObjNameSingulOLE2);
@@ -1916,40 +1909,60 @@ void SdrOle2Obj::NbcMove(const Size& rSize)
// -----------------------------------------------------------------------------
-sal_Bool SdrOle2Obj::Unload( const uno::Reference< embed::XEmbeddedObject >& xObj, sal_Int64 nAspect )
+sal_Bool SdrOle2Obj::CanUnloadRunningObj( const uno::Reference< embed::XEmbeddedObject >& xObj, sal_Int64 nAspect )
{
sal_Bool bResult = sal_False;
sal_Int32 nState = xObj->getCurrentState();
if ( nState == embed::EmbedStates::LOADED )
{
+ // the object is already unloaded
bResult = sal_True;
}
else
{
- sal_Int64 nMiscStatus = xObj->getStatus( nAspect );
uno::Reference < util::XModifiable > xModifiable( xObj->getComponent(), uno::UNO_QUERY );
-
- if ( embed::EmbedMisc::MS_EMBED_ALWAYSRUN != ( nMiscStatus & embed::EmbedMisc::MS_EMBED_ALWAYSRUN ) &&
- embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY != ( nMiscStatus & embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY ) &&
- !( xModifiable.is() && xModifiable->isModified() ) &&
- !( nState == embed::EmbedStates::INPLACE_ACTIVE || nState == embed::EmbedStates::UI_ACTIVE || nState == embed::EmbedStates::ACTIVE ) )
+ if ( !xModifiable.is() )
+ bResult = sal_True;
+ else
{
- try
+ sal_Int64 nMiscStatus = xObj->getStatus( nAspect );
+
+ if ( embed::EmbedMisc::MS_EMBED_ALWAYSRUN != ( nMiscStatus & embed::EmbedMisc::MS_EMBED_ALWAYSRUN ) &&
+ embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY != ( nMiscStatus & embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY ) &&
+ !( xModifiable.is() && xModifiable->isModified() ) &&
+ !( nState == embed::EmbedStates::INPLACE_ACTIVE || nState == embed::EmbedStates::UI_ACTIVE || nState == embed::EmbedStates::ACTIVE ) )
{
- xObj->changeState( embed::EmbedStates::LOADED );
bResult = sal_True;
}
- catch( ::com::sun::star::uno::Exception& e )
- {
- (void)e;
- DBG_ERROR(
- (OString("SdrOle2Obj::Unload=(), "
- "exception caught: ") +
- rtl::OUStringToOString(
- comphelper::anyToString( cppu::getCaughtException() ),
- RTL_TEXTENCODING_UTF8 )).getStr() );
- }
+ }
+ }
+
+ return bResult;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdrOle2Obj::Unload( const uno::Reference< embed::XEmbeddedObject >& xObj, sal_Int64 nAspect )
+{
+ sal_Bool bResult = sal_False;
+
+ if ( CanUnloadRunningObj( xObj, nAspect ) )
+ {
+ try
+ {
+ xObj->changeState( embed::EmbedStates::LOADED );
+ bResult = sal_True;
+ }
+ catch( ::com::sun::star::uno::Exception& e )
+ {
+ (void)e;
+ DBG_ERROR(
+ (OString("SdrOle2Obj::Unload=(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
}
}
@@ -2195,79 +2208,11 @@ sal_Bool SdrOle2Obj::AddOwnLightClient()
//////////////////////////////////////////////////////////////////////////////
-bool SdrOle2Obj::executeOldDoPaintPreparations(SdrPageView* pPageVew) const
+bool SdrOle2Obj::executeOldDoPaintPreparations(SdrPageView* /*pPageVew*/) const
{
- bool bIsActive(false);
- // copy of the old SdrOle2Obj::Do_PaintObject stuff which evtl. needs
- // to be emulated.
-
- // //charts must be painted resolution dependent!! #i82893#, #i75867#
- // if( ChartPrettyPainter::IsChart(xObjRef) && ChartPrettyPainter::ShouldPrettyPaintChartOnThisDevice( rOut.GetOutDev() ) )
- // if( !rOut.GetOffset().nA && !rOut.GetOffset().nB )//offset!=0 is the scenario 'copy -> past special gdi metafile' which does not work with direct painting so far
- // if( ChartPrettyPainter::DoPrettyPaintChart( this->getXModel(), rOut.GetOutDev(), aRect ) )
- // return bOk;
- //
- // if( !GetGraphic() )
- // ( (SdrOle2Obj*) this)->GetObjRef_Impl(); // try to create embedded object
-
- // this one can be used directly, just reformatting a bit
- if(!GetGraphic())
- {
- // try to create embedded object
- const_cast< SdrOle2Obj* >(this)->GetObjRef_Impl();
- }
-
- // if ( xObjRef.is() )
- // {
- // sal_Int64 nMiscStatus = xObjRef->getStatus( GetAspect() );
- // if( !bSizProt && (nMiscStatus & embed::EmbedMisc::EMBED_NEVERRESIZE) )
- // ( (SdrOle2Obj*) this)->bSizProt = TRUE;
-
- // old stuff which relies on xObjRef and nMiscStatus
- if(xObjRef.is())
- {
- const sal_Int64 nMiscStatus(xObjRef->getStatus(GetAspect()));
-
- // this hack (to change model data during PAINT argh(!)) can also be reproduced
- // directly
- if(!IsResizeProtect() && (nMiscStatus & embed::EmbedMisc::EMBED_NEVERRESIZE))
- {
- const_cast< SdrOle2Obj* >(this)->SetResizeProtect(true);
- }
-
- // OutputDevice* pOut = rOut.GetOutDev();
- //
- // //TODO/LATER: currently it's not possible to compare the windows, the XOutDev contains a virtual device
- // sal_Int32 nState = xObjRef->getCurrentState();
- // //if ( ( nState != embed::EmbedStates::INPLACE_ACTIVE && nState != embed::EmbedStates::UI_ACTIVE ) ||
- // // pModel && SfxInPlaceClient::GetActiveWindow( pModel->GetPersist(), xObjRef ) != pOut )
- // {
- // if ( nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE )
- // {
- // // PlugIn-Objekt connecten
- // if (rInfoRec.pPV!=NULL)
- // {
- // SdrOle2Obj* pOle2Obj = (SdrOle2Obj*) this;
- // SdrView* pSdrView = (SdrView*) &rInfoRec.pPV->GetView();
- // pSdrView->DoConnect(pOle2Obj);
- // }
- // }
-
- // nState is used in old paint to see if OLE is activated and to do
- // a different paint
- const sal_Int32 nState(xObjRef->getCurrentState());
-
- bIsActive = (nState == embed::EmbedStates::ACTIVE);
-
- // for this one i need the view.
- if(pPageVew && (nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE))
- {
- // connect plugin object
- pPageVew->GetView().DoConnect(const_cast< SdrOle2Obj* >(this));
- }
- }
-
- return bIsActive;
+ //#i101925# moved this stuff to method ViewObjectContactOfSdrOle2Obj::createPrimitive2DSequence and reorganized it further to avoid superfluous metafile creation for charts
+ //this method can be removed with the next incompatible build
+ return false;
}
Bitmap SdrOle2Obj::GetEmtyOLEReplacementBitmap() const
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index 7d128cf79746..1e9c9b57c52d 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -37,7 +37,6 @@
#include <svx/xpool.hxx>
#include <svx/xpoly.hxx>
#include <svx/svdattr.hxx>
-#include "svdtouch.hxx"
#include <svx/svdtrans.hxx>
#include <svx/svdetc.hxx>
#include <svx/svddrag.hxx>
@@ -79,6 +78,10 @@ inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); }
#include <basegfx/curve/b2dcubicbezier.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
+// #i89784#
+#include <svx/sdr/attribute/sdrtextattribute.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+
using namespace sdr;
inline USHORT GetPrevPnt(USHORT nPnt, USHORT nPntMax, FASTBOOL bClosed)
@@ -1746,7 +1749,10 @@ void SdrPathObj::ImpForceKind()
// was called, once here below and once on a 2nd place below.
// #i10659# for SdrTextObj, keep aRect up to date
- aRect = ImpGetBoundRect(GetPathPoly());
+ if(GetPathPoly().count())
+ {
+ aRect = ImpGetBoundRect(GetPathPoly());
+ }
}
// #i75974# adapt polygon state to object type. This may include a reinterpretation
@@ -1825,51 +1831,6 @@ UINT16 SdrPathObj::GetObjIdentifier() const
return USHORT(meKind);
}
-SdrObject* SdrPathObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const
-{
- if(pVisiLayer && !pVisiLayer->IsSet(sal::static_int_cast< sal_uInt8 >(GetLayer())))
- {
- return NULL;
- }
-
- sal_Bool bHit(sal_False);
- const basegfx::B2DPoint aHitPoint(rPnt.X(), rPnt.Y());
-
- if(GetPathPoly().isClosed() && (bTextFrame || HasFill()))
- {
- // hit in filled polygon? Subdivbide needed for better precision
- if(GetPathPoly().areControlPointsUsed())
- {
- bHit = basegfx::tools::isInside(GetPathPoly().getDefaultAdaptiveSubdivision(), aHitPoint);
- }
- else
- {
- bHit = basegfx::tools::isInside(GetPathPoly(), aHitPoint);
- }
- }
-
- if(!bHit)
- {
- // hit polygon line?
- const double fHalfLineWidth(ImpGetLineWdt() / 2.0);
- double fDistance(nTol);
-
- if(fHalfLineWidth > fDistance)
- {
- fDistance = fHalfLineWidth;
- }
-
- bHit = basegfx::tools::isInEpsilonRange(GetPathPoly(), aHitPoint, fDistance);
- }
-
- if(!bHit && !IsTextFrame() && HasText())
- {
- bHit = (0L != SdrTextObj::CheckHit(rPnt,nTol,pVisiLayer));
- }
-
- return bHit ? (SdrObject*)this : 0L;
-}
-
void SdrPathObj::operator=(const SdrObject& rObj)
{
SdrTextObj::operator=(rObj);
@@ -2424,7 +2385,10 @@ void SdrPathObj::TakeUnrotatedSnapRect(Rectangle& rRect) const
void SdrPathObj::RecalcSnapRect()
{
- maSnapRect = ImpGetBoundRect(GetPathPoly());
+ if(GetPathPoly().count())
+ {
+ maSnapRect = ImpGetBoundRect(GetPathPoly());
+ }
}
void SdrPathObj::NbcSetSnapRect(const Rectangle& rRect)
@@ -2514,8 +2478,11 @@ void SdrPathObj::NbcSetPoint(const Point& rPnt, sal_uInt32 nHdlNum)
}
else
{
- // #i10659# for SdrTextObj, keep aRect up to date
- aRect = ImpGetBoundRect(GetPathPoly()); // fuer SdrTextObj
+ if(GetPathPoly().count())
+ {
+ // #i10659# for SdrTextObj, keep aRect up to date
+ aRect = ImpGetBoundRect(GetPathPoly()); // fuer SdrTextObj#
+ }
}
SetRectsDirty();
@@ -2717,7 +2684,19 @@ SdrObject* SdrPathObj::RipPoint(sal_uInt32 nHdlNum, sal_uInt32& rNewPt0Index)
SdrObject* SdrPathObj::DoConvertToPolyObj(BOOL bBezier) const
{
- SdrObject* pRet = ImpConvertMakeObj(GetPathPoly(), IsClosed(), bBezier);
+ // #i89784# check for FontWork with activated HideContour
+ bool bHideContour(false);
+
+ {
+ drawinglayer::attribute::SdrTextAttribute* pText = drawinglayer::primitive2d::createNewSdrTextAttribute(GetObjectItemSet(), *getText(0));
+ bHideContour = pText && pText->getSdrFormTextAttribute() && pText->isHideContour();
+ delete pText;
+ }
+
+ SdrObject* pRet = bHideContour ?
+ 0 :
+ ImpConvertMakeObj(GetPathPoly(), IsClosed(), bBezier);
+
SdrPathObj* pPath = PTR_CAST(SdrPathObj, pRet);
if(pPath)
diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx
index ed841692a5f8..837b75bcf849 100644
--- a/svx/source/svdraw/svdorect.cxx
+++ b/svx/source/svdraw/svdorect.cxx
@@ -38,7 +38,6 @@
#include <svx/xpoly.hxx>
#include <svx/svdattr.hxx>
#include <svx/svdpool.hxx>
-#include "svdtouch.hxx"
#include <svx/svdtrans.hxx>
#include <svx/svdetc.hxx>
#include <svx/svddrag.hxx>
@@ -239,81 +238,6 @@ void SdrRectObj::TakeUnrotatedSnapRect(Rectangle& rRect) const
}
}
-SdrObject* SdrRectObj::ImpCheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer, FASTBOOL bForceFilled, FASTBOOL bForceTol) const
-{
- if(pVisiLayer && !pVisiLayer->IsSet(sal::static_int_cast< sal_uInt8 >(GetLayer())))
- {
- return NULL;
- }
-
- INT32 nMyTol=nTol;
- FASTBOOL bFilled=bForceFilled || HasFill();
- FASTBOOL bPickThrough=pModel!=NULL && pModel->IsPickThroughTransparentTextFrames();
- if (bTextFrame && !bPickThrough) bFilled=TRUE;
- FASTBOOL bLine=HasLine();
-
- INT32 nWdt=bLine ? ImpGetLineWdt() :0; // Halbe Strichstaerke
-
- // #i25616#
- if(nWdt && !LineIsOutsideGeometry())
- {
- nWdt /= 2;
- }
-
- long nBoundWdt=aRect.GetWidth()-1;
- long nBoundHgt=aRect.GetHeight()-1;
- if (bFilled && nBoundWdt>short(nTol) && nBoundHgt>short(nTol) && Abs(aGeo.nShearWink)<=4500) {
- if (!bForceTol && !bTextFrame ) nMyTol=0; // Keine Toleranz noetig hier
- }
- if (nWdt>nMyTol && (!bTextFrame || pEdtOutl==NULL)) nMyTol=nWdt; // Bei dicker Umrandung keine Toleranz noetig, ausser wenn bei TextEdit
- Rectangle aR(aRect);
- if (nMyTol!=0 && bFilled) {
- aR.Left ()-=nMyTol;
- aR.Top ()-=nMyTol;
- aR.Right ()+=nMyTol;
- aR.Bottom()+=nMyTol;
- }
-
- if (bFilled || bLine || bTextFrame) { // Bei TextFrame so tun, alsob Linie da
- unsigned nCnt=0;
- INT32 nXShad=0,nYShad=0;
- long nEckRad=/*bTextFrame ? 0 :*/ GetEckenradius();
- do { // 1 Durchlauf, bei Schatten 2 Durchlaeufe.
- if (nCnt!=0) aR.Move(nXShad,nYShad);
- if (aGeo.nDrehWink!=0 || aGeo.nShearWink!=0 || nEckRad!=0 || !bFilled) {
- Polygon aPol(aR);
- if (nEckRad!=0) {
- INT32 nRad=nEckRad;
- if (bFilled) nRad+=nMyTol; // um korrekt zu sein ...
- XPolygon aXPoly(ImpCalcXPoly(aR,nRad));
- aPol = Polygon(aXPoly.getB2DPolygon().getDefaultAdaptiveSubdivision());
- } else {
- if (aGeo.nShearWink!=0) ShearPoly(aPol,aRect.TopLeft(),aGeo.nTan);
- if (aGeo.nDrehWink!=0) RotatePoly(aPol,aRect.TopLeft(),aGeo.nSin,aGeo.nCos);
- }
- if (bFilled) {
- if (IsPointInsidePoly(aPol,rPnt)) return (SdrObject*)this;
- } else {
- Rectangle aTouchRect(rPnt.X()-nMyTol,rPnt.Y()-nMyTol,rPnt.X()+nMyTol,rPnt.Y()+nMyTol);
- if (IsRectTouchesLine(aPol,aTouchRect)) return (SdrObject*)this;
- }
- } else {
- if (aR.IsInside(rPnt)) return (SdrObject*)this;
- }
- } while (nCnt++==0 && ImpGetShadowDist(nXShad,nYShad));
- }
- FASTBOOL bCheckText=TRUE;
- if (bCheckText && HasText() && (!bTextFrame || bPickThrough)) {
- return SdrTextObj::CheckHit(rPnt,nTol,pVisiLayer);
- }
- return NULL;
-}
-
-SdrObject* SdrRectObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const
-{
- return ImpCheckHit(rPnt,nTol,pVisiLayer,FALSE/*,bTextFrame*/);
-}
-
void SdrRectObj::TakeObjNameSingul(XubString& rName) const
{
if (IsTextFrame())
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 9abf3950d694..6b2f02299d4a 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -36,7 +36,6 @@
#include <svx/svdpagv.hxx> // fuer Abfrage im Paint, ob das
#include <svx/svdview.hxx> // Objekt gerade editiert wird
#include <svx/svdpage.hxx> // und fuer AnimationHandler (Laufschrift)
-#include "svdtouch.hxx"
#include <svx/svdetc.hxx>
#include <svx/svdoutl.hxx>
#include "svdscrol.hxx" // fuer Laufschrift
@@ -1129,101 +1128,6 @@ void SdrTextObj::StopTextAnimation(OutputDevice* /*pOutDev*/, long /*nExtraData*
SetTextAnimationAllowed(sal_False);
}
-SdrObject* SdrTextObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const
-{
- if(!bTextFrame && !GetOutlinerParaObject() )
- {
- return NULL;
- }
-
- if(pVisiLayer && !pVisiLayer->IsSet(sal::static_int_cast< sal_uInt8 >(GetLayer())))
- {
- return NULL;
- }
-
- INT32 nMyTol=nTol;
- FASTBOOL bFontwork=IsFontwork();
- SdrFitToSizeType eFit=GetFitToSize();
- FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
- Rectangle aR(aRect);
- Rectangle aAnchor2(aR);
- Rectangle aTextRect(aR);
- SdrOutliner* pOutliner = NULL;
- pOutliner = &pModel->GetHitTestOutliner();
-
- if (bFontwork) {
- if (pFormTextBoundRect!=NULL) aR=*pFormTextBoundRect;
- else aR=GetCurrentBoundRect();
- }
- else
- {
- TakeTextRect( *pOutliner, aTextRect, FALSE, &aAnchor2, FALSE ); // EditText nicht mehr ignorieren! TRUE); // EditText ignorieren!
-
- if (bFitToSize)
- aR=aAnchor2;
- else
- aR=aTextRect;
- }
- if (aR.GetWidth()-1>short(nTol) && aR.GetHeight()-1>short(nTol)) nMyTol=0; // Keine Toleranz noetig hier
- if (nMyTol!=0) {
- aR.Left ()-=nMyTol;
- aR.Top ()-=nMyTol;
- aR.Right ()+=nMyTol;
- aR.Bottom()+=nMyTol;
- }
- FASTBOOL bRet=FALSE;
-
- if(bFontwork)
- {
- bRet = aR.IsInside(rPnt);
-
- // #105130# Include aRect here in measurements to be able to hit a
- // fontwork object on its border
- if(!bRet)
- {
- const Rectangle aSnapRect = GetSnapRect();
-
- if( (rPnt.X() >= aSnapRect.Left() - nTol && rPnt.X() <= aSnapRect.Left() + nTol)
- || (rPnt.X() >= aSnapRect.Right() - nTol && rPnt.X() <= aSnapRect.Right() + nTol)
- || (rPnt.Y() >= aSnapRect.Top() - nTol && rPnt.Y() <= aSnapRect.Top() + nTol)
- || (rPnt.Y() >= aSnapRect.Bottom() - nTol && rPnt.Y() <= aSnapRect.Bottom() + nTol))
- {
- bRet = TRUE;
- }
- }
- }
- else
- {
- if (aGeo.nDrehWink!=0) {
- Polygon aPol(aR);
- RotatePoly(aPol,aR.TopLeft(),aGeo.nSin,aGeo.nCos);
- bRet=IsPointInsidePoly(aPol,rPnt);
- } else {
- bRet=aR.IsInside(rPnt);
- }
- if (bRet) { // und nun noch checken, ob wirklich Buchstaben getroffen sind
- // Featurewunsch zur 4.0
- // Zunaechst meine Dok-Koordinaten in EE-Dok-Koordinaten umwandeln.
- Point aPt(rPnt); aPt-=aR.TopLeft();
- if (bFitToSize) { // #38214#: FitToSize berueksichtigen
- Fraction aX(aTextRect.GetWidth()-1,aAnchor2.GetWidth()-1);
- Fraction aY(aTextRect.GetHeight()-1,aAnchor2.GetHeight()-1);
- ResizePoint(aPt,Point(),aX,aY);
- }
- if (aGeo.nDrehWink!=0) RotatePoint(aPt,Point(),-aGeo.nSin,aGeo.nCos); // -sin fuer Unrotate
- // Und nun im EE-Dok auf Buchstabensuche gehen
- long nHitTol = 2000;
- OutputDevice* pRef = pOutliner->GetRefDevice();
- if( pRef )
- nHitTol = pRef->LogicToLogic( nHitTol, MAP_100TH_MM, pRef->GetMapMode().GetMapUnit() );
-
- bRet = pOutliner->IsTextPos( aPt, (sal_uInt16)nHitTol );
- }
- }
-
- return bRet ? (SdrObject*)this : NULL;
-}
-
void SdrTextObj::TakeObjNameSingul(XubString& rName) const
{
XubString aStr;
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index fe56b2da4e61..76c29de8d480 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -657,7 +657,11 @@ namespace
bool SdrTextObj::impCheckSpellCheckForDecomposeTextPrimitive() const
{
- return false;
+ // #i102062# asked TL who killed this feature (CWS tl56). Obviously, there
+ // is no more support for EE_CNTRL_NOREDLINES anymore; redlining is always
+ // on nowadays. Unfortunately, not false, but true should be returned then.
+ // Trying if this is all...
+ return true;
}
bool SdrTextObj::impDecomposeContourTextPrimitive(
@@ -731,7 +735,9 @@ bool SdrTextObj::impDecomposeBlockTextPrimitive(
// prepare outliner
const bool bIsCell(rSdrBlockTextPrimitive.getCellText());
- const SfxItemSet& rTextItemSet = rSdrBlockTextPrimitive.getSdrText().GetItemSet();
+ const SfxItemSet& rTextItemSet = rSdrBlockTextPrimitive.getSdrText()
+ ? rSdrBlockTextPrimitive.getSdrText()->GetItemSet()
+ : GetObjectItemSet();
SdrOutliner& rOutliner = ImpGetDrawOutliner();
SdrTextVertAdjust eVAdj = GetTextVerticalAdjust(rTextItemSet);
SdrTextHorzAdjust eHAdj = GetTextHorizontalAdjust(rTextItemSet);
@@ -767,17 +773,40 @@ bool SdrTextObj::impDecomposeBlockTextPrimitive(
}
else
{
+ // check if block text is used (only one of them can be true)
+ const bool bHorizontalIsBlock(SDRTEXTHORZADJUST_BLOCK == eHAdj && !bVerticalWritintg);
+ const bool bVerticalIsBlock(SDRTEXTVERTADJUST_BLOCK == eVAdj && bVerticalWritintg);
+
if((rSdrBlockTextPrimitive.getWordWrap() || IsTextFrame()) && !rSdrBlockTextPrimitive.getUnlimitedPage())
{
- rOutliner.SetMaxAutoPaperSize(aAnchorTextSize);
+ // #i103454# maximal paper size hor/ver needs to be limited to text
+ // frame size. If it's block text, still allow the 'other' direction
+ // to grow to get a correct real text size when using GetPaperSize().
+ // When just using aAnchorTextSize as maximum, GetPaperSize()
+ // would just return aAnchorTextSize again: this means, the wanted
+ // 'measurement' of the real size of block text would not work
+ Size aMaxAutoPaperSize(aAnchorTextSize);
+
+ if(bHorizontalIsBlock)
+ {
+ // allow to grow vertical for horizontal blocks
+ aMaxAutoPaperSize.setHeight(1000000);
+ }
+ else if(bVerticalIsBlock)
+ {
+ // allow to grow horizontal for vertical blocks
+ aMaxAutoPaperSize.setWidth(1000000);
+ }
+
+ rOutliner.SetMaxAutoPaperSize(aMaxAutoPaperSize);
}
- if(SDRTEXTHORZADJUST_BLOCK == eHAdj && !bVerticalWritintg)
+ // set minimal paper size hor/ver if needed
+ if(bHorizontalIsBlock)
{
rOutliner.SetMinAutoPaperSize(Size(nAnchorTextWidth, 0));
}
-
- if(SDRTEXTVERTADJUST_BLOCK == eVAdj && bVerticalWritintg)
+ else if(bVerticalIsBlock)
{
rOutliner.SetMinAutoPaperSize(Size(0, nAnchorTextHeight));
}
@@ -903,7 +932,9 @@ bool SdrTextObj::impDecomposeStretchTextPrimitive(
// prepare outliner
SdrOutliner& rOutliner = ImpGetDrawOutliner();
const sal_uInt32 nOriginalControlWord(rOutliner.GetControlWord());
- const SfxItemSet& rTextItemSet = rSdrStretchTextPrimitive.getSdrText().GetItemSet();
+ const SfxItemSet& rTextItemSet = rSdrStretchTextPrimitive.getSdrText()
+ ? rSdrStretchTextPrimitive.getSdrText()->GetItemSet()
+ : GetObjectItemSet();
const Size aNullSize;
rOutliner.SetControlWord(nOriginalControlWord|EE_CNTRL_STRETCHING|EE_CNTRL_AUTOPAGESIZE);
@@ -927,6 +958,16 @@ bool SdrTextObj::impDecomposeStretchTextPrimitive(
basegfx::B2DHomMatrix aNewTransformA;
basegfx::B2DHomMatrix aNewTransformB;
+ // #i101957# Check for vertical text. If used, aNewTransformA
+ // needs to translate the text initially around object width to orient
+ // it relative to the topper right instead of the topper left
+ const bool bVertical(rSdrStretchTextPrimitive.getOutlinerParaObject().IsVertical());
+
+ if(bVertical)
+ {
+ aNewTransformA.translate(aScale.getX(), 0.0);
+ }
+
// calculate global char stretching scale parameters. Use non-mirrored sizes
// to layout without mirroring
const double fScaleX(fabs(aScale.getX()) / aOutlinerScale.getX());
@@ -1196,4 +1237,5 @@ void SdrTextObj::impGetScrollTextTiming(drawinglayer::animation::AnimationEntryL
}
}
+//////////////////////////////////////////////////////////////////////////////
// eof
diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx
index 57fec8fbfaaa..f3bdeeb4811c 100644
--- a/svx/source/svdraw/svdotextpathdecomposition.cxx
+++ b/svx/source/svdraw/svdotextpathdecomposition.cxx
@@ -70,6 +70,7 @@
#include <editstat.hxx>
#include <unoapi.hxx>
#include <drawinglayer/geometry/viewinformation2d.hxx>
+#include <svx/sdr/attribute/sdrformtextoutlineattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -223,65 +224,13 @@ namespace
} // end of anonymous namespace
//////////////////////////////////////////////////////////////////////////////
-// TextBreakup data helper
-
-namespace
-{
- class impFormTextValues
- {
- sal_Int32 mnFormTextDistance; // distance from line in upright direction
- sal_Int32 mnFormTextStart; // shift from polygon start
- sal_Int32 mnFormTextShdwXVal; // shadow distance or 10th degrees
- sal_Int32 mnFormTextShdwYVal; // shadow distance or scaling
- sal_uInt16 mnFormTextShdwTransp; // shadow transparence
- XFormTextStyle meFormTextStyle; // on/off and char orientation
- XFormTextAdjust meFormTextAdjust; // adjustment (left/right/center) and scale
- XFormTextShadow meFormTextShadow; // shadow mode
- Color maFormTextShdwColor; // shadow color
-
- // bitfield
- unsigned mbFormTextMirror : 1; // change orientation
- unsigned mbFormTextOutline : 1; // show contour of objects
-
- public:
- impFormTextValues(const SfxItemSet& rSet)
- : mnFormTextDistance(((const XFormTextDistanceItem&)rSet.Get(XATTR_FORMTXTDISTANCE)).GetValue()),
- mnFormTextStart(((const XFormTextStartItem&)rSet.Get(XATTR_FORMTXTSTART)).GetValue()),
- mnFormTextShdwXVal(((const XFormTextShadowXValItem&)rSet.Get(XATTR_FORMTXTSHDWXVAL)).GetValue()),
- mnFormTextShdwYVal(((const XFormTextShadowYValItem&)rSet.Get(XATTR_FORMTXTSHDWYVAL)).GetValue()),
- mnFormTextShdwTransp(((const XFormTextShadowTranspItem&)rSet.Get(XATTR_FORMTXTSHDWTRANSP)).GetValue()),
- meFormTextStyle(((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue()),
- meFormTextAdjust(((const XFormTextAdjustItem&)rSet.Get(XATTR_FORMTXTADJUST)).GetValue()),
- meFormTextShadow(((const XFormTextShadowItem&)rSet.Get(XATTR_FORMTXTSHADOW)).GetValue()),
- maFormTextShdwColor(((const XFormTextShadowColorItem&)rSet.Get(XATTR_FORMTXTSHDWCOLOR)).GetColorValue()),
- mbFormTextMirror(((const XFormTextMirrorItem&)rSet.Get(XATTR_FORMTXTMIRROR)).GetValue()),
- mbFormTextOutline(((const XFormTextOutlineItem&)rSet.Get(XATTR_FORMTXTOUTLINE)).GetValue())
- {
- }
-
- // data access
- sal_Int32 getFormTextDistance() const { return mnFormTextDistance; }
- sal_Int32 getFormTextStart() const { return mnFormTextStart; }
- sal_Int32 getFormTextShdwXVal() const { return mnFormTextShdwXVal; }
- sal_Int32 getFormTextShdwYVal() const { return mnFormTextShdwYVal; }
- sal_uInt16 getFormTextShdwTransp() const { return mnFormTextShdwTransp; }
- XFormTextStyle getFormTextStyle() const { return meFormTextStyle; }
- XFormTextAdjust getFormTextAdjust() const { return meFormTextAdjust; }
- XFormTextShadow getFormTextShadow() const { return meFormTextShadow; }
- Color getFormTextShdwColor() const { return maFormTextShdwColor; }
- bool getFormTextMirror() const { return mbFormTextMirror; }
- bool getFormTextOutline() const { return mbFormTextOutline; }
- };
-} // end of anonymous namespace
-
-//////////////////////////////////////////////////////////////////////////////
// TextBreakup one poly and one paragraph helper
namespace
{
class impPolygonParagraphHandler
{
- const impFormTextValues& mrVal; // FormText parameters
+ const drawinglayer::attribute::SdrFormTextAttribute& mrSdrFormTextAttribute; // FormText parameters
std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& mrDecomposition; // destination primitive list
std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& mrShadowDecomposition; // destination primitive list for shadow
Reference < com::sun::star::i18n::XBreakIterator > mxBreak; // break iterator
@@ -321,10 +270,10 @@ namespace
public:
impPolygonParagraphHandler(
- const impFormTextValues& rVal,
+ const drawinglayer::attribute::SdrFormTextAttribute& rSdrFormTextAttribute,
std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rDecomposition,
std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rShadowDecomposition)
- : mrVal(rVal),
+ : mrSdrFormTextAttribute(rSdrFormTextAttribute),
mrDecomposition(rDecomposition),
mrShadowDecomposition(rShadowDecomposition)
{
@@ -348,16 +297,18 @@ namespace
double fPolyStart(0.0);
double fScaleFactor(1.0);
- if(mrVal.getFormTextMirror())
+ if(mrSdrFormTextAttribute.getFormTextMirror())
{
aPolygonCandidate.flip();
}
- if(mrVal.getFormTextStart() && (XFT_LEFT == mrVal.getFormTextAdjust() || XFT_RIGHT == mrVal.getFormTextAdjust()))
+ if(mrSdrFormTextAttribute.getFormTextStart()
+ && (XFT_LEFT == mrSdrFormTextAttribute.getFormTextAdjust()
+ || XFT_RIGHT == mrSdrFormTextAttribute.getFormTextAdjust()))
{
- if(XFT_LEFT == mrVal.getFormTextAdjust())
+ if(XFT_LEFT == mrSdrFormTextAttribute.getFormTextAdjust())
{
- fPolyStart += mrVal.getFormTextStart();
+ fPolyStart += mrSdrFormTextAttribute.getFormTextStart();
if(fPolyStart > fPolyEnd)
{
@@ -366,7 +317,7 @@ namespace
}
else
{
- fPolyEnd -= mrVal.getFormTextStart();
+ fPolyEnd -= mrSdrFormTextAttribute.getFormTextStart();
if(fPolyEnd < fPolyStart)
{
@@ -375,7 +326,7 @@ namespace
}
}
- if(XFT_LEFT != mrVal.getFormTextAdjust())
+ if(XFT_LEFT != mrSdrFormTextAttribute.getFormTextAdjust())
{
// calculate total text length of this paragraph, some layout needs to be done
const double fParagraphTextLength(getParagraphTextLength(rTextPortions));
@@ -384,7 +335,7 @@ namespace
// but still take care of XFT_AUTOSIZE in that case
const bool bTextTooLong(fParagraphTextLength > (fPolyEnd - fPolyStart));
- if(XFT_RIGHT == mrVal.getFormTextAdjust())
+ if(XFT_RIGHT == mrSdrFormTextAttribute.getFormTextAdjust())
{
if(!bTextTooLong)
{
@@ -392,7 +343,7 @@ namespace
fPolyStart += ((fPolyEnd - fPolyStart) - fParagraphTextLength);
}
}
- else if(XFT_CENTER == mrVal.getFormTextAdjust())
+ else if(XFT_CENTER == mrSdrFormTextAttribute.getFormTextAdjust())
{
if(!bTextTooLong)
{
@@ -400,7 +351,7 @@ namespace
fPolyStart += ((fPolyEnd - fPolyStart) - fParagraphTextLength) / 2.0;
}
}
- else if(XFT_AUTOSIZE == mrVal.getFormTextAdjust())
+ else if(XFT_AUTOSIZE == mrSdrFormTextAttribute.getFormTextAdjust())
{
// if scale, prepare scale factor between curve length and text length
if(0.0 != fParagraphTextLength)
@@ -434,7 +385,7 @@ namespace
// prepare portion length. Takes RTL sections into account.
double fPortionLength(pCandidate->getDisplayLength(nUsedTextLength, nNextGlyphLen));
- if(XFT_AUTOSIZE == mrVal.getFormTextAdjust())
+ if(XFT_AUTOSIZE == mrSdrFormTextAttribute.getFormTextAdjust())
{
// when scaling, expand portion length
fPortionLength *= fScaleFactor;
@@ -449,25 +400,27 @@ namespace
aNewTransformA.scale(aSize.getX(), aSize.getY());
// prepare scaling of text primitive
- if(XFT_AUTOSIZE == mrVal.getFormTextAdjust())
+ if(XFT_AUTOSIZE == mrSdrFormTextAttribute.getFormTextAdjust())
{
// when scaling, expand text primitive scaling
aNewTransformA.scale(fScaleFactor, fScaleFactor);
}
// eventually create shadow primitives from aDecomposition and add to rDecomposition
- const bool bShadow(XFTSHADOW_NONE != mrVal.getFormTextShadow());
+ const bool bShadow(XFTSHADOW_NONE != mrSdrFormTextAttribute.getFormTextShadow());
if(bShadow)
{
- if(XFTSHADOW_NORMAL == mrVal.getFormTextShadow())
+ if(XFTSHADOW_NORMAL == mrSdrFormTextAttribute.getFormTextShadow())
{
- aNewShadowTransform.translate(mrVal.getFormTextShdwXVal(), -mrVal.getFormTextShdwYVal());
+ aNewShadowTransform.translate(
+ mrSdrFormTextAttribute.getFormTextShdwXVal(),
+ -mrSdrFormTextAttribute.getFormTextShdwYVal());
}
else // XFTSHADOW_SLANT
{
- double fScaleValue(mrVal.getFormTextShdwYVal() / 100.0);
- double fShearValue(-mrVal.getFormTextShdwXVal() * F_PI1800);
+ double fScaleValue(mrSdrFormTextAttribute.getFormTextShdwYVal() / 100.0);
+ double fShearValue(-mrSdrFormTextAttribute.getFormTextShdwXVal() * F_PI1800);
aNewShadowTransform.scale(1.0, fScaleValue);
aNewShadowTransform.shearX(sin(fShearValue));
@@ -475,7 +428,7 @@ namespace
}
}
- switch(mrVal.getFormTextStyle())
+ switch(mrSdrFormTextAttribute.getFormTextStyle())
{
case XFT_ROTATE :
{
@@ -533,7 +486,7 @@ namespace
}
// distance from path?
- if(mrVal.getFormTextDistance())
+ if(mrSdrFormTextAttribute.getFormTextDistance())
{
if(aEndPos.equal(aStartPos))
{
@@ -541,7 +494,9 @@ namespace
}
// use back vector (aStartPos - aEndPos) here to get mirrored perpendicular as in old stuff
- const basegfx::B2DVector aPerpendicular(basegfx::getNormalizedPerpendicular(aStartPos - aEndPos) * mrVal.getFormTextDistance());
+ const basegfx::B2DVector aPerpendicular(
+ basegfx::getNormalizedPerpendicular(aStartPos - aEndPos) *
+ mrSdrFormTextAttribute.getFormTextDistance());
aNewTransformB.translate(aPerpendicular.getX(), aPerpendicular.getY());
}
@@ -550,7 +505,7 @@ namespace
{
if(pCandidate->getText().Len() && nNextGlyphLen)
{
- const Color aShadowColor(mrVal.getFormTextShdwColor());
+ const Color aShadowColor(mrSdrFormTextAttribute.getFormTextShdwColor());
const basegfx::BColor aRGBShadowColor(aShadowColor.getBColor());
const xub_StrLen nPortionIndex(pCandidate->getPortionIndex(nUsedTextLength, nNextGlyphLen));
const ::std::vector< double > aNewDXArray(
@@ -611,101 +566,6 @@ namespace
namespace
{
- basegfx::B2DLineJoin impGetB2DLineJoin(XLineJoint eLineJoint)
- {
- switch(eLineJoint)
- {
- case XLINEJOINT_MIDDLE :
- {
- return basegfx::B2DLINEJOIN_MIDDLE;
- }
- case XLINEJOINT_BEVEL :
- {
- return basegfx::B2DLINEJOIN_BEVEL;
- }
- case XLINEJOINT_MITER :
- {
- return basegfx::B2DLINEJOIN_MITER;
- }
- case XLINEJOINT_ROUND :
- {
- return basegfx::B2DLINEJOIN_ROUND;
- }
- default :
- {
- return basegfx::B2DLINEJOIN_NONE; // XLINEJOINT_NONE
- }
- }
- }
-} // end of anonymous namespace
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace
-{
- sal_uInt8 impGetStrokeTransparence(bool bShadow, const SfxItemSet& rSet)
- {
- sal_uInt8 nRetval;
-
- if(bShadow)
- {
- nRetval = (sal_uInt8)((((SdrShadowTransparenceItem&)(rSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue() * 255) / 100);
- }
- else
- {
- nRetval = (sal_uInt8)((((XLineTransparenceItem&)(rSet.Get(XATTR_LINETRANSPARENCE))).GetValue() * 255) / 100);
- }
-
- return nRetval;
- }
-
- drawinglayer::attribute::LineAttribute impGetLineAttribute(bool bShadow, const SfxItemSet& rSet)
- {
- basegfx::BColor aColorAttribute;
-
- if(bShadow)
- {
- const Color aShadowColor(((SdrShadowColorItem&)(rSet.Get(SDRATTR_SHADOWCOLOR))).GetColorValue());
- aColorAttribute = aShadowColor.getBColor();
- }
- else
- {
- const Color aLineColor(((XLineColorItem&)(rSet.Get(XATTR_LINECOLOR))).GetColorValue());
- aColorAttribute = aLineColor.getBColor();
- }
-
- const sal_uInt32 nLineWidth = ((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue();
- const XLineJoint eLineJoint = ((const XLineJointItem&)(rSet.Get(XATTR_LINEJOINT))).GetValue();
-
- return drawinglayer::attribute::LineAttribute(aColorAttribute, (double)nLineWidth, impGetB2DLineJoin(eLineJoint));
- }
-
- drawinglayer::attribute::StrokeAttribute impGetStrokeAttribute(const SfxItemSet& rSet)
- {
- const XLineStyle eLineStyle = ((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue();
- double fFullDotDashLen(0.0);
- ::std::vector< double > aDotDashArray;
-
- if(XLINE_DASH == eLineStyle)
- {
- const XDash& rDash = ((const XLineDashItem&)(rSet.Get(XATTR_LINEDASH))).GetDashValue();
-
- if(rDash.GetDots() || rDash.GetDashes())
- {
- const sal_uInt32 nLineWidth = ((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue();
- fFullDotDashLen = rDash.CreateDotDashArray(aDotDashArray, (double)nLineWidth);
- }
- }
-
- return drawinglayer::attribute::StrokeAttribute(aDotDashArray, fFullDotDashLen);
- }
-} // end of anonymous namespace
-
-//////////////////////////////////////////////////////////////////////////////
-// primitive decomposition helpers
-
-namespace
-{
void impAddPolygonStrokePrimitives(
const basegfx::B2DPolyPolygonVector& rB2DPolyPolyVector,
const basegfx::B2DHomMatrix& rTransform,
@@ -732,8 +592,7 @@ namespace
drawinglayer::primitive2d::Primitive2DSequence impAddPathTextOutlines(
const std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rSource,
- bool bShadow,
- const SfxItemSet& rSet)
+ const drawinglayer::attribute::SdrFormTextOutlineAttribute& rOutlineAttribute)
{
std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aNewPrimitives;
@@ -751,19 +610,19 @@ namespace
if(aB2DPolyPolyVector.size())
{
- // prepare Line and Stroke Attribute
- const drawinglayer::attribute::LineAttribute aLineAttribute(impGetLineAttribute(bShadow, rSet));
- const drawinglayer::attribute::StrokeAttribute aStrokeAttribute(impGetStrokeAttribute(rSet));
- const sal_uInt8 nTransparence(impGetStrokeTransparence(bShadow, rSet));
-
// create stroke primitives
std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aStrokePrimitives;
- impAddPolygonStrokePrimitives(aB2DPolyPolyVector, aPolygonTransform, aLineAttribute, aStrokeAttribute, aStrokePrimitives);
+ impAddPolygonStrokePrimitives(
+ aB2DPolyPolyVector,
+ aPolygonTransform,
+ rOutlineAttribute.getLineAttribute(),
+ rOutlineAttribute.getStrokeAttribute(),
+ aStrokePrimitives);
const sal_uInt32 nStrokeCount(aStrokePrimitives.size());
if(nStrokeCount)
{
- if(nTransparence)
+ if(rOutlineAttribute.getTransparence())
{
// create UnifiedAlphaPrimitive2D
drawinglayer::primitive2d::Primitive2DSequence aStrokePrimitiveSequence(nStrokeCount);
@@ -773,7 +632,10 @@ namespace
aStrokePrimitiveSequence[b] = drawinglayer::primitive2d::Primitive2DReference(aStrokePrimitives[b]);
}
- drawinglayer::primitive2d::UnifiedAlphaPrimitive2D* pNew2 = new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(aStrokePrimitiveSequence, (double)nTransparence / 100.0);
+ drawinglayer::primitive2d::UnifiedAlphaPrimitive2D* pNew2 =
+ new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(
+ aStrokePrimitiveSequence,
+ (double)rOutlineAttribute.getTransparence() / 100.0);
aNewPrimitives.push_back(pNew2);
}
else
@@ -822,7 +684,7 @@ bool SdrTextObj::impDecomposePathTextPrimitive(
rOutliner.SetUpdateMode(true);
rOutliner.Clear();
rOutliner.SetPaperSize(Size(LONG_MAX,LONG_MAX));
- rOutliner.SetText(*rSdrPathTextPrimitive.getSdrText().GetOutlinerParaObject());
+ rOutliner.SetText(rSdrPathTextPrimitive.getOutlinerParaObject());
// set visualizing page at Outliner; needed e.g. for PageNumberField decomposition
rOutliner.setVisualizedPage(GetSdrPageFromXDrawPage(aViewInformation.getVisualizedPage()));
@@ -833,11 +695,8 @@ bool SdrTextObj::impDecomposePathTextPrimitive(
if(rPathTextPortions.size())
{
- // get FormText values
- const SfxItemSet& rSet = rSdrPathTextPrimitive.getSdrText().GetItemSet();
- const impFormTextValues aVal(rSet);
-
- // get polygon values
+ // get FormText and polygon values
+ const drawinglayer::attribute::SdrFormTextAttribute& rFormTextAttribute = rSdrPathTextPrimitive.getSdrFormTextAttribute();
const basegfx::B2DPolyPolygon& rPathPolyPolygon(rSdrPathTextPrimitive.getPathPolyPolygon());
// get loop count
@@ -848,12 +707,13 @@ bool SdrTextObj::impDecomposePathTextPrimitive(
nLoopCount = rOutliner.GetParagraphCount();
}
- if(nLoopCount && XFT_NONE != aVal.getFormTextStyle())
+ if(nLoopCount)
{
// prepare common decomposition stuff
std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aRegularDecomposition;
std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aShadowDecomposition;
- impPolygonParagraphHandler aPolygonParagraphHandler(aVal, aRegularDecomposition, aShadowDecomposition);
+ impPolygonParagraphHandler aPolygonParagraphHandler(
+ rFormTextAttribute, aRegularDecomposition, aShadowDecomposition);
sal_uInt32 a;
for(a = 0L; a < nLoopCount; a++)
@@ -892,10 +752,10 @@ bool SdrTextObj::impDecomposePathTextPrimitive(
}
// evtl. add shadow outlines
- if(aVal.getFormTextOutline())
+ if(rFormTextAttribute.getFormTextOutline() && rFormTextAttribute.getShadowOutline())
{
- const SfxItemSet& rLocalSet = rSdrPathTextPrimitive.getSdrText().GetObject().GetMergedItemSet();
- const drawinglayer::primitive2d::Primitive2DSequence aOutlines(impAddPathTextOutlines(aShadowDecomposition, true, rLocalSet));
+ const drawinglayer::primitive2d::Primitive2DSequence aOutlines(
+ impAddPathTextOutlines(aShadowDecomposition, *rFormTextAttribute.getShadowOutline()));
drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aRetvalA, aOutlines);
}
}
@@ -911,10 +771,10 @@ bool SdrTextObj::impDecomposePathTextPrimitive(
}
// evtl. add outlines
- if(aVal.getFormTextOutline())
+ if(rFormTextAttribute.getFormTextOutline() && rFormTextAttribute.getOutline())
{
- const SfxItemSet& rLocalSet = rSdrPathTextPrimitive.getSdrText().GetObject().GetMergedItemSet();
- const drawinglayer::primitive2d::Primitive2DSequence aOutlines(impAddPathTextOutlines(aRegularDecomposition, false, rLocalSet));
+ const drawinglayer::primitive2d::Primitive2DSequence aOutlines(
+ impAddPathTextOutlines(aRegularDecomposition, *rFormTextAttribute.getOutline()));
drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aRetvalB, aOutlines);
}
}
diff --git a/svx/source/svdraw/svdotxed.cxx b/svx/source/svdraw/svdotxed.cxx
index 3b1a304bf9d4..f384cc9b4326 100644
--- a/svx/source/svdraw/svdotxed.cxx
+++ b/svx/source/svdraw/svdotxed.cxx
@@ -291,11 +291,6 @@ void SdrTextObj::EndTextEdit(SdrOutliner& rOutl)
mbInEditMode = FALSE;
}
-SdrObject* SdrTextObj::CheckTextEditHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const
-{
- return SdrTextObj::CheckHit(rPnt,nTol,pVisiLayer);
-}
-
USHORT SdrTextObj::GetOutlinerViewAnchorMode() const
{
SdrTextHorzAdjust eH=GetTextHorizontalAdjust();
diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx
index addc538efb25..aaed882cae3d 100644
--- a/svx/source/svdraw/svdotxtr.cxx
+++ b/svx/source/svdraw/svdotxtr.cxx
@@ -43,9 +43,13 @@
#include <svx/sdr/properties/itemsettools.hxx>
#include <svx/sdr/properties/properties.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
-#include "svdtxhdl.hxx"
#include <svtools/itemset.hxx>
#include <svditer.hxx>
+#include <drawinglayer/processor2d/textaspolygonextractor2d.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xlnwtit.hxx>
////////////////////////////////////////////////////////////////////////////////////////////////////
//
@@ -335,37 +339,139 @@ void SdrTextObj::NbcMirror(const Point& rRef1, const Point& rRef2)
SetGlueReallyAbsolute(FALSE);
}
-SdrObject* SdrTextObj::ImpConvertObj(FASTBOOL bToPoly) const
+//////////////////////////////////////////////////////////////////////////////
+
+SdrObject* SdrTextObj::ImpConvertContainedTextToSdrPathObjs(bool bToPoly) const
{
- if (!ImpCanConvTextToCurve()) return NULL;
- SdrObjGroup* pGroup=new SdrObjGroup();
+ SdrObject* pRetval = 0;
- boost::shared_ptr< SdrOutliner > xOutl( const_cast< SdrTextObj* >(this)->CreateDrawOutliner() );
- xOutl->SetUpdateMode(TRUE);
- ImpTextPortionHandler aConverter(*(xOutl.get()),*this);
+ if(!ImpCanConvTextToCurve())
+ {
+ // suppress HelpTexts from PresObj's
+ return 0;
+ }
- aConverter.ConvertToPathObj(*pGroup,bToPoly);
+ // get primitives
+ const drawinglayer::primitive2d::Primitive2DSequence xSequence(GetViewContact().getViewIndependentPrimitive2DSequence());
- // Nachsehen, ob ueberhaupt was drin ist:
- SdrObjList* pOL=pGroup->GetSubList();
+ if(xSequence.hasElements())
+ {
+ // create an extractor with neutral ViewInformation
+ const drawinglayer::geometry::ViewInformation2D aViewInformation2D(0);
+ drawinglayer::processor2d::TextAsPolygonExtractor2D aExtractor(aViewInformation2D);
- if (pOL->GetObjCount()==0) {
- delete pGroup;
- return NULL;
- }
- // Ein einzelnes Objekt muss nicht gruppiert werden:
- if (pOL->GetObjCount()==1) {
- SdrObject* pObj=pOL->RemoveObject(0);
- delete pGroup;
- return pObj;
+ // extract text as polygons
+ aExtractor.process(xSequence);
+
+ // get results
+ const drawinglayer::processor2d::TextAsPolygonDataNodeVector& rResult = aExtractor.getTarget();
+ const sal_uInt32 nResultCount(rResult.size());
+
+ if(nResultCount)
+ {
+ // prepare own target
+ SdrObjGroup* pGroup = new SdrObjGroup();
+ SdrObjList* pObjectList = pGroup->GetSubList();
+
+ // process results
+ for(sal_uInt32 a(0); a < nResultCount; a++)
+ {
+ const drawinglayer::processor2d::TextAsPolygonDataNode& rCandidate = rResult[a];
+ basegfx::B2DPolyPolygon aPolyPolygon(rCandidate.getB2DPolyPolygon());
+
+ if(aPolyPolygon.count())
+ {
+ // take care of wanted polygon type
+ if(bToPoly)
+ {
+ if(aPolyPolygon.areControlPointsUsed())
+ {
+ aPolyPolygon = basegfx::tools::adaptiveSubdivideByAngle(aPolyPolygon);
+ }
+ }
+ else
+ {
+ if(!aPolyPolygon.areControlPointsUsed())
+ {
+ aPolyPolygon = basegfx::tools::expandToCurve(aPolyPolygon);
+ }
+ }
+
+ // create ItemSet with object attributes
+ SfxItemSet aAttributeSet(GetObjectItemSet());
+ SdrPathObj* pPathObj = 0;
+
+ // always clear objectshadow; this is included in the extraction
+ aAttributeSet.Put(SdrShadowItem(false));
+
+ if(rCandidate.getIsFilled())
+ {
+ // set needed items
+ aAttributeSet.Put(XFillColorItem(String(), Color(rCandidate.getBColor())));
+ aAttributeSet.Put(XLineStyleItem(XLINE_NONE));
+ aAttributeSet.Put(XFillStyleItem(XFILL_SOLID));
+
+ // create filled SdrPathObj
+ pPathObj = new SdrPathObj(OBJ_PATHFILL, aPolyPolygon);
+ }
+ else
+ {
+ // set needed items
+ aAttributeSet.Put(XLineColorItem(String(), Color(rCandidate.getBColor())));
+ aAttributeSet.Put(XLineStyleItem(XLINE_SOLID));
+ aAttributeSet.Put(XLineWidthItem(0));
+ aAttributeSet.Put(XFillStyleItem(XFILL_NONE));
+
+ // create line SdrPathObj
+ pPathObj = new SdrPathObj(OBJ_PATHLINE, aPolyPolygon);
+ }
+
+ // copy basic information from original
+ pPathObj->ImpSetAnchorPos(GetAnchorPos());
+ pPathObj->NbcSetLayer(GetLayer());
+
+ if(GetModel())
+ {
+ pPathObj->SetModel(GetModel());
+ pPathObj->NbcSetStyleSheet(GetStyleSheet(), true);
+ }
+
+ // apply prepared ItemSet and add to target
+ pPathObj->SetMergedItemSet(aAttributeSet);
+ pObjectList->InsertObject(pPathObj);
+ }
+ }
+
+ // postprocess; if no result and/or only one object, simplify
+ if(!pObjectList->GetObjCount())
+ {
+ delete pGroup;
+ }
+ else if(1 == pObjectList->GetObjCount())
+ {
+ pRetval = pObjectList->RemoveObject(0);
+ delete pGroup;
+ }
+ else
+ {
+ pRetval = pGroup;
+ }
+ }
}
- // Ansonsten die Gruppe zurueckgeben
- return pGroup;
+
+ return pRetval;
}
+//////////////////////////////////////////////////////////////////////////////
+
SdrObject* SdrTextObj::DoConvertToPolyObj(BOOL bBezier) const
{
- return ImpConvertObj(!bBezier);
+ return ImpConvertContainedTextToSdrPathObjs(!bBezier);
+}
+
+bool SdrTextObj::ImpCanConvTextToCurve() const
+{
+ return !IsOutlText();
}
SdrObject* SdrTextObj::ImpConvertMakeObj(const basegfx::B2DPolyPolygon& rPolyPolygon, sal_Bool bClosed, sal_Bool bBezier, sal_Bool bNoSetAttr) const
@@ -388,25 +494,23 @@ SdrObject* SdrTextObj::ImpConvertMakeObj(const basegfx::B2DPolyPolygon& rPolyPol
pPathObj->SetPathPoly(basegfx::tools::expandToCurve(pPathObj->GetPathPoly()));
}
+ if(pPathObj)
{
- if(pPathObj)
+ pPathObj->ImpSetAnchorPos(aAnchor);
+ pPathObj->NbcSetLayer(SdrLayerID(GetLayer()));
+
+ if(pModel)
{
- pPathObj->ImpSetAnchorPos(aAnchor);
- pPathObj->NbcSetLayer(SdrLayerID(GetLayer()));
+ pPathObj->SetModel(pModel);
- if(pModel)
+ if(!bNoSetAttr)
{
- pPathObj->SetModel(pModel);
+ sdr::properties::ItemChangeBroadcaster aC(*pPathObj);
- if(!bNoSetAttr)
- {
- sdr::properties::ItemChangeBroadcaster aC(*pPathObj);
-
- pPathObj->ClearMergedItem();
- pPathObj->SetMergedItemSet(GetObjectItemSet());
- pPathObj->GetProperties().BroadcastItemChange(aC);
- pPathObj->NbcSetStyleSheet(GetStyleSheet(), sal_True);
- }
+ pPathObj->ClearMergedItem();
+ pPathObj->SetMergedItemSet(GetObjectItemSet());
+ pPathObj->GetProperties().BroadcastItemChange(aC);
+ pPathObj->NbcSetStyleSheet(GetStyleSheet(), sal_True);
}
}
}
@@ -421,7 +525,7 @@ SdrObject* SdrTextObj::ImpConvertAddText(SdrObject* pObj, FASTBOOL bBezier) cons
return pObj;
}
- SdrObject* pText = ImpConvertObj(!bBezier);
+ SdrObject* pText = ImpConvertContainedTextToSdrPathObjs(!bBezier);
if(!pText)
{
@@ -433,40 +537,6 @@ SdrObject* SdrTextObj::ImpConvertAddText(SdrObject* pObj, FASTBOOL bBezier) cons
return pText;
}
- // #i97874#
- // if shadow is set, apply it to created text, too
- const bool bShadowOn(((SdrShadowItem&)GetObjectItem(SDRATTR_SHADOW)).GetValue());
- SfxItemSet aShadowSet(*(GetObjectItemSet().GetPool()), SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST);
-
- if(bShadowOn)
- {
- // filter shadow items
- aShadowSet.Put(GetObjectItemSet());
- }
-
- { // #i97874#
- // copy needed attributes from local object to all newly created objects
- SdrObjListIter aIter(*pText);
-
- while(aIter.IsMore())
- {
- SdrObject* pCandidate = aIter.Next();
-
- // make sure Layer and model are correct
- pCandidate->NbcSetLayer(SdrLayerID(GetLayer()));
- pCandidate->SetModel(pModel);
-
- // set shadow if needed
- if(bShadowOn)
- {
- pCandidate->SetMergedItemSet(aShadowSet);
- }
-
- // set used StyleSheet
- pCandidate->NbcSetStyleSheet(GetStyleSheet(), true);
- }
- }
-
if(pText->IsGroupObject())
{
// is already group object, add partial shape in front
@@ -487,4 +557,5 @@ SdrObject* SdrTextObj::ImpConvertAddText(SdrObject* pObj, FASTBOOL bBezier) cons
}
}
+//////////////////////////////////////////////////////////////////////////////
// eof
diff --git a/svx/source/svdraw/svdouno.cxx b/svx/source/svdraw/svdouno.cxx
index abf9574f9172..74a3b0a49ada 100644
--- a/svx/source/svdraw/svdouno.cxx
+++ b/svx/source/svdraw/svdouno.cxx
@@ -297,11 +297,6 @@ namespace
};
}
-SdrObject* SdrUnoObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const
-{
- return ImpCheckHit(rPnt, nTol, pVisiLayer, TRUE, TRUE);
-}
-
void SdrUnoObj::TakeObjNameSingul(XubString& rName) const
{
rName = ImpGetResStr(STR_ObjNameSingulUno);
diff --git a/svx/source/svdraw/svdovirt.cxx b/svx/source/svdraw/svdovirt.cxx
index a93905fe21ed..18840cde18e0 100644
--- a/svx/source/svdraw/svdovirt.cxx
+++ b/svx/source/svdraw/svdovirt.cxx
@@ -161,13 +161,6 @@ void SdrVirtObj::SetChanged()
SdrObject::SetChanged();
}
-SdrObject* SdrVirtObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const
-{
- Point aPnt(rPnt-aAnchor);
- FASTBOOL bRet=rRefObj.CheckHit(aPnt,nTol,pVisiLayer)!=NULL;
- return bRet ? (SdrObject*)this : NULL;
-}
-
SdrObject* SdrVirtObj::Clone() const
{
SdrObject* pObj=new SdrVirtObj(((SdrVirtObj*)this)->rRefObj); // Nur eine weitere Referenz
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index 2986cb482aae..05b5b5e5aca6 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -678,33 +678,6 @@ const Rectangle& SdrObjList::GetAllObjBoundRect() const
return aOutRect;
}
-SdrObject* SdrObjList::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer, FASTBOOL bBackward) const
-{
- SdrObject* pHit=NULL;
- Rectangle R(rPnt.X()-nTol,rPnt.Y()-nTol,rPnt.X()+nTol,rPnt.Y()+nTol);
- if (R.IsOver(GetAllObjBoundRect())) {
- ULONG nObjAnz=GetObjCount();
- ULONG nObjNum=bBackward ? 0 : nObjAnz;
- while (pHit==NULL && (bBackward ? nObjNum<nObjAnz : nObjNum>0)) {
- if (!bBackward) nObjNum--;
- SdrObject* pObj=GetObj(nObjNum);
- if (R.IsOver(pObj->GetCurrentBoundRect())) {
- SdrObjList* pSubList=pObj->GetSubList();
- if (pSubList!=NULL || pVisiLayer==NULL) { // Gruppenobjekte beruecksichtigen sichtbare Layer selbst
- pHit=pObj->CheckHit(rPnt,nTol,pVisiLayer/*,bBackward*/);
- } else { // Ansonsten nur wenn Layer sichtbar
- SdrLayerID nLayer=pObj->GetLayer();
- if (pVisiLayer->IsSet(nLayer)) {
- pHit=pObj->CheckHit(rPnt,nTol,pVisiLayer/*,bBackward*/);
- }
- }
- }
- if (bBackward) nObjNum++;
- }
- }
- return pHit;
-}
-
void SdrObjList::NbcReformatAllTextObjects()
{
ULONG nAnz=GetObjCount();
@@ -773,42 +746,6 @@ void SdrObjList::BurnInStyleSheetAttributes()
}
}
-FASTBOOL SdrObjList::ImpGetFillColor(SdrObject* pObj, Color& rCol) const
-{
- return GetDraftFillColor(pObj->GetMergedItemSet(), rCol);
-}
-
-FASTBOOL SdrObjList::GetFillColor(const Point& rPnt, const SetOfByte& rVisLayers,
- /*FASTBOOL bLayerSorted,*/ Color& rCol) const
-{
- if (pModel==NULL) return FALSE;
- FASTBOOL bRet=FALSE;
- FASTBOOL bMaster=pPage!=NULL ? pPage->IsMasterPage() : FALSE;
- for (ULONG no=GetObjCount(); !bRet && no>0; ) {
- no--;
- SdrObject* pObj=GetObj(no);
- SdrObjList* pOL=pObj->GetSubList();
- if (pOL!=NULL) { // Aha, Gruppenobjekt
- bRet=pOL->GetFillColor(rPnt,rVisLayers,/*bLayerSorted,*/rCol);
- } else {
- SdrTextObj* pTextObj=PTR_CAST(SdrTextObj,pObj);
- // #108867# Exclude zero master page object (i.e. background
- // shape) from color query
- if (pTextObj!=NULL &&
- pObj->IsClosedObj() && rVisLayers.IsSet(pObj->GetLayer()) &&
- (!bMaster || (!pObj->IsNotVisibleAsMaster() && no!=0)) &&
- pObj->GetCurrentBoundRect().IsInside(rPnt) &&
- !pTextObj->IsHideContour() && pObj->IsHit(rPnt,0,NULL))
- { // Nachfolgend extra Funktion um Stack zu sparen,
- // da diese Methode hier rekursiv ist.
- bRet=ImpGetFillColor(pObj,rCol);
- }
- }
- }
- return bRet;
-}
-
-
ULONG SdrObjList::GetObjCount() const
{
return maList.size();
@@ -1706,56 +1643,6 @@ void SdrPage::TRG_ImpMasterPageRemoved(const SdrPage& rRemovedPage)
}
}
-// MasterPage interface
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-FASTBOOL SdrPage::ImplGetFillColor(const Point& rPnt, const SetOfByte& rVisLayers,
- /* FASTBOOL bLayerSorted,*/ Color& rCol, FASTBOOL bSkipBackgroundShape) const
-{
- if (pModel==NULL) return FALSE;
- FASTBOOL bRet=SdrObjList::GetFillColor(rPnt,rVisLayers,/*bLayerSorted,*/rCol);
- if (!bRet && !mbMaster)
- {
- // nun zu den Masterpages
- if(TRG_HasMasterPage())
- {
- SetOfByte aSet(rVisLayers);
- aSet &= TRG_GetMasterPageVisibleLayers();
- SdrPage& rMasterPage = TRG_GetMasterPage();
-
- // #108867# Don't fall back to background shape on
- // master pages. This is later handled by
- // GetBackgroundColor, and is necessary to cater for
- // the silly ordering: 1. shapes, 2. master page
- // shapes, 3. page background, 4. master page
- // background.
- bRet = rMasterPage.ImplGetFillColor(rPnt, aSet, rCol, TRUE);
- }
- }
-
- // #108867# Only now determine background color from background shapes
- if( !bRet && !bSkipBackgroundShape )
- {
- rCol = GetPageBackgroundColor();
- return TRUE;
- }
-
- return bRet;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-FASTBOOL SdrPage::GetFillColor(const Point& rPnt, const SetOfByte& rVisLayers,
- /*FASTBOOL bLayerSorted,*/ Color& rCol) const
-{
- // #108867# Wrapper for ImplGetFillColor. Used to properly set the
- // bSkipBackgroundShape parameter. Never skip background shape on
- // first level of recursion
- return ImplGetFillColor(rPnt,rVisLayers,/*bLayerSorted,*/rCol,FALSE);
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
const SdrPageGridFrameList* SdrPage::GetGridFrameList(const SdrPageView* /*pPV*/, const Rectangle* /*pRect*/) const
{
return NULL;
diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
index c42497d73507..c89c458aa9c7 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -113,7 +113,7 @@ ImplEncirclementOverlay::ImplEncirclementOverlay(const SdrPaintView& rView, cons
if(pTargetOverlay)
{
::sdr::overlay::OverlayRollingRectangleStriped* aNew = new ::sdr::overlay::OverlayRollingRectangleStriped(
- rStartPos, rStartPos, sal_False);
+ rStartPos, rStartPos, false);
pTargetOverlay->add(*aNew);
maObjects.append(*aNew);
}
@@ -1466,130 +1466,6 @@ void SdrPaintView::SetApplicationDocumentColor(Color aDocumentColor)
}
}
-// declaration extracted from svdedxv.cxx
-#define SPOTCOUNT 5
-
-Color SdrPaintView::CalcBackgroundColor( const Rectangle& rArea,
- const SetOfByte& rVisibleLayers,
- const SdrPage& rCurrPage ) const
-{
- // code extracted from SdrObjEditView::ImpGetTextEditBackgroundColor
- svtools::ColorConfig aColorConfig;
- Color aBackground(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
-
- // #98988# test if we are in High contrast mode; if yes, take
- // application background color
- // #10049# wrong, always use svtools::DOCCOLOR as default and use document settings if
- // not hc mode
- const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
-
- if(!rStyleSettings.GetHighContrastMode())
- {
- // Ok, dann eben die Page durchsuchen!
- Point aSpotPos[SPOTCOUNT];
- Color aSpotColor[SPOTCOUNT];
- ULONG nHeight( rArea.GetSize().Height() );
- ULONG nWidth( rArea.GetSize().Width() );
- ULONG nWidth14 = nWidth / 4;
- ULONG nHeight14 = nHeight / 4;
- ULONG nWidth34 = ( 3 * nWidth ) / 4;
- ULONG nHeight34 = ( 3 * nHeight ) / 4;
-
- USHORT i;
- for ( i = 0; i < SPOTCOUNT; i++ )
- {
- // Es wird anhand von fuenf Spots die Farbe untersucht
- switch ( i )
- {
- case 0 :
- {
- // Center-Spot
- aSpotPos[i] = rArea.Center();
- }
- break;
-
- case 1 :
- {
- // TopLeft-Spot
- aSpotPos[i] = rArea.TopLeft();
- aSpotPos[i].X() += nWidth14;
- aSpotPos[i].Y() += nHeight14;
- }
- break;
-
- case 2 :
- {
- // TopRight-Spot
- aSpotPos[i] = rArea.TopLeft();
- aSpotPos[i].X() += nWidth34;
- aSpotPos[i].Y() += nHeight14;
- }
- break;
-
- case 3 :
- {
- // BottomLeft-Spot
- aSpotPos[i] = rArea.TopLeft();
- aSpotPos[i].X() += nWidth14;
- aSpotPos[i].Y() += nHeight34;
- }
- break;
-
- case 4 :
- {
- // BottomRight-Spot
- aSpotPos[i] = rArea.TopLeft();
- aSpotPos[i].X() += nWidth34;
- aSpotPos[i].Y() += nHeight34;
- }
- break;
-
- }
-
- aSpotColor[i] = Color( COL_WHITE );
- rCurrPage.GetFillColor(aSpotPos[i], rVisibleLayers, /*bLayerSortedRedraw,*/ aSpotColor[i]);
- }
-
- USHORT aMatch[SPOTCOUNT];
-
- for ( i = 0; i < SPOTCOUNT; i++ )
- {
- // Wurden gleiche Spot-Farben gefuden?
- aMatch[i] = 0;
-
- for ( USHORT j = 0; j < SPOTCOUNT; j++ )
- {
- if( j != i )
- {
- if( aSpotColor[i] == aSpotColor[j] )
- {
- aMatch[i]++;
- }
- }
- }
- }
-
- // Das hoechste Gewicht hat der Spot in der Mitte
- aBackground = aSpotColor[0];
-
- for ( USHORT nMatchCount = SPOTCOUNT - 1; nMatchCount > 1; nMatchCount-- )
- {
- // Welche Spot-Farbe wurde am haeufigsten gefunden?
- for ( i = 0; i < SPOTCOUNT; i++ )
- {
- if( aMatch[i] == nMatchCount )
- {
- aBackground = aSpotColor[i];
- nMatchCount = 1; // Abbruch auch der aeusseren for-Schleife
- break;
- }
- }
- }
- }
-
- return aBackground;
-}
-
// #114898#
bool SdrPaintView::IsBufferedOutputAllowed() const
{
diff --git a/svx/source/svdraw/svdsnpv.cxx b/svx/source/svdraw/svdsnpv.cxx
index be0e871d61bf..0f126e2ec701 100644
--- a/svx/source/svdraw/svdsnpv.cxx
+++ b/svx/source/svdraw/svdsnpv.cxx
@@ -93,11 +93,16 @@ void ImplPageOriginOverlay::SetPosition(const basegfx::B2DPoint& rNewPosition)
if(rNewPosition != maPosition)
{
// apply to OverlayObjects
- basegfx::B2DHomMatrix aMatrix;
- aMatrix.translate(
- rNewPosition.getX() - maPosition.getX(),
- rNewPosition.getY() - maPosition.getY());
- maObjects.transform(aMatrix);
+ for(sal_uInt32 a(0); a < maObjects.count(); a++)
+ {
+ sdr::overlay::OverlayCrosshairStriped* pCandidate =
+ static_cast< sdr::overlay::OverlayCrosshairStriped* >(&maObjects.getOverlayObject(a));
+
+ if(pCandidate)
+ {
+ pCandidate->setBasePosition(rNewPosition);
+ }
+ }
// remember new position
maPosition = rNewPosition;
@@ -167,11 +172,17 @@ void ImplHelpLineOverlay::SetPosition(const basegfx::B2DPoint& rNewPosition)
if(rNewPosition != maPosition)
{
// apply to OverlayObjects
- basegfx::B2DHomMatrix aMatrix;
- aMatrix.translate(
- rNewPosition.getX() - maPosition.getX(),
- rNewPosition.getY() - maPosition.getY());
- maObjects.transform(aMatrix);
+ // apply to OverlayObjects
+ for(sal_uInt32 a(0); a < maObjects.count(); a++)
+ {
+ sdr::overlay::OverlayHelplineStriped* pCandidate =
+ static_cast< sdr::overlay::OverlayHelplineStriped* >(&maObjects.getOverlayObject(a));
+
+ if(pCandidate)
+ {
+ pCandidate->setBasePosition(rNewPosition);
+ }
+ }
// remember new position
maPosition = rNewPosition;
diff --git a/svx/source/svdraw/svdtext.cxx b/svx/source/svdraw/svdtext.cxx
index cbf80e23c91d..038eb96b35e6 100644
--- a/svx/source/svdraw/svdtext.cxx
+++ b/svx/source/svdraw/svdtext.cxx
@@ -53,6 +53,7 @@ SdrText::SdrText( SdrTextObj& rObject, OutlinerParaObject* pOutlinerParaObject /
SdrText::~SdrText()
{
+ clearWeak();
delete mpOutlinerParaObject;
}
@@ -60,10 +61,19 @@ void SdrText::CheckPortionInfo( SdrOutliner& rOutliner )
{
if(!mbPortionInfoChecked)
{
+ // #i102062# no action when the Outliner is the HitTestOutliner,
+ // this will remove WrongList info at the OPO
+ if(mpModel && &rOutliner == &mpModel->GetHitTestOutliner())
+ return;
+
// Optimierung: ggf. BigTextObject erzeugen
mbPortionInfoChecked=true;
if(mpOutlinerParaObject!=NULL && rOutliner.ShouldCreateBigTextObject())
- mpOutlinerParaObject= rOutliner.CreateParaObject();
+ {
+ // #i102062# MemoryLeak closed
+ delete mpOutlinerParaObject;
+ mpOutlinerParaObject = rOutliner.CreateParaObject();
+ }
}
}
diff --git a/svx/source/svdraw/svdtouch.cxx b/svx/source/svdraw/svdtouch.cxx
deleted file mode 100644
index 918855b6d665..000000000000
--- a/svx/source/svdraw/svdtouch.cxx
+++ /dev/null
@@ -1,299 +0,0 @@
-/*************************************************************************
- *
- * 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: svdtouch.cxx,v $
- * $Revision: 1.11 $
- *
- * 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_svx.hxx"
-
-#include "svdtouch.hxx"
-#include <svx/xpoly.hxx>
-#include <tools/bigint.hxx>
-#include <tools/poly.hxx>
-#include <basegfx/polygon/b2dpolygon.hxx>
-#include <basegfx/polygon/b2dpolygontools.hxx>
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-class ImpPolyHitCalc {
-public:
- long x1,x2,y1,y2; // Koordinaten des Rect, muessen sortiert sein!
- FASTBOOL bEdge; // ein Punkt lag genau auf einer Kante
- FASTBOOL bIntersect; // mind. 2 Punkte auf verschiedenen Seiten einer Kante
- FASTBOOL bPntInRect; // mind. 1 Punkt war vollstaendig im Rect
- USHORT nOCnt; // wenn Counter ungerade, dann getroffen
- USHORT nUCnt; // wenn Counter ungerade, dann getroffen
- USHORT nLCnt; // wenn Counter ungerade, dann getroffen
- USHORT nRCnt; // wenn Counter ungerade, dann getroffen
- FASTBOOL bLine; // TRUE=PolyLine, kein Polygon
-public:
- ImpPolyHitCalc(const Rectangle& aR, FASTBOOL bIsLine=FALSE)
- {
- bLine=bIsLine;
- bEdge=FALSE;
- bIntersect=FALSE;
- bPntInRect=FALSE;
- x1=aR.Left();
- x2=aR.Right();
- y1=aR.Top();
- y2=aR.Bottom();
- nOCnt=0;
- nUCnt=0;
- nLCnt=0;
- nRCnt=0;
- }
- FASTBOOL IsDecided() { return bEdge || bIntersect || bPntInRect; }
- void CheckPntInRect(const Point& rP)
- {
- if (!bPntInRect) {
- bPntInRect=rP.X()>=x1 && rP.X()<=x2 && rP.Y()>=y1 && rP.Y()<=y2;
- }
- }
- bool IsHit() { return (!bLine && (nOCnt & 1)==1) || IsDecided(); }
-};
-
-#define CAREFUL_MULDIV(Res,Val,Mul,Div) { \
- if (Abs(Val)>0xB504 || Abs(Mul)>0xB504) { \
- BigInt aBigTemp(Val); \
- aBigTemp*=Mul; \
- aBigTemp/=Div; \
- Res=long(aBigTemp); \
- } else { \
- Res=Val*Mul/Div; \
- } \
-}
-
-void ImpCheckIt(ImpPolyHitCalc& rH, long lx1, long ly1, long lx2, long ly2,
- long rx1, long ry1, long rx2, long ry2, USHORT& nOCnt, USHORT& nUCnt)
-{
- if ((ly1>ly2) || ((ly1==ly2) && (lx1>lx2))) {
- long nTmp; // die 2 Punkte nach Y sortieren
- nTmp=lx1;
- lx1=lx2;
- lx2=nTmp;
- nTmp=ly1;
- ly1=ly2;
- ly2=nTmp;
- }
- FASTBOOL b1=FALSE,b2=FALSE,b3=FALSE,b4=FALSE; // je 1 Flag fuer jeden der 4 Punkte LO,RO,LU,RU
- FASTBOOL bx1,bx2;
- FASTBOOL by1=ly1<=ry1 && ly2>ry1;
- FASTBOOL by2=ly1<=ry2 && ly2>ry2;
- long dx(0),dy(0),a(0);
- if (by1 || by2) {
- dx=lx2-lx1;
- dy=ly2-ly1;
- }
- if (by1) { // Nur wer die Scanline schneidet
- bx1=lx1<rx1; // x1,y1
- bx2=lx2<rx1;
- FASTBOOL bA=FALSE; // Optimierung: ggf eine Division sparen
- if (bx1 && bx2) b1=TRUE;
- else if (bx1 || bx2) {
- long yTemp=ry1-ly1;
- CAREFUL_MULDIV(a,dx,yTemp,dy); // a=dx*yTemp/dy;
- a+=lx1;
- bA=TRUE;
- rH.bEdge=(a==rx1);
- if (a<rx1) b1=TRUE;
- } // x2,y1
- bx1=lx1<rx2;
- bx2=lx2<rx2;
- if (bx1 && bx2) b2=TRUE;
- else if (bx1 || bx2) {
- if (!bA) {
- long yTemp=ry1-ly1;
- CAREFUL_MULDIV(a,dx,yTemp,dy);
- a+=lx1;
- }
- rH.bEdge=(a==rx2);
- if (a<rx2) b2=TRUE;
- }
- }
- if (by2) { // Nur wer die Scanline schneidet
- bx1=lx1<rx1; // x1,y2
- bx2=lx2<rx1;
- FASTBOOL bA=FALSE; // Optimierung: ggf eine Division sparen
- if (bx1 && bx2) b3=TRUE;
- else if (bx1 || bx2) {
- long yTemp=ry2-ly1;
- CAREFUL_MULDIV(a,dx,yTemp,dy);
- a+=lx1;
- bA=TRUE;
- rH.bEdge=(a==rx1);
- if (a<rx1) b3=TRUE;
- }
- bx1=lx1<rx2; // x2,y2
- bx2=lx2<rx2;
- if (bx1 && bx2) b4=TRUE;
- else if (bx1 || bx2) {
- if (!bA) {
- long yTemp=ry2-ly1;
- CAREFUL_MULDIV(a,dx,yTemp,dy);
- a+=lx1;
- }
- rH.bEdge=(a==rx2);
- if (a<rx2) b4=TRUE;
- }
- }
- if (by1 || by2) { // nun die Ergebnisse auswerten
- if (by1 && by2) { // Linie durch beide Scanlines
- if (b1 && b2 && b3 && b4) { nOCnt++; nUCnt++; } // Rect komplett rechts neben der Linie
- else if (b1 || b2 || b3 || b4) rH.bIntersect=TRUE; // Nur zum Teil->Schnittpunkt
- } else { // ansonsten Ober- und Unterkante des Rects getrennt betrachten
- if (by1) { // Linie durch Oberkante
- if (b1 && b2) nOCnt++; // Oberkante komplett rechts neben der Linie
- else if (b1 || b2) rH.bIntersect=TRUE; // Nur zum Teil->Schnittpunkt
- }
- if (by2) { // Linie durch Unterkante
- if (b3 && b4) nUCnt++; // Unterkante komplett rechts neben der Linie
- else if (b3 || b4) rH.bIntersect=TRUE; // Nur zum Teil->Schnittpunkt
- }
- }
- }
-}
-
-void CheckPolyHit(const Polygon& rPoly, ImpPolyHitCalc& rH)
-{
- USHORT nAnz=rPoly.GetSize();
- if (nAnz==0) return;
- if (nAnz==1) { rH.CheckPntInRect(rPoly[0]); return; }
- Point aPt0=rPoly[USHORT(nAnz-1)];
- rH.CheckPntInRect(aPt0);
- USHORT i=0;
- if (rH.bLine) {
- aPt0=rPoly[0];
- i++;
- }
- for (; i<nAnz && !rH.IsDecided(); i++) {
- Point aP1(aPt0);
- Point aP2(rPoly[i]);
- rH.CheckPntInRect(aP2);
- if (!rH.IsDecided()) {
- ImpCheckIt(rH,aP1.X(),aP1.Y(),aP2.X(),aP2.Y(),rH.x1,rH.y1,rH.x2,rH.y2,rH.nOCnt,rH.nUCnt);
- ImpCheckIt(rH,aP1.Y(),aP1.X(),aP2.Y(),aP2.X(),rH.y1,rH.x1,rH.y2,rH.x2,rH.nLCnt,rH.nRCnt);
- }
- aPt0=rPoly[i];
- }
- if (!rH.bLine) { // Sicherheitshalber nochmal checken
- if ((rH.nOCnt&1)!=(rH.nUCnt&1)) rH.bIntersect=TRUE; // da wird wohl eine durchgegangen sein
- if ((rH.nLCnt&1)!=(rH.nRCnt&1)) rH.bIntersect=TRUE; // da wird wohl eine durchgegangen sein
- if ((rH.nOCnt&1)!=(rH.nLCnt&1)) rH.bIntersect=TRUE; // da wird wohl eine durchgegangen sein
- }
-}
-
-bool IsRectTouchesLine(const Point& rPt1, const Point& rPt2, const Rectangle& rHit)
-{
- Polygon aPol(2);
- aPol[0]=rPt1;
- aPol[1]=rPt2;
- ImpPolyHitCalc aHit(rHit,TRUE);
- CheckPolyHit(aPol,aHit);
- return aHit.IsHit();
-}
-
-bool IsRectTouchesLine(const Polygon& rLine, const Rectangle& rHit)
-{
- ImpPolyHitCalc aHit(rHit,TRUE);
- CheckPolyHit(rLine,aHit);
- return aHit.IsHit();
-}
-
-bool IsRectTouchesLine(const PolyPolygon& rLine, const Rectangle& rHit)
-{
- ImpPolyHitCalc aHit(rHit,TRUE);
- USHORT nAnz=rLine.Count();
- for (USHORT nNum=0; nNum<nAnz && !aHit.IsHit(); nNum++) {
- CheckPolyHit(rLine[nNum],aHit);
- }
- return aHit.IsHit();
-}
-
-BYTE CheckPointTouchesPoly(const Polygon& rPoly, const Point& rHit) // 0=Ausserhalb, 1=Innerhalb, 2=Beruehrung
-{
- USHORT nAnz=rPoly.GetSize();
- if (nAnz<2) return FALSE;
- FASTBOOL bEdge=FALSE;
- USHORT nCnt=0;
- Point aPt0=rPoly[USHORT(nAnz-1)];
- for (USHORT i=0; i<nAnz && !bEdge; i++) {
- Point aP1(rPoly[i]);
- Point aP2(aPt0);
- if ((aP1.Y()>aP2.Y()) || ((aP1.Y()==aP2.Y()) && (aP1.X()>aP2.X()))) { Point aTmp(aP1); aP1=aP2; aP2=aTmp; }
- bEdge=((aP1.X()==aP2.X()) && (rHit.X()==aP1.X()) && (rHit.Y()>=aP1.Y()) && (rHit.Y()<=aP2.Y())) ||
- ((aP1.Y()==aP2.Y()) && (rHit.Y()==aP1.Y()) && (rHit.X()>=aP1.X()) && (rHit.X()<=aP2.X())) ||
- (rHit.X()==aP1.X()) && (rHit.Y()==aP1.Y());
- if (!bEdge && aP1.Y()<=rHit.Y() && aP2.Y()>rHit.Y()) { // Nur wer die Scanline schneidet
- FASTBOOL bx1=aP1.X()<rHit.X();
- FASTBOOL bx2=aP2.X()<rHit.X();
- if (bx1 && bx2) nCnt++;
- else if (bx1 || bx2) {
- long dx=aP2.X()-aP1.X();
- long dy=aP2.Y()-aP1.Y();
- long yTemp=rHit.Y()-aP1.Y();
- long xTemp;
- if (Abs(dx)>0xB504 || Abs(yTemp)>0xB504) { // gegen Integerueberlaeufe
- BigInt aBigTemp(dx);
- aBigTemp*=yTemp;
- aBigTemp/=dy;
- xTemp=long(aBigTemp);
- } else {
- xTemp=dx*yTemp /dy;
- }
- xTemp+=aP1.X();
- bEdge=(xTemp==rHit.X());
- if (xTemp<rHit.X()) nCnt++;
- }
- }
- aPt0=rPoly[i];
- }
- if (bEdge) return 2;
- return (nCnt & 1)==1;
-}
-
-bool IsPointInsidePoly(const Polygon& rPoly, const Point& rHit)
-{
- return CheckPointTouchesPoly(rPoly,rHit)!=0;
-}
-
-bool IsPointInsidePoly(const PolyPolygon& rPoly, const Point& rHit)
-{
- FASTBOOL bInside=FALSE;
- FASTBOOL bEdge=FALSE;
- USHORT nAnz=rPoly.Count();
- for (USHORT i=0; i<nAnz && !bEdge; i++) {
- BYTE n=CheckPointTouchesPoly(rPoly.GetObject(i),rHit);
- bEdge=n==2;
- if (n==1) bInside=!bInside;
- }
- return bInside || bEdge;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-
diff --git a/svx/source/svdraw/svdtxhdl.cxx b/svx/source/svdraw/svdtxhdl.cxx
deleted file mode 100644
index e78b85ff10d0..000000000000
--- a/svx/source/svdraw/svdtxhdl.cxx
+++ /dev/null
@@ -1,400 +0,0 @@
-/*************************************************************************
- *
- * 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: svdtxhdl.cxx,v $
- * $Revision: 1.29 $
- *
- * 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_svx.hxx"
-
-#include "svdtxhdl.hxx"
-#include <limits.h>
-#include "svditext.hxx"
-#include <svx/svdmodel.hxx>
-#include <svx/svdpage.hxx>
-#include <svx/svdogrp.hxx>
-#include <svx/svdotext.hxx>
-#include <svx/svdoutl.hxx>
-#include <svx/outliner.hxx>
-#include <svx/outlobj.hxx>
-#include <svx/svxfont.hxx>
-#include <svx/xlnclit.hxx>
-#include <svx/xlnwtit.hxx>
-#include <svx/xflclit.hxx>
-#include <vcl/metric.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
-#include <com/sun/star/i18n/ScriptType.hdl>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
-#include <comphelper/processfactory.hxx>
-
-#include <com/sun/star/i18n/CharacterIteratorMode.hdl>
-#include "unolingu.hxx"
-#include <basegfx/polygon/b2dpolygon.hxx>
-#include <basegfx/polygon/b2dpolygontools.hxx>
-#include <basegfx/matrix/b2dhommatrix.hxx>
-#include <svtools/itemset.hxx>
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::i18n;
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-ImpTextPortionHandler::ImpTextPortionHandler(SdrOutliner& rOutln, const SdrTextObj& rTxtObj):
- rOutliner(rOutln),
- rTextObj(rTxtObj)
-{
- SdrModel* pModel = rTextObj.GetModel();
- MapMode aMap=aVDev.GetMapMode();
-
- aMap.SetMapUnit(pModel->GetScaleUnit());
- aMap.SetScaleX(pModel->GetScaleFraction());
- aMap.SetScaleY(pModel->GetScaleFraction());
- aVDev.SetMapMode(aMap);
-}
-
-void ImpTextPortionHandler::ConvertToPathObj(SdrObjGroup& rGroup, FASTBOOL bPoly)
-{
- bToPoly=bPoly;
- pGroup=&rGroup;
-
- Rectangle aAnchorRect;
- Rectangle aTextRect;
- SdrFitToSizeType eFit=rTextObj.GetFitToSize();
- FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
- // Bei TakeTextRect wird u.a. auch der Text in
- // den Outliner gesteckt
- rTextObj.TakeTextRect(rOutliner,aTextRect,FALSE,&aAnchorRect);
- maTextRect=aTextRect;
- if (bFitToSize) maTextRect=aAnchorRect;
- rOutliner.SetDrawPortionHdl(LINK(this,ImpTextPortionHandler,ConvertHdl));
- rOutliner.StripPortions();
- rOutliner.SetDrawPortionHdl(Link());
- rOutliner.Clear();
-
- if(bFitToSize)
- {
- Fraction nX(aAnchorRect.Right()-aAnchorRect.Left(),aTextRect.Right()-aTextRect.Left());
- Fraction nY(aAnchorRect.Bottom()-aAnchorRect.Top(),aTextRect.Bottom()-aTextRect.Top());
-
- // #95395# scale from top-right when vertical text
- if(rOutliner.IsVertical())
- pGroup->NbcResize(aAnchorRect.TopRight(),nX,nY);
- else
- pGroup->NbcResize(aAnchorRect.TopLeft(),nX,nY);
- }
- if (rTextObj.aGeo.nDrehWink!=0) { // #35825# Rotieren erst nach Resize (wg. FitToSize)
- pGroup->NbcRotate(maTextRect.TopLeft(),rTextObj.aGeo.nDrehWink,rTextObj.aGeo.nSin,rTextObj.aGeo.nCos);
- }
-}
-
-// #101498# Helper class to remember text portions in sorted manner
-class ImpRecordPortion
-{
-public:
- Point maPosition;
- String maText;
- xub_StrLen mnTextStart;
- xub_StrLen mnTextLength;
- sal_uInt16 mnPara;
- xub_StrLen mnIndex;
-
- // #102819# Here SvxFont needs to be used instead of Font
- SvxFont maFont;
-
- sal_Int32* mpDXArray;
- sal_uInt8 mnBiDiLevel;
-
- ImpRecordPortion(DrawPortionInfo* pInfo);
- ~ImpRecordPortion();
-
- sal_uInt8 GetBiDiLevel() const { return mnBiDiLevel; }
-};
-
-ImpRecordPortion::ImpRecordPortion(DrawPortionInfo* pInfo)
-: maPosition(pInfo->mrStartPos),
- maText(pInfo->mrText),
- mnTextStart((xub_StrLen)pInfo->mnTextStart),
- mnTextLength((xub_StrLen)pInfo->mnTextLen),
- mnPara(pInfo->mnPara),
- mnIndex(pInfo->mnIndex),
- maFont(pInfo->mrFont),
- mpDXArray(NULL),
- mnBiDiLevel(pInfo->GetBiDiLevel())
-{
- if(pInfo->mpDXArray)
- {
- mpDXArray = new sal_Int32[pInfo->mnTextLen];
-
- for(sal_uInt32 a(0L); a < pInfo->mnTextLen; a++)
- {
- mpDXArray[a] = pInfo->mpDXArray[a];
- }
- }
-}
-
-ImpRecordPortion::~ImpRecordPortion()
-{
- if(mpDXArray)
- {
- delete[] mpDXArray;
- }
-}
-
-IMPL_LINK(ImpTextPortionHandler,ConvertHdl,DrawPortionInfo*,pInfo)
-{
- // maTextRect enthaelt den Ausgabebereich des Textobjekts
- BOOL bIsVertical(rOutliner.IsVertical());
- Point aPos2(maTextRect.TopLeft() + pInfo->mrStartPos);
- Color aColor(pInfo->mrFont.GetColor());
-
- if(bIsVertical)
- aPos2 = maTextRect.TopRight() + pInfo->mrStartPos;
-
- Point aStartPos(aPos2);
- SfxItemSet aAttrSet((SfxItemPool&)(*rTextObj.GetObjectItemPool()));
- long nHochTief(pInfo->mrFont.GetEscapement());
- FontMetric aFontMetric(aVDev.GetFontMetric());
- sal_Int32 nLineLen(0L);
-
- Font aFont( pInfo->mrFont );
-
- if( nHochTief)
- {
- // shrink the font for sub-/superscripting
- long nPercent(pInfo->mrFont.GetPropr());
-
- if(nPercent != 100)
- {
- Size aSize(aFont.GetSize());
- aSize.Height() = (aSize.Height() * nPercent +50) / 100;
- aSize.Width() = (aSize.Width() * nPercent +50) / 100;
- aFont.SetSize(aSize);
- }
-
- sal_Bool bNeg(nHochTief < 0);
-
- if(bNeg)
- nHochTief = -nHochTief;
-
- nHochTief = (nHochTief * pInfo->mrFont.GetSize().Height() +50) /100;
-
- if(bNeg)
- nHochTief = -nHochTief;
- }
-
- aFont.SetOrientation( 0 );
- aVDev.SetFont( aFont );
-
- if(bIsVertical)
- // #83068#
- aPos2.X() += aFontMetric.GetAscent() + nHochTief;
- else
- aPos2.Y() -= aFontMetric.GetAscent() + nHochTief;
-
- if (pInfo->mrFont.IsOutline())
- {
- aAttrSet.Put(XLineColorItem(String(),aColor));
- aAttrSet.Put(XLineStyleItem(XLINE_SOLID));
- aAttrSet.Put(XLineWidthItem(0));
- aAttrSet.Put(XFillStyleItem(XFILL_NONE));
- }
- else
- {
- aAttrSet.Put(XFillColorItem(String(),aColor));
- aAttrSet.Put(XLineStyleItem(XLINE_NONE));
- aAttrSet.Put(XFillStyleItem(XFILL_SOLID));
- }
-
- // #100318# convert in a single step
- // #101499# Use GetTextOutlines and a PolyPolyVector now
- PolyPolyVector aPolyPolyVector;
- if(aVDev.GetTextOutlines(aPolyPolyVector, pInfo->mrText, pInfo->mnTextStart, pInfo->mnTextStart, pInfo->mnTextLen)
- && aPolyPolyVector.size())
- {
- for(sal_uInt32 a(0); a < aPolyPolyVector.size(); a++)
- {
- PolyPolygon aPolyPoly(aPolyPolyVector[a]);
-
- if(aPolyPoly.Count() > 0 && aPolyPoly[0].GetSize() > 0)
- {
- basegfx::B2DPolyPolygon aPolyPolygon(aPolyPoly.getB2DPolyPolygon());
- basegfx::B2DHomMatrix aMatrix;
-
- // rotate 270 degree if vertical since result is unrotated
- if(pInfo->mrFont.GetOrientation())
- {
- double fAngle(F_PI * (pInfo->mrFont.GetOrientation() % 3600) / 1800.0);
- aMatrix.rotate(fAngle);
- }
-
- // result is baseline oriented, thus move one line height, too
- if(bIsVertical)
- {
- aMatrix.translate(-aFontMetric.GetAscent(), 0.0);
- }
- else
- {
- aMatrix.translate(0.0, aFontMetric.GetAscent());
- }
-
- // move to output coordinates
- aMatrix.translate(aPos2.X(), aPos2.Y());
-
- // transform
- aPolyPolygon.transform(aMatrix);
-
- // create object
- SdrObject* pObj = rTextObj.ImpConvertMakeObj(aPolyPolygon, sal_True, !bToPoly, sal_True);
- pObj->SetMergedItemSet(aAttrSet);
- pGroup->GetSubList()->InsertObject(pObj);
- }
- }
-
- nLineLen = pInfo->mpDXArray[pInfo->mnTextLen - 1];
- }
-
- FontUnderline eUndl=pInfo->mrFont.GetUnderline();
- FontStrikeout eStrk=pInfo->mrFont.GetStrikeout();
- if (eUndl!=UNDERLINE_NONE) {
- FASTBOOL bDouble=eUndl==UNDERLINE_DOUBLE;
- long nDescent=aFontMetric.GetDescent();
- long nAscend=aFontMetric.GetAscent();
- long nDick=nDescent / (bDouble ? 5 : 3);
- long nDist=(nDescent-nDick*2)/3; // Linienabstand bei doppelt
- basegfx::B2DPolyPolygon aPolyPolygon;
-
- if (eUndl!=UNDERLINE_DOTTED) {
- Point aPoint(0,0);
- XPolygon aXP(Rectangle(aPoint,bIsVertical ? Point(nDick,nLineLen) : Point(nLineLen,nDick)));
- if(bIsVertical)
- aXP.Move(nAscend-nDist,0);
- aPolyPolygon.append(aXP.getB2DPolygon());
- if (bDouble) {
- if(bIsVertical)
- aXP.Move(-(nDick+nDist),0);
- else
- aXP.Move(0,nDick+nDist);
- aPolyPolygon.append(aXP.getB2DPolygon());
- }
- } else {
- Point aPoint(0,0);
- XPolygon aXP(Rectangle(aPoint,Point(nDick,nDick)));
- long n=0;
- while (n<=nLineLen) {
- if (n+nDick>nLineLen) { // ler letzte Dot ggf. etwas schmaler
- aXP=XPolygon(Rectangle(
- bIsVertical ? Point(0,n) : Point(n,0),
- bIsVertical ? Point(nDick,nLineLen) : Point(nLineLen,nDick)));
- }
- aPolyPolygon.append(aXP.getB2DPolygon());
- if(bIsVertical)
- aXP.Move(0,2*nDick);
- else
- aXP.Move(2*nDick,0);
- n+=2*nDick;
- }
- }
-
- long y=nDescent-nDick; // y-Position der Striche zur Baseline bestimmen
- if (bDouble) y-=nDick+nDist;
- y=(y+1)/2;
-
- basegfx::B2DHomMatrix aMatrix;
-
- if(bIsVertical)
- {
- aMatrix.translate(aStartPos.X() - (y - nHochTief), aStartPos.Y());
- }
- else
- {
- aMatrix.translate(aStartPos.X(), aStartPos.Y() + y - nHochTief);
- }
-
- aPolyPolygon.transform(aMatrix);
-
- // maTextRect enthaelt den Ausgabebereich des Textobjekts
- SdrObject* pObj=rTextObj.ImpConvertMakeObj(aPolyPolygon, sal_True, !bToPoly, sal_True);
- pObj->SetMergedItemSet(aAttrSet);
- pGroup->GetSubList()->InsertObject(pObj);
- }
- if (eStrk!=STRIKEOUT_NONE) {
- FASTBOOL bDouble=eStrk==STRIKEOUT_DOUBLE;
- long nDescent=aFontMetric.GetDescent();
- //long nAscend=aFontMetric.GetAscent();
- long nDick=nDescent / (bDouble ? 5 : 3);
- long nDist=(nDescent-nDick*2)/3; // Linienabstand bei doppelt
- basegfx::B2DPolyPolygon aPolyPolygon;
-
- const Point aPoint(0,0);
- const Rectangle aRect(aPoint,bIsVertical ? Point(nDick,nLineLen) : Point(nLineLen,nDick));
- const basegfx::B2DRange aRectRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom());
- basegfx::B2DPolygon aPolyFromRect(basegfx::tools::createPolygonFromRect(aRectRange));
- aPolyPolygon.append(aPolyFromRect);
-
- if (bDouble)
- {
- basegfx::B2DHomMatrix aMatrix;
-
- if(bIsVertical)
- aMatrix.translate(-(nDick+nDist), 0.0);
- else
- aMatrix.translate(0.0, nDick+nDist);
-
- aPolyFromRect.transform(aMatrix);
- aPolyPolygon.append(aPolyFromRect);
- }
-
- // y-Position der Striche zur Baseline bestimmen
- long y=-(long)(aFontMetric.GetAscent()-aFontMetric.GetIntLeading()+1)/3;
- if (!bDouble) y-=(nDick+1)/2;
- else y-=nDick+(nDist+1)/2;
-
- basegfx::B2DHomMatrix aMatrix;
-
- if(bIsVertical)
- {
- aMatrix.translate(aStartPos.X() - (y - nHochTief), aStartPos.Y());
- }
- else
- {
- aMatrix.translate(aStartPos.X(), aStartPos.Y() + y - nHochTief);
- }
-
- aPolyPolygon.transform(aMatrix);
-
- // maTextRect enthaelt den Ausgabebereich des Textobjekts
- SdrObject* pObj=rTextObj.ImpConvertMakeObj(aPolyPolygon, sal_True, !bToPoly, sal_True);
- pObj->SetMergedItemSet(aAttrSet);
- pGroup->GetSubList()->InsertObject(pObj);
- }
-
- return 0;
-}
-
-// eof
diff --git a/svx/source/svdraw/svdtxhdl.hxx b/svx/source/svdraw/svdtxhdl.hxx
deleted file mode 100644
index 82fd38519171..000000000000
--- a/svx/source/svdraw/svdtxhdl.hxx
+++ /dev/null
@@ -1,73 +0,0 @@
-/*************************************************************************
- *
- * 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: svdtxhdl.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 _SVDTXHDL_HXX
-#define _SVDTXHDL_HXX
-
-#include <vcl/virdev.hxx>
-#include <tools/poly.hxx>
-#include <tools/link.hxx>
-
-//************************************************************
-// Vorausdeklarationen
-//************************************************************
-
-class SdrOutliner;
-class DrawPortionInfo;
-class SdrTextObj;
-class SdrObjGroup;
-class SdrModel;
-
-//************************************************************
-// ImpTextPortionHandler
-//************************************************************
-
-class ImpTextPortionHandler
-{
- VirtualDevice aVDev;
- SdrOutliner& rOutliner;
- const SdrTextObj& rTextObj;
-
- // Variablen fuer ConvertToPathObj
- SdrObjGroup* pGroup;
- FASTBOOL bToPoly;
- Rectangle maTextRect;
-
-public:
- ImpTextPortionHandler(SdrOutliner& rOutln, const SdrTextObj& rTxtObj);
- void ConvertToPathObj(SdrObjGroup& rGroup, FASTBOOL bToPoly);
-
- DECL_LINK(ConvertHdl,DrawPortionInfo*);
-};
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#endif //_SVDTXHDL_HXX
-
diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx
index 84ddc594f97e..cd37fa21f9f5 100644
--- a/svx/source/svdraw/svdview.cxx
+++ b/svx/source/svdraw/svdview.cxx
@@ -55,13 +55,12 @@
#include "svx/svddrgmt.hxx"
#include "svx/svdoutl.hxx"
#include "svx/svdotable.hxx"
-
-// #90477#
#include <tools/tenccvt.hxx>
#include <svx/sdr/overlay/overlaypolypolygon.hxx>
#include <svx/sdr/overlay/overlaymanager.hxx>
#include <sdrpaintwindow.hxx>
#include <svx/sdrpagewindow.hxx>
+#include <svx/sdrhittesthelper.hxx>
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -489,7 +488,9 @@ SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) co
SdrTextObj* pTextObj=PTR_CAST(SdrTextObj,pHitObj);
if (pTextObj!=NULL && pTextObj->HasText())
{
- BOOL bTEHit=pTextObj->IsTextEditHit(aLocalLogicPosition,0/*nHitTolLog*/,&pPV->GetVisibleLayers());
+ bool bTEHit(pPV &&
+ SdrObjectPrimitiveHit(*pTextObj, aLocalLogicPosition, 0, *pPV, &pPV->GetVisibleLayers(), true));
+
if (bTEHit)
{
Rectangle aTextRect;
@@ -566,11 +567,15 @@ SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) co
if(!bBoundRectHit)
{
- BOOL bTEHit=pHitObj->IsTextEditHit(aLocalLogicPosition,0,&pPV->GetVisibleLayers());
+ bool bTEHit(pPV &&
+ SdrObjectPrimitiveHit(*pHitObj, aLocalLogicPosition, 0, *pPV, &pPV->GetVisibleLayers(), true));
// TextEdit an Objekten im gesperrten Layer
if (pPV->GetLockedLayers().IsSet(pHitObj->GetLayer()))
+ {
bTEHit=FALSE;
+ }
+
if (bTEHit)
{
rVEvt.pRootObj=pObj;
diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx
index 9a6958b34c4d..23f3981228e1 100644
--- a/svx/source/svdraw/svdxcgv.cxx
+++ b/svx/source/svdraw/svdxcgv.cxx
@@ -554,7 +554,17 @@ Bitmap SdrExchangeView::GetMarkedObjBitmap( BOOL bNoVDevIfOneBmpMarked ) const
if( !aBmp )
{
const Graphic aGraphic( GetMarkedObjMetaFile( bNoVDevIfOneBmpMarked ) );
- aBmp = aGraphic.GetBitmap();
+
+ // #i102089# support user's settings of AA and LineSnap when the MetaFile gets
+ // rasterconverted to a bitmap
+ const SvtOptionsDrawinglayer aDrawinglayerOpt;
+ const GraphicConversionParameters aParameters(
+ Size(),
+ false,
+ aDrawinglayerOpt.IsAntiAliasing(),
+ aDrawinglayerOpt.IsSnapHorVerLinesToDiscrete());
+
+ aBmp = aGraphic.GetBitmap(aParameters);
}
}
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
index 792176eecc01..4ac7b4754f8d 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -450,6 +450,11 @@ void Cell::cloneFrom( const CellRef& xCell )
msFormula = xCell->msFormula;
mfValue = xCell->mfValue;
mnError = xCell->mnError;
+
+ mbMerged = xCell->mbMerged;
+ mnRowSpan = xCell->mnRowSpan;
+ mnColSpan = xCell->mnColSpan;
+
}
notifyModified();
}
diff --git a/svx/source/table/cellcursor.cxx b/svx/source/table/cellcursor.cxx
index 4d7b6fa02e76..681546b9ebd9 100644
--- a/svx/source/table/cellcursor.cxx
+++ b/svx/source/table/cellcursor.cxx
@@ -201,6 +201,9 @@ bool CellCursor::GetMergedSelection( CellPos& rStart, CellPos& rEnd )
if( xCell->isMerged() )
{
findMergeOrigin( mxTable, mnRight, mnBottom, rEnd.mnCol, rEnd.mnRow );
+ // merge not possible if selection is only one cell and all its merges
+ if( rEnd == rStart )
+ return false;
xCell.set( dynamic_cast< Cell* >( mxTable->getCellByPosition( rEnd.mnCol, rEnd.mnRow ).get() ) );
}
}
@@ -271,7 +274,7 @@ void SAL_CALL CellCursor::merge( ) throw (NoSupportException, RuntimeException)
try
{
- merge( aStart.mnCol, aStart.mnRow, aEnd.mnCol - aStart.mnCol + 1, aEnd.mnRow - aStart.mnRow + 1 );
+ mxTable->merge( aStart.mnCol, aStart.mnRow, aEnd.mnCol - aStart.mnCol + 1, aEnd.mnRow - aStart.mnRow + 1 );
mxTable->optimize();
mxTable->setModified(sal_True);
}
@@ -286,40 +289,6 @@ void SAL_CALL CellCursor::merge( ) throw (NoSupportException, RuntimeException)
// -----------------------------------------------------------------------------
-void CellCursor::merge( sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nColSpan, sal_Int32 nRowSpan )
-{
- // merge first cell
- CellRef xOriginCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
- if( xOriginCell.is() )
- {
- xOriginCell->AddUndo();
- xOriginCell->merge( nColSpan, nRowSpan );
- }
-
- const sal_Int32 nLastRow = nRow + nRowSpan;
- const sal_Int32 nLastCol = nCol + nColSpan;
-
- sal_Int32 nTempCol = nCol + 1;
-
- // merge remaining cells
- for( ; nRow < nLastRow; nRow++ )
- {
- for( ; nTempCol < nLastCol; nTempCol++ )
- {
- CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nTempCol, nRow ).get() ) );
- if( xCell.is() && !xCell->isMerged() )
- {
- xCell->AddUndo();
- xCell->setMerged();
- xOriginCell->mergeContent( xCell );
- }
- }
- nTempCol = nCol;
- }
-}
-
-// -----------------------------------------------------------------------------
-
void CellCursor::split_column( sal_Int32 nCol, sal_Int32 nColumns, std::vector< sal_Int32 >& rLeftOvers )
{
const sal_Int32 nRowCount = mxTable->getRowCount();
@@ -362,8 +331,13 @@ void CellCursor::split_column( sal_Int32 nCol, sal_Int32 nColumns, std::vector<
CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
if( !xCell.is() || xCell->isMerged() )
{
- // merged cells are ignored, but newly added columns will be added to leftovers
- rLeftOvers[nRow] += nNewCols;
+ if( nNewCols > 0 )
+ {
+ // merged cells are ignored, but newly added columns will be added to leftovers
+ xCell.set( dynamic_cast< Cell* >(mxTable->getCellByPosition( nCol+1, nRow ).get() ) );
+ if( !xCell.is() || !xCell->isMerged() )
+ rLeftOvers[nRow] += nNewCols;
+ }
}
else
{
@@ -388,12 +362,9 @@ void CellCursor::split_column( sal_Int32 nCol, sal_Int32 nColumns, std::vector<
if( nSplits == 0 )
nSplitSpan = nCellsAvailable - ((nSplitSpan+1) * nColumns) - 1;
- xCell->merge( nSplitSpan + 1, nRowSpan + 1);
+ mxTable->merge( nSplitCol, nRow, nSplitSpan + 1, nRowSpan + 1);
if( nSplits > 0 )
- {
nSplitCol += nSplitSpan + 1;
- xCell.set( dynamic_cast< Cell* >( mxTable->getCellByPosition( nSplitCol, nRow ).get() ) );
- }
}
do
@@ -407,7 +378,7 @@ void CellCursor::split_column( sal_Int32 nCol, sal_Int32 nColumns, std::vector<
{
// cope with outside cells, merge if needed
if( nColSpan < (rLeftOvers[nRow] + nNewCols) )
- merge( nCol, nRow, (rLeftOvers[nRow] + nNewCols) + 1, nRowSpan + 1 );
+ mxTable->merge( nCol, nRow, (rLeftOvers[nRow] + nNewCols) + 1, nRowSpan + 1 );
do
{
@@ -476,8 +447,13 @@ void CellCursor::split_row( sal_Int32 nRow, sal_Int32 nRows, std::vector< sal_In
CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
if( !xCell.is() || xCell->isMerged() )
{
- // merged cells are ignored, but newly added columns will be added to leftovers
- rLeftOvers[nCol] += nNewRows;
+ if( nNewRows )
+ {
+ // merged cells are ignored, but newly added columns will be added to leftovers
+ xCell.set( dynamic_cast< Cell* >(mxTable->getCellByPosition( nCol, nRow+1 ).get() ) );
+ if( !xCell.is() || !xCell->isMerged() )
+ rLeftOvers[nCol] += nNewRows;
+ }
}
else
{
@@ -502,12 +478,9 @@ void CellCursor::split_row( sal_Int32 nRow, sal_Int32 nRows, std::vector< sal_In
if( nSplits == 0 )
nSplitSpan = nCellsAvailable - ((nSplitSpan+1) * nRows) - 1;
- xCell->merge( nColSpan + 1, nSplitSpan + 1 );
+ mxTable->merge( nCol, nSplitRow, nColSpan + 1, nSplitSpan + 1 );
if( nSplits > 0 )
- {
nSplitRow += nSplitSpan + 1;
- xCell.set( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nSplitRow ).get() ) );
- }
}
do
@@ -521,7 +494,7 @@ void CellCursor::split_row( sal_Int32 nRow, sal_Int32 nRows, std::vector< sal_In
{
// cope with outside cells, merge if needed
if( nRowSpan < (rLeftOvers[nCol] + nNewRows) )
- merge( nCol, nRow, nColSpan + 1, (rLeftOvers[nCol] + nNewRows) + 1 );
+ mxTable->merge( nCol, nRow, nColSpan + 1, (rLeftOvers[nCol] + nNewRows) + 1 );
do
{
diff --git a/svx/source/table/cellcursor.hxx b/svx/source/table/cellcursor.hxx
index f4f242f39c0e..c23dbf12b210 100644
--- a/svx/source/table/cellcursor.hxx
+++ b/svx/source/table/cellcursor.hxx
@@ -75,8 +75,6 @@ public:
protected:
bool GetMergedSelection( CellPos& rStart, CellPos& rEnd );
- void merge( sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nColSpan, sal_Int32 nRowSpan );
-
void split_column( sal_Int32 nCol, sal_Int32 nColumns, std::vector< sal_Int32 >& rLeftOvers );
void split_horizontal( sal_Int32 nColumns );
void split_row( sal_Int32 nRow, sal_Int32 nRows, std::vector< sal_Int32 >& rLeftOvers );
diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
index c42feb83c742..44caaee6c148 100644
--- a/svx/source/table/svdotable.cxx
+++ b/svx/source/table/svdotable.cxx
@@ -1930,21 +1930,6 @@ void lcl_VertLine( OutputDevice& rDev, const Point& rTop, const Point& rBottom,
// --------------------------------------------------------------------
-SdrObject* SdrTableObj::CheckHit(const Point& rPnt, USHORT /*nTol*/, const SetOfByte* pVisiLayer) const
-{
- if(pVisiLayer && !pVisiLayer->IsSet(sal::static_int_cast< sal_uInt8 >(GetLayer())))
- {
- return NULL;
- }
-
- if( (rPnt.X() >= aOutRect.Left()) && (rPnt.X() <= aOutRect.Right()) && (rPnt.Y() >= aOutRect.Top()) && rPnt.Y() <= aOutRect.Bottom() )
- return const_cast<SdrObject*>(static_cast<const SdrObject*>(this));
-
- return NULL;
-}
-
-// --------------------------------------------------------------------
-
void SdrTableObj::TakeObjNameSingul(XubString& rName) const
{
rName = ImpGetResStr(STR_ObjNameSingulTable);
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index 55125b14eff4..c99c2b3c2262 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -493,7 +493,7 @@ void SvxTableController::GetState( SfxItemSet& rSet )
// --------------------------------------------------------------------
-void SvxTableController::onInsert( sal_uInt16 nSId )
+void SvxTableController::onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs )
{
::sdr::table::SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( mxTableObj.get() );
if( !pTableObj )
@@ -501,6 +501,21 @@ void SvxTableController::onInsert( sal_uInt16 nSId )
if( mxTable.is() ) try
{
+ //
+ bool bInsertAfter = true;
+ sal_uInt16 nCount = 0;
+ if( pArgs )
+ {
+ const SfxPoolItem* pItem = 0;
+ pArgs->GetItemState(nSId, FALSE, &pItem);
+ if (pItem)
+ {
+ nCount = ((const SfxInt16Item* )pItem)->GetValue();
+ if(SFX_ITEM_SET == pArgs->GetItemState(SID_TABLE_PARAM_INSERT_AFTER, TRUE, &pItem))
+ bInsertAfter = ((const SfxBoolItem* )pItem)->GetValue();
+ }
+ }
+
CellPos aStart, aEnd;
if( hasSelectedCells() )
{
@@ -508,9 +523,12 @@ void SvxTableController::onInsert( sal_uInt16 nSId )
}
else
{
- aStart.mnCol = mxTable->getColumnCount() - 1;
- aStart.mnRow = mxTable->getRowCount() - 1;
- aEnd = aStart;
+ if( bInsertAfter )
+ {
+ aStart.mnCol = mxTable->getColumnCount() - 1;
+ aStart.mnRow = mxTable->getRowCount() - 1;
+ aEnd = aStart;
+ }
}
if( pTableObj->IsTextEditActive() )
@@ -535,8 +553,9 @@ void SvxTableController::onInsert( sal_uInt16 nSId )
}
Reference< XTableColumns > xCols( mxTable->getColumns() );
- const sal_Int32 nNewColumns = aEnd.mnCol - aStart.mnCol + 1;
- xCols->insertByIndex( aEnd.mnCol + 1, nNewColumns );
+ const sal_Int32 nNewColumns = (nCount == 0) ? (aEnd.mnCol - aStart.mnCol + 1) : nCount;
+ const sal_Int32 nNewStartColumn = aEnd.mnCol + (bInsertAfter ? 1 : 0);
+ xCols->insertByIndex( nNewStartColumn, nNewColumns );
for( sal_Int32 nOffset = 0; nOffset < nNewColumns; nOffset++ )
{
@@ -552,7 +571,7 @@ void SvxTableController::onInsert( sal_uInt16 nSId )
if( mpModel )
mpModel->SetChanged();
- aStart.mnCol = aEnd.mnCol+1;
+ aStart.mnCol = nNewStartColumn;
aStart.mnRow = 0;
aEnd.mnCol = aStart.mnCol + nNewColumns - 1;
aEnd.mnRow = mxTable->getRowCount() - 1;
@@ -570,8 +589,9 @@ void SvxTableController::onInsert( sal_uInt16 nSId )
}
Reference< XTableRows > xRows( mxTable->getRows() );
- const sal_Int32 nNewRows = aEnd.mnRow - aStart.mnRow + 1;
- xRows->insertByIndex( aEnd.mnRow + 1, nNewRows );
+ const sal_Int32 nNewRows = (nCount == 0) ? (aEnd.mnRow - aStart.mnRow + 1) : nCount;
+ const sal_Int32 nNewRowStart = aEnd.mnRow + (bInsertAfter ? 1 : 0);
+ xRows->insertByIndex( nNewRowStart, nNewRows );
for( sal_Int32 nOffset = 0; nOffset < nNewRows; nOffset++ )
{
@@ -582,13 +602,16 @@ void SvxTableController::onInsert( sal_uInt16 nSId )
}
if( bUndo )
+ {
mpModel->EndUndo();
+ mpModel->SetChanged();
+ }
if( mpModel )
mpModel->SetChanged();
aStart.mnCol = 0;
- aStart.mnRow = aEnd.mnRow+1;
+ aStart.mnRow = nNewRowStart;
aEnd.mnCol = mxTable->getColumnCount() - 1;
aEnd.mnRow = aStart.mnRow + nNewRows - 1;
break;
@@ -756,7 +779,7 @@ void SvxTableController::Execute( SfxRequest& rReq )
{
case SID_TABLE_INSERT_ROW:
case SID_TABLE_INSERT_COL:
- onInsert( nSId );
+ onInsert( nSId, rReq.GetArgs() );
break;
case SID_TABLE_DELETE_ROW:
case SID_TABLE_DELETE_COL:
@@ -987,6 +1010,9 @@ void SvxTableController::MergeMarkedCells()
SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( mxTableObj.get() );
if( pTableObj )
{
+ if( pTableObj->IsTextEditActive() )
+ mpView->SdrEndTextEdit(sal_True);
+
TableModelNotifyGuard aGuard( mxTable.get() );
MergeRange( aStart.mnCol, aStart.mnRow, aEnd.mnCol, aEnd.mnRow );
}
@@ -1018,6 +1044,9 @@ void SvxTableController::SplitMarkedCells()
SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >( mxTableObj.get() );
if( pTableObj )
{
+ if( pTableObj->IsTextEditActive() )
+ mpView->SdrEndTextEdit(sal_True);
+
TableModelNotifyGuard aGuard( mxTable.get() );
const bool bUndo = mpModel && mpModel->IsUndoEnabled();
@@ -1476,7 +1505,16 @@ bool SvxTableController::executeAction( sal_uInt16 nAction, bool bSelect, Window
if( bSelect )
gotoCell( pTableObj->getPreviousCell( getSelectionEnd(), true ), false, pWindow, nAction );
else
- gotoCell( pTableObj->getNextCell( getSelectionEnd(), true ), false, pWindow, nAction );
+ {
+ CellPos aSelectionEnd( getSelectionEnd() );
+ CellPos aNextCell( pTableObj->getNextCell( aSelectionEnd, true ) );
+ if( aSelectionEnd == aNextCell )
+ {
+ onInsert( SID_TABLE_INSERT_ROW, 0 );
+ aNextCell = pTableObj->getNextCell( aSelectionEnd, true );
+ }
+ gotoCell( aNextCell, false, pWindow, nAction );
+ }
break;
}
}
@@ -1934,7 +1972,6 @@ void SvxTableController::updateSelectionOverlay()
if( pOverlayManager )
{
// sdr::overlay::CellOverlayType eType = sdr::overlay::CELL_OVERLAY_INVERT;
- // sdr::overlay::CellOverlayType eType = sdr::overlay::CELL_OVERLAY_HATCH;
sdr::overlay::CellOverlayType eType = sdr::overlay::CELL_OVERLAY_TRANSPARENT;
sdr::overlay::OverlayObjectCell* pOverlay = new sdr::overlay::OverlayObjectCell( eType, aHighlight, aRanges );
@@ -1974,7 +2011,7 @@ void SvxTableController::MergeAttrFromSelectedCells(SfxItemSet& rAttr, bool bOnl
for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ )
{
CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
- if( xCell.is() )
+ if( xCell.is() && !xCell->isMerged() )
{
const SfxItemSet& rSet = xCell->GetItemSet();
SfxWhichIter aIter(rSet);
diff --git a/svx/source/table/tablecontroller.hxx b/svx/source/table/tablecontroller.hxx
index 4caf7cd957a1..826b72b16908 100644
--- a/svx/source/table/tablecontroller.hxx
+++ b/svx/source/table/tablecontroller.hxx
@@ -43,6 +43,7 @@
class SdrObjEditView;
class SdrObject;
+class SfxItemSet;
namespace sdr { namespace table {
@@ -72,7 +73,7 @@ public:
virtual bool SetStyleSheet( SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr );
// slots
- void onInsert( sal_uInt16 nSId );
+ void onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs = 0 );
void onDelete( sal_uInt16 nSId );
void onSelect( sal_uInt16 nSId );
void onFormatTable( SfxRequest& rReq );
diff --git a/svx/source/table/tablehandles.cxx b/svx/source/table/tablehandles.cxx
index 6b88e1d9a0ac..72e10e29c336 100644
--- a/svx/source/table/tablehandles.cxx
+++ b/svx/source/table/tablehandles.cxx
@@ -38,60 +38,36 @@
#include <vcl/salbtype.hxx>
#include <vcl/canvastools.hxx>
#include <vcl/hatch.hxx>
-
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/range/b2drectangle.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
-
#include <svx/sdr/overlay/overlayobject.hxx>
#include <svx/sdr/overlay/overlaymanager.hxx>
#include <svx/sdrpagewindow.hxx>
#include <sdrpaintwindow.hxx>
#include <svx/svdmrkv.hxx>
#include <svx/svdpagv.hxx>
-
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <svx/sdr/overlay/overlayhatchrect.hxx>
+#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
namespace sdr { namespace table {
-class OverlayTableEdge : public sdr::overlay::OverlayObject
-{
-protected:
- basegfx::B2DPolyPolygon maPolyPolygon;
-
- // Draw geometry
- virtual void drawGeometry(OutputDevice& rOutputDevice);
-
- // Create the BaseRange. This method needs to calculate maBaseRange.
- virtual void createBaseRange(OutputDevice& rOutputDevice);
-
- virtual void transform(const basegfx::B2DHomMatrix& rMatrix);
-
-public:
- OverlayTableEdge( const basegfx::B2DPolyPolygon& rPolyPolygon );
- virtual ~OverlayTableEdge();
-};
-
// --------------------------------------------------------------------
-class OverlayTableBorder : public sdr::overlay::OverlayObject
+class OverlayTableEdge : public sdr::overlay::OverlayObject
{
protected:
basegfx::B2DPolyPolygon maPolyPolygon;
+ bool mbVisible;
- // Draw geometry
- virtual void drawGeometry(OutputDevice& rOutputDevice);
-
- // Create the BaseRange. This method needs to calculate maBaseRange.
- virtual void createBaseRange(OutputDevice& rOutputDevice);
-
- virtual void transform(const basegfx::B2DHomMatrix& rMatrix);
-
- virtual sal_Bool isHit(const basegfx::B2DPoint& rPos, double fTol = 0.0) const;
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
public:
- OverlayTableBorder( const basegfx::B2DPolyPolygon& rPolyPolygon );
- virtual ~OverlayTableBorder();
+ OverlayTableEdge( const basegfx::B2DPolyPolygon& rPolyPolygon, bool bVisible );
+ virtual ~OverlayTableEdge();
};
// --------------------------------------------------------------------
@@ -134,40 +110,23 @@ sal_Int32 TableEdgeHdl::GetValidDragOffset( const SdrDragStat& rDrag ) const
basegfx::B2DPolyPolygon TableEdgeHdl::getSpecialDragPoly(const SdrDragStat& rDrag) const
{
- return GetPolyPolygon(false, &rDrag);
-}
+ basegfx::B2DPolyPolygon aVisible;
+ basegfx::B2DPolyPolygon aInvisible;
-bool TableEdgeHdl::IsHdlHit(const Point& rPnt) const
-{
- if( GetPointNum() != 0 )
- {
- double fTol = 0.0;
- if( pHdlList )
- {
- SdrMarkView* pView = pHdlList->GetView();
- if( pView )
- {
- OutputDevice* pOutDev = pView->GetFirstOutputDevice();
- if( pOutDev )
- {
- fTol = static_cast<double>(pOutDev->PixelToLogic(Size(3, 3)).Width());
- }
- }
- }
+ // create and return visible and non-visible parts for drag
+ getPolyPolygon(aVisible, aInvisible, &rDrag);
+ aVisible.append(aInvisible);
- basegfx::B2DPoint aPosition(rPnt.X(), rPnt.Y());
- if( basegfx::tools::isInEpsilonRange( maVisiblePolygon, aPosition, fTol ) )
- return sal_True;
- }
- return false;
+ return aVisible;
}
-
-basegfx::B2DPolyPolygon TableEdgeHdl::GetPolyPolygon( bool bOnlyVisible, const SdrDragStat* pDrag /*= 0*/ ) const
+void TableEdgeHdl::getPolyPolygon(basegfx::B2DPolyPolygon& rVisible, basegfx::B2DPolyPolygon& rInvisible, const SdrDragStat* pDrag) const
{
- basegfx::B2DPolyPolygon aRetValue;
-
+ // changed method to create visible and invisible partial polygons in one run in
+ // separate PolyPolygons; both kinds are used
basegfx::B2DPoint aOffset(aPos.X(), aPos.Y());
+ rVisible.clear();
+ rInvisible.clear();
if( pDrag )
{
@@ -176,37 +135,35 @@ basegfx::B2DPolyPolygon TableEdgeHdl::GetPolyPolygon( bool bOnlyVisible, const S
}
basegfx::B2DPoint aStart(aOffset), aEnd(aOffset);
-
int nPos = mbHorizontal ? 0 : 1;
-
- // base line hit, check for edges
TableEdgeVector::const_iterator aIter( maEdges.begin() );
+
while( aIter != maEdges.end() )
{
TableEdge aEdge(*aIter++);
- if( aEdge.meState == Visible || ( aEdge.meState == Invisible && !bOnlyVisible ) )
- {
- aStart[nPos] = aOffset[nPos] + aEdge.mnStart;
- aEnd[nPos] = aOffset[nPos] + aEdge.mnEnd;
+ aStart[nPos] = aOffset[nPos] + aEdge.mnStart;
+ aEnd[nPos] = aOffset[nPos] + aEdge.mnEnd;
- basegfx::B2DPolygon aPolygon;
- aPolygon.append( aStart );
- aPolygon.append( aEnd );
+ basegfx::B2DPolygon aPolygon;
+ aPolygon.append( aStart );
+ aPolygon.append( aEnd );
- aRetValue.append( aPolygon );
+ if(aEdge.meState == Visible)
+ {
+ rVisible.append(aPolygon);
+ }
+ else
+ {
+ rInvisible.append(aPolygon);
}
}
-
- return aRetValue;
}
void TableEdgeHdl::CreateB2dIAObject()
{
GetRidOfIAObject();
- maVisiblePolygon = GetPolyPolygon(false);
-
if(pHdlList && pHdlList->GetView() && !pHdlList->GetView()->areMarkHandlesHidden())
{
SdrMarkView* pView = pHdlList->GetView();
@@ -214,20 +171,40 @@ void TableEdgeHdl::CreateB2dIAObject()
if(pPageView)
{
- for(sal_uInt32 nWindow = 0; nWindow < pPageView->PageWindowCount(); nWindow++)
- {
- // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b];
- const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(nWindow);
+ basegfx::B2DPolyPolygon aVisible;
+ basegfx::B2DPolyPolygon aInvisible;
- if(rPageWindow.GetPaintWindow().OutputToWindow())
+ // get visible and invisible parts
+ getPolyPolygon(aVisible, aInvisible, 0);
+
+ if(aVisible.count() || aInvisible.count())
+ {
+ for(sal_uInt32 nWindow = 0; nWindow < pPageView->PageWindowCount(); nWindow++)
{
- if(rPageWindow.GetOverlayManager())
- {
- ::sdr::overlay::OverlayObject* pOverlayObject =
- new OverlayTableEdge( GetPolyPolygon(true) );
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(nWindow);
- rPageWindow.GetOverlayManager()->add(*pOverlayObject);
- maOverlayGroup.append(*pOverlayObject);
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
+ {
+ if(rPageWindow.GetOverlayManager())
+ {
+ if(aVisible.count())
+ {
+ // create overlay object for visible parts
+ sdr::overlay::OverlayObject* pOverlayObject = new OverlayTableEdge(aVisible, true);
+ rPageWindow.GetOverlayManager()->add(*pOverlayObject);
+ maOverlayGroup.append(*pOverlayObject);
+ }
+
+ if(aInvisible.count())
+ {
+ // also create overlay object vor invisible parts to allow
+ // a standard HitTest using the primitives from that overlay object
+ // (see OverlayTableEdge implementation)
+ sdr::overlay::OverlayObject* pOverlayObject = new OverlayTableEdge(aInvisible, false);
+ rPageWindow.GetOverlayManager()->add(*pOverlayObject);
+ maOverlayGroup.append(*pOverlayObject);
+ }
+ }
}
}
}
@@ -237,9 +214,10 @@ void TableEdgeHdl::CreateB2dIAObject()
//////////////////////////////////////////////////////////////////////////////
-OverlayTableEdge::OverlayTableEdge( const basegfx::B2DPolyPolygon& rPolyPolygon )
+OverlayTableEdge::OverlayTableEdge( const basegfx::B2DPolyPolygon& rPolyPolygon, bool bVisible )
: OverlayObject(Color(COL_GRAY))
, maPolyPolygon( rPolyPolygon )
+, mbVisible(bVisible)
{
}
@@ -247,47 +225,35 @@ OverlayTableEdge::~OverlayTableEdge()
{
}
-void OverlayTableEdge::drawGeometry(OutputDevice& rOutputDevice)
+drawinglayer::primitive2d::Primitive2DSequence OverlayTableEdge::createOverlayObjectPrimitive2DSequence()
{
- rOutputDevice.SetLineColor(getBaseColor());
- rOutputDevice.SetFillColor();
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
- for(sal_uInt32 a(0L); a < maPolyPolygon.count();a ++)
+ if(maPolyPolygon.count())
{
-/*
- const basegfx::B2DPolygon aPolygon = maPolyPolygon.getB2DPolygon(a);
- const basegfx::B2DPoint aStart(aPolygon.getB2DPoint(0L));
- const basegfx::B2DPoint aEnd(aPolygon.getB2DPoint(aPolygon.count() - 1L));
- const Point aStartPoint(FRound(aStart.getX()), FRound(aStart.getY()));
- const Point aEndPoint(FRound(aEnd.getX()), FRound(aEnd.getY()));
- rOutputDevice.DrawLine(aStartPoint, aEndPoint);
-*/
- PolyPolygon aPolyPolygon( maPolyPolygon );
- rOutputDevice.DrawTransparent( aPolyPolygon, 50 );
- }
-}
-
-void OverlayTableEdge::transform(const basegfx::B2DHomMatrix& rMatrix)
-{
- maPolyPolygon.transform( rMatrix );
-}
-
-void OverlayTableEdge::createBaseRange(OutputDevice& /*rOutputDevice*/)
-{
- // reset range and expand it
- maBaseRange.reset();
-
- if(isHittable())
- {
- for(sal_uInt32 a(0L); a < maPolyPolygon.count();a ++)
+ // Discussed with CL. Currently i will leave the transparence out since this
+ // a little bit expensive. We may check the look with drag polygons later
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new drawinglayer::primitive2d::PolyPolygonHairlinePrimitive2D(
+ maPolyPolygon,
+ getBaseColor().getBColor()));
+
+ if(mbVisible)
+ {
+ // visible, just return as sequence
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
+ }
+ else
{
- const basegfx::B2DPolygon aPolygon = maPolyPolygon.getB2DPolygon(a);
- const basegfx::B2DPoint aStart(aPolygon.getB2DPoint(0L));
- const basegfx::B2DPoint aEnd(aPolygon.getB2DPoint(aPolygon.count() - 1L));
- maBaseRange.expand(aStart);
- maBaseRange.expand(aEnd);
+ // embed in HitTest primitive to support HitTest of this overlay object
+ const drawinglayer::primitive2d::Primitive2DSequence aSequence(&aReference, 1);
+ const drawinglayer::primitive2d::Primitive2DReference aNewReference(
+ new drawinglayer::primitive2d::HitTestPrimitive2D(aSequence));
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aNewReference, 1);
}
}
+
+ return aRetval;
}
// ====================================================================
@@ -325,16 +291,15 @@ void TableBorderHdl::CreateB2dIAObject()
{
if(rPageWindow.GetOverlayManager())
{
- OutputDevice& rOutDev = rPageWindow.GetPaintWindow().GetOutputDevice();
-
- Size aBorderSize( rOutDev.PixelToLogic( Size( 6, 6 ) ) );
- basegfx::B2DRectangle aRect( vcl::unotools::b2DRectangleFromRectangle( maRectangle ) );
- basegfx::B2DPolyPolygon aPolyPolygon;
- aPolyPolygon.append(basegfx::tools::createPolygonFromRect( aRect ) );
- aRect.grow( aBorderSize.nA );
- aPolyPolygon.append(basegfx::tools::createPolygonFromRect( aRect ) );
-
- ::sdr::overlay::OverlayObject* pOverlayObject = new OverlayTableBorder( aPolyPolygon );
+ const basegfx::B2DRange aRange(vcl::unotools::b2DRectangleFromRectangle(maRectangle));
+ sdr::overlay::OverlayObject* pOverlayObject = new sdr::overlay::OverlayHatchRect(
+ aRange.getMinimum(),
+ aRange.getMaximum(),
+ Color(0x80, 0x80, 0x80),
+ 6.0,
+ 0.0,
+ 45 * F_PI180,
+ 0.0);
rPageWindow.GetOverlayManager()->add(*pOverlayObject);
maOverlayGroup.append(*pOverlayObject);
@@ -345,55 +310,7 @@ void TableBorderHdl::CreateB2dIAObject()
}
}
-OverlayTableBorder::OverlayTableBorder( const basegfx::B2DPolyPolygon& rPolyPolygon )
-: OverlayObject(Color(COL_GRAY))
-, maPolyPolygon( rPolyPolygon )
-{
-}
-
-OverlayTableBorder::~OverlayTableBorder()
-{
-}
-
-// Hittest with logical coordinates
-sal_Bool OverlayTableBorder::isHit(const basegfx::B2DPoint& rPos, double /*fTol = 0.0*/) const
-{
- if(isHittable())
- {
- if( basegfx::tools::isInside( maPolyPolygon.getB2DPolygon(1), rPos, true ) )
- if( !basegfx::tools::isInside( maPolyPolygon.getB2DPolygon(0), rPos, false ) )
- return sal_True;
- }
- return sal_False;
-}
-
-// Draw geometry
-void OverlayTableBorder::drawGeometry(OutputDevice& rOutputDevice)
-{
- svtools::ColorConfig aColorConfig;
- Color aHatchCol( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
- const Hatch aHatch( HATCH_SINGLE, aHatchCol, 3, 450 );
- PolyPolygon aPolyPolygon( maPolyPolygon );
- rOutputDevice.DrawHatch( aPolyPolygon, aHatch );
-}
-
-// Create the BaseRange. This method needs to calculate maBaseRange.
-void OverlayTableBorder::createBaseRange(OutputDevice& /*rOutputDevice*/)
-{
- if(isHittable())
- {
- maBaseRange = basegfx::tools::getRange(maPolyPolygon);
- }
- else
- {
- maBaseRange.reset();
- }
-}
-
-void OverlayTableBorder::transform(const basegfx::B2DHomMatrix& rMatrix)
-{
- maPolyPolygon.transform( rMatrix );
-}
+//////////////////////////////////////////////////////////////////////////////
} // end of namespace table
} // end of namespace sdr
diff --git a/svx/source/table/tablehandles.hxx b/svx/source/table/tablehandles.hxx
index a6831f72bc88..e78d7fc4bdd3 100644
--- a/svx/source/table/tablehandles.hxx
+++ b/svx/source/table/tablehandles.hxx
@@ -57,8 +57,6 @@ class TableEdgeHdl : public SdrHdl
public:
TableEdgeHdl( const Point& rPnt, bool bHorizontal, sal_Int32 nMin, sal_Int32 nMax, sal_Int32 nEdges );
- virtual bool IsHdlHit(const Point& rPnt) const;
-
sal_Int32 GetValidDragOffset( const SdrDragStat& rDrag ) const;
virtual Pointer GetPointer() const;
@@ -68,7 +66,7 @@ public:
bool IsHorizontalEdge() const { return mbHorizontal; }
basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat& rDrag) const;
- basegfx::B2DPolyPolygon GetPolyPolygon( bool bOnlyVisible, const SdrDragStat* pDrag = 0 ) const;
+ void getPolyPolygon(basegfx::B2DPolyPolygon& rVisible, basegfx::B2DPolyPolygon& rInvisible, const SdrDragStat* pDrag) const;
protected:
// create marker for this kind
@@ -77,7 +75,6 @@ protected:
private:
bool mbHorizontal;
sal_Int32 mnMin, mnMax;
- basegfx::B2DPolyPolygon maVisiblePolygon;
TableEdgeVector maEdges;
};
diff --git a/svx/source/table/tablelayouter.cxx b/svx/source/table/tablelayouter.cxx
index 9c62d3ad4be9..b2620452d31a 100644
--- a/svx/source/table/tablelayouter.cxx
+++ b/svx/source/table/tablelayouter.cxx
@@ -102,6 +102,9 @@ basegfx::B2ITuple TableLayouter::getCellSize( const CellPos& rPos ) const
sal_Int32 nRowSpan = std::max( xCell->getRowSpan(), (sal_Int32)1 );
while( nRowSpan && (aPos.mnRow < nRowCount) )
{
+ if( ((sal_Int32)maRows.size()) <= aPos.mnRow )
+ break;
+
height += maRows[aPos.mnRow++].mnSize;
nRowSpan--;
}
@@ -110,8 +113,12 @@ basegfx::B2ITuple TableLayouter::getCellSize( const CellPos& rPos ) const
sal_Int32 nColSpan = std::max( xCell->getColumnSpan(), (sal_Int32)1 );
while( nColSpan && (aPos.mnCol < nColCount ) )
{
+ if( ((sal_Int32)maColumns.size()) <= aPos.mnCol )
+ break;
+
width += maColumns[aPos.mnCol++].mnSize;
nColSpan--;
+ nColSpan--;
}
}
}
@@ -122,6 +129,7 @@ basegfx::B2ITuple TableLayouter::getCellSize( const CellPos& rPos ) const
return basegfx::B2ITuple( width, height );
}
+
// -----------------------------------------------------------------------------
bool TableLayouter::getCellArea( const CellPos& rPos, basegfx::B2IRectangle& rArea ) const
@@ -133,11 +141,14 @@ bool TableLayouter::getCellArea( const CellPos& rPos, basegfx::B2IRectangle& rAr
{
const basegfx::B2ITuple aCellSize( getCellSize( rPos ) );
- const sal_Int32 x = maColumns[rPos.mnCol].mnPos;
- const sal_Int32 y = maRows[rPos.mnRow].mnPos;
+ if( (rPos.mnCol < ((sal_Int32)maColumns.size()) && (rPos.mnRow < ((sal_Int32)maRows.size()) ) ) )
+ {
+ const sal_Int32 x = maColumns[rPos.mnCol].mnPos;
+ const sal_Int32 y = maRows[rPos.mnRow].mnPos;
- rArea = basegfx::B2IRectangle( x, y, x + aCellSize.getX(), y + aCellSize.getY() );
- return true;
+ rArea = basegfx::B2IRectangle( x, y, x + aCellSize.getX(), y + aCellSize.getY() );
+ return true;
+ }
}
}
catch( Exception& )
@@ -321,6 +332,21 @@ sal_Int32 TableLayouter::getVerticalEdge( int nEdgeX, sal_Int32* pnMin /*= 0*/,
// -----------------------------------------------------------------------------
+static bool checkMergeOrigin( const TableModelRef& xTable, sal_Int32 nMergedX, sal_Int32 nMergedY, sal_Int32 nCellX, sal_Int32 nCellY, bool& bRunning )
+{
+ Reference< XMergeableCell > xCell( xTable->getCellByPosition( nCellX, nCellY ), UNO_QUERY );
+ if( xCell.is() && !xCell->isMerged() )
+ {
+ const sal_Int32 nRight = xCell->getColumnSpan() + nCellX;
+ const sal_Int32 nBottom = xCell->getRowSpan() + nCellY;
+ if( (nMergedX < nRight) && (nMergedY < nBottom) )
+ return true;
+
+ bRunning = false;
+ }
+ return false;
+}
+
/** returns true if the cell(nMergedX,nMergedY) is merged with other cells.
the returned cell( rOriginX, rOriginY ) is the origin( top left cell ) of the merge.
*/
@@ -336,49 +362,87 @@ bool findMergeOrigin( const TableModelRef& xTable, sal_Int32 nMergedX, sal_Int32
if( !xCell.is() || !xCell->isMerged() )
return true;
- // check horizontal
- sal_Int32 nCol = nMergedX-1;
- while( nCol >= 0 )
+ bool bCheckVert = true;
+ bool bCheckHorz = true;
+
+ sal_Int32 nMinCol = 0;
+ sal_Int32 nMinRow = 0;
+
+ sal_Int32 nStep = 1, i;
+
+ sal_Int32 nRow, nCol;
+ do
{
- xCell = xCell.query( xTable->getCellByPosition( nCol, nMergedY ) );
- if( xCell.is() && !xCell->isMerged() )
+ if( bCheckVert )
{
- if( xCell->getColumnSpan() > 1 )
+ nRow = nMergedY - nStep;
+ if( nRow >= nMinRow )
+ {
+ nCol = nMergedX;
+ for( i = 0; (i <= nStep) && (nCol >= nMinCol); i++, nCol-- )
+ {
+ if( checkMergeOrigin( xTable, nMergedX, nMergedY, nCol, nRow, bCheckVert ) )
+ {
+ rOriginX = nCol; rOriginY = nRow;
+ return true;
+ }
+
+ if( !bCheckVert )
+ {
+ if( nCol == nMergedX )
+ {
+ nMinRow = nRow+1;
+ }
+ else
+ {
+ bCheckVert = true;
+ }
+ break;
+ }
+ }
+ }
+ else
{
- // hit!
- rOriginX = nCol;
- rOriginY = nMergedY;
- return true;
+ bCheckVert = false;
}
- break;
}
- nCol--;
- }
- // check vertical
- sal_Int32 nRow = nMergedY-1;
- while( nRow >= 0 )
- {
- xCell = xCell.query( xTable->getCellByPosition( nMergedX, nRow ) );
- if( xCell.is() && !xCell->isMerged() )
+ if( bCheckHorz )
{
- if( xCell->getRowSpan() > 1 )
+ nCol = nMergedX - nStep;
+ if( nCol >= nMinCol )
{
- // hit!
- rOriginX = nMergedX;
- rOriginY = nRow;
- return true;
+ nRow = nMergedY;
+ for( i = 0; (i < nStep) && (nRow >= nMinRow); i++, nRow-- )
+ {
+ if( checkMergeOrigin( xTable, nMergedX, nMergedY, nCol, nRow, bCheckHorz ) )
+ {
+ rOriginX = nCol; rOriginY = nRow;
+ return true;
+ }
+
+ if( !bCheckHorz )
+ {
+ if( nRow == nMergedY )
+ {
+ nMinCol = nCol+1;
+ }
+ else
+ {
+ bCheckHorz = true;
+ }
+ break;
+ }
+ }
+ }
+ else
+ {
+ bCheckHorz = false;
}
- break;
}
- nRow--;
+ nStep++;
}
-
- // if origin is not at the edges, it must be the top left cell of the merged edges
- rOriginX = nCol+1;
- rOriginY = nRow+1;
- xCell = xCell.query( xTable->getCellByPosition( rOriginX, rOriginY ) );
- return xCell.is() && (xCell->getRowSpan() > 1) && (xCell->getColumnSpan() > 1);
+ while( bCheckVert || bCheckHorz );
}
catch( Exception& )
{
diff --git a/svx/source/table/tablemodel.cxx b/svx/source/table/tablemodel.cxx
index 83b1a95723a9..ce79dad77b4c 100644
--- a/svx/source/table/tablemodel.cxx
+++ b/svx/source/table/tablemodel.cxx
@@ -52,6 +52,8 @@
#include "svdstr.hrc"
#include "svdglob.hxx"
+//#define PLEASE_DEBUG_THE_TABLES 1
+
using ::rtl::OUString;
using namespace ::osl;
using namespace ::vos;
@@ -620,14 +622,29 @@ void TableModel::notifyModification()
::osl::MutexGuard guard( m_aMutex );
if( (mnNotifyLock == 0) && mpTableObj && mpTableObj->GetModel() )
{
+ mbNotifyPending = false;
+
+ ::cppu::OInterfaceContainerHelper * pModifyListeners = rBHelper.getContainer( XModifyListener::static_type() );
+ if( pModifyListeners )
+ {
+ EventObject aSource;
+ aSource.Source = static_cast< ::cppu::OWeakObject* >(this);
+ pModifyListeners->notifyEach( &XModifyListener::modified, aSource);
+ }
+ }
+ else
+ {
+ mbNotifyPending = true;
+ }
#ifdef PLEASE_DEBUG_THE_TABLES
- FILE* file = fopen( "e:\\table.log","a+" );
+ FILE* file = fopen( "c:\\table.xml","w" );
const sal_Int32 nColCount = getColumnCountImpl();
const sal_Int32 nRowCount = getRowCountImpl();
- fprintf( file, "<table columns=\"%ld\" rows=\"%ld\">\n\r", nColCount, nRowCount );
+ fprintf( file, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\r" );
+ fprintf( file, "<table columns=\"%ld\" rows=\"%ld\" updated=\"%s\">\n\r", nColCount, nRowCount, mbNotifyPending ? "false" : "true");
for( sal_Int32 nCol = 0; nCol < nColCount; ++nCol )
{
@@ -647,9 +664,9 @@ void TableModel::notifyModification()
sal_Int32 nColSpan = xCell->getColumnSpan();
sal_Bool bMerged = xCell->isMerged();
- if( nColSpan > 1 )
+ if( nColSpan != 1 )
fprintf( file, " column-span=\"%ld\"", nColSpan );
- if( nRowSpan > 1 )
+ if( nRowSpan != 1 )
fprintf( file, " row-span=\"%ld\"", nRowSpan );
if( bMerged )
@@ -663,20 +680,6 @@ void TableModel::notifyModification()
fprintf( file, "</table>\n\r" );
fclose( file );
#endif
- mbNotifyPending = false;
-
- ::cppu::OInterfaceContainerHelper * pModifyListeners = rBHelper.getContainer( XModifyListener::static_type() );
- if( pModifyListeners )
- {
- EventObject aSource;
- aSource.Source = static_cast< ::cppu::OWeakObject* >(this);
- pModifyListeners->notifyEach( &XModifyListener::modified, aSource);
- }
- }
- else
- {
- mbNotifyPending = true;
- }
}
// -----------------------------------------------------------------------------
@@ -784,19 +787,7 @@ void TableModel::insertColumns( sal_Int32 nIndex, sal_Int32 nCount )
// cell merges over newly created columns, so add the new columns to the merged cell
const sal_Int32 nRowSpan = xCell->getRowSpan();
nColSpan += nCount;
- if( bUndo )
- xCell->AddUndo();
- xCell->merge( nColSpan, nRowSpan );
- // set newly inserted cells to merged state
- for( sal_Int32 nColOffset = 0; nColOffset < nCount; ++nColOffset )
- {
- for( sal_Int32 nRowOffset = 0; nRowOffset < nRowSpan; ++nRowOffset )
- {
- CellRef xMergedCell( getCell( nIndex + nColOffset, nRow + nRowOffset ) );
- if( xMergedCell.is() )
- xMergedCell->setMerged();
- }
- }
+ merge( nCol, nRow, nColSpan, nRowSpan );
}
}
}
@@ -909,7 +900,10 @@ void TableModel::removeColumns( sal_Int32 nIndex, sal_Int32 nCount )
maRows[nRows]->removeColumns( nIndex, nCount );
if( bUndo )
+ {
pModel->EndUndo();
+ pModel->SetChanged();
+ }
}
catch( Exception& )
{
@@ -964,20 +958,7 @@ void TableModel::insertRows( sal_Int32 nIndex, sal_Int32 nCount )
// cell merges over newly created columns, so add the new columns to the merged cell
const sal_Int32 nColSpan = xCell->getColumnSpan();
nRowSpan += nCount;
- if( bUndo )
- xCell->AddUndo();
- xCell->merge( nColSpan, nRowSpan );
-
- // set newly inserted cells to merged state
- for( sal_Int32 nColOffset = 1; nColOffset < nColSpan; ++nColOffset )
- {
- for( sal_Int32 nRowOffset = 0; nRowOffset <= nCount; ++nRowOffset )
- {
- CellRef xMergedCell( getCell( nCol + nColOffset - 1, nIndex + nRowOffset ) );
- if( xMergedCell.is() )
- xMergedCell->setMerged();
- }
- }
+ merge( nCol, nRow, nColSpan, nRowSpan );
}
}
}
@@ -1075,7 +1056,10 @@ void TableModel::removeRows( sal_Int32 nIndex, sal_Int32 nCount )
remove_range<RowVector,RowVector::iterator>( maRows, nIndex, nCount );
if( bUndo )
+ {
pModel->EndUndo();
+ pModel->SetChanged();
+ }
}
catch( Exception& )
{
@@ -1198,6 +1182,52 @@ void TableModel::optimize()
// -----------------------------------------------------------------------------
+void TableModel::merge( sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nColSpan, sal_Int32 nRowSpan )
+{
+ SdrModel* pModel = mpTableObj->GetModel();
+
+ const bool bUndo = pModel && mpTableObj->IsInserted() && pModel->IsUndoEnabled();
+
+ const sal_Int32 nLastRow = nRow + nRowSpan;
+ const sal_Int32 nLastCol = nCol + nColSpan;
+
+ if( (nLastRow > getRowCount()) || (nLastCol > getRowCount() ) )
+ {
+ DBG_ERROR("TableModel::merge(), merge beyound the table!");
+ }
+
+ // merge first cell
+ CellRef xOriginCell( dynamic_cast< Cell* >( getCellByPosition( nCol, nRow ).get() ) );
+ if( xOriginCell.is() )
+ {
+ if( bUndo )
+ xOriginCell->AddUndo();
+ xOriginCell->merge( nColSpan, nRowSpan );
+ }
+
+ sal_Int32 nTempCol = nCol + 1;
+
+ // merge remaining cells
+ for( ; nRow < nLastRow; nRow++ )
+ {
+ for( ; nTempCol < nLastCol; nTempCol++ )
+ {
+ CellRef xCell( dynamic_cast< Cell* >( getCellByPosition( nTempCol, nRow ).get() ) );
+ if( xCell.is() && !xCell->isMerged() )
+ {
+ if( bUndo )
+ xCell->AddUndo();
+ xCell->setMerged();
+ xOriginCell->mergeContent( xCell );
+ }
+ }
+ nTempCol = nCol;
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+
void TableModel::updateRows()
{
sal_Int32 nRow = 0;
diff --git a/svx/source/table/tablemodel.hxx b/svx/source/table/tablemodel.hxx
index 73e188dd3f5c..e118999b276f 100644
--- a/svx/source/table/tablemodel.hxx
+++ b/svx/source/table/tablemodel.hxx
@@ -96,6 +96,9 @@ public:
/** deletes rows and columns that are completly merged. Must be called between BegUndo/EndUndo! */
void optimize();
+ /// merges the cell at the given position with the given span
+ void merge( sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nColSpan, sal_Int32 nRowSpan );
+
// ICellRange
virtual sal_Int32 getLeft();
virtual sal_Int32 getTop();
diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx
index c1c58977be64..f740bf60258c 100644
--- a/svx/source/table/viewcontactoftableobj.cxx
+++ b/svx/source/table/viewcontactoftableobj.cxx
@@ -599,7 +599,30 @@ namespace sdr
const SfxItemSet& rCellItemSet = xCurrentCell->GetItemSet();
const sal_uInt32 nTextIndex(nColCount * aCellPos.mnRow + aCellPos.mnCol);
const SdrText* pSdrText = rTableObj.getText(nTextIndex);
- drawinglayer::attribute::SdrFillTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute(rCellItemSet, pSdrText);
+ drawinglayer::attribute::SdrFillTextAttribute* pAttribute = 0;
+
+ if(pSdrText)
+ {
+ // #i101508# take cell's local text frame distances into account
+ const sal_Int32 nLeft(xCurrentCell->GetTextLeftDistance());
+ const sal_Int32 nRight(xCurrentCell->GetTextRightDistance());
+ const sal_Int32 nUpper(xCurrentCell->GetTextUpperDistance());
+ const sal_Int32 nLower(xCurrentCell->GetTextLowerDistance());
+
+ pAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute(
+ rCellItemSet,
+ pSdrText,
+ &nLeft,
+ &nUpper,
+ &nRight,
+ &nLower);
+ }
+ else
+ {
+ pAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute(
+ rCellItemSet,
+ pSdrText);
+ }
if(pAttribute)
{
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src
index 180724093424..601f2594a080 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src
@@ -40,7 +40,7 @@
#define FULL_WIDTH (220)
#define FULL_HEIGHT (120)
-#define EDITBUTTON_WIDTH (70)
+#define EDITBUTTON_WIDTH (75)
#define COL_1 (RSC_SP_DLG_INNERBORDER_LEFT)
#define COL_2 (COL_1+RSC_SP_FLGR_SPACE_X)
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index b5f3e5c6ec5f..098ddb6c31c0 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -104,6 +104,9 @@ using namespace ::com::sun::star::task;
#include <svx/sdr/contact/viewobjectcontact.hxx>
#include <svx/sdr/contact/viewcontact.hxx>
+// #i102251#
+#include <editstat.hxx>
+
//////////////////////////////////////////////////////////////////////////////
namespace svx
@@ -225,16 +228,27 @@ namespace svx
Graphic aGraphic( rMtf );
BitmapEx aBmpEx;
+ // #i102089# support user's settings of AA and LineSnap when the MetaFile gets
+ // rasterconverted to a bitmap
+ const SvtOptionsDrawinglayer aDrawinglayerOpt;
+ const GraphicConversionParameters aParameters(
+ pSize ? *pSize : Size(0, 0),
+ true, // allow unlimited size
+ aDrawinglayerOpt.IsAntiAliasing(),
+ aDrawinglayerOpt.IsSnapHorVerLinesToDiscrete());
+
if( bTransparent )
{
- Graphic aMaskGraphic( rMtf.GetMonochromeMtf( COL_BLACK ) );
- Bitmap aMaskBmp( aMaskGraphic.GetUnlimitedBitmap( pSize ) );
+ Graphic aMaskGraphic(rMtf.GetMonochromeMtf(COL_BLACK));
+ Bitmap aMaskBmp(aMaskGraphic.GetBitmap(aParameters));
- aMaskBmp.Convert( BMP_CONVERSION_1BIT_THRESHOLD );
- aBmpEx = BitmapEx( aGraphic.GetUnlimitedBitmap( pSize ), aMaskBmp );
+ aMaskBmp.Convert(BMP_CONVERSION_1BIT_THRESHOLD);
+ aBmpEx = BitmapEx(aGraphic.GetBitmap(aParameters), aMaskBmp);
}
else
- aBmpEx = BitmapEx( aGraphic.GetUnlimitedBitmap( pSize ) );
+ {
+ aBmpEx = BitmapEx(aGraphic.GetBitmap(aParameters));
+ }
aBmpEx.SetPrefMapMode( rMtf.GetPrefMapMode() );
aBmpEx.SetPrefSize( rMtf.GetPrefSize() );
@@ -625,8 +639,12 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
rOutl.SetCalcFieldValueHdl( LINK(this, GraphicExporter, CalcFieldValueHdl) );
rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor(pView->GetSdrPageView()) );
- std::vector< SdrObject* > aShapes;
+ // #i102251#
+ const sal_uInt32 nOldCntrl(rOutl.GetControlWord());
+ sal_uInt32 nCntrl = nOldCntrl & ~EE_CNTRL_ONLINESPELLING;
+ rOutl.SetControlWord(nCntrl);
+ std::vector< SdrObject* > aShapes;
bool bRet = true;
// export complete page?
@@ -977,6 +995,9 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
rOutl.SetCalcFieldValueHdl( maOldCalcFieldValueHdl );
+ // #i102251#
+ rOutl.SetControlWord(nOldCntrl);
+
return bRet;
}
diff --git a/svx/source/unodraw/gluepts.cxx b/svx/source/unodraw/gluepts.cxx
index 1210a3847a96..d742cf63ece8 100644
--- a/svx/source/unodraw/gluepts.cxx
+++ b/svx/source/unodraw/gluepts.cxx
@@ -49,19 +49,15 @@ using namespace ::cppu;
const USHORT NON_USER_DEFINED_GLUE_POINTS = 4;
-class SvxUnoGluePointAccess : public WeakImplHelper2< container::XIndexContainer, container::XIdentifierContainer >,
- public SfxListener
+class SvxUnoGluePointAccess : public WeakImplHelper2< container::XIndexContainer, container::XIdentifierContainer >
{
private:
- SdrObject* mpObject;
+ SdrObjectWeakRef mpObject;
public:
SvxUnoGluePointAccess( SdrObject* pObject ) throw();
virtual ~SvxUnoGluePointAccess() throw();
- // SfxListener
- virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) throw ();
-
// XIdentifierContainer
virtual sal_Int32 SAL_CALL insert( const uno::Any& aElement ) throw (lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL removeByIdentifier( sal_Int32 Identifier ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
@@ -223,52 +219,16 @@ static void convert( const drawing::GluePoint2& rUnoGlue, SdrGluePoint& rSdrGlue
SvxUnoGluePointAccess::SvxUnoGluePointAccess( SdrObject* pObject ) throw()
: mpObject( pObject )
{
- StartListening( *mpObject->GetModel() );
-
}
SvxUnoGluePointAccess::~SvxUnoGluePointAccess() throw()
{
- if( mpObject && mpObject->GetModel())
- EndListening( *mpObject->GetModel() );
-}
-
-void SvxUnoGluePointAccess::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw()
-{
- const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
-
- if( pSdrHint && mpObject)
- {
- if( pSdrHint->GetKind() == HINT_OBJREMOVED )
- {
- if( mpObject == pSdrHint->GetObject() )
- mpObject = NULL;
- }
- else if( pSdrHint->GetKind() == HINT_MODELCLEARED )
- {
- mpObject = NULL;
- }
- // #110094#-9
- //else if( pSdrHint->GetKind() == HINT_OBJLISTCLEAR )
- //{
- // SdrObjList* pObjList = mpObject ? mpObject->GetObjList() : NULL;
- // while( pObjList )
- // {
- // if( pSdrHint->GetObjList() == pObjList )
- // {
- // mpObject = NULL;
- // break;
- // }
- // pObjList = pObjList->GetUpList();
- // }
- //}
- }
}
// XIdentifierContainer
sal_Int32 SAL_CALL SvxUnoGluePointAccess::insert( const uno::Any& aElement ) throw (lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
{
- if( mpObject )
+ if( mpObject.is() )
{
SdrGluePointList* pList = mpObject->ForceGluePointList();
if( pList )
@@ -298,7 +258,7 @@ sal_Int32 SAL_CALL SvxUnoGluePointAccess::insert( const uno::Any& aElement ) thr
void SAL_CALL SvxUnoGluePointAccess::removeByIdentifier( sal_Int32 Identifier ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
- if( mpObject && ( Identifier >= NON_USER_DEFINED_GLUE_POINTS ))
+ if( mpObject.is() && ( Identifier >= NON_USER_DEFINED_GLUE_POINTS ))
{
const USHORT nId = (USHORT)(Identifier - NON_USER_DEFINED_GLUE_POINTS) + 1;
@@ -327,7 +287,7 @@ void SAL_CALL SvxUnoGluePointAccess::removeByIdentifier( sal_Int32 Identifier )
// XIdentifierReplace
void SAL_CALL SvxUnoGluePointAccess::replaceByIdentifer( sal_Int32 Identifier, const uno::Any& aElement ) throw (lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
- if( mpObject && mpObject->IsNode() )
+ if( mpObject.is() && mpObject->IsNode() )
{
struct drawing::GluePoint2 aGluePoint;
if( (Identifier < NON_USER_DEFINED_GLUE_POINTS) || !(aElement >>= aGluePoint))
@@ -361,7 +321,7 @@ void SAL_CALL SvxUnoGluePointAccess::replaceByIdentifer( sal_Int32 Identifier, c
// XIdentifierAccess
uno::Any SAL_CALL SvxUnoGluePointAccess::getByIdentifier( sal_Int32 Identifier ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
- if( mpObject && mpObject->IsNode() )
+ if( mpObject.is() && mpObject->IsNode() )
{
struct drawing::GluePoint2 aGluePoint;
@@ -401,21 +361,29 @@ uno::Any SAL_CALL SvxUnoGluePointAccess::getByIdentifier( sal_Int32 Identifier )
uno::Sequence< sal_Int32 > SAL_CALL SvxUnoGluePointAccess::getIdentifiers() throw (uno::RuntimeException)
{
- const SdrGluePointList* pList = mpObject->GetGluePointList();
- const USHORT nCount = pList ? pList->GetCount() : 0;
+ if( mpObject.is() )
+ {
+ const SdrGluePointList* pList = mpObject->GetGluePointList();
+ const USHORT nCount = pList ? pList->GetCount() : 0;
- USHORT i;
+ USHORT i;
- uno::Sequence< sal_Int32 > aIdSequence( nCount + NON_USER_DEFINED_GLUE_POINTS );
- sal_Int32 *pIdentifier = aIdSequence.getArray();
+ uno::Sequence< sal_Int32 > aIdSequence( nCount + NON_USER_DEFINED_GLUE_POINTS );
+ sal_Int32 *pIdentifier = aIdSequence.getArray();
- for( i = 0; i < NON_USER_DEFINED_GLUE_POINTS; i++ )
- *pIdentifier++ = (sal_Int32)i;
+ for( i = 0; i < NON_USER_DEFINED_GLUE_POINTS; i++ )
+ *pIdentifier++ = (sal_Int32)i;
- for( i = 0; i < nCount; i++ )
- *pIdentifier++ = (sal_Int32) ( (*pList)[i].GetId() + NON_USER_DEFINED_GLUE_POINTS ) - 1;
+ for( i = 0; i < nCount; i++ )
+ *pIdentifier++ = (sal_Int32) ( (*pList)[i].GetId() + NON_USER_DEFINED_GLUE_POINTS ) - 1;
- return aIdSequence;
+ return aIdSequence;
+ }
+ else
+ {
+ uno::Sequence< sal_Int32 > aEmpty;
+ return aEmpty;
+ }
}
/* deprecated */
@@ -425,7 +393,7 @@ void SAL_CALL SvxUnoGluePointAccess::insertByIndex( sal_Int32, const uno::Any& E
throw(lang::IllegalArgumentException, lang::IndexOutOfBoundsException,
lang::WrappedTargetException, uno::RuntimeException)
{
- if( mpObject )
+ if( mpObject.is() )
{
SdrGluePointList* pList = mpObject->ForceGluePointList();
if( pList )
@@ -455,7 +423,7 @@ void SAL_CALL SvxUnoGluePointAccess::insertByIndex( sal_Int32, const uno::Any& E
void SAL_CALL SvxUnoGluePointAccess::removeByIndex( sal_Int32 Index )
throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
{
- if( mpObject )
+ if( mpObject.is() )
{
SdrGluePointList* pList = mpObject->ForceGluePointList();
if( pList )
@@ -487,7 +455,7 @@ void SAL_CALL SvxUnoGluePointAccess::replaceByIndex( sal_Int32 Index, const uno:
throw lang::IllegalArgumentException();
Index -= 4;
- if( mpObject && Index >= 0 )
+ if( mpObject.is() && Index >= 0 )
{
SdrGluePointList* pList = const_cast< SdrGluePointList* >( mpObject->GetGluePointList() );
if( pList && Index < pList->GetCount() )
@@ -509,7 +477,7 @@ sal_Int32 SAL_CALL SvxUnoGluePointAccess::getCount()
throw(uno::RuntimeException)
{
sal_Int32 nCount = 0;
- if( mpObject )
+ if( mpObject.is() )
{
// each node has a default of 4 glue points
// and any number of user defined glue points
@@ -529,7 +497,7 @@ sal_Int32 SAL_CALL SvxUnoGluePointAccess::getCount()
uno::Any SAL_CALL SvxUnoGluePointAccess::getByIndex( sal_Int32 Index )
throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
{
- if( Index >= 0 && mpObject && mpObject->IsNode() )
+ if( Index >= 0 && mpObject.is() && mpObject->IsNode() )
{
struct drawing::GluePoint2 aGluePoint;
@@ -571,7 +539,7 @@ uno::Type SAL_CALL SvxUnoGluePointAccess::getElementType()
sal_Bool SAL_CALL SvxUnoGluePointAccess::hasElements()
throw( uno::RuntimeException)
{
- return mpObject && mpObject->IsNode();
+ return mpObject.is() && mpObject->IsNode();
}
/**
diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx
index fdac6b7a9c1a..7f7aedf860e9 100644
--- a/svx/source/unodraw/unomod.cxx
+++ b/svx/source/unodraw/unomod.cxx
@@ -215,9 +215,14 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawMSFactory::createTextField(
{
uno::Reference< uno::XInterface > xRet;
- const OUString aTextFieldPrexit( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextField.") );
+ const OUString aTextFieldPrexit( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.textfield.") );
- if( ServiceSpecifier.compareTo( aTextFieldPrexit, aTextFieldPrexit.getLength() ) == 0 )
+ // #i93308# up to OOo 3.2 we used this wrong namespace name with the capital T & F. This is
+ // fixed since OOo 3.2 but for compatibility we will still provide support for the wrong notation.
+ const OUString aTextFieldPrexit2( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextField.") );
+
+ if( (ServiceSpecifier.compareTo( aTextFieldPrexit, aTextFieldPrexit.getLength() ) == 0) ||
+ (ServiceSpecifier.compareTo( aTextFieldPrexit2, aTextFieldPrexit2.getLength() ) == 0) )
{
OUString aFieldType( ServiceSpecifier.copy( aTextFieldPrexit.getLength() ) );
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index 4cc56d5ca427..7ab6a44fd3fb 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -670,17 +670,16 @@ sal_Bool SvXMLGraphicHelper::ImplWriteGraphic( const ::rtl::OUString& rPictureSt
// -----------------------------------------------------------------------------
-void SvXMLGraphicHelper::ImplInsertGraphicURL( const ::rtl::OUString& rURLStr, sal_uInt32 nInsertPos )
+void SvXMLGraphicHelper::ImplInsertGraphicURL( const ::rtl::OUString& rURLStr, sal_uInt32 nInsertPos, rtl::OUString& rRequestedFileName )
{
+ rtl::OUString aURLString( rURLStr );
::rtl::OUString aPictureStorageName, aPictureStreamName;
-
- if( ( maURLSet.find( rURLStr ) != maURLSet.end() ) )
+ if( ( maURLSet.find( aURLString ) != maURLSet.end() ) )
{
URLPairVector::iterator aIter( maGrfURLs.begin() ), aEnd( maGrfURLs.end() );
-
while( aIter != aEnd )
{
- if( rURLStr == (*aIter).first )
+ if( aURLString == (*aIter).first )
{
maGrfURLs[ nInsertPos ].second = (*aIter).second;
aIter = aEnd;
@@ -689,7 +688,7 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const ::rtl::OUString& rURLStr, s
aIter++;
}
}
- else if( ImplGetStreamNames( rURLStr, aPictureStorageName, aPictureStreamName ) )
+ else if( ImplGetStreamNames( aURLString, aPictureStorageName, aPictureStreamName ) )
{
URLPair& rURLPair = maGrfURLs[ nInsertPos ];
@@ -718,22 +717,23 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const ::rtl::OUString& rURLStr, s
String aStreamName( aGraphicObjectId );
Graphic aGraphic( (Graphic&) aGrfObject.GetGraphic() );
const GfxLink aGfxLink( aGraphic.GetLink() );
+ String aExtension;
if( aGfxLink.GetDataSize() )
{
switch( aGfxLink.GetType() )
{
- case( GFX_LINK_TYPE_EPS_BUFFER ): aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".eps" ) ); break;
- case( GFX_LINK_TYPE_NATIVE_GIF ): aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".gif" ) ); break;
- case( GFX_LINK_TYPE_NATIVE_JPG ): aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".jpg" ) ); break;
- case( GFX_LINK_TYPE_NATIVE_PNG ): aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".png" ) ); break;
- case( GFX_LINK_TYPE_NATIVE_TIF ): aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".tif" ) ); break;
- case( GFX_LINK_TYPE_NATIVE_WMF ): aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".wmf" ) ); break;
- case( GFX_LINK_TYPE_NATIVE_MET ): aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".met" ) ); break;
- case( GFX_LINK_TYPE_NATIVE_PCT ): aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".pct" ) ); break;
+ case( GFX_LINK_TYPE_EPS_BUFFER ): aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".eps" ) ); break;
+ case( GFX_LINK_TYPE_NATIVE_GIF ): aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".gif" ) ); break;
+ case( GFX_LINK_TYPE_NATIVE_JPG ): aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".jpg" ) ); break;
+ case( GFX_LINK_TYPE_NATIVE_PNG ): aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".png" ) ); break;
+ case( GFX_LINK_TYPE_NATIVE_TIF ): aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".tif" ) ); break;
+ case( GFX_LINK_TYPE_NATIVE_WMF ): aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".wmf" ) ); break;
+ case( GFX_LINK_TYPE_NATIVE_MET ): aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".met" ) ); break;
+ case( GFX_LINK_TYPE_NATIVE_PCT ): aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".pct" ) ); break;
default:
- aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".grf" ) );
+ aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".grf" ) );
break;
}
}
@@ -742,30 +742,52 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const ::rtl::OUString& rURLStr, s
if( aGrfObject.GetType() == GRAPHIC_BITMAP )
{
if( aGrfObject.IsAnimated() )
- aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".gif" ) );
+ aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".gif" ) );
else
- aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".png" ) );
+ aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".png" ) );
}
else if( aGrfObject.GetType() == GRAPHIC_GDIMETAFILE )
{
// SJ: first check if this metafile is just a eps file, then we will store the eps instead of svm
GDIMetaFile& rMtf( (GDIMetaFile&)aGraphic.GetGDIMetaFile() );
if ( ImplCheckForEPS( rMtf ) )
- aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".eps" ) );
+ aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".eps" ) );
else
- aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".svm" ) );
+ aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".svm" ) );
}
}
+ rtl::OUString aURLEntry;
+ const String sPictures( RTL_CONSTASCII_USTRINGPARAM( "Pictures/" ) );
+
+ if ( rRequestedFileName.getLength() )
+ {
+ aURLEntry = sPictures;
+ aURLEntry += rRequestedFileName;
+ aURLEntry += aExtension;
+
+ URLPairVector::iterator aIter( maGrfURLs.begin() ), aEnd( maGrfURLs.end() );
+ while( aIter != aEnd )
+ {
+ if( aURLEntry == (*aIter).second )
+ break;
+ aIter++;
+ }
+ if ( aIter == aEnd )
+ aStreamName = rRequestedFileName;
+ }
+
+ aStreamName += aExtension;
+
if( mbDirect && aStreamName.Len() )
ImplWriteGraphic( aPictureStorageName, aStreamName, aGraphicObjectId );
- rURLPair.second = String( RTL_CONSTASCII_USTRINGPARAM( "Pictures/" ) );
+ rURLPair.second = sPictures;
rURLPair.second += aStreamName;
}
}
- maURLSet.insert( rURLStr );
+ maURLSet.insert( aURLString );
}
}
@@ -820,14 +842,45 @@ void SvXMLGraphicHelper::Destroy( SvXMLGraphicHelper* pSvXMLGraphicHelper )
// -----------------------------------------------------------------------------
// XGraphicObjectResolver
-::rtl::OUString SAL_CALL SvXMLGraphicHelper::resolveGraphicObjectURL( const ::rtl::OUString& aURL )
+::rtl::OUString SAL_CALL SvXMLGraphicHelper::resolveGraphicObjectURL( const ::rtl::OUString& rURL )
throw(uno::RuntimeException)
{
::osl::MutexGuard aGuard( maMutex );
const sal_Int32 nIndex = maGrfURLs.size();
+ rtl::OUString aURL( rURL );
+ rtl::OUString aUserData;
+ rtl::OUString aRequestedFileName;
+
+ sal_Int32 nUser = rURL.indexOf( '?', 0 );
+ if ( nUser >= 0 )
+ {
+ aURL = rtl::OUString( rURL.copy( 0, nUser ) );
+ nUser++;
+ aUserData = rURL.copy( nUser, rURL.getLength() - nUser );
+ }
+ if ( aUserData.getLength() )
+ {
+ sal_Int32 nIndex2 = 0;
+ do
+ {
+ rtl::OUString aToken = aUserData.getToken( 0, ';', nIndex2 );
+ sal_Int32 n = aToken.indexOf( '=' );
+ if ( ( n > 0 ) && ( ( n + 1 ) < aToken.getLength() ) )
+ {
+ rtl::OUString aParam( aToken.copy( 0, n ) );
+ rtl::OUString aValue( aToken.copy( n + 1, aToken.getLength() - ( n + 1 ) ) );
+
+ const rtl::OUString sRequestedName( RTL_CONSTASCII_USTRINGPARAM("requestedName") );
+ if ( aParam.match( sRequestedName ) )
+ aRequestedFileName = aValue;
+ }
+ }
+ while ( nIndex2 >= 0 );
+ }
+
maGrfURLs.push_back( ::std::make_pair( aURL, ::rtl::OUString() ) );
- ImplInsertGraphicURL( aURL, nIndex );
+ ImplInsertGraphicURL( aURL, nIndex, aRequestedFileName );
return maGrfURLs[ nIndex ].second;
}
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index 21dd7fcb1acd..6fae754662ee 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -66,6 +66,8 @@
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/vector/b2dvector.hxx>
+#include <stdio.h>
+
using namespace ::rtl;
using namespace ::com::sun::star;
@@ -108,7 +110,7 @@ long ScaleMetricValue( long nVal, long nMul, long nDiv )
/*************************************************************************
|*
-|* NameOrIndex::NameOrIndex(USHORT nWhich, long nIndex)
+|* NameOrIndex::NameOrIndex(USHORT nWhich, INT32 nIndex)
|*
|* Beschreibung
|* Ersterstellung 14.11.94
@@ -116,7 +118,7 @@ long ScaleMetricValue( long nVal, long nMul, long nDiv )
|*
*************************************************************************/
-NameOrIndex::NameOrIndex(USHORT _nWhich, long nIndex) :
+NameOrIndex::NameOrIndex(USHORT _nWhich, INT32 nIndex) :
SfxStringItem(_nWhich, aNameOrIndexEmptyString),
nPalIndex(nIndex)
{
@@ -134,7 +136,7 @@ NameOrIndex::NameOrIndex(USHORT _nWhich, long nIndex) :
NameOrIndex::NameOrIndex(USHORT _nWhich, const XubString& rName) :
SfxStringItem(_nWhich, rName),
- nPalIndex((long)-1)
+ nPalIndex(-1)
{
}
@@ -230,7 +232,7 @@ SfxPoolItem* NameOrIndex::Create(SvStream& rIn, USHORT /*nVer*/) const
SvStream& NameOrIndex::Store( SvStream& rOut, USHORT nItemVersion ) const
{
SfxStringItem::Store( rOut, nItemVersion );
- rOut << (INT32)nPalIndex;
+ rOut << nPalIndex;
return rOut;
}
@@ -369,11 +371,11 @@ TYPEINIT1_AUTOFACTORY(XColorItem, NameOrIndex);
/*************************************************************************
|*
-|* XColorItem::XColorItem(USHORT nWhich, long nIndex, const Color& rTheColor)
+|* XColorItem::XColorItem(USHORT nWhich, INT32 nIndex, const Color& rTheColor)
|*
\************************************************************************/
-XColorItem::XColorItem(USHORT _nWhich, long nIndex, const Color& rTheColor) :
+XColorItem::XColorItem(USHORT _nWhich, INT32 nIndex, const Color& rTheColor) :
NameOrIndex(_nWhich, nIndex),
aColor(rTheColor)
{
@@ -884,7 +886,7 @@ TYPEINIT1_AUTOFACTORY(XLineDashItem, NameOrIndex);
/*************************************************************************
|*
-|* XLineDashItem::XLineDashItem(long nIndex, const XDash& rTheDash)
+|* XLineDashItem::XLineDashItem(INT32 nIndex, const XDash& rTheDash)
|*
|* Beschreibung
|* Ersterstellung 15.11.94
@@ -892,7 +894,7 @@ TYPEINIT1_AUTOFACTORY(XLineDashItem, NameOrIndex);
|*
*************************************************************************/
-XLineDashItem::XLineDashItem(long nIndex, const XDash& rTheDash) :
+XLineDashItem::XLineDashItem(INT32 nIndex, const XDash& rTheDash) :
NameOrIndex(XATTR_LINEDASH, nIndex),
aDash(rTheDash)
{
@@ -1501,7 +1503,7 @@ TYPEINIT1_AUTOFACTORY(XLineColorItem, XColorItem);
/*************************************************************************
|*
-|* XLineColorItem::XLineColorItem(long nIndex, const Color& rTheColor)
+|* XLineColorItem::XLineColorItem(INT32 nIndex, const Color& rTheColor)
|*
|* Beschreibung
|* Ersterstellung 15.11.94
@@ -1509,7 +1511,7 @@ TYPEINIT1_AUTOFACTORY(XLineColorItem, XColorItem);
|*
*************************************************************************/
-XLineColorItem::XLineColorItem(long nIndex, const Color& rTheColor) :
+XLineColorItem::XLineColorItem(INT32 nIndex, const Color& rTheColor) :
XColorItem(XATTR_LINECOLOR, nIndex, rTheColor)
{
}
@@ -1720,7 +1722,7 @@ TYPEINIT1_AUTOFACTORY(XLineStartItem, NameOrIndex);
/*************************************************************************
|*
-|* XLineStartItem::XLineStartItem(long nIndex)
+|* XLineStartItem::XLineStartItem(INT32 nIndex)
|*
|* Beschreibung
|* Ersterstellung 15.11.94
@@ -1728,7 +1730,7 @@ TYPEINIT1_AUTOFACTORY(XLineStartItem, NameOrIndex);
|*
*************************************************************************/
-XLineStartItem::XLineStartItem(long nIndex)
+XLineStartItem::XLineStartItem(INT32 nIndex)
: NameOrIndex(XATTR_LINESTART, nIndex)
{
}
@@ -2192,7 +2194,7 @@ TYPEINIT1_AUTOFACTORY(XLineEndItem, NameOrIndex);
/*************************************************************************
|*
-|* XLineEndItem::XLineEndItem(long nIndex)
+|* XLineEndItem::XLineEndItem(INT32 nIndex)
|*
|* Beschreibung
|* Ersterstellung 15.11.94
@@ -2200,7 +2202,7 @@ TYPEINIT1_AUTOFACTORY(XLineEndItem, NameOrIndex);
|*
*************************************************************************/
-XLineEndItem::XLineEndItem(long nIndex)
+XLineEndItem::XLineEndItem(INT32 nIndex)
: NameOrIndex(XATTR_LINEEND, nIndex)
{
}
@@ -2664,7 +2666,7 @@ TYPEINIT1_AUTOFACTORY(XLineStartWidthItem, SfxMetricItem);
/*************************************************************************
|*
-|* XLineStartWidthItem::XLineStartWidthItem(long nWidth)
+|* XLineStartWidthItem::XLineStartWidthItem(INT32 nWidth)
|*
|* Beschreibung
|* Ersterstellung 15.11.94
@@ -3249,7 +3251,7 @@ TYPEINIT1_AUTOFACTORY(XFillColorItem, XColorItem);
/*************************************************************************
|*
-|* XFillColorItem::XFillColorItem(long nIndex, const Color& rTheColor)
+|* XFillColorItem::XFillColorItem(INT32 nIndex, const Color& rTheColor)
|*
|* Beschreibung
|* Ersterstellung 15.11.94
@@ -3257,7 +3259,7 @@ TYPEINIT1_AUTOFACTORY(XFillColorItem, XColorItem);
|*
*************************************************************************/
-XFillColorItem::XFillColorItem(long nIndex, const Color& rTheColor) :
+XFillColorItem::XFillColorItem(INT32 nIndex, const Color& rTheColor) :
XColorItem(XATTR_FILLCOLOR, nIndex, rTheColor)
{
}
@@ -3372,7 +3374,7 @@ sal_Bool XFillColorItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE
// -----------------------------
TYPEINIT1_AUTOFACTORY(XSecondaryFillColorItem, XColorItem);
-XSecondaryFillColorItem::XSecondaryFillColorItem(long nIndex, const Color& rTheColor) :
+XSecondaryFillColorItem::XSecondaryFillColorItem(INT32 nIndex, const Color& rTheColor) :
XColorItem(XATTR_SECONDARYFILLCOLOR, nIndex, rTheColor)
{
}
@@ -3510,7 +3512,7 @@ TYPEINIT1_AUTOFACTORY(XFillGradientItem, NameOrIndex);
/*************************************************************************
|*
-|* XFillGradientItem::XFillGradientItem(long nIndex,
+|* XFillGradientItem::XFillGradientItem(INT32 nIndex,
|* const XGradient& rTheGradient)
|*
|* Beschreibung
@@ -3519,7 +3521,7 @@ TYPEINIT1_AUTOFACTORY(XFillGradientItem, NameOrIndex);
|*
*************************************************************************/
-XFillGradientItem::XFillGradientItem(long nIndex,
+XFillGradientItem::XFillGradientItem(INT32 nIndex,
const XGradient& rTheGradient) :
NameOrIndex(XATTR_FILLGRADIENT, nIndex),
aGradient(rTheGradient)
@@ -4042,7 +4044,7 @@ XFillFloatTransparenceItem::XFillFloatTransparenceItem() :
//------------------------------------------------------------------------
-XFillFloatTransparenceItem::XFillFloatTransparenceItem( long nIndex, const XGradient& rGradient, BOOL bEnable ) :
+XFillFloatTransparenceItem::XFillFloatTransparenceItem( INT32 nIndex, const XGradient& rGradient, BOOL bEnable ) :
XFillGradientItem ( nIndex, rGradient ),
bEnabled ( bEnable )
{
@@ -4246,7 +4248,7 @@ TYPEINIT1_AUTOFACTORY(XFillHatchItem, NameOrIndex);
/*************************************************************************
|*
-|* XFillHatchItem::XFillHatchItem(long nIndex,
+|* XFillHatchItem::XFillHatchItem(INT32 nIndex,
|* const XHatch& rTheHatch)
|*
|* Beschreibung
@@ -4255,7 +4257,7 @@ TYPEINIT1_AUTOFACTORY(XFillHatchItem, NameOrIndex);
|*
*************************************************************************/
-XFillHatchItem::XFillHatchItem(long nIndex,
+XFillHatchItem::XFillHatchItem(INT32 nIndex,
const XHatch& rTheHatch) :
NameOrIndex(XATTR_FILLHATCH, nIndex),
aHatch(rTheHatch)
@@ -5258,7 +5260,7 @@ TYPEINIT1_AUTOFACTORY(XFormTextShadowColorItem, XColorItem);
|*
*************************************************************************/
-XFormTextShadowColorItem::XFormTextShadowColorItem(long nIndex,
+XFormTextShadowColorItem::XFormTextShadowColorItem(INT32 nIndex,
const Color& rTheColor) :
XColorItem(XATTR_FORMTXTSHDWCOLOR, nIndex, rTheColor)
{
diff --git a/svx/util/makefile.mk b/svx/util/makefile.mk
index f3e180140cdd..a751cfdd20ac 100644
--- a/svx/util/makefile.mk
+++ b/svx/util/makefile.mk
@@ -125,6 +125,7 @@ SHL1STDLIBS= \
$(UNOTOOLSLIB) \
$(TOOLSLIB) \
$(I18NISOLANGLIB) \
+ $(I18NPAPERLIB) \
$(XMLSCRIPTLIB) \
$(COMPHELPERLIB) \
$(UCBHELPERLIB) \
@@ -174,7 +175,8 @@ SHL2STDLIBS= \
$(CPPULIB) \
$(VOSLIB) \
$(SALLIB) \
- $(JVMFWKLIB)
+ $(JVMFWKLIB) \
+ $(ICUUCLIB)
.IF "$(debug)$(dbgutil)"!=""
SHL2STDLIBS += $(CPPUHELPERLIB)
diff --git a/svx/util/makefile.pmk b/svx/util/makefile.pmk
index 27f185e936bd..b2aae3329111 100644
--- a/svx/util/makefile.pmk
+++ b/svx/util/makefile.pmk
@@ -36,4 +36,12 @@ CDEFS += -DSVX_DLLIMPLEMENTATION
CFLAGS+=-DENABLE_GTK
.ENDIF
+.IF "$(ENABLE_KDE)" != ""
+CFLAGS+=-DENABLE_KDE
+.ENDIF
+
+.IF "$(ENABLE_KDE4)" != ""
+CFLAGS+=-DENABLE_KDE4
+.ENDIF
+
VISIBILITY_HIDDEN=TRUE
diff --git a/sysui/desktop/solaris/makefile.mk b/sysui/desktop/solaris/makefile.mk
index 9a2c606f6264..32dc11be96a9 100644
--- a/sysui/desktop/solaris/makefile.mk
+++ b/sysui/desktop/solaris/makefile.mk
@@ -49,7 +49,7 @@ TARGET=solaris
PKGFILES = $(BIN)$/pkg$/{$(PRODUCTLIST)}-desktop-integration.tar.gz
PKGDATESTRING = $(shell @date -u +%Y.%m.%d)
-PKGARCH=sparc,i386
+PKGARCH=all
FASPAC=`test -f $(SOLARBINDIR)/faspac-so.sh && echo "/sbin/sh" || echo "echo"`
@@ -125,7 +125,9 @@ $(PKGFILES) : $(MISC)$/{$(PRODUCTLIST)}$/prototype
@-$(RM) $(BIN)$/$(@:f)
@$(MKDIRHIER) $(@:d)
pkgmk -l 1073741824 -r . -f $(MISC)$/$(@:b:b:s/-/ /:1)$/prototype -o -d $(PKGDIR) ARCH=$(PKGARCH) VERSION=$(PKGVERSION.$(@:b:s/-/ /:1)),REV=$(PKGREV).$(PKGDATESTRING)
+.IF "$(DONTCOMPRESS)"==""
$(FASPAC) $(SOLARBINDIR)/faspac-so.sh -a -d $(PKGDIR) $(@:b:b:s/-/ /:1:s/.//)$(PRODUCTVERSIONSHORT)-desktop-int
+.ENDIF # "$(DONTCOMPRESS)"==""
@tar -cf - -C $(PKGDIR) $(@:b:b:s/-/ /:1:s/.//)$(PRODUCTVERSIONSHORT)-desktop-int | gzip > $@
@rm -rf $(PKGDIR)/$(@:b:b:s/-/ /:1:s/.//)$(PRODUCTVERSIONSHORT)-desktop-int
diff --git a/sysui/desktop/solaris/pkginfo b/sysui/desktop/solaris/pkginfo
index 8fbf60ec812f..4f7f42df8341 100644
--- a/sysui/desktop/solaris/pkginfo
+++ b/sysui/desktop/solaris/pkginfo
@@ -11,3 +11,6 @@ SUNW_PKGVERS=1.0
CLASSES=none build
OFFICE_PATH=
LEGACY_GNOME="false"
+DESC=Desktop integration for %PRODUCTNAME
+SUNW_PRODNAME=%PRODUCTNAME
+SUNW_PRODVERS=3
diff --git a/sysui/prj/build.lst b/sysui/prj/build.lst
index 151595eaea56..9f6934e2352a 100644
--- a/sysui/prj/build.lst
+++ b/sysui/prj/build.lst
@@ -1,4 +1,4 @@
-su sysui : offapi xml2cmp rdbmaker transex3 setup_native NULL
+su sysui : l10n offapi xml2cmp rdbmaker transex3 setup_native NULL
su sysui\source\win32\QuickStart nmake - w su_win32_quickstart NULL
su sysui\source\win32\QuickStart\so nmake - w su_win32_quickstart_so su_win32_quickstart.w NULL
su sysui\desktop\icons nmake - w su_iconsw NULL
diff --git a/sysui/util/checksize.pl b/sysui/util/checksize.pl
index ea0def46d5b5..808442d91a18 100644
--- a/sysui/util/checksize.pl
+++ b/sysui/util/checksize.pl
@@ -82,8 +82,8 @@ sub check #04.02.2005 13:40
my $path = shift;
my $file = shift;
print "$path$file\n" if ((-e "$path$file") && $is_debug);
- # don't check dpc,flag,rpmflag, [obj for UNX] files, or etc subdirectory
- return if ( ($file =~ /.+\.(dpc|\w*?flag)/) || ($file =~ /.+\.obj/ && $ENV{GUI} eq 'UNX') || ($path =~ /.+etc/) || ($path =~ /.+logs/) );
+ # don't check dpc,flag,rpmflag,sdf [obj for UNX] files, or etc subdirectory
+ return if ( ($file =~ /.+\.(dpc|\w*?flag)/) || ($file =~ /.+\.obj/ && $ENV{GUI} eq 'UNX') || ($path =~ /.+etc/) || ($path =~ /.+logs/) || ($path =~ /.+sdf/) );
if ( -z "$path$file" ) {
print "Error: $path$file 0 Bytes!\n";
$err++;
diff --git a/ucb/source/ucp/file/bc.cxx b/ucb/source/ucp/file/bc.cxx
index 30aa5bd96b25..beb366b07ca5 100644
--- a/ucb/source/ucp/file/bc.cxx
+++ b/ucb/source/ucp/file/bc.cxx
@@ -607,7 +607,7 @@ BaseContent::addProperty(
{
if( ( m_nState & JustInserted ) || ( m_nState & Deleted ) || Name == rtl::OUString() )
{
- throw lang::IllegalArgumentException();
+ throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 );
}
m_pMyShell->associate( m_aUncPath,Name,DefaultValue,Attributes );
@@ -623,7 +623,7 @@ BaseContent::removeProperty(
{
if( m_nState & Deleted )
- throw beans::UnknownPropertyException();
+ throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
m_pMyShell->deassociate( m_aUncPath, Name );
}
@@ -792,7 +792,7 @@ BaseContent::setParent(
throw( lang::NoSupportException,
RuntimeException)
{
- throw lang::NoSupportException();
+ throw lang::NoSupportException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
@@ -973,12 +973,12 @@ BaseContent::setPropertyValues(
rtl::OUString NewTitle;
if( !( Values[i].Value >>= NewTitle ) )
{
- ret[i] <<= beans::IllegalTypeException();
+ ret[i] <<= beans::IllegalTypeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
break;
}
else if( ! NewTitle.getLength() )
{
- ret[i] <<= lang::IllegalArgumentException();
+ ret[i] <<= lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 );
break;
}
diff --git a/ucb/source/ucp/file/filcmd.cxx b/ucb/source/ucp/file/filcmd.cxx
index 5f7574514d80..92001b2dc0e0 100644
--- a/ucb/source/ucp/file/filcmd.cxx
+++ b/ucb/source/ucp/file/filcmd.cxx
@@ -100,7 +100,7 @@ XCommandInfo_impl::getCommandInfoByName(
if( m_pMyShell->m_sCommandInfo[i].Name == aName )
return m_pMyShell->m_sCommandInfo[i];
- throw UnsupportedCommandException();
+ throw UnsupportedCommandException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
@@ -114,7 +114,7 @@ XCommandInfo_impl::getCommandInfoByHandle(
if( m_pMyShell->m_sCommandInfo[i].Handle == Handle )
return m_pMyShell->m_sCommandInfo[i];
- throw UnsupportedCommandException();
+ throw UnsupportedCommandException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
diff --git a/ucb/source/ucp/file/filglob.cxx b/ucb/source/ucp/file/filglob.cxx
index 77d3a7d4d790..25095a4f9082 100644
--- a/ucb/source/ucp/file/filglob.cxx
+++ b/ucb/source/ucp/file/filglob.cxx
@@ -66,6 +66,7 @@
using namespace ucbhelper;
using namespace osl;
+using namespace ::com::sun::star;
using namespace com::sun::star::task;
using namespace com::sun::star::beans;
using namespace com::sun::star::lang;
@@ -277,7 +278,7 @@ namespace fileaccess {
if( errorCode == TASKHANDLER_UNSUPPORTED_COMMAND )
{
- aAny <<= UnsupportedCommandException();
+ aAny <<= UnsupportedCommandException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
cancelCommandExecution( aAny,xEnv );
}
else if( errorCode == TASKHANDLING_WRONG_SETPROPERTYVALUES_ARGUMENT ||
diff --git a/ucb/source/ucp/file/filinpstr.cxx b/ucb/source/ucp/file/filinpstr.cxx
index f234914687ab..acd7b4a11421 100644
--- a/ucb/source/ucp/file/filinpstr.cxx
+++ b/ucb/source/ucp/file/filinpstr.cxx
@@ -153,7 +153,7 @@ XInputStream_impl::readBytes(
io::IOException,
uno::RuntimeException)
{
- if( ! m_nIsOpen ) throw io::IOException();
+ if( ! m_nIsOpen ) throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
aData.realloc(nBytesToRead);
//TODO! translate memory exhaustion (if it were detectable...) into
@@ -162,7 +162,7 @@ XInputStream_impl::readBytes(
sal_uInt64 nrc(0);
if(m_aFile.read( aData.getArray(),sal_uInt64(nBytesToRead),nrc )
!= osl::FileBase::E_None)
- throw io::IOException();
+ throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
// Shrink aData in case we read less than nBytesToRead (XInputStream
// documentation does not tell whether this is required, and I do not know
@@ -219,7 +219,7 @@ XInputStream_impl::closeInput(
{
osl::FileBase::RC err = m_aFile.close();
if( err != osl::FileBase::E_None )
- throw io::IOException();
+ throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
m_nIsOpen = false;
}
}
@@ -233,9 +233,9 @@ XInputStream_impl::seek(
uno::RuntimeException )
{
if( location < 0 )
- throw lang::IllegalArgumentException();
+ throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 );
if( osl::FileBase::E_None != m_aFile.setPos( Pos_Absolut, sal_uInt64( location ) ) )
- throw io::IOException();
+ throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
@@ -247,7 +247,7 @@ XInputStream_impl::getPosition(
{
sal_uInt64 uPos;
if( osl::FileBase::E_None != m_aFile.getPos( uPos ) )
- throw io::IOException();
+ throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
return sal_Int64( uPos );
}
@@ -259,7 +259,7 @@ XInputStream_impl::getLength(
{
sal_uInt64 uEndPos;
if ( m_aFile.getSize(uEndPos) != osl::FileBase::E_None )
- throw io::IOException();
+ throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
else
return sal_Int64( uEndPos );
}
diff --git a/ucb/source/ucp/file/filprp.cxx b/ucb/source/ucp/file/filprp.cxx
index aae5e073ba84..39ff82d95909 100644
--- a/ucb/source/ucp/file/filprp.cxx
+++ b/ucb/source/ucp/file/filprp.cxx
@@ -129,7 +129,7 @@ XPropertySetInfo_impl::getPropertyByName(
for( sal_Int32 i = 0; i < m_seq.getLength(); ++i )
if( m_seq[i].Name == aName ) return m_seq[i];
- throw beans::UnknownPropertyException();
+ throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
diff --git a/ucb/source/ucp/file/filrow.cxx b/ucb/source/ucp/file/filrow.cxx
index 1f646fe9ee38..62085b58ecc8 100644
--- a/ucb/source/ucp/file/filrow.cxx
+++ b/ucb/source/ucp/file/filrow.cxx
@@ -153,7 +153,7 @@ XRow_impl::getString(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
- throw sdbc::SQLException();
+ throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
rtl::OUString Value;
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<rtl::OUString>( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@@ -167,7 +167,7 @@ XRow_impl::getBoolean(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
- throw sdbc::SQLException();
+ throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
sal_Bool Value( false );
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<sal_Bool>( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@@ -182,7 +182,7 @@ XRow_impl::getByte(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
- throw sdbc::SQLException();
+ throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
sal_Int8 Value( 0 );
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<sal_Int8>( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@@ -196,7 +196,7 @@ XRow_impl::getShort(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
- throw sdbc::SQLException();
+ throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
sal_Int16 Value( 0 );
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<sal_Int16>( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@@ -211,7 +211,7 @@ XRow_impl::getInt(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
- throw sdbc::SQLException();
+ throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
sal_Int32 Value( 0 );
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<sal_Int32>( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@@ -225,7 +225,7 @@ XRow_impl::getLong(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
- throw sdbc::SQLException();
+ throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
sal_Int64 Value( 0 );
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<sal_Int64>( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@@ -239,7 +239,7 @@ XRow_impl::getFloat(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
- throw sdbc::SQLException();
+ throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
float Value( 0 );
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<float>( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@@ -253,7 +253,7 @@ XRow_impl::getDouble(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
- throw sdbc::SQLException();
+ throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
double Value( 0 );
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<double>( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@@ -267,7 +267,7 @@ XRow_impl::getBytes(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
- throw sdbc::SQLException();
+ throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
uno::Sequence< sal_Int8 > Value(0);
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<uno::Sequence< sal_Int8 > >( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@@ -281,7 +281,7 @@ XRow_impl::getDate(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
- throw sdbc::SQLException();
+ throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
util::Date Value;
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<util::Date>( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@@ -295,7 +295,7 @@ XRow_impl::getTime(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
- throw sdbc::SQLException();
+ throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
util::Time Value;
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<util::Time>( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@@ -309,7 +309,7 @@ XRow_impl::getTimestamp(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
- throw sdbc::SQLException();
+ throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
util::DateTime Value;
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<util::DateTime>( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@@ -324,7 +324,7 @@ XRow_impl::getBinaryStream(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
- throw sdbc::SQLException();
+ throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
uno::Reference< io::XInputStream > Value;
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<uno::Reference< io::XInputStream > >( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@@ -339,7 +339,7 @@ XRow_impl::getCharacterStream(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
- throw sdbc::SQLException();
+ throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
uno::Reference< io::XInputStream > Value;
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert< uno::Reference< io::XInputStream> >( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@@ -355,7 +355,7 @@ XRow_impl::getObject(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
- throw sdbc::SQLException();
+ throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
uno::Any Value;
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<uno::Any>( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@@ -369,7 +369,7 @@ XRow_impl::getRef(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
- throw sdbc::SQLException();
+ throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
uno::Reference< sdbc::XRef > Value;
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<uno::Reference< sdbc::XRef> >( m_pMyShell,
@@ -386,7 +386,7 @@ XRow_impl::getBlob(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
- throw sdbc::SQLException();
+ throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
uno::Reference< sdbc::XBlob > Value;
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<uno::Reference< sdbc::XBlob> >( m_pMyShell,
@@ -403,7 +403,7 @@ XRow_impl::getClob(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
- throw sdbc::SQLException();
+ throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
uno::Reference< sdbc::XClob > Value;
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<uno::Reference< sdbc::XClob> >( m_pMyShell,
@@ -421,7 +421,7 @@ XRow_impl::getArray(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
- throw sdbc::SQLException();
+ throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
uno::Reference< sdbc::XArray > Value;
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<uno::Reference< sdbc::XArray> >( m_pMyShell,
diff --git a/ucb/source/ucp/file/filrset.cxx b/ucb/source/ucp/file/filrset.cxx
index 334e74e79726..c8efb6bf37c7 100644
--- a/ucb/source/ucp/file/filrset.cxx
+++ b/ucb/source/ucp/file/filrset.cxx
@@ -355,7 +355,7 @@ XResultSet_impl::OneMore(
}
else // error fetching anything
{
- throw sdbc::SQLException();
+ throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
}
}
}
@@ -513,7 +513,7 @@ XResultSet_impl::relative(
uno::RuntimeException)
{
if( isAfterLast() || isBeforeFirst() )
- throw sdbc::SQLException();
+ throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
if( row > 0 )
while( row-- ) next();
else if( row < 0 )
@@ -665,7 +665,7 @@ XResultSet_impl::getStaticResultSet()
osl::MutexGuard aGuard( m_aMutex );
if ( m_xListener.is() )
- throw ucb::ListenerAlreadySetException();
+ throw ucb::ListenerAlreadySetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
return uno::Reference< sdbc::XResultSet >( this );
}
@@ -681,7 +681,7 @@ XResultSet_impl::setListener(
osl::ClearableMutexGuard aGuard( m_aMutex );
if ( m_xListener.is() )
- throw ucb::ListenerAlreadySetException();
+ throw ucb::ListenerAlreadySetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
m_xListener = Listener;
@@ -724,9 +724,9 @@ XResultSet_impl::connectToCache(
= m_pMyShell->m_xMultiServiceFactory;
if( m_xListener.is() )
- throw ucb::ListenerAlreadySetException();
+ throw ucb::ListenerAlreadySetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
if( m_bStatic )
- throw ucb::ListenerAlreadySetException();
+ throw ucb::ListenerAlreadySetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
uno::Reference< ucb::XSourceInitialization > xTarget(
xCache, uno::UNO_QUERY );
@@ -753,7 +753,7 @@ XResultSet_impl::connectToCache(
return;
}
}
- throw ucb::ServiceNotFoundException();
+ throw ucb::ServiceNotFoundException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
//=========================================================================
@@ -838,7 +838,7 @@ void SAL_CALL XResultSet_impl::setPropertyValue(
if( aPropertyName == rtl::OUString::createFromAscii( "IsRowCountFinal" ) ||
aPropertyName == rtl::OUString::createFromAscii( "RowCount" ) )
return;
- throw beans::UnknownPropertyException();
+ throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
@@ -862,7 +862,7 @@ uno::Any SAL_CALL XResultSet_impl::getPropertyValue(
return aAny;
}
else
- throw beans::UnknownPropertyException();
+ throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
@@ -891,7 +891,7 @@ void SAL_CALL XResultSet_impl::addPropertyChangeListener(
m_pRowCountListeners->addInterface( xListener );
}
else
- throw beans::UnknownPropertyException();
+ throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
@@ -916,7 +916,7 @@ void SAL_CALL XResultSet_impl::removePropertyChangeListener(
m_pRowCountListeners->removeInterface( aListener );
}
else
- throw beans::UnknownPropertyException();
+ throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
void SAL_CALL XResultSet_impl::addVetoableChangeListener(
diff --git a/ucb/source/ucp/file/filstr.cxx b/ucb/source/ucp/file/filstr.cxx
index 4c560acb238f..4ba4ff5c2b7e 100644
--- a/ucb/source/ucp/file/filstr.cxx
+++ b/ucb/source/ucp/file/filstr.cxx
@@ -189,10 +189,10 @@ void SAL_CALL XStream_impl::truncate(void)
throw( io::IOException, uno::RuntimeException )
{
if (osl::FileBase::E_None != m_aFile.setSize(0))
- throw io::IOException();
+ throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
if (osl::FileBase::E_None != m_aFile.setPos(Pos_Absolut,sal_uInt64(0)))
- throw io::IOException();
+ throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
@@ -211,7 +211,7 @@ XStream_impl::readBytes(
uno::RuntimeException)
{
if( ! m_nIsOpen )
- throw io::IOException();
+ throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
sal_Int8 * buffer;
try
@@ -221,7 +221,7 @@ XStream_impl::readBytes(
catch( std::bad_alloc )
{
if( m_nIsOpen ) m_aFile.close();
- throw io::BufferSizeExceededException();
+ throw io::BufferSizeExceededException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
sal_uInt64 nrc(0);
@@ -229,7 +229,7 @@ XStream_impl::readBytes(
!= osl::FileBase::E_None)
{
delete[] buffer;
- throw io::IOException();
+ throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
aData = uno::Sequence< sal_Int8 > ( buffer, (sal_uInt32)nrc );
delete[] buffer;
@@ -287,7 +287,7 @@ XStream_impl::writeBytes( const uno::Sequence< sal_Int8 >& aData )
const sal_Int8* p = aData.getConstArray();
if(osl::FileBase::E_None != m_aFile.write(((void*)(p)),sal_uInt64(length),nWrittenBytes) ||
nWrittenBytes != length )
- throw io::IOException();
+ throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
}
@@ -352,9 +352,9 @@ XStream_impl::seek(
uno::RuntimeException )
{
if( location < 0 )
- throw lang::IllegalArgumentException();
+ throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 );
if( osl::FileBase::E_None != m_aFile.setPos( Pos_Absolut, sal_uInt64( location ) ) )
- throw io::IOException();
+ throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
@@ -366,7 +366,7 @@ XStream_impl::getPosition(
{
sal_uInt64 uPos;
if( osl::FileBase::E_None != m_aFile.getPos( uPos ) )
- throw io::IOException();
+ throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
return sal_Int64( uPos );
}
@@ -378,7 +378,7 @@ XStream_impl::getLength(
{
sal_uInt64 uEndPos;
if ( m_aFile.getSize(uEndPos) != osl::FileBase::E_None )
- throw io::IOException();
+ throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
else
return sal_Int64( uEndPos );
}
diff --git a/ucb/source/ucp/file/filtask.cxx b/ucb/source/ucp/file/filtask.cxx
index a6293cff03e0..57c165b0b9b0 100644
--- a/ucb/source/ucp/file/filtask.cxx
+++ b/ucb/source/ucp/file/filtask.cxx
@@ -70,7 +70,7 @@ TaskManager::startTask(
TaskMap::iterator it = m_aTaskMap.find( CommandId );
if( it != m_aTaskMap.end() )
{
- throw DuplicateCommandIdentifierException();
+ throw DuplicateCommandIdentifierException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
m_aTaskMap[ CommandId ] = TaskHandling( xCommandEnv );
}
diff --git a/ucb/source/ucp/file/prov.cxx b/ucb/source/ucp/file/prov.cxx
index 4bebc8cf01c1..08da75ebdeb9 100644
--- a/ucb/source/ucp/file/prov.cxx
+++ b/ucb/source/ucp/file/prov.cxx
@@ -343,7 +343,7 @@ FileProvider::queryContent(
aUnc );
if( err )
- throw IllegalIdentifierException();
+ throw IllegalIdentifierException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
return Reference< XContent >( new BaseContent( m_pMyShell,xIdentifier,aUnc ) );
}
@@ -534,7 +534,7 @@ XPropertySetInfoImpl2::getPropertyByName(
if( m_seq[i].Name == aName )
return m_seq[i];
- throw UnknownPropertyException();
+ throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
@@ -616,7 +616,7 @@ FileProvider::setPropertyValue( const rtl::OUString& aPropertyName,
aPropertyName.compareToAscii( "HostName" ) == 0 )
return;
else
- throw UnknownPropertyException();
+ throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
@@ -648,7 +648,7 @@ FileProvider::getPropertyValue(
return aAny;
}
else
- throw UnknownPropertyException();
+ throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
diff --git a/ucb/source/ucp/file/shell.cxx b/ucb/source/ucp/file/shell.cxx
index e070f091363d..f53873563c99 100644
--- a/ucb/source/ucp/file/shell.cxx
+++ b/ucb/source/ucp/file/shell.cxx
@@ -494,7 +494,7 @@ shell::associate( const rtl::OUString& aUnqPath,
shell::PropertySet::iterator it1 = m_aDefaultProperties.find( newProperty );
if( it1 != m_aDefaultProperties.end() )
- throw beans::PropertyExistException();
+ throw beans::PropertyExistException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
{
osl::MutexGuard aGuard( m_aMutex );
@@ -507,7 +507,7 @@ shell::associate( const rtl::OUString& aUnqPath,
PropertySet& properties = *(it->second.properties);
it1 = properties.find( newProperty );
if( it1 != properties.end() )
- throw beans::PropertyExistException();
+ throw beans::PropertyExistException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
// Property does not exist
properties.insert( newProperty );
@@ -530,7 +530,7 @@ shell::deassociate( const rtl::OUString& aUnqPath,
shell::PropertySet::iterator it1 = m_aDefaultProperties.find( oldProperty );
if( it1 != m_aDefaultProperties.end() )
- throw beans::NotRemoveableException();
+ throw beans::NotRemoveableException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
osl::MutexGuard aGuard( m_aMutex );
@@ -542,7 +542,7 @@ shell::deassociate( const rtl::OUString& aUnqPath,
it1 = properties.find( oldProperty );
if( it1 == properties.end() )
- throw beans::UnknownPropertyException();
+ throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
properties.erase( it1 );
@@ -838,7 +838,7 @@ shell::setv( const rtl::OUString& aUnqPath,
it1 = properties.find( toset );
if( it1 == properties.end() )
{
- ret[i] <<= beans::UnknownPropertyException();
+ ret[i] <<= beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
continue;
}
@@ -848,7 +848,7 @@ shell::setv( const rtl::OUString& aUnqPath,
if( it1->getAttributes() & beans::PropertyAttribute::READONLY )
{
- ret[i] <<= lang::IllegalAccessException();
+ ret[i] <<= lang::IllegalAccessException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
continue;
}
@@ -919,7 +919,7 @@ shell::setv( const rtl::OUString& aUnqPath,
}
}
else
- ret[i] <<= beans::IllegalTypeException();
+ ret[i] <<= beans::IllegalTypeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
else if(values[i].Name == IsReadOnly ||
values[i].Name == IsHidden)
@@ -1027,7 +1027,7 @@ shell::setv( const rtl::OUString& aUnqPath,
}
}
else
- ret[i] <<= beans::IllegalTypeException();
+ ret[i] <<= beans::IllegalTypeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
}
} // end for
diff --git a/uui/prj/build.lst b/uui/prj/build.lst
index 500a4fc8cd0c..0ebacfcb814f 100644
--- a/uui/prj/build.lst
+++ b/uui/prj/build.lst
@@ -1,4 +1,4 @@
-uu uui : svtools NULL
+uu uui : l10n svtools NULL
uu uui usr1 - all uu_mkout NULL
uu uui\source nmake - all uu_source NULL
uu uui\util nmake - all uu_util uu_source NULL
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index 30a4d0f48c94..62de20f87a74 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -63,6 +63,7 @@
#include "com/sun/star/task/XInteractionHandler.hpp"
#include "com/sun/star/task/XInteractionHandler2.hpp"
#include "com/sun/star/task/DocumentPasswordRequest.hpp"
+#include "com/sun/star/task/DocumentMSPasswordRequest.hpp"
#include "com/sun/star/task/ErrorCodeIOException.hpp"
#include "com/sun/star/task/ErrorCodeRequest.hpp"
#include "com/sun/star/task/MasterPasswordRequest.hpp"
@@ -1132,6 +1133,15 @@ bool UUIInteractionHelper::handleDialogRequests(
return true;
}
+ star::task::DocumentMSPasswordRequest aDocumentMSPasswordRequest;
+ if (aAnyRequest >>= aDocumentMSPasswordRequest)
+ {
+ handleMSPasswordRequest(aDocumentMSPasswordRequest.Mode,
+ rRequest->getContinuations(),
+ aDocumentMSPasswordRequest.Name);
+ return true;
+ }
+
star::task::PasswordRequest aPasswordRequest;
if (aAnyRequest >>= aPasswordRequest)
{
@@ -1839,6 +1849,48 @@ UUIInteractionHelper::executePasswordDialog(
}
void
+UUIInteractionHelper::executeMSPasswordDialog(
+ LoginErrorInfo & rInfo,
+ star::task::PasswordRequestMode nMode,
+ ::rtl::OUString aDocName)
+ SAL_THROW((star::uno::RuntimeException))
+{
+ try
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ std::auto_ptr< ResMgr >
+ xManager(ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ if( nMode == star::task::PasswordRequestMode_PASSWORD_CREATE )
+ {
+ std::auto_ptr< PasswordCreateDialog >
+ xDialog(new PasswordCreateDialog(
+ getParentProperty(), xManager.get(), true));
+
+ rInfo.SetResult(xDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK :
+ ERRCODE_BUTTON_CANCEL);
+ rInfo.SetPassword( xDialog->GetPassword() );
+ }
+ else
+ {
+ std::auto_ptr< PasswordDialog >
+ xDialog(new PasswordDialog(
+ getParentProperty(), nMode, xManager.get(), aDocName ));
+
+ rInfo.SetResult(xDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK :
+ ERRCODE_BUTTON_CANCEL);
+ rInfo.SetPassword( xDialog->GetPassword() );
+ }
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw star::uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ star::uno::Reference< star::uno::XInterface>());
+ }
+}
+
+void
UUIInteractionHelper::executeCookieDialog(CntHTTPCookieRequest & rRequest)
SAL_THROW((star::uno::RuntimeException))
{
@@ -2558,6 +2610,47 @@ UUIInteractionHelper::handlePasswordRequest(
}
void
+UUIInteractionHelper::handleMSPasswordRequest(
+ star::task::PasswordRequestMode nMode,
+ star::uno::Sequence< star::uno::Reference<
+ star::task::XInteractionContinuation > > const &
+ rContinuations,
+ ::rtl::OUString aDocumentName )
+ SAL_THROW((star::uno::RuntimeException))
+{
+ star::uno::Reference< star::task::XInteractionRetry > xRetry;
+ star::uno::Reference< star::task::XInteractionAbort > xAbort;
+ star::uno::Reference< star::task::XInteractionPassword >
+ xPassword;
+ getContinuations(
+ rContinuations, 0, 0, &xRetry, &xAbort, 0, &xPassword, 0, 0);
+ LoginErrorInfo aInfo;
+
+ executeMSPasswordDialog(aInfo, nMode, aDocumentName);
+
+ switch (aInfo.GetResult())
+ {
+ case ERRCODE_BUTTON_OK:
+ if (xPassword.is())
+ {
+ xPassword->setPassword(aInfo.GetPassword());
+ xPassword->select();
+ }
+ break;
+
+ case ERRCODE_BUTTON_RETRY:
+ if (xRetry.is())
+ xRetry->select();
+ break;
+
+ default:
+ if (xAbort.is())
+ xAbort->select();
+ break;
+ }
+}
+
+void
UUIInteractionHelper::handleCookiesRequest(
star::ucb::HandleCookiesRequest const & rRequest,
star::uno::Sequence< star::uno::Reference<
diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx
index 8b53b071a629..4053f919bf7b 100644
--- a/uui/source/iahndl.hxx
+++ b/uui/source/iahndl.hxx
@@ -201,6 +201,12 @@ private:
::rtl::OUString aDocumentName)
SAL_THROW((com::sun::star::uno::RuntimeException));
+ void
+ executeMSPasswordDialog(LoginErrorInfo & rInfo,
+ com::sun::star::task::PasswordRequestMode nMode,
+ ::rtl::OUString aDocumentName)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
void executeCookieDialog(CntHTTPCookieRequest & rRequest)
SAL_THROW((com::sun::star::uno::RuntimeException));
@@ -280,6 +286,16 @@ private:
::rtl::OUString aDocumentName = ::rtl::OUString())
SAL_THROW((com::sun::star::uno::RuntimeException));
+ void
+ handleMSPasswordRequest(
+ com::sun::star::task::PasswordRequestMode nMode,
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > const &
+ rContinuations,
+ ::rtl::OUString aDocumentName = ::rtl::OUString())
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
void
handleCookiesRequest(
com::sun::star::ucb::HandleCookiesRequest const & rRequest,
diff --git a/uui/source/passcrtdlg.cxx b/uui/source/passcrtdlg.cxx
index a57255cddefe..636cd4510ecc 100644
--- a/uui/source/passcrtdlg.cxx
+++ b/uui/source/passcrtdlg.cxx
@@ -69,19 +69,19 @@ IMPL_LINK( PasswordCreateDialog, OKHdl_Impl, OKButton *, EMPTYARG )
// -----------------------------------------------------------------------
-PasswordCreateDialog::PasswordCreateDialog( Window* _pParent, ResMgr * pResMgr )
+PasswordCreateDialog::PasswordCreateDialog( Window* _pParent, ResMgr * pResMgr, bool bMSCryptoMode)
:ModalDialog( _pParent, ResId( DLG_UUI_PASSWORD_CRT, *pResMgr ) )
,aFTPasswordCrt ( this, ResId( FT_PASSWORD_CRT, *pResMgr ) )
,aEDPasswordCrt ( this, ResId( ED_PASSWORD_CRT, *pResMgr ) )
,aFTPasswordRepeat ( this, ResId( FT_PASSWORD_REPEAT, *pResMgr ) )
,aEDPasswordRepeat ( this, ResId( ED_PASSWORD_REPEAT, *pResMgr ) )
- ,aFTWarning ( this, ResId( FT_PASSWORD_WARNING, *pResMgr ) )
+ ,aFTWarning ( this, ResId( bMSCryptoMode ? FT_MSPASSWORD_WARNING : FT_PASSWORD_WARNING, *pResMgr ) )
,aFixedLine1 ( this, ResId( FL_FIXED_LINE_1, *pResMgr ) )
,aOKBtn ( this, ResId( BTN_PASSCRT_OK, *pResMgr ) )
,aCancelBtn ( this, ResId( BTN_PASSCRT_CANCEL, *pResMgr ) )
,aHelpBtn ( this, ResId( BTN_PASSCRT_HELP, *pResMgr ) )
,pResourceMgr ( pResMgr )
- ,nMinLen(5)
+ ,nMinLen( bMSCryptoMode ? 1 : 5 )
{
FreeResource();
@@ -90,6 +90,12 @@ PasswordCreateDialog::PasswordCreateDialog( Window* _pParent, ResMgr * pResMgr )
aOKBtn.Enable( sal_False );
+ if ( bMSCryptoMode )
+ {
+ aEDPasswordCrt.SetMaxTextLen( 15 );
+ aEDPasswordRepeat.SetMaxTextLen( 15 );
+ }
+
long nLabelWidth = aFTWarning.GetSizePixel().Width();
long nLabelHeight = aFTWarning.GetSizePixel().Height();
long nTextWidth = aFTWarning.GetCtrlTextWidth( aFTWarning.GetText() );
diff --git a/uui/source/passcrtdlg.hrc b/uui/source/passcrtdlg.hrc
index 4c10fa92fddd..54a09494e2ab 100644
--- a/uui/source/passcrtdlg.hrc
+++ b/uui/source/passcrtdlg.hrc
@@ -28,19 +28,20 @@
*
************************************************************************/
-#ifndef UUI_PASSCRTDLG_HRC
-#define UUI_PASSCRTDLG_HRC
+#ifndef UUI_PASSCRTDLG_HRC
+#define UUI_PASSCRTDLG_HRC
-// local identifiers
-#define BTN_PASSCRT_CANCEL 1
-#define ED_PASSWORD_CRT 2
-#define FT_PASSWORD_REPEAT 3
-#define FT_PASSWORD_WARNING 4
-#define ED_PASSWORD_REPEAT 5
-#define FL_FIXED_LINE_1 6
-#define BTN_PASSCRT_OK 7
-#define BTN_PASSCRT_HELP 8
-#define FT_PASSWORD_CRT 9
+// local identifiers
+#define BTN_PASSCRT_CANCEL 1
+#define ED_PASSWORD_CRT 2
+#define FT_PASSWORD_REPEAT 3
+#define FT_PASSWORD_WARNING 4
+#define ED_PASSWORD_REPEAT 5
+#define FL_FIXED_LINE_1 6
+#define BTN_PASSCRT_OK 7
+#define BTN_PASSCRT_HELP 8
+#define FT_PASSWORD_CRT 9
+#define FT_MSPASSWORD_WARNING 10
-#endif // UUI_PASSCRTDLG_HRC
+#endif // UUI_PASSCRTDLG_HRC
diff --git a/uui/source/passcrtdlg.hxx b/uui/source/passcrtdlg.hxx
index 0fefc10d09ba..b4f0f61644d6 100644
--- a/uui/source/passcrtdlg.hxx
+++ b/uui/source/passcrtdlg.hxx
@@ -58,7 +58,7 @@ class PasswordCreateDialog : public ModalDialog
DECL_LINK( EditHdl_Impl, Edit * );
public:
- PasswordCreateDialog( Window* pParent, ResMgr * pResMgr );
+ PasswordCreateDialog( Window* pParent, ResMgr * pResMgr, bool bMSCryptoMode = false );
String GetPassword() const { return aEDPasswordCrt.GetText(); }
};
diff --git a/uui/source/passcrtdlg.src b/uui/source/passcrtdlg.src
index cdfc9d380079..13f1ea688620 100644
--- a/uui/source/passcrtdlg.src
+++ b/uui/source/passcrtdlg.src
@@ -34,7 +34,7 @@
#include <ids.hrc>
#endif
#ifndef UUI_PASSCRTDLG_HRC
-#include "passcrtdlg.hrc"
+#include "passcrtdlg.hrc"
#endif
ModalDialog DLG_UUI_PASSWORD_CRT
@@ -44,61 +44,68 @@ ModalDialog DLG_UUI_PASSWORD_CRT
Moveable = TRUE ;
OutputSize = TRUE ;
SVLook = TRUE ;
- Size = MAP_APPFONT( 145, 129 );
+ Size = MAP_APPFONT( 145, 129 );
FixedText FT_PASSWORD_CRT
{
- Pos = MAP_APPFONT( 3, 4 );
- Size = MAP_APPFONT( 139, 9 );
- Text [ en-US ] = "Enter password";
+ Pos = MAP_APPFONT( 3, 4 );
+ Size = MAP_APPFONT( 139, 9 );
+ Text [ en-US ] = "Enter password";
};
Edit ED_PASSWORD_CRT
{
Border = TRUE ;
- Pos = MAP_APPFONT( 3, 17 );
+ Pos = MAP_APPFONT( 3, 17 );
Size = MAP_APPFONT( 139, 13 );
PassWord = TRUE ;
};
Edit ED_PASSWORD_REPEAT
{
Border = TRUE ;
- Pos = MAP_APPFONT( 3, 47 );
+ Pos = MAP_APPFONT( 3, 47 );
Size = MAP_APPFONT( 139, 13 );
PassWord = TRUE ;
};
OKButton BTN_PASSCRT_OK
{
- Pos = MAP_APPFONT( 27, 110 );
+ Pos = MAP_APPFONT( 27, 110 );
Size = MAP_APPFONT( 37, 15 );
DefButton = TRUE ;
};
CancelButton BTN_PASSCRT_CANCEL
{
- Pos = MAP_APPFONT( 66, 110 );
- Size = MAP_APPFONT( 37, 15 );
+ Pos = MAP_APPFONT( 66, 110 );
+ Size = MAP_APPFONT( 37, 15 );
};
HelpButton BTN_PASSCRT_HELP
{
- Pos = MAP_APPFONT( 105, 110 );
- Size = MAP_APPFONT( 37, 15 );
+ Pos = MAP_APPFONT( 105, 110 );
+ Size = MAP_APPFONT( 37, 15 );
};
- FixedText FT_PASSWORD_REPEAT
- {
- Pos = MAP_APPFONT( 3, 34 );
- Size = MAP_APPFONT( 139, 9 );
- Text [ en-US ] = "Reenter password";
- };
- FixedText FT_PASSWORD_WARNING
- {
- Pos = MAP_APPFONT( 4, 64 );
- Size = MAP_APPFONT( 137, 40 );
- Text [ en-US ] = "WARNING: If you lose or forget the password, it cannot be recovered. It is advisable to keep passwords in a safe place. Passwords are case-sensitive and at least five characters long.";
- WordBreak = TRUE;
- };
- FixedLine FL_FIXED_LINE_1
- {
- Pos = MAP_APPFONT( 0, 104 );
- Size = MAP_APPFONT( 145, 6 );
+ FixedText FT_PASSWORD_REPEAT
+ {
+ Pos = MAP_APPFONT( 3, 34 );
+ Size = MAP_APPFONT( 139, 9 );
+ Text [ en-US ] = "Reenter password";
+ };
+ FixedText FT_PASSWORD_WARNING
+ {
+ Pos = MAP_APPFONT( 4, 64 );
+ Size = MAP_APPFONT( 137, 40 );
+ Text [ en-US ] = "WARNING: If you lose or forget the password, it cannot be recovered. It is advisable to keep passwords in a safe place. Passwords are case-sensitive and at least five characters long.";
+ WordBreak = TRUE;
+ };
+ FixedText FT_MSPASSWORD_WARNING
+ {
+ Pos = MAP_APPFONT( 4, 64 );
+ Size = MAP_APPFONT( 137, 40 );
+ Text [ en-US ] = "WARNING: If you lose or forget the password, it cannot be recovered. It is advisable to keep passwords in a safe place. Passwords are case-sensitive and at most fifteen characters long.";
+ WordBreak = TRUE;
+ };
+ FixedLine FL_FIXED_LINE_1
+ {
+ Pos = MAP_APPFONT( 0, 104 );
+ Size = MAP_APPFONT( 145, 6 );
};
- Text [ en-US ] = "Enter Password";
+ Text [ en-US ] = "Enter Password";
};
diff --git a/uui/source/passworddlg.src b/uui/source/passworddlg.src
index d03814e81a41..41845b7488d1 100644
--- a/uui/source/passworddlg.src
+++ b/uui/source/passworddlg.src
@@ -44,46 +44,47 @@ ModalDialog DLG_UUI_PASSWORD
Moveable = TRUE ;
OutputSize = TRUE ;
SVLook = TRUE ;
- Size = MAP_APPFONT( 145, 75 );
- Text [ en-US ] = "Enter password";
+ Size = MAP_APPFONT( 145, 75 );
+ Text [ en-US ] = "Enter password";
FixedText FT_PASSWORD
{
- Pos = MAP_APPFONT( 3, 4 );
- Size = MAP_APPFONT( 139, 28 );
- Text [ en-US ] = "Enter password to open the file: \n";
- WordBreak = TRUE;
+ Pos = MAP_APPFONT( 3, 4 );
+ Size = MAP_APPFONT( 139, 28 );
+ Text [ en-US ] = "Enter password to open the file: \n";
+ WordBreak = TRUE;
};
-
+
Edit ED_PASSWORD
{
- Pos = MAP_APPFONT( 3, 35 );
- Size = MAP_APPFONT( 139, 13 );
+ Pos = MAP_APPFONT( 3, 35 );
+ Size = MAP_APPFONT( 139, 13 );
Border = TRUE ;
PassWord = TRUE ;
};
OKButton BTN_PASSWORD_OK
{
- Pos = MAP_APPFONT( 27, 56 );
- Size = MAP_APPFONT( 37, 15 );
+ Pos = MAP_APPFONT( 27, 56 );
+ Size = MAP_APPFONT( 37, 15 );
+ DefButton = TRUE ;
};
-
+
CancelButton BTN_PASSWORD_CANCEL
{
- Pos = MAP_APPFONT( 66, 56 );
- Size = MAP_APPFONT( 37, 15 );
+ Pos = MAP_APPFONT( 66, 56 );
+ Size = MAP_APPFONT( 37, 15 );
};
-
+
HelpButton BTN_PASSWORD_HELP
{
- Pos = MAP_APPFONT( 105, 56 );
- Size = MAP_APPFONT( 37, 15 );
- };
-
- FixedLine FL_FIXED_LINE_1
- {
- Pos = MAP_APPFONT( 0, 50 );
- Size = MAP_APPFONT( 145, 6 );
+ Pos = MAP_APPFONT( 105, 56 );
+ Size = MAP_APPFONT( 37, 15 );
+ };
+
+ FixedLine FL_FIXED_LINE_1
+ {
+ Pos = MAP_APPFONT( 0, 50 );
+ Size = MAP_APPFONT( 145, 6 );
};
};
diff --git a/xmlhelp/source/cxxhelp/provider/db.cxx b/xmlhelp/source/cxxhelp/provider/db.cxx
index 3cc9b6168076..e3129f8e94b5 100644
--- a/xmlhelp/source/cxxhelp/provider/db.cxx
+++ b/xmlhelp/source/cxxhelp/provider/db.cxx
@@ -39,8 +39,8 @@
#include "com/sun/star/io/XSeekable.hpp"
#ifdef TEST_DBHELP
-#include <osl/time.h>
-#endif
+#include <osl/time.h>
+#endif
using namespace com::sun::star;
using namespace com::sun::star::uno;
@@ -65,7 +65,7 @@ namespace db_internal
void DBData::copyToBuffer( const char* pSrcData, int nSize )
{
m_nSize = nSize;
- delete m_pBuffer;
+ delete [] m_pBuffer;
m_pBuffer = new char[m_nSize+1];
memcpy( m_pBuffer, pSrcData, m_nSize );
m_pBuffer[m_nSize] = 0;
@@ -111,10 +111,10 @@ void testWriteKeyValue( FILE* pFile, const KeyValPair& rKeyValPair )
int nValueLen = aValueStr.getLength();
fprintf( pFile, "%x ", nKeyLen );
if( nKeyLen > 0 )
- fwrite( aKeyStr.getStr(), 1, nKeyLen, pFile );
+ fwrite( aKeyStr.getStr(), 1, nKeyLen, pFile );
fprintf( pFile, " %x ", nValueLen );
if( nValueLen > 0 )
- fwrite( aValueStr.getStr(), 1, nValueLen, pFile );
+ fwrite( aValueStr.getStr(), 1, nValueLen, pFile );
fprintf( pFile, "%c", cLF );
}
@@ -178,9 +178,9 @@ bool DBHelp::testAgainstDb( const rtl::OString& fileName, bool bOldDbAccess )
const char* pTestReadData = NULL;
int nTestReadDataSize = 0;
- sal_uInt32 starttime = osl_getGlobalTimer();
- sal_uInt32 afterfirsttime = starttime;
-
+ sal_uInt32 starttime = osl_getGlobalTimer();
+ sal_uInt32 afterfirsttime = starttime;
+
if( pFile != NULL )
{
if( bOldDbAccess )
@@ -238,20 +238,20 @@ bool DBHelp::testAgainstDb( const rtl::OString& fileName, bool bOldDbAccess )
}
if( bFirst )
{
- afterfirsttime = osl_getGlobalTimer();
+ afterfirsttime = osl_getGlobalTimer();
bFirst = false;
}
int nError = 0;
if( bTestSuccess && pTestReadData != NULL )
{
- int nCmp = memcmp( ptr, pTestReadData, nValueLen );
- if( nCmp == 0 )
- ++nOkCount;
- else
- nError = 1;
-
+ int nCmp = memcmp( ptr, pTestReadData, nValueLen );
+ if( nCmp == 0 )
+ ++nOkCount;
+ else
+ nError = 1;
+
if( nValueLen != nTestReadDataSize )
- nError = 2;
+ nError = 2;
}
else
nError = 3;
@@ -266,14 +266,14 @@ bool DBHelp::testAgainstDb( const rtl::OString& fileName, bool bOldDbAccess )
fprintf( pFile, "ERROR, not found:\n" );
testWriteKeyValue( pFile, rKeyValPair );
fprintf( pFile, "\nError Code: %d\n", nError );
- }
+ }
}
}
tableTest.close( 0 );
- sal_uInt32 endtime = osl_getGlobalTimer();
- double dDiffTime = (endtime-starttime) / 1000.0;
- double dDiffFirstTime = (afterfirsttime-starttime) / 1000.0;
+ sal_uInt32 endtime = osl_getGlobalTimer();
+ double dDiffTime = (endtime-starttime) / 1000.0;
+ double dDiffFirstTime = (afterfirsttime-starttime) / 1000.0;
if( pFile != NULL )
{
int nCount = avKeyValPair.size();
@@ -397,8 +397,8 @@ bool DBHelp::getValueForKey( const rtl::OString& rKey, DBData& rValue )
Reference< XSeekable > xXSeekable( xIn, UNO_QUERY );
if( xXSeekable.is() )
{
- xXSeekable->seek( iValuePos );
-
+ xXSeekable->seek( iValuePos );
+
Sequence< sal_Int8 > aData;
sal_Int32 nRead = xIn->readBytes( aData, nValueLen );
if( nRead == nValueLen )
diff --git a/xmlhelp/source/cxxhelp/provider/db.hxx b/xmlhelp/source/cxxhelp/provider/db.hxx
index 7633e78b3425..e98cd9040cf7 100644
--- a/xmlhelp/source/cxxhelp/provider/db.hxx
+++ b/xmlhelp/source/cxxhelp/provider/db.hxx
@@ -108,7 +108,7 @@ namespace berkeleydbproxy {
, m_pBuffer( NULL )
{}
~DBData()
- { delete m_pBuffer; }
+ { delete [] m_pBuffer; }
int getSize() const
{ return m_nSize; }
diff --git a/xmloff/inc/RDFaExportHelper.hxx b/xmloff/inc/RDFaExportHelper.hxx
new file mode 100644
index 000000000000..f7a708b68a0a
--- /dev/null
+++ b/xmloff/inc/RDFaExportHelper.hxx
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * 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: RDFaExportHelper.hxx,v $
+ * $Revision: 1.1.2.1 $
+ *
+ * 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 RDFAEXPORTHELPER_HXX
+#define RDFAEXPORTHELPER_HXX
+
+#include <com/sun/star/uno/Reference.h>
+
+#include <rtl/ustring.hxx>
+
+#include <map>
+
+
+namespace com { namespace sun { namespace star {
+ namespace rdf { class XBlankNode; }
+ namespace rdf { class XMetadatable; }
+ namespace rdf { class XDocumentRepository; }
+} } }
+
+class SvXMLExport;
+
+namespace xmloff {
+
+class SAL_DLLPRIVATE RDFaExportHelper
+{
+private:
+ SvXMLExport & m_rExport;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XDocumentRepository> m_xRepository;
+
+ ::rtl::OUString m_RDFsLabel;
+
+ typedef ::std::map< ::rtl::OUString, ::rtl::OUString >
+ BlankNodeMap_t;
+
+ BlankNodeMap_t m_BlankNodeMap;
+
+ long m_Counter;
+
+ ::rtl::OUString
+ LookupBlankNode( ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XBlankNode> const & i_xBlankNode);
+
+public:
+ RDFaExportHelper(SvXMLExport & i_rExport);
+
+ void
+ AddRDFa(::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XMetadatable> const & i_xMetadatable);
+};
+
+} // namespace xmloff
+
+#endif // RDFAEXPORTHELPER_HXX
+
diff --git a/xmloff/inc/RDFaImportHelper.hxx b/xmloff/inc/RDFaImportHelper.hxx
new file mode 100644
index 000000000000..c038917597c8
--- /dev/null
+++ b/xmloff/inc/RDFaImportHelper.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * 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: RDFaImportHelper.hxx,v $
+ * $Revision: 1.1.2.1 $
+ *
+ * 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 RDFAIMPORTHELPER_HXX
+#define RDFAIMPORTHELPER_HXX
+
+#include <com/sun/star/uno/Reference.h>
+
+#include <vector>
+
+
+namespace rtl { class OUString; }
+
+namespace com { namespace sun { namespace star {
+ namespace uno { class XComponentContext; }
+ namespace rdf { class XMetadatable; }
+ namespace rdf { class XRepositorySupplier; }
+} } }
+
+class SvXMLImport;
+
+namespace xmloff {
+
+struct RDFaEntry;
+
+class SAL_DLLPRIVATE RDFaImportHelper
+{
+
+private:
+ const SvXMLImport & m_rImport;
+
+ typedef ::std::vector< RDFaEntry > RDFaEntries_t;
+
+ RDFaEntries_t m_RDFaEntries;
+
+ const SvXMLImport & GetImport() const { return m_rImport; }
+
+
+public:
+ RDFaImportHelper(const SvXMLImport & i_rImport);
+
+ ~RDFaImportHelper();
+
+ /** Add a RDFa statement; parameters are XML attribute values */
+ void AddRDFa(
+ ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XMetadatable>
+ i_xObject,
+ ::rtl::OUString const & i_rAbout,
+ ::rtl::OUString const & i_rProperty,
+ ::rtl::OUString const & i_rContent,
+ ::rtl::OUString const & i_rDatatype);
+
+ /** Insert all added statements into the RDF repository.
+ <p> This is done <em>after</em> the input file has been read,
+ to prevent collision between generated ids and ids in the file.</p>
+ */
+ void InsertRDFa( ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XRepositorySupplier > const & i_xModel);
+};
+
+} // namespace xmloff
+
+#endif // RDFAIMPORTHELPER_HXX
+
diff --git a/xmloff/inc/SchXMLImport.hxx b/xmloff/inc/SchXMLImport.hxx
index 2267452d93e7..ebecb4d19bb5 100644
--- a/xmloff/inc/SchXMLImport.hxx
+++ b/xmloff/inc/SchXMLImport.hxx
@@ -102,6 +102,7 @@ enum SchXMLAxisElemTokenMap
enum SchXMLChartAttrMap
{
+ XML_TOK_CHART_HREF,
XML_TOK_CHART_CLASS,
XML_TOK_CHART_WIDTH,
XML_TOK_CHART_HEIGHT,
diff --git a/xmloff/inc/txtflde.hxx b/xmloff/inc/txtflde.hxx
index 4355e249d649..15062560da24 100644
--- a/xmloff/inc/txtflde.hxx
+++ b/xmloff/inc/txtflde.hxx
@@ -38,9 +38,7 @@
#include <com/sun/star/uno/Reference.h>
#include "xmlnmspe.hxx"
-#ifndef _RTL_USTRING
#include <rtl/ustring.hxx>
-#endif
#include <xmloff/xmltoken.hxx>
#include <map>
@@ -148,6 +146,8 @@ enum FieldIdEnum {
FIELD_ID_COMBINED_CHARACTERS, // combined characters (asian typography)
+ FIELD_ID_META, // text:meta-field (RDF metadata)
+
FIELD_ID_MEASURE, // for measure shapes
FIELD_ID_TABLE_FORMULA, // DEPRECATED: table formulas (Writer 2.0)
@@ -182,14 +182,16 @@ public:
/// Export this field and the surrounding span element with the formatting.
/// To be called for every field in the document body.
void ExportField(const ::com::sun::star::uno::Reference <
- ::com::sun::star::text::XTextField > & rTextField );
+ ::com::sun::star::text::XTextField > & rTextField,
+ sal_Bool bProgress );
/// collect styles (character styles, data styles, ...) for this field
/// (if appropriate).
/// Also collect used field masters (if pUsedMasters is set)
/// to be called for every field during style export.
void ExportFieldAutoStyle(const ::com::sun::star::uno::Reference <
- ::com::sun::star::text::XTextField > & rTextField );
+ ::com::sun::star::text::XTextField > & rTextField,
+ sal_Bool bProgress );
/// export field declarations.
/// to be called once at beginning of document body.
@@ -239,7 +241,8 @@ protected:
::com::sun::star::beans::XPropertySet> & rPropSet,
const ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet> & rRangePropSet,
- enum FieldIdEnum nToken);
+ enum FieldIdEnum nToken,
+ sal_Bool bProgress );
/// export an empty element
void ExportElement(enum ::xmloff::token::XMLTokenEnum eElement, /// element token
@@ -257,6 +260,11 @@ protected:
::com::sun::star::beans::XPropertySet> & rPropSet,
const ::rtl::OUString& rContent);
+ /// export text:meta-field (RDF metadata)
+ void ExportMetaField( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & i_xMeta,
+ bool i_bAutoStyles, sal_Bool i_bProgress );
+
/// export a boolean attribute
void ProcessBoolean(
enum ::xmloff::token::XMLTokenEnum eXmlName, /// attribute token (namespace text)
diff --git a/xmloff/inc/xmlkywd.hxx b/xmloff/inc/xmlkywd.hxx
index c228ed26eb41..e0bd8868f181 100644
--- a/xmloff/inc/xmlkywd.hxx
+++ b/xmloff/inc/xmlkywd.hxx
@@ -1991,4 +1991,11 @@ XML_CONSTASCII_ACTION( sXML_readonly, "readonly" );
XML_CONSTASCII_ACTION( sXML_page_continuation, "page-continuation" );
+XML_CONSTASCII_ACTION( sXML_contains, "contains" );
+XML_CONSTASCII_ACTION( sXML_does_not_contain, "does-not-contain" );
+XML_CONSTASCII_ACTION( sXML_begins_with, "begins-with" );
+XML_CONSTASCII_ACTION( sXML_does_not_begin_with, "does-not-begin-with" );
+XML_CONSTASCII_ACTION( sXML_ends_with, "ends-with" );
+XML_CONSTASCII_ACTION( sXML_does_not_end_with, "does-not-end-with" );
+
#endif
diff --git a/xmloff/inc/xmlnmspe.hxx b/xmloff/inc/xmlnmspe.hxx
index 82e62cab6ab9..a79890f19a7d 100644
--- a/xmloff/inc/xmlnmspe.hxx
+++ b/xmloff/inc/xmlnmspe.hxx
@@ -79,9 +79,10 @@ XML_NAMESPACE( ANIMATION, 31U )
XML_NAMESPACE( XML, 32U )
XML_NAMESPACE( REPORT, 33U )
XML_NAMESPACE( OF, 34U ) // OpenFormula aka ODFF
-XML_NAMESPACE( RDFA, 35U )
+XML_NAMESPACE( XHTML, 35U )
+XML_NAMESPACE( GRDDL, 36U )
-#define _XML_OLD_NAMESPACE_BASE 36U
+#define _XML_OLD_NAMESPACE_BASE 37U
// namespaces used in the technical preview (SO 5.2)
XML_OLD_NAMESPACE( FO, 0U )
diff --git a/xmloff/inc/xmloff/SchXMLExportHelper.hxx b/xmloff/inc/xmloff/SchXMLExportHelper.hxx
index b886e499d329..2082ce59de03 100644
--- a/xmloff/inc/xmloff/SchXMLExportHelper.hxx
+++ b/xmloff/inc/xmloff/SchXMLExportHelper.hxx
@@ -233,13 +233,6 @@ public:
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartDocument > & xChartDoc );
- // if no data provider exists by, now the model (as XChild) is asked for its
- // parent which creates the data provider that is finally set at the chart
- // document
- static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider >
- GetDataProvider( const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XChartDocument > & xChartDoc );
-
::com::sun::star::awt::Size getPageSize(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartDocument > & xChartDoc ) const;
diff --git a/xmloff/inc/xmloff/SchXMLImportHelper.hxx b/xmloff/inc/xmloff/SchXMLImportHelper.hxx
index 0b8df9580e9e..d62368739c8a 100644
--- a/xmloff/inc/xmloff/SchXMLImportHelper.hxx
+++ b/xmloff/inc/xmloff/SchXMLImportHelper.hxx
@@ -143,13 +143,6 @@ public:
sal_Int32 GetLengthOfSeries();
void ResizeChartData( sal_Int32 nSeries, sal_Int32 nDataPoints = -1 );
- // if no data provider exists by, now the model (as XChild) is asked for its
- // parent which creates the data provider that is finally set at the chart
- // document
- static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider >
- GetDataProvider( const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XChartDocument > & xChartDoc );
-
/** @param bPushLastChartType If </FALSE>, in case a new chart type has to
be added (because it does not exist yet), it is appended at the
end of the chart-type container. When </TRUE>, a new chart type
diff --git a/xmloff/inc/xmloff/table/XMLTableExport.hxx b/xmloff/inc/xmloff/table/XMLTableExport.hxx
index cca3ff29d33b..028166358069 100644
--- a/xmloff/inc/xmloff/table/XMLTableExport.hxx
+++ b/xmloff/inc/xmloff/table/XMLTableExport.hxx
@@ -75,7 +75,7 @@ typedef ::std::map< const ::com::sun::star::uno::Reference< com::sun::star::tabl
class XMLOFF_DLLPUBLIC XMLTableExport : public UniRefBase
{
public:
- XMLTableExport(SvXMLExport& rExp, const rtl::Reference< XMLPropertySetMapper >& xCellPropertySetMapper, const rtl::Reference< XMLPropertyHandlerFactory >& xFactoryRef );
+ XMLTableExport(SvXMLExport& rExp, const rtl::Reference< SvXMLExportPropertyMapper >& xCellExportPropertySetMapper, const rtl::Reference< XMLPropertyHandlerFactory >& xFactoryRef );
virtual ~XMLTableExport();
// This method collects all automatic styles for the given table
diff --git a/xmloff/inc/xmloff/txtimp.hxx b/xmloff/inc/xmloff/txtimp.hxx
index fa81e97defeb..7e041d0bdc91 100644
--- a/xmloff/inc/xmloff/txtimp.hxx
+++ b/xmloff/inc/xmloff/txtimp.hxx
@@ -253,6 +253,10 @@ enum XMLTextPElemTokens
enum XMLTextPAttrTokens
{
XML_TOK_TEXT_P_XMLID,
+ XML_TOK_TEXT_P_ABOUT,
+ XML_TOK_TEXT_P_PROPERTY,
+ XML_TOK_TEXT_P_CONTENT,
+ XML_TOK_TEXT_P_DATATYPE,
XML_TOK_TEXT_P_STYLE_NAME,
XML_TOK_TEXT_P_COND_STYLE_NAME,
XML_TOK_TEXT_P_LEVEL,
diff --git a/xmloff/inc/xmloff/txtparae.hxx b/xmloff/inc/xmloff/txtparae.hxx
index 37da59a1df76..1ea068911236 100644
--- a/xmloff/inc/xmloff/txtparae.hxx
+++ b/xmloff/inc/xmloff/txtparae.hxx
@@ -38,9 +38,7 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <xmloff/uniref.hxx>
#include <xmloff/xmlexppr.hxx>
-#ifndef _XMLOFF_STYLEEXP_HXX
#include <xmloff/styleexp.hxx>
-#endif
#include <xmloff/xmltoken.hxx>
#include <xmloff/SinglePropertySetInfoCache.hxx>
#include <xmloff/XMLStringVector.hxx>
@@ -264,6 +262,12 @@ public:
const ::com::sun::star::uno::Reference <
::com::sun::star::beans::XPropertySetInfo > & rPropSetInfo );
+ void exportTextRangeEnumeration(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::container::XEnumeration > & rRangeEnum,
+ sal_Bool bAutoStyles, sal_Bool bProgress,
+ sal_Bool bPrvChrIsSpc = sal_True );
+
protected:
sal_Int32 addTextFrameAttributes(
@@ -316,16 +320,11 @@ protected:
const ::com::sun::star::uno::Reference <
::com::sun::star::text::XTextContent > & rTextContent,
sal_Bool bAutoStyles, sal_Bool bProgress );
- void exportTextRangeEnumeration(
- const ::com::sun::star::uno::Reference <
- ::com::sun::star::container::XEnumeration > & rRangeEnum,
- sal_Bool bAutoStyles, sal_Bool bProgress,
- sal_Bool bPrvChrIsSpc = sal_True );
void exportTextField(
const ::com::sun::star::uno::Reference <
::com::sun::star::text::XTextRange > & rTextRange,
- sal_Bool bAutoStyles );
+ sal_Bool bAutoStyles, sal_Bool bProgress );
void exportAnyTextFrame(
const ::com::sun::star::uno::Reference <
@@ -484,6 +483,12 @@ protected:
::com::sun::star::beans::XPropertySet> & rPortionPropSet,
sal_Bool bAutoStyles );
+ /// export a text:meta
+ void exportMeta(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & i_xMeta,
+ sal_Bool i_bAutoStyles, sal_Bool i_isProgress );
+
public:
XMLTextParagraphExport(
diff --git a/xmloff/inc/xmloff/txtprmap.hxx b/xmloff/inc/xmloff/txtprmap.hxx
index 12a39ba952fb..ddf420176c57 100644
--- a/xmloff/inc/xmloff/txtprmap.hxx
+++ b/xmloff/inc/xmloff/txtprmap.hxx
@@ -71,7 +71,7 @@
#define CTF_FONTFAMILY (XML_TEXT_CTF_START + 36)
#define CTF_FONTPITCH (XML_TEXT_CTF_START + 37)
#define CTF_FONTCHARSET (XML_TEXT_CTF_START + 38)
-// (XML_TEXT_CTF_START + 39)
+#define CTF_TEXTWRITINGMODE (XML_TEXT_CTF_START + 39)
#define CTF_SYNCHEIGHT_MIN (XML_TEXT_CTF_START + 40)
#define CTF_FRAMEHEIGHT_ABS (XML_TEXT_CTF_START + 41)
#define CTF_FRAMEHEIGHT_REL (XML_TEXT_CTF_START + 42)
diff --git a/xmloff/inc/xmloff/xmlexp.hxx b/xmloff/inc/xmloff/xmlexp.hxx
index 99097487b604..b4d388957f0f 100644
--- a/xmloff/inc/xmloff/xmlexp.hxx
+++ b/xmloff/inc/xmloff/xmlexp.hxx
@@ -92,6 +92,7 @@ class XMLErrors;
namespace rtl { class OUString; }
namespace com { namespace sun { namespace star {
+ namespace uno { class XComponentContext; }
namespace frame { class XModel; }
namespace container { class XIndexContainer; }
} } }
@@ -362,6 +363,22 @@ public:
// XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+ /** ensures that the given namespace is in scope at the next started
+ element.
+
+ <p>If the namespace is not yet declared, the necessary attribute will
+ be added, as well.</p>
+
+ @param i_rNamespace the namespace to be declared
+ @param i_rPreferredPrefix (opt.) preferred prefix for the namespace
+
+ @returns the actual prefix that the namespace is associated with
+ */
+ ::rtl::OUString
+ EnsureNamespace(::rtl::OUString const & i_rNamespace,
+ ::rtl::OUString const & i_rPreferredPrefix
+ = ::rtl::OUString::createFromAscii("gen") );
+
// Check if common attribute list is empty.
#ifdef PRODUCT
void CheckAttrList() {}
@@ -553,6 +570,9 @@ public:
// #110680#
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getServiceFactory();
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ GetComponentContext() const;
+
// --> OD 2006-03-10 #i51726#
SvtModuleOptions::EFactory GetModelType() const
{
@@ -570,13 +590,17 @@ public:
/// returns the currently configured default version for odf export
SvtSaveOptions::ODFDefaultVersion getDefaultVersion() const;
- /// relative path of stream in package, e.g. "someobject/content.xml"
- ::rtl::OUString GetStreamPath() const;
+ /// name of stream in package, e.g., "content.xml"
+ ::rtl::OUString GetStreamName() const;
/// add xml:id attribute (for RDF metadata)
void AddAttributeXmlId(::com::sun::star::uno::Reference<
::com::sun::star::uno::XInterface> const & i_xIfc);
+ /// add RDFa attributes for a metadatable text content
+ void AddAttributesRDFa( ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent> const & i_xTextContent);
+
// --> OD 2008-11-26 #158694#
sal_Bool exportTextNumberElement() const;
// <--
diff --git a/xmloff/inc/xmloff/xmlimp.hxx b/xmloff/inc/xmloff/xmlimp.hxx
index e496b34d79f2..717f117be415 100644
--- a/xmloff/inc/xmloff/xmlimp.hxx
+++ b/xmloff/inc/xmloff/xmlimp.hxx
@@ -61,8 +61,10 @@
namespace rtl { class OUString; }
namespace com { namespace sun { namespace star {
+ namespace uno { class XComponentContext; }
namespace frame { class XModel; }
namespace io { class XOutputStream; }
+ namespace rdf { class XMetadatable; }
} } }
namespace comphelper { class UnoInterfaceToUniqueIdentifierMapper; }
@@ -346,7 +348,7 @@ public:
sal_uInt16 getImportFlags() const { return mnImportFlags; }
sal_Bool IsFormsSupported() const { return mbIsFormsSupported; }
- rtl::OUString GetAbsoluteReference(const rtl::OUString& rValue);
+ rtl::OUString GetAbsoluteReference(const rtl::OUString& rValue) const;
sal_Unicode ConvStarBatsCharToStarSymbol( sal_Unicode c );
sal_Unicode ConvStarMathCharToStarSymbol( sal_Unicode c );
@@ -400,6 +402,9 @@ public:
// #110680#
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getServiceFactory();
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ GetComponentContext() const;
+
// --> OD 2004-08-10 #i28749#
sal_Bool IsShapePositionInHoriL2R() const;
// <--
@@ -411,14 +416,23 @@ public:
String GetBaseURL() const;
String GetDocumentBase() const;
- /// relative path of stream in package, e.g. "someobject/content.xml"
- ::rtl::OUString GetStreamPath() const;
+ /// name of stream in package, e.g., "content.xml"
+ ::rtl::OUString GetStreamName() const;
/// set the XmlId attribute of given UNO object (for RDF metadata)
void SetXmlId(::com::sun::star::uno::Reference<
::com::sun::star::uno::XInterface> const & i_xIfc,
::rtl::OUString const & i_rXmlId);
+ /// Add a RDFa statement; parameters are XML attribute values
+ void AddRDFa(
+ ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XMetadatable>
+ i_xObject,
+ ::rtl::OUString const & i_rAbout,
+ ::rtl::OUString const & i_rProperty,
+ ::rtl::OUString const & i_rContent,
+ ::rtl::OUString const & i_rDatatype);
+
// #i31958# XForms helper method
// (to be implemented by applications suporting XForms)
virtual void initXForms();
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
index 49dde992bad0..b42791ca1d0b 100644
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -138,9 +138,11 @@ namespace xmloff { namespace token {
XML_NP_OF,
XML_N_OF,
- // ODF 1.2 metadata: RDFa
- XML_NP_RDFA,
- XML_N_RDFA,
+ // ODF 1.2 metadata: RDFa and GRDDL
+ XML_NP_XHTML,
+ XML_N_XHTML,
+ XML_NP_GRDDL,
+ XML_N_GRDDL,
// units
XML_UNIT_MM,
@@ -3042,6 +3044,7 @@ namespace xmloff { namespace token {
XML_META_FIELD,
XML_ABOUT,
XML_DATATYPE,
+ XML_TRANSFORMATION,
// ODF 1.2 numbered-paragraph
XML_LIST_ID,
@@ -3079,6 +3082,13 @@ namespace xmloff { namespace token {
XML_MATHWEIGHT,
XML_MATHCOLOR,
+ XML_CONTAINS,
+ XML_DOES_NOT_CONTAIN,
+ XML_BEGINS_WITH,
+ XML_DOES_NOT_BEGIN_WITH,
+ XML_ENDS_WITH,
+ XML_DOES_NOT_END_WITH,
+
XML_TOKEN_END
};
diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx
index d6072560297a..d103876b9350 100644
--- a/xmloff/source/chart/SchXMLChartContext.cxx
+++ b/xmloff/source/chart/SchXMLChartContext.cxx
@@ -228,6 +228,57 @@ void lcl_removeEmptyChartTypeGroups( const uno::Reference< chart2::XChartDocumen
}
}
+uno::Sequence< sal_Int32 > lcl_getNumberSequenceFromString( const ::rtl::OUString& rStr, bool bAddOneToEachOldIndex )
+{
+ const sal_Unicode aSpace( ' ' );
+
+ // count number of entries
+ ::std::vector< sal_Int32 > aVec;
+ sal_Int32 nLastPos = 0;
+ sal_Int32 nPos = 0;
+ while( nPos != -1 )
+ {
+ nPos = rStr.indexOf( aSpace, nLastPos );
+ if( nPos > nLastPos )
+ {
+ aVec.push_back( rStr.copy( nLastPos, (nPos - nLastPos) ).toInt32() );
+ }
+ if( nPos != -1 )
+ nLastPos = nPos + 1;
+ }
+ // last entry
+ if( nLastPos != 0 &&
+ rStr.getLength() > nLastPos )
+ {
+ aVec.push_back( rStr.copy( nLastPos, (rStr.getLength() - nLastPos) ).toInt32() );
+ }
+
+ const sal_Int32 nVecSize = aVec.size();
+ uno::Sequence< sal_Int32 > aSeq( nVecSize );
+
+ if(!bAddOneToEachOldIndex)
+ {
+ sal_Int32* pSeqArr = aSeq.getArray();
+ for( nPos = 0; nPos < nVecSize; ++nPos )
+ {
+ pSeqArr[ nPos ] = aVec[ nPos ];
+ }
+ }
+ else if( bAddOneToEachOldIndex )
+ {
+ aSeq.realloc( nVecSize+1 );
+ aSeq[0]=0;
+
+ sal_Int32* pSeqArr = aSeq.getArray();
+ for( nPos = 0; nPos < nVecSize; ++nPos )
+ {
+ pSeqArr[ nPos+1 ] = aVec[ nPos ]+1;
+ }
+ }
+
+ return aSeq;
+}
+
} // anonymous namespace
static __FAR_DATA SvXMLEnumMapEntry aXMLLegendAlignmentMap[] =
@@ -249,7 +300,8 @@ SchXMLChartContext::SchXMLChartContext( SchXMLImportHelper& rImpHelper,
SvXMLImport& rImport, const rtl::OUString& rLocalName ) :
SvXMLImportContext( rImport, XML_NAMESPACE_CHART, rLocalName ),
mrImportHelper( rImpHelper ),
- mbHasOwnTable( sal_True ),
+ m_bHasRangeAtPlotArea( false ),
+ m_bHasTableElement( false ),
mbAllRangeAddressesAvailable( sal_True ),
mbColHasLabels( sal_False ),
mbRowHasLabels( sal_False ),
@@ -269,7 +321,6 @@ void SchXMLChartContext::StartElement( const uno::Reference< xml::sax::XAttribut
awt::Size aChartSize;
// this flag is necessarry for pie charts in the core
sal_Bool bSetSwitchData = sal_False;
- sal_Bool bDomainForDefaultDataNeeded = sal_False;
::rtl::OUString sAutoStyleName;
::rtl::OUString aOldChartTypeName;
@@ -284,6 +335,10 @@ void SchXMLChartContext::StartElement( const uno::Reference< xml::sax::XAttribut
switch( rAttrTokenMap.Get( nPrefix, aLocalName ))
{
+ case XML_TOK_CHART_HREF:
+ m_aXLinkHRefAttributeToIndicateDataProvider = aValue;
+ break;
+
case XML_TOK_CHART_CLASS:
{
rtl::OUString sClassName;
@@ -302,15 +357,9 @@ void SchXMLChartContext::StartElement( const uno::Reference< xml::sax::XAttribut
case XML_CHART_CLASS_CIRCLE:
bSetSwitchData = sal_True;
break;
- case XML_CHART_CLASS_SCATTER:
- bDomainForDefaultDataNeeded = sal_True;
- break;
case XML_CHART_CLASS_STOCK:
mbIsStockChart = true;
break;
- case XML_CHART_CLASS_BUBBLE:
- DBG_ERROR( "Bubble chart not supported yet" );
- break;
default:
break;
}
@@ -321,10 +370,6 @@ void SchXMLChartContext::StartElement( const uno::Reference< xml::sax::XAttribut
// service is taken from add-in-name attribute
bHasAddin = true;
- // for service charts assume domain in base type
- // if base type doesn't use a domain this is ok,
- // the data just grows bigger
- bDomainForDefaultDataNeeded = sal_True;
aOldChartTypeName = sClassName;
maChartTypeServiceName = sClassName;
}
@@ -361,7 +406,7 @@ void SchXMLChartContext::StartElement( const uno::Reference< xml::sax::XAttribut
maChartTypeServiceName = SchXMLTools::GetChartTypeByClassName( aChartClass_Bar, false /* bUseOldNames */ );
}
- InitChart (aChartSize, bDomainForDefaultDataNeeded, aOldChartTypeName, bSetSwitchData);
+ InitChart (aChartSize, aOldChartTypeName, bSetSwitchData);
if( bHasAddin )
{
@@ -617,14 +662,21 @@ bool lcl_SpecialHandlingForDonutChartNeeded(
} // anonymous namespace
-void SchXMLChartContext::ChangeDiagramAccordingToTemplate(
- const uno::Reference< chart2::XChartDocument >& xNewDoc )
+
+void lcl_ApplyDataFromRectangularRangeToDiagram(
+ const uno::Reference< chart2::XChartDocument >& xNewDoc
+ , const rtl::OUString& rRectangularRange
+ , ::com::sun::star::chart::ChartDataRowSource eDataRowSource
+ , bool bRowHasLabels, bool bColHasLabels
+ , bool bSwitchOnLabelsAndCategoriesForOwnData
+ , const rtl::OUString& sColTrans
+ , const rtl::OUString& sRowTrans )
{
if( !xNewDoc.is() )
return;
uno::Reference< chart2::XDiagram > xNewDia( xNewDoc->getFirstDiagram());
- uno::Reference< chart2::data::XDataProvider > xDataProvider( mrImportHelper.GetDataProvider( xNewDoc ) );
+ uno::Reference< chart2::data::XDataProvider > xDataProvider( xNewDoc->getDataProvider() );
if( !xNewDia.is() || !xDataProvider.is() )
return;
@@ -633,11 +685,11 @@ void SchXMLChartContext::ChangeDiagramAccordingToTemplate(
return;
sal_Bool bFirstCellAsLabel =
- (meDataRowSource==chart::ChartDataRowSource_COLUMNS)? mbRowHasLabels : mbColHasLabels;
+ (eDataRowSource==chart::ChartDataRowSource_COLUMNS)? bRowHasLabels : bColHasLabels;
sal_Bool bHasCateories =
- (meDataRowSource==chart::ChartDataRowSource_COLUMNS)? mbColHasLabels : mbRowHasLabels;
+ (eDataRowSource==chart::ChartDataRowSource_COLUMNS)? bColHasLabels : bRowHasLabels;
- if( mbHasOwnTable )
+ if( bSwitchOnLabelsAndCategoriesForOwnData )
{
bFirstCellAsLabel = true;
bHasCateories = true;
@@ -646,25 +698,25 @@ void SchXMLChartContext::ChangeDiagramAccordingToTemplate(
uno::Sequence< beans::PropertyValue > aArgs( 3 );
aArgs[0] = beans::PropertyValue(
::rtl::OUString::createFromAscii("CellRangeRepresentation"),
- -1, uno::makeAny( msChartAddress ),
+ -1, uno::makeAny( rRectangularRange ),
beans::PropertyState_DIRECT_VALUE );
aArgs[1] = beans::PropertyValue(
::rtl::OUString::createFromAscii("DataRowSource"),
- -1, uno::makeAny( meDataRowSource ),
+ -1, uno::makeAny( eDataRowSource ),
beans::PropertyState_DIRECT_VALUE );
aArgs[2] = beans::PropertyValue(
::rtl::OUString::createFromAscii("FirstCellAsLabel"),
-1, uno::makeAny( bFirstCellAsLabel ),
beans::PropertyState_DIRECT_VALUE );
- if( msColTrans.getLength() || msRowTrans.getLength() )
+ if( sColTrans.getLength() || sRowTrans.getLength() )
{
aArgs.realloc( aArgs.getLength() + 1 );
aArgs[ aArgs.getLength() - 1 ] = beans::PropertyValue(
::rtl::OUString::createFromAscii("SequenceMapping"),
- -1, uno::makeAny( msColTrans.getLength()
- ? GetNumberSequenceFromString( msColTrans, bHasCateories && !xNewDoc->hasInternalDataProvider() )
- : GetNumberSequenceFromString( msRowTrans, bHasCateories && !xNewDoc->hasInternalDataProvider() ) ),
+ -1, uno::makeAny( sColTrans.getLength()
+ ? lcl_getNumberSequenceFromString( sColTrans, bHasCateories && !xNewDoc->hasInternalDataProvider() )
+ : lcl_getNumberSequenceFromString( sRowTrans, bHasCateories && !xNewDoc->hasInternalDataProvider() ) ),
beans::PropertyState_DIRECT_VALUE );
}
@@ -777,21 +829,36 @@ void SchXMLChartContext::EndElement()
if(!xNewDoc.is())
return;
- // if we already have an internal data provider, we know that we cannot have
- // external data here. If we can have external data but know that we have
- // internal data due to missing ranges, we must create an internal data
- // provider
+ bool bHasOwnData = false;
+ if( m_aXLinkHRefAttributeToIndicateDataProvider.equalsAscii( "." ) ) //data comes from the chart itself
+ bHasOwnData = true;
+ else if( m_aXLinkHRefAttributeToIndicateDataProvider.equalsAscii( ".." ) ) //data comes from the parent application
+ bHasOwnData = false;
+ else if( m_aXLinkHRefAttributeToIndicateDataProvider.getLength() ) //not supported so far to get the data by sibling objects -> fall back to chart itself if data are available
+ bHasOwnData = m_bHasTableElement;
+ else
+ bHasOwnData = !m_bHasRangeAtPlotArea;
+
if( xNewDoc->hasInternalDataProvider())
- mbHasOwnTable = true;
- else if( mbHasOwnTable )
+ {
+ if( !m_bHasTableElement && !m_aXLinkHRefAttributeToIndicateDataProvider.equalsAscii( "." ) )
+ {
+ //#i103147# ODF, workaround broken files with a missing table:cell-range-address at the plot-area
+ bool bSwitchSuccessful = SchXMLTools::switchBackToDataProviderFromParent( xNewDoc, maLSequencesPerIndex );
+ bHasOwnData = !bSwitchSuccessful;
+ }
+ else
+ bHasOwnData = true;//e.g. in case of copy->paste from calc to impress
+ }
+ else if( bHasOwnData )
{
xNewDoc->createInternalDataProvider( sal_False /* bCloneExistingData */ );
}
- if( mbHasOwnTable )
+ if( bHasOwnData )
msChartAddress = ::rtl::OUString::createFromAscii("all");
- bool bPostProcessTable = false;
- if( !mbHasOwnTable && mbAllRangeAddressesAvailable )
+ bool bSwitchRangesFromOuterToInternalIfNecessary = false;
+ if( !bHasOwnData && mbAllRangeAddressesAvailable )
{
// special handling for stock chart (merge series together)
if( mbIsStockChart )
@@ -799,24 +866,28 @@ void SchXMLChartContext::EndElement()
}
else if( msChartAddress.getLength() )
{
- // in this case there are range addresses that are simply wrong.
+ //own data or only rectangular range available
+
bool bOlderThan2_3 = SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan2_3( Reference< frame::XModel >( xNewDoc, uno::UNO_QUERY ));
- bool bOldFileWithOwnDataFromRows = (bOlderThan2_3 && mbHasOwnTable && (meDataRowSource==chart::ChartDataRowSource_ROWS));
+ bool bOldFileWithOwnDataFromRows = (bOlderThan2_3 && bHasOwnData && (meDataRowSource==chart::ChartDataRowSource_ROWS)); // in this case there are range addresses that are simply wrong.
+
if( mbAllRangeAddressesAvailable && !bSpecialHandlingForDonutChart && !mbIsStockChart &&
!bOldFileWithOwnDataFromRows )
{
- // note: mbRowHasLabels means the first row contains labels, that
- // means we have "column-descriptions", (analogously mbColHasLabels
- // means we have "row-descriptions")
- SchXMLTableHelper::applyTable( maTable, xNewDoc );
- bPostProcessTable = true;
+ //bHasOwnData is true in this case!
+ //e.g. for normal files with own data or also in case of copy paste scenario (e.g. calc to impress)
+ if( xNewDoc->hasInternalDataProvider() )
+ SchXMLTableHelper::applyTableToInternalDataProvider( maTable, xNewDoc );
+ bSwitchRangesFromOuterToInternalIfNecessary = true;
}
else
{
+ //apply data from rectangular range
+
// apply data read from the table sub-element to the chart
// if the data provider supports the XChartDataArray interface like
// the internal data provider
- uno::Reference< chart::XChartDataArray > xChartData( mrImportHelper.GetDataProvider( xNewDoc ), uno::UNO_QUERY );
+ uno::Reference< chart::XChartDataArray > xChartData( xNewDoc->getDataProvider(), uno::UNO_QUERY );
if( xChartData.is())
SchXMLTableHelper::applyTableSimple( maTable, xChartData );
@@ -826,29 +897,32 @@ void SchXMLChartContext::EndElement()
{
if( bOlderThan2_3 && xDiaProp.is() )//for older charts the hidden cells were removed by calc on the fly
xDiaProp->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IncludeHiddenCells")),uno::makeAny(false));
- ChangeDiagramAccordingToTemplate( xNewDoc );
+
+ // note: mbRowHasLabels means the first row contains labels, that means we have "column-descriptions",
+ // (analogously mbColHasLabels means we have "row-descriptions")
+ lcl_ApplyDataFromRectangularRangeToDiagram( xNewDoc, msChartAddress, meDataRowSource, mbRowHasLabels, mbColHasLabels, bHasOwnData, msColTrans, msRowTrans );
}
catch( uno::Exception & )
{
//try to fallback to internal data
- DBG_ERROR( "Exception during import SchXMLChartContext::ChangeDiagramAccordingToTemplate try to fallback to internal data" );
- if(!mbHasOwnTable)
+ DBG_ERROR( "Exception during import SchXMLChartContext::lcl_ApplyDataFromRectangularRangeToDiagram try to fallback to internal data" );
+ if(!bHasOwnData)
{
- mbHasOwnTable = true;
+ bHasOwnData = true;
msChartAddress = ::rtl::OUString::createFromAscii("all");
if( !xNewDoc->hasInternalDataProvider() )
{
xNewDoc->createInternalDataProvider( sal_False /* bCloneExistingData */ );
- xChartData = uno::Reference< chart::XChartDataArray >( mrImportHelper.GetDataProvider( xNewDoc ), uno::UNO_QUERY );
+ xChartData = uno::Reference< chart::XChartDataArray >( xNewDoc->getDataProvider(), uno::UNO_QUERY );
if( xChartData.is())
SchXMLTableHelper::applyTableSimple( maTable, xChartData );
try
{
- ChangeDiagramAccordingToTemplate( xNewDoc );
+ lcl_ApplyDataFromRectangularRangeToDiagram( xNewDoc, msChartAddress, meDataRowSource, mbRowHasLabels, mbColHasLabels, bHasOwnData, msColTrans, msRowTrans );
}
catch( uno::Exception & )
{
- DBG_ERROR( "Exception during import SchXMLChartContext::ChangeDiagramAccordingToTemplate fallback to internal data failed also" );
+ DBG_ERROR( "Exception during import SchXMLChartContext::lcl_ApplyDataFromRectangularRangeToDiagram fallback to internal data failed also" );
}
}
}
@@ -904,16 +978,23 @@ void SchXMLChartContext::EndElement()
SchXMLSeries2Context::setStylesToStatisticsObjects( maSeriesDefaultsAndStyles
, pStylesCtxt, pStyle, sCurrStyleName );
}
+ }
+
+ //#i98319# call switchRangesFromOuterToInternalIfNecessary before the data point styles are applied, otherwise in copy->paste scenario the data point styles do get lost
+ if( bSwitchRangesFromOuterToInternalIfNecessary )
+ {
+ if( xNewDoc->hasInternalDataProvider() )
+ SchXMLTableHelper::switchRangesFromOuterToInternalIfNecessary( maTable, maLSequencesPerIndex, xNewDoc, meDataRowSource );
+ }
+ if( pStylesCtxt )
+ {
// ... then iterate over data-point attributes, so the latter are not overwritten
SchXMLSeries2Context::setStylesToDataPoints( maSeriesDefaultsAndStyles
, pStylesCtxt, pStyle, sCurrStyleName, mrImportHelper, GetImport(), mbIsStockChart, bSpecialHandlingForDonutChart, bSwitchOffLinesForScatter );
}
}
- if( bPostProcessTable )
- SchXMLTableHelper::postProcessTable( maTable, maLSequencesPerIndex, xNewDoc, meDataRowSource );
-
if( xProp.is())
xProp->setPropertyValue( rtl::OUString::createFromAscii( "RefreshAddInAllowed" ) , uno::makeAny( sal_True) );
}
@@ -1014,8 +1095,9 @@ SvXMLImportContext* SchXMLChartContext::CreateChildContext(
{
case XML_TOK_CHART_PLOT_AREA:
pContext = new SchXMLPlotAreaContext( mrImportHelper, GetImport(), rLocalName,
+ m_aXLinkHRefAttributeToIndicateDataProvider,
maSeriesAddresses, msCategoriesAddress,
- msChartAddress, mbHasOwnTable, mbAllRangeAddressesAvailable,
+ msChartAddress, m_bHasRangeAtPlotArea, mbAllRangeAddressesAvailable,
mbColHasLabels, mbRowHasLabels,
meDataRowSource,
maSeriesDefaultsAndStyles,
@@ -1057,6 +1139,7 @@ SvXMLImportContext* SchXMLChartContext::CreateChildContext(
{
SchXMLTableContext * pTableContext =
new SchXMLTableContext( mrImportHelper, GetImport(), rLocalName, maTable );
+ m_bHasTableElement = true;
// #i85913# take into account column- and row- mapping for
// charts with own data only for those which were not copied
// from a place where they got data from the container. Note,
@@ -1071,12 +1154,12 @@ SvXMLImportContext* SchXMLChartContext::CreateChildContext(
if( msColTrans.getLength() > 0 )
{
OSL_ASSERT( msRowTrans.getLength() == 0 );
- pTableContext->setColumnPermutation( GetNumberSequenceFromString( msColTrans, true ));
+ pTableContext->setColumnPermutation( lcl_getNumberSequenceFromString( msColTrans, true ));
msColTrans = OUString();
}
else if( msRowTrans.getLength() > 0 )
{
- pTableContext->setRowPermutation( GetNumberSequenceFromString( msRowTrans, true ));
+ pTableContext->setRowPermutation( lcl_getNumberSequenceFromString( msRowTrans, true ));
msRowTrans = OUString();
}
}
@@ -1116,7 +1199,6 @@ SvXMLImportContext* SchXMLChartContext::CreateChildContext(
*/
void SchXMLChartContext::InitChart(
awt::Size aChartSize,
- sal_Bool /* bDomainForDefaultDataNeeded */,
const OUString & rChartTypeServiceName, // currently the old service name
sal_Bool /* bSetSwitchData */ )
{
@@ -1155,57 +1237,6 @@ void SchXMLChartContext::InitChart(
}
}
-uno::Sequence< sal_Int32 > SchXMLChartContext::GetNumberSequenceFromString( const ::rtl::OUString& rStr, bool bAddOneToEachOldIndex )
-{
- const sal_Unicode aSpace( ' ' );
-
- // count number of entries
- ::std::vector< sal_Int32 > aVec;
- sal_Int32 nLastPos = 0;
- sal_Int32 nPos = 0;
- while( nPos != -1 )
- {
- nPos = rStr.indexOf( aSpace, nLastPos );
- if( nPos > nLastPos )
- {
- aVec.push_back( rStr.copy( nLastPos, (nPos - nLastPos) ).toInt32() );
- }
- if( nPos != -1 )
- nLastPos = nPos + 1;
- }
- // last entry
- if( nLastPos != 0 &&
- rStr.getLength() > nLastPos )
- {
- aVec.push_back( rStr.copy( nLastPos, (rStr.getLength() - nLastPos) ).toInt32() );
- }
-
- const sal_Int32 nVecSize = aVec.size();
- uno::Sequence< sal_Int32 > aSeq( nVecSize );
-
- if(!bAddOneToEachOldIndex)
- {
- sal_Int32* pSeqArr = aSeq.getArray();
- for( nPos = 0; nPos < nVecSize; ++nPos )
- {
- pSeqArr[ nPos ] = aVec[ nPos ];
- }
- }
- else if( bAddOneToEachOldIndex )
- {
- aSeq.realloc( nVecSize+1 );
- aSeq[0]=0;
-
- sal_Int32* pSeqArr = aSeq.getArray();
- for( nPos = 0; nPos < nVecSize; ++nPos )
- {
- pSeqArr[ nPos+1 ] = aVec[ nPos ]+1;
- }
- }
-
- return aSeq;
-}
-
// ----------------------------------------
SchXMLTitleContext::SchXMLTitleContext( SchXMLImportHelper& rImpHelper, SvXMLImport& rImport,
diff --git a/xmloff/source/chart/SchXMLChartContext.hxx b/xmloff/source/chart/SchXMLChartContext.hxx
index 596646e6b35a..c02f623ebe10 100644
--- a/xmloff/source/chart/SchXMLChartContext.hxx
+++ b/xmloff/source/chart/SchXMLChartContext.hxx
@@ -114,7 +114,9 @@ private:
::rtl::OUString maMainTitle, maSubTitle;
com::sun::star::awt::Point maMainTitlePos, maSubTitlePos, maLegendPos;
- sal_Bool mbHasOwnTable;
+ ::rtl::OUString m_aXLinkHRefAttributeToIndicateDataProvider;
+ bool m_bHasRangeAtPlotArea;
+ bool m_bHasTableElement;
sal_Bool mbAllRangeAddressesAvailable;
sal_Bool mbColHasLabels;
sal_Bool mbRowHasLabels;
@@ -139,20 +141,14 @@ private:
a locked controller. This includes setting the draw page size and setting
the chart type.
@param aChartSize The size the draw page will be set to.
- @param bDomainForDefaultDataNeeded This flag indicates wether the chart's data set
- has to contain a domain value.
@param aServiceName The name of the service the diagram is initialized with.
@param bSetWitchData Indicates wether the data set takes it's data series from
rows or from columns.
*/
void InitChart (com::sun::star::awt::Size aChartSize,
- sal_Bool bDomainForDefaultDataNeeded,
const ::rtl::OUString & rChartTypeServiceName,
sal_Bool bSetSwitchData);
- void ChangeDiagramAccordingToTemplate(
- const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xNewDoc );
- ::com::sun::star::uno::Sequence< sal_Int32 > GetNumberSequenceFromString( const ::rtl::OUString& rStr, bool bAddOneToEachOldIndex );
void MergeSeriesForStockChart();
};
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index 46dd7e3da973..3290cb31db96 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -353,8 +353,10 @@ bool lcl_isSeriesAttachedToFirstAxis(
OUString lcl_ConvertRange( const ::rtl::OUString & rRange, const Reference< chart2::XChartDocument > & xDoc )
{
OUString aResult = rRange;
+ if( !xDoc.is() )
+ return aResult;
Reference< chart2::data::XRangeXMLConversion > xConversion(
- SchXMLExportHelper::GetDataProvider( xDoc ), uno::UNO_QUERY );
+ xDoc->getDataProvider(), uno::UNO_QUERY );
if( xConversion.is())
aResult = xConversion->convertRangeToXML( rRange );
return aResult;
@@ -837,6 +839,28 @@ void lcl_exportNumberFormat( const OUString& rPropertyName, const Reference< bea
return aResult;
}
+bool lcl_exportDomainForThisSequence( const Reference< chart2::data::XDataSequence > xValues, rtl::OUString& rFirstRangeForThisDomainIndex, SvXMLExport& rExport )
+{
+ bool bDomainExported = false;
+ if( xValues.is())
+ {
+ Reference< chart2::XChartDocument > xNewDoc( rExport.GetModel(), uno::UNO_QUERY );
+ OUString aRange( lcl_ConvertRange( xValues->getSourceRangeRepresentation(), xNewDoc ) );
+
+ //work around error in OOo 2.0 (problems with multiple series having a domain element)
+ if( !rFirstRangeForThisDomainIndex.getLength() || !aRange.equals(rFirstRangeForThisDomainIndex) )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_TABLE, XML_CELL_RANGE_ADDRESS, aRange);
+ SvXMLElementExport aDomain( rExport, XML_NAMESPACE_CHART, XML_DOMAIN, sal_True, sal_True );
+ bDomainExported = true;
+ }
+
+ if( !rFirstRangeForThisDomainIndex.getLength() )
+ rFirstRangeForThisDomainIndex = aRange;
+ }
+ return bDomainExported;
+}
+
} // anonymous namespace
struct SchXMLDataPointStruct
@@ -1092,6 +1116,16 @@ void SchXMLExportHelper::parseDocument( Reference< chart::XChartDocument >& rCha
if( bExportContent )
{
+ //export data provider in xlink:href attribute
+ const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
+ if( nCurrentODFVersion >= SvtSaveOptions::ODFVER_012 )
+ {
+ OUString aDataProviderURL( RTL_CONSTASCII_USTRINGPARAM( ".." ) );
+ if( xNewDoc->hasInternalDataProvider() )
+ aDataProviderURL = OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aDataProviderURL );
+ }
+
OUString sChartType( xDiagram->getDiagramType() );
// attributes
@@ -2488,7 +2522,8 @@ void SchXMLExportHelper::exportSeries(
return;
Reference< chart2::XChartDocument > xNewDoc( mrExport.GetModel(), uno::UNO_QUERY );
- OUString aFirstXRange;
+ OUString aFirstXDomainRange;
+ OUString aFirstYDomainRange;
std::vector< XMLPropertyState > aPropertyStates;
@@ -2537,7 +2572,6 @@ void SchXMLExportHelper::exportSeries(
xSource->getDataSequences());
sal_Int32 nMainSequenceIndex = -1;
sal_Int32 nSeriesLength = 0;
- sal_Int32 nSeqIdx=0;
sal_Int32 nAttachedAxis = chart::ChartAxisAssign::PRIMARY_Y;
sal_Bool bHasMeanValueLine = false;
chart::ChartRegressionCurveType eRegressionType( chart::ChartRegressionCurveType_NONE );
@@ -2550,29 +2584,32 @@ void SchXMLExportHelper::exportSeries(
{
Reference< chart2::data::XDataSequence > xValuesSeq;
Reference< chart2::data::XDataSequence > xLabelSeq;
- for( ;nMainSequenceIndex==-1 && nSeqIdx<aSeqCnt.getLength();
- ++nSeqIdx )
+ sal_Int32 nSeqIdx=0;
+ for( ; nSeqIdx<aSeqCnt.getLength(); ++nSeqIdx )
{
OUString aRole;
Reference< chart2::data::XDataSequence > xTempValueSeq( aSeqCnt[nSeqIdx]->getValues() );
- Reference< beans::XPropertySet > xSeqProp( xTempValueSeq, uno::UNO_QUERY );
- if( xSeqProp.is())
- xSeqProp->getPropertyValue(OUString::createFromAscii("Role")) >>= aRole;
- // "main" sequence
- if( aRole.equals( aLabelRole ))
+ if( nMainSequenceIndex==-1 )
{
- xValuesSeq.set( xTempValueSeq );
- xLabelSeq.set( aSeqCnt[nSeqIdx]->getLabel());
- // "main" sequence attributes exported, now go on with domains
- nMainSequenceIndex = nSeqIdx;
- break;
+ Reference< beans::XPropertySet > xSeqProp( xTempValueSeq, uno::UNO_QUERY );
+ if( xSeqProp.is())
+ xSeqProp->getPropertyValue(OUString::createFromAscii("Role")) >>= aRole;
+ // "main" sequence
+ if( aRole.equals( aLabelRole ))
+ {
+ xValuesSeq.set( xTempValueSeq );
+ xLabelSeq.set( aSeqCnt[nSeqIdx]->getLabel());
+ nMainSequenceIndex = nSeqIdx;
+ }
}
+ sal_Int32 nSequenceLength = (xTempValueSeq.is()? xTempValueSeq->getData().getLength() : sal_Int32(0));
+ if( nSeriesLength < nSequenceLength )
+ nSeriesLength = nSequenceLength;
}
// have found the main sequence, then xValuesSeq and
// xLabelSeq contain those. Otherwise both are empty
{
- nSeriesLength = (xValuesSeq.is()? xValuesSeq->getData().getLength() : sal_Int32(0));
// get property states for autostyles
try
{
@@ -2688,46 +2725,36 @@ void SchXMLExportHelper::exportSeries(
}
// export domain elements if we have a series parent element
- if( nMainSequenceIndex>-1 )
+ if( pSeries )
{
// domain elements
if( bExportContent )
{
- for( nSeqIdx=0; nSeqIdx<aSeqCnt.getLength(); ++nSeqIdx )
+ bool bIsScatterChart = aChartType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.ScatterChartType"));
+ bool bIsBubbleChart = aChartType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.BubbleChartType"));
+ Reference< chart2::data::XDataSequence > xYValuesForBubbleChart;
+ if( bIsBubbleChart )
+ {
+ Reference< chart2::data::XLabeledDataSequence > xSequence( lcl_getDataSequenceByRole( aSeqCnt, OUString::createFromAscii("values-y" ) ) );
+ if( xSequence.is() )
+ {
+ xYValuesForBubbleChart = xSequence->getValues();
+ if( !lcl_exportDomainForThisSequence( xYValuesForBubbleChart, aFirstYDomainRange, mrExport ) )
+ xYValuesForBubbleChart = 0;
+ }
+ }
+ if( bIsScatterChart || bIsBubbleChart )
{
- if( nSeqIdx != nMainSequenceIndex )
+ Reference< chart2::data::XLabeledDataSequence > xSequence( lcl_getDataSequenceByRole( aSeqCnt, OUString::createFromAscii("values-x" ) ) );
+ if( xSequence.is() )
{
- bool bExportDomain = false;
- //@todo: roles should be exported
- Reference< chart2::data::XDataSequence > xSeq( aSeqCnt[nSeqIdx]->getValues() );
- if( xSeq.is())
- {
- OUString aXRange( lcl_ConvertRange(
- xSeq->getSourceRangeRepresentation(), xNewDoc ) );
- //work around error in OOo 2.0 (problems with multiple series having a domain element)
- if( !aFirstXRange.getLength() || !aXRange.equals(aFirstXRange) )
- {
- bExportDomain = true;
- mrExport.AddAttribute( XML_NAMESPACE_TABLE, XML_CELL_RANGE_ADDRESS, aXRange);
- m_aDataSequencesToExport.push_back( tLabelValuesDataPair( 0, xSeq ));
- }
-
- if( !aFirstXRange.getLength() )
- aFirstXRange = aXRange;
- }
-// xSeq.set( aSeqCnt[nSeqIdx]->getLabel());
-// if( xSeq.is())
-// mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_LABEL_CELL_ADDRESS,
-// lcl_ConvertRange(
-// xSeq->getSourceRangeRepresentation(),
-// xNewDoc ));
- if( bExportDomain )
- {
- SvXMLElementExport aDomain( mrExport, XML_NAMESPACE_CHART,
- XML_DOMAIN, sal_True, sal_True );
- }
+ Reference< chart2::data::XDataSequence > xValues( xSequence->getValues() );
+ if( lcl_exportDomainForThisSequence( xValues, aFirstXDomainRange, mrExport ) )
+ m_aDataSequencesToExport.push_back( tLabelValuesDataPair( 0, xValues ));
}
}
+ if( xYValuesForBubbleChart.is() )
+ m_aDataSequencesToExport.push_back( tLabelValuesDataPair( 0, xYValuesForBubbleChart ));
}
}
@@ -3506,7 +3533,7 @@ void SchXMLExport::_ExportContent()
// check if we have own data. If so we must not export the complete
// range string, as this is our only indicator for having own or
// external data. @todo: fix this in the file format!
- Reference< lang::XServiceInfo > xDPServiceInfo( maExportHelper.GetDataProvider( xNewDoc ), uno::UNO_QUERY );
+ Reference< lang::XServiceInfo > xDPServiceInfo( xNewDoc->getDataProvider(), uno::UNO_QUERY );
if( ! (xDPServiceInfo.is() &&
xDPServiceInfo->getImplementationName().equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM( "com.sun.star.comp.chart.InternalDataProvider" ))))
@@ -3566,45 +3593,12 @@ void SchXMLExport::SetProgress( sal_Int32 nPercentage )
mxStatusIndicator->setValue( nPercentage );
}
-// static
-Reference< chart2::data::XDataProvider > SchXMLExportHelper::GetDataProvider(
- const Reference< chart2::XChartDocument > & xDoc )
-{
- Reference< chart2::data::XDataProvider > xResult;
- if( xDoc.is())
- {
- xResult.set( xDoc->getDataProvider());
- // allowed to attach a new data provider in export?
-// if( ! xResult.is())
-// {
-// Reference< container::XChild > xChild( xDoc, uno::UNO_QUERY );
-// if( xChild.is())
-// {
-// Reference< lang::XMultiServiceFactory > xFact( xChild->getParent(), uno::UNO_QUERY );
-// if( xFact.is())
-// {
-// xResult.set(
-// xFact->createInstance( OUString::createFromAscii("com.sun.star.chart2.data.DataProvider")),
-// uno::UNO_QUERY );
-// if( xResult.is())
-// {
-// Reference< chart2::data::XDataReceiver > xReceiver( xDoc, uno::UNO_QUERY );
-// if( xReceiver.is())
-// xReceiver->attachDataProvider( xResult );
-// }
-// }
-// }
-// }
- }
- return xResult;
-}
-
void SchXMLExportHelper::InitRangeSegmentationProperties( const Reference< chart2::XChartDocument > & xChartDoc )
{
if( xChartDoc.is())
try
{
- Reference< chart2::data::XDataProvider > xDataProvider( GetDataProvider( xChartDoc ));
+ Reference< chart2::data::XDataProvider > xDataProvider( xChartDoc->getDataProvider() );
OSL_ENSURE( xDataProvider.is(), "No DataProvider" );
if( xDataProvider.is())
{
diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx
index ca79b12a3e2d..831c15fb624e 100644
--- a/xmloff/source/chart/SchXMLImport.cxx
+++ b/xmloff/source/chart/SchXMLImport.cxx
@@ -346,6 +346,7 @@ const SvXMLTokenMap& SchXMLImportHelper::GetChartAttrTokenMap()
{
static __FAR_DATA SvXMLTokenMapEntry aChartAttrTokenMap[] =
{
+ { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_CHART_HREF },
{ XML_NAMESPACE_CHART, XML_CLASS, XML_TOK_CHART_CLASS },
{ XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_CHART_WIDTH },
{ XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_CHART_HEIGHT },
@@ -614,38 +615,6 @@ void SchXMLImportHelper::ResizeChartData( sal_Int32 nSeries, sal_Int32 nDataPoin
}
}
-// static
-Reference< chart2::data::XDataProvider > SchXMLImportHelper::GetDataProvider(
- const Reference< chart2::XChartDocument > & xDoc )
-{
- Reference< chart2::data::XDataProvider > xResult;
- if( xDoc.is())
- {
- try
- {
- xResult.set( xDoc->getDataProvider());
-// if( ! xResult.is())
-// {
-// Reference< container::XChild > xChild( xDoc, uno::UNO_QUERY_THROW );
-// Reference< lang::XMultiServiceFactory > xFact( xChild->getParent(), uno::UNO_QUERY );
-// if( xFact.is())
-// {
-// Reference< chart2::data::XDataReceiver > xReceiver( xDoc, uno::UNO_QUERY_THROW );
-// xResult.set(
-// xFact->createInstance( OUString::createFromAscii("com.sun.star.chart2.data.DataProvider")),
-// uno::UNO_QUERY_THROW );
-// xReceiver->attachDataProvider( xResult );
-// }
-// }
- }
- catch( const uno::Exception & )
- {
- // didn't get a data provider from the container
- }
- }
- return xResult;
-}
-
//static
void SchXMLImportHelper::DeleteDataSeries(
const Reference< chart2::XDataSeries > & xSeries,
@@ -796,6 +765,8 @@ SchXMLImport::SchXMLImport(
sal_uInt16 nImportFlags ) :
SvXMLImport( xServiceFactory, nImportFlags )
{
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK );
+
mbIsGraphicLoadOnDemandSupported = false;
}
@@ -807,6 +778,8 @@ SchXMLImport::SchXMLImport(
sal_Bool /*bLoadDoc*/, sal_Bool bShowProgress )
: SvXMLImport( xServiceFactory, xModel, rGrfContainer )
{
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK );
+
// get status indicator (if requested)
if( bShowProgress )
{
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
index bcf1f7abb3bf..8bb4712b4159 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
@@ -108,8 +108,10 @@ struct lcl_AxisHasCategories : public ::std::unary_function< SchXMLAxis, bool >
OUString lcl_ConvertRange( const ::rtl::OUString & rRange, const uno::Reference< chart2::XChartDocument > & xDoc )
{
OUString aResult = rRange;
+ if(!xDoc.is())
+ return aResult;
uno::Reference< chart2::data::XRangeXMLConversion > xConversion(
- SchXMLImportHelper::GetDataProvider( xDoc ), uno::UNO_QUERY );
+ xDoc->getDataProvider(), uno::UNO_QUERY );
if( xConversion.is())
aResult = xConversion->convertRangeFromXML( rRange );
return aResult;
@@ -177,10 +179,11 @@ SchXML3DSceneAttributesHelper::~SchXML3DSceneAttributesHelper()
SchXMLPlotAreaContext::SchXMLPlotAreaContext(
SchXMLImportHelper& rImpHelper,
SvXMLImport& rImport, const rtl::OUString& rLocalName,
+ const rtl::OUString& rXLinkHRefAttributeToIndicateDataProvider,
uno::Sequence< chart::ChartSeriesAddress >& rSeriesAddresses,
::rtl::OUString& rCategoriesAddress,
::rtl::OUString& rChartAddress,
- sal_Bool & rHasOwnTable,
+ bool& rbHasRangeAtPlotArea,
sal_Bool & rAllRangeAddressesAvailable,
sal_Bool & rColHasLabels,
sal_Bool & rRowHasLabels,
@@ -195,28 +198,27 @@ SchXMLPlotAreaContext::SchXMLPlotAreaContext(
mrCategoriesAddress( rCategoriesAddress ),
mrSeriesDefaultsAndStyles( rSeriesDefaultsAndStyles ),
mnNumOfLinesProp( 0 ),
- mnNumOfLinesReadBySeries( 0 ),
mbStockHasVolume( sal_False ),
mnSeries( 0 ),
- mnMaxSeriesLength( 0 ),
+ m_aGlobalSeriesImportInfo( rAllRangeAddressesAvailable ),
maSceneImportHelper( rImport ),
mbHasSize(false),
mbHasPosition(false),
mbPercentStacked(false),
m_bAxisPositionAttributeImported(false),
+ m_rXLinkHRefAttributeToIndicateDataProvider(rXLinkHRefAttributeToIndicateDataProvider),
mrChartAddress( rChartAddress ),
- mrHasOwnTable( rHasOwnTable ),
- mrAllRangeAddressesAvailable( rAllRangeAddressesAvailable ),
+ m_rbHasRangeAtPlotArea( rbHasRangeAtPlotArea ),
mrColHasLabels( rColHasLabels ),
mrRowHasLabels( rRowHasLabels ),
mrDataRowSource( rDataRowSource ),
- mnFirstFirstDomainIndex( -1 ),
maChartTypeServiceName( aChartTypeServiceName ),
mrLSequencesPerIndex( rLSequencesPerIndex ),
- mnCurrentDataIndex( 0 ),
mbGlobalChartTypeUsedBySeries( false ),
maChartSize( rChartSize )
{
+ m_rbHasRangeAtPlotArea = false;
+
// get Diagram
uno::Reference< chart::XChartDocument > xDoc( rImpHelper.GetChartDocument(), uno::UNO_QUERY );
if( xDoc.is())
@@ -342,7 +344,7 @@ void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttri
case XML_TOK_PA_CHART_ADDRESS:
mrChartAddress = lcl_ConvertRange( aValue, xNewDoc );
// indicator for getting data from the outside
- mrHasOwnTable = sal_False;
+ m_rbHasRangeAtPlotArea = true;
break;
case XML_TOK_PA_DS_HAS_LABELS:
{
@@ -518,7 +520,17 @@ void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttri
}
//
- if( mrHasOwnTable && mxNewDoc.is())
+ bool bCreateInternalDataProvider = false;
+ if( m_rXLinkHRefAttributeToIndicateDataProvider.equalsAscii( "." ) ) //data comes from the chart itself
+ bCreateInternalDataProvider = true;
+ else if( m_rXLinkHRefAttributeToIndicateDataProvider.equalsAscii( ".." ) ) //data comes from the parent application
+ bCreateInternalDataProvider = false;
+ else if( m_rXLinkHRefAttributeToIndicateDataProvider.getLength() ) //not supported so far to get the data by sibling objects -> fall back to chart itself
+ bCreateInternalDataProvider = true;
+ else if( !m_rbHasRangeAtPlotArea )
+ bCreateInternalDataProvider = true;
+
+ if( bCreateInternalDataProvider && mxNewDoc.is() )
{
// we have no complete range => we have own data, so switch the data
// provider to internal. Clone is not necessary, as we don't have any
@@ -578,14 +590,11 @@ SvXMLImportContext* SchXMLPlotAreaContext::CreateChildContext(
mrImportHelper, GetImport(), rLocalName,
mxNewDoc, maAxes,
mrSeriesDefaultsAndStyles.maSeriesStyleList,
- mnSeries, mnMaxSeriesLength,
- mnNumOfLinesReadBySeries, mbStockHasVolume,
- maFirstFirstDomainAddress,
- mnFirstFirstDomainIndex,
- mrAllRangeAddressesAvailable,
+ mnSeries,
+ mbStockHasVolume,
+ m_aGlobalSeriesImportInfo,
maChartTypeServiceName,
mrLSequencesPerIndex,
- mnCurrentDataIndex,
mbGlobalChartTypeUsedBySeries, maChartSize );
}
mnSeries++;
@@ -632,7 +641,7 @@ void SchXMLPlotAreaContext::EndElement()
if( mrCategoriesAddress.getLength() && mxNewDoc.is())
{
uno::Reference< chart2::data::XDataProvider > xDataProvider(
- mrImportHelper.GetDataProvider( mxNewDoc ));
+ mxNewDoc->getDataProvider() );
// @todo: correct coordinate system index
sal_Int32 nDimension( 0 );
::std::vector< SchXMLAxis >::const_iterator aIt(
@@ -659,15 +668,8 @@ void SchXMLPlotAreaContext::EndElement()
maSceneImportHelper.setSceneAttributes( xDiaProp );
}
- // if the property NumberOfLines and the number of series containing
- // class="chart:line" as attribute are both different from 0 they must
- // be equal
- OSL_ASSERT( mnNumOfLinesProp == 0 || mnNumOfLinesReadBySeries == 0 ||
- mnNumOfLinesProp == mnNumOfLinesReadBySeries );
-
// set correct number of lines at series
- if( ! mrAllRangeAddressesAvailable &&
- mnNumOfLinesReadBySeries == 0 &&
+ if( ! m_aGlobalSeriesImportInfo.rbAllRangeAddressesAvailable &&
mnNumOfLinesProp > 0 &&
maChartTypeServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.ColumnChartType" )))
{
@@ -1533,7 +1535,7 @@ SvXMLImportContext* SchXMLAxisContext::CreateChildContext(
break;
case XML_TOK_AXIS_CATEGORIES:
- pContext = new SchXMLCategoriesDomainContext( mrImportHelper, GetImport(),
+ pContext = new SchXMLCategoriesContext( mrImportHelper, GetImport(),
p_nPrefix, rLocalName,
mrCategoriesAddress );
maCurrentAxis.bHasCategories = true;
@@ -1640,7 +1642,7 @@ void SchXMLDataPointContext::StartElement( const uno::Reference< xml::sax::XAttr
// ========================================
-SchXMLCategoriesDomainContext::SchXMLCategoriesDomainContext(
+SchXMLCategoriesContext::SchXMLCategoriesContext(
SchXMLImportHelper& rImpHelper,
SvXMLImport& rImport,
sal_uInt16 nPrefix,
@@ -1652,11 +1654,11 @@ SchXMLCategoriesDomainContext::SchXMLCategoriesDomainContext(
{
}
-SchXMLCategoriesDomainContext::~SchXMLCategoriesDomainContext()
+SchXMLCategoriesContext::~SchXMLCategoriesContext()
{
}
-void SchXMLCategoriesDomainContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+void SchXMLCategoriesContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
{
sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.hxx b/xmloff/source/chart/SchXMLPlotAreaContext.hxx
index 2d14f9c644dc..ed01ad2fa8da 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.hxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.hxx
@@ -74,11 +74,12 @@ class SchXMLPlotAreaContext : public SvXMLImportContext
public:
SchXMLPlotAreaContext( SchXMLImportHelper& rImpHelper,
SvXMLImport& rImport, const rtl::OUString& rLocalName,
+ const rtl::OUString& rXLinkHRefAttributeToIndicateDataProvider,
::com::sun::star::uno::Sequence<
::com::sun::star::chart::ChartSeriesAddress >& rSeriesAddresses,
::rtl::OUString& rCategoriesAddress,
::rtl::OUString& rChartAddress,
- sal_Bool & rHasOwnTable,
+ bool& bHasRangeAtPlotArea,
sal_Bool & rAllRangeAddressesAvailable,
sal_Bool & rColHasLabels,
sal_Bool & rRowHasLabels,
@@ -107,10 +108,10 @@ private:
rtl::OUString& mrCategoriesAddress;
SeriesDefaultsAndStyles& mrSeriesDefaultsAndStyles;
sal_Int32 mnNumOfLinesProp;
- sal_Int32 mnNumOfLinesReadBySeries;
sal_Bool mbStockHasVolume;
sal_Int32 mnSeries;
- sal_Int32 mnMaxSeriesLength;
+ GlobalSeriesImportInfo m_aGlobalSeriesImportInfo;
+
SchXML3DSceneAttributesHelper maSceneImportHelper;
::com::sun::star::awt::Size maSize;
::com::sun::star::awt::Point maPosition;
@@ -119,19 +120,16 @@ private:
bool mbPercentStacked;
bool m_bAxisPositionAttributeImported;
::rtl::OUString msAutoStyleName;
+ const ::rtl::OUString& m_rXLinkHRefAttributeToIndicateDataProvider;
::rtl::OUString& mrChartAddress;
- sal_Bool & mrHasOwnTable;
- sal_Bool & mrAllRangeAddressesAvailable;
+ bool& m_rbHasRangeAtPlotArea;
sal_Bool & mrColHasLabels;
sal_Bool & mrRowHasLabels;
::com::sun::star::chart::ChartDataRowSource & mrDataRowSource;
- ::rtl::OUString maFirstFirstDomainAddress;
- sal_Int32 mnFirstFirstDomainIndex;
-
::rtl::OUString maChartTypeServiceName;
tSchXMLLSequencesPerIndex & mrLSequencesPerIndex;
- sal_Int32 mnCurrentDataIndex;
+
bool mbGlobalChartTypeUsedBySeries;
::com::sun::star::awt::Size maChartSize;
};
@@ -203,19 +201,19 @@ public:
// ----------------------------------------
-class SchXMLCategoriesDomainContext : public SvXMLImportContext
+class SchXMLCategoriesContext : public SvXMLImportContext
{
private:
SchXMLImportHelper& mrImportHelper;
rtl::OUString& mrAddress;
public:
- SchXMLCategoriesDomainContext( SchXMLImportHelper& rImpHelper,
+ SchXMLCategoriesContext( SchXMLImportHelper& rImpHelper,
SvXMLImport& rImport,
sal_uInt16 nPrefix,
const rtl::OUString& rLocalName,
rtl::OUString& rAddress );
- virtual ~SchXMLCategoriesDomainContext();
+ virtual ~SchXMLCategoriesContext();
virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
};
diff --git a/xmloff/source/chart/SchXMLSeries2Context.cxx b/xmloff/source/chart/SchXMLSeries2Context.cxx
index 07dda88800c4..4633a149e4df 100644
--- a/xmloff/source/chart/SchXMLSeries2Context.cxx
+++ b/xmloff/source/chart/SchXMLSeries2Context.cxx
@@ -81,11 +81,10 @@ using ::rtl::OUStringBuffer;
namespace
{
-OUString lcl_ConvertRange( const ::rtl::OUString & rRange, const Reference< chart2::XChartDocument > & xDoc )
+OUString lcl_ConvertRange( const ::rtl::OUString & rRange, const Reference< chart2::data::XDataProvider >& xDataProvider )
{
OUString aResult = rRange;
- Reference< chart2::data::XRangeXMLConversion > xConversion(
- SchXMLImportHelper::GetDataProvider( xDoc ), uno::UNO_QUERY );
+ Reference< chart2::data::XRangeXMLConversion > xConversion( xDataProvider, uno::UNO_QUERY );
if( xConversion.is())
aResult = xConversion->convertRangeFromXML( rRange );
return aResult;
@@ -234,6 +233,54 @@ void lcl_insertErrorBarLSequencesToMap(
}
}
+Reference< chart2::data::XLabeledDataSequence > lcl_createAndAddSequenceToSeries( const rtl::OUString& rRole
+ , const rtl::OUString& rRange
+ , const Reference< chart2::data::XDataProvider >& xDataProvider
+ , const Reference< chart2::XDataSeries >& xSeries )
+{
+ Reference< chart2::data::XLabeledDataSequence > xLabeledSeq;
+
+ Reference< chart2::data::XDataSource > xSeriesSource( xSeries,uno::UNO_QUERY );
+ Reference< chart2::data::XDataSink > xSeriesSink( xSeries, uno::UNO_QUERY );
+
+ if( !(rRange.getLength() && xDataProvider.is() && xSeriesSource.is() && xSeriesSink.is()) )
+ return xLabeledSeq;
+
+ // create a new sequence
+ xLabeledSeq = SchXMLTools::GetNewLabeledDataSequence();
+
+ // set values at the new sequence
+ Reference< chart2::data::XDataSequence > xSeq;
+ try
+ {
+ xSeq.set( xDataProvider->createDataSequenceByRangeRepresentation( lcl_ConvertRange( rRange, xDataProvider )));
+ SchXMLTools::setXMLRangePropertyAtDataSequence( xSeq, rRange );
+ }
+ catch( const lang::IllegalArgumentException & ex )
+ {
+ (void)ex; // avoid warning for pro build
+ OSL_ENSURE( false, ::rtl::OUStringToOString(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IllegalArgumentException caught, Message: " )) +
+ ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+ }
+
+ Reference< beans::XPropertySet > xSeqProp( xSeq, uno::UNO_QUERY );
+ if( xSeqProp.is())
+ xSeqProp->setPropertyValue(OUString::createFromAscii("Role"), uno::makeAny( rRole));
+ xLabeledSeq->setValues( xSeq );
+
+ // add new sequence to data series / push to front to have the correct sequence order if charttype is changed afterwards
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aOldSeq( xSeriesSource->getDataSequences());
+ sal_Int32 nOldCount = aOldSeq.getLength();
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aNewSeq( nOldCount + 1 );
+ aNewSeq[0]=xLabeledSeq;
+ for( sal_Int32 nN=0; nN<nOldCount; nN++ )
+ aNewSeq[nN+1] = aOldSeq[nN];
+ xSeriesSink->setData( aNewSeq );
+
+ return xLabeledSeq;
+}
+
} // anonymous namespace
// ================================================================================
@@ -245,15 +292,10 @@ SchXMLSeries2Context::SchXMLSeries2Context(
std::vector< SchXMLAxis >& rAxes,
::std::list< DataRowPointStyle >& rStyleList,
sal_Int32 nSeriesIndex,
- sal_Int32& rMaxSeriesLength,
- sal_Int32& rNumOfLines,
- sal_Bool& rStockHasVolume,
- ::rtl::OUString& rFirstFirstDomainAddress,
- sal_Int32& rFirstFirstDomainIndex,
- sal_Bool& rAllRangeAddressesAvailable,
+ sal_Bool bStockHasVolume,
+ GlobalSeriesImportInfo& rGlobalSeriesImportInfo,
const OUString & aGlobalChartTypeName,
tSchXMLLSequencesPerIndex & rLSequencesPerIndex,
- sal_Int32& rCurrentDataIndex,
bool& rGlobalChartTypeUsedBySeries,
const awt::Size & rChartSize ) :
SvXMLImportContext( rImport, XML_NAMESPACE_CHART, rLocalName ),
@@ -264,18 +306,13 @@ SchXMLSeries2Context::SchXMLSeries2Context(
m_xSeries(0),
mnSeriesIndex( nSeriesIndex ),
mnDataPointIndex( 0 ),
- mrMaxSeriesLength( rMaxSeriesLength ),
- mrNumOfLines( rNumOfLines ),
- mrStockHasVolume( rStockHasVolume ),
- mrFirstFirstDomainAddress(rFirstFirstDomainAddress),
- mrFirstFirstDomainIndex(rFirstFirstDomainIndex),
- mrAllRangeAddressesAvailable( rAllRangeAddressesAvailable ),
+ m_bStockHasVolume( bStockHasVolume ),
+ m_rGlobalSeriesImportInfo(rGlobalSeriesImportInfo),
mpAttachedAxis( NULL ),
maGlobalChartTypeName( aGlobalChartTypeName ),
maSeriesChartTypeName( aGlobalChartTypeName ),
m_bHasDomainContext(false),
mrLSequencesPerIndex( rLSequencesPerIndex ),
- mrCurrentDataIndex( rCurrentDataIndex ),
mrGlobalChartTypeUsedBySeries( rGlobalChartTypeUsedBySeries ),
mbSymbolSizeIsMissingInFile(false),
maChartSize( rChartSize )
@@ -304,7 +341,7 @@ void SchXMLSeries2Context::StartElement( const uno::Reference< xml::sax::XAttrib
Reference< chart2::data::XRangeXMLConversion > xRangeConversion;
if( mxNewDoc.is())
- xRangeConversion.set( mrImportHelper.GetDataProvider( mxNewDoc ), uno::UNO_QUERY );
+ xRangeConversion.set( mxNewDoc->getDataProvider(), uno::UNO_QUERY );
for( sal_Int16 i = 0; i < nAttrCount; i++ )
{
@@ -369,10 +406,10 @@ void SchXMLSeries2Context::StartElement( const uno::Reference< xml::sax::XAttrib
OSL_ASSERT( mxNewDoc.is());
if( mxNewDoc.is())
{
- if( mrAllRangeAddressesAvailable && ! bHasRange )
- mrAllRangeAddressesAvailable = sal_False;
+ if( m_rGlobalSeriesImportInfo.rbAllRangeAddressesAvailable && ! bHasRange )
+ m_rGlobalSeriesImportInfo.rbAllRangeAddressesAvailable = sal_False;
- Reference< chart2::data::XDataProvider > xDataProvider( mrImportHelper.GetDataProvider( mxNewDoc ));
+ Reference< chart2::data::XDataProvider > xDataProvider( mxNewDoc->getDataProvider() );
if( xDataProvider.is())
{
bool bIsCandleStick = maGlobalChartTypeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.CandleStickChartType"));
@@ -383,7 +420,7 @@ void SchXMLSeries2Context::StartElement( const uno::Reference< xml::sax::XAttrib
else
{
if( bIsCandleStick
- && mrStockHasVolume
+ && m_bStockHasVolume
&& mnSeriesIndex == 0 )
{
maSeriesChartTypeName = OUString::createFromAscii( "com.sun.star.chart2.ColumnChartType" );
@@ -424,7 +461,7 @@ void SchXMLSeries2Context::StartElement( const uno::Reference< xml::sax::XAttrib
if( bHasRange )
try
{
- xSeq.set( xDataProvider->createDataSequenceByRangeRepresentation( lcl_ConvertRange( m_aSeriesRange, mxNewDoc )));
+ xSeq.set( xDataProvider->createDataSequenceByRangeRepresentation( lcl_ConvertRange( m_aSeriesRange, xDataProvider )));
SchXMLTools::setXMLRangePropertyAtDataSequence( xSeq, m_aSeriesRange );
}
catch( const lang::IllegalArgumentException & ex )
@@ -438,16 +475,17 @@ void SchXMLSeries2Context::StartElement( const uno::Reference< xml::sax::XAttrib
Reference< beans::XPropertySet > xSeqProp( xSeq, uno::UNO_QUERY );
if( xSeqProp.is())
{
- //@todo: set correct role ("main role" dependent on chart type)
- xSeqProp->setPropertyValue(OUString::createFromAscii("Role"),
- uno::makeAny( OUString::createFromAscii("values-y")));
+ OUString aMainRole( OUString::createFromAscii("values-y") );
+ if( maSeriesChartTypeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.BubbleChartType") ) )
+ aMainRole = OUString::createFromAscii("values-size");
+ xSeqProp->setPropertyValue(OUString::createFromAscii("Role"), uno::makeAny( aMainRole ));
}
xLabeledSeq->setValues( xSeq );
// register for setting local data if external data provider is not present
maPostponedSequences.insert(
tSchXMLLSequencesPerIndex::value_type(
- tSchXMLIndexWithPart( mrCurrentDataIndex, SCH_XML_PART_VALUES ), xLabeledSeq ));
+ tSchXMLIndexWithPart( m_rGlobalSeriesImportInfo.nCurrentDataIndex, SCH_XML_PART_VALUES ), xLabeledSeq ));
// label
if( bHasLabelRange )
@@ -456,7 +494,7 @@ void SchXMLSeries2Context::StartElement( const uno::Reference< xml::sax::XAttrib
{
Reference< chart2::data::XDataSequence > xLabelSequence(
xDataProvider->createDataSequenceByRangeRepresentation(
- lcl_ConvertRange( m_aSeriesLabelRange, mxNewDoc )));
+ lcl_ConvertRange( m_aSeriesLabelRange, xDataProvider )));
xLabeledSeq->setLabel( xLabelSequence );
SchXMLTools::setXMLRangePropertyAtDataSequence( xLabelSequence, m_aSeriesLabelRange );
}
@@ -475,7 +513,7 @@ void SchXMLSeries2Context::StartElement( const uno::Reference< xml::sax::XAttrib
// used for the internal data.
maPostponedSequences.insert(
tSchXMLLSequencesPerIndex::value_type(
- tSchXMLIndexWithPart( mrCurrentDataIndex, SCH_XML_PART_LABEL ), xLabeledSeq ));
+ tSchXMLIndexWithPart( m_rGlobalSeriesImportInfo.nCurrentDataIndex, SCH_XML_PART_LABEL ), xLabeledSeq ));
Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeq( &xLabeledSeq, 1 );
@@ -519,47 +557,91 @@ void SchXMLSeries2Context::StartElement( const uno::Reference< xml::sax::XAttrib
}
}
+struct DomainInfo
+{
+ DomainInfo( const rtl::OUString& rRole, const rtl::OUString& rRange, sal_Int32 nIndex )
+ : aRole(rRole), aRange(rRange), nIndexForLocalData(nIndex)
+ {}
+
+ rtl::OUString aRole;
+ rtl::OUString aRange;
+ sal_Int32 nIndexForLocalData;
+};
+
void SchXMLSeries2Context::EndElement()
{
// special handling for different chart types. This is necessary as the
// roles are not yet saved in the file format
- OUString aXValuesRange( mrFirstFirstDomainAddress );
- sal_Int32 nCurrentDataIndexBeforeDomains = mrCurrentDataIndex;
- sal_Int32 nDomainOffset = 0;
- bool bCreateXValues = false;
- bool bHasOwnDomains = false;
+ sal_Int32 nDomainCount = maDomainAddresses.size();
+ bool bIsScatterChart = maSeriesChartTypeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.ScatterChartType"));
+ bool bIsBubbleChart = maSeriesChartTypeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.BubbleChartType"));
bool bDeleteSeries = false;
- if( maDomainAddresses.size() == 1 ||
- maSeriesChartTypeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.ScatterChartType")) )
+ std::vector< DomainInfo > aDomainInfos;
+
+ //different handling for different chart types necessary
+ if( bIsScatterChart || ( nDomainCount==1 && !bIsBubbleChart ) )
{
- bCreateXValues = true;
+ DomainInfo aDomainInfo( OUString::createFromAscii("values-x"), m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress, m_rGlobalSeriesImportInfo.nFirstFirstDomainIndex ) ;
+ bool bCreateXValues = true;
if( !maDomainAddresses.empty() )
{
- aXValuesRange = maDomainAddresses.front();
- bHasOwnDomains = true;
- if(!mrFirstFirstDomainAddress.getLength())
+ if( !m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress.getLength() )
{
- mrFirstFirstDomainAddress=aXValuesRange;
- mrFirstFirstDomainIndex=mrCurrentDataIndex;
+ m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress = maDomainAddresses.front();
+ m_rGlobalSeriesImportInfo.nFirstFirstDomainIndex = m_rGlobalSeriesImportInfo.nCurrentDataIndex;
}
+ aDomainInfo.aRange = maDomainAddresses.front();
+ aDomainInfo.nIndexForLocalData = m_rGlobalSeriesImportInfo.nCurrentDataIndex;
+ m_rGlobalSeriesImportInfo.nCurrentDataIndex++;
}
- else if( !mrFirstFirstDomainAddress.getLength() && !m_bHasDomainContext && mnSeriesIndex==0 )
+ else if( !m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress.getLength() && !m_bHasDomainContext && mnSeriesIndex==0 )
{
if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan2_3( GetImport().GetModel() ) ) //wrong old chart files:
{
//for xy charts the first series needs to have a domain
//if this by error iss not the case the first series is taken s x values
//needed for wrong files created while having an addin (e.g. BoxPlot)
- mrFirstFirstDomainAddress = m_aSeriesRange;
- mrFirstFirstDomainIndex = mrCurrentDataIndex;
+ m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress = m_aSeriesRange;
+ m_rGlobalSeriesImportInfo.nFirstFirstDomainIndex = m_rGlobalSeriesImportInfo.nCurrentDataIndex++;
bDeleteSeries = true;
bCreateXValues = false;//they will be created for the next series
}
}
+ if( bCreateXValues )
+ aDomainInfos.push_back( aDomainInfo );
+ }
+ else if( bIsBubbleChart )
+ {
+ if( nDomainCount>1 )
+ {
+ DomainInfo aDomainInfo( OUString::createFromAscii("values-x"), maDomainAddresses[1], m_rGlobalSeriesImportInfo.nCurrentDataIndex ) ;
+ if( !m_rGlobalSeriesImportInfo.aFirstSecondDomainAddress.getLength() )
+ {
+ //for bubble chart the second domain contains the x values which should become an index smaller than y values for own data table
+ //->so second first
+ m_rGlobalSeriesImportInfo.aFirstSecondDomainAddress = maDomainAddresses[1];
+ m_rGlobalSeriesImportInfo.nFirstSecondDomainIndex = m_rGlobalSeriesImportInfo.nCurrentDataIndex;
+ }
+ aDomainInfos.push_back( aDomainInfo );
+ m_rGlobalSeriesImportInfo.nCurrentDataIndex++;
+ }
+ else if( m_rGlobalSeriesImportInfo.aFirstSecondDomainAddress.getLength() )
+ {
+ DomainInfo aDomainInfo( OUString::createFromAscii("values-x"), m_rGlobalSeriesImportInfo.aFirstSecondDomainAddress, m_rGlobalSeriesImportInfo.nFirstSecondDomainIndex ) ;
+ aDomainInfos.push_back( aDomainInfo );
+ }
+ if( nDomainCount>0)
+ {
+ DomainInfo aDomainInfo( OUString::createFromAscii("values-y"), maDomainAddresses.front(), m_rGlobalSeriesImportInfo.nCurrentDataIndex ) ;
+ if( !m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress.getLength() )
+ {
+ m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress = maDomainAddresses.front();
+ m_rGlobalSeriesImportInfo.nFirstFirstDomainIndex = m_rGlobalSeriesImportInfo.nCurrentDataIndex;
+ }
+ aDomainInfos.push_back( aDomainInfo );
+ m_rGlobalSeriesImportInfo.nCurrentDataIndex++;
+ }
}
-
- if( mrMaxSeriesLength < mnDataPointIndex )
- mrMaxSeriesLength = mnDataPointIndex;
if( bDeleteSeries )
{
@@ -583,71 +665,22 @@ void SchXMLSeries2Context::EndElement()
}
}
- if( bCreateXValues && aXValuesRange.getLength())
+ Reference< chart2::data::XDataProvider > xDataProvider;
+ if ( mxNewDoc.is() ) {
+ xDataProvider = mxNewDoc->getDataProvider();
+ }
+ for( std::vector< DomainInfo >::reverse_iterator aIt( aDomainInfos.rbegin() ); aIt!= aDomainInfos.rend(); ++aIt )
{
- Reference< chart2::data::XDataProvider > xDataProvider( mrImportHelper.GetDataProvider( mxNewDoc ));
- if( !(m_xSeries.is() && xDataProvider.is()))
- return;
-
- Reference< chart2::data::XDataSource > xSeriesSource( m_xSeries,uno::UNO_QUERY );
- if( ! xSeriesSource.is())
- return;
-
- // assume we have a scatter chart
-
- // create new sequence for x-values
- Reference< chart2::data::XLabeledDataSequence > xLabeledSeq(
- SchXMLTools::GetNewLabeledDataSequence());
-
- // values
- Reference< chart2::data::XDataSequence > xSeq;
- try
- {
- xSeq.set( xDataProvider->createDataSequenceByRangeRepresentation( lcl_ConvertRange( aXValuesRange, mxNewDoc )));
- SchXMLTools::setXMLRangePropertyAtDataSequence( xSeq, aXValuesRange );
- }
- catch( const lang::IllegalArgumentException & ex )
- {
- (void)ex; // avoid warning for pro build
- OSL_ENSURE( false, ::rtl::OUStringToOString(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IllegalArgumentException caught, Message: " )) +
- ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
- }
-
- Reference< beans::XPropertySet > xSeqProp( xSeq, uno::UNO_QUERY );
- if( xSeqProp.is())
- {
- xSeqProp->setPropertyValue(OUString::createFromAscii("Role"),
- uno::makeAny( OUString::createFromAscii("values-x")));
- }
- xLabeledSeq->setValues( xSeq );
-
- // register for setting local data if external data provider is not present
- if( bHasOwnDomains )
- {
- mrLSequencesPerIndex.insert(
- tSchXMLLSequencesPerIndex::value_type(
- tSchXMLIndexWithPart( mrCurrentDataIndex, SCH_XML_PART_VALUES ), xLabeledSeq ));
- ++mrCurrentDataIndex;
-
- nDomainOffset = mrCurrentDataIndex - nCurrentDataIndexBeforeDomains;
- }
- else
+ DomainInfo aDomainInfo( *aIt );
+ Reference< chart2::data::XLabeledDataSequence > xLabeledSeq =
+ lcl_createAndAddSequenceToSeries( aDomainInfo.aRole, aDomainInfo.aRange, xDataProvider, m_xSeries );
+ if( xLabeledSeq.is() )
{
+ // register for setting local data if external data provider is not present
mrLSequencesPerIndex.insert(
tSchXMLLSequencesPerIndex::value_type(
- tSchXMLIndexWithPart( mrFirstFirstDomainIndex, SCH_XML_PART_VALUES ), xLabeledSeq ));
+ tSchXMLIndexWithPart( aDomainInfo.nIndexForLocalData, SCH_XML_PART_VALUES ), xLabeledSeq ));
}
-
- // @todo? export and import labels for domains?
-
- // add new sequence to data series
- Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeq( xSeriesSource->getDataSequences());
- aSeq.realloc( aSeq.getLength() + 1 );
- aSeq[aSeq.getLength()-1] = xLabeledSeq;
- Reference< chart2::data::XDataSink > xSink( xSeriesSource, uno::UNO_QUERY );
- if( xSink.is())
- xSink->setData( aSeq );
}
if( !bDeleteSeries )
@@ -655,18 +688,14 @@ void SchXMLSeries2Context::EndElement()
for( tSchXMLLSequencesPerIndex::const_iterator aIt( maPostponedSequences.begin());
aIt != maPostponedSequences.end(); ++aIt )
{
- sal_Int32 nNewIndex = aIt->first.first + nDomainOffset;
+ sal_Int32 nNewIndex = aIt->first.first + nDomainCount;
mrLSequencesPerIndex.insert(
tSchXMLLSequencesPerIndex::value_type(
tSchXMLIndexWithPart( nNewIndex, aIt->first.second ), aIt->second ));
}
+ m_rGlobalSeriesImportInfo.nCurrentDataIndex++;
}
maPostponedSequences.clear();
-
- if( bHasOwnDomains )
- mrCurrentDataIndex += nDomainOffset;
- else
- ++mrCurrentDataIndex;
}
SvXMLImportContext* SchXMLSeries2Context::CreateChildContext(
diff --git a/xmloff/source/chart/SchXMLSeries2Context.hxx b/xmloff/source/chart/SchXMLSeries2Context.hxx
index f540179186ca..f0c8996de539 100644
--- a/xmloff/source/chart/SchXMLSeries2Context.hxx
+++ b/xmloff/source/chart/SchXMLSeries2Context.hxx
@@ -62,12 +62,10 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > m_xSeries;
sal_Int32 mnSeriesIndex;
sal_Int32 mnDataPointIndex;
- sal_Int32& mrMaxSeriesLength;
- sal_Int32& mrNumOfLines;
- sal_Bool& mrStockHasVolume;
- ::rtl::OUString& mrFirstFirstDomainAddress;
- sal_Int32& mrFirstFirstDomainIndex;
- sal_Bool& mrAllRangeAddressesAvailable;
+ sal_Bool m_bStockHasVolume;
+
+ GlobalSeriesImportInfo& m_rGlobalSeriesImportInfo;
+
SchXMLAxis* mpAttachedAxis;
sal_Int32 mnAttachedAxis;
::rtl::OUString msAutoStyleName;
@@ -78,7 +76,6 @@ private:
::rtl::OUString m_aSeriesLabelRange;
bool m_bHasDomainContext;
tSchXMLLSequencesPerIndex & mrLSequencesPerIndex;
- sal_Int32& mrCurrentDataIndex;
tSchXMLLSequencesPerIndex maPostponedSequences;
bool& mrGlobalChartTypeUsedBySeries;
bool mbSymbolSizeIsMissingInFile;
@@ -92,15 +89,10 @@ public:
std::vector< SchXMLAxis >& rAxes,
::std::list< DataRowPointStyle >& rStyleList,
sal_Int32 nSeriesIndex,
- sal_Int32& rMaxSeriesLength,
- sal_Int32& rNumOfLines,
- sal_Bool& rStockHasVolume,
- ::rtl::OUString& rFirstFirstDomainAddress,
- sal_Int32& rFirstFirstDomainIndex,
- sal_Bool& rAllRangeAddressesAvailable,
+ sal_Bool bStockHasVolume,
+ GlobalSeriesImportInfo& rGlobalSeriesImportInfo,
const ::rtl::OUString & aGlobalChartTypeName,
tSchXMLLSequencesPerIndex & rLSequencesPerIndex,
- sal_Int32& rCurrentDataIndex,
bool& rGlobalChartTypeUsedBySeries,
const ::com::sun::star::awt::Size & rChartSize );
virtual ~SchXMLSeries2Context();
diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx
index 046da76497d7..4eb17d289d73 100644
--- a/xmloff/source/chart/SchXMLTableContext.cxx
+++ b/xmloff/source/chart/SchXMLTableContext.cxx
@@ -343,37 +343,6 @@ void lcl_fillRangeMapping(
}
}
-void lcl_copyProperties(
- const Reference< beans::XPropertySet > & xSource,
- const Reference< beans::XPropertySet > & xDestination )
-{
- if( ! (xSource.is() && xDestination.is()))
- return;
-
- try
- {
- Reference< beans::XPropertySetInfo > xSrcInfo( xSource->getPropertySetInfo(), uno::UNO_QUERY_THROW );
- Reference< beans::XPropertySetInfo > xDestInfo( xDestination->getPropertySetInfo(), uno::UNO_QUERY_THROW );
- Sequence< beans::Property > aProperties( xSrcInfo->getProperties());
- const sal_Int32 nLength = aProperties.getLength();
- for( sal_Int32 i = 0; i < nLength; ++i )
- {
- OUString aName( aProperties[i].Name);
- if( xDestInfo->hasPropertyByName( aName ))
- {
- beans::Property aProp( xDestInfo->getPropertyByName( aName ));
- if( (aProp.Attributes & beans::PropertyAttribute::READONLY) == 0 )
- xDestination->setPropertyValue(
- aName, xSource->getPropertyValue( aName ));
- }
- }
- }
- catch( const uno::Exception & )
- {
- OSL_ENSURE( false, "Copying property sets failed!" );
- }
-}
-
Reference< chart2::data::XDataSequence >
lcl_reassignDataSequence(
const Reference< chart2::data::XDataSequence > & xSequence,
@@ -1016,7 +985,7 @@ void SchXMLTableHelper::applyTableSimple(
// ----------------------------------------
-void SchXMLTableHelper::applyTable(
+void SchXMLTableHelper::applyTableToInternalDataProvider(
const SchXMLTable& rTable,
uno::Reference< chart2::XChartDocument > xChartDoc )
{
@@ -1031,19 +1000,12 @@ void SchXMLTableHelper::applyTable(
// prerequisite for this method: all objects (data series, domains, etc.)
// need their own range string.
- // If the range-strings are valid (starting with "local-table") they should
- // be interpreted like given, otherwise (when the ranges refer to Calc- or
- // Writer-ranges, but the container is not available like when pasting a
- // chart from Calc to Impress) the range is ignored, and every object gets
- // one table column in the order of appearance, which is: 1. categories,
- // 2. data series: 2.a) domains, 2.b) values (main-role, usually y-values)
-
// apply all data read in the table to the chart data-array of the internal
// data provider
lcl_applyXMLTableToInternalDataprovider( rTable, xDataArray );
}
-void SchXMLTableHelper::postProcessTable(
+void SchXMLTableHelper::switchRangesFromOuterToInternalIfNecessary(
const SchXMLTable& rTable,
const tSchXMLLSequencesPerIndex & rLSequencesPerIndex,
uno::Reference< chart2::XChartDocument > xChartDoc,
@@ -1051,6 +1013,14 @@ void SchXMLTableHelper::postProcessTable(
{
if( ! (xChartDoc.is() && xChartDoc->hasInternalDataProvider()))
return;
+
+ // If the range-strings are valid (starting with "local-table") they should
+ // be interpreted like given, otherwise (when the ranges refer to Calc- or
+ // Writer-ranges, but the container is not available like when pasting a
+ // chart from Calc to Impress) the range is ignored, and every object gets
+ // one table column in the order of appearance, which is: 1. categories,
+ // 2. data series: 2.a) domains, 2.b) values (main-role, usually y-values)
+
Reference< chart2::data::XDataProvider > xDataProv( xChartDoc->getDataProvider());
// create a mapping from original ranges to new ranges
@@ -1079,7 +1049,7 @@ void SchXMLTableHelper::postProcessTable(
lcl_reassignDataSequence( xSeq, xDataProv, aRangeMap, aRange ));
if( xNewSeq != xSeq )
{
- lcl_copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ),
+ SchXMLTools::copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ),
Reference< beans::XPropertySet >( xNewSeq, uno::UNO_QUERY ));
aLSeqIt->second->setValues( xNewSeq );
}
@@ -1099,7 +1069,7 @@ void SchXMLTableHelper::postProcessTable(
Reference< chart2::data::XDataSequence > xNewSequence(
xDataProv->createDataSequenceByRangeRepresentation(
OUString(RTL_CONSTASCII_USTRINGPARAM("categories"))));
- lcl_copyProperties(
+ SchXMLTools::copyProperties(
xOldSequenceProp, Reference< beans::XPropertySet >( xNewSequence, uno::UNO_QUERY ));
aLSeqIt->second->setValues( xNewSequence );
bCategoriesApplied = true;
@@ -1110,7 +1080,7 @@ void SchXMLTableHelper::postProcessTable(
OUString aRep( OUString::valueOf( aLSeqIt->first.first ));
Reference< chart2::data::XDataSequence > xNewSequence(
xDataProv->createDataSequenceByRangeRepresentation( aRep ));
- lcl_copyProperties(
+ SchXMLTools::copyProperties(
xOldSequenceProp, Reference< beans::XPropertySet >( xNewSequence, uno::UNO_QUERY ));
aLSeqIt->second->setValues( xNewSequence );
}
@@ -1131,7 +1101,7 @@ void SchXMLTableHelper::postProcessTable(
lcl_reassignDataSequence( xSeq, xDataProv, aRangeMap, aRange ));
if( xNewSeq != xSeq )
{
- lcl_copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ),
+ SchXMLTools::copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ),
Reference< beans::XPropertySet >( xNewSeq, uno::UNO_QUERY ));
aLSeqIt->second->setLabel( xNewSeq );
}
@@ -1143,7 +1113,7 @@ void SchXMLTableHelper::postProcessTable(
Reference< chart2::data::XDataSequence > xNewSeq(
xDataProv->createDataSequenceByRangeRepresentation( aRep ));
- lcl_copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ),
+ SchXMLTools::copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ),
Reference< beans::XPropertySet >( xNewSeq, uno::UNO_QUERY ));
aLSeqIt->second->setLabel( xNewSeq );
}
diff --git a/xmloff/source/chart/SchXMLTableContext.hxx b/xmloff/source/chart/SchXMLTableContext.hxx
index 8a9ea5c369a0..7cff3e7ecff7 100644
--- a/xmloff/source/chart/SchXMLTableContext.hxx
+++ b/xmloff/source/chart/SchXMLTableContext.hxx
@@ -108,14 +108,14 @@ public:
table, the addresses of series, the addresses of labels,
the cell-range-address for the categories
*/
- static void applyTable( const SchXMLTable& rTable,
+ static void applyTableToInternalDataProvider( const SchXMLTable& rTable,
com::sun::star::uno::Reference< com::sun::star::chart2::XChartDocument > xChartDoc );
- /** Second part of applyTable that has to be called after the data series
+ /** Second part of applyTableToInternalDataProvider that has to be called after the data series
got their styles set. This function reorders local data to fit the
correct data structure.
*/
- static void postProcessTable( const SchXMLTable& rTable,
+ static void switchRangesFromOuterToInternalIfNecessary( const SchXMLTable& rTable,
const tSchXMLLSequencesPerIndex & rLSequencesPerIndex,
com::sun::star::uno::Reference< com::sun::star::chart2::XChartDocument > xChartDoc,
::com::sun::star::chart::ChartDataRowSource eDataRowSource );
diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx
index 7915c9e4e8c1..57ba65868140 100644
--- a/xmloff/source/chart/SchXMLTools.cxx
+++ b/xmloff/source/chart/SchXMLTools.cxx
@@ -54,8 +54,10 @@
#include <xmloff/xmlexp.hxx>
#include "xmlnmspe.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/chart2/data/XDataProvider.hpp>
+#include <com/sun/star/chart2/data/XDataReceiver.hpp>
#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
@@ -123,6 +125,24 @@ sal_Int32 lcl_getBuildIDFromGenerator( const ::rtl::OUString& rGenerator )
return nBuildId;
}
+Reference< chart2::data::XDataSequence > lcl_createNewSequenceFromCachedXMLRange( const Reference< chart2::data::XDataSequence >& xSeq, const Reference< chart2::data::XDataProvider >& xDataProvider )
+{
+ Reference< chart2::data::XDataSequence > xRet;
+ OUString aRange;
+ Reference< chart2::data::XRangeXMLConversion > xRangeConversion( xDataProvider, uno::UNO_QUERY );
+ if( xRangeConversion.is() )
+ {
+ if( xSeq.is() && SchXMLTools::getXMLRangePropertyFromDataSequence( xSeq, aRange, /* bClearProp = */ true ) )
+ {
+ xRet.set( xDataProvider->createDataSequenceByRangeRepresentation(
+ xRangeConversion->convertRangeFromXML( aRange )) );
+ SchXMLTools::copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ),
+ Reference< beans::XPropertySet >( xRet, uno::UNO_QUERY ));
+ }
+ }
+ return xRet;
+}
+
} // anonymous namespace
// ----------------------------------------
@@ -185,6 +205,9 @@ const tMakeStringStringMap& lcl_getChartTypeNameMap()
( ::rtl::OUString::createFromAscii( "com.sun.star.chart.StockDiagram" )
, ::rtl::OUString::createFromAscii( "com.sun.star.chart2.CandleStickChartType" ) )
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart.BubbleDiagram" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart2.BubbleChartType" ) )
+
;
return g_aChartTypeNameMap;
}
@@ -241,6 +264,9 @@ OUString GetChartTypeByClassName(
else
aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Scatter"));
}
+
+ else if( IsXMLToken( rClassName, XML_BUBBLE ))
+ aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Bubble"));
else if( IsXMLToken( rClassName, XML_RADAR ))
aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Net"));
else if( IsXMLToken( rClassName, XML_STOCK ))
@@ -306,6 +332,8 @@ XMLTokenEnum getTokenByChartType(
else if( (bUseOldNames && aServiceName.equalsAscii("XY")) ||
(!bUseOldNames && aServiceName.equalsAscii("Scatter")))
eResult = XML_SCATTER;
+ else if( aServiceName.equalsAscii("Bubble"))
+ eResult = XML_BUBBLE;
else if( aServiceName.equalsAscii("Net"))
eResult = XML_RADAR;
else if( (bUseOldNames && aServiceName.equalsAscii("Stock")) ||
@@ -583,6 +611,68 @@ bool getXMLRangePropertyFromDataSequence(
return bResult;
}
+void copyProperties(
+ const Reference< beans::XPropertySet > & xSource,
+ const Reference< beans::XPropertySet > & xDestination )
+{
+ if( ! (xSource.is() && xDestination.is()) )
+ return;
+
+ try
+ {
+ Reference< beans::XPropertySetInfo > xSrcInfo( xSource->getPropertySetInfo(), uno::UNO_QUERY_THROW );
+ Reference< beans::XPropertySetInfo > xDestInfo( xDestination->getPropertySetInfo(), uno::UNO_QUERY_THROW );
+ Sequence< beans::Property > aProperties( xSrcInfo->getProperties());
+ const sal_Int32 nLength = aProperties.getLength();
+ for( sal_Int32 i = 0; i < nLength; ++i )
+ {
+ OUString aName( aProperties[i].Name);
+ if( xDestInfo->hasPropertyByName( aName ))
+ {
+ beans::Property aProp( xDestInfo->getPropertyByName( aName ));
+ if( (aProp.Attributes & beans::PropertyAttribute::READONLY) == 0 )
+ xDestination->setPropertyValue(
+ aName, xSource->getPropertyValue( aName ));
+ }
+ }
+ }
+ catch( const uno::Exception & )
+ {
+ OSL_ENSURE( false, "Copying property sets failed!" );
+ }
+}
+
+bool switchBackToDataProviderFromParent( const Reference< chart2::XChartDocument >& xChartDoc, const tSchXMLLSequencesPerIndex & rLSequencesPerIndex )
+{
+ //return whether the switch is successful
+ if( !xChartDoc.is() || !xChartDoc->hasInternalDataProvider() )
+ return false;
+ Reference< chart2::data::XDataProvider > xDataProviderFromParent( SchXMLTools::getDataProviderFromParent( xChartDoc ) );
+ if( !xDataProviderFromParent.is() )
+ return false;
+ uno::Reference< chart2::data::XDataReceiver > xDataReceiver( xChartDoc, uno::UNO_QUERY );
+ if( !xDataReceiver.is() )
+ return false;
+
+ xDataReceiver->attachDataProvider( xDataProviderFromParent );
+
+ for( tSchXMLLSequencesPerIndex::const_iterator aLSeqIt( rLSequencesPerIndex.begin() );
+ aLSeqIt != rLSequencesPerIndex.end(); ++aLSeqIt )
+ {
+ Reference< chart2::data::XLabeledDataSequence > xLabeledSeq( aLSeqIt->second );
+ if( !xLabeledSeq.is() )
+ continue;
+ Reference< chart2::data::XDataSequence > xNewSeq;
+ xNewSeq = lcl_createNewSequenceFromCachedXMLRange( xLabeledSeq->getValues(), xDataProviderFromParent );
+ if( xNewSeq.is() )
+ xLabeledSeq->setValues( xNewSeq );
+ xNewSeq = lcl_createNewSequenceFromCachedXMLRange( xLabeledSeq->getLabel(), xDataProviderFromParent );
+ if( xNewSeq.is() )
+ xLabeledSeq->setLabel( xNewSeq );
+ }
+ return true;
+}
+
bool isDocumentGeneratedWithOpenOfficeOlderThan3_0( const uno::Reference< frame::XModel >& xChartModel )
{
bool bResult = isDocumentGeneratedWithOpenOfficeOlderThan2_3( xChartModel );
@@ -641,4 +731,27 @@ bool isDocumentGeneratedWithOpenOfficeOlderThan2_3( const uno::Reference< frame:
return bResult;
}
+Reference< chart2::data::XDataProvider > getDataProviderFromParent( const Reference< chart2::XChartDocument >& xChartDoc )
+{
+ Reference< chart2::data::XDataProvider > xRet;
+ uno::Reference< container::XChild > xChild( xChartDoc, uno::UNO_QUERY );
+ if( xChild.is() )
+ {
+ Reference< lang::XMultiServiceFactory > xFact( xChild->getParent(), uno::UNO_QUERY );
+ if( xFact.is() )
+ {
+ const OUString aDataProviderServiceName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.data.DataProvider"));
+ const uno::Sequence< OUString > aServiceNames( xFact->getAvailableServiceNames());
+ const OUString * pBegin = aServiceNames.getConstArray();
+ const OUString * pEnd = pBegin + aServiceNames.getLength();
+ if( ::std::find( pBegin, pEnd, aDataProviderServiceName ) != pEnd )
+ {
+ xRet = Reference< chart2::data::XDataProvider >(
+ xFact->createInstance( aDataProviderServiceName ), uno::UNO_QUERY );
+ }
+ }
+ }
+ return xRet;
+}
+
} // namespace SchXMLTools
diff --git a/xmloff/source/chart/SchXMLTools.hxx b/xmloff/source/chart/SchXMLTools.hxx
index dad5a396b6c4..916fffc382aa 100644
--- a/xmloff/source/chart/SchXMLTools.hxx
+++ b/xmloff/source/chart/SchXMLTools.hxx
@@ -67,7 +67,7 @@ namespace SchXMLTools
XML_CHART_CLASS_RADAR,
XML_CHART_CLASS_BAR,
XML_CHART_CLASS_STOCK,
- XML_CHART_CLASS_BUBBLE, // not yet implemented
+ XML_CHART_CLASS_BUBBLE,
XML_CHART_CLASS_ADDIN,
XML_CHART_CLASS_UNKNOWN
};
@@ -127,6 +127,16 @@ namespace SchXMLTools
::com::sun::star::chart2::data::XDataSequence > & xDataSequence,
::rtl::OUString & rOutXMLRange,
bool bClearProp = false );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > getDataProviderFromParent( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc );
+
+ bool switchBackToDataProviderFromParent( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument >& xChartDoc
+ , const tSchXMLLSequencesPerIndex & rLSequencesPerIndex );
+
+ void copyProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xSource,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xDestination );
}
#endif // SCH_XML_TOOLS_HXX_
diff --git a/xmloff/source/chart/transporttypes.hxx b/xmloff/source/chart/transporttypes.hxx
index 41bb93fe4401..6046ec4606fc 100644
--- a/xmloff/source/chart/transporttypes.hxx
+++ b/xmloff/source/chart/transporttypes.hxx
@@ -136,9 +136,25 @@ struct SchXMLAxis
// ----------------------------------------
-// struct PostponedStyleObject
-// {
-// };
+struct GlobalSeriesImportInfo
+{
+ GlobalSeriesImportInfo( sal_Bool& rAllRangeAddressesAvailable )
+ : rbAllRangeAddressesAvailable( rAllRangeAddressesAvailable )
+ , nCurrentDataIndex( 0 )
+ , nFirstFirstDomainIndex( -1 )
+ , nFirstSecondDomainIndex( -1 )
+ {}
+
+ sal_Bool& rbAllRangeAddressesAvailable;
+
+ sal_Int32 nCurrentDataIndex;
+
+ ::rtl::OUString aFirstFirstDomainAddress;
+ sal_Int32 nFirstFirstDomainIndex;
+
+ ::rtl::OUString aFirstSecondDomainAddress;
+ sal_Int32 nFirstSecondDomainIndex;
+};
struct DataRowPointStyle
{
diff --git a/xmloff/source/core/RDFaExportHelper.cxx b/xmloff/source/core/RDFaExportHelper.cxx
new file mode 100644
index 000000000000..077ef6133fc4
--- /dev/null
+++ b/xmloff/source/core/RDFaExportHelper.cxx
@@ -0,0 +1,218 @@
+/*************************************************************************
+ *
+ * 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: RDFaExportHelper.cxx,v $
+ * $Revision: 1.1.2.4 $
+ *
+ * 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_xmloff.hxx"
+
+#include "RDFaExportHelper.hxx"
+
+#include "xmlnmspe.hxx"
+
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmltoken.hxx>
+
+#include <comphelper/stlunosequence.hxx>
+#include <comphelper/stl_types.hxx>
+
+#include <com/sun/star/rdf/Statement.hpp>
+#include <com/sun/star/rdf/URIs.hpp>
+#include <com/sun/star/rdf/URI.hpp>
+#include <com/sun/star/rdf/XLiteral.hpp>
+#include <com/sun/star/rdf/XRepositorySupplier.hpp>
+#include <com/sun/star/rdf/XDocumentRepository.hpp>
+
+#include <rtl/ustrbuf.hxx>
+
+#include <boost/bind.hpp>
+#include <boost/iterator_adaptors.hpp>
+#ifndef BOOST_ITERATOR_ADAPTOR_DWA053000_HPP_ // from iterator_adaptors.hpp
+// N.B.: the check for the header guard _of a specific version of boost_
+// is here so this may work on different versions of boost,
+// which sadly put the goods in different header files
+#include <boost/iterator/transform_iterator.hpp>
+#endif
+
+#include <functional>
+#include <algorithm>
+
+
+using namespace ::com::sun::star;
+
+namespace xmloff {
+
+static const char s_prefix [] = "_:b";
+
+static ::rtl::OUString
+makeCURIE(SvXMLExport * i_pExport,
+ uno::Reference<rdf::XURI> const & i_xURI)
+{
+ OSL_ENSURE(i_xURI.is(), "makeCURIE: null URI");
+ if (!i_xURI.is()) throw uno::RuntimeException();
+
+ const ::rtl::OUString Namespace( i_xURI->getNamespace() );
+ OSL_ENSURE(Namespace.getLength(), "makeCURIE: no namespace");
+ if (!Namespace.getLength()) throw uno::RuntimeException();
+
+ ::rtl::OUStringBuffer buf;
+ buf.append( i_pExport->EnsureNamespace(Namespace) );
+ buf.append( static_cast<sal_Unicode>(':') );
+ // N.B.: empty LocalName is valid!
+ buf.append( i_xURI->getLocalName() );
+
+ return buf.makeStringAndClear();
+}
+
+////////////////////////////////////////////////////////////////////////////
+
+RDFaExportHelper::RDFaExportHelper(SvXMLExport & i_rExport)
+ : m_rExport(i_rExport), m_xRepository(0), m_Counter(0)
+{
+ const uno::Reference<rdf::XRepositorySupplier> xRS( m_rExport.GetModel(),
+ uno::UNO_QUERY);
+ OSL_ENSURE(xRS.is(), "AddRDFa: model is no rdf::XRepositorySupplier");
+ if (!xRS.is()) throw uno::RuntimeException();
+ m_xRepository.set(xRS->getRDFRepository(), uno::UNO_QUERY_THROW);
+
+ const uno::Reference<rdf::XURI> xLabel(
+ rdf::URI::createKnown(m_rExport.GetComponentContext(),
+ rdf::URIs::RDFS_LABEL));
+ m_RDFsLabel = xLabel->getStringValue();
+}
+
+::rtl::OUString
+RDFaExportHelper::LookupBlankNode(
+ uno::Reference<rdf::XBlankNode> const & i_xBlankNode)
+{
+ OSL_ENSURE(i_xBlankNode.is(), "null BlankNode?");
+ if (!i_xBlankNode.is()) throw uno::RuntimeException();
+ ::rtl::OUString & rEntry(
+ m_BlankNodeMap[ i_xBlankNode->getStringValue() ] );
+ if (!rEntry.getLength())
+ {
+ ::rtl::OUStringBuffer buf;
+ buf.appendAscii(s_prefix);
+ buf.append(++m_Counter);
+ rEntry = buf.makeStringAndClear();
+ }
+ return rEntry;
+}
+
+////////////////////////////////////////////////////////////////////////////
+
+void
+RDFaExportHelper::AddRDFa(
+ uno::Reference<rdf::XMetadatable> const & i_xMetadatable)
+{
+ try
+ {
+ uno::Sequence<rdf::Statement> stmts(
+ m_xRepository->getStatementRDFa(i_xMetadatable) );
+
+ if (0 == stmts.getLength())
+ {
+ return; // no RDFa
+ }
+
+ // all stmts have the same subject, so we only handle first one
+ const uno::Reference<rdf::XURI> xSubjectURI(stmts[0].Subject,
+ uno::UNO_QUERY);
+ const uno::Reference<rdf::XBlankNode> xSubjectBNode(stmts[0].Subject,
+ uno::UNO_QUERY);
+ if (!xSubjectURI.is() && !xSubjectBNode.is())
+ {
+ throw uno::RuntimeException();
+ }
+ static const sal_Unicode s_OpenBracket ('[');
+ static const sal_Unicode s_CloseBracket(']');
+ const ::rtl::OUString about( xSubjectURI.is()
+ ? m_rExport.GetRelativeReference(xSubjectURI->getStringValue())
+ : ::rtl::OUStringBuffer().append(s_OpenBracket).append(
+ LookupBlankNode(xSubjectBNode)).append(s_CloseBracket)
+ .makeStringAndClear()
+ );
+
+ const ::comphelper::StlUnoSequence<rdf::Statement>::iterator iter
+ ( ::std::partition( ::comphelper::stl_begin(stmts),
+ ::comphelper::stl_end(stmts),
+ ::boost::bind(&::rtl::OUString::equals, m_RDFsLabel,
+ ::boost::bind(&rdf::XNode::getStringValue,
+ ::boost::bind(&rdf::Statement::Predicate, _1))) ) );
+
+ if (iter != ::comphelper::stl_end(stmts))
+ {
+ // from iter to end, all stmts should have same object
+ const uno::Reference<rdf::XLiteral> xContent(
+ (*iter).Object, uno::UNO_QUERY_THROW );
+ const uno::Reference<rdf::XURI> xDatatype(xContent->getDatatype());
+ if (xDatatype.is())
+ {
+ const ::rtl::OUString datatype(
+ makeCURIE(&m_rExport, xDatatype) );
+ m_rExport.AddAttribute(XML_NAMESPACE_XHTML,
+ token::XML_DATATYPE, datatype);
+ }
+ if (iter != ::comphelper::stl_begin(stmts)) // there is rdfs:label
+ {
+ m_rExport.AddAttribute(XML_NAMESPACE_XHTML, token::XML_CONTENT,
+ xContent->getValue());
+ }
+ }
+ else
+ {
+ OSL_ENSURE(false,"invalid RDFa: every property is rdfs:label");
+ return;
+ }
+
+ ::rtl::OUStringBuffer property;
+ ::comphelper::intersperse(
+ ::boost::make_transform_iterator(
+ iter, // omit RDFsLabel predicates!
+ ::boost::bind(&makeCURIE, &m_rExport,
+ ::boost::bind(&rdf::Statement::Predicate, _1))),
+ // argh, this must be the same type :(
+ ::boost::make_transform_iterator(
+ ::comphelper::stl_end(stmts),
+ ::boost::bind(&makeCURIE, &m_rExport,
+ ::boost::bind(&rdf::Statement::Predicate, _1))),
+ ::comphelper::OUStringBufferAppender(property),
+ ::rtl::OUString::createFromAscii(" "));
+
+ m_rExport.AddAttribute(XML_NAMESPACE_XHTML, token::XML_PROPERTY,
+ property.makeStringAndClear());
+
+ m_rExport.AddAttribute(XML_NAMESPACE_XHTML, token::XML_ABOUT, about);
+ }
+ catch (uno::Exception &)
+ {
+ OSL_ENSURE(false, "AddRDFa: exception");
+ }
+}
+
+} // namespace xmloff
+
diff --git a/xmloff/source/core/RDFaImportHelper.cxx b/xmloff/source/core/RDFaImportHelper.cxx
new file mode 100644
index 000000000000..7191a6db6739
--- /dev/null
+++ b/xmloff/source/core/RDFaImportHelper.cxx
@@ -0,0 +1,458 @@
+/*************************************************************************
+ *
+ * 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: RDFaImportHelper.cxx,v $
+ * $Revision: 1.1.2.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.
+ *
+ ************************************************************************/
+
+#include "precompiled_xmloff.hxx"
+
+#include "RDFaImportHelper.hxx"
+
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+
+#include <comphelper/sequenceasvector.hxx>
+
+#include <tools/string.hxx> // for GetAbsoluteReference
+
+#include <com/sun/star/rdf/URI.hpp>
+#include <com/sun/star/rdf/XDocumentMetadataAccess.hpp>
+#include <com/sun/star/rdf/XDocumentRepository.hpp>
+
+#include <rtl/ustring.hxx>
+
+#include <boost/bind.hpp>
+#include <boost/iterator_adaptors.hpp>
+#ifndef BOOST_ITERATOR_ADAPTOR_DWA053000_HPP_ // from iterator_adaptors.hpp
+// N.B.: the check for the header guard _of a specific version of boost_
+// is here so this may work on different versions of boost,
+// which sadly put the goods in different header files
+#include <boost/iterator/transform_iterator.hpp>
+#endif
+
+#include <map>
+#include <iterator>
+#include <functional>
+#include <algorithm>
+
+
+using namespace ::com::sun::star;
+
+namespace xmloff {
+
+/** a bit of context for parsing RDFa attributes */
+class SAL_DLLPRIVATE RDFaReader
+{
+ const SvXMLImport & m_rImport;
+
+ const SvXMLImport & GetImport() const { return m_rImport; }
+
+ //FIXME: this is an ugly hack to workaround buggy SvXMLImport::GetAbsolute
+ ::rtl::OUString GetAbsoluteReference(::rtl::OUString const & i_rURI) const
+ {
+ if (!i_rURI.getLength() || i_rURI[0] == '#')
+ {
+ return GetImport().GetBaseURL() + i_rURI;
+ }
+ else
+ {
+ return GetImport().GetAbsoluteReference(i_rURI);
+ }
+ }
+
+public:
+ RDFaReader(SvXMLImport const & i_rImport)
+ : m_rImport(i_rImport)
+ { }
+
+ // returns URI or blank node!
+ ::rtl::OUString ReadCURIE(::rtl::OUString const & i_rCURIE) const;
+
+ std::vector< ::rtl::OUString >
+ ReadCURIEs(::rtl::OUString const & i_rCURIEs) const;
+
+ ::rtl::OUString
+ ReadURIOrSafeCURIE( ::rtl::OUString const & i_rURIOrSafeCURIE) const;
+};
+
+/** helper to insert RDFa statements into the RDF repository */
+class SAL_DLLPRIVATE RDFaInserter
+{
+ const uno::Reference<uno::XComponentContext> m_xContext;
+ uno::Reference< rdf::XDocumentRepository > m_xRepository;
+
+ typedef ::std::map< ::rtl::OUString, uno::Reference< rdf::XBlankNode > >
+ BlankNodeMap_t;
+
+ BlankNodeMap_t m_BlankNodeMap;
+
+public:
+ RDFaInserter(uno::Reference<uno::XComponentContext> const & i_xContext,
+ uno::Reference< rdf::XDocumentRepository > const & i_xRepository)
+ : m_xContext(i_xContext)
+ , m_xRepository(i_xRepository)
+ {}
+
+ uno::Reference< rdf::XBlankNode >
+ LookupBlankNode(::rtl::OUString const & i_rNodeId );
+
+ uno::Reference< rdf::XURI >
+ MakeURI( ::rtl::OUString const & i_rURI) const;
+
+ uno::Reference< rdf::XResource>
+ MakeResource( ::rtl::OUString const & i_rResource);
+
+ void InsertRDFaEntry(struct RDFaEntry const & i_rEntry);
+};
+
+/** store metadatable object and its RDFa attributes */
+struct SAL_DLLPRIVATE RDFaEntry
+{
+ uno::Reference<rdf::XMetadatable> m_xObject;
+ ::rtl::OUString m_About;
+ ::std::vector< ::rtl::OUString > m_Properties;
+ ::rtl::OUString m_Content;
+ ::rtl::OUString m_Datatype;
+
+ RDFaEntry(uno::Reference<rdf::XMetadatable> i_xObject,
+ ::rtl::OUString const & i_rAbout,
+ ::std::vector< ::rtl::OUString > const & i_rProperties,
+ ::rtl::OUString const & i_rContent,
+ ::rtl::OUString const & i_rDatatype)
+ : m_xObject(i_xObject)
+ , m_About(i_rAbout)
+ , m_Properties(i_rProperties)
+ , m_Content(i_rContent)
+ , m_Datatype(i_rDatatype)
+ { }
+};
+
+////////////////////////////////////////////////////////////////////////////
+
+
+static inline bool isWS(const sal_Unicode i_Char)
+{
+ return ('\t' == i_Char) || ('\n' == i_Char) || ('\r' == i_Char)
+ || (' ' == i_Char);
+}
+
+static ::rtl::OUString splitAtWS(::rtl::OUString & io_rString)
+{
+ const sal_Int32 len( io_rString.getLength() );
+ sal_Int32 idxstt(0);
+ while ((idxstt < len) && ( isWS(io_rString[idxstt])))
+ ++idxstt; // skip leading ws
+ sal_Int32 idxend(idxstt);
+ while ((idxend < len) && (!isWS(io_rString[idxend])))
+ ++idxend; // the CURIE
+ const ::rtl::OUString ret(io_rString.copy(idxstt, idxend - idxstt));
+ io_rString = io_rString.copy(idxend); // rest
+ return ret;
+}
+
+::rtl::OUString
+RDFaReader::ReadCURIE(::rtl::OUString const & i_rCURIE) const
+{
+ // the RDFa spec says that a prefix is required (it may be empty: ":foo")
+ const sal_Int32 idx( i_rCURIE.indexOf(':') );
+ if (idx >= 0)
+ {
+ ::rtl::OUString Prefix;
+ ::rtl::OUString LocalName;
+ ::rtl::OUString Namespace;
+ sal_uInt16 nKey( GetImport().GetNamespaceMap()._GetKeyByAttrName(
+ i_rCURIE, &Prefix, &LocalName, &Namespace) );
+ if (Prefix.equalsAscii("_"))
+ {
+ // eeek, it's a bnode!
+ // "_" is not a valid URI scheme => we can identify bnodes
+ return i_rCURIE;
+ }
+ else
+ {
+ OSL_ENSURE(XML_NAMESPACE_NONE != nKey, "no namespace?");
+ if ((XML_NAMESPACE_UNKNOWN != nKey) &&
+ (XML_NAMESPACE_XMLNS != nKey))
+ {
+ // N.B.: empty LocalName is valid!
+ const ::rtl::OUString URI(Namespace + LocalName);
+// return GetImport().GetAbsoluteReference(URI);
+ return GetAbsoluteReference(URI);
+ }
+ else
+ {
+ OSL_TRACE( "ReadCURIE: invalid CURIE: invalid prefix" );
+ return ::rtl::OUString();
+ }
+ }
+ }
+ else
+ {
+ OSL_TRACE( "ReadCURIE: invalid CURIE: no prefix" );
+ return ::rtl::OUString();
+ }
+}
+
+::std::vector< ::rtl::OUString >
+RDFaReader::ReadCURIEs(::rtl::OUString const & i_rCURIEs) const
+{
+ std::vector< ::rtl::OUString > vec;
+ ::rtl::OUString CURIEs(i_rCURIEs);
+ do {
+ ::rtl::OUString curie( splitAtWS(CURIEs) );
+ if (curie.getLength())
+ {
+ const ::rtl::OUString uri(ReadCURIE(curie));
+ if (uri.getLength())
+ {
+ vec.push_back(uri);
+ }
+ }
+ }
+ while (CURIEs.getLength());
+ if (!vec.size())
+ {
+ OSL_TRACE( "ReadCURIEs: invalid CURIEs" );
+ }
+ return vec;
+}
+
+::rtl::OUString
+RDFaReader::ReadURIOrSafeCURIE(::rtl::OUString const & i_rURIOrSafeCURIE) const
+{
+ const sal_Int32 len(i_rURIOrSafeCURIE.getLength());
+ if (len && (i_rURIOrSafeCURIE[0] == '['))
+ {
+ if ((len >= 2) && (i_rURIOrSafeCURIE[len - 1] == ']'))
+ {
+ return ReadCURIE(i_rURIOrSafeCURIE.copy(1, len - 2));
+ }
+ else
+ {
+ OSL_TRACE( "ReadURIOrSafeCURIE: invalid SafeCURIE" );
+ return ::rtl::OUString();
+ }
+ }
+ else
+ {
+ if (i_rURIOrSafeCURIE.matchAsciiL("_:", 2)) // blank node
+ {
+ OSL_TRACE( "ReadURIOrSafeCURIE: invalid URI: scheme is _" );
+ return ::rtl::OUString();
+ }
+ else
+ {
+// return GetImport().GetAbsoluteReference(i_rURIOrSafeCURIE);
+ return GetAbsoluteReference(i_rURIOrSafeCURIE);
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////
+
+uno::Reference< rdf::XBlankNode >
+RDFaInserter::LookupBlankNode(::rtl::OUString const & i_rNodeId )
+{
+ uno::Reference< rdf::XBlankNode > & rEntry( m_BlankNodeMap[ i_rNodeId ] );
+ if (!rEntry.is())
+ {
+ rEntry = m_xRepository->createBlankNode();
+ }
+ return rEntry;
+}
+
+uno::Reference< rdf::XURI >
+RDFaInserter::MakeURI( ::rtl::OUString const & i_rURI) const
+{
+ if (i_rURI.matchAsciiL("_:", 2)) // blank node
+ {
+ OSL_TRACE("MakeURI: cannot create URI for blank node");
+ return 0;
+ }
+ else
+ {
+ try
+ {
+ return rdf::URI::create( m_xContext, i_rURI );
+ }
+ catch (uno::Exception &)
+ {
+ OSL_ENSURE(false, "MakeURI: cannot create URI");
+ return 0;
+ }
+ }
+}
+
+uno::Reference< rdf::XResource>
+RDFaInserter::MakeResource( ::rtl::OUString const & i_rResource)
+{
+ if (i_rResource.matchAsciiL("_:", 2)) // blank node
+ {
+ // we cannot use the blank node label as-is: it must be distinct
+ // from labels in other graphs, so create fresh ones per XML stream
+ // N.B.: content.xml and styles.xml are distinct graphs
+ ::rtl::OUString name( i_rResource.copy(2) );
+ const uno::Reference< rdf::XBlankNode > xBNode( LookupBlankNode(name) );
+ OSL_ENSURE(xBNode.is(), "no blank node?");
+ return uno::Reference<rdf::XResource>( xBNode, uno::UNO_QUERY);
+ }
+ else
+ {
+ return uno::Reference<rdf::XResource>( MakeURI( i_rResource ),
+ uno::UNO_QUERY);
+ }
+}
+
+/** i wrote this because c++ implementations cannot agree on which variant
+ of boost::bind and std::mem_fun_ref applied to Reference::is compiles */
+class ref_is_null :
+ public ::std::unary_function<sal_Bool, const uno::Reference<rdf::XURI> & >
+{
+public:
+ sal_Bool operator() (const uno::Reference<rdf::XURI> & i_rRef)
+ {
+ return !i_rRef.is();
+ }
+};
+
+void RDFaInserter::InsertRDFaEntry(
+ struct RDFaEntry const & i_rEntry)
+{
+ OSL_ENSURE(i_rEntry.m_xObject.is(),
+ "InsertRDFaEntry: invalid arg: null object");
+ if (!i_rEntry.m_xObject.is()) return;
+
+ const uno::Reference< rdf::XResource > xSubject(
+ MakeResource( i_rEntry.m_About ) );
+ if (!xSubject.is())
+ {
+ return; // invalid
+ }
+
+ ::comphelper::SequenceAsVector< uno::Reference< rdf::XURI > > predicates;
+
+ predicates.reserve(i_rEntry.m_Properties.size());
+
+ ::std::remove_copy_if(
+ ::boost::make_transform_iterator(i_rEntry.m_Properties.begin(),
+ ::boost::bind(&RDFaInserter::MakeURI, this, _1)),
+ // argh, this must be the same type :(
+ ::boost::make_transform_iterator(i_rEntry.m_Properties.end(),
+ ::boost::bind(&RDFaInserter::MakeURI, this, _1)),
+ ::std::back_inserter(predicates),
+ ref_is_null() );
+ // compiles only on wntmsci12
+// ::boost::bind( ::std::logical_not<sal_Bool>(), ::boost::bind<sal_Bool>(&uno::Reference<rdf::XURI>::is, _1)));
+ // compiles on unxsoli4, wntsci12, but not unxlngi6
+// ::boost::bind( ::std::logical_not<sal_Bool>(), ::boost::bind<sal_Bool, com::sun::star::uno::Reference<rdf::XURI> >(&uno::Reference<rdf::XURI>::is, _1)));
+ // compiles on unxsoli4, unxlngi6, but not wntsci12
+// ::std::not1( ::std::mem_fun_ref(&uno::Reference<rdf::XURI>::is)) );
+
+ if (!predicates.size())
+ {
+ return; // invalid
+ }
+
+ uno::Reference<rdf::XURI> xDatatype;
+ if (i_rEntry.m_Datatype.getLength())
+ {
+ xDatatype = MakeURI( i_rEntry.m_Datatype );
+ }
+
+ try
+ {
+ // N.B.: this will call xMeta->ensureMetadataReference, which is why
+ // this must be done _after_ importing the whole XML file,
+ // to prevent collision between generated ids and ids in the file
+ m_xRepository->setStatementRDFa(xSubject, predicates.getAsConstList(),
+ i_rEntry.m_xObject, i_rEntry.m_Content, xDatatype);
+ }
+ catch (uno::Exception &)
+ {
+ OSL_ENSURE(false, "InsertRDFaEntry: setStatementRDFa failed?");
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////
+
+RDFaImportHelper::RDFaImportHelper(const SvXMLImport & i_rImport)
+ : m_rImport(i_rImport)
+{
+}
+
+RDFaImportHelper::~RDFaImportHelper()
+{
+}
+
+void
+RDFaImportHelper::AddRDFa(
+ uno::Reference<rdf::XMetadatable> i_xObject,
+ ::rtl::OUString const & i_rAbout,
+ ::rtl::OUString const & i_rProperty,
+ ::rtl::OUString const & i_rContent,
+ ::rtl::OUString const & i_rDatatype)
+{
+ if (!i_rProperty.getLength())
+ {
+ OSL_TRACE("AddRDFa: invalid input: xhtml:property empty");
+ return;
+ }
+ if (!i_xObject.is())
+ {
+ OSL_ENSURE(false, "AddRDFa: invalid arg: null textcontent");
+ return;
+ }
+ // must parse CURIEs here: need namespace declaration context
+ RDFaReader reader(GetImport());
+ const ::rtl::OUString about( reader.ReadURIOrSafeCURIE(i_rAbout) );
+ if (!about.getLength()) return;
+ const ::std::vector< ::rtl::OUString > properties(
+ reader.ReadCURIEs(i_rProperty) );
+ if (!properties.size()) return;
+ const ::rtl::OUString datatype( i_rDatatype.getLength()
+ ? reader.ReadCURIE(i_rDatatype)
+ : ::rtl::OUString() );
+ m_RDFaEntries.push_back(RDFaEntry(i_xObject,
+ about, properties, i_rContent, datatype));
+}
+
+void RDFaImportHelper::InsertRDFa(
+ uno::Reference< rdf::XRepositorySupplier> const & i_xModel)
+{
+ OSL_ENSURE(i_xModel.is(), "InsertRDFa: invalid arg: model null");
+ if (!i_xModel.is()) return;
+ const uno::Reference< rdf::XDocumentRepository > xRepository(
+ i_xModel->getRDFRepository(), uno::UNO_QUERY);
+ OSL_ENSURE(xRepository.is(), "InsertRDFa: no DocumentRepository?");
+ if (!xRepository.is()) return;
+ RDFaInserter inserter(GetImport().GetComponentContext(), xRepository);
+ ::std::for_each(m_RDFaEntries.begin(), m_RDFaEntries.end(),
+ ::boost::bind(&RDFaInserter::InsertRDFaEntry, &inserter, _1));
+}
+
+} // namespace xmloff
+
diff --git a/xmloff/source/core/makefile.mk b/xmloff/source/core/makefile.mk
index c68981c27496..b9cb8e9c1b60 100644
--- a/xmloff/source/core/makefile.mk
+++ b/xmloff/source/core/makefile.mk
@@ -77,7 +77,10 @@ SLOFILES = \
$(SLO)$/XMLEmbeddedObjectImportContext.obj \
$(SLO)$/XMLBase64Export.obj \
$(SLO)$/XMLBase64ImportContext.obj \
- $(SLO)$/XMLBasicExportFilter.obj
+ $(SLO)$/XMLBasicExportFilter.obj \
+ $(SLO)$/RDFaImportHelper.obj \
+ $(SLO)$/RDFaExportHelper.obj \
+
# --- Targets -------------------------------------------------------
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 0789cb54b0ce..8045cd582e2f 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -63,9 +63,7 @@
#include <xmloff/SettingsExportHelper.hxx>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
-#ifndef _COM_SUN_STAR_DOCUMENT_XEVENTSSUPPLIER_HPP
#include <com/sun/star/document/XEventsSupplier.hpp>
-#endif
#include <com/sun/star/document/XViewDataSupplier.hpp>
#include <GradientStyle.hxx>
#include <HatchStyle.hxx>
@@ -73,16 +71,10 @@
#include <TransGradientStyle.hxx>
#include <MarkerStyle.hxx>
#include <DashStyle.hxx>
-#ifndef _XMLOFF_XMLFONTAUTOSTYLEPOOL_HXX
-#include <xmloff/XMLFontAutoStylePool>
-#endif
+#include <xmloff/XMLFontAutoStylePool.hxx>
#include "XMLImageMapExport.hxx"
-#ifndef _XMLOFF_XMLBASE64EXPORT_HXX_
#include "XMLBase64Export.hxx"
-#endif
-#ifndef _XMLOFF_XMLERROR_HXX_
#include "xmlerror.hxx"
-#endif
#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include "XMLFilterServiceNames.h"
@@ -105,6 +97,7 @@
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <com/sun/star/rdf/XMetadatable.hpp>
+#include "RDFaExportHelper.hxx"
using ::rtl::OUString;
@@ -126,6 +119,9 @@ sal_Char __READONLY_DATA sXML_1_2[] = "1.2";
const sal_Char *sOpenOfficeOrgProject ="OpenOffice.org_project";
+const sal_Char s_grddl_xsl[] =
+ "http://docs.oasis-open.org/office/1.2/xslt/odf2rdf.xsl";
+
#define LOGFILE_AUTHOR "mb93740"
#define XML_MODEL_SERVICE_WRITER "com.sun.star.text.TextDocument"
@@ -223,6 +219,19 @@ public:
/// relative path of stream in package, e.g. "someobject/content.xml"
::rtl::OUString mStreamPath;
+ const uno::Reference< uno::XComponentContext > mxComponentContext;
+
+ /// name of stream in package, e.g., "content.xml"
+ ::rtl::OUString mStreamName;
+
+ /// stack of backed up namespace maps
+ /// long: depth at which namespace map has been backed up into the stack
+ ::std::stack< ::std::pair< SvXMLNamespaceMap *, long > > mNamespaceMaps;
+ /// counts depth (number of open elements/start tags)
+ long mDepth;
+
+ ::std::auto_ptr< ::xmloff::RDFaExportHelper> mpRDFaHelper;
+
// --> OD 2008-11-26 #158694#
sal_Bool mbExportTextNumberElement;
// <--
@@ -243,14 +252,20 @@ SvXMLExport_Impl::SvXMLExport_Impl()
// --> PB 2007-07-06 #i146851#
,mbSaveBackwardCompatibleODF( sal_True )
// <--
- ,mStreamPath()
+ ,mxComponentContext( ::comphelper::getProcessComponentContext() )
+ ,mStreamName()
+ ,mNamespaceMaps()
+ ,mDepth(0)
+ ,mpRDFaHelper() // lazy
// --> OD 2008-11-26 #158694#
,mbExportTextNumberElement( sal_False )
// <--
,mbNullDateInitialized( sal_False )
{
+ OSL_ENSURE(mxComponentContext.is(), "SvXMLExport: no ComponentContext");
+ if (!mxComponentContext.is()) throw uno::RuntimeException();
mxUriReferenceFactory = uri::UriReferenceFactory::create(
- comphelper_getProcessComponentContext());
+ mxComponentContext );
}
//==============================================================================
@@ -325,9 +340,17 @@ void SvXMLExport::_InitCtor()
mpNamespaceMap->Add( GetXMLToken(XML_NP_XSI), GetXMLToken(XML_N_XSI), XML_NAMESPACE_XSI );
mpNamespaceMap->Add( GetXMLToken(XML_NP_FIELD), GetXMLToken(XML_N_FIELD), XML_NAMESPACE_FIELD );
}
+ // RDFa: needed for content and header/footer styles
if( (getExportFlags() & (EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
{
- mpNamespaceMap->Add( GetXMLToken(XML_NP_RDFA), GetXMLToken(XML_N_RDFA), XML_NAMESPACE_RDFA );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_XHTML),
+ GetXMLToken(XML_N_XHTML), XML_NAMESPACE_XHTML );
+ }
+ // GRDDL: to convert RDFa and meta.xml to RDF
+ if( (getExportFlags() & (EXPORT_META|EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_GRDDL),
+ GetXMLToken(XML_N_GRDDL), XML_NAMESPACE_GRDDL );
}
mxAttrList = (xml::sax::XAttributeList*)mpAttrList;
@@ -762,9 +785,7 @@ void SAL_CALL SvXMLExport::initialize( const uno::Sequence< uno::Any >& aArgumen
aBaseURL.insertName( sName );
msOrigFileName = aBaseURL.GetMainURL(INetURLObject::DECODE_TO_IURI);
}
- OSL_ENSURE(sName.getLength(), "no StreamName ???");
- mpImpl->mStreamPath = sRelPath.getLength() ? sRelPath +
- ::rtl::OUString::createFromAscii("/") + sName : sName;
+ mpImpl->mStreamName = sName; // Note: may be empty (XSLT)
// --> OD 2006-09-26 #i69627#
const ::rtl::OUString sOutlineStyleAsNormalListStyle(
@@ -914,6 +935,54 @@ uno::Sequence< OUString > SAL_CALL SvXMLExport::getSupportedServiceNames( )
///////////////////////////////////////////////////////////////////////
+::rtl::OUString
+SvXMLExport::EnsureNamespace(::rtl::OUString const & i_rNamespace,
+ ::rtl::OUString const & i_rPreferredPrefix)
+{
+ ::rtl::OUString sPrefix;
+ sal_uInt16 nKey( _GetNamespaceMap().GetKeyByName( i_rNamespace ) );
+ if( XML_NAMESPACE_UNKNOWN == nKey )
+ {
+ // There is no prefix for the namespace, so
+ // we have to generate one and have to add it.
+ sPrefix = i_rPreferredPrefix;
+ nKey = _GetNamespaceMap().GetKeyByPrefix( sPrefix );
+ sal_Int32 n( 0 );
+ ::rtl::OUStringBuffer buf;
+ while( nKey != USHRT_MAX )
+ {
+ buf.append( i_rPreferredPrefix );
+ buf.append( ++n );
+ sPrefix = buf.makeStringAndClear();
+ nKey = _GetNamespaceMap().GetKeyByPrefix( sPrefix );
+ }
+
+ if (mpImpl->mNamespaceMaps.empty()
+ || (mpImpl->mNamespaceMaps.top().second != mpImpl->mDepth))
+ {
+ // top was created for lower depth... need a new namespace map!
+ mpImpl->mNamespaceMaps.push(
+ ::std::make_pair(mpNamespaceMap, mpImpl->mDepth) );
+ mpNamespaceMap = new SvXMLNamespaceMap( *mpNamespaceMap );
+ }
+
+ // add the namespace to the map and as attribute
+ mpNamespaceMap->Add( sPrefix, i_rNamespace );
+ buf.append( GetXMLToken(XML_XMLNS) );
+ buf.append( sal_Unicode(':') );
+ buf.append( sPrefix );
+ AddAttribute( buf.makeStringAndClear(), i_rNamespace );
+ }
+ else
+ {
+ // If there is a prefix for the namespace, reuse that.
+ sPrefix = _GetNamespaceMap().GetPrefixByKey( nKey );
+ }
+ return sPrefix;
+}
+
+///////////////////////////////////////////////////////////////////////
+
void SvXMLExport::AddAttributeASCII( sal_uInt16 nPrefixKey,
const sal_Char *pName,
const sal_Char *pValue )
@@ -921,9 +990,8 @@ void SvXMLExport::AddAttributeASCII( sal_uInt16 nPrefixKey,
OUString sName( OUString::createFromAscii( pName ) );
OUString sValue( OUString::createFromAscii( pValue ) );
- mpAttrList->AddAttribute( mpNamespaceMap->GetQNameByKey( nPrefixKey,
- sName ),
- sValue );
+ mpAttrList->AddAttribute(
+ _GetNamespaceMap().GetQNameByKey( nPrefixKey, sName ), sValue );
}
void SvXMLExport::AddAttribute( sal_uInt16 nPrefixKey, const sal_Char *pName,
@@ -931,16 +999,15 @@ void SvXMLExport::AddAttribute( sal_uInt16 nPrefixKey, const sal_Char *pName,
{
OUString sName( OUString::createFromAscii( pName ) );
- mpAttrList->AddAttribute( mpNamespaceMap->GetQNameByKey( nPrefixKey,
- sName ),
- rValue );
+ mpAttrList->AddAttribute(
+ _GetNamespaceMap().GetQNameByKey( nPrefixKey, sName ), rValue );
}
void SvXMLExport::AddAttribute( sal_uInt16 nPrefixKey, const OUString& rName,
const OUString& rValue )
{
- mpAttrList->AddAttribute( mpNamespaceMap->GetQNameByKey( nPrefixKey, rName ),
- rValue );
+ mpAttrList->AddAttribute(
+ _GetNamespaceMap().GetQNameByKey( nPrefixKey, rName ), rValue );
}
void SvXMLExport::AddAttribute( sal_uInt16 nPrefixKey,
@@ -948,7 +1015,7 @@ void SvXMLExport::AddAttribute( sal_uInt16 nPrefixKey,
const OUString& rValue )
{
mpAttrList->AddAttribute(
- mpNamespaceMap->GetQNameByKey( nPrefixKey, GetXMLToken(eName) ),
+ _GetNamespaceMap().GetQNameByKey( nPrefixKey, GetXMLToken(eName) ),
rValue );
}
@@ -957,7 +1024,7 @@ void SvXMLExport::AddAttribute( sal_uInt16 nPrefixKey,
enum XMLTokenEnum eValue)
{
mpAttrList->AddAttribute(
- mpNamespaceMap->GetQNameByKey( nPrefixKey, GetXMLToken(eName) ),
+ _GetNamespaceMap().GetQNameByKey( nPrefixKey, GetXMLToken(eName) ),
GetXMLToken(eValue) );
}
@@ -1307,6 +1374,13 @@ sal_uInt32 SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass )
{
enum XMLTokenEnum eRootService = XML_TOKEN_INVALID;
const sal_Int32 nExportMode = mnExportFlags & (EXPORT_META|EXPORT_STYLES|EXPORT_CONTENT|EXPORT_SETTINGS);
+
+ if ( EXPORT_SETTINGS != nExportMode ) // meta, content, styles
+ {
+ AddAttribute( XML_NAMESPACE_GRDDL, XML_TRANSFORMATION,
+ OUString::createFromAscii(s_grddl_xsl) );
+ }
+
if( EXPORT_META == nExportMode )
{
// export only meta
@@ -2159,7 +2233,8 @@ void SvXMLExport::StartElement(sal_uInt16 nPrefix,
enum ::xmloff::token::XMLTokenEnum eName,
sal_Bool bIgnWSOutside )
{
- StartElement(mpNamespaceMap->GetQNameByKey( nPrefix, GetXMLToken(eName) ), bIgnWSOutside);
+ StartElement(_GetNamespaceMap().GetQNameByKey( nPrefix,
+ GetXMLToken(eName) ), bIgnWSOutside);
}
void SvXMLExport::StartElement(const OUString& rName,
@@ -2188,6 +2263,7 @@ void SvXMLExport::StartElement(const OUString& rName,
}
}
ClearAttrList();
+ ++mpImpl->mDepth; // increment nesting depth counter
}
void SvXMLExport::Characters(const ::rtl::OUString& rChars)
@@ -2218,12 +2294,26 @@ void SvXMLExport::EndElement(sal_uInt16 nPrefix,
enum ::xmloff::token::XMLTokenEnum eName,
sal_Bool bIgnWSInside )
{
- EndElement(mpNamespaceMap->GetQNameByKey( nPrefix, GetXMLToken(eName) ), bIgnWSInside);
+ EndElement(_GetNamespaceMap().GetQNameByKey( nPrefix, GetXMLToken(eName) ),
+ bIgnWSInside);
}
void SvXMLExport::EndElement(const OUString& rName,
sal_Bool bIgnWSInside )
{
+ // decrement nesting depth counter & (maybe) restore namespace map
+ --mpImpl->mDepth;
+ if (!mpImpl->mNamespaceMaps.empty() &&
+ (mpImpl->mNamespaceMaps.top().second == mpImpl->mDepth))
+ {
+ delete mpNamespaceMap;
+ mpNamespaceMap = mpImpl->mNamespaceMaps.top().first;
+ mpImpl->mNamespaceMaps.pop();
+ }
+ OSL_ENSURE(mpImpl->mNamespaceMaps.empty() ||
+ (mpImpl->mNamespaceMaps.top().second < mpImpl->mDepth),
+ "SvXMLExport: NamespaceMaps corrupted");
+
if ((mnErrorFlags & ERROR_DO_NOTHING) != ERROR_DO_NOTHING)
{
try
@@ -2319,6 +2409,12 @@ void SvXMLExport::DisposingModel()
return mxServiceFactory;
}
+uno::Reference< uno::XComponentContext >
+SvXMLExport::GetComponentContext() const
+{
+ return mpImpl->mxComponentContext;
+}
+
::comphelper::UnoInterfaceToUniqueIdentifierMapper& SvXMLExport::getInterfaceToIdentifierMapper()
{
return mpImpl->maInterfaceToIdentifierMapper;
@@ -2346,23 +2442,9 @@ SvtSaveOptions::ODFDefaultVersion SvXMLExport::getDefaultVersion() const
return SvtSaveOptions::ODFVER_012;
}
-::rtl::OUString SvXMLExport::GetStreamPath() const
-{
- return mpImpl->mStreamPath;
-}
-
-//FIXME: where to put this???
-static bool splitXmlId(::rtl::OUString const & i_XmlId,
- ::rtl::OUString & o_StreamName, ::rtl::OUString& o_Idref )
+::rtl::OUString SvXMLExport::GetStreamName() const
{
- const sal_Int32 idx(i_XmlId.indexOf(static_cast<sal_Unicode>('#')));
- if ((idx <= 0) || (idx >= i_XmlId.getLength() - 1)) {
- return false;
- } else {
- o_StreamName = (i_XmlId.copy(0, idx));
- o_Idref = (i_XmlId.copy(idx+1));
- return true;
- }
+ return mpImpl->mStreamName;
}
void
@@ -2380,30 +2462,69 @@ SvXMLExport::AddAttributeXmlId(uno::Reference<uno::XInterface> const & i_xIfc)
// OSL_ENSURE(xMeta.is(), "xml:id: not XMetadatable");
if ( xMeta.is() )
{
- const ::rtl::OUString XmlId( xMeta->getXmlId() );
- if ( !XmlId.equalsAscii("") )
+ const beans::StringPair mdref( xMeta->getMetadataReference() );
+ if ( !mdref.Second.equalsAscii("") )
{
- ::rtl::OUString StreamName;
- ::rtl::OUString Idref;
- if( splitXmlId(XmlId, StreamName, Idref) )
+ const ::rtl::OUString streamName( GetStreamName() );
+ if ( streamName.getLength() )
{
- if ( GetStreamPath().equals(StreamName) )
+ if ( streamName.equals(mdref.First) )
{
- AddAttribute( XML_NAMESPACE_XML, XML_ID, Idref );
+ AddAttribute( XML_NAMESPACE_XML, XML_ID, mdref.Second );
}
else
{
- OSL_ENSURE(false, "xml:id: invalid stream name");
+ OSL_ENSURE(false, "SvXMLExport::AddAttributeXmlId: "
+ "invalid stream name");
}
}
else
{
- OSL_ENSURE(false, "xml:id invalid?");
+ // FIXME: this is ugly
+ // there is no stream name (e.g. XSLT, flat-xml format)!
+ // but how do we ensure uniqueness in this case?
+ // a) just omit styles.xml ids -- they are unlikely anyway...
+ // b) somehow find out whether we are currently exporting styles
+ // or content, and prefix "s" or "c" => unique
+ if ( mdref.First.equalsAscii("content.xml") )
+ {
+ AddAttribute( XML_NAMESPACE_XML, XML_ID, mdref.Second );
+ }
+ else
+ {
+ OSL_TRACE("SvXMLExport::AddAttributeXmlId: "
+ "no stream name given: dropping styles.xml xml:id");
+ }
}
}
}
}
+void
+SvXMLExport::AddAttributesRDFa(
+ uno::Reference<text::XTextContent> const & i_xTextContent)
+{
+ // check version >= 1.2
+ switch (getDefaultVersion()) {
+ case SvtSaveOptions::ODFVER_011: // fall thru
+ case SvtSaveOptions::ODFVER_010: return;
+ default: break;
+ }
+
+ const uno::Reference<rdf::XMetadatable> xMeta(
+ i_xTextContent, uno::UNO_QUERY);
+ if (!xMeta.is() || !xMeta->getMetadataReference().Second.getLength())
+ {
+ return; // no xml:id => no RDFa
+ }
+
+ if (!mpImpl->mpRDFaHelper.get())
+ {
+ mpImpl->mpRDFaHelper.reset( new ::xmloff::RDFaExportHelper(*this) );
+ }
+ mpImpl->mpRDFaHelper->AddRDFa(xMeta);
+}
+
// --> OD 2008-11-26 #158694#
sal_Bool SvXMLExport::exportTextNumberElement() const
{
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 06d6b575a21f..28c970a94066 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -64,9 +64,12 @@
#include <tools/string.hxx> // used in StartElement for logging
#include <cppuhelper/implbase1.hxx>
#include <comphelper/extract.hxx>
+#include <comphelper/processfactory.hxx>
#include <vcl/fontcvt.hxx>
#include <com/sun/star/rdf/XMetadatable.hpp>
+#include <com/sun/star/rdf/XRepositorySupplier.hpp>
+#include "RDFaImportHelper.hxx"
#define LOGFILE_AUTHOR "unknown"
@@ -111,6 +114,7 @@ sal_Char __READONLY_DATA sXML_np__xforms[] = "_xforms";
sal_Char __READONLY_DATA sXML_np__xsd[] = "_xsd";
sal_Char __READONLY_DATA sXML_np__xsi[] = "_xsi";
sal_Char __READONLY_DATA sXML_np__field[] = "_field";
+sal_Char __READONLY_DATA sXML_np__xhtml[] = "_xhtml";
sal_Char __READONLY_DATA sXML_np__fo_old[] = "__fo";
sal_Char __READONLY_DATA sXML_np__xlink_old[] = "__xlink";
@@ -169,8 +173,8 @@ public:
INetURLObject aBaseURL;
INetURLObject aDocBase;
- /// relative path of stream in package, e.g. "someobject/content.xml"
- ::rtl::OUString mStreamPath;
+ /// name of stream in package, e.g., "content.xml"
+ ::rtl::OUString mStreamName;
::rtl::OUString aODFVersion;
@@ -183,18 +187,28 @@ public:
sal_Bool mbTextDocInOOoFileFormat;
// <--
+ const uno::Reference< uno::XComponentContext > mxComponentContext;
+
+ std::auto_ptr< xmloff::RDFaImportHelper > mpRDFaHelper;
+
SvXMLImport_Impl() :
hBatsFontConv( 0 ), hMathFontConv( 0 ),
mbOwnGraphicResolver( false ),
mbOwnEmbeddedResolver( false ),
- mStreamPath(),
+ mStreamName(),
// --> OD 2004-08-11 #i28749#
mbShapePositionInHoriL2R( sal_False ),
// <--
// --> OD 2007-12-19 #152540#
- mbTextDocInOOoFileFormat( sal_False )
+ mbTextDocInOOoFileFormat( sal_False ),
// <--
- {}
+ mxComponentContext( ::comphelper::getProcessComponentContext() ),
+ mpRDFaHelper() // lazy
+ {
+ OSL_ENSURE(mxComponentContext.is(), "SvXMLImport: no ComponentContext");
+ if (!mxComponentContext.is()) throw uno::RuntimeException();
+ }
+
~SvXMLImport_Impl()
{
if( hBatsFontConv )
@@ -222,7 +236,6 @@ void SvXMLImport::_InitCtor()
if( mnImportFlags != 0 )
{
// implicit "xml" namespace prefix
- const ::rtl::OUString Xml;
mpNamespaceMap->Add( GetXMLToken(XML_XML), GetXMLToken(XML_N_XML),
XML_NAMESPACE_XML );
mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__office ) ),
@@ -294,6 +307,9 @@ void SvXMLImport::_InitCtor()
mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__field ) ), GetXMLToken(XML_N_FIELD), XML_NAMESPACE_FIELD );
mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__of ) ),
GetXMLToken(XML_N_OF), XML_NAMESPACE_OF );
+ mpNamespaceMap->Add(
+ OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__xhtml ) ),
+ GetXMLToken(XML_N_XHTML), XML_NAMESPACE_XHTML );
}
msPackageProtocol = OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) );
@@ -527,6 +543,16 @@ void SAL_CALL SvXMLImport::endDocument( void )
// #i9518# All the stuff that accesses the document has to be done here, not in the dtor,
// because the SvXMLImport dtor might not be called until after the document has been closed.
+ if (mpImpl->mpRDFaHelper.get())
+ {
+ const uno::Reference<rdf::XRepositorySupplier> xRS(mxModel,
+ uno::UNO_QUERY);
+ if (xRS.is())
+ {
+ mpImpl->mpRDFaHelper->InsertRDFa( xRS );
+ }
+ }
+
if (mpNumImport)
{
delete mpNumImport;
@@ -935,9 +961,7 @@ void SAL_CALL SvXMLImport::initialize( const uno::Sequence< uno::Any >& aArgumen
mpImpl->aBaseURL.insertName( sRelPath );
mpImpl->aBaseURL.insertName( sName );
}
- OSL_ENSURE(sName.getLength(), "no StreamName ???");
- mpImpl->mStreamPath = sRelPath.getLength() ? sRelPath +
- ::rtl::OUString::createFromAscii("/") + sName : sName;
+ mpImpl->mStreamName = sName; // Note: may be empty (XSLT)
// --> OD 2004-08-10 #i28749# - retrieve property <ShapePositionInHoriL2R>
sPropName = OUString( RTL_CONSTASCII_USTRINGPARAM("ShapePositionInHoriL2R" ) );
if( xPropertySetInfo->hasPropertyByName(sPropName) )
@@ -1562,7 +1586,7 @@ const SvXMLStylesContext *SvXMLImport::GetMasterStyles() const
return (const SvXMLStylesContext *)&mxMasterStyles;
}
-OUString SvXMLImport::GetAbsoluteReference(const OUString& rValue)
+OUString SvXMLImport::GetAbsoluteReference(const OUString& rValue) const
{
if( rValue.getLength() == 0 || rValue[0] == '#' )
return rValue;
@@ -1753,6 +1777,13 @@ void SvXMLImport::DisposingModel()
// #110680#
return mxServiceFactory;
}
+
+uno::Reference< uno::XComponentContext >
+SvXMLImport::GetComponentContext() const
+{
+ return mpImpl->mxComponentContext;
+}
+
String SvXMLImport::GetBaseURL() const
{
return mpImpl->aBaseURL.GetMainURL( INetURLObject::NO_DECODE );
@@ -1763,9 +1794,9 @@ String SvXMLImport::GetDocumentBase() const
return mpImpl->aDocBase.GetMainURL( INetURLObject::NO_DECODE );
}
-::rtl::OUString SvXMLImport::GetStreamPath() const
+::rtl::OUString SvXMLImport::GetStreamName() const
{
- return mpImpl->mStreamPath;
+ return mpImpl->mStreamName;
}
// --> OD 2004-08-10 #i28749#
@@ -1854,13 +1885,12 @@ void SvXMLImport::SetXmlId(uno::Reference<uno::XInterface> const & i_xIfc,
//FIXME: not yet
// OSL_ENSURE(xMeta.is(), "xml:id: not XMetadatable");
if (xMeta.is()) {
- ::rtl::OUStringBuffer XmlId( GetStreamPath() );
- XmlId.appendAscii("#");
- XmlId.append(i_rXmlId);
+ const beans::StringPair mdref( GetStreamName(), i_rXmlId );
try {
- xMeta->setXmlId(XmlId.makeStringAndClear());
+ xMeta->setMetadataReference(mdref);
} catch (lang::IllegalArgumentException &) {
// probably duplicate; ignore
+ OSL_TRACE("SvXMLImport::SetXmlId: cannot set xml:id");
}
}
} catch (uno::Exception &) {
@@ -1868,3 +1898,20 @@ void SvXMLImport::SetXmlId(uno::Reference<uno::XInterface> const & i_xIfc,
}
}
+void
+SvXMLImport::AddRDFa(uno::Reference<rdf::XMetadatable> i_xObject,
+ ::rtl::OUString const & i_rAbout,
+ ::rtl::OUString const & i_rProperty,
+ ::rtl::OUString const & i_rContent,
+ ::rtl::OUString const & i_rDatatype)
+{
+ // N.B.: we only get called if i_xObject had xhtml:about attribute
+ // (an empty attribute value is valid)
+ if (!mpImpl->mpRDFaHelper.get())
+ {
+ mpImpl->mpRDFaHelper.reset( new ::xmloff::RDFaImportHelper(*this) );
+ }
+ mpImpl->mpRDFaHelper->AddRDFa(i_xObject,
+ i_rAbout, i_rProperty, i_rContent, i_rDatatype);
+}
+
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index badadd466b63..8655a367db52 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -146,9 +146,11 @@ namespace xmloff { namespace token {
TOKEN( "of", XML_NP_OF ),
TOKEN( "urn:oasis:names:tc:opendocument:xmlns:of:1.2", XML_N_OF ),
- // ODF 1.2 metadata: RDFa
- TOKEN( "rdfa", XML_NP_RDFA ),
- TOKEN( "http://docs.oasis-open.org/opendocument/meta/rdfa#", XML_N_RDFA ),
+ // ODF 1.2 metadata: RDFa and GRDDL
+ TOKEN( "xhtml", XML_NP_XHTML ),
+ TOKEN( "http://www.w3.org/1999/xhtml", XML_N_XHTML ),
+ TOKEN( "grddl", XML_NP_GRDDL ),
+ TOKEN( "http://www.w3.org/2003/g/data-view#", XML_N_GRDDL ),
// units
TOKEN( "mm", XML_UNIT_MM ),
@@ -3044,6 +3046,7 @@ namespace xmloff { namespace token {
TOKEN( "meta-field", XML_META_FIELD ),
TOKEN( "about", XML_ABOUT ),
TOKEN( "datatype", XML_DATATYPE ),
+ TOKEN( "transformation", XML_TRANSFORMATION ),
// ODF 1.2 numbered-paragraph
TOKEN( "list-id", XML_LIST_ID ),
@@ -3080,6 +3083,13 @@ namespace xmloff { namespace token {
TOKEN( "mathweight", XML_MATHWEIGHT ),
TOKEN( "mathcolor", XML_MATHCOLOR ),
+ TOKEN( "contains", XML_CONTAINS ),
+ TOKEN( "does-not-contain", XML_DOES_NOT_CONTAIN ),
+ TOKEN( "begins-with", XML_BEGINS_WITH ),
+ TOKEN( "does-not-begin-with", XML_DOES_NOT_BEGIN_WITH ),
+ TOKEN( "ends-with", XML_ENDS_WITH ),
+ TOKEN( "does-not-end-with", XML_DOES_NOT_END_WITH ),
+
#if OSL_DEBUG_LEVEL > 0
{ 0, NULL, NULL, XML_TOKEN_END }
#else
diff --git a/xmloff/source/draw/animationexport.cxx b/xmloff/source/draw/animationexport.cxx
index 5253404c9894..4d7a8af1a1e9 100644
--- a/xmloff/source/draw/animationexport.cxx
+++ b/xmloff/source/draw/animationexport.cxx
@@ -1564,7 +1564,7 @@ void AnimationsExporterImpl::convertValue( XMLTokenEnum eAttributeName, OUString
case XML_FONT_WEIGHT: nType = XML_TYPE_TEXT_WEIGHT; break;
case XML_FONT_STYLE: nType = XML_TYPE_TEXT_POSTURE; break;
case XML_TEXT_UNDERLINE: nType = XML_TYPE_TEXT_UNDERLINE_STYLE; break;
- case XML_FONT_SIZE: nType = XML_TYPE_CHAR_HEIGHT; break;
+ case XML_FONT_SIZE: nType = XML_TYPE_DOUBLE_PERCENT; break;
case XML_VISIBILITY: nType = XML_SD_TYPE_PRESPAGE_VISIBILITY; break;
case XML_OPACITY:
case XML_TRANSITIONFILTER: nType = XML_TYPE_DOUBLE; break;
diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx
index c6a8ce2eb7cc..6569c9d5408d 100644
--- a/xmloff/source/draw/animationimport.cxx
+++ b/xmloff/source/draw/animationimport.cxx
@@ -472,7 +472,7 @@ Any AnimationsImportHelperImpl::convertValue( XMLTokenEnum eAttributeName, const
case XML_FONT_WEIGHT: nType = XML_TYPE_TEXT_WEIGHT; break;
case XML_FONT_STYLE: nType = XML_TYPE_TEXT_POSTURE; break;
case XML_TEXT_UNDERLINE: nType = XML_TYPE_TEXT_UNDERLINE_STYLE; break;
- case XML_FONT_SIZE: nType = XML_TYPE_CHAR_HEIGHT; break;
+ case XML_FONT_SIZE: nType = XML_TYPE_DOUBLE_PERCENT; break;
case XML_VISIBILITY: nType = XML_SD_TYPE_PRESPAGE_VISIBILITY; break;
default:
diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx
index 60b921ea8aaa..dcdfdbaa05d2 100644
--- a/xmloff/source/draw/sdpropls.cxx
+++ b/xmloff/source/draw/sdpropls.cxx
@@ -268,7 +268,7 @@ const XMLPropertyMapEntry aXMLSDProperties[] =
GMAP( "ControlDataStyle", XML_NAMESPACE_STYLE,XML_DATA_STYLE_NAME, XML_TYPE_STRING|MID_FLAG_NO_PROPERTY_EXPORT|MID_FLAG_SPECIAL_ITEM, CTF_SD_CONTROL_SHAPE_DATA_STYLE ),
GMAP( "ControlTextEmphasis", XML_NAMESPACE_STYLE,XML_TEXT_EMPHASIZE, XML_TYPE_CONTROL_TEXT_EMPHASIZE, 0 ),
GMAP( "ImageScaleMode", XML_NAMESPACE_STYLE,XML_REPEAT, XML_SD_TYPE_IMAGE_SCALE_MODE|MID_FLAG_MULTI_PROPERTY, 0 ),
- GMAP( "ControlWritingMode", XML_NAMESPACE_STYLE,XML_WRITING_MODE, XML_TYPE_TEXT_WRITING_MODE_WITH_DEFAULT|MID_FLAG_MULTI_PROPERTY, 0 ),
+ GMAP( "ControlWritingMode", XML_NAMESPACE_STYLE,XML_WRITING_MODE, XML_TYPE_TEXT_WRITING_MODE_WITH_DEFAULT|MID_FLAG_MULTI_PROPERTY, CTF_CONTROLWRITINGMODE ),
// special entries for floating frames
GMAP( "FrameIsAutoScroll", XML_NAMESPACE_DRAW, XML_FRAME_DISPLAY_SCROLLBAR, XML_TYPE_BOOL|MID_FLAG_MULTI_PROPERTY, CTF_FRAME_DISPLAY_SCROLLBAR ),
@@ -1230,6 +1230,10 @@ void XMLShapeExportPropertyMapper::ContextFilter(
XMLPropertyState* pClip11State = NULL;
XMLPropertyState* pClipState = NULL;
+ XMLPropertyState* pShapeWritingMode = NULL;
+ XMLPropertyState* pTextWritingMode = NULL;
+ XMLPropertyState* pControlWritingMode = NULL;
+
// filter properties
for( std::vector< XMLPropertyState >::iterator aIter = rProperties.begin();
aIter != rProperties.end();
@@ -1261,14 +1265,24 @@ void XMLShapeExportPropertyMapper::ContextFilter(
break;
case CTF_WRITINGMODE:
{
+ pShapeWritingMode = property;
text::WritingMode eWritingMode;
if( property->maValue >>= eWritingMode )
{
if( text::WritingMode_LR_TB == eWritingMode )
+ {
property->mnIndex = -1;
+ pShapeWritingMode = 0;
+ }
}
}
break;
+ case CTF_CONTROLWRITINGMODE:
+ pControlWritingMode = property;
+ break;
+ case CTF_TEXTWRITINGMODE:
+ pTextWritingMode = property;
+ break;
case CTF_REPEAT_OFFSET_X:
pRepeatOffsetX = property;
break;
@@ -1353,6 +1367,19 @@ void XMLShapeExportPropertyMapper::ContextFilter(
}
}
+ // check for duplicate writing mode
+ if( pShapeWritingMode && (pTextWritingMode || pControlWritingMode) )
+ {
+ if( pTextWritingMode )
+ pTextWritingMode->mnIndex = -1;
+ if( pControlWritingMode )
+ pControlWritingMode->mnIndex = -1;
+ }
+ else if( pTextWritingMode && pControlWritingMode )
+ {
+ pControlWritingMode->mnIndex = -1;
+ }
+
// do not export visual area for internal ole objects
if( pOLEIsInternal )
{
diff --git a/xmloff/source/draw/sdpropls.hxx b/xmloff/source/draw/sdpropls.hxx
index bf27e669f1ca..eed5eee69b51 100644
--- a/xmloff/source/draw/sdpropls.hxx
+++ b/xmloff/source/draw/sdpropls.hxx
@@ -142,7 +142,7 @@ extern const XMLPropertyMapEntry aXMLSDPresPageProps_onlyHeadersFooter[];
//////////////////////////////////////////////////////////////////////////////
#define CTF_NUMBERINGRULES 1000
-//#define CTF_NUMBERINGRULES_NAME 1001
+#define CTF_CONTROLWRITINGMODE 1001
#define CTF_WRITINGMODE 1002
#define CTF_REPEAT_OFFSET_X 1003
#define CTF_REPEAT_OFFSET_Y 1004
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index d3e3edcd6716..bcac474e97eb 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -1213,7 +1213,8 @@ const rtl::Reference< XMLTableExport >& XMLShapeExport::GetShapeTableExport()
if( !mxShapeTableExport.is() )
{
rtl::Reference< XMLPropertyHandlerFactory > xFactory( new XMLSdPropHdlFactory( mrExport.GetModel(), mrExport ) );
- rtl::Reference< XMLPropertySetMapper > xPropertySetMapper( new XMLShapePropertySetMapper( xFactory.get() ) );
+ UniReference < XMLPropertySetMapper > xMapper( new XMLShapePropertySetMapper( xFactory.get() ) );
+ rtl::Reference< SvXMLExportPropertyMapper > xPropertySetMapper( new XMLShapeExportPropertyMapper( xMapper, (XMLTextListAutoStylePool*)&mrExport.GetTextParagraphExport()->GetListAutoStylePool(), mrExport ) );
mxShapeTableExport = new XMLTableExport( mrExport, xPropertySetMapper, xFactory );
}
diff --git a/xmloff/source/draw/shapeexport2.cxx b/xmloff/source/draw/shapeexport2.cxx
index a7bb8bd7fcec..b2e81d333fba 100644
--- a/xmloff/source/draw/shapeexport2.cxx
+++ b/xmloff/source/draw/shapeexport2.cxx
@@ -49,6 +49,7 @@
#endif
#include "sdpropls.hxx"
#include <tools/debug.hxx>
+#include <tools/urlobj.hxx>
#include <rtl/ustrbuf.hxx>
#include <xmloff/xmlexp.hxx>
#include <xmloff/xmluconv.hxx>
@@ -1166,8 +1167,30 @@ void XMLShapeExport::ImpExportGraphicObjectShape(
OUString aStreamURL;
OUString aStr;
+ xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicStreamURL"))) >>= aStreamURL;
xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicURL"))) >>= sImageURL;
- aStr = mrExport.AddEmbeddedGraphicObject( sImageURL );
+
+ OUString aResolveURL( sImageURL );
+ const rtl::OUString sPackageURL( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.Package:") );
+
+ // sj: trying to preserve the filename
+ if ( aStreamURL.match( sPackageURL, 0 ) )
+ {
+ rtl::OUString sRequestedName( aStreamURL.copy( sPackageURL.getLength(), aStreamURL.getLength() - sPackageURL.getLength() ) );
+ sal_Int32 nLastIndex = sRequestedName.lastIndexOf( '/' ) + 1;
+ if ( ( nLastIndex > 0 ) && ( nLastIndex < sRequestedName.getLength() ) )
+ sRequestedName = sRequestedName.copy( nLastIndex, sRequestedName.getLength() - nLastIndex );
+ nLastIndex = sRequestedName.lastIndexOf( '.' );
+ if ( nLastIndex >= 0 )
+ sRequestedName = sRequestedName.copy( 0, nLastIndex );
+ if ( sRequestedName.getLength() )
+ {
+ aResolveURL = aResolveURL.concat( OUString(RTL_CONSTASCII_USTRINGPARAM("?requestedName=")));
+ aResolveURL = aResolveURL.concat( sRequestedName );
+ }
+ }
+
+ aStr = mrExport.AddEmbeddedGraphicObject( aResolveURL );
mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr );
if( aStr.getLength() )
diff --git a/xmloff/source/draw/shapeexport4.cxx b/xmloff/source/draw/shapeexport4.cxx
index d38bb3761868..e2e804eefb43 100644
--- a/xmloff/source/draw/shapeexport4.cxx
+++ b/xmloff/source/draw/shapeexport4.cxx
@@ -1130,21 +1130,21 @@ void XMLShapeExport::ImpExportTableShape( const uno::Reference< drawing::XShape
{
mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_TEMPLATE_NAME, sTemplate );
- const XMLPropertyMapEntry* pEntry = &aXMLTableShapeAttributes[0];
-
- while( pEntry->msApiName ) try
+ for( const XMLPropertyMapEntry* pEntry = &aXMLTableShapeAttributes[0]; pEntry->msApiName; pEntry++ )
{
- sal_Bool bBool = sal_False;
- const OUString sAPIPropertyName( OUString(pEntry->msApiName, pEntry->nApiNameLength, RTL_TEXTENCODING_ASCII_US ) );
+ try
+ {
+ sal_Bool bBool = sal_False;
+ const OUString sAPIPropertyName( OUString(pEntry->msApiName, pEntry->nApiNameLength, RTL_TEXTENCODING_ASCII_US ) );
- xPropSet->getPropertyValue( sAPIPropertyName ) >>= bBool;
- if( bBool )
- mrExport.AddAttribute(pEntry->mnNameSpace, pEntry->meXMLName, XML_TRUE );
- pEntry++;
- }
- catch( uno::Exception& )
- {
- DBG_ERROR("XMLShapeExport::ImpExportTableShape(), exception caught!");
+ xPropSet->getPropertyValue( sAPIPropertyName ) >>= bBool;
+ if( bBool )
+ mrExport.AddAttribute(pEntry->mnNameSpace, pEntry->meXMLName, XML_TRUE );
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR("XMLShapeExport::ImpExportTableShape(), exception caught!");
+ }
}
}
}
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 27ca5c4beafe..65aad96bad86 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -3584,16 +3584,17 @@ void SdXMLTableShapeContext::StartElement( const ::com::sun::star::uno::Referenc
}
const XMLPropertyMapEntry* pEntry = &aXMLTableShapeAttributes[0];
- int i = 0;
- while( pEntry->msApiName && (i < 6) ) try
- {
- const OUString sAPIPropertyName( OUString(pEntry->msApiName, pEntry->nApiNameLength, RTL_TEXTENCODING_ASCII_US ) );
- xProps->setPropertyValue( sAPIPropertyName, Any( maTemplateStylesUsed[i++] ) );
- pEntry++;
- }
- catch( Exception& )
+ for( int i = 0; pEntry->msApiName && (i < 6); i++, pEntry++ )
{
- DBG_ERROR("SdXMLTableShapeContext::StartElement(), exception caught!");
+ try
+ {
+ const OUString sAPIPropertyName( OUString(pEntry->msApiName, pEntry->nApiNameLength, RTL_TEXTENCODING_ASCII_US ) );
+ xProps->setPropertyValue( sAPIPropertyName, Any( maTemplateStylesUsed[i] ) );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("SdXMLTableShapeContext::StartElement(), exception caught!");
+ }
}
}
diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx
index 0769798159c4..d3dc170e58d5 100644
--- a/xmloff/source/forms/elementexport.cxx
+++ b/xmloff/source/forms/elementexport.cxx
@@ -529,15 +529,15 @@ namespace xmloff
{
static sal_Int32 nBooleanPropertyAttributeIds[] =
{ // attribute flags
- CCA_CURRENT_SELECTED, CCA_DISABLED, CCA_DROPDOWN, CCA_PRINTABLE, CCA_READONLY, CCA_SELECTED, CCA_TAB_STOP
+ CCA_CURRENT_SELECTED, CCA_DISABLED, CCA_DROPDOWN, CCA_PRINTABLE, CCA_READONLY, CCA_SELECTED, CCA_TAB_STOP, CCA_ENABLEVISIBLE
};
static const ::rtl::OUString* pBooleanPropertyNames[] =
{ // property names
- &PROPERTY_STATE, &PROPERTY_ENABLED, &PROPERTY_DROPDOWN, &PROPERTY_PRINTABLE, &PROPERTY_READONLY, &PROPERTY_DEFAULT_STATE, &PROPERTY_TABSTOP
+ &PROPERTY_STATE, &PROPERTY_ENABLED, &PROPERTY_DROPDOWN, &PROPERTY_PRINTABLE, &PROPERTY_READONLY, &PROPERTY_DEFAULT_STATE, &PROPERTY_TABSTOP, &PROPERTY_ENABLEVISIBLE
};
static sal_Bool nBooleanPropertyAttrFlags[] =
{ // attribute defaults
- BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_FALSE | BOOLATTR_INVERSE_SEMANTICS, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_VOID
+ BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_FALSE | BOOLATTR_INVERSE_SEMANTICS, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_VOID, BOOLATTR_DEFAULT_FALSE
};
#if OSL_DEBUG_LEVEL > 0
sal_Int32 nIdCount = sizeof(nBooleanPropertyAttributeIds) / sizeof(nBooleanPropertyAttributeIds[0]);
diff --git a/xmloff/source/forms/formattributes.cxx b/xmloff/source/forms/formattributes.cxx
index da5f3207ddda..0c2431590b63 100644
--- a/xmloff/source/forms/formattributes.cxx
+++ b/xmloff/source/forms/formattributes.cxx
@@ -60,6 +60,7 @@ namespace xmloff
case CCA_CURRENT_SELECTED: return "current-selected";
case CCA_CURRENT_VALUE: return "current-value";
case CCA_DISABLED: return "disabled";
+ case CCA_ENABLEVISIBLE: return "visible";
case CCA_DROPDOWN: return "dropdown";
case CCA_FOR: return "for";
case CCA_IMAGE_DATA: return "image-data";
diff --git a/xmloff/source/forms/formattributes.hxx b/xmloff/source/forms/formattributes.hxx
index 5d55948be328..eba2855d3b5e 100644
--- a/xmloff/source/forms/formattributes.hxx
+++ b/xmloff/source/forms/formattributes.hxx
@@ -69,6 +69,7 @@ namespace xmloff
#define CCA_VALUE 0x00200000
#define CCA_ORIENTATION 0x00400000
#define CCA_VISUAL_EFFECT 0x00800000
+ #define CCA_ENABLEVISIBLE 0x01000000
// flags for database control atttributes
#define DA_BOUND_COLUMN 0x00000001
diff --git a/xmloff/source/forms/strings.hxx b/xmloff/source/forms/strings.hxx
index 2e525829fa1a..59413ed0b924 100644
--- a/xmloff/source/forms/strings.hxx
+++ b/xmloff/source/forms/strings.hxx
@@ -115,6 +115,7 @@ namespace xmloff
XMLFORM_CONSTASCII_STRING( PROPERTY_TABSTOP, "Tabstop" );
XMLFORM_CONSTASCII_STRING( PROPERTY_STATE, "State" );
XMLFORM_CONSTASCII_STRING( PROPERTY_ENABLED, "Enabled" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_ENABLEVISIBLE, "EnableVisible" );
XMLFORM_CONSTASCII_STRING( PROPERTY_MAXTEXTLENGTH, "MaxTextLen" );
XMLFORM_CONSTASCII_STRING( PROPERTY_LINECOUNT, "LineCount" );
XMLFORM_CONSTASCII_STRING( PROPERTY_TABINDEX, "TabIndex" );
diff --git a/xmloff/source/table/XMLTableExport.cxx b/xmloff/source/table/XMLTableExport.cxx
index 1fe2127e1a6e..de930d6dd288 100644
--- a/xmloff/source/table/XMLTableExport.cxx
+++ b/xmloff/source/table/XMLTableExport.cxx
@@ -150,7 +150,7 @@ sal_Int32 StringStatisticHelper::getModeString( OUString& rStyleName )
// class XMLTableExport
// --------------------------------------------------------------------
-XMLTableExport::XMLTableExport(SvXMLExport& rExp, const rtl::Reference< XMLPropertySetMapper >& xCellPropertySetMapper, const rtl::Reference< XMLPropertyHandlerFactory >& xFactoryRef )
+XMLTableExport::XMLTableExport(SvXMLExport& rExp, const rtl::Reference< SvXMLExportPropertyMapper >& xExportPropertyMapper, const rtl::Reference< XMLPropertyHandlerFactory >& xFactoryRef )
: mrExport( rExp )
, mbExportTables( false )
{
@@ -174,7 +174,7 @@ XMLTableExport::XMLTableExport(SvXMLExport& rExp, const rtl::Reference< XMLPrope
(void)e;
}
- mxCellExportPropertySetMapper = new SvXMLExportPropertyMapper( xCellPropertySetMapper.get() );
+ mxCellExportPropertySetMapper = xExportPropertyMapper;
mxCellExportPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(rExp));
mxRowExportPropertySetMapper = new SvXMLExportPropertyMapper( new XMLPropertySetMapper( getRowPropertiesMap(), xFactoryRef.get() ) );
diff --git a/xmloff/source/text/XMLTextMarkImportContext.cxx b/xmloff/source/text/XMLTextMarkImportContext.cxx
index 04201990b797..1091636c9d3f 100644
--- a/xmloff/source/text/XMLTextMarkImportContext.cxx
+++ b/xmloff/source/text/XMLTextMarkImportContext.cxx
@@ -308,39 +308,57 @@ Reference<XInterface> XMLTextMarkImportContext::CreateAndInsertMark(
const OUString& i_rXmlId)
{
// create mark
- Reference<XMultiServiceFactory> xFactory(rImport.GetModel(),UNO_QUERY);
- if( xFactory.is() )
+ const Reference<XMultiServiceFactory> xFactory(rImport.GetModel(),
+ UNO_QUERY);
+ Reference<XInterface> xIfc;
+
+ if (xFactory.is())
{
- Reference<XInterface> xIfc = xFactory->createInstance(sServiceName);
+ xIfc = xFactory->createInstance(sServiceName);
- // set name
- Reference<XNamed> xNamed(xIfc, UNO_QUERY);
+ if (!xIfc.is())
+ {
+ OSL_ENSURE(false, "CreateAndInsertMark: cannot create service?");
+ return 0;
+ }
+
+ // set name (unless there is no name (text:meta))
+ const Reference<XNamed> xNamed(xIfc, UNO_QUERY);
if (xNamed.is())
{
xNamed->setName(sMarkName);
+ }
+ else
+ {
+ if (sMarkName.getLength())
+ {
+ OSL_ENSURE(false, "name given, but XNamed not supported?");
+ return 0;
+ }
+ }
- // xml:id for RDF metadata
- rImport.SetXmlId(xIfc, i_rXmlId);
+ // xml:id for RDF metadata
+ rImport.SetXmlId(xIfc, i_rXmlId);
- // cast to XTextContent and attach to document
- Reference<XTextContent> xTextContent(xIfc, UNO_QUERY);
- if (xTextContent.is())
+ // cast to XTextContent and attach to document
+ const Reference<XTextContent> xTextContent(xIfc, UNO_QUERY);
+ if (xTextContent.is())
+ {
+ try
{
- try
- {
// if inserting marks, bAbsorb==sal_False will cause
// collapsing of the given XTextRange.
- rImport.GetTextImport()->GetText()->insertTextContent(rRange,
- xTextContent, sal_True);
- }
- catch (com::sun::star::lang::IllegalArgumentException e)
- {
- // ignore
- }
+ rImport.GetTextImport()->GetText()->insertTextContent(rRange,
+ xTextContent, sal_True);
+ }
+ catch (com::sun::star::lang::IllegalArgumentException &)
+ {
+ OSL_ENSURE(false, "CreateAndInsertMark: cannot insert?");
+ return 0;
}
}
- return xIfc;
- } else return NULL;
+ }
+ return xIfc;
}
sal_Bool XMLTextMarkImportContext::FindName(
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index a77e49925554..873a4a42f02c 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -44,9 +44,6 @@
#include <xmloff/xmlnume.hxx>
#include "numehelp.hxx"
-#ifndef _XMLOFF_PROPMAPPINGTYPES_HXX
-#include <xmloff/maptypes.hxx>
-#endif
#include <xmloff/families.hxx>
#include <xmloff/XMLEventExport.hxx>
#include "XMLTextCharStyleNamesElementExport.hxx"
@@ -65,9 +62,7 @@
#include <com/sun/star/text/XDependentTextField.hpp>
#include <com/sun/star/text/XTextFieldsSupplier.hpp>
-#ifndef _COM_SUN_STAR_TEXT_SETVARIABLETYPE_HPP
#include <com/sun/star/text/SetVariableType.hpp>
-#endif
#include <com/sun/star/text/PlaceholderType.hpp>
#include <com/sun/star/text/FilenameDisplayFormat.hpp>
#include <com/sun/star/text/ChapterFormat.hpp>
@@ -78,6 +73,7 @@
#include <com/sun/star/util/NumberFormat.hpp>
#include <com/sun/star/text/BibliographyDataType.hpp>
#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/rdf/XMetadatable.hpp>
#include <rtl/ustrbuf.hxx>
#include <tools/debug.hxx>
#include <rtl/math.hxx>
@@ -152,6 +148,7 @@ static sal_Char __READONLY_DATA FIELD_SERVICE_BIBLIOGRAPHY[] = "Bibliography";
static sal_Char __READONLY_DATA FIELD_SERVICE_SCRIPT[] = "Script";
static sal_Char __READONLY_DATA FIELD_SERVICE_ANNOTATION[] = "Annotation";
static sal_Char __READONLY_DATA FIELD_SERVICE_COMBINED_CHARACTERS[] = "CombinedCharacters";
+static sal_Char __READONLY_DATA FIELD_SERVICE_META[] = "MetaField";
static sal_Char __READONLY_DATA FIELD_SERVICE_MEASURE[] = "Measure";
static sal_Char __READONLY_DATA FIELD_SERVICE_TABLE_FORMULA[] = "TableFormula";
static sal_Char __READONLY_DATA FIELD_SERVICE_DROP_DOWN[] = "DropDown";
@@ -219,6 +216,7 @@ SvXMLEnumStringMapEntry __READONLY_DATA aFieldServiceNameMapping[] =
ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_ANNOTATION, FIELD_ID_ANNOTATION ),
ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_COMBINED_CHARACTERS, FIELD_ID_COMBINED_CHARACTERS ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_META, FIELD_ID_META ),
// non-writer fields
ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_SHEET_NAME, FIELD_ID_SHEET_NAME ),
@@ -604,6 +602,7 @@ enum FieldIdEnum XMLTextFieldExport::MapFieldName(
case FIELD_ID_TEMPLATE_NAME:
case FIELD_ID_CHAPTER:
case FIELD_ID_FILE_NAME:
+ case FIELD_ID_META:
case FIELD_ID_SHEET_NAME:
case FIELD_ID_MEASURE:
case FIELD_ID_URL:
@@ -646,6 +645,9 @@ sal_Bool XMLTextFieldExport::IsStringField(
return !bRet;
}
+ case FIELD_ID_META://FIXME ?????? no idea...
+ return 0 > GetIntProperty(sPropertyNumberFormat, xPropSet);
+
case FIELD_ID_DATABASE_DISPLAY:
// TODO: depends on... ???
// workaround #no-bug#: no data type
@@ -738,7 +740,7 @@ sal_Bool XMLTextFieldExport::IsStringField(
/// export the styles needed by the given field. Called on first pass
/// through document
void XMLTextFieldExport::ExportFieldAutoStyle(
- const Reference<XTextField> & rTextField)
+ const Reference<XTextField> & rTextField, sal_Bool bProgress )
{
// get property set
Reference<XPropertySet> xPropSet(rTextField, UNO_QUERY);
@@ -831,6 +833,10 @@ void XMLTextFieldExport::ExportFieldAutoStyle(
}
break;
+ case FIELD_ID_META:
+ // recurse into content (does not export element, so can be done first)
+ ExportMetaField(xPropSet, true, bProgress);
+ // fall-through: for the meta-field itself!
case FIELD_ID_DOCINFO_PRINT_TIME:
case FIELD_ID_DOCINFO_PRINT_DATE:
case FIELD_ID_DOCINFO_CREATION_DATE:
@@ -948,7 +954,8 @@ void XMLTextFieldExport::ExportFieldAutoStyle(
}
/// export the given field to XML. Called on second pass through document
-void XMLTextFieldExport::ExportField(const Reference<XTextField> & rTextField )
+void XMLTextFieldExport::ExportField(
+ const Reference<XTextField> & rTextField, sal_Bool bProgress )
{
// get property set
Reference<XPropertySet> xPropSet(rTextField, UNO_QUERY);
@@ -1026,7 +1033,8 @@ void XMLTextFieldExport::ExportField(const Reference<XTextField> & rTextField )
sal_False, sal_False);
// finally, export the field itself
- ExportFieldHelper( rTextField, xPropSet, xRangePropSet, nToken );
+ ExportFieldHelper( rTextField, xPropSet, xRangePropSet, nToken,
+ bProgress );
}
}
@@ -1035,7 +1043,8 @@ void XMLTextFieldExport::ExportFieldHelper(
const Reference<XTextField> & rTextField,
const Reference<XPropertySet> & rPropSet,
const Reference<XPropertySet> &,
- enum FieldIdEnum nToken)
+ enum FieldIdEnum nToken,
+ sal_Bool bProgress )
{
// get property set info (because some attributes are not support
// in all implementations)
@@ -1738,11 +1747,17 @@ void XMLTextFieldExport::ExportFieldHelper(
{
// The style with the combined characters attribute has
// already been handled in the ExportField method. So all that
- // is left to do now is to exprot the characters.
+ // is left to do now is to export the characters.
GetExport().Characters(sPresentation);
break;
}
+ case FIELD_ID_META:
+ {
+ ExportMetaField(rPropSet, false, bProgress);
+ break;
+ }
+
case FIELD_ID_MEASURE:
{
ProcessString(XML_KIND, MapMeasureKind(GetInt16Property(sPropertyMeasureKind, rPropSet)));
@@ -2248,6 +2263,47 @@ void XMLTextFieldExport::ExportMacro(
GetExport().Characters(rContent);
}
+// FIXME: this is untested
+void XMLTextFieldExport::ExportMetaField(
+ const Reference<XPropertySet> & i_xMeta,
+ bool i_bAutoStyles, sal_Bool i_bProgress )
+{
+ bool doExport(!i_bAutoStyles); // do not export element if autostyles
+ // check version >= 1.2
+ switch (GetExport().getDefaultVersion()) {
+ case SvtSaveOptions::ODFVER_011: // fall thru
+ case SvtSaveOptions::ODFVER_010: doExport = false; break;
+ default: break;
+ }
+
+ const Reference < XEnumerationAccess > xEA( i_xMeta, UNO_QUERY_THROW );
+ const Reference < XEnumeration > xTextEnum( xEA->createEnumeration() );
+
+ if (doExport)
+ {
+ const Reference<rdf::XMetadatable> xMeta( i_xMeta, UNO_QUERY_THROW );
+
+ // style:data-style-name
+ ProcessValueAndType(sal_False,
+ GetIntProperty(sPropertyNumberFormat, i_xMeta),
+ sEmpty, sEmpty, 0.0, sal_False, sal_False, sal_True,
+ sal_False, sal_False /*, sal_False*/ );
+
+ // text:meta-field without xml:id is invalid
+ xMeta->ensureMetadataReference();
+
+ // xml:id for RDF metadata
+ GetExport().AddAttributeXmlId(xMeta);
+ }
+
+ SvXMLElementExport aElem( GetExport(), doExport,
+ XML_NAMESPACE_TEXT, XML_META_FIELD, sal_False, sal_False );
+
+ // recurse to export content
+ GetExport().GetTextParagraphExport()->
+ exportTextRangeEnumeration( xTextEnum, i_bAutoStyles, i_bProgress );
+}
+
/// export all data-style related attributes
void XMLTextFieldExport::ProcessValueAndType(
sal_Bool bIsString, /// do we process a string or a number?
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 04ac465daa3f..e47c3aae262b 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -327,7 +327,11 @@ static __FAR_DATA SvXMLTokenMapEntry aTextPElemTokenMap[] =
static __FAR_DATA SvXMLTokenMapEntry aTextPAttrTokenMap[] =
{
- { XML_NAMESPACE_XML , XML_ID, XML_TOK_TEXT_P_XMLID },
+ { XML_NAMESPACE_XML , XML_ID, XML_TOK_TEXT_P_XMLID },
+ { XML_NAMESPACE_XHTML, XML_ABOUT, XML_TOK_TEXT_P_ABOUT },
+ { XML_NAMESPACE_XHTML, XML_PROPERTY, XML_TOK_TEXT_P_PROPERTY },
+ { XML_NAMESPACE_XHTML, XML_CONTENT, XML_TOK_TEXT_P_CONTENT },
+ { XML_NAMESPACE_XHTML, XML_DATATYPE, XML_TOK_TEXT_P_DATATYPE },
{ XML_NAMESPACE_TEXT, XML_STYLE_NAME, XML_TOK_TEXT_P_STYLE_NAME },
{ XML_NAMESPACE_TEXT, XML_COND_STYLE_NAME,
XML_TOK_TEXT_P_COND_STYLE_NAME },
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 2617a8ff0089..a96fe0ffd1a2 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -65,15 +65,11 @@
#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/container/XContentEnumerationAccess.hpp>
#include <com/sun/star/text/XTextFrame.hpp>
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_
#include <com/sun/star/container/XNameAccess.hpp>
-#endif
#include <com/sun/star/text/SizeType.hpp>
#include <com/sun/star/text/HoriOrientation.hpp>
#include <com/sun/star/text/VertOrientation.hpp>
-#ifndef _COM_SUN_STAR_TEXT_TEXTCONTENTANCHORTYPE_HPP
#include <com/sun/star/text/TextContentAnchorType.hpp>
-#endif
#include <com/sun/star/text/XTextFramesSupplier.hpp>
#include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
#include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
@@ -111,28 +107,23 @@
#include <xmloff/nmspmap.hxx>
#include <xmloff/xmlexp.hxx>
#include "txtflde.hxx"
-#ifndef _XMLOFF_TXTPRMAP_HXX
#include <xmloff/txtprmap.hxx>
-#endif
#include "XMLImageMapExport.hxx"
#include "XMLTextNumRuleInfo.hxx"
#include "XMLTextListAutoStylePool.hxx"
-#ifndef _XMLOFF_TXTPARAE_HXX
#include <xmloff/txtparae.hxx>
-#endif
#include "XMLSectionExport.hxx"
#include "XMLIndexMarkExport.hxx"
#include <xmloff/XMLEventExport.hxx>
#include "XMLRedlineExport.hxx"
-#ifndef _XMLOFF_MULTIPROPERTYSETHELPER_HXX
#include "MultiPropertySetHelper.hxx"
-#endif
#include <xmloff/formlayerexport.hxx>
#include "XMLTextCharStyleNamesElementExport.hxx"
// --> OD 2008-04-25 #refactorlists#
#include <txtlists.hxx>
// <--
+#include <com/sun/star/rdf/XMetadatable.hpp>
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
@@ -975,23 +966,29 @@ void XMLTextParagraphExport::exportListChange(
// <text:list-header> or <text:list-item>
GetExport().CheckAttrList();
- if ( nListLevelsToBeOpened == 1 &&
- rNextInfo.HasStartValue() )
- {
- OUStringBuffer aBuffer;
- aBuffer.append( (sal_Int32)rNextInfo.GetStartValue() );
- GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE,
- aBuffer.makeStringAndClear() );
- }
- else if ( bRestartNumberingAtContinuedRootList )
+ // --> OD 2009-06-24 #i97309#
+ // export start value in case of <bRestartNumberingAtContinuedRootList>
+ // at correct list item
+ if ( nListLevelsToBeOpened == 1 )
{
- OUStringBuffer aBuffer;
- aBuffer.append( (sal_Int32)nRestartValueForContinuedRootList );
- GetExport().AddAttribute( XML_NAMESPACE_TEXT,
- XML_START_VALUE,
- aBuffer.makeStringAndClear() );
- bRestartNumberingAtContinuedRootList = false;
+ if ( rNextInfo.HasStartValue() )
+ {
+ OUStringBuffer aBuffer;
+ aBuffer.append( (sal_Int32)rNextInfo.GetStartValue() );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE,
+ aBuffer.makeStringAndClear() );
+ }
+ else if ( bRestartNumberingAtContinuedRootList )
+ {
+ OUStringBuffer aBuffer;
+ aBuffer.append( (sal_Int32)nRestartValueForContinuedRootList );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT,
+ XML_START_VALUE,
+ aBuffer.makeStringAndClear() );
+ bRestartNumberingAtContinuedRootList = false;
+ }
}
+ // <--
eLName = ( rNextInfo.IsNumbered() || nListLevelsToBeOpened > 1 )
? XML_LIST_ITEM
@@ -1460,7 +1457,8 @@ bool XMLTextParagraphExport::collectTextAutoStylesOptimized( sal_Bool bIsProgres
{
Any aAny = xTextFieldsEnum->nextElement();
Reference< XTextField > xTextField = *(Reference<XTextField>*)aAny.getValue();
- exportTextField( xTextField->getAnchor(), bAutoStyles );
+ exportTextField( xTextField->getAnchor(), bAutoStyles,
+ bIsProgress );
try
{
Reference < XPropertySet > xSet( xTextField, UNO_QUERY );
@@ -1905,6 +1903,7 @@ void XMLTextParagraphExport::exportParagraph(
{
// xml:id for RDF metadata
GetExport().AddAttributeXmlId(rTextContent);
+ GetExport().AddAttributesRDFa(rTextContent);
OUString sStyle;
if( rPropSetHelper.hasProperty( PARA_STYLE_NAME ) )
@@ -2142,6 +2141,7 @@ void XMLTextParagraphExport::exportTextRangeEnumeration(
sal_Bool bAutoStyles, sal_Bool bIsProgress,
sal_Bool bPrvChrIsSpc )
{
+ static OUString sMeta(RTL_CONSTASCII_USTRINGPARAM("Meta")); // FIXME
sal_Bool bPrevCharIsSpace = bPrvChrIsSpc;
while( rTextEnum->hasMoreElements() )
@@ -2162,7 +2162,7 @@ void XMLTextParagraphExport::exportTextRangeEnumeration(
}
else if( sType.equals(sTextField))
{
- exportTextField( xTxtRange, bAutoStyles );
+ exportTextField( xTxtRange, bAutoStyles, bIsProgress );
bPrevCharIsSpace = sal_False;
}
else if( sType.equals( sFrame ) )
@@ -2217,6 +2217,10 @@ void XMLTextParagraphExport::exportTextRangeEnumeration(
{
exportRuby(xPropSet, bAutoStyles);
}
+ else if (sType.equals(sMeta))
+ {
+ exportMeta(xPropSet, bAutoStyles, bIsProgress);
+ }
else if (sType.equals(sTextFieldStart))
{
Reference<XNamed> xBookmark(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
@@ -2286,7 +2290,7 @@ void XMLTextParagraphExport::exportTextRangeEnumeration(
Reference<XServiceInfo> xServiceInfo( xTxtRange, UNO_QUERY );
if( xServiceInfo->supportsService( sTextFieldService ) )
{
- exportTextField( xTxtRange, bAutoStyles );
+ exportTextField( xTxtRange, bAutoStyles, bIsProgress );
bPrevCharIsSpace = sal_False;
}
else
@@ -2308,7 +2312,7 @@ void XMLTextParagraphExport::exportTable(
void XMLTextParagraphExport::exportTextField(
const Reference < XTextRange > & rTextRange,
- sal_Bool bAutoStyles )
+ sal_Bool bAutoStyles, sal_Bool bIsProgress )
{
Reference < XPropertySet > xPropSet( rTextRange, UNO_QUERY );
// non-Writer apps need not support Property TextField, so test first
@@ -2320,11 +2324,11 @@ void XMLTextParagraphExport::exportTextField(
{
if( bAutoStyles )
{
- pFieldExport->ExportFieldAutoStyle( xTxtFld );
+ pFieldExport->ExportFieldAutoStyle( xTxtFld, bIsProgress );
}
else
{
- pFieldExport->ExportField( xTxtFld );
+ pFieldExport->ExportField( xTxtFld, bIsProgress );
}
}
else
@@ -3634,7 +3638,41 @@ void XMLTextParagraphExport::exportRuby(
}
}
+// FIXME: this is untested
+void XMLTextParagraphExport::exportMeta(
+ const Reference<XPropertySet> & i_xMeta,
+ sal_Bool i_bAutoStyles, sal_Bool i_isProgress)
+{
+ bool doExport(!i_bAutoStyles); // do not export element if autostyles
+ // check version >= 1.2
+ switch (GetExport().getDefaultVersion()) {
+ case SvtSaveOptions::ODFVER_011: // fall thru
+ case SvtSaveOptions::ODFVER_010: doExport = false; break;
+ default: break;
+ }
+
+ const Reference < XEnumerationAccess > xEA( i_xMeta, UNO_QUERY_THROW );
+ const Reference < XEnumeration > xTextEnum( xEA->createEnumeration() );
+ if (doExport)
+ {
+ const Reference<rdf::XMetadatable> xMeta( i_xMeta, UNO_QUERY_THROW );
+ const Reference<XTextContent> xTextContent( i_xMeta, UNO_QUERY_THROW );
+
+ // text:meta with neither xml:id nor RDFa is invalid
+ xMeta->ensureMetadataReference();
+
+ // xml:id and RDFa for RDF metadata
+ GetExport().AddAttributeXmlId(xMeta);
+ GetExport().AddAttributesRDFa(xTextContent);
+ }
+
+ SvXMLElementExport aElem( GetExport(), doExport,
+ XML_NAMESPACE_TEXT, XML_META, sal_False, sal_False );
+
+ // recurse to export content
+ exportTextRangeEnumeration( xTextEnum, i_bAutoStyles, i_isProgress );
+}
void XMLTextParagraphExport::PreventExportOfControlsInMuteSections(
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index 31d2891f9f79..6fb213f43642 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -671,34 +671,33 @@ SvXMLImportContext *XMLImpRubyContext_Impl::CreateChildContext(
// ---------------------------------------------------------------------
-/** text:meta and text:meta-field
-//FIXME neither finished nor tested
+/** for text:meta and text:meta-field
+//FIXME not tested
*/
-class XMLMetaImportContext : public SvXMLImportContext
+class XMLMetaImportContextBase : public SvXMLImportContext
{
- XMLHints_Impl& mrHints;
-// XMLStyleHint_Impl *pHint;
+ XMLHints_Impl& m_rHints;
- sal_Bool& mrIgnoreLeadingSpace;
+ sal_Bool& m_rIgnoreLeadingSpace;
/// start position
- Reference<XTextRange> mxStart;
+ Reference<XTextRange> m_xStart;
- OUString mXmlId;
+protected:
+ OUString m_XmlId;
public:
TYPEINFO();
- XMLMetaImportContext(
+ XMLMetaImportContextBase(
SvXMLImport& i_rImport,
sal_uInt16 i_nPrefix,
const OUString& i_rLocalName,
const Reference< xml::sax::XAttributeList > & i_xAttrList,
-// enum XMLTextPElemTokens nTok,
XMLHints_Impl& i_rHints,
sal_Bool & i_rIgnoreLeadingSpace );
- virtual ~XMLMetaImportContext();
+ virtual ~XMLMetaImportContextBase();
virtual void EndElement();
@@ -707,25 +706,30 @@ public:
const Reference< xml::sax::XAttributeList > & i_xAttrList );
virtual void Characters( const OUString& i_rChars );
+
+ virtual void ProcessAttribute(sal_uInt16 const i_nPrefix,
+ OUString const & i_rLocalName, OUString const & i_rValue);
+
+ virtual void InsertMeta(const Reference<XTextRange> & i_xInsertionRange)
+ = 0;
};
-TYPEINIT1( XMLMetaImportContext , SvXMLImportContext );
+TYPEINIT1( XMLMetaImportContextBase, SvXMLImportContext );
-XMLMetaImportContext::XMLMetaImportContext(
+XMLMetaImportContextBase::XMLMetaImportContextBase(
SvXMLImport& i_rImport,
sal_uInt16 i_nPrefix,
const OUString& i_rLocalName,
const Reference< xml::sax::XAttributeList > & i_xAttrList,
XMLHints_Impl& i_rHints,
sal_Bool & i_rIgnoreLeadingSpace )
- : SvXMLImportContext( i_rImport, i_nPrefix, i_rLocalName ),
- mrHints( i_rHints ),
- mrIgnoreLeadingSpace( i_rIgnoreLeadingSpace ),
- mxStart()
+ : SvXMLImportContext( i_rImport, i_nPrefix, i_rLocalName )
+ , m_rHints( i_rHints )
+ , m_rIgnoreLeadingSpace( i_rIgnoreLeadingSpace )
+ , m_xStart()
{
-//FIXME: RDFa (text:meta)
const sal_Int16 nAttrCount(i_xAttrList.is() ? i_xAttrList->getLength() : 0);
- for( sal_Int16 i=0; i < nAttrCount; i++ )
+ for ( sal_Int16 i=0; i < nAttrCount; i++ )
{
const OUString& rAttrName( i_xAttrList->getNameByIndex( i ) );
const OUString& rValue( i_xAttrList->getValueByIndex( i ) );
@@ -734,49 +738,61 @@ XMLMetaImportContext::XMLMetaImportContext(
sal_uInt16 nPrefix =
GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
&sLocalName );
-// FIXME: only meta-field
- if( XML_NAMESPACE_TEXT == nPrefix &&
- IsXMLToken( sLocalName, XML_DATA_STYLE_NAME ) )
- {
-// pHint->SetStyleName( rValue );
- break;
- }
- else if ( (XML_NAMESPACE_XML == nPrefix) &&
- IsXMLToken(sLocalName, XML_ID) )
- {
- mXmlId = rValue;
- }
+ ProcessAttribute(nPrefix, sLocalName, rValue);
}
- //FIXME meta-field xml:id mandatory
- mxStart = GetImport().GetTextImport()->GetCursorAsRange()->getStart();
+ m_xStart = GetImport().GetTextImport()->GetCursorAsRange()->getStart();
}
-XMLMetaImportContext::~XMLMetaImportContext()
+XMLMetaImportContextBase::~XMLMetaImportContextBase()
{
}
-void XMLMetaImportContext::EndElement()
+void XMLMetaImportContextBase::EndElement()
{
- OSL_ENSURE(mxStart.is(), "no mxStart?");
+ OSL_ENSURE(m_xStart.is(), "no mxStart?");
+ if (!m_xStart.is()) return;
- Reference<XTextRange> xEndRange(
+ const Reference<XTextRange> xEndRange(
GetImport().GetTextImport()->GetCursorAsRange()->getStart() );
// create range for insertion
- Reference<XTextCursor> xInsertionCursor(
+ const Reference<XTextCursor> xInsertionCursor(
GetImport().GetTextImport()->GetText()->createTextCursorByRange(
xEndRange) );
- xInsertionCursor->gotoRange(mxStart, sal_True);
+ xInsertionCursor->gotoRange(m_xStart, sal_True);
- Reference<XTextRange> xInsertionRange(xInsertionCursor, UNO_QUERY);
+ const Reference<XTextRange> xInsertionRange(xInsertionCursor, UNO_QUERY);
- OUString sName;
+ InsertMeta(xInsertionRange);
//FIXME
- // insert bookmark
-// XMLTextMarkImportContext::CreateAndInsertMark
+#if 0
+ Reference<XMultiServiceFactory> xFactory(rImport.GetModel(), UNO_QUERY);
+ if ( xFactory.is() )
+ {
+ Reference<XInterface> xIfc = xFactory->createInstance(sServiceName);
+
+ // xml:id for RDF metadata
+ rImport.SetXmlId(xIfc, i_rXmlId);
+
+ // cast to XTextContent and attach to document
+ Reference<XTextContent> xTextContent(xIfc, UNO_QUERY);
+ if (xTextContent.is())
+ {
+ try
+ {
+ rImport.GetTextImport()->GetText()->insertTextContent(
+ xInsertionRange, xTextContent, sal_True);
+ }
+ catch (com::sun::star::lang::IllegalArgumentException &)
+ {
+ OSL_ENSURE(false, "XMLMetaImportContext::EndElement: iae");
+ }
+ }
+ }
+#endif
}
-SvXMLImportContext * XMLMetaImportContext::CreateChildContext(
+SvXMLImportContext * XMLMetaImportContextBase::CreateChildContext(
sal_uInt16 i_nPrefix, const OUString& i_rLocalName,
const Reference< xml::sax::XAttributeList > & i_xAttrList )
{
@@ -785,15 +801,236 @@ SvXMLImportContext * XMLMetaImportContext::CreateChildContext(
sal_uInt16 nToken = rTokenMap.Get( i_nPrefix, i_rLocalName );
return XMLImpSpanContext_Impl::CreateChildContext( GetImport(), i_nPrefix,
- i_rLocalName, i_xAttrList, nToken, mrHints, mrIgnoreLeadingSpace );
+ i_rLocalName, i_xAttrList, nToken, m_rHints, m_rIgnoreLeadingSpace );
}
-void XMLMetaImportContext::Characters( const OUString& i_rChars )
+void XMLMetaImportContextBase::Characters( const OUString& i_rChars )
{
- //FIXME do we need to call ConvertStarFonts?
- GetImport().GetTextImport()->InsertString( i_rChars, mrIgnoreLeadingSpace );
+ GetImport().GetTextImport()->InsertString(i_rChars, m_rIgnoreLeadingSpace);
}
+void XMLMetaImportContextBase::ProcessAttribute(sal_uInt16 const i_nPrefix,
+ OUString const & i_rLocalName, OUString const & i_rValue)
+{
+ if ( (XML_NAMESPACE_XML == i_nPrefix) &&
+ IsXMLToken(i_rLocalName, XML_ID) )
+ {
+ m_XmlId = i_rValue;
+ }
+}
+
+
+// ---------------------------------------------------------------------
+
+/** text:meta
+//FIXME not tested
+ */
+class XMLMetaImportContext : public XMLMetaImportContextBase
+{
+ // RDFa
+ bool m_bHaveAbout;
+ ::rtl::OUString m_sAbout;
+ ::rtl::OUString m_sProperty;
+ ::rtl::OUString m_sContent;
+ ::rtl::OUString m_sDatatype;
+
+public:
+ TYPEINFO();
+
+ XMLMetaImportContext(
+ SvXMLImport& i_rImport,
+ sal_uInt16 i_nPrefix,
+ const OUString& i_rLocalName,
+ const Reference< xml::sax::XAttributeList > & i_xAttrList,
+ XMLHints_Impl& i_rHints,
+ sal_Bool & i_rIgnoreLeadingSpace );
+
+ virtual void ProcessAttribute(sal_uInt16 const i_nPrefix,
+ OUString const & i_rLocalName, OUString const & i_rValue);
+
+ virtual void InsertMeta(const Reference<XTextRange> & i_xInsertionRange);
+};
+
+TYPEINIT1( XMLMetaImportContext, XMLMetaImportContextBase );
+
+XMLMetaImportContext::XMLMetaImportContext(
+ SvXMLImport& i_rImport,
+ sal_uInt16 i_nPrefix,
+ const OUString& i_rLocalName,
+ const Reference< xml::sax::XAttributeList > & i_xAttrList,
+ XMLHints_Impl& i_rHints,
+ sal_Bool & i_rIgnoreLeadingSpace )
+ : XMLMetaImportContextBase( i_rImport, i_nPrefix, i_rLocalName,
+ i_xAttrList, i_rHints, i_rIgnoreLeadingSpace )
+ , m_bHaveAbout(false)
+{
+}
+
+void XMLMetaImportContext::ProcessAttribute(sal_uInt16 const i_nPrefix,
+ OUString const & i_rLocalName, OUString const & i_rValue)
+{
+ if ( XML_NAMESPACE_XHTML == i_nPrefix )
+ {
+ // RDFa
+ if ( IsXMLToken( i_rLocalName, XML_ABOUT) )
+ {
+ m_sAbout = i_rValue;
+ m_bHaveAbout = true;
+ }
+ else if ( IsXMLToken( i_rLocalName, XML_PROPERTY) )
+ {
+ m_sProperty = i_rValue;
+ }
+ else if ( IsXMLToken( i_rLocalName, XML_CONTENT) )
+ {
+ m_sContent = i_rValue;
+ }
+ else if ( IsXMLToken( i_rLocalName, XML_DATATYPE) )
+ {
+ m_sDatatype = i_rValue;
+ }
+ }
+ else
+ {
+ XMLMetaImportContextBase::ProcessAttribute(
+ i_nPrefix, i_rLocalName, i_rValue);
+ }
+}
+
+void XMLMetaImportContext::InsertMeta(
+ const Reference<XTextRange> & i_xInsertionRange)
+{
+ OSL_ENSURE(!m_bHaveAbout == !m_sProperty.getLength(),
+ "XMLMetaImportContext::InsertMeta: invalid RDFa?");
+ if (m_XmlId.getLength() || (m_bHaveAbout && m_sProperty.getLength()))
+ {
+ // insert mark
+ const uno::Reference<rdf::XMetadatable> xMeta(
+ XMLTextMarkImportContext::CreateAndInsertMark(
+ GetImport(),
+ OUString::createFromAscii(
+ "com.sun.star.text.InContentMetadata"),
+ OUString(),
+ i_xInsertionRange, m_XmlId),
+ uno::UNO_QUERY);
+ OSL_ENSURE(xMeta.is(), "cannot insert Meta?");
+
+ if (xMeta.is() && m_bHaveAbout)
+ {
+ GetImport().AddRDFa(xMeta,
+ m_sAbout, m_sProperty, m_sContent, m_sDatatype);
+ }
+ }
+ else
+ {
+ OSL_TRACE("invalid <text:meta>: no xml:id, no valid RDFa");
+ }
+}
+
+// ---------------------------------------------------------------------
+
+/** text:meta-field
+//FIXME not tested
+ */
+class XMLMetaFieldImportContext : public XMLMetaImportContextBase
+{
+ OUString m_DataStyleName;
+
+public:
+ TYPEINFO();
+
+ XMLMetaFieldImportContext(
+ SvXMLImport& i_rImport,
+ sal_uInt16 i_nPrefix,
+ const OUString& i_rLocalName,
+ const Reference< xml::sax::XAttributeList > & i_xAttrList,
+ XMLHints_Impl& i_rHints,
+ sal_Bool & i_rIgnoreLeadingSpace );
+
+ virtual void ProcessAttribute(sal_uInt16 const i_nPrefix,
+ OUString const & i_rLocalName, OUString const & i_rValue);
+
+ virtual void InsertMeta(const Reference<XTextRange> & i_xInsertionRange);
+};
+
+TYPEINIT1( XMLMetaFieldImportContext, XMLMetaImportContextBase );
+
+XMLMetaFieldImportContext::XMLMetaFieldImportContext(
+ SvXMLImport& i_rImport,
+ sal_uInt16 i_nPrefix,
+ const OUString& i_rLocalName,
+ const Reference< xml::sax::XAttributeList > & i_xAttrList,
+ XMLHints_Impl& i_rHints,
+ sal_Bool & i_rIgnoreLeadingSpace )
+ : XMLMetaImportContextBase( i_rImport, i_nPrefix, i_rLocalName,
+ i_xAttrList, i_rHints, i_rIgnoreLeadingSpace )
+{
+}
+
+void XMLMetaFieldImportContext::ProcessAttribute(sal_uInt16 const i_nPrefix,
+ OUString const & i_rLocalName, OUString const & i_rValue)
+{
+ if( XML_NAMESPACE_STYLE == i_nPrefix &&
+ IsXMLToken( i_rLocalName, XML_DATA_STYLE_NAME ) )
+ {
+ m_DataStyleName = i_rValue;
+ }
+ else
+ {
+ XMLMetaImportContextBase::ProcessAttribute(
+ i_nPrefix, i_rLocalName, i_rValue);
+ }
+}
+
+void XMLMetaFieldImportContext::InsertMeta(
+ const Reference<XTextRange> & i_xInsertionRange)
+{
+ if (m_XmlId.getLength()) // valid?
+ {
+ // insert mark
+ const Reference<XPropertySet> xPropertySet(
+ XMLTextMarkImportContext::CreateAndInsertMark(
+ GetImport(),
+ OUString::createFromAscii(
+ "com.sun.star.text.textfield.MetadataField"),
+ OUString(),
+ i_xInsertionRange, m_XmlId),
+ UNO_QUERY);
+ OSL_ENSURE(xPropertySet.is(), "cannot insert MetaField?");
+ if (!xPropertySet.is()) return;
+
+ if (m_DataStyleName.getLength())
+ {
+ sal_Bool isDefaultLanguage(sal_True);
+
+ const sal_Int32 nKey( GetImport().GetTextImport()->GetDataStyleKey(
+ m_DataStyleName, & isDefaultLanguage) );
+
+ if (-1 != nKey)
+ {
+ static ::rtl::OUString sPropertyIsFixedLanguage(
+ ::rtl::OUString::createFromAscii("IsFixedLanguage") );
+ Any any;
+ any <<= nKey;
+ xPropertySet->setPropertyValue(
+ OUString::createFromAscii("NumberFormat"), any);
+ if ( xPropertySet->getPropertySetInfo()->
+ hasPropertyByName( sPropertyIsFixedLanguage ) )
+ {
+ any <<= static_cast<bool>(!isDefaultLanguage);
+ xPropertySet->setPropertyValue( sPropertyIsFixedLanguage,
+ any );
+ }
+ }
+ }
+ }
+ else
+ {
+ OSL_TRACE("invalid <text:meta-field>: no xml:id");
+ }
+}
+
+
// ---------------------------------------------------------------------
@@ -1574,13 +1811,17 @@ SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext(
sal_False);
break;
- case XML_TOK_TEXT_META:
- case XML_TOK_TEXT_META_FIELD:
// FIXME: should test before enabling...
#if 0
+ case XML_TOK_TEXT_META:
pContext = new XMLMetaImportContext(rImport, nPrefix, rLocalName,
xAttrList, rHints, rIgnoreLeadingSpace );
break;
+
+ case XML_TOK_TEXT_META_FIELD:
+ pContext = new XMLMetaFieldImportContext(rImport, nPrefix, rLocalName,
+ xAttrList, rHints, rIgnoreLeadingSpace );
+ break;
#endif
default:
@@ -1657,6 +1898,7 @@ XMLParaContext::XMLParaContext(
sal_Bool bHead ) :
SvXMLImportContext( rImport, nPrfx, rLName ),
xStart( rImport.GetTextImport()->GetCursorAsRange()->getStart() ),
+ m_bHaveAbout(false),
nOutlineLevel( IsXMLToken( rLName, XML_H ) ? 1 : -1 ),
pHints( 0 ),
// --> OD 2007-07-25 #i73509#
@@ -1686,9 +1928,21 @@ XMLParaContext::XMLParaContext(
&aLocalName );
switch( rTokenMap.Get( nPrefix, aLocalName ) )
{
-//FIXME: RDFa
case XML_TOK_TEXT_P_XMLID:
- sXmlId = rValue;
+ m_sXmlId = rValue;
+ break;
+ case XML_TOK_TEXT_P_ABOUT:
+ m_sAbout = rValue;
+ m_bHaveAbout = true;
+ break;
+ case XML_TOK_TEXT_P_PROPERTY:
+ m_sProperty = rValue;
+ break;
+ case XML_TOK_TEXT_P_CONTENT:
+ m_sContent = rValue;
+ break;
+ case XML_TOK_TEXT_P_DATATYPE:
+ m_sDatatype = rValue;
break;
case XML_TOK_TEXT_P_STYLE_NAME:
sStyleName = rValue;
@@ -1785,7 +2039,8 @@ XMLParaContext::~XMLParaContext()
xAttrCursor->gotoRange( xEnd, sal_True );
// xml:id for RDF metadata
- if (sXmlId.getLength() > 0) {
+ if (m_sXmlId.getLength() || m_bHaveAbout || m_sProperty.getLength())
+ {
try {
const uno::Reference<container::XEnumerationAccess> xEA
(xAttrCursor, uno::UNO_QUERY_THROW);
@@ -1795,12 +2050,17 @@ XMLParaContext::~XMLParaContext()
if (xEnum->hasMoreElements()) {
uno::Reference<rdf::XMetadatable> xMeta;
xEnum->nextElement() >>= xMeta;
-//FIXME not yet
-// OSL_ENSURE(xMeta.is(), "xml:id: not XMetadatable");
- GetImport().SetXmlId(xMeta, sXmlId);
+ OSL_ENSURE(xMeta.is(), "xml:id: not XMetadatable");
+ GetImport().SetXmlId(xMeta, m_sXmlId);
+ if (m_bHaveAbout)
+ {
+ GetImport().AddRDFa(xMeta,
+ m_sAbout, m_sProperty, m_sContent, m_sDatatype);
+ }
OSL_ENSURE(!xEnum->hasMoreElements(), "xml:id: > 1 paragraph?");
}
} catch (uno::Exception &) {
+ OSL_TRACE("XMLParaContext::~XMLParaContext: exception");
}
}
diff --git a/xmloff/source/text/txtparai.hxx b/xmloff/source/text/txtparai.hxx
index 781055d2f297..6eaeeee1ee46 100644
--- a/xmloff/source/text/txtparai.hxx
+++ b/xmloff/source/text/txtparai.hxx
@@ -50,7 +50,12 @@ class XMLParaContext : public SvXMLImportContext
::com::sun::star::text::XTextRange > xStart; // xub_StrLen nStart;
::rtl::OUString sStyleName;
::rtl::OUString sId;
- ::rtl::OUString sXmlId;
+ ::rtl::OUString m_sXmlId;
+ ::rtl::OUString m_sAbout;
+ ::rtl::OUString m_sProperty;
+ ::rtl::OUString m_sContent;
+ ::rtl::OUString m_sDatatype;
+ bool m_bHaveAbout;
sal_Int8 nOutlineLevel;
XMLHints_Impl *pHints;
// --> OD 2007-07-25 #i73509#
diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx
index 18946de8c3a6..c82e4d09e271 100644
--- a/xmloff/source/text/txtprmap.cxx
+++ b/xmloff/source/text/txtprmap.cxx
@@ -372,7 +372,7 @@ XMLPropertyMapEntry aXMLParaPropMap[] =
// RES_PARATR_SNAPTOGRID
MP_E( "SnapToGrid", STYLE, SNAP_TO_LAYOUT_GRID, XML_TYPE_BOOL, 0 ),
- MP_ED( "WritingMode", STYLE, WRITING_MODE, XML_TYPE_TEXT_WRITING_MODE_WITH_DEFAULT, 0 ),
+ MP_ED( "WritingMode", STYLE, WRITING_MODE, XML_TYPE_TEXT_WRITING_MODE_WITH_DEFAULT, CTF_TEXTWRITINGMODE ),
MP_E( "ParaIsConnectBorder", STYLE, JOIN_BORDER, XML_TYPE_BOOL, 0 ),
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
index 6e5f91f7f741..9535d8a46c1a 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
@@ -33,6 +33,7 @@
#include "exp_share.hxx"
#include <rtl/ustrbuf.hxx>
+#include <tools/diagnose_ex.h>
#include <com/sun/star/awt/CharSet.hpp>
#include <com/sun/star/awt/FontFamily.hpp>
@@ -996,6 +997,24 @@ void ElementDescriptor::readDefaults( bool supportPrintable )
OSL_ENSURE( 0, "unexpected property type for \"Enabled\": not bool!" );
}
+ sal_Bool bVisible = sal_True;
+ try
+ {
+ if (_xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("EnableVisible") ) ) >>= bVisible)
+ {
+
+ // only write out the non default case
+ if (! bVisible)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":visible") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
// force writing of pos/size
a = _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("PositionX") ) );
if (a.getValueTypeClass() == TypeClass_LONG)
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
index f02b9d46b2aa..78b2fed46673 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
@@ -33,6 +33,7 @@
#include "imp_share.hxx"
#include <osl/diagnose.h>
+#include <tools/diagnose_ex.h>
#include <osl/mutex.hxx>
#include <rtl/ustrbuf.hxx>
@@ -1612,6 +1613,23 @@ void ImportContext::importDefaults(
OUString( RTL_CONSTASCII_USTRINGPARAM("Enabled") ), makeAny( sal_False ) );
}
+ sal_Bool bVisible = sal_True;
+ if (getBoolAttr(
+ &bVisible, OUString( RTL_CONSTASCII_USTRINGPARAM("visible") ),
+ xAttributes, _pImport->XMLNS_DIALOGS_UID ) && !bVisible)
+ {
+ try
+ {
+
+ _xControlModel->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("EnableVisible") ), makeAny( sal_False ) );
+ }
+ catch( Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
if (!importLongProperty( nBaseX,
OUString( RTL_CONSTASCII_USTRINGPARAM("PositionX") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("left") ),